© 2001 BEA Systems, Inc.

com.bea.commerce.ebusiness.discount.mgmt
Interface DiscountMgmt


public interface DiscountMgmt

This interface defines the public interface of the DiscountMgmt service. This service controls the persistance of discount sets and the creation and access of discounts.


Method Summary
 void activateDiscount(QualificationDiscountId id)
          Mark the discount definition indicated by id as active.
 void addDiscountSet(java.lang.String setName, java.lang.String source)
          Stores the XML definition of the discount set if the discount set is not already present.
 void deactivateDiscount(QualificationDiscountId id)
          Mark the discount definition indicated by id as inactive.
 boolean deleteDiscount(QualificationDiscountId id)
          Delete the discount specified by id.
 boolean deleteDiscount(java.lang.String setName, java.lang.String discountName)
          Delete the discount specified by setName and discountName.
 boolean deleteDiscountSet(java.lang.String setName)
          Delete the discount set definition specified by setName.
 int deploySet(java.lang.String setName)
          Deploys the discount set.
 QualificationDiscountDef getDiscountById(QualificationDiscountId id)
          Gets a discount (QualificationDiscountDef) by it's id (QualificationDiscountId).
 QualificationDiscountDef getDiscountByName(java.lang.String setName, java.lang.String discountName)
          Gets a discount definition (QualificationDiscountDef) by its name.
 java.util.Set getDiscountsById(java.util.Set idSet, java.util.Set qualDiscountDefSet)
          Gets a Set of QualificationDiscountDefs whose ids (QualificationDiscountId)s are in the Set argument passed.
 java.util.Set getGlobalDiscounts()
          Gets all the global discounts currently deployed
 java.lang.String retrieveDiscountSet(java.lang.String setName)
          Gets the XML representation of the discount set by it's name.
 void updateDiscountSet(java.lang.String setName, java.lang.String source)
          Updates the set named setName to the new definition indicated by source.
 

Method Detail

addDiscountSet

public void addDiscountSet(java.lang.String setName,
                           java.lang.String source)
                    throws java.rmi.RemoteException,
                           SetAlreadyExistsException,
                           SetPersistenceException
Stores the XML definition of the discount set if the discount set is not already present.
Parameters:
setName - a String indicating the discount set's name
source - a String, the XML source definition of the discoun set
Throws:
SetAlreadyExistsException - if a discount set with this setName already exists
SetPersistenceException - if the set cannot be saved for some reason
java.rmi.RemoteException - thrown on a communication error

activateDiscount

public void activateDiscount(QualificationDiscountId id)
                      throws java.rmi.RemoteException,
                             DiscountNotFoundException
Mark the discount definition indicated by id as active.
Parameters:
id - the QualificationDiscountId of the discount to activate
Throws:
DiscountNotFoundException - if the discount specified by id cannot be found
java.rmi.RemoteException - thrown on a communication error

deactivateDiscount

public void deactivateDiscount(QualificationDiscountId id)
                        throws java.rmi.RemoteException,
                               DiscountNotFoundException
Mark the discount definition indicated by id as inactive.
Parameters:
id - the QualificationDiscountId of the discount to deactivate
Throws:
DiscountNotFoundException - if the discount specified by id cannot be found
java.rmi.RemoteException - thrown on a communication error

deploySet

public int deploySet(java.lang.String setName)
              throws java.rmi.RemoteException,
                     SetNotFoundException,
                     DiscountParsingException,
                     SetPersistenceException,
                     DiscountDeployException
Deploys the discount set. Deploying a discount set entails parsing the XML definition of the set into individual discounts which are then stored and ready for use. Before attmepting to deploy a set it must first added using addDiscountSet. During parsing definitons that are deployed are marked in set definition and the definition is re-saved.
Parameters:
setName - a String indicating the discount set's name
Returns:
the number of discounts deployed from the set
Throws:
SetNotFoundException - if the set specified setName cannot be found.
DiscountParsingException - if an unrecoverable failure occurs while that attempting to parse the set definition that prevents any discounts from being created.
SetPersistenceException - if the updated set definiton cannot be saved.
DiscountDeployException - if any errors occur that cause one or exceptions to not deploy
java.rmi.RemoteException - thrown on a communication error
See Also:
addDiscountSet(java.lang.String, java.lang.String)

deleteDiscount

public boolean deleteDiscount(QualificationDiscountId id)
                       throws DiscountNotFoundException,
                              DiscountInUseException,
                              java.rmi.RemoteException
Delete the discount specified by id. A discount can only be deleted if it is not being used in a DiscountAssociation.
Parameters:
id - the QualificationDiscountId of the discount to delete
Returns:
true if the discount was delete, false if it could not be delete. The most common reason deleting a discount might fails is if it is being used in a DiscountAssociation.
Throws:
DiscountNotFoundException - if the discount does not exists, or has not been deployed
DiscountInUseException - if the discount could not be deleted because it is being used
java.rmi.RemoteException - thrown on a communication error
See Also:
DiscountAssociation

