How to Implement the Custo Type Mapping Business Logic?

Technical Article

Abstract

This article details how to define and integrate the customer business logic for PLM customization types mapping based on the Enterprise Knowledge scripting technology.

Business Logic Intent

This business logic opening allows integrating customer policy for the mapping of customized types when exchanging PLMEntities.

In the context of Coexistence scenario, it will allow to determine the target custo name of each PLM entity from source custo type and source attribute values.

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 PLMCustoTypeMapping  
Customization Intent Computation
Execution Context Client

Input Objects

The Business Logic can be invoked for any PLM Component Type. It means that your implementation can safely use the PLM public attributes of the PLM Component.

Context Object Parameters

Parameter Names Types Read/Write Comments
OperationId string Read Parameter used to identify the context of mapping. Following values are available:
  • "Coexistence" for any Coexistence scenario
Source string Read Parameter used to precise the context of mapping with the source of the data. In "Coexistence" operation it corresponds to the name of the Source Provider.
Target string Read Parameter used to precise the context of mapping with the target of the data. In "Coexistence" operation it corresponds to the name of the Target Provider.
ThisObject PLMEntity None This is an empty PLM proxy object with Top Modeler abstract type. It is not to be used in the Rule.
SourceObject PLMEntity Read This is a PLM proxy object with the same top modeler type and custo type as the source PLM entity to exchange. Reading this PLM entity, the BL can retrieve source attributes values.
TargetCustoName string Write Output parameter returning the name of the Customization for target PLM Entity after Rule computation.
CustoDiscipline string Write Output parameter returning the value for V_CustoDiscipline attribute of target PLM Entity after Rule computation.

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 script samples illustrate how to:

  1. Compute PLMProductDS customization for an ENOSAM2 PLMCoreReference object

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

<Scripts>
    <Script OpeningID="PLMCustoTypeMapping"
            Type="VPMReference"
            ScriptName="MyCustoTypeMappingScript" >
            <Condition Attribute="OperationId" Value="Coexistence" />
            <Condition Attribute="Source" Value="VPM1" />
            <Condition Attribute="Target" Value="PLM1" />
    </Script>
</Scripts>

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

Let SourceObject(PLMEntity)
Let oCustoName(String)
oCustoName = ""
 
set SourceObject = Parameters->GetAttributeObject("SourceObject")

if(SourceObject <> NULL)
{
	if(Parameters->HasAttribute("TargetCustoName") == true)
	{
		if(SourceObject->IsSupporting("ENOSAM2_Part") == true)
		{
			oCustoName = "PLMProductDS"
		}
		
		Parameters->SetAttributeString("TargetCustoName", oCustoName)
	}
}

Recommendations

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

...
GetAttributeObject("SourceObject")
if(SourceObject <> NULL)
{
...

References

History

Version: 1 [November 2009] Document created