Infrastructure Server Fcts Functions

Infrastructure specific functions are used to customize the actions performed on the server within Business Logic Validation on Server openings.

Important: These functions are not available within execution control.

This page discusses:

AreTreatedInSameTransaction

Returns TRUE if the two given entities (parameters “instance” and “owner”) are treated in the same transaction. FALSE otherwise.

Signature

AreTreatedInSameTransaction(Instance : Feature, Owner : Feature) : Boolean

Arguments

Name Input / Output Required? Type Comment
Instance Input Yes Feature
OwnerI Input Yes Feature

ReturnType

Boolean

ChangeControlledStatus

On any reference or representation reference object, the ChangeControlledStatus knowledge function is available for the user to retrieve from a knowledge rule whether the object is Change Controlled or not: Boolean ChangeControlledStatus(Object Reference).

Signature

ChangeControlledStatus(idset : Feature) : Boolean

Arguments

Name Input / Output Required? Type Comment
idset In Yes Feature
Note: An error message appears, if the object is not a PLMReference or PLMRepresentationReference.

ReturnType

Boolean

Example

let iControlledStatus(Boolean)
iControlledStatus = ChangeControlledStatus(ThisObject)
Validation = true
if (iControlledStatus == false)
{ Validation = false
}

ChangeMaturity

Lets you change the maturity of a reference list or of a reference

Signature

