How to Implement the Identification Initialization Business Logic Openness?

Technical Article

Abstract

This article details how to define and integrate the customer business logic for PLM entity initialization.

Business Logic Intent

This business logic openness "PLMIdentificationInitialization" allows to integrate customer policy by providing business rules for PLM Component initialization purpose.

PLM Opening Definition

This section describes the objects defining the PLM opening: its global information, its kind of input object, its context object parameters.

General Information

PLM Opening ID  PLMIdentificationInitialization   
Customization Intent  Execution
Execution context  Client

Input Objects

This PLM Opening ID can be associated to PLM component class types below. This is the fact (i.e. ThisObject) in the business rule.

Notice: The fact can be either a PLM Proxy or a PLM Component.

PLM Component Class Types
PLMCoreReference
PLMCoreRepReference
PLMCoreInstance
PLMConnection
PLMPort

Context Object Parameters

In addition to the fact object, context attributes are available in the scripting rule.

Some parameter availability are based on OperationId and OperationDetail attribute combination. Refer to the matrix below.

Parameter Names Types Read/Write Comments
OperationId string Read Parameter used to identify the context of initialization. Following values are available:
  • "New” for PLM Component creation.
  • "Cloning" for PLM Component duplication.
  • "Implicit" for PLM Component creation by factory APIs with no specific context.
  • "ImportAsNew" for data import creating new PLM Components.
  • "Default" for any else case.

 

OperationDetail string Read Parameter to be used combined with OperationId parameter. Details the context of the OperationId. Following values are available:
  • "NoOperationDetail"
  • "Create"
  • "CopyPaste"
  • "ConfiguredSplit"
  • "ReplaceReference"
  • "CloneDistantData" for "Duplicate As Alternative" command.

 

IdString string Read Parameter that may be used for the naming of the PLM entity (e.g. as prefix).
IdCloningString string Read Parameter that may be used for the naming of the PLM entity (e.g. as prefix).
CopyFrom PLMEntity Read PLM Proxy object of the source PLM entity to clone. Based on this object, the attributes values may be parameterized.
CoupledRef PLMEntity Read When creating a couple "PLM Part Reference/Representation Reference" in one shot, this parameter provides the PLM Proxy object of the aggregating Part Reference. Based on this object, the attributes values may be parameterized.
AggregatingReference PLMEntity Read When creating a PLM Instance, this parameter provides a PLM Proxy object of the PLM Reference entity (i.e. OwnedBy) that will aggregate the PLM instance. Based on this object, the attributes values may be parameterized.
Reference PLMEntity Read When creating a PLM Instance, this parameter provides a PLM Proxy object of the PLM Reference entity (i.e. (InstanceOf) of the this PLM instance. Based on this object, the attributes values may be parameterized.

Notice that depending of the context some parameters may be unset. Therefore, it is necessary to check attribute validity before reading.

See the Recommendations section for more details.

Implementation Samples

The following business rule samples illustrate how to:

  1. Initialize the naming of a stand alone Representation Reference based on a unique number computed by an external function of a user knowledge package.
  2. Initialize the naming of a Representation Reference from the naming of a couple Part Reference (same PLM_ExternalID attribute prefixed by "3DRep of  ")
  3. Set the attributes on a cloned Representation Reference: the description of the cloned object is set to  : "This Representation is a copy of Original object PLM_ExternalID"

To achieve this particular business logic implementation you will associate a rule (e.g. "MyRepIdentificationScript") to the couple <OpeningID, Type> in a CATRuleExit file:

<Scripts>
    <Script OpeningID="PLMIdentificationInitialization"
            Type="MyPLMRepresentation"
            ScriptName="MyRepIdentificationScript" />
</Scripts>

Then you will create a CATRule file (e.g. MyRepIdentificationScript.CATRule) to define your business logic:

Let Operation(string)
Let CoupledRefId(string)
Let CoupledRef(PLMProductDS)
Let OriDesc(string)
Let CopyFrom(PLMProductDS)
Let CopyFromId(string)
Let CloningString(string)
 
Operation=Parameters->GetAttributeString("OperationId")
 
If(Operation=="New" or Operation=="Implicit" or Operation=="Default")
{
	/* Management of coupling between Representation Reference Naming and Part Reference naming */
	If (Parameters->HasAttribute("CoupledRef") == true)
	{
		set CoupledRef = Parameters->GetAttributeObject("CoupledRef")
		/* Test if a coupled Part Reference exists */
             	if(CoupledRef <> NULL)
          	{
			/* Retrieve the Attributes on the couple Part Reference */
			CoupledRefId = CoupledRef->GetAttributeString("PLM_ExternalID")
			ThisObject.PLM_ExternalID = "3DRep of "+CoupledRefId
			ThisObject.V_description = "Representation for part "+CoupledRefId
		}
		else
		{
			/* Default naming based on a customized numbering */
			Prefix = Parameters->GetAttributeString("IdString")
			ThisObject.PLM_ExternalID = Prefix +"Representation"
			
		}
	}
	else
	{
		/* Default naming based on a customized numbering */
		Prefix = Parameters->GetAttributeString("IdString")
		ThisObject.PLM_ExternalID = Prefix +"Representation" 
	}
}
else if(Operation=="Cloning")
{
	/* Case of cloning */
	if (Parameters->HasAttribute("IdCloningString") == true)
	{
		CloningString = Parameters->GetAttributeString("IdCloningString")
	}
	if(CloningString=="")
	{
		CloningString = "Auto Renamed of "
	}
	/* retreive the attributes on the initial object */
	set CopyFrom = Parameters->GetAttributeObject("CopyFrom")
	CopyFromId = CopyFrom->GetAttributeString("PLM_ExternalID")
	OriDesc = CopyFrom->GetAttributeString("V_description")
	ThisObject.PLM_ExternalID = CloningString + CopyFromId
	ThisObject.V_description = "This Representation is a copy of "+CopyFromId
}

Recommendations

Before using an optional input parameter, you have to check its value. For instance, to check if the CopyFrom parameter is valuated or not, use the following code sequence:

...
set CopyFromRef = GetAttributeObject("CopyFrom")
if(CopyFromRef <> NULL)
{
...

References

History

Version: 1 [July 2007] Document created