com.ibm.commerce.foundation.common.util.sdo

Class SDOHelper

  • java.lang.Object
    • com.ibm.commerce.foundation.common.util.sdo.SDOHelper


  • public class SDOHelper
    extends java.lang.Object
    Utility class for SDO objects.
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String COPYRIGHT
      IBM Copyright notice field.
      static java.lang.String SDO_LOAD_PROPERTY_PREFIX
      The property key prefix found in SDO.properties that indicate a property to include when converting an XML document into the appropriate data object.
      static java.lang.String SDO_PROPERTY_FILE
      The name of the property file that will be loaded during class initialization which contains the default save and load properties.
      static java.lang.String SDO_SAVE_PROPERTY_PREFIX
      The property key prefix found in SDO.properties that indicates a property to include when saving the data object into an XML document.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static commonj.sdo.DataObject clone(commonj.sdo.DataObject dataObject)
      This method returns a clone of the specified data object.
      static commonj.sdo.DataObject clone(commonj.sdo.DataObject dataObject, boolean bContainer)
      This method returns a clone of the specified data object.
      static commonj.sdo.DataObject convertByteArrayToDataObject(byte[] data)
      This is a utility method that converts a XML document into the appropriate SDO object.
      static byte[] convertDataObjectToByteArray(commonj.sdo.DataObject dataObject)
      This is a utility method to convert a SDO object into a byte array.
      static byte[] convertDataObjectToByteArray(commonj.sdo.DataObject dataObject, boolean extractContainer)
      This is a utility method to convert a SDO object into a byte array.
      static org.w3c.dom.Document convertDataObjectToDocument(commonj.sdo.DataObject dataObject)
      This is a utility method to convert a SDO object into a Document.
      static javax.xml.soap.SOAPElement convertDataObjectToSOAPElement(commonj.sdo.DataObject dataObject)
      This is a utility method to convert a SDO object into a SOAPElement object.
      static commonj.sdo.DataObject convertElementToDataObject(org.w3c.dom.Element element)
      This is a utility method that converts a Element object into the appropriate SDO object.
      static java.lang.Object convertEmfXmlByteArrayToObject(byte[] convertDataObjectToByteArray)
      convertEmfXmlByteArrayToObject
      static commonj.sdo.DataObject convertInputStreamToDataObject(java.io.InputStream inputStream)
      This is a utility method that converts a XML document into the appropriate SDO object.
      static commonj.sdo.DataObject convertInputStreamToDataObject(java.io.InputStream inputStream, boolean extractContainer)
      This is a utility method that converts a XML document into the appropriate SDO object.
      static byte[] convertObjectToEmfXmlByteArray(java.lang.Object objectToConvert)
      convertObjectToEmfXmlByteArray
      static commonj.sdo.DataObject convertSOAPElementToDataObject(javax.xml.soap.SOAPElement soapElement)
      This is a utility method that converts a SOAPElement object into the appropriate SDO object.
      static void move(commonj.sdo.DataObject srcObj, commonj.sdo.DataObject descObj)
      This method will move all common properties from the source to the destination object.
      static javax.xml.datatype.XMLGregorianCalendar resolveDateTimeValue(java.lang.Object aDateTimeObject)
      This method converts a given input object to XMLGregorianCalendar type provided it is of type String formatted as a lexical representation of an xml schema dateTime data type (http://www.w3.org/TR/xmlschema-2/#dateTime).
      static java.lang.String toString(commonj.sdo.DataObject dataObject)
      This method will return the string representation of the data object for debugging purposes.
      static java.lang.String toString(commonj.sdo.DataObject dataObject, boolean extractContainer)
      This method will return the string representation of the data object for debugging purposes.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • COPYRIGHT

        public static final java.lang.String COPYRIGHT
        IBM Copyright notice field.
        See Also:
        Constant Field Values
      • SDO_SAVE_PROPERTY_PREFIX

        public static final java.lang.String SDO_SAVE_PROPERTY_PREFIX
        The property key prefix found in SDO.properties that indicates a property to include when saving the data object into an XML document.
        See Also:
        Constant Field Values
      • SDO_LOAD_PROPERTY_PREFIX

        public static final java.lang.String SDO_LOAD_PROPERTY_PREFIX
        The property key prefix found in SDO.properties that indicate a property to include when converting an XML document into the appropriate data object.
        See Also:
        Constant Field Values
      • SDO_PROPERTY_FILE

        public static final java.lang.String SDO_PROPERTY_FILE
        The name of the property file that will be loaded during class initialization which contains the default save and load properties. This file also includes the SDO packages to load for dynamic object creation.
        See Also:
        Constant Field Values
    • Method Detail

      • convertDataObjectToByteArray

        public static final byte[] convertDataObjectToByteArray(commonj.sdo.DataObject dataObject)
                                                         throws java.io.IOException
        This is a utility method to convert a SDO object into a byte array. The produced byte array is the XML representation of the SDO object.
        Parameters:
        dataObject - The SDO object to convert into the XML byte array.
        Returns:
        A byte array that contains a XML document that represents the specified SDO object.
        Throws:
        java.io.IOException - There was a problem converting the SDO object into the byte array.
      • convertDataObjectToByteArray

        public static byte[] convertDataObjectToByteArray(commonj.sdo.DataObject dataObject,
                                                          boolean extractContainer)
                                                   throws java.io.IOException
        This is a utility method to convert a SDO object into a byte array. The produced byte array is the XML representation of the SDO object.
        Parameters:
        dataObject - The SDO object to convert into the XML byte array.
        extractContainer - Option to extract the container from the data object before serialization.
        Returns:
        A byte array that contains a XML document that represents the specified SDO object.
        Throws:
        java.io.IOException - There was a problem converting the SDO object into the byte array.
      • convertByteArrayToDataObject

        public static final commonj.sdo.DataObject convertByteArrayToDataObject(byte[] data)
                                                                         throws java.io.IOException
        This is a utility method that converts a XML document into the appropriate SDO object. The method utilizes the package classes that have been registered to determine the appropriate static SDO objects the represents the elements contained in the specified XML document.
        Parameters:
        data - A byte array that contains the XML document to convert.
        Returns:
        The SDO object that represents the XML document specified.
        Throws:
        java.io.IOException - There was a problem converting the byte array into the SDO object.
      • convertInputStreamToDataObject

        public static final commonj.sdo.DataObject convertInputStreamToDataObject(java.io.InputStream inputStream)
                                                                           throws java.io.IOException
        This is a utility method that converts a XML document into the appropriate SDO object. The method utilizes the package classes that have been registered to determine the appropriate static SDO objects the represents the elements contained in the specified XML document.
        Parameters:
        inputStream - An input stream that contains the XML document to convert.
        Returns:
        The SDO object that represents the XML document specified.
        Throws:
        java.io.IOException - There was a problem converting the byte array into the SDO object.
      • convertInputStreamToDataObject

        public static commonj.sdo.DataObject convertInputStreamToDataObject(java.io.InputStream inputStream,
                                                                            boolean extractContainer)
                                                                     throws java.io.IOException
        This is a utility method that converts a XML document into the appropriate SDO object. The method utilizes the package classes that have been registered to determine the appropriate static SDO objects the represents the elements contained in the specified XML document.
        Parameters:
        inputStream - An input stream that contains the XML document to convert.
        extractContainer - Option to extract the first resource in the container of the result.
        Returns:
        The SDO object that represents the XML document specified.
        Throws:
        java.io.IOException - There was a problem converting the byte array into the SDO object.
      • convertDataObjectToSOAPElement

        public static final javax.xml.soap.SOAPElement convertDataObjectToSOAPElement(commonj.sdo.DataObject dataObject)
                                                                               throws java.io.IOException,
                                                                                      javax.xml.soap.SOAPException
        This is a utility method to convert a SDO object into a SOAPElement object.
        Parameters:
        dataObject - The SDO object to convert into SOAPElement object.
        Returns:
        A SOAPElement object that represents the specified SDO object.
        Throws:
        java.io.IOException - There was a problem retieveing data from the SDO object.
        javax.xml.soap.SOAPException - There was a problem constructing the SOAPElement object.
      • convertDataObjectToDocument

        public static final org.w3c.dom.Document convertDataObjectToDocument(commonj.sdo.DataObject dataObject)
                                                                      throws java.io.IOException
        This is a utility method to convert a SDO object into a Document.
        Parameters:
        dataObject - The SDO object to convert into SOAPElement object.
        Returns:
        The XML Document object that represents the specified SDO.
        Throws:
        java.io.IOException - There was a problem constructing the Document object.
      • convertElementToDataObject

        public static final commonj.sdo.DataObject convertElementToDataObject(org.w3c.dom.Element element)
                                                                       throws java.io.IOException
        This is a utility method that converts a Element object into the appropriate SDO object. The method utilizes the package classes that have been registered to determine the appropriate static SDO objects the represents the elements contained in the specified SOAPElement object.
        Parameters:
        element - An element that contains the business info in SDO.
        Returns:
        The SDO object that represents the element specified.
        Throws:
        java.io.IOException - There was a problem converting the element into the SDO object.
      • convertSOAPElementToDataObject

        public static final commonj.sdo.DataObject convertSOAPElementToDataObject(javax.xml.soap.SOAPElement soapElement)
                                                                           throws java.io.IOException
        This is a utility method that converts a SOAPElement object into the appropriate SDO object. The method utilizes the package classes that have been registered to determine the appropriate static SDO objects the represents the elements contained in the specified SOAPElement object.
        Parameters:
        soapElement - An SOAP Element that contains the business info in SDO.
        Returns:
        The SDO object that represents the SOAP Element specified.
        Throws:
        java.io.IOException - There was a problem converting the SOAP element into the SDO object.
      • clone

        public static commonj.sdo.DataObject clone(commonj.sdo.DataObject dataObject)
        This method returns a clone of the specified data object. This method will perform a deep clone object and the cloned instance will not have any reference to the specified data object.
        Parameters:
        dataObject - The data object to clone.
        Returns:
        A clone version of the data object.
      • clone

        public static commonj.sdo.DataObject clone(commonj.sdo.DataObject dataObject,
                                                   boolean bContainer)
        This method returns a clone of the specified data object. This method will perform a deep clone and the cloned instance will not have any references to the specified data object.
        Parameters:
        dataObject - The data object to clone
        bContainer - true to clone any containers of the data object, false to only clone the data object.
        Returns:
        A clone version of the data object.
      • move

        public static void move(commonj.sdo.DataObject srcObj,
                                commonj.sdo.DataObject descObj)
        This method will move all common properties from the source to the destination object. If the property is a complex object, then all the properties of the complex object will be moved as well.
        Parameters:
        srcObj - The source data object.
        descObj - The destination data object.
      • toString

        public static java.lang.String toString(commonj.sdo.DataObject dataObject)
        This method will return the string representation of the data object for debugging purposes. Use this method to obtains a readable representation of the data object.
        Parameters:
        dataObject - The data object to convert to a string.
        Returns:
        The string representation of the data object.
      • toString

        public static java.lang.String toString(commonj.sdo.DataObject dataObject,
                                                boolean extractContainer)
        This method will return the string representation of the data object for debugging purposes. Use this method to obtains a readable representation of the data object.
        Parameters:
        dataObject - The data object to convert to a string.
        extractContainer - Option to extract the container from the data object before serialization.
        Returns:
        The string representation of the data object.
      • resolveDateTimeValue

        public static javax.xml.datatype.XMLGregorianCalendar resolveDateTimeValue(java.lang.Object aDateTimeObject)
        This method converts a given input object to XMLGregorianCalendar type provided it is of type String formatted as a lexical representation of an xml schema dateTime data type (http://www.w3.org/TR/xmlschema-2/#dateTime). If input parameter is of internal type org.eclipse.emf.ecore.xml.type.internal.XMLCalendar it will be cast to XMLGregorianCalendar.
        Parameters:
        aDateTimeObject - - an object representing the xml schema dateTime datatype
        Returns:
        A date object of type XMLGregorianCalendar if input parameter is of type String or org.eclipse.emf.ecore.xml.type.internal.XMLCalendar.
      • convertEmfXmlByteArrayToObject

        public static java.lang.Object convertEmfXmlByteArrayToObject(byte[] convertDataObjectToByteArray)
                                                               throws java.io.IOException
        convertEmfXmlByteArrayToObject
        Parameters:
        convertDataObjectToByteArray - The byte array to convert.
        Returns:
        The converted object.
        Throws:
        java.io.IOException - If anything goes wrong during the decoding.
      • convertObjectToEmfXmlByteArray

        public static byte[] convertObjectToEmfXmlByteArray(java.lang.Object objectToConvert)
                                                     throws java.io.IOException
        convertObjectToEmfXmlByteArray
        Parameters:
        objectToConvert - the object to convert.
        Returns:
        The EMF Xml byte array.
        Throws:
        java.io.IOException - If anything goes wrong during the encoding.