com.ibm.ccd.portal
Class PortalResponseUtil

java.lang.Object
  extended by com.ibm.ccd.portal.PortalResponseUtil
All Implemented Interfaces:
WPCPortalResponseUtil

public class PortalResponseUtil
extends java.lang.Object
implements WPCPortalResponseUtil


Constructor Summary
PortalResponseUtil()
           
 
Method Summary
 java.lang.String constructItemSkeletonResponse(java.util.HashMap infoMap, com.ibm.pim.attribute.AttributeCollection attrCollection)
          Builds the xml representation containing the information about item attributes
 java.lang.String constructQueryTransactionStatus(java.util.HashMap infoMap)
          Gives the status of the current transaction
 java.lang.String constructResponseForCatalogView(java.util.HashMap infoMap)
           
 java.lang.String constructResponseForCatalogViewList(java.util.HashMap infoMap)
          Fetches the list of all the views available for the catalog that begin with PORTAL_ and the system default view
 java.lang.String constructResponseForGetCatalogs(java.util.HashMap infoMap)
          Fetches the list of all the catalogs for the current context
 java.lang.String constructResponseForGetDocstoreDoc(java.util.HashMap infoMap, java.lang.String validationError)
          Fetches the document from the doc store
 java.lang.String constructResponseForGetResource(java.util.HashMap infoMap)
          this attaches the expected response to the XML response that goes back points to be noted is it supports one resource at a time, as the webservice attachment should not more than 15KB, atleast till now with our exp.
 java.lang.String constructResponseForItemDetailOrClone(java.util.HashMap infoMap, java.lang.Boolean isClone)
          Fetches the details associated with the item for item detail or clone item operation
 java.lang.String constructResponseForItemOperation(java.util.HashMap infoMap, java.lang.String wpcAction)
          Generates the response for either add,modify or delete depending on the command type passed along
 java.lang.String constructResponseForQueryCatalogChildren(java.util.HashMap infoMap)
          Fetches all the catagories associated with the current catalog when the root hierarchy is selected or the items and catagories under the parent category are fetched
 java.lang.String constructResponseForUploadFile(java.util.HashMap infoMap)
          Retrieves the document from the incoming soap attachments ,copies to the default location .Also copies the document to the new location as specified in the request .
 java.lang.String constructResponseQueryTransactionDetails(java.util.HashMap infoMap)
          Retrieves the document containing the transaction details from the docstore if the given transaction id exists
 java.lang.String constructSearchResponse(java.util.HashMap infoMap, java.lang.String validationError)
          Builds the response indicating the success or failure of the result operation
 java.lang.String constructSpecAttributeXML(com.ibm.pim.attribute.AttributeDefinition currentSpecAttrDefinition, java.lang.String attributeName, com.ibm.pim.attribute.AttributeCollection attrCollection, java.util.HashMap infoMap, com.ibm.pim.catalog.item.Item itm)
          Builds the xml representation containing the details of the attributes of the spec associated with the item
 java.lang.String constructUploadResponse(java.util.HashMap infoMap)
          Fetches the document from the path specified in the request and calls the CSV or XLS Helper to upload the content depending on the file type
 java.lang.String getMultiOccurSearchResults(com.ibm.pim.search.SearchResultSet searchResultSet, java.lang.String catalogName, java.util.HashMap infoMap)
          Builds the response containing the result of the search operation
 java.lang.String getResponse(java.util.HashMap infoMap, java.lang.String command)
          Obtains the result of the request passed after processing it appropriately based on the command
 com.ibm.pim.catalog.item.Item getSupplierFilteredItem(com.ibm.pim.catalog.item.Item item, java.lang.Object supplierID, java.lang.String specName, java.util.HashMap infoMap)
           
 boolean isAttrPathInAttrCollection(java.lang.String attrPath, com.ibm.pim.attribute.AttributeCollection attrCollection)
          Checks if the attribute is present in the given attribute collection
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortalResponseUtil

