Categorie: reference Bijgewerkt: 2026-04-08 actionfield workflow actionfield765

ActionField765

Beschrijving: Insert new ObjectLandRegistry with a BuildingPart. Custom: Nee

Propertiesbewerken

Property Type Accessor
LandRegistry LandRegistry Root

XMLbewerken

<Workflow Name="ActionField765" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Insert new ObjectLandRegistry with a BuildingPart.</Description>
	<Properties>
		<Property	Name="LandRegistry"					Type="LandRegistry"				Accessor="Root"		Direction="In" />

		<Property	Name="BuildingList"					Type="List[Building]"			Accessor="Internal" />
		<Property	Name="CreatedObjectLandRegistry"	Type="ObjectLandRegistry"		Accessor="Internal" />
		<Property	Name="ObjectLandRegistryCount"		Type="Int64"					Accessor="Internal"						Default="0" />
		<Property	Name="ObjectLandRegistryList"		Type="List[ObjectLandRegistry]"	Accessor="Internal" />
		<Property	Name="SelectedBuildingPart"			Type="BuildingPart"				Accessor="Internal" />
		<Property	Name="SQLWhereClause"				Type="String"					Accessor="Internal"						Default="Empty"	Comment="where not (BldpBldId = '0' and BldpId = '0') and not (BldpBldId = '1' and BldpId = '1') and ..." />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Comment><![CDATA[
First get a list of all BuildingParts already linked to the root LandRegistry and use that list to build a SQL Where clause to use in the SelectDomainObject. 
When a BuildingPart is selected, validate that this BuildingPart is not linked to the root LandRegistry yet (this validation should never fail, because of the previous SQl Where clause). 
Next, validate if the BuildingParts Building (or parent complex) is not already linked to the root LandRegistry. 
To do this, check if BuildingParts Building is part of a complex. If it is, add the parent building. 
Add the BuildingParts Building itself to the list as well. Now check to see if there are any ObjectLandRegistries for the root LandRegistry and the buildings in the list. 
There could be a record either for a Building, a complex or none. There shouldn't any situations where both a Building and a complex are linked as this is validated against in WF764.		
		]]></Comment>

		<Transaction>
			<GetList Name="GetObjectLandRegistriesWithBuildingPartForThisLandRegistry" Type="ObjectLandRegistry" OutputProperty="${ObjectLandRegistryList}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="LandRegistry"	Operator="="		PropertyValue="${LandRegistry}" />
					<NotFilter>
						<PropertyEmptyFilter PropertyName="BuildingPart" />
					</NotFilter>
				</Filters>
			</GetList>

			<When Name="WhenObjectLandRegistryListNotEmpty" Condition="${ObjectLandRegistryList.Count} != 0">
				<ForEach Name="ForEachObjectLandRegistry" In="${ObjectLandRegistryList}" As="ObjectLandRegistryItem">
					<When Name="WhenSQLWhereClauseNotEmpty" Condition="${SQLWhereClause} != Empty">
						<Assign Name="Add ' and ' " Property="${SQLWhereClause}" Value="${SQLWhereClause} and " />
					</When>

					<Assign Name="Add Ids" Property="${SQLWhereClause}" Value="${SQLWhereClause} not (BldpBldId='${ObjectLandRegistryItem.BuildingPart.Id.Building.Id}' and BldpId='${ObjectLandRegistryItem.BuildingPart.Id.Id}')" Comment="For each found BuildingPart add 'not (BldpBldId = xx and BldpId = xx)' to uniquely identify that BuildingPart" />
				</ForEach>
			</When>
		</Transaction>

		<SystemDialog Name="SelectDomainObject" DialogName="SelectDomainObject">
			<Parameter	Name="EntityName"					Direction="In"		Value="BuildingPart" />
			<Parameter	Name="SelectionListConfiguration"	Direction="In"		Value="Default" />
			<Parameter	Name="SqlWhereClause"				Direction="In"		Value="${SQLWhereClause}" />
			<Parameter	Name="DomainObject"					Direction="Out"									OutputProperty="${SelectedBuildingPart}" />
		</SystemDialog>

		<Transaction>
			<GetCount Name="CountObjectLandRegistriesForTheSelectedBuildingPart" Type="ObjectLandRegistry" OutputProperty="${ObjectLandRegistryCount}">
				<Filters>
					<PropertyFilter	PropertyName="LandRegistry"	Operator="="		PropertyValue="${LandRegistry}" />
					<PropertyFilter	PropertyName="BuildingPart"	Operator="="		PropertyValue="${SelectedBuildingPart}" />
				</Filters>
			</GetCount>

			<Validation Name="ValidateIfLandRegistryIsNotLinkedToSelectedBuildingPartAlready" Condition="${ObjectLandRegistryCount} == 0" MessageCode="1512">
				<Parameter	Name="BuildingPart"	Direction="In"		Value="${SelectedBuildingPart}" />
			</Validation>

			<When Name="WhenBuildingPartsBuildingIsPartOfComplex" Condition="${SelectedBuildingPart.Id.Building.ComplexBuilding} != Empty">
				<AddToList Name="AddComplexParentToList" List="${BuildingList}" Item="${SelectedBuildingPart.Id.Building.ComplexBuilding}" />
			</When>

			<AddToList Name="AddSelectedBuildingToList" List="${BuildingList}" Item="${SelectedBuildingPart.Id.Building}" />

			<GetList Name="GetObjectLandRegistriesForBuildingsInList" Type="ObjectLandRegistry" OutputProperty="${ObjectLandRegistryList}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="LandRegistry"	Operator="="		PropertyValue="${LandRegistry}" />
					<InFilter PropertyName="Building" Values="${BuildingList}" />
				</Filters>
			</GetList>

			<When Name="WhenObjectLandRegistryListNotEmpty" Condition="${ObjectLandRegistryList.Count} != 0">
				<ForEach Name="ForEachObjectLandRegistry" In="${ObjectLandRegistryList}" As="ObjectLandRegistryItem">
					<Validation Name="ValidateIfSelectedBuildingPartHasItsBuildingOrComplexAdded" Condition="${ObjectLandRegistryList.Count} == 0" MessageCode="1513">
						<Parameter	Name="Building"		Direction="In"		Value="${ObjectLandRegistryItem.Building}" />
						<Parameter	Name="BuildingPart"	Direction="In"		Value="${SelectedBuildingPart}" />
					</Validation>
				</ForEach>
			</When>

			<Insert Name="Insert ObjectLandRegistry" ObjectType="ObjectLandRegistry" OutputProperty="${CreatedObjectLandRegistry}">
				<Parameter	Name="BuildingPart"	Direction="In"		Value="${SelectedBuildingPart}" />
				<Parameter	Name="LandRegistry"	Direction="In"		Value="${LandRegistry}" />
			</Insert>
		</Transaction>

		<UserContent Name="Post" />
	</Execution>
</Workflow>