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

ActionField1204

Beschrijving: Create CadImportProfilePropertyRules for CadImportProfileProperty. Custom: Nee

Propertiesbewerken

Property Type Accessor
CadImportProfileProperty CadImportProfileProperty Root
DefaultMatchingProperty UltimoString Optional
EntityContext Context Optional
EntityName UltimoString Optional

XMLbewerken

<Workflow Name="ActionField1204" Version="2025.07.28" WorkflowType="Standard" xmlns="urn:Ultimo.Framework.Workflow-mapping">
	<Security EditLevel="10" ViewLevel="20" UserContentLevel="30" />
	<Description>Create CadImportProfilePropertyRules for CadImportProfileProperty.</Description>
	<Properties>
		<Property	Name="CadImportProfileProperty"	Type="CadImportProfileProperty"				Accessor="Root"		Direction="In" />

		<Property	Name="DefaultMatchingProperty"	Type="UltimoString"							Accessor="Optional"	Direction="In"		Default="Id"					Comment="Default value for matching property for foreign keys, defaults to 'Id'." />
		<Property	Name="EntityContext"			Type="Context"								Accessor="Optional"	Direction="In"		Default="SpaceContext.Space"	Comment="Default context for entity, defaults to 'SpaceContext.Space'." />
		<Property	Name="EntityName"				Type="UltimoString"							Accessor="Optional"	Direction="In"		Default="Space"					Comment="Default entity that TargetProperty/TargetFeature are related to, defaults to 'Space'." />

		<Property	Name="CreatedRule"				Type="CadImportProfilePropertyRule"			Accessor="Internal" />
		<Property	Name="CurrentRules"				Type="List[CadImportProfilePropertyRule]"	Accessor="Internal" />
		<Property	Name="DefaultAction"			Type="CadImportRuleAction"					Accessor="Internal" />
		<Property	Name="NewRules"					Type="List[CadImportRule]"					Accessor="Internal" />
		<Property	Name="PropertyExists"			Type="Boolean"								Accessor="Internal" />
		<Property	Name="PropertyIsForeignKey"		Type="Boolean"								Accessor="Internal" />
		<Property	Name="RuleType"					Type="CadImportRuleType"					Accessor="Internal" />
	</Properties>
	<Execution>
		<UserContent Name="Pre" />

		<Transaction>
			<GetList Name="Get current profile property rules" Type="CadImportProfilePropertyRule" OutputProperty="${CurrentRules}" OrderBy="Id" OrderDirection="Ascending">
				<Filters>
					<PropertyFilter	PropertyName="CadImportProfileProperty"	Operator="="		PropertyValue="${CadImportProfileProperty}" />
				</Filters>
			</GetList>

			<ForEach Name="Loop current rules" In="${CurrentRules}" As="CurrentRule">
				<TrashObject Name="Trash rule" DomainObject="${CurrentRule}" />
			</ForEach>

			<Choose Name="Check if either TargetProperty or TargetFeature is filled">
				<When Name="TargetProperty or TargetFeature not empty" Condition="${CadImportProfileProperty.TargetProperty} != Empty || ${CadImportProfileProperty.TargetFeature} != Empty">
					<Choose Name="TargetProperty or TargetFeature">
						<When Name="TargetProperty" Condition="${CadImportProfileProperty.TargetProperty} != Empty">
							<Command Name="Determine property type" CommandName="HasPropertyOrForeignKey">
								<Parameter	Name="EntityName"							Direction="In"		Value="${EntityName}" />
								<Parameter	Name="PropertyName"							Direction="In"		Value="${CadImportProfileProperty.TargetProperty}" />
								<Parameter	Name="ThrowExceptionWhenPropertyNotValid"	Direction="In"		Value="False" />
								<Parameter	Name="PropertyExists"						Direction="Out"															OutputProperty="${PropertyExists}" />
								<Parameter	Name="PropertyIsForeignKey"					Direction="Out"															OutputProperty="${PropertyIsForeignKey}" />
							</Command>

							<Validation Name="ValidateTargetPropertyIsPropertyOnEntity" Condition="${PropertyExists} == True" MessageCode="2471">
								<Parameter	Name="EntityName"	Direction="In"		Value="#contextdescription_capital(${EntityName} ${EntityContext})" />
								<Parameter	Name="PropertyName"	Direction="In"		Value="${CadImportProfileProperty.TargetProperty}" />
							</Validation>

							<Choose Name="Property or Foreign key">
								<When Name="Property" Condition="${PropertyIsForeignKey} == False">
									<Assign Name="Set rule type to property" Property="${RuleType}" Value="Property" />
								</When>

								<Otherwise Name="Foreign key">
									<Assign Name="Set rule type to foreign key" Property="${RuleType}" Value="ForeignKey" />
									<AssignWhenEmpty Name="Set default matching property for foreign key" Property="${CadImportProfileProperty.RelatedEntityMatchingProperty}" Value="${DefaultMatchingProperty}" />
								</Otherwise>
							</Choose>
						</When>


						<When Name="TargetFeature" Condition="${CadImportProfileProperty.TargetFeature} != Empty">
							<Assign Name="Set rule type to feature" Property="${RuleType}" Value="Feature" />
						</When>
					</Choose>

					<GetList Name="Get active rules for type" Type="CadImportRule" OutputProperty="${NewRules}" OrderBy="Id" OrderDirection="Ascending">
						<Filters>
							<PropertyFilter	PropertyName="Status"	Operator="="		PropertyValue="CadImportRuleStatus.Active" />
							<PropertyFilter	PropertyName="Context"	Operator="="		PropertyValue="CadImportRuleContext.CadImportRuleSpace" />
							<PropertyFilter	PropertyName="Type"		Operator="="		PropertyValue="${RuleType}" />
						</Filters>
					</GetList>

					<ForEach Name="Loop found rules" In="${NewRules}" As="NewRule">
						<GetItem Name="Get default action" Type="CadImportRuleAction" OutputProperty="${DefaultAction}">
							<Filters>
								<PropertyFilter	PropertyName="CadImportRule"	Operator="="		PropertyValue="${NewRule}" />
								<PropertyFilter	PropertyName="IsDefault"		Operator="="		PropertyValue="True" />
							</Filters>
						</GetItem>

						<Insert Name="Insert rule" ObjectType="CadImportProfilePropertyRule" OutputProperty="${CreatedRule}">
							<Parameter	Name="Context"						Direction="In"		Value="CadImportProfilePropertyRuleContext.CadImportProfilePropertyRule" />
							<Parameter	Name="AskUserForAction"				Direction="In"		Value="${NewRule.AskUserForAction}" />
							<Parameter	Name="CadImportProfileProperty"		Direction="In"		Value="${CadImportProfileProperty}" />
							<Parameter	Name="CadImportRule"				Direction="In"		Value="${NewRule}" />
							<Parameter	Name="CadImportRuleDefaultAction"	Direction="In"		Value="${DefaultAction}" />
						</Insert>
					</ForEach>
				</When>

				<Otherwise Name="Otherwise, both TargetProperty and TargetFeature are empty">
					<Assign Name="Clear default matching property for foreign key" Property="${CadImportProfileProperty.RelatedEntityMatchingProperty}" Value="Empty" />
				</Otherwise>
			</Choose>
		</Transaction>

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