3D PLM Enterprise Architecture

VPM Navigator

Working with Configuration Handler

Working with Configuration Handler
Use Case

Abstract

This article discuses the CAAImmCAAServicesCHTestCmd use case. The use case mainly focuses on the public interface CATImmCAAServices APIs implemented to achieve the following :

  • Retrieving the current Applied Configuration Handler on PRC,
  • Retrieving All the Configuration Handler associated with the PRC,
  • Applying the Configuration Handler on the PRC and expanding the Product assembly up to the specified level.

What You Will Learn With This Use Case

The primary objective of this use case is to familiarize the user with the CATImmCAAServices public interface APIs meant for dealing with the Configuration Handler. The use case introduces the user with the following three APIs :

[Top]

The CAAImmCAAServicesCHTestCmd Use Case

The CAAImmCAAServicesCHTestCmd  is a use case of the CAACATImmENOVIAProvider.edu framework that illustrates CATImmCAAServices interface capabilities.

[Top]

What Does the CAAImmCAAServicesCHTestCmd Use Case Do

The CAAImmCAAServicesCHTestCmd is a test command which seeks the associated Configuration Handler/s and Sets as well as Resets the Configuration Handler on the Root object existing in the current VPM Navigator window providing the liberty to expand the product assembly up to the specified level..

[Top]

How to Launch the CAAImmCAAServicesCHTestCmd command

To launch CAAImmCAAServicesCHTestCmd , the user needs to set up the build time environment, then compile CAAImmCAAServicesCHTestCmd along with its prerequisites, set up the run time environment, and then execute the use case [1] in the following way:

[Top]

Where to Find the CAAImmCAAServicesCHTestCmd Code

The test command is made up of a single class named CAAImmCAAServicesCHTestCmd located in the CAAImmCAAServicesCHTestCmd.m module of the CAACATImmENOVIAProvider.edu framework :

Windows InstallRootDirectory\CAACATImmENOVIAProvider.edu\CAAImmCAAServicesCHTestCmd.m\
Unix InstallRootDirectory/CAACATImmENOVIAProvider.edu/CAAImmCAAServicesCHTestCmd.m/

where InstallRootDirectory is the directory where the CAA CD-ROM is installed.

[Top]

Step-by-Step

The following are the main steps in CAAImmCAAServicesCHTestCmd use case :

  1. Instantiate the CATImmCAAServices object
  2. Get Current Root and its Identifiers
  3. Get the Configuration Handler(s) associated with PRC

          3a. Get All the applied Configuration Handlers

          3b. Get Current Configuration Handler

  4. Set/Reset the Configuration Handler
  5. Release the CATImmCAAServices object

[Top]

Instantiate the CATImmCAAServices object

The CAAImmCAAServicesCHTestCmd command has been derived from CATCommand. The constructor of the command class has a call to the CAAImmCAAServicesCHTestCmd ::Initialise method which retrieves the current root object and its associated information and then seeks the Configuration Handler/s associated with that root object. Depending upon the user choice to Set/Reset the ConfigHandler on PRC the constructor makes  a call to the CAAImmCAAServicesCHTestCmd ::Activate method for further operation.

CAAImmCAAServicesCHTestCmd::CAAImmCAAServicesCHTestCmd(void* arg):CATCommand(NULL,"CAAServicesTestCmd")
{
  ...
  int a = Initialise();
  if ( a == 2 )
    Activate(NULL,NULL);
  ...  
 }

The CATImmCAAServices object is instantiated in the Initialise method as shown below.

int CAAImmCAAServicesCHTestCmd::Initialise()
{
  ...
  _ImmServiceObj = new CATImmCAAServices();
  ...

In addition some other private members of the type CATUnicodeString and CATListOfCATUnicodeString are defined which contain the information about the root identifiers and their names, configuration filters and their names.

[Top]

Get the Current Root and its Identifiers in the VPMNAV window

 The CATImmCAAServices::GetCurrentRootIdentifiers method retrieves the current Root Identifier from the current VPM Navigator window. This method retrieves the Identifier of the root object, its value and the root type.

  ...
  hr = _ImmServiceObj->GetCurrentRootIdentifiers(_oIdentifierNames,_oIdentifierValues,
     					         _oRootType);
  ...

On the failure of this method a failure message is displayed and the execution of the command ends. Whereas on success, the  identifier name of the PRC, its value and the root type is displayed in the notification dialog box [Fig.3].

[Top]

Get the Configuration Handler(s) associated with the PRC

Once the current root object identifier and the corresponding information is retrieved, the next step is to seek the Configuration Handler(s) associated with it. Since the use case provides the choice to the user to retrieve either All the ConfigHandlers or the Current ConfigHandlers associated with PRC. 

  ...
  CATUnicodeString type_message = CATMsgCatalog::BuildMessage("CAAImmCAAServicesCHTestCmd","ChooseConfigHandler");
  
  CATUnicodeString title = CATMsgCatalog::BuildMessage("CAAImmCAAServicesCHTestCmd", "title");
  CATDlgNotify* pRunDlg = new CATDlgNotify(CATApplicationFrame::GetFrame()->GetMainWindow (),
       				           "VPM_Identification8",CATDlgNfyInformation |
     					   CATDlgNfyYesNoCancel |CATDlgWndModal);
  int CHType = pRunDlg->DisplayBlocked(type_message, title);
  ...  

Depending upon the user selection and the return value (CHType) of the CATDlgNotify::DisplayBlocked method, use case makes a call to the either of GetAllPRCConfigHandlers or GetPRCConfigHandler  these two methods.

Get All the applied Configuration Handlers

Here a call to the CATImmCAAServices::GetAllPRCConfigHandlers retrieves the PRC name(_oIdentifierValues[1]) and the list of ConfigHandlers (_oCHdsValues) associated with it.

  ...
  if (CHType == 3)
  {
    hr = _ImmServiceObj->GetAllPRCConfigHandlers(_oIdentifierValues[1],_oCHdsValues);
    ...
  }
  ...

Get the Current Configuration Handler

A call to the CATImmCAAServices::GetPRCConfigHandler retrieves only the current ConfigHandler(_oCHdsValues[1]) applied on the PRC among the list of all the configuration handlers associated with it..

  else if(CHType == 4)
  {
    hr = _ImmServiceObj->GetPRCConfigHandler(_oIdentifierValues[1],_oCHdsValues[1]);
    ...
  }
 }

