How to Implement the Attributes Mapping Business Logic?

Technical Article

Abstract

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

Business Logic Intent

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

In the context of Coexistence scenario, it will allow to determine the values of "free" and "user" attributes of target custo type PLMEntity from source custo type and source attributes values.

In addition to this basic behavior, this business logic allows to define the value of maturity and ownership attributes in the target provider.

Important remark: In this context a default "Identity" mapping is applied, the attributes values not set by the rule will be taken from source object if the attribute exist in source customization.

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 PLMAttributesMapping  
Customization Intent  Execution
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 scenario 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 scenario it corresponds to the name of the Target Provider.
ThisObject PLMEntity Write This is the PLM proxy object with the top modeler and custo type of the targetted PLMEntity. The execution of the BL will write the attributes values on this proxy.
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.
ExchangeObject TEBLExchangeObject Write

Use this object to set the value of maturity and ownership attributes. Attributes hold by ExchangeObject are the following :

  • MappedMaturity
  • MappedUser
  • MappedOrganization
  • MappedProject
     

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. Execute the mapping to set the V_description attribute value of a PLMProductDS Reference from the V_PlantCode attribute value of source object.
  2. Process the mapping of ownership information

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

<Scripts>
    <Script OpeningID="PLMAttributesMapping"
            Type="PLMProductDS"
            ScriptName="MyAttributesMappingScript" >
            <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. MyAttributesMappingScript.CATRule) to define your business logic:

Let SourceObject(PLMEntity)
Let SourceObjectPlantCode(String)
SourceObjectPlantCode=""
Let SourceObjectUser=""
Let SourceObjectProject=""
Let SourceObjectOrganization=""
Let ExchangeObject(TEBLExchangeObject)
 
set SourceObject = Parameters->GetAttributeObject("SourceObject")

if(SourceObject <> NULL)
{
	SourceObjectPlantCode = SourceObject->GetAttributeString("V_PlantCode")
	ThisObject.V_description = SourceObjectPlantCode
}

if(SourceObject <> NULL)
{
	SourceObjectUser = SourceObject->GetAttributeString("V_user")
	SourceObjectProject = SourceObject->GetAttributeString("V_project")
	SourceObjectOrganization = SourceObject->GetAttributeString("V_organization")

	if(SourceObjectUser=="OLD_USER")
		ExchangeObject.MappedUser = "NEW_USER"
	else
		ExchangeObject.MappedUser = SourceObjectUser 

	ExchangeObject.MappedProject = SourceObjectProject
	ExchangeObject.MappedOrganization = SourceObjectOrganization
}

Recommendations

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

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

References

History

Version: 1 [November 2009] Document created
Version: 2 [May 2010] Document updated with maturity and ownership capabilities