atg.repository.xml
Class RemoveService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.repository.xml.RemoveService
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, atg.nucleus.logging.VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, java.util.EventListener

public class RemoveService
extends GenericService

This service is used to remove items from a repository. The items to remove are selected by passing a set of "match" properties to use to select the items, and the value from the incoming instance document is matched with.


Field Summary
static java.lang.String CHECKOUT_TAG
           
static java.lang.String CLASS_VERSION
           
static java.lang.String REMOVE_SERVICE_OP_NAME
           
 
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
RemoveService()
           
 
Method Summary
protected  void deleteItem(RepositoryItem pItem)
          Internal method to delete the items from the repository
 java.lang.String[] deleteItemsInIndTransaction(RepositoryItem[] pItems)
          Removes the repository items with separate transaction for each item.
 AddService getAddService()
          Returns the AddService nucleus component
 java.lang.String[] getMatchProperties()
          Returns Properties to match in item descriptor
 int getMaxSelectedItems()
          Returns Maximum number of items that can be removed with the given search criteria from the repository
 RepositoryXMLTools getRepositoryXMLTools()
          Returns RepositoryXMLTools.
 javax.transaction.TransactionManager getTransactionManager()
          Returns Transaction Manger
protected  DetailedRemoveException populateException(java.util.Map pMap, java.util.List pList, RepositoryItem pItem)
          Internal to populate the DetailedRemoveException exception.
 java.lang.String[] removeItems(org.xml.sax.InputSource pInputSource, java.util.Map pMatchValues, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(org.xml.sax.InputSource pInputSource, java.lang.String[] pMatchProperties, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.io.InputStream pInputStream, java.util.Map pMatchValues, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.io.InputStream pInputStream, java.lang.String[] pMatchProperties, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.io.Reader pReader, java.util.Map pMatchValues, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.io.Reader pReader, java.lang.String[] pMatchProperties, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.lang.String pXMLString, java.util.Map pMatchValues, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 java.lang.String[] removeItems(java.lang.String pXMLString, java.lang.String[] pMatchProperties, boolean pInOneTransaction)
          Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.
 void setAddService(AddService pAddService)
          Sets Properties to match in item descriptor
 void setMatchProperties(java.lang.String[] pMatchProperties)
          Sets Properties to match in item descriptor
 void setMaxSelectedItems(int pMaxSelectedItems)
          Sets Maximum number of items that can be removed with the given search criteria from the repository
 void setRepositoryXMLTools(RepositoryXMLTools pRepositoryXMLTools)
          Sets RepositoryXMLTools
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets Transaction Manger
 void verifyProperties(java.lang.String[] pMatchProperties, RepositoryItemDescriptor pItemDescriptor)
          Verifies whether the matched properties passed are simple type properties or not as defined in the Repository.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, 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

CHECKOUT_TAG

public static final java.lang.String CHECKOUT_TAG
See Also:
Constant Field Values

REMOVE_SERVICE_OP_NAME

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

RemoveService

public RemoveService()
Method Detail

getRepositoryXMLTools

public RepositoryXMLTools getRepositoryXMLTools()
Returns RepositoryXMLTools. Exposes utilty functions used by this class.

Returns:
the RepositoryXMLTools

setRepositoryXMLTools

public void setRepositoryXMLTools(RepositoryXMLTools pRepositoryXMLTools)
Sets RepositoryXMLTools

Parameters:
pRepositoryXMLTools - a RepositoryXMLTools value

getMaxSelectedItems

public int getMaxSelectedItems()
Returns Maximum number of items that can be removed with the given search criteria from the repository

Returns:
the MaxSelectedItems

setMaxSelectedItems

public void setMaxSelectedItems(int pMaxSelectedItems)
Sets Maximum number of items that can be removed with the given search criteria from the repository

Parameters:
MaxSelectedItems -

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns Transaction Manger

Returns:
the TransactionManager

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets Transaction Manger

Parameters:
TransactionManager -

getMatchProperties

public java.lang.String[] getMatchProperties()
Returns Properties to match in item descriptor

Returns:
the MatchProperties

setMatchProperties

public void setMatchProperties(java.lang.String[] pMatchProperties)
Sets Properties to match in item descriptor

Parameters:
MatchProperties -

getAddService

public AddService getAddService()
Returns the AddService nucleus component

Returns:
the AddService

setAddService

public void setAddService(AddService pAddService)
Sets Properties to match in item descriptor

Parameters:
MatchProperties -

removeItems

public java.lang.String[] removeItems(java.io.Reader pReader,
                                      java.lang.String[] pMatchProperties,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pReader - the reader that reads the incoming XML stream
pMatchProperties - array of top-level properties that should be used to select items out of the repository for deletion.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(java.io.InputStream pInputStream,
                                      java.lang.String[] pMatchProperties,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pInputStream - the reader that reads the incoming XML stream
pMatchProperties - array of top-level properties that should be used to select items out of the repository for deletion.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(java.lang.String pXMLString,
                                      java.lang.String[] pMatchProperties,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pXMLString - the XML document
pMatchProperties - array of top-level properties that should be used to select items out of the repository for deletion.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(org.xml.sax.InputSource pInputSource,
                                      java.lang.String[] pMatchProperties,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      MaxNumberItemsException,
                                      DetailedRemoveException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pInputSource - the reader that reads the incoming XML stream
pMatchProperties - array of top-level properties that should be used to select items out of the repository for deletion.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(java.io.Reader pReader,
                                      java.util.Map pMatchValues,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pReader - the reader that reads the incoming XML stream
pMatchValues - Set of key/value pairs that we should match on. Items will be selected out of the repository whose properties (corresponding to the key in the pMatchValues) have values equal to corresponding the values in the pMatchValues.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(java.io.InputStream pInputStream,
                                      java.util.Map pMatchValues,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pInputStream - the reader that reads the incoming XML stream
pMatchValues - Set of key/value pairs that we should match on. Items will be selected out of the repository whose properties (corresponding to the key in the pMatchValues) have values equal to corresponding the values in the pMatchValues.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(java.lang.String pXMLString,
                                      java.util.Map pMatchValues,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      DetailedRemoveException,
                                      MaxNumberItemsException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pXMLString - the XML document
pMatchValues - Set of key/value pairs that we should match on. Items will be selected out of the repository whose properties (corresponding to the key in the pMatchValues) have values equal to corresponding the values in the pMatchValues.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

removeItems

public java.lang.String[] removeItems(org.xml.sax.InputSource pInputSource,
                                      java.util.Map pMatchValues,
                                      boolean pInOneTransaction)
                               throws RemoveException,
                                      MaxNumberItemsException,
                                      DetailedRemoveException,
                                      MatchException
Parses the XML Instance document to retrive the RepositoryItems and removes them from the repository.

Parameters:
pInputSource - the reader that reads the incoming XML stream
pMatchValues - Set of key/value pairs that we should match on. Items will be selected out of the repository whose properties (corresponding to the key in the pMatchValues) have values equal to corresponding the values in the pMatchValues.
pInOneTransaction - should all selected items be deleted in one transaction, or in their own separate transaction.
Returns:
array of IDs of the removed items
Throws:
RemoveException - if an error occurs
DetailedRemoveException - if more then one item was removed, then this will contain an entry for each item removed
MaxNumberItemsException - if more items were selected from the repository then the allowable number. (as defined by the maxNumberSelectedItems) property.
MatchException

deleteItemsInIndTransaction

public java.lang.String[] deleteItemsInIndTransaction(RepositoryItem[] pItems)
                                               throws RemoveException,
                                                      DetailedRemoveException
Removes the repository items with separate transaction for each item.

Parameters:
pItems - array of items that should all be removed in one transaction
Returns:
String array of IDs for items removed
Throws:
RemoveException - if an error occured
DetailedRemoveException - if more then one item was removed, this will contain an entry for each item removed and the associatd error.

populateException

protected DetailedRemoveException populateException(java.util.Map pMap,
                                                    java.util.List pList,
                                                    RepositoryItem pItem)
Internal to populate the DetailedRemoveException exception.

Parameters:
pMap - map of item to exception
pList - list of items that were supposed to be removed
pItem - the item that was attempted to be removedn
Returns:
the newly created and populated DetailedRemoveException

deleteItem

protected void deleteItem(RepositoryItem pItem)
                   throws RepositoryException
Internal method to delete the items from the repository

Parameters:
pItem - the item that should be removed from the repository.
Throws:
RepositoryException - if an error occurs

verifyProperties

public void verifyProperties(java.lang.String[] pMatchProperties,
                             RepositoryItemDescriptor pItemDescriptor)
                      throws RemoveException
Verifies whether the matched properties passed are simple type properties or not as defined in the Repository.

Parameters:
pMatchProperties - properties to check for
pItemDescriptor - RepositoryItemDescriptor to check against.
Throws:
RemoveException