atg.commerce.promotion
Class PromotionImportExport

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.commerce.promotion.PromotionImportExport
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class PromotionImportExport
extends GenericService

This is the main class for the Promotions Import Export API. It enables integrators to import and export promotions. To import promotions the call sequence is, startImportExportSession, importPromotion (once for each promotion to import) and endImportExportSession. To do an export the call is either exportPromotionsById or exportPromotionsByRQLQuery. It is not necessary to call the xxxSession methods for an export. When running against a versioned repository the API will automatically make the appripate calls to the PublishingWorklowAutomator component, in order to take care of the CA project details. The integrator should not need to call PublishingWorklowAutomator directly.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String PMDL_VERSION
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
PromotionImportExport()
           
 
Method Summary
protected  java.lang.String addPromotion(PromotionImportExportSession pSession, PromotionImportExportInfo pPromotion)
          addPromotion This method manages the addition of a promotion to the promotions repository.
protected  java.lang.String createClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier, java.lang.String pTemplateId)
          createClosenessQualifier This method manages the creation of a closeness qualifier.
protected  java.lang.String createCoupon(CouponImportExportInfo pCoupon, java.lang.String pPromotionId)
          createCoupon This method manages the creation of a coupon.
protected  java.lang.String deleteClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier)
          deleteClosenessQualifier This method manages the deletion of a closeness qualifier.
protected  void deleteCoupon(CouponImportExportInfo pCoupon, java.lang.String pPromotionId)
          deleteCoupon This method manages the deletion of a coupon.
 void doStartService()
          doStartService This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.
 void doStopService()
          doStopService This is called when a Service is required to shut down.
 void endImportExportSession(PromotionImportExportSession pSession)
          endImportExportSession This method sets ends the import export session by completing the current transaction and ending the publishing workflow session in the case of import into a versioned repository.
 java.util.List<PromotionImportExportInfo> exportPromotionsById(java.util.List<java.lang.String> pPromotionIds)
          exportPromotionsById This method enables the user to export promotions by specifying a list of promotion item ids.
 java.util.List<PromotionImportExportInfo> exportPromotionsByRQLQuery(java.lang.String pRQLQuery)
          exportPromotionsByRQLQuery This method enables the user to export promotions by specifying an RQL query to do the retrievals.
 int getBatchSize()
          Get the batch size.
 ClaimableTools getClaimableTools()
          Get the claimable tools.
 PromotionImportExportIntegrator[] getIntegrators()
          Gets the integrators.
 PromotionImportExportTools getPromotionImportExportTools()
          Get the promotion import export tools.
 PromotionTemplateManager getPromotionTemplateManager()
          Get the promotion template manager.
 PromotionTools getPromotionTools()
          Get the promotion tools.
 atg.epub.PublishingWorkflowSession getPublishingWorkflowAutomator()
          Get the publishing workflow automator.
 java.util.Hashtable<java.lang.String,java.lang.Object> getSessions()
          Get the sessions
 javax.transaction.TransactionManager getTransactionManager()
          Get the transaction manager.
 PromotionImportExportStatus importPromotion(PromotionImportExportSession pSession, PromotionImportExportInfo pPromotion)
          importPromotion This method enables the API user to create or update an individual promotion and all of its associated items, i.e.
protected  java.lang.String mergeIds(java.util.HashSet<RepositoryItem> pRepositoryItems, java.lang.String pCommaSeparatedIdList, java.lang.String pItemId)
          mergeIdList This method merges the ids, from a set of repository items, a comma separated list of ids (from a map value), and a single id representing the current item.
 void setBatchSize(int pBatchSize)
          Set the batch size.
 void setClaimableTools(ClaimableTools pClaimableTools)
          Set the claimable tools.
 void setIntegrators(PromotionImportExportIntegrator[] pIntegrators)
          Sets the integrators.
 void setPromotionImportExportTools(PromotionImportExportTools pPromotionImportExportTools)
          Set the promotion import export tools.
 void setPromotionTemplateManager(PromotionTemplateManager pPromotionTemplateManager)
          Set the promotion template manager.
 void setPromotionTools(PromotionTools pPromotionTools)
          Set the promotion tools.
 void setPublishingWorkflowAutomator(atg.epub.PublishingWorkflowSession pPublishingWorkflowAutomator)
          Set the publishing workflow automator.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Set the transaction manager.
 PromotionImportExportSession startImportExportSession(java.lang.String pSessionId)
          startImportExportSession This method sets up the import export session for the user.
