InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IAMService Class Referenceabstract

#include <IAMService.h>

Inheritance diagram for IAMService:
IPMUnknown

Public Types

enum  { kDefaultIID = IID_IAMSERVICE }
 
enum  {
  enInvalid = 0, enTargetAsset = kWorkgroupPrefix + 1, enCheckInComment = kWorkgroupPrefix + 2, enContentSaver = kWorkgroupPrefix + 3,
  enUIFlags = kWorkgroupPrefix + 4, enUniqueAssetLocation = kWorkgroupPrefix + 5, enUseStoredData = kWorkgroupPrefix + 6, enCheckOutToUserName = kWorkgroupPrefix + 7,
  enOverrideAuthority = kWorkgroupPrefix + 8, enForceSave = kWorkgroupPrefix + 9, enCommandUndoability = kWorkgroupPrefix + 10, enSaveVersion = kWorkgroupPrefix + 11,
  enModelObject = kWorkgroupPrefix + 12
}
 

Public Member Functions

virtual ErrorCode Do (IManageableAsset *pAsset=nil)=0
 
virtual bool16 VerifyContext (IManageableAsset *pAsset=nil)=0
 
- Public Member Functions inherited from IPMUnknown
virtual IPMUnknownQueryInterface (PMIID interfaceID) const =0
 
virtual void AddRef () const =0
 
virtual void Release () const =0
 

Detailed Description

The IAMService interface represents an asset management service. An implementation of this interface should perform a specific, atomic service that either succeeds or has no affect whatsoever. Each asset management service has unique AssetService number. It is the responsibility of the IAMServiceProvider to map the AssetService number to the actual service implementation.

The typical implementation of a service aggregates IID_IAMSERVICE on a separate service boss. For exchanging service data parameters between the service and the caller, also aggregate the IID_IAMSERVICEDATA (IAMServiceData) interface. For most services, the standard implementation of IAMServiceData (kAMServiceDataImpl) can be used.

Example:

The following example defines an IAMServiceProvider::enCheckOut service that uses the Version Cue API to do the checkout operation.


    Class

    {

        kVCCheckOutServiceBoss,

        kInvalidClass,

        {

            IID_IAMSERVICE,     kVCCheckOutServiceImpl,

            IID_IAMSERVICEDATA, kAMServiceDataImpl, // standard impl

            IID_IVCUTILS,       kVCUtilsImpl,       // utils specific to Version Cue

        }

    },

Example:

The following sample code invokes the above enCheckOut service. Assume that assetRef is a valid UIDRef and uiFlags are standard UIFlags passed in to this code.


    ErrorCode status(kFailure);

    InterfacePtr<IManageableAsset> asset( assetRef, UseDefaultIID() );

    InterfacePtr<IAMSPManager> iAMSPManager( GetExecutionContextSession(), UseDefaultIID() );

    if ( asset && asset->IsBound() && iAMSPManager )

    {

        InterfacePtr<IAMServiceProvider> amsp( iAMSPManager->GetServiceProvider( 

            asset->GetServiceProviderClass() ), UseDefaultIID() );

        if ( amsp )

        {

            status = kSuccess; // always assume kSuccess if no service is available

            InterfacePtr<IAMService> checkOutService( amsp->GetService( IAMServiceProvider::enCheckOut ) );

            if ( checkOutService )

            {

                InterfacePtr<IAMServiceData> checkOutServiceData( checkOutService, UseDefaultIID() );

                if ( checkOutServiceData )

                    checkOutServiceData->Set( IAMService::enUIFlags, uiFlags );
                status = checkOutService->Do( asset );

            }

        }

    }

See Also
IAMServiceProvider.
IAMServiceData.

Member Enumeration Documentation

anonymous enum

Predefined IAMServiceData identifiers for data parameters passed to services (input parameter) or returned to the service requestor (output parameter).

See Also
IAMServiceData.
IAMServiceProvider for the data parameters and data types required by each predefined AssetService.
Enumerator
enInvalid 

Default identifer.

enTargetAsset 

Input parameter: the asset to perform the service on.

enCheckInComment 

Input parameter: the CheckIn comment.

enContentSaver 

Input parameter: the ISaveAssetContent callback interface.

enUIFlags 

Input parameter: the UIFlags permitted for the service.

enUniqueAssetLocation 

Output parameter: the unique asset location as return by the IAMServiceProvider::enGetUniqueAssetLocation service.

enUseStoredData 

Input parameter: flag specifies use of stored asset management-specific data for an IDataLink.

enCheckOutToUserName 

Input parameter: user name to check out an asset to.

enOverrideAuthority 

Input parameter: flag specifies permission to override a lock during CheckIn.

enForceSave 

Input parameter: asset save option during CheckIn.

enCommandUndoability 

Input parameter: the ICommand::Undoability permitted for any ICommands executed by the service.

enSaveVersion 

Input parameter: flag specifies whether or not to save a new version as part of a CheckIn.

enModelObject 

Input parameter: identifies the model object associated with an asset.

Member Function Documentation

virtual ErrorCode IAMService::Do (IManageableAssetpAsset = nil)
pure virtual

The Do method executes the service. Unlike ICommands, services are executed by directly calling the Do() method. For convenience, facades may be used to set up service data, invoke the IAMService::Do() method and interpret the results.

Parameters
pAssetis a pointer to an IManageableAsset object that is the target of the service. This parameter is specified if the service target is a model boss that aggregates the IManageableAsset interface. Omit this parameter for other service targets; instead, set the target using the service's IAMServiceData interface.
See Also
IAMServiceData.
IManageableAsset.
IWorkgroupFacade.
virtual bool16 IAMService::VerifyContext (IManageableAssetpAsset = nil)
pure virtual

The VerifyContext method verifies that the service is allowed for the specified asset. It does not predict whether or not the service will execute successfully. This method is useful for enabling or disabling UI widgets that invoke the service. For example, VerifyContext() for a CheckIn service would verify that the asset is checked out.

Parameters
pAssetis a pointer to an IManageableAsset object that is the target of the service.
Returns
kFalse only if it is known that the service should not be executed within the current context; otherwise, this method should return kTrue.
See Also
IManageableAsset.