ChangeMaturity(function: #In String, objects: #In ObjectType [, strSignature: #In String]) : VoidType

Arguments

Name Input / Output Required? Type Comment
function Input Yes String Must be promote or demote.
ObjectType Input Yes List Reference list or reference on which the change maturity is done.
strSignature Input Optional String The signature of the change maturity that corresponds to the transition (Share, KeepPrivate, ...)

Usage

ChangeMaturity ("promote", MyReference, "Share")
ChangeMaturity ("demote", MyReference)

ReturnType

Boolean

Example 1

let ListToChangeMaturity (List)
ListToChangeMaturity.Append( ThisObject )
ChangeMaturity("promote", ThisObject, "Share") 
ChangeMaturity("demote", ThisObject ) 
ChangeMaturity("promote", ListToChangeMaturity, "Share")

GetAttachedDocuments

Lets you retrieve aggregated documents from a reference. It returns a new list containing the identifiers of all the documents aggregated under the input reference. .

Signature

GetAttachedDocuments(idset : Feature) : List

Arguments

Name Input / Output Required? Type Comment
idset In Yes Feature The reference from which the documents are retrieved

ReturnType

List

Example 1

Parameters.NLSMessage = BuildKweMessageNLS(Catalog, Key, Arg1, Arg2, …)

Example 2

This example shows how to use a EKL script using GetAttachedDocuments() for thePLMCheckMaturity opening. The validation fails if at least one attached document has no description.

 Let ListDocs (List) 
Let ListDocsSize (Integer)
Let doc (PLMCoreRepReference)


Set ListDocs = GetAttachedDocuments(ThisObject )
ListDocsSize = ListDocs.Size()
Trace (1, "nb docs : " + ListDocsSize)

Validation = true

 i = 1
 for i while i <= ListDocsSize
 {
      doc = ListDocs.GetItem(i)
      Trace (1, "docs description: " + doc.V_description)
             If ( doc.V_description == '' )
                        Validation = false
 }

GetResourceEntries

Functions that can be called in any server-side EKL opening: "Pre Check", "Action" or "Post Check" openings, and in any kind of operation already containing EKL openings (Save, Maturity, etc.), in the same way as any other EKL function.

Signature

GetResourceEntries(type : String, condition : String) : List

Arguments

Name Input / Output Required? Type Comment
type In Yes String

The Vtype of the entities to search for. It must be provided in its EKL string format without dictionary package and without slash separator. Example: "PLMPosPickListRef".

condition In Yes String An EKL string expression describing the attributes criteria the entities must match. Example:

"x.PLM_ExternalID==\"myResource*\"

Note: The function does not support all combinations of the AND/OR logical operators.

ReturnType

List

Example

Let WhereClause(String)

Let EntityList (List)
Let CurrentEntity (PLMPosPickListRef)
Let i (Integer)
Let ListSize (Integer)

WhereClause = "x.PLM_ExternalID==\"TestResource*\" AND ( x.V_row_name==\"Row1\" OR x.V_row_name==\"Row2\" )"

Set EntityList = GetResourceEntries("PLMPosPickListRef", WhereClause)

if (EntityList <> NULL AND EntityList.Size() == 2)
{
          for i while i <= ListSize 
          {
                     CurrentEntity = EntityList.GetItem(i)
                     if (CurrentEntity.V_row_data ...
          }
          Validation = true
}
else
{
         Validation = false
}

GetSROwnersFromPointedElement

Returns a list of all the PLM Entities that contain at least one semantic relation pointing to a given PLM Entity (parameter “pointedObject”) as target or in their path.

Only the semantic relations whose Role is contained in the input list of strings semanticRelRoles are processed, the others are ignored.

Finally, only the PLM Entities who belong to the Designer Workspace identified by the parameter workspaceid are returned. Note that the empty string "" identifies the Designer Workspace Reference).

Signature

GetSROwnersFromPointedElement(pointedObject : Feature, semanticRelRoles : List,
 workspaceid : String) : Boolean

Arguments

Name Input / Output Required? Type Comment
pointedObject Input Yes Feature
semanticRelRoles Input Yes List
workspaceid Input Yes String

ReturnType

PLMEntities

ListImplementingChanges

On any object, the ListImplementingChanges Knowledge function will be available for the user to know by which ECA the objects has been impacted (if any): ListImplementingChanges(Object ).

Signature

ListImplementingChanges(idset : Feature) : List

Arguments

Name Input / Output Required? Type Comment
idset In Yes Feature

ReturnType

List

Example

let nbECAs(Integer)
let ListOfImplementingEca(List)
ListOfImplementingEca = ListImplementingChanges(ThisObject)
Validation = true
nbECAs = ListOfImplementingEca.Size()
if (nbECAs == 0)
{ Validation = false
}

RetrieveMaterials

Function used to get the list of materials associated with a reference passed in input.

Signature

RetrieveMaterials(idset : Feature) : List

Arguments

Name Input / Output Required? Type Comment
idset In Yes Feature

ReturnType

List

Example

let listMat(List)
let filteredtMat(List)

Validation = true
listMat = RetrieveMaterials(ThisObject)
filteredtMat = listMat.Filter("CATMatReference", "(x.IsASortOf(\"CATMatReferenceDS\") == true ) 
and (x.V_Density == 100 )")

if (filteredtMat.Size() > 0) 
     Validation = false

SetChangeControlledStatus

On any reference or representation reference object, the SetChangeControlledStatus knowledge function is available so that you can valuate the Change Controlled status when executing the rule: SetChangeControlledStatus(Object Reference, Boolean ChangeControlledStatus).

Signature

SetChangeControlledStatus(idset : Feature, idset : Boolean) : Boolean

Arguments

Name Input / Output Required? Type Comment
idset In Yes Feature
idset In Yes Boolean

ReturnType

Boolean

Example

let DescriptionValue(String)
DescriptionValue=ThisObject.V_description
if (DescriptionValue=="PhaseB")
{
         SetChangeControlledStatus(ThisObject,true) 
}

Trace

The trace action is listed below.

Syntax

  • The level is comprised between 1 and 9 and is used to indent the traces.
  • The message is used like a message function.
  • The argument must have the same number of # and parameters. If there are more parameters than #, parameters are added at the end of the message. If there are more # than parameters, the character # is not replaced.
    Note: Remember that:
    • The | symbol lets you insert a carriage return in a prompt.
    • # is replaced with the parameter value.

To activate Traces:

  • Modify the logback.xml file located in WEB-INF/classes Add logger tags.
  • The other tags are compulsory but the ones provided in the example below are examples only.

This file must have the following format:

<configuration ... > 
            <!-- logback.xml --> 
            <appender name="STDOUT" 
class="ch.qos.logback.core.ConsoleAppender"> 
                <encoder> 
                  <pattern>%d [%thread] %-5level %logger{15} - %msg%n</pattern> 
                </encoder> 
                </appender> 

<!-- basic traces --> <logger name="CKE_CUSTO_TRACES" level="DEBUG"><appender-ref ref="STDOUT"/></logger> 

<!-- extended traces <logger name="CKE_CUSTO_TRACES_Verbose" level="DEBUG"><appender-ref ref="STDOUT"/></logger> --> <root level="OFF"/> </configuration>

The text provided to the Trace() function is displayed on the server side in the application server console. You can also display it through the logger name CKE_EKL_TRACE in debug mode, for example: <logger name="CKE_EKL_TRACE" level="DEBUG"><appender-ref ref="STDOUT"/></logger>. The traces are only used for debug purposes.

Arguments

String Execution Profile Required? Description Comment
level Local Read Yes Comprised between 1 and 9 and is used to indent the traces.
message Local Read Yes The message is used like a message function. You must put a String in quotes.
argument Local Read Yes The argument must have the same number of # and parameters. If there are more parameters than #, parameters are added at the end of the message. If there are more # than parameters, the character # is not replaced.

Example 1

Trace(1,"this is a trace")

BuildDeferredMessageNLS

CATNls file depending on the client NLS on a target machine. Its role is to store the information to build a message (could be error, warning, or info) from a catalog, key, and inputs arguments.The BuildDeferredMessageNLS function can build an NLS message (a message in a given language) by finding it in a CATXXX.

Warning: It is strongly discouraged to use this method because it is not web client compatible.

Arguments

String Execution Profile Required? Description
Catalog (String) Local Read Yes CATNLS file name
Key(String) Local Read Yes Key name in the NLS file
Args (List) Local Read Optional Variable arguments number

The output is a structure composed of Catalog, Key, and List of arguments, that is to be affected to Parameters.

Note: The BuildMessageNLS on the client is replaced by a BuildDeferredMessageNLS on the server. The CATNls files must be available on the client.

Example 1

Parameters.NLSMessage = BuildKweMessageNLS(Catalog, Key, Arg1, Arg2, …)

ValidateSRs

In a completion scenario, navigation is performed through basic PLMQL calls. The navigation returns paths that become filters according to semantic relations’ roles or pointed objects’ types. This function is used to allow the user to filter inputs by performing an efficient navigation, including filter parameters.

Signature

ValidateSRs(iObjectToCheckPLMIDs, iRoles, iScopePLMIDs, iExcludedTypes) 

Arguments

Name Input / Output Required? Type Comment
iInputObjects Input Yes PLMIDSet List of the input objects’ PLMID. These objects can be ports, connections or representations.
iRolesList Input Yes List of strings List of the semantic relations’ roles to be checked.
iScopesObjects Input Yes PLMIDSet List of the authorized object’s PLMID to be pointed by the semantic relations.
iExcludedTypes Input Optional List of strings List of the excluded types. Those types are considered as exception, they do not invalidate the path.

ReturnType

List of strings

Example

Let validatedConnections (PLMIDSet)
set validatedConnections = ValidateSRs( inputConnections, RolesList, scopesObjects, excludedTypes)



In the above example:

  • iInputConnections is the list of PLMIDs containing CNX1, CNX2, CNX3 and CNX4.
  • iRolesList is the list of the semantic relation’s roles to be checked. In the previous schema, roles are represented by colors. R and B roles are in the RolesList.
  • iScopesObjects is the list of the PLMIDs of the authorized objects. In this example, the list contains R1, i12, R2, i13, R3, i14 and R4. .
  • iExcludedTypes is the list of the excluded types, here, TypeB.