CATPLMIntegrationUse CATAdpDuplicator

Usage: you must use this class as is. You should never derive it.


public class CATAdpDuplicator

Class to duplicate (clone) elements.

Role:

This class duplicates elements passed as input if they are clonable. In IRPC, only references and representations can be passed as input.

A cloning scope is calculated dynamically. The following component may be duplicated (and returned in the result set) if aggregated under a given reference, even if not* specified in input :

If defined, the relevant PLMIdentificationInitialization business logic with 'Cloning' OperationId will be called on every impacted reference or representation. If not defined a default logic is applied by adding the given IdCloningString to the first string attribute of the identifier set (most of the time the attirbute PLM_ExternalID).

If a specific attribute set is associated to a given component, those attributes will applied after the attributes defined by the previous business logic. It may overwrite some of them.

Example of usage :
 CATAdpDuplicator duplicator;
 while()
 {
   CATAdpAttributeSet attributeSet;
   // Code which specifies attributes to change, like attributes in the identificator set
   // ...
   if(FAILED(duplicator.AddElement(pMyComp, attributeSet))
   //Error management
 }
 
Then :
 if(FAILED(duplicator.Duplicate())
 {
    CATIAdpPLMErrorReviewer pErrorReviewer = NULL;
    duplicator.GetErrorReviewer(pErrorReviewer);
    //manage errors
    CATSysReleasePtr(pErrorReviewer);
 }
 
Or :
 CATAdpComponentsAssociation duplicatedComponents;
 if(SUCCEEDED(duplicator.Duplicate(duplicatedComponents))
 {
   CATAdpComponentsAssociationIter iter(duplicatedComponents.GetIterator());
   CATIAdpPLMIdentificator *pSource, *pDuplicated = NULL;
   while(S_OK == iter.NextComponent(pSource, pDuplicated))
   {
      //Do something
      CATSysReleasePtr(pSource);
      CATSysReleasePtr(pDuplicated);
   }
 }
 else
 {
    CATIAdpPLMErrorReviewer *pErrorReviewer = NULL;
    duplicator.GetErrorReviewer(pErrorReviewer);
    //manage errors
    CATSysReleasePtr(pErrorReviewer);
 }


Constructor and Destructor Index


o CATAdpDuplicator(CATIAdpPLMErrorReviewer*)
Constructor
o CATAdpDuplicator(CATUnicodeString&,CATIAdpPLMErrorReviewer*)
o ~CATAdpDuplicator()

Method Index


o AddElement(CATIAdpPLMIdentificator*)
Add element to duplicate
Role: Entry point to add elements to duplication.
o AddElement(CATIAdpPLMIdentificator*,CATAdpAttributeSet&)
Add element to duplicate with specific attributes to be set on the clone.
o Duplicate()
Launch duplication.
o Duplicate(CATAdpComponentsAssociation&)
Launch duplication.
o GetErrorReviewer(CATIAdpPLMErrorReviewer*&)
Get the error reviewer.

Constructor and Destructor


o CATAdpDuplicator
public CATAdpDuplicator( iopErrorReviewer= NULL)
Constructor
Parameters:
iopErrorReviewer
An error reviewer.
See also:
o CATAdpDuplicator
public CATAdpDuplicator( const iIdCloningString,
iopErrorReviewer= NULL)
o ~CATAdpDuplicator
public virtual ~CATAdpDuplicator()

Methods


o AddElement
public AddElement( ipAdpIdentificator)
Add element to duplicate
Role: Entry point to add elements to duplication. The elements will be duplicated only if the Duplicate method is called. When using this method, it is recommended that you also specify a non empty and unique iIdCloningString in the constructor. This string will be passed as input to the PLMIdentificationInitialization business logic or be set as prefix of the identifier set if no relevant business logic is found. If iIdCloningString is not specified and components are add this way, naming conflicts may prevent the cloning operation. Please note that CAA attributes are always copied.
Parameters:
*ipAdpIdentificator
[in] : The element to duplicate. Elements must be of duplicable type (Reference, RepReference, Entity...), else an error will be put in the error monitor at duplication time.
Returns:
S_OK Operation succeeded
E_FAIL Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
E_UNEXPECTED Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
o AddElement
public AddElement( ipAdpIdentificator,
const iAdpAttributeSet)
Add element to duplicate with specific attributes to be set on the clone.
Role: Entry point to add elements to duplication. The elements will be duplicated only if the Duplicate method is called. The attribute set is associated to the adp identificator . The given attributes will complete and may overwrite the ones retrieved through the PLMIdentificationInitialization business logic. Please note that CAA attributes are always copied.
Parameters:
*ipAdpIdentificator
[in] : The element to duplicate. Elements must be of duplicable type (Reference, RepReference, Entity...), else an error will be put in the error monitor at duplication time.
&iAdpAttributeSet
[in] : The attributes which will be overriden. The modified attributes must only be of string type.
Returns:
S_OK Operation succeeded
E_FAIL Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
E_UNEXPECTED Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
o Duplicate
public Duplicate()
Launch duplication.
Role: The duplication is done on the server at this very moment. Elements are allowed to be in session. Elements won't be replaced in session. This method won't return the cloned components.
Returns:
S_OK Operation succeeded
E_FAIL Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
E_UNEXPECTED Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
o Duplicate
public Duplicate( oComponentsAssociation)
Launch duplication.
Role: The duplication is done on the server at this very moment. Elements are allowed to be in session. Elements won't be replaced in session. This method will return the cloned components. The components which were not added to this class but which were duplicated though (ie. instances, connexions, ports...) will be present in output.
Parameters:
oComponentsAssociation
[out] Association of original components and duplicata (output of duplication). Every duplicated component will be here.
Returns:
S_OK Operation succeeded
E_FAIL Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
E_UNEXPECTED Error were encountered, no duplication done. See error reviewer content to fetch errors details. Nothing was done during the operation
o GetErrorReviewer
public GetErrorReviewer( oErrorReviewer)
Get the error reviewer.
Parameters:
oErrorReviewer
[out] Reviewer containing errors
See also:

This object is included in the file: CATAdpDuplicator.h
If needed, your Imakefile.mk should include the module: CATPLMIntegrationUse

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.