com.ibm.commerce.marketing.promotion.policy
Class PromotionPolicyJDBCPersistenceManager
- java.lang.Object
-
- com.ibm.commerce.marketing.promotion.persistence.JDBCPersistenceManager
-
- com.ibm.commerce.marketing.promotion.policy.PromotionPolicyJDBCPersistenceManager
-
- All Implemented Interfaces:
- KeyResolver, PromotionPolicyPersistenceManager, XMLizable, java.io.Serializable
public class PromotionPolicyJDBCPersistenceManager extends com.ibm.commerce.marketing.promotion.persistence.JDBCPersistenceManager implements PromotionPolicyPersistenceManager
This Class is using JDBC connection to manage the promotion policy data in the database.XML Snippet for PromotionPolicyJDBCPersistenceManager:
<PromotionPolicyJDBCPersistenceManager impl="com.ibm.commerce.marketing.promotion.policy.PromotionPolicyJDBCPersistenceManager"> <InitialCacheSize>64</InitialCacheSize> <MaxCacheSize>1024</MaxCacheSize> </PromotionPolicyJDBCPersistenceManager>
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description PromotionPolicyJDBCPersistenceManager()
Default Constructor for PromotionPolicyJDBCPersistenceManager.PromotionPolicyJDBCPersistenceManager(java.sql.Connection con)
Constructor for PromotionPolicyJDBCPersistenceManager.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
create(PromotionPolicy policy)
Create a new promotion policy.PromotionPolicyKey[]
findGlobalPolicyKeysByStore(StoreKey key)
Finds all global promotion policies within a storePromotionPolicyKey[]
findPolicyKeysByGroupAndStatus(com.ibm.commerce.marketing.promotion.group.PromotionGroupKey gkey, int status)
Finds promotion policies based on the group with which they are associated and their statusvoid
fromXML(org.w3c.dom.Node anXMLNode)
Transforms an XML node into a real Object.int
getCacheInitialSize()
Gets initial cache sizeint
getCacheMaxSize()
Gets maximum cache sizevoid
initCache()
Initials the cache.PromotionPolicy
load(PromotionPolicyKey key)
Finds promotion policy by promotion policy key.java.lang.Number
lookup(Key key)
Find policy by key.java.lang.Number
nextNumericKey()
Returns the next primary key valuevoid
reload(PromotionPolicyKey key)
Invalidates the cache for one promotion policy.void
reloadAll()
Invalidates all policies currently in the cache.void
remove(PromotionPolicy policy)
This removing is referring to marked for deletion.Key
reverseLookup(java.lang.Number keyValue)
Find promotion policy by numeric key.void
save(PromotionPolicy policy)
Save promotion policy.void
setCacheInitialSize(int i)
Sets initial cache sizevoid
setCacheMaxSize(int i)
Sets maximum cache sizejava.lang.String
toXML()
Converts any object into an XML format representation.
-
-
-
Constructor Detail
-
PromotionPolicyJDBCPersistenceManager
public PromotionPolicyJDBCPersistenceManager(java.sql.Connection con)
Constructor for PromotionPolicyJDBCPersistenceManager.- Parameters:
con
- database connection
-
PromotionPolicyJDBCPersistenceManager
public PromotionPolicyJDBCPersistenceManager()
Default Constructor for PromotionPolicyJDBCPersistenceManager.
-
-
Method Detail
-
reload
public void reload(PromotionPolicyKey key)
Invalidates the cache for one promotion policy.- Specified by:
reload
in interfacePromotionPolicyPersistenceManager
- Parameters:
key
- to the promotion policy- See Also:
PromotionPolicyPersistenceManager.reload(PromotionPolicyKey)
-
reloadAll
public void reloadAll()
Invalidates all policies currently in the cache.- Specified by:
reloadAll
in interfacePromotionPolicyPersistenceManager
- See Also:
PromotionPolicyPersistenceManager.reloadAll()
-
load
public PromotionPolicy load(PromotionPolicyKey key) throws PersistenceObjectNotFoundException, PersistenceObjectReadException
Finds promotion policy by promotion policy key.- Specified by:
load
in interfacePromotionPolicyPersistenceManager
- Parameters:
PromotionPolicyKey
- key- Returns:
- PromotionPolicy
- Throws:
PersistenceObjectNotFoundException
- when the object identified by the key is not foundPersistenceObjectReadException
- when fails to load this object- See Also:
PromotionPolicyPersistenceManager.load(PromotionPolicyKey)
-
create
public void create(PromotionPolicy policy) throws PersistenceObjectAlreadyExistsException, PersistenceCreateException
Create a new promotion policy.- Specified by:
create
in interfacePromotionPolicyPersistenceManager
- Parameters:
PromotionPolicy
- policy The promotion policy to create in the database.- Throws:
PersistenceObjectAlreadyException
- when the object to create as identified by the key already existsPersistenceCreateException
- when fails to create this objectPersistenceObjectAlreadyExistsException
- when the object to create as identified by the key already exists- See Also:
PromotionPolicyPersistenceManager.create(PromotionPolicy)
-
remove
public void remove(PromotionPolicy policy) throws PersistenceObjectNotFoundException, PersistenceRemoveException
This removing is referring to marked for deletion.- Specified by:
remove
in interfacePromotionPolicyPersistenceManager
- Parameters:
PromotionPolicy
- pro- Throws:
PersistenceObjectNotFoundException
- when the object identified by the key is not foundPersistenceRemoveException
- when fails to remove this object- See Also:
com.ibm.commerce.marketing.promotion.policy.PromotionPolicyPersistenceManager#delete(PromotionPolicy)
-
save
public void save(PromotionPolicy policy) throws PersistenceObjectNotFoundException, PersistenceObjectWriteException
Save promotion policy.- Specified by:
save
in interfacePromotionPolicyPersistenceManager
- Parameters:
PromotionPolicy
- policy- Throws:
PersistenceObjectNotFoundException
- when the object identified by the key is not foundPersistenceObjectWriteException
- when fails to write to this object- See Also:
PromotionPolicyPersistenceManager.save(PromotionPolicy)
-
lookup
public java.lang.Number lookup(Key key)
Find policy by key.- Specified by:
lookup
in interfaceKeyResolver
- Parameters:
key
- is the Key for lookup.- Returns:
- number corresponding to the Key if found.
- See Also:
KeyResolver.lookup(Key)
-
reverseLookup
public Key reverseLookup(java.lang.Number keyValue)
Find promotion policy by numeric key.- Specified by:
reverseLookup
in interfaceKeyResolver
- Parameters:
keyValue
- is a number representing the key.- Returns:
- Key object if found.
- See Also:
KeyResolver.reverseLookup(Number)
-
nextNumericKey
public java.lang.Number nextNumericKey()
Returns the next primary key value- Specified by:
nextNumericKey
in interfacePromotionPolicyPersistenceManager
- Returns:
- next primary key value
-
findGlobalPolicyKeysByStore
public PromotionPolicyKey[] findGlobalPolicyKeysByStore(StoreKey key)
Finds all global promotion policies within a store- Specified by:
findGlobalPolicyKeysByStore
in interfacePromotionPolicyPersistenceManager
- Parameters:
key
- identifies the store- Returns:
- an array of global policy keys
- See Also:
PromotionPolicyPersistenceManager.findGlobalPolicyKeysByStore(StoreKey)
-
findPolicyKeysByGroupAndStatus
public PromotionPolicyKey[] findPolicyKeysByGroupAndStatus(com.ibm.commerce.marketing.promotion.group.PromotionGroupKey gkey, int status)
Finds promotion policies based on the group with which they are associated and their status- Specified by:
findPolicyKeysByGroupAndStatus
in interfacePromotionPolicyPersistenceManager
- Parameters:
gkey
- the key of the group with which the policies are associated.status
- the status of the policies- Returns:
- an array of policy keys
- See Also:
PromotionPolicyPersistenceManager.findPolicyKeysByGroupAndStatus(PromotionGroupKey, int)
-
toXML
public java.lang.String toXML() throws XMLizationException
Converts any object into an XML format representation.- Specified by:
toXML
in interfaceXMLizable
- Returns:
- The string format of the XML that represents this XMLizable object
- Throws:
XMLizationException
- when this process fails- See Also:
XMLizable.toXML()
-
fromXML
public void fromXML(org.w3c.dom.Node anXMLNode) throws DeXMLizationException
Transforms an XML node into a real Object.- Specified by:
fromXML
in interfaceXMLizable
- Parameters:
anXMLNode
- The node that represents an XMLizable object- Throws:
DeXMLizationException
- when this process fails- See Also:
XMLizable.fromXML(Node)
-
setCacheInitialSize
public void setCacheInitialSize(int i)
Sets initial cache size- Parameters:
i
- the initial cache size
-
setCacheMaxSize
public void setCacheMaxSize(int i)
Sets maximum cache size- Parameters:
i
- the maximum cache size
-
getCacheInitialSize
public int getCacheInitialSize()
Gets initial cache size- Returns:
- Initial cache size
-
getCacheMaxSize
public int getCacheMaxSize()
Gets maximum cache size- Returns:
- Maximum cache size
-
initCache
public void initCache()
Initials the cache.
-
-