Relationship Establishment Validation Business Logic (PLMRelationEstablishmentCheck)

An opening ID is an entry point used to customize business logic. The PLMRelationEstablishmentCheck business logic is used to manage and validate the relationship between objects in the Functional & Logical Design app.

Note: For more information about customization by business rules, see Installation and Setup: Customize: Behavior: Data Setup: Customization by Business Rules.

This page discusses:

General Information

This opening ID is invoked:

  • For Materials

    This opening ID is called when assigning a material to a product (its intent is wider because it concerns the establishment of relationship between two objects. But at the moment, it is limited to this particular scenario). The goal of the Business logic is to validate that the material that we want to assign to a product is compliant with some enterprise rules. When the check fails, a message can be provided to the end-user, explaining the reason why. Two severity of message can be generated: When the check fails, a message can be provided to the end-user, explaining the reason why.

    Two severity of message can be generated:

    1. Warnings (Severity equals to 1): in such a case, the material is assigned.
    2. Errors (Severity equals to 2 or greater): in such a case, the assignment of the material is refused.

  • For Documents Attached to Objects

    This opening ID is called when you want to attach a document to an object, both the document and the object are compliant with corporate rules. A Check Business Logic is called when you attach a document to an object to enable custom checks in particular checks on the maturity of the future parent and attributes of the document.

  • For Implement Links

    This opening ID is called when you want to validate an implement link between a source object and a target object. It provides an additional information to the implement link.

The table below provides you with information related to the definition of the Opening ID.

Opening ID: PLMRelationEstablishmentCheck
Customization intent:Validation
Execution context:Client

Input Objects

The Business Logic can be invoked for at least the listed Component Type. It means that your implementation can safely use the attributes of the default Component. Several possible uses of the BL are possible depending on their purpose:

Component Class TypesPurposeNote
CATMatConnectionMaterials
PLMCoreRepReferenceDocuments attached to objects
PLMEntityImplement LinksThe IRPC object (without context) from which the implement link starts.
BusinessTypeImplement LinksThe ER object (without context) from which the implement link starts.

Context Object Parameters (in addition to standard message and Severity parameters for validation BL)

For Materials

Parameter NamesTypesRead/WriteComments
TargetPLMCoreReferenceReadMaterial that we want to assign (in the future, object that we want to be pointed by the relationship).
ListReadList corresponding to the implement link target path.
RelationTypeStringReadType of the relationship. In this case, its value is CATMaterialToReferenceLink
Type of the implement link. in this case, Its value is PLM_ImplementLink_Target.
ContextPLM EntityReadContext where the material is applied (the object that aggregates the material connection).
SupportFeatureReadSupport on which the material is applied. It can be a product reference, a representation instance, or a mechanical body.
RepInstancePLMCoreRepInstanceReadWhen the support is a reference, it contains the rep instance.
SourceListReadList corresponding to the implement link source path. Note that the path last element corresponds do the Input object ('ThisObject').

For Documents Attached to Objects

Parameter NamesTypesRead/WriteComments
TargetPLMDMTDocumentReadParameter in input that contains the target object of the relation to be created, i.e. the document.
RelationTypeStringReadString parameter in input of the rule. In this case, its value is PLMDocConnection.

Tip: Attributes of both the input object and the target are available in the Business Logic and can be used to determine the check validity. The attribute that can prove useful is the current state.

For Implement Links

Parameter NameTypeRead/WriteComments
RelationTypeString ReadIts value is PLM_ImplementLink_Target.
TargetListReadList corresponding to the implement link target path.
SourceListReadList corresponding to the implement link source path. Note that the path last element corresponds do the Input object ('ThisObject').

Sample For Materials

The following BL samples show how to check the material's maturity, the maturity of the support, the project and the kind of object on which the material is applied.

/* The following rule is an example of what can be done/*
/* ----------------- */
/*      Declare      */
/* ----------------- */
Let Reference (CATMatReference)/*The material reference*/
Let SupportFeat (Feature)      /*The support of the material */
Let ProductContext (PLMEntity) /*The product context in which the material is applied*/
Let RepInstance (PLMEntity)    /*The RepInstance in which the material is applied*/
Let s=""
Let maturity=""
Let matProject=""
/* ------------------ */
/*    Affectations    */
/* ------------------ */
if ( true == Parameters -> HasAttribute("Target") )
{
set Reference = Parameters->GetAttributeObject("Target")
}
if ( true == Parameters -> HasAttribute("Context") )
{
set ProductContext = Parameters->GetAttributeObject("Context")
}
if ( true == Parameters -> HasAttribute("Support") )
{
set SupportFeat = Parameters->GetAttributeObject("Support")
}
if ( true == Parameters -> HasAttribute("RepInstance") )
{
set RepInstance = Parameters->GetAttributeObject("RepInstance")
}

/* ------------------ */
/*    Sample Tests    */
/* ------------------ */

Validation=true
/* Test on context maturity */
if ( ProductContext == NULL ) 
{
         Validation=false
         Parameters.Message = "Context must not be NULL"
         Parameters.Severity=2
}
else
{ 
         if ( true == ProductContext -> HasAttribute( "current" ) )
   
     {
	        maturity = ProductContext -> GetAttributeString( "current" )
         if ( "IN_WORK" <> maturity )
         {
            Validation=false
            Parameters.Message = "Applying material requires an \"IN_WORK\" product context"
            Parameters.Severity=2
          }
     }
}

/* Test on Support type */
if ( SupportFeat == NULL ) 
{
      Validation=false
      Parameters.Message = "Support must not be NULL"
      Parameters.Severity=2
}
else
{     
      if ( false == (SupportFeat -> IsASortOf( "PLMEntity" )) )
      {
            Validation=false
            Parameters.Message = "Applying materials on feature is forbidden"
            Parameters.Severity=2
      }
}

/* Test on material reference */
if (Reference == NULL)
{
        Validation=false
        Parameters.Message = "Material Reference must not be NULL"
        Parameters.Severity=2
}
else
{
        if ( true == Reference -> HasAttribute( "project" ) )
        {
              matProject = Reference -> GetAttributeString( "project" ) 
              if ( "Default" <> matProject ) 
              {
                     Validation=false
                     Parameters.Message = "Material reference must be in \"Default\" project"
                     Parameters.Severity=2
               }
         }
}    
 

Sample For Documents Attached to Objects

The following rule sample shows how to check some attributes values (e.g. V_description) of the product to which the document is attached.

If (ThisObject.V_description == "Test")
{
validation = TRUE
}
else
{
validation = FALSE
}
if (validation == FALSE)
{
Parameters.Message = "Cannot attach the document under the Product"
Parameters.Severity=2
}