Lifecycle Applications

Engineering Change Management

The Action Manager Interface

Creating and deleting Actions and ECRs
Use Case

Abstract

This article shows how to use the ENOVICWActionManager interface of the ENOVInterfaces framework to create and remove Actions and Engineering Change Requests in the Change Management domain.


What You Will Learn With This Use Case

This use case is intended to show you how to create and delete two of the basic objects of the Change Management domain: Actions and Engineering Change Requests. These objects are used to request and accomplish the modification or development of a product. The ENOVInterfaces framework contains the ENOVICWActionManager interface which allow you to directly create the business objects which may then be manipulated as desired.

[Top]

The CAAEviActionManager Use Case

CAAEviActionManager is a use case of the CAAENOVInterfaces.edu framework that illustrates the creation of the Actions and Engineering Change Requests.

[Top]

What Does CAAEviActionManager Do?

CAAEviActionManager begins by opening a VPM session and creating a login a session. Then the Action Manager is retrieved. The necessary parameters are created and the managers are directly used to create the business objects.

The ENOVInterfaces interfaces/methods shown are as follows:

[Top]

How to Launch CAAEviActionManager

To launch CAAEviActionManager, you will need to set up the build time environment, then compile CAAEviActionManager.cpp along with its prerequisites, set up the run time environment, and then execute the use case. The required interfaces can be found in the ENOVInterfaces, VPMInterfaces, VPMPersistency, System frameworks. From the directory where the executable file is stored, enter"CAAEviActionManager" to execute the program. [1].

[Top]

Where to Find the CAAEviActionManager Code

The CAAEviActionManager use case is made of a single file located in the CAAEviActionManager.m module of the CAAENOVInterfaces.edu framework:

Windows InstallRootDirectory\CAAENOVInterfaces.edu\CAAEviActionManager.m\
Unix InstallRootDirectory/CAAENOVInterfaces.edu/CAAEviActionManager.m/

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

[Top]

Step-by-Step

For demonstration purposes, the code from the CAAEviActionManager use case is shown here. There are five logical steps in the CAAEviActionManager use case:

  1. Get the Action manager
  2. Create an Action
  3. Create an Engineering Change Request
  4. Update a custom attribute
  5. Delete Action/ECR

[Top]

Get the Action manager

#include "ENOVIBOActionManager.h" 

This include statement gives access to the interface demonstrated here.

 //--- Get the ENOVIBOActionManager

    ENOVIBOActionManager_var spActMgr = GetBOActManager(); 
    if ( spActMgr == NULL_var ) 
    {  
    	cout << "ERROR in getting Action Manager." << endl << flush; 
    	VPMSession::CloseSession();
       	return 2;
    }
    cout << "Got Action Manager successfully." << endl << flush; 

 

  1. After the VPM session is opened, you can simply retrieve the action manager with a call to GetBOActManager().
  2. Here, the Action Manager is called spActMgr.

[Top]

Create an Action

    #include "CATIAFLAction.h"
    #include "CATUnicodeString.h"
    #include "ENOVIBOActionManager.h"
       

These include statements are required for the following operations.

//--- Create a new Action 

    CATIVpmAFLAction_var Action = NULL_var;
    CATUnicodeString ActType("Action_Design");
    CATUnicodeString ActName("MyDesignAction");
    CATUnicodeString ActPriority("Routine");
    CATUnicodeString ActInitialAbstract("This is a CAA Design Action.");
    
    rc = spActMgr->CreateNewAction( ActType, 
                                  Action,
                                  ActName,
                                  ActPriority,
                                  ActInitialAbstract );
                                  
    if ( !SUCCEEDED(rc) || Action==NULL_var )
    {   
    	cout << "ERROR in creating Action." << endl << flush;
    	VPMSession::CloseSession();
       	return 3;
    }    
    cout << "Created new Action successfully." << endl << flush;
  1. With the Action manager spActMgr, a call to member method CreateNewAction is made. The arguments passed are ActType ("Action_Design"), ActName ("MyDesignAction"), ActPriority ("Routine"), and ActInitialAbstract ("This is a CAA Design Action").
  2. The method creates a CATIVpmAFLAction object (Action) and returns S_OK when successfully completed. E_FAIL is returned if the create is not successful.

[Top]