deleteDiscount

public boolean deleteDiscount(java.lang.String setName,
                              java.lang.String discountName)
                       throws DiscountNotFoundException,
                              DiscountInUseException,
                              java.rmi.RemoteException
Delete the discount specified by setName and discountName. A discount can only be deleted if it is not being used in a DiscountAssociation.
Parameters:
setName - a String, the name of the set the discount being deleted belongs to
discountName - a String, the name the discount being deleted
Returns:
true if the discount was delete, false if it could not be delete. The most common reason deleting a discount might fails is if it is being used in a DiscountAssociation.
Throws:
DiscountNotFoundException - if the discount does not exists, or has not been deployed
DiscountInUseException - if the discount could not be deleted because it is being used
java.rmi.RemoteException - thrown on a communication error
See Also:
DiscountAssociation

deleteDiscountSet

public boolean deleteDiscountSet(java.lang.String setName)
                          throws SetNotFoundException,
                                 DiscountSetInUseException,
                                 java.rmi.RemoteException
Delete the discount set definition specified by setName. he set can only be deleted if none of the discounts it defines are in use, that is they were deployed and not deleted.
Parameters:
setName - a String, the name of the set to delete
Returns:
true if the discount set was delete, false if it could not be delete. The most common reason deleting a discount set might fails is if any of the set's discounts are still in use.
Throws:
SetNotFoundException - if the set could not be found
DiscountSetInUseException - if one or more discounts from the set are still deployed
java.rmi.RemoteException - thrown on a communication error

getGlobalDiscounts

public java.util.Set getGlobalDiscounts()
                                 throws java.rmi.RemoteException
Gets all the global discounts currently deployed
Returns:
a Set containging all of the global QualificationDiscountDef objects currently deployed, if there are no global discounts deployed the Set will be empty.
Throws:
java.rmi.RemoteException - thrown on a communication error

getDiscountById

public QualificationDiscountDef getDiscountById(QualificationDiscountId id)
                                         throws java.rmi.RemoteException
Gets a discount (QualificationDiscountDef) by it's id (QualificationDiscountId).
Parameters:
id - the QualificationDiscountId of the discount
Returns:
the QualificationDiscountDef specifed by the id or null if the discount was not found
Throws:
java.rmi.RemoteException - thrown on a communication error

getDiscountsById

public java.util.Set getDiscountsById(java.util.Set idSet,
                                      java.util.Set qualDiscountDefSet)
                               throws java.rmi.RemoteException
Gets a Set of QualificationDiscountDefs whose ids (QualificationDiscountId)s are in the Set argument passed.
Parameters:
idSet - a Set of QualificationDiscountId objects. This Set will not be modified by this method.
qualDiscountDefSet - an empty set into which the QualificationDiscountDef objects will be placed. This set must be modifiable. Anything that was already in the set will be removed.
Returns:
a Set, the one specifed by the qualDiscountDefSet parameter, of QualificationDiscountDef objects whose QualificationDiscountIds match those passed in the idSet parameter. If no matching QualificationDiscountDef objects the returned set will be empty.
Throws:
java.rmi.RemoteException - thrown on a communication error

getDiscountByName

public QualificationDiscountDef getDiscountByName(java.lang.String setName,
                                                  java.lang.String discountName)
                                           throws java.rmi.RemoteException
Gets a discount definition (QualificationDiscountDef) by its name. Since discount name are only unquie within a discount set the set name is required also.
Parameters:
setName - the name of the set to which the discount belongs
discountName - the id (QualificationDiscountId) of the discount to retrieve
Returns:
the discount definition (QualificationDiscountDef), or null if the discount was not found
Throws:
java.rmi.RemoteException - thrown on a communication error

retrieveDiscountSet

public java.lang.String retrieveDiscountSet(java.lang.String setName)
                                     throws java.rmi.RemoteException,
                                            SetNotFoundException
Gets the XML representation of the discount set by it's name.
Parameters:
setName - the name of the discount set definiton to retrieve
Returns:
a String containing the XML representation of the discount set
Throws:
SetNotFoundException - if the set could not be found
java.rmi.RemoteException - thrown on a communication error

updateDiscountSet

public void updateDiscountSet(java.lang.String setName,
                              java.lang.String source)
                       throws java.rmi.RemoteException,
                              SetNotFoundException,
                              SetPersistenceException
Updates the set named setName to the new definition indicated by source.
Parameters:
setName - the name of the set to update
source - the new XML discount set defintion that will be specified by setName
Throws:
SetNotFoundException - if a set called setName isn't already present
SetPersistenceException - if the new set cannot be saved.
java.rmi.RemoteException - thrown on a communication error

© 2001 BEA Systems, Inc.

Copyright © 2001 BEA Systems, Inc. All Rights Reserved