If any of the above two methods fails or no configuration handler is associated with the PRC is found then an appropriate failure message is displayed and the execution of the command ends. Whereas on success, the name/s of the configuration handler/s associated with the PRC get displayed.

[Top]

Set/Reset the Configuration Handler

If there are one or more configuration handlers associated with the PRC then the use case sets the first configuration handler from the list of available configuration handlers on the PRC. This is achieved through the CATImmCAAServices ::SetPRCConfigHandler API, as explained below.

CATStatusChangeRC CAAImmCAAServicesCHTestCmd::Activate(CATCommand*  iFromClient,
      						       CATNotification*  iNotification )
{  
   ...
   CATDlgNotify* pRunDlg = new CATDlgNotify(CATApplicationFrame::GetFrame()->GetMainWindow (),
     					    "VPM_Identification",CATDlgNfyOKCancel|CATDlgWndModal);
   int a = pRunDlg->DisplayBlocked(type_message, title);
   pRunDlg->RequestDelayedDestruction();
   pRunDlg = NULL;
  
   CATListOfCATUnicodeString CHdsValues;
   
   if( a == 2 )
      CHdsValues.Append("");
   else 
      CHdsValues.Append(_oCHdsValues[1]);
   
   int b = Set( _oIdentifierValues[1],CHdsValues[1]);
  ...
}

On the successful execution of the GetAllPRCConfigHandlers method, use case makes a call to the CAAImmCAAServicesCHTestCmd::Activate to proceed ahead with Setting/Resetting the ConfigHandler on PRC. 

A call to CAAImmCAAServicesCHTestCmd::Set function internally calls the CATImmCAAServices::SetPRCConfigHandler API. The API has been specifically designed to set or reset, as per the user selection, the ConfigHandler on the PRC and then to control the level of expansion of the Product assembly instead of expanding the whole assembly unnecessarily. 

int CAAImmCAAServicesCHTestCmd::Set(const CATUnicodeString& iPRCIdentifiersValue,
                                    CATUnicodeString& iCHdsValue)
{
  ...
  int iExpandLevel = 1;
  int iCheckFlag = 1;
  hr = _ImmServiceObj->SetPRCConfigHandler(iPRCIdentifiersValue,iCHdsValue,
      				           iExpandLevel,iCheckFlag);
  ...
}

Here the third argument (iExpandLevel) to specify the expand level has been set to One .

This API also allows the user to check/confirm if the applied Configuration Handler has been actually attached to the PRC or not. The fourth argument (iCheckFlag ) serves this purpose if set to One .If the flag is set to one, the SetPRCConfigHandler method internally makes a call to the CATImmCAAServices::GetPRCConfigHandler API to confirm the same.

[Top]

Release the CATImmCAAServices object

It is recommended to deallocate the CATImmCAAServices object at the end of the command, or when its use is finished in the following way,

...
   if(_ImmServiceObj)
   {
      delete _ImmServiceObj;
      _ImmServiceObj=NULL;
   }	
...

[Top]


In Short

This CAAImmCAAServicesCHTestCmd use case mainly focuses on CATImmCAAServices interface APIs designed to work with the Configuration Handler.

The use case demonstrates how to retrieve the Configuration Handlers associated with the current root object in the VPM Navigator window. Whereas it provides the liberty to the user to retrieve All or only the Current ConfigHandler/s associated with the PRC.

It familiarizes the user with the API meant to Set/Reset the ConfigHandler on the PRC and allows the user to restrict the expansion of the product assembly up to the specified Expand level.

[Top]


References

[1] Building and Launching a CAA V5 Use Case
[Top]

History

Version: 1 [July 2006] Document created
[Top]

Copyright © 2006, Dassault Systèmes. All rights reserved.