protected  java.lang.String updateClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier, java.lang.String pTemplateId)
          updateClosenessQualifier This method manages the updating of a closeness qualifier.
protected  java.lang.String updateCoupon(CouponImportExportInfo pCoupon, java.lang.String pPromotionId)
          updateCoupon This method manages the updating of a coupon.
protected  java.lang.String updatePromotion(PromotionImportExportSession pSession, PromotionImportExportInfo pPromotion)
          updatePromotion This method manages the update of a promotion.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


PMDL_VERSION

public static final java.lang.String PMDL_VERSION
See Also:
Constant Field Values
Constructor Detail

PromotionImportExport

public PromotionImportExport()
Method Detail

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Get the transaction manager.

Returns:
- the transaction manager component.

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Set the transaction manager.

Parameters:
pTransactionManager - - the transaction manager component.

getClaimableTools

public ClaimableTools getClaimableTools()
Get the claimable tools.

Returns:
- the claimable tools component.

setClaimableTools

public void setClaimableTools(ClaimableTools pClaimableTools)
Set the claimable tools.

Parameters:
pClaimableTools - - the claimable tools component.

getPromotionTools

public PromotionTools getPromotionTools()
Get the promotion tools.

Returns:
- the promotion tools component.

setPromotionTools

public void setPromotionTools(PromotionTools pPromotionTools)
Set the promotion tools.

Parameters:
pPromotionTools - - the promotion tools component.

getPromotionImportExportTools

public PromotionImportExportTools getPromotionImportExportTools()
Get the promotion import export tools.

Returns:
- the promotion import export tools component.

setPromotionImportExportTools

public void setPromotionImportExportTools(PromotionImportExportTools pPromotionImportExportTools)
Set the promotion import export tools.

Parameters:
pPromotionImportExportTools - - the promotion import export tools component.

getPromotionTemplateManager

public PromotionTemplateManager getPromotionTemplateManager()
Get the promotion template manager.

Returns:
- the promotion template manager component.

setPromotionTemplateManager

public void setPromotionTemplateManager(PromotionTemplateManager pPromotionTemplateManager)
Set the promotion template manager.

Parameters:
pPromotionTemplateManager - - the promotion template manager component.

getPublishingWorkflowAutomator

public atg.epub.PublishingWorkflowSession getPublishingWorkflowAutomator()
Get the publishing workflow automator.

Returns:
- the publishing workflow automator component.

setPublishingWorkflowAutomator

public void setPublishingWorkflowAutomator(atg.epub.PublishingWorkflowSession pPublishingWorkflowAutomator)
Set the publishing workflow automator.

Parameters:
pPublishingWorkflowAutomator - - the publishing workflow automator component.

getBatchSize

public int getBatchSize()
Get the batch size.

Returns:
- the batch size to use for grouping imports in a single transaction.

setBatchSize

public void setBatchSize(int pBatchSize)
Set the batch size. This value determines how many promotion actions are grouped together into a single transaction.

Parameters:
pBatchSize - - the transaction batch size.

getIntegrators

public PromotionImportExportIntegrator[] getIntegrators()
Gets the integrators.

Returns:
- the integrators which are used to customise the import export API.

setIntegrators

public void setIntegrators(PromotionImportExportIntegrator[] pIntegrators)
Sets the integrators. These integrators enable system integrators to inject custom functionality into the promotion import export process.