public PortalResponseUtil()
                   throws com.ibm.pim.common.exceptions.PIMInternalException
Throws:
com.ibm.pim.common.exceptions.PIMInternalException
Method Detail

isAttrPathInAttrCollection

public boolean isAttrPathInAttrCollection(java.lang.String attrPath,
                                          com.ibm.pim.attribute.AttributeCollection attrCollection)
                                   throws com.ibm.pim.common.exceptions.PIMInternalException,
                                          com.ibm.pim.common.exceptions.PIMAuthorizationException
Description copied from interface: WPCPortalResponseUtil
Checks if the attribute is present in the given attribute collection

Specified by:
isAttrPathInAttrCollection in interface WPCPortalResponseUtil
Parameters:
attrPath - the full path of the attribute
attrCollection - the attribute collection to be checked for attribute
Returns:
true if the specified attribute is present in the attribute collection,returns false otherwise
Throws:
com.ibm.pim.common.exceptions.PIMInternalException
com.ibm.pim.common.exceptions.PIMAuthorizationException

constructSpecAttributeXML

public java.lang.String constructSpecAttributeXML(com.ibm.pim.attribute.AttributeDefinition currentSpecAttrDefinition,
                                                  java.lang.String attributeName,
                                                  com.ibm.pim.attribute.AttributeCollection attrCollection,
                                                  java.util.HashMap infoMap,
                                                  com.ibm.pim.catalog.item.Item itm)
                                           throws java.lang.NumberFormatException,
                                                  com.ibm.pim.common.exceptions.PIMInternalException,
                                                  com.ibm.pim.common.exceptions.PIMAuthorizationException
Description copied from interface: WPCPortalResponseUtil
Builds the xml representation containing the details of the attributes of the spec associated with the item

Specified by:
constructSpecAttributeXML in interface WPCPortalResponseUtil
Parameters:
currentSpecAttrDefinition - the curent attribute definition required to fetch the required information
attributeName - the name of the attribute
attrCollection - the associated attribute collection in which the attribute is searched for
infoMap - the hashmap containing the header information
itm - the item for which the xml representation is to be constructed
Returns:
the xml representation containing the details of the item attributes
Throws:
java.lang.NumberFormatException
com.ibm.pim.common.exceptions.PIMInternalException
com.ibm.pim.common.exceptions.PIMAuthorizationException

constructItemSkeletonResponse

public java.lang.String constructItemSkeletonResponse(java.util.HashMap infoMap,
                                                      com.ibm.pim.attribute.AttributeCollection attrCollection)
                                               throws com.ibm.pim.common.exceptions.PIMException,
                                                      com.ibm.pim.common.exceptions.PIMInternalException,
                                                      java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Builds the xml representation containing the information about item attributes

Specified by:
constructItemSkeletonResponse in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashMap containing the header information
attrCollection - the associated attribute collection
Returns:
the xml representation containing all the iformation about the spec name and the item attributes
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

getSupplierFilteredItem

public com.ibm.pim.catalog.item.Item getSupplierFilteredItem(com.ibm.pim.catalog.item.Item item,
                                                             java.lang.Object supplierID,
                                                             java.lang.String specName,
                                                             java.util.HashMap infoMap)
                                                      throws com.ibm.pim.common.exceptions.PIMException,
                                                             com.ibm.pim.common.exceptions.PIMInternalException,
                                                             java.lang.IllegalArgumentException
Specified by:
getSupplierFilteredItem in interface WPCPortalResponseUtil
Parameters:
item - the item whose supplier id information is to be retrieved
supplierID - the supplier id to be checked
specName - the spec associated with the item
infoMap - the hashmap containing the header information
Returns:
Item if the item has the supplier id value as supplierID ,returns null otherwise
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructResponseForItemOperation

