Attribute Mapping Business Logic (PLMAttributesMapping)

This section describes how to define and integrate the customer Business Logic for PLM attribute mapping based on the Enterprise Knowledge scripting technology.

This page discusses:

Business Logic Intent

This Business Logic Opening allows the integration of customer policy for the mapping of PLM Attributes when exchanging PLMEntities. In a Coexistence scenario, it will allow you to determine the values of "free" and "user" attributes of the target customized type PLMEntity from the source customized type the and source attribute values. In addition to this basic behavior, this Business Logic allows you to define the value of maturity and ownership attributes in the target provider.

Important:
  • In this context, a default "Identity" mapping is applied, the attribute values not set by the rule will be taken from the source object if the attribute exists in the source customization.
  • With PLMAttributesMapping you can update any free attribute, even one belonging to the IDSet. However, make sure you are aware of any possible impacts on your business process.

PLM Opening Definition

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

General Information

PLM Opening ID

PLMAttributesMapping

Customization Intent Execution
Execution Content Client

Input Objects

The Business Logic can be invoked for any PLM component type. This means that your implementation can safely use the PLM public attributes of the PLM component

Context Object Parameters

Parameter Name Type Read/Write Comments
OperationId String Read Parameter used to identify the mapping context. The following values are available:
  • "Coexistence" for any Coexistence scenario
  • "BriefcaseImport" for any V6 data exchange scenario.
Source String Read Parameter used to specify the mapping context with the source of the data. In a "Coexistence" operation, it matches the name of the source provider. In a V6 data exchange scenario, the value is necessarily "PLM1".
Target String Read Parameter used to specify the mapping context with the target of the data. In a "Coexistence" operation, it matches the name of the target provider. In a V6 data exchange scenario, the value is necessarily "PLM1", as the source and the target providers are identical.
SourceTypeName String Read Customized type of the source PLM entity to be exchanged
ThisObject PLMEntity Write 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 customized type as the source PLM entity to be exchanged. Reading this PLM entity, the BL can retrieve source attribute values.

ExchangeObject TEBLExchangeObject Write Object used to set the value of maturity and ownership attributes. The attributes held by ExchangeObject are as follows:
  • MappedMaturity
  • MappedUser
  • MappedOrganization
  • MappedProject
Note: Depending on the context, some parameters may be unset. Attribute validity must therefore be checked before reading. For more details, see the recommendations below .

Implementation Sample

The following script samples illustrate how to execute the mapping in order to set the V_description attribute value of a PLMProductDS reference from the V_PlantCode attribute value of the source object and to process the mapping of ownership information. To achieve this particular Business Logic implementation you have to associate a script (for example "MyAttributesMappingScript") with the <OpeningID, Type> pair in a CATRuleExit file:

<Scripts>
     <Script OpeningID="PLMAttributesTypeMapping"
             Type="PLMProductDS"
             ScriptName="MyAttributesMappingScript" >
             <Condition Attribute="OperationId" Value="Coexistence" />
             <Condition Attribute="Source" Value="VPM1" />
             <Condition Attribute="Target" Value="PLM1" />
     </Script> 
</Scripts>

You then have to create a CATRule file (for example MyAttributesTypeMappingScript.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")
set ExchangeObject = Parameters->GetAttributeObject("ExchangeObject")

if(SourceObject <> NULL)
{
    SourceObjectPlantCode = SourceObject->GetAttributeString("V_PlantCode")
    ThisObject.V_description = SourceObjectPlantCode
}
if(SourceObject <> NULL)
{
    SourceObjectUser = SourceObject->GetAttributeString("owner")
    SourceObjectProject = SourceObject->GetAttributeString("project")
    SourceObjectOrganization = SourceObject->GetAttributeString("organization")

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

     ExchangeObject.MappedProject = SourceObjectProject
     ExchangeObject.MappedOrganization = SourceObjectOrganization
         }
 }

To create an extension, you must set the oEnterpriseItemNumber attribute on the input proxy, which is ThisObject . Database Design Import (DBDI) reads the attribute and, based on its value, adds the EnterpriseExtension to the 3DEXPERIENCE object. DBDI then sets V_PartNumber on this extension by using the value from the input proxy.

To create an extension, do the following changes:

  • For ENOVIAvpm:
    if(SourceObject->IsASortOf("VPMENV_VPMReference") == true)
    {
    ThisObject->SetAttributeString("oEnterpriseItemNumber" , "TestEnterpriseExtension")
    }
    
  • For ENOVIA VPM V5:
    if(srcObject->IsASortOf("VP5PartReferenceGX") == true)
    { 
    ThisObject->SetAttributeString("oEnterpriseItemNumber" , "TestEnterpriseExtension")
    }
    if(srcObject->IsASortOf("VP5ProductReferenceGX") == true)
    {
    ThisObject->SetAttributeString("oEnterpriseItemNumber" , "TestEnterpriseExtension")
         }
    On 3DEXPERIENCE side EnterpriseExtension and its attribute V_PartNumber should be visible on properties panel as below.
    
  • For SmarTeam:
    ThisObject->SetAttributeString("oEnterpriseItemNumber" , "TestEnterpriseExtension")

Recommendations

Before using an optional input parameter, you must 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)
{
...