Create an Engineering Change Request

      #include "CATIVpmAFLAction.h"
      #include "CATUnicodeString.h"
      #include "ENOVIBOActionManager.h"
      

These include statements are required for the following operations.

//--- Create a new Engineering Change Request 

    CATIVpmAFLAction_var Ecr = NULL_var;
    CATUnicodeString EcrType("ECR");
    CATUnicodeString EcrName("MyEcr");
    CATUnicodeString EcrPriority("Routine");
    CATUnicodeString EcrInitialAbstract("This is a CAA Engineering Change Request.");
    CATUnicodeString EcrTypeCode("Release");
    
    rc = spActMgr->CreateNewECR( EcrType, 
                                 Ecr,
                                 EcrName,
                                 EcrPriority,
                                 EcrInitialAbstract,
                                 EcrTypeCode );
                                  
    if ( !SUCCEEDED(rc) || Ecr==NULL_var )
    {  
    	cout << "ERROR in creating Engineering Change Request." << endl << flush;
    	VPMSession::CloseSession();
       	return 4;
    }    
    cout << "Created new Engineering Change Request successfully." << endl << flush;
  1. With the Action manager spActMgr a call to member method CreateNewECR is made. The arguments passed are EcrType ("Routine"), EcrName ("MyEcr"), EcrPriority ("Routine"), EcrInitialAbstract ("This is a CAA Engineering Change Request"), and EcrTypeCode ("Release").
  2. The method creates a CATIVpmAFLAction object (Ecr) and returns S_OK when successfully completed. E_FAIL is returned if the create is not successful.

 

[Top]

Update a custom attribute

      #include "CATIVpmFactoryObject.h"
      #include "CATUnicodeString.h
      #include "ENOVIBOActionManager.h"
      

These include statements are required for the following operations.

//--- Update Custom Attribute 'ServiceLife' on the Action

    CATIVpmFactoryObject_var ActFactObj(Action);
    CATUnicodeString attName("ServiceLife");
    CATUnicodeString attValue("20 years");
    
    rc = spActMgr->UpdatecustomAttribute(ActFactObj,
    					 attName,
    					 attValue);

    if ( !SUCCEEDED(rc) )
    {  
    	cout << "ERROR in Updating Custom Attribute." << endl << flush;
    	VPMSession::CloseSession();
       	return 5;
    }    
    cout << "Updated Custom Attribute successfully." << endl << flush;
      

 

  1. First, the action object (Action) is cast as a CATIVpmFactoryObject type, ActFactObj.
  2. Then the custom attribute attName ("ServiceLife") and its value attValue ("20 years") are set. This would be a customer defined attribute.
  3. With the Action manager spActMgr a call to member method UpdatecustomAttribute is made.
  4. The method returns S_OK when successfully completed. E_FAIL is returned if the create is not successful.

 

[Top]

Delete Action/ECR

      #include "CATIVpmAFLAction.h"
      #include "ENOVIBOActionManager.h"
      

These include statements are required for the following operations.

//--- Delete Action

    rc = spActMgr->RemoveAction(Action);
                                  
    if ( !SUCCEEDED(rc))
    {  
    	cout << "ERROR in Deleting Action." << endl << flush;
    	VPMSession::CloseSession();
       	return 6;
    }    
    cout << "Deleted Action successfully." << endl << flush;

//--- Delete Engineering Change Request

    rc = spActMgr->RemoveAction(Ecr);
                                  
    if ( !SUCCEEDED(rc))
    {  
    	cout << "ERROR in Deleting Engineering Change Request." << endl << flush;
    	VPMSession::CloseSession();
       	return 7;
    }    
    cout << "Deleted Engineering Change Request successfully." << endl << flush;
      

 

  1. With the Action manager spActMgr, a call to member method RemoveAction is made.
  2. To delete the Action, the Action object (Action) is the argument. To delete the ECR object, (Ecr) is the argument.
  3. The method deletes the object and returns S_OK when successfully completed. E_FAIL is returned if the delete is not successful.

 

[Top]


In Short

The ENOVIBOActionManager interface available in the ENOVInterfaces framework can be used to create and delete Actions and ECRs. Action manager is also used to update customer defined attributes on Actions. You can retrieve the Action manager with GetBOActManager().

[Top]


References

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

History

Version: 1 [Feb 2002] Document created
[Top]

Copyright © 1994-2002, Dassault Systèmes. All rights reserved.