Parameters:
pIntegrators - - the integrator components array.

getSessions

public java.util.Hashtable<java.lang.String,java.lang.Object> getSessions()
Get the sessions

Returns:
- the currently running import export sessions.

startImportExportSession

public PromotionImportExportSession startImportExportSession(java.lang.String pSessionId)
                                                      throws atg.commerce.promotion.PromotionException
startImportExportSession This method sets up the import export session for the user. When doing an import (as opposed to an export), it must be called to do the initialization, before any calls to the importPromotion method are made. When run against versioned repositories, this method takes care of the CA project details by making the appropriate calls to the PublishingWorkflowAutomator component (which sets up the CA project).

Parameters:
pSessionId - - the unique session id. If null, an id is generated.
Returns:
- a PromotionImportExportSession object for use by the user throughout the session.
Throws:
atg.commerce.promotion.PromotionException

importPromotion

public PromotionImportExportStatus importPromotion(PromotionImportExportSession pSession,
                                                   PromotionImportExportInfo pPromotion)
                                            throws atg.commerce.promotion.PromotionException
importPromotion This method enables the API user to create or update an individual promotion and all of its associated items, i.e. closeness qualifiers, promotion folder and coupons. Calls to this method must be sandwiched between calls to startImportExportSession and endImportExportSession.

Parameters:
pSession - - the import export session.
pPromotion - - the promotion details to import.
Returns:
- a PromotionImportExportStatus object detailing the result of the import.
Throws:
atg.commerce.promotion.PromotionException

exportPromotionsById

public java.util.List<PromotionImportExportInfo> exportPromotionsById(java.util.List<java.lang.String> pPromotionIds)
                                                               throws atg.commerce.promotion.PromotionException
exportPromotionsById This method enables the user to export promotions by specifying a list of promotion item ids. When exporting promotions there is not need to call startImportExportSession or endImportExportSession.

Parameters:
pPromotionIds - - the list of ids of the promotions to export. If null, all promotions are returned.
Returns:
- a list of PromotionImportExportInfo objects.
Throws:
atg.commerce.promotion.PromotionException

exportPromotionsByRQLQuery

public java.util.List<PromotionImportExportInfo> exportPromotionsByRQLQuery(java.lang.String pRQLQuery)
                                                                     throws atg.commerce.promotion.PromotionException
exportPromotionsByRQLQuery This method enables the user to export promotions by specifying an RQL query to do the retrievals. When exporting promotions there is not need to call startImportExportSession or endImportExportSession.

Parameters:
pRQLQuery - - the RQL query to be used to query the promotions repository.
Returns:
- a list of PromotionImportExportInfo objects.
Throws:
atg.commerce.promotion.PromotionException

endImportExportSession

public void endImportExportSession(PromotionImportExportSession pSession)
                            throws atg.commerce.promotion.PromotionException
endImportExportSession This method sets ends the import export session by completing the current transaction and ending the publishing workflow session in the case of import into a versioned repository. This method must be called at the end of an import session, i.e. after the last call to importPromotion.

Parameters:
pSession - - the import export session.
Throws:
atg.commerce.promotion.PromotionException

addPromotion

protected java.lang.String addPromotion(PromotionImportExportSession pSession,
                                        PromotionImportExportInfo pPromotion)
                                 throws atg.commerce.promotion.PromotionException
addPromotion This method manages the addition of a promotion to the promotions repository. It also manages the import of the associated items such as, promotion folder, closeness qualifiers and coupons.

Parameters:
pSession - - the import export session.
pPromotion - - the promotion details to import.
Returns:
- the id of the promotion.
Throws:
atg.commerce.promotion.PromotionException

updatePromotion

protected java.lang.String updatePromotion(PromotionImportExportSession pSession,
                                           PromotionImportExportInfo pPromotion)
                                    throws atg.commerce.promotion.PromotionException