public java.lang.String constructResponseForItemOperation(java.util.HashMap infoMap,
                                                          java.lang.String wpcAction)
                                                   throws com.ibm.pim.common.exceptions.PIMException,
                                                          com.ibm.pim.common.exceptions.PIMInternalException,
                                                          java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Generates the response for either add,modify or delete depending on the command type passed along

Specified by:
constructResponseForItemOperation in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
wpcAction - the command type that specifies either of the three add ,modify or delete
Returns:
the response that indicates the success or failure of the operation
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructResponseForItemDetailOrClone

public java.lang.String constructResponseForItemDetailOrClone(java.util.HashMap infoMap,
                                                              java.lang.Boolean isClone)
                                                       throws com.ibm.pim.common.exceptions.PIMInternalException
Description copied from interface: WPCPortalResponseUtil
Fetches the details associated with the item for item detail or clone item operation

Specified by:
constructResponseForItemDetailOrClone in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
isClone - holds true if the command invoked is clone , else contains false
Returns:
the xml representation of the item operation
Throws:
com.ibm.pim.common.exceptions.PIMInternalException

constructResponseForUploadFile

public java.lang.String constructResponseForUploadFile(java.util.HashMap infoMap)
                                                throws com.ibm.pim.common.exceptions.PIMException,
                                                       com.ibm.pim.common.exceptions.PIMInternalException,
                                                       java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Retrieves the document from the incoming soap attachments ,copies to the default location .Also copies the document to the new location as specified in the request .

Specified by:
constructResponseForUploadFile in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
Returns:
the response containing the new path to the document
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructUploadResponse

public java.lang.String constructUploadResponse(java.util.HashMap infoMap)
                                         throws com.ibm.pim.common.exceptions.PIMException,
                                                com.ibm.pim.common.exceptions.PIMInternalException,
                                                java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Fetches the document from the path specified in the request and calls the CSV or XLS Helper to upload the content depending on the file type

Specified by:
constructUploadResponse in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the required information
Returns:
the response indicating the success or failure of the operation
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructQueryTransactionStatus

public java.lang.String constructQueryTransactionStatus(java.util.HashMap infoMap)
                                                 throws com.ibm.pim.common.exceptions.PIMInternalException
Description copied from interface: WPCPortalResponseUtil
Gives the status of the current transaction

Specified by:
constructQueryTransactionStatus in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
Returns:
the xml response indicating the status of the transaction
Throws:
com.ibm.pim.common.exceptions.PIMInternalException

constructResponseQueryTransactionDetails

public java.lang.String constructResponseQueryTransactionDetails(java.util.HashMap infoMap)
                                                          throws com.ibm.pim.common.exceptions.PIMInternalException
Description copied from interface: WPCPortalResponseUtil
Retrieves the document containing the transaction details from the docstore if the given transaction id exists

Specified by:
constructResponseQueryTransactionDetails in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
Returns:
notification indicating the success or failure of the operation
Throws:
com.ibm.pim.common.exceptions.PIMInternalException

constructResponseForQueryCatalogChildren

public java.lang.String constructResponseForQueryCatalogChildren(java.util.HashMap infoMap)
                                                          throws com.ibm.pim.common.exceptions.PIMException,
                                                                 com.ibm.pim.common.exceptions.PIMInternalException,
                                                                 java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Fetches all the catagories associated with the current catalog when the root hierarchy is selected or the items and catagories under the parent category are fetched

Specified by:
constructResponseForQueryCatalogChildren in interface WPCPortalResponseUtil
Parameters:
infoMap - the hash map containing the header information
Returns:
xml representation containing the children and also the notification indicating the success or failure of the operation
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructResponseForGetCatalogs

public java.lang.String constructResponseForGetCatalogs(java.util.HashMap infoMap)
                                                 throws com.ibm.pim.common.exceptions.PIMInternalException
Description copied from interface: WPCPortalResponseUtil
Fetches the list of all the catalogs for the current context

