com.ibm.commerce.pagelayout.facade.server.helpers.activity

Class AbstractPageLayoutActivity

  • java.lang.Object
    • com.ibm.commerce.pagelayout.facade.server.helpers.activity.AbstractPageLayoutActivity
  • Direct Known Subclasses:
    PageLocationActivity


    public abstract class AbstractPageLayoutActivity
    extends java.lang.Object
    This class is the base class for a Page Layout Activity. A Page Layout Activity encapsulates a Marketing Activity. Each Page Layout Activity has a backing Marketing Activity. The Page Layout Activity exposes simple Page Layout friendly getters and setters for operating on the Marketing Activity. The clients of Page Layout Activities are not directly tied to Marketing Activities.

    A Page Layout Activity cannot be instantiated directly. It is used only in conjunction with the corresponding Page Layout Activity Helper.

    This base class provides methods for the following:

    Since this is a base class, it only provides the basic and commonly used getters & setters. Each Activity can have a different structure. As mentioned in AbstractPageLayoutActivityHelper.tailorActivityTemplate(ActivityType, String, String), you can add/overwrite the structure of an existing Activity Template during SAR publish. To access the new Campaign Elements (Targets, Actions, etc) which you may have added, you can add appropriate getters & setters by extending this class. For example, let's say you added a new Activity Template that has a new Action called "showPageLayout" which stores the Page Layout Id. The setter & getter would have the implementation like the following:
            public void setLayoutId(String layoutId){
                    final String METHODNAME = "setLayoutId(String layoutId)";
                    LOGGER.entering(CLASSNAME, METHODNAME, layoutId);
                    
                    CampaignElementType showLayoutElement = getCampaignElement(PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_ACTION_LAYOUT);
                    if(showLayoutElement == null){
                            throw new PageLayoutSystemException(PageLayoutSystemMessageKeys._SYS_ACTIVITY_ELEMENT_NOT_EXIST, PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_ACTION_LAYOUT, CLASSNAME, METHODNAME);
                    }
                    
                    List campaignElementVariableList = showLayoutElement.getCampaignElementVariable();
                    
                    for (CampaignElementVariableType campaignElementVariable : campaignElementVariableList) {
                            if(PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_VARIABLE_NAME_PAGE_LAYOUT_ID.equals(campaignElementVariable.getName())){
                                    campaignElementVariable.setValue(layoutId);
                                    break;
                            }
                    }
                    
                    dirtyElement(showLayoutElement);
                    
                    LOGGER.exiting(CLASSNAME, METHODNAME);
            }
            
            public String getLayoutId(){
                    final String METHODNAME = "getLayoutId()";
                    LOGGER.entering(CLASSNAME, METHODNAME);
                    
                    CampaignElementType showLayoutElement = getCampaignElement(PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_ACTION_LAYOUT);
                    if(showLayoutElement == null){
                            throw new PageLayoutSystemException(PageLayoutSystemMessageKeys._SYS_ACTIVITY_ELEMENT_NOT_EXIST, PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_ACTION_LAYOUT, CLASSNAME, METHODNAME);
                    }
                    
                    String layoutId = null;
                    List campaignElementVariableList = showLayoutElement.getCampaignElementVariable();
                    
                    for (CampaignElementVariableType campaignElementVariable : campaignElementVariableList) {
                            if(PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_VARIABLE_NAME_PAGE_LAYOUT_ID.equals(campaignElementVariable.getName())){
                                    layoutId = campaignElementVariable.getValue();
                                    break;
                            }
                    }
                    
                    LOGGER.exiting(CLASSNAME, METHODNAME, layoutId);
                    return layoutId;
            }
     
    In the above code snippet, the reference to Campaign Element for "showPageLayout" is got using the method getCampaignElement(String). In the setter, the Page layout Id is set in the Campaign Element and then final the Campaign Element is added to the set of dirty elements in the Activity using dirtyElement(CampaignElementType). When the Activity is finally saved by invoking AbstractPageLayoutActivityHelper.savePageLayoutActivity(List), only the dirty Campaign Elements are saved.

    Similarly, if you set values in the Activity itself like start date, end date, priority, etc then your setter should make the Activity dirty by invoking dirtyActivity(). The Page Layout Activity Framework will save the Activity level details only if the Activity is dirty.

    See Also:
    AbstractPageLayoutActivityHelper
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.String getActivityId()
      Returns the Activity Id of this Page Layout Activity.
      CampaignElementType getCurrentPageCampaignElement()
      This method returns the Current Page Campaign Element template name of the Page Layout Activity.
      java.lang.String getDeviceClass()
      Returns the Device Class of this Page Layout Activity.
      java.lang.Object getEnddate()
      Returns the End Date of this Page Layout Activity.
      java.lang.String getName()
      Returns the Name of this Page Layout Activity.
      java.math.BigInteger getPriority()
      Returns the Priority of this Page Layout Activity.
      java.lang.Object getStartDate()
      Returns the Start Date of this Page Layout Activity.
      java.lang.String getStoreId()
      Returns the Store Id of this Page Layout Activity.
      void setCurrentPageCampaignElementTemplate(CampaignElementType newCurrentPageCampaignElement)
      Sets the Current Page campaign element in this Page Layout Activity to the specified element.
      void setDeviceClass(java.lang.String deviceClass)
      Sets the Device Class in this Page Layout Activity.
      void setEndDate(java.lang.Object date)
      Sets the End Date of this Page Layout Activity.
      void setName(java.lang.String name)
      Sets the Name of this Page Layout Activity.
      void setPriority(java.math.BigInteger priority)
      Sets the Priority of this Page Layout Activity.
      void setStartDate(java.lang.Object date)
      Sets the Start Date of this Page Layout Activity.
      void setStoreId(java.lang.String storeId)
      Sets the Store Id of this Page Layout Activity.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getActivityId

        public final java.lang.String getActivityId()
        Returns the Activity Id of this Page Layout Activity.
        Returns:
        The Activity Id.
      • setName

        public void setName(java.lang.String name)
        Sets the Name of this Page Layout Activity.
        Parameters:
        name - The Page Layout Activity Name to set.
      • getName

        public java.lang.String getName()
        Returns the Name of this Page Layout Activity.
        Returns:
        The Page Layout Activity name.
      • setStoreId

        public void setStoreId(java.lang.String storeId)
        Sets the Store Id of this Page Layout Activity.
        Parameters:
        storeId - The Store Id to set.
      • getStoreId

        public java.lang.String getStoreId()
        Returns the Store Id of this Page Layout Activity.
        Returns:
        The Store Id of this Page Layout Activity.
      • setStartDate

        public void setStartDate(java.lang.Object date)
        Sets the Start Date of this Page Layout Activity.
        Parameters:
        date - The Start Date to set. The format should be an SDO representation of XML dateTime.
      • getStartDate

        public java.lang.Object getStartDate()
        Returns the Start Date of this Page Layout Activity.
        Returns:
        The Start Date of this Page Layout Activity.
      • setEndDate

        public void setEndDate(java.lang.Object date)
        Sets the End Date of this Page Layout Activity.
        Parameters:
        date - The End Date to set. The format should be an SDO representation of XML dateTime.
      • getEnddate

        public java.lang.Object getEnddate()
        Returns the End Date of this Page Layout Activity.
        Returns:
        The End Date of this Page Layout Activity.
      • setPriority

        public void setPriority(java.math.BigInteger priority)
        Sets the Priority of this Page Layout Activity.
        Parameters:
        priority - The Priority of this Page Layout Activity.
      • getPriority

        public java.math.BigInteger getPriority()
        Returns the Priority of this Page Layout Activity.
        Returns:
        The Priority of this Page Layout Activity.
      • getCurrentPageCampaignElement

        public CampaignElementType getCurrentPageCampaignElement()
        This method returns the Current Page Campaign Element template name of the Page Layout Activity. Possible Current Page target templates are:
        • PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_CATEGORY
        • PageLayoutActivityHelperConstants.CAMPAIGN_ELEMENT_TEMPLATE_NAME_PRODUCT

        The Map of Campaign Elements present in this Page Layout Activity is constructed in the constructor AbstractPageLayoutActivity(ActivityType, AbstractPageLayoutActivityHelper).

        Returns:
        The Campaign Element reference. It returns NULL if the Campaign Element does not exist for the given name.
      • setCurrentPageCampaignElementTemplate

        public void setCurrentPageCampaignElementTemplate(CampaignElementType newCurrentPageCampaignElement)
        Sets the Current Page campaign element in this Page Layout Activity to the specified element. The DMELEMENT DMELETEMPLATE_ID of this layout activity is changed.
        Parameters:
        newCurrentPageCampaignElement - The New Campaign Element to set.
      • setDeviceClass

        public void setDeviceClass(java.lang.String deviceClass)
        Sets the Device Class in this Page Layout Activity.
        Parameters:
        deviceClass - The Device Class to set.
      • getDeviceClass

        public java.lang.String getDeviceClass()
        Returns the Device Class of this Page Layout Activity.
        Returns:
        The Device Class of this Page Layout Activity.