updatePromotion This method manages the update of a promotion. It also manages the import of the associated items such as, promotion folder, closeness qualifiers and coupons.

Parameters:
pSession - - the import export session.
pPromotion - - the promotion details to import.
Returns:
- the id of the promotion.
Throws:
atg.commerce.promotion.PromotionException

createClosenessQualifier

protected java.lang.String createClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier,
                                                    java.lang.String pTemplateId)
                                             throws atg.commerce.promotion.PromotionException
createClosenessQualifier This method manages the creation of a closeness qualifier.

Parameters:
pClosenessQualifier - - the closeness qualifier import export object.
pTemplateId - - the id of the template to use (optional).
Returns:
- the id of the created closeness qualifier.
Throws:
atg.commerce.promotion.PromotionException

updateClosenessQualifier

protected java.lang.String updateClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier,
                                                    java.lang.String pTemplateId)
                                             throws atg.commerce.promotion.PromotionException
updateClosenessQualifier This method manages the updating of a closeness qualifier.

Parameters:
pClosenessQualifier - - the closeness qualifier import export object.
pTemplateId - - the id of the template to use (optional).
Returns:
- the id of the updated closeness qualifier.
Throws:
atg.commerce.promotion.PromotionException

deleteClosenessQualifier

protected java.lang.String deleteClosenessQualifier(ClosenessQualifierImportExportInfo pClosenessQualifier)
                                             throws atg.commerce.promotion.PromotionException
deleteClosenessQualifier This method manages the deletion of a closeness qualifier.

Parameters:
pClosenessQualifier - - the closeness qualifier import export object.
Returns:
- the id of the deleted closeness qualifier.
Throws:
atg.commerce.promotion.PromotionException

createCoupon

protected java.lang.String createCoupon(CouponImportExportInfo pCoupon,
                                        java.lang.String pPromotionId)
                                 throws atg.commerce.promotion.PromotionException
createCoupon This method manages the creation of a coupon.

Parameters:
pCoupon - - the coupon import export object.
pPromotionId - - the id of the promotion to associate with the coupon.
Returns:
- the id of the created coupon.
Throws:
atg.commerce.promotion.PromotionException

updateCoupon

protected java.lang.String updateCoupon(CouponImportExportInfo pCoupon,
                                        java.lang.String pPromotionId)
                                 throws atg.commerce.promotion.PromotionException
updateCoupon This method manages the updating of a coupon.

Parameters:
pCoupon - - the coupon import export object.
pPromotionId - - the id of the promotion to associate with the coupon.
Returns:
- the id of the updated coupon.
Throws:
atg.commerce.promotion.PromotionException

deleteCoupon

protected void deleteCoupon(CouponImportExportInfo pCoupon,
                            java.lang.String pPromotionId)
                     throws atg.commerce.promotion.PromotionException
deleteCoupon This method manages the deletion of a coupon.

Parameters:
pCoupon - - the coupon import export object.
pPromotionId - - the id of the current promotion.
Throws:
atg.commerce.promotion.PromotionException

mergeIds

protected java.lang.String mergeIds(java.util.HashSet<RepositoryItem> pRepositoryItems,
                                    java.lang.String pCommaSeparatedIdList,
                                    java.lang.String pItemId)
mergeIdList This method merges the ids, from a set of repository items, a comma separated list of ids (from a map value), and a single id representing the current item.

Parameters:
pRepositoryItems - - a HashSet of repository items.
pCommaSeparatedIdList - - a comma seperated list of ids.
pItemId - - a repository item id.
Returns:
- a comma separated list of the merged repository ids.

doStartService

public void doStartService()
doStartService This is called after a Service has been created, placed into the naming hierarchy, and initialized with its configured property values.

Overrides:
doStartService in class GenericService

doStopService

public void doStopService()
doStopService This is called when a Service is required to shut down.

Overrides:
doStopService in class GenericService