Specified by:
constructResponseForGetCatalogs in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
Returns:
xml representation of the list of the catalogs
Throws:
com.ibm.pim.common.exceptions.PIMInternalException

constructResponseForCatalogView

public java.lang.String constructResponseForCatalogView(java.util.HashMap infoMap)
Specified by:
constructResponseForCatalogView in interface WPCPortalResponseUtil
Returns:
string containing the response

constructResponseForCatalogViewList

public java.lang.String constructResponseForCatalogViewList(java.util.HashMap infoMap)
Description copied from interface: WPCPortalResponseUtil
Fetches the list of all the views available for the catalog that begin with PORTAL_ and the system default view

Specified by:
constructResponseForCatalogViewList in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashMap containing the header information
Returns:
the xml representation of all the views in the catalog

getMultiOccurSearchResults

public java.lang.String getMultiOccurSearchResults(com.ibm.pim.search.SearchResultSet searchResultSet,
                                                   java.lang.String catalogName,
                                                   java.util.HashMap infoMap)
                                            throws com.ibm.pim.common.exceptions.PIMException,
                                                   com.ibm.pim.common.exceptions.PIMInternalException,
                                                   java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Builds the response containing the result of the search operation

Specified by:
getMultiOccurSearchResults in interface WPCPortalResponseUtil
Parameters:
searchResultSet - the result set of the search operation
catalogName - the current catalog selected by the user
infoMap - the hash map containing the header information
Returns:
the result of the search operation
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructSearchResponse

public java.lang.String constructSearchResponse(java.util.HashMap infoMap,
                                                java.lang.String validationError)
Description copied from interface: WPCPortalResponseUtil
Builds the response indicating the success or failure of the result operation

Specified by:
constructSearchResponse in interface WPCPortalResponseUtil
Parameters:
infoMap - the hashmap containing the header information
validationError - the validation error string
Returns:
the response indicating the success or failure

getResponse

public java.lang.String getResponse(java.util.HashMap infoMap,
                                    java.lang.String command)
                             throws com.ibm.pim.common.exceptions.PIMException,
                                    com.ibm.pim.common.exceptions.PIMInternalException,
                                    java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
Obtains the result of the request passed after processing it appropriately based on the command

Specified by:
getResponse in interface WPCPortalResponseUtil
command - the command type passed in the request
Returns:
the result of the request
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructResponseForGetResource

public java.lang.String constructResponseForGetResource(java.util.HashMap infoMap)
                                                 throws com.ibm.pim.common.exceptions.PIMException,
                                                        com.ibm.pim.common.exceptions.PIMInternalException,
                                                        java.lang.IllegalArgumentException
Description copied from interface: WPCPortalResponseUtil
this attaches the expected response to the XML response that goes back points to be noted is it supports one resource at a time, as the webservice attachment should not more than 15KB, atleast till now with our exp. we were not able to send more than this in the attachments if the given attribute's type is other than BINARY/IMAGE/THUMBNAIL_IMAGE foult code will be sent back

Specified by:
constructResponseForGetResource in interface WPCPortalResponseUtil
Returns:
string containing the response
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalArgumentException

constructResponseForGetDocstoreDoc

public java.lang.String constructResponseForGetDocstoreDoc(java.util.HashMap infoMap,
                                                           java.lang.String validationError)
                                                    throws com.ibm.pim.common.exceptions.PIMException,
                                                           com.ibm.pim.common.exceptions.PIMInternalException,
                                                           java.lang.IllegalStateException
Description copied from interface: WPCPortalResponseUtil
Fetches the document from the doc store

Specified by:
constructResponseForGetDocstoreDoc in interface WPCPortalResponseUtil
Returns:
notification indicating success or failure
Throws:
com.ibm.pim.common.exceptions.PIMException
com.ibm.pim.common.exceptions.PIMInternalException
java.lang.IllegalStateException