© 2001 BEA Systems, Inc.

com.bea.commerce.campaign
Interface CampaignRepository


public interface CampaignRepository

Campaign repository EJB object interface.


Method Summary
 void clearEndStates(java.lang.String campaignId)
          Clear all of the user end states associated to a campaign.
 boolean deleteCampaign(java.lang.String campaignId)
          Permanently delete a campaign.
 java.util.Collection findCampaignInfo(java.lang.String query, java.lang.String sortBy, int max)
          Get a list of CampaignInfos that match the query.
 java.util.Collection findCampaignInfo(java.lang.String query, java.lang.String sortBy, int max, java.util.Collection attributeNames)
          Get a list of CampaignInfos that match the query.
 java.lang.String getCampaign(java.lang.String campaignId)
          Get the XML of the named campaign.
 CampaignService getCampaignService()
          Return the campaign service this is tied to.
 void loadAllCampaigns()
          Tell the campaign repository to load all the campaigns from the data store.
 boolean setCampaign(java.lang.String campaign)
          Set the XML of the named campaign.
 

Method Detail

findCampaignInfo

public java.util.Collection findCampaignInfo(java.lang.String query,
                                             java.lang.String sortBy,
                                             int max,
                                             java.util.Collection attributeNames)
                                      throws java.lang.IllegalArgumentException,
                                             javax.ejb.EJBException,
                                             java.rmi.RemoteException
Get a list of CampaignInfos that match the query.

The following property names are allowed in the query string:

Example Queries:

The sortBy may reference any of the previously listed property names, except for 'validClassifications'.

The CampaignInfos that are returned from this method will always have the 'id', 'name', 'description', 'activeFlag', and 'shutdownFlag' attributes set. The attributeNames collection should be the String attributes names to also include. The supported attribute names are 'startDate', 'stopDate', 'sponsorName', 'valueProposition', and 'goalDescription'. Anyother attributes names will be ignored. If the attribute name is not listed, it's value in the CampaignInfo will be null.

Parameters:
query - the query string.
sortBy - the sorting clause.
max - the maximum number to return (<= 0 for all).
attributeNames - the list of additional attribute names to include in the CampaignInfo objects.
Returns:
a list of CampaignInfo objects.
Throws:
java.lang.IllegalArgumentException - thrown on an invalid query or sortBy string.
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

findCampaignInfo

public java.util.Collection findCampaignInfo(java.lang.String query,
                                             java.lang.String sortBy,
                                             int max)
                                      throws java.lang.IllegalArgumentException,
                                             javax.ejb.EJBException,
                                             java.rmi.RemoteException
Get a list of CampaignInfos that match the query.

This will return CampaignInfo object with only the default attributes set ('id', 'name', 'description', 'activeFlag', and 'shutdownFlag').

Parameters:
query - the query string.
sortBy - the sorting clause.
max - the maximum number to return (<= 0 for all).
Returns:
a list of CampaignInfo objects.
Throws:
java.lang.IllegalArgumentException - thrown on an invalid query or sortBy string.
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.
See Also:
findCampaignInfo(java.lang.String, java.lang.String, int, java.util.Collection)

getCampaign

public java.lang.String getCampaign(java.lang.String campaignId)
                             throws javax.ejb.EJBException,
                                    java.rmi.RemoteException
Get the XML of the named campaign.
Parameters:
campaignId - the id of the campaign.
Returns:
the campaign's XML, or null on no such campaign.
Throws:
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

setCampaign

public boolean setCampaign(java.lang.String campaign)
                    throws java.lang.IllegalArgumentException,
                           javax.ejb.EJBException,
                           java.rmi.RemoteException
Set the XML of the named campaign.

The campaign XML should be in UTF-8. Additionally, the top-level campaign tag should have an xsi:schemaLocation for 'campaign.xsd'.

Parameters:
campaignName - the name of the campaign.
campaign - the XML of the campaign.
Returns:
true if the campaign was modified, false if it was created.
Throws:
java.lang.IllegalArgumentException - throw on invalid XML.
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

deleteCampaign

public boolean deleteCampaign(java.lang.String campaignId)
                       throws javax.ejb.EJBException,
                              java.rmi.RemoteException
Permanently delete a campaign.

This will remove the campaign definition from the repository, making the campaign no longer available. If the campaign had not previosly been shutdown, it will be now.

Parameters:
campaignId - the id of the campaign.
Returns:
true if the campaign was removed, false if it did not exist.
Throws:
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

loadAllCampaigns

public void loadAllCampaigns()
                      throws java.rmi.RemoteException,
                             javax.ejb.EJBException
Tell the campaign repository to load all the campaigns from the data store.

This could be a time-intensive operation and should only happen at server startup. Incremental changes and additions via the CampaignRepository will automatically update the CampaignService.

Throws:
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

getCampaignService

public CampaignService getCampaignService()
                                   throws java.rmi.RemoteException,
                                          javax.ejb.EJBException
Return the campaign service this is tied to.

This will be used for cleaning up campaigns.

Throws:
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.

clearEndStates

public void clearEndStates(java.lang.String campaignId)
                    throws java.rmi.RemoteException,
                           javax.ejb.EJBException
Clear all of the user end states associated to a campaign.
Throws:
EJBException - thrown on an error.
java.rmi.RemoteException - thrown on a communications error.
See Also:
ScenarioService.clearEndStates(com.bea.commerce.campaign.ScenarioContainer)

© 2001 BEA Systems, Inc.

Copyright © 2001 BEA Systems, Inc. All Rights Reserved