-
Create a resource finder.
/* Create the resource finder */
pEnsEngSpecResourceFinder = new("EnsEngSpecResourceFinder","EnsEngSpecResourceFinder1",NULL)
if (pEnsEngSpecResourceFinder <> NULL)
-
Add the required information to find the resources.
{
/* Init the information on the resource finder */
pEnsEngSpecResourceFinder->SetAttributeString("ApplicationName","CATPiping")
pEnsEngSpecResourceFinder->SetAttributeString("ApplicativeOperationName","_MultiSpec")
pEnsEngSpecResourceFinder->SetAttributeString ("SearchedResourceKind","MinimumTangentLength")
/* Set a resource filtering expression based on PLM attributes */
pEnsCondition1 = new("EnsCondition","ExpCondition1",NULL)
pEnsCondition2 = new("EnsCondition","ExpCondition2",NULL)
if ( (pEnsCondition1 <> NULL) AND (pEnsCondition2 <> NULL) )
{
pEnsCondition1->SetAttributeString("ParameterName","V_sec_level")
/* Warning : only operator “==” accepted */
pEnsCondition1->SetAttributeString("Operator","==")
pEnsCondition1->SetAttributeInteger("ParameterValue",-1)
EnsConditions->Append(pEnsCondition1)
pEnsCondition2->SetAttributeString("ParameterName","organization")
/* Warning : only operator “==” accepted */
pEnsCondition2->SetAttributeString("Operator","==")
pEnsCondition2->SetAttributeString("ParameterValue","MyCompany")
EnsConditions->Append(pEnsCondition2)
pEnsExpression = new("EnsExpression","EnsExpression1",NULL)
if (pEnsExpression <> NULL)
{
pEnsExpression->SetAttributeObject("ListOfEnsConditions",EnsConditions)
pEnsEngSpecResourceFinder->SetAttributeObject ("EnsExpressionToFilterSearchedResource",pEnsExpression)
}
}
/* Set applicative entities */
/* Remark : ens specification object is used just to check that the SetAtttributeObject works correctly on the EnsEngSpecResourceFinder : in a real case, these entities are not the specs, but other current entities depending on the current operation */
EnsApplicativeEntitiesKeys->Append("EnsSpecification1")
EnsApplicativeEntities->Append(pEnsSpecObj)
pEnsEngSpecResourceFinder->SetAttributeObject ("ListOfCurApplicativeEntitiesKeys",EnsApplicativeEntitiesKeys)
pEnsEngSpecResourceFinder->SetAttributeObject ("ListOfCurApplicativeEntities",EnsApplicativeEntities)
/* Set the initial ens specifications: customer additional ones (if any) will be automatically added internally and must not be set */
pEnsEngSpecResourceFinder->SetAttributeObject ("ListOfCurEnsSpecifications",EnsSpecs)
-
Get the result type.
Note:
The result type can be a table or a filter.
If the result type is a table, the exact result type is obtained through a call to
GetEnsTechnoTableResultType.
/* Get the type the created ens techno table for result must be a sort of */
pEnsEngSpecResourceFinder->GetEnsTechnoTableResultType(sEnsTechnoTableResultRequiredType)
If the result type is a filter, the exact result type is obtained through a call to
GetEnsFilterResultType. /* Get the type the created ens filter for result must be a sort of */
pEnsEngSpecResourceFinder->GetEnsFilterResultType(sEnsFilterResultRequiredType)
-
Create a result object with the object type you obtained at step 3.
/* Initialize the ens techno table result */
pEnsTechnoTableResult = new(sEnsTechnoTableResultRequiredType, "EnsTechnoTableResult1", NULL)
if (pEnsTechnoTableResult <> NULL)
-
Run the resource finder to fill the result object created at step 4.
/* Run the resource finder for resource search: case ens technological tables */
pEnsEngSpecResourceFinder->GetEnsTechnoTableResult(pEnsTechnoTableResult)
The result is inserted
in the created table or filter. The searched resource is this object which can be accessed through knowledge services. Note:
You can add a filter on the resource finder in the form of a filtering expression. An expression is build with conditions and a condition is a parameter name, an operation and a value, for example material=inox. You need to create first the conditions with their three elements and then you create the expression in which you list the conditions.
|