com.ibm.tivoli.maximo.oslc.provider

Class OslcJSONStructureData

  • All Implemented Interfaces:
    java.lang.Cloneable


    public class OslcJSONStructureData
    extends OslcJSONStructureObject
    OSLC JSON Structure Data. It's a wrapper class around document to travel thru the data.
    • Constructor Detail

      • OslcJSONStructureData

        public OslcJSONStructureData(com.ibm.json.java.JSONArtifact data,
                                     java.lang.String mosName,
                                     java.lang.String path,
                                     UserInfo userInfo,
                                     java.lang.String messageType,
                                     boolean leanJson)
                              throws MXException
        Construct the StructureData object with a byte array. It will not break the data. If need to be broken call breakData() method
        Parameters:
        data - byte array for the MOS XML
        Throws:
        MXException
    • Method Detail

      • isBroken

        public boolean isBroken()
        Determine is data broken or not.
        Overrides:
        isBroken in class StructureData
        Returns:
        boolean is xml broken
      • moveToNextObjectStructure

        public boolean moveToNextObjectStructure()
                                          throws MXException
        moves to the next object structure . This call will break the data for that object structure and will set the current data pointer. This method should be called only for internal xmls.
        Overrides:
        moveToNextObjectStructure in class StructureData
        Returns:
        boolean if last object or not
        Throws:
        MXException
      • moveToPrevObjectStructure

        public boolean moveToPrevObjectStructure()
                                          throws MXException
        moves to the previous object structure. This call will break the data for that object structure and will set the current data pointer. This method should be called only for internal xmls.
        Overrides:
        moveToPrevObjectStructure in class StructureData
        Returns:
        boolean if first object or not
        Throws:
        MXException
      • removeCurrentObjectStructure

        public void removeCurrentObjectStructure()
                                          throws MXException
        Removed the current object structure from the Structure & re-positions cursor to previous one. If current position is 0 (i.e no integration objects exist after removal of the current mos), then currentPosition will point to -1 and currentData will point to null after removal of the current os.
        Overrides:
        removeCurrentObjectStructure in class StructureData
        Throws:
        MXException
      • getData

        public org.jdom2.Document getData()
        Return data in jdom Document format
        Overrides:
        getData in class StructureData
        Returns:
        Document object with whole data which is stored in StructureData object
      • hasDocument

        public boolean hasDocument()
        Determines if the StructureData instance has the data converted to a Document or is still in bytes format.
        Overrides:
        hasDocument in class StructureData
        Returns:
        true is the data is converted to a Document object and false otherwise
      • getDataAsBytes

        public byte[] getDataAsBytes()
        Return the whole document as bytes. This is costly method as it regenerates the byte data from the document each time the call is made.
        Overrides:
        getDataAsBytes in class StructureData
        Returns:
        byte[] whole data which is stored in StructureData object
      • getOriginalByteData

        public byte[] getOriginalByteData()
        Return the whole document as bytes. This is costly method as it regenerates the byte data from the document each time the call is made.
        Overrides:
        getOriginalByteData in class StructureData
        Returns:
        byte[] whole data which is stored in StructureData object
      • clone

        public java.lang.Object clone()
        clones the StructureData object and the document inside it.
        Overrides:
        clone in class StructureData
        Returns:
        Object a copy of the StructureData object
      • setMicData

        public StructureObject setMicData(org.jdom2.Element data)
        Set Element in the current element
        Overrides:
        setMicData in class StructureData
        Parameters:
        data - Give reference Element to set to current level.
        Returns:
        Structure Object which is a wrapper around one Element
      • createChildrenData

        public void createChildrenData(java.lang.String name,
                                       boolean setAsCurrent)
        Create Child level from current level
        Overrides:
        createChildrenData in class StructureData
        Parameters:
        name - Name of the child level. This will move the current data pointer to the child level.
        setAsCurrent - boolean to identify setting child as current level or not
      • setParentAsCurrent

        public boolean setParentAsCurrent()
        Set parent Element as current data.
        Overrides:
        setParentAsCurrent in class StructureData
        Returns:
        boolean If there is no parent returns false otherwise true and sets the current data pointer to the parent.
      • getPrimaryObjectList

        public java.util.List getPrimaryObjectList()
        Get list of primary objects in mos in the Structure data
        Overrides:
        getPrimaryObjectList in class StructureData
        Returns:
        list of object structures as Elements in the Structure data
      • getPrimaryObjectData

        public java.util.Map getPrimaryObjectData()
        Get primary object in mos in the Structure data
        Returns:
        list of object structures as Elements in the Structure data
      • getHierarchyObjectList

        public java.util.List getHierarchyObjectList()
        Get list of hierarchy objects in mos in the Structure data
        Overrides:
        getHierarchyObjectList in class StructureData
        Returns:
        list of object structures as Elements in the Structure data
      • getSize

        public int getSize()
        Get the object structure size
        Overrides:
        getSize in class StructureData
        Returns:
        size of the object structure
      • isMultiObjectStructure

        public boolean isMultiObjectStructure()
        checks whether XML has multiple object structures
        Overrides:
        isMultiObjectStructure in class StructureData
        Returns:
        whether XML has multiple object structures
      • getPrimaryObjectName

        public java.lang.String getPrimaryObjectName()
        Get main object name in the Structure data (it can be alias)
        Overrides:
        getPrimaryObjectName in class StructureData
        Returns:
        main object name in the Structure data (it can be alias)
      • getTransLanguage

        public java.lang.String getTransLanguage()
                                          throws MXException
        Get language of the transaction. If language is not set up for for the transaction will use local language
        Overrides:
        getTransLanguage in class StructureData
        Returns:
        Language of the transaction
        Throws:
        MXException
      • getPrimaryObject

        public org.jdom2.Element getPrimaryObject()
        Get primary object in the current level
        Overrides:
        getPrimaryObject in class StructureData
        Returns:
        Reference to Element object with a primary object data
      • getStructureObject

        public StructureObject getStructureObject(int pos)
        Get object structure in the current level
        Overrides:
        getStructureObject in class StructureData
        Parameters:
        pos - Position of the object structure in the list.
        Returns:
        Reference to Element object with a data
      • getAction

        public java.lang.String getAction()
        Get Action of the Structure Data
        Overrides:
        getAction in class StructureData
        Returns:
        Action of the Structure Data
      • isActionNull

        public boolean isActionNull()
        Determine whether Action of primary object of Structure Data is null
        Overrides:
        isActionNull in class StructureData
        Returns:
        true is Action is null or empty string, false otherwise
      • getMessageID

        public java.lang.String getMessageID()
        Get Message ID of the Structure Data
        Overrides:
        getMessageID in class StructureData
      • removeCurrentData

        public void removeCurrentData()
        Remove the CurrentData Element and set the parent as the current data
        Overrides:
        removeCurrentData in class StructureData
      • setPrimaryObject

        public void setPrimaryObject(org.jdom2.Element h)
        Set Primary Object Element object
        Overrides:
        setPrimaryObject in class StructureData
        Parameters:
        h - Give reference Element to set to primary object.
      • setPrimaryObject

        public void setPrimaryObject(java.lang.String name)
        Set the primary object
        Overrides:
        setPrimaryObject in class StructureData
        Parameters:
        name - name of the primary object
      • setCurrentPosition

        public void setCurrentPosition(int pos)
        Sets current position
        Overrides:
        setCurrentPosition in class StructureData
        Parameters:
        pos - Position of the object strucure in the list.
      • getCurrentPosition

        public int getCurrentPosition()
        gets current position
        Overrides:
        getCurrentPosition in class StructureData
        Returns:
        pos Position of the object structure in the list.
      • getRootName

        public java.lang.String getRootName()
        gets root element name
        Overrides:
        getRootName in class StructureData
        Returns:
        name of root element.
      • setAction

        public void setAction(java.lang.String action)
        Set object Element action
        Overrides:
        setAction in class StructureData
        Parameters:
        action - action value to be set.
      • setChildrenData

        public void setChildrenData(java.util.List l)
        Set child level data
        Overrides:
        setChildrenData in class StructureData
        Parameters:
        l - Give reference to List of Element to set as child.
      • setAsCurrent

        public StructureObject setAsCurrent(org.jdom2.Element data)
        Set Element as the current level
        Overrides:
        setAsCurrent in class StructureData
        Parameters:
        data - Give reference to Element to set as current.
      • setAsCurrent

        public StructureObject setAsCurrent(java.lang.Object data)
        Set Element as the current level
        Overrides:
        setAsCurrent in class StructureData
        Parameters:
        data - Give reference to Element to set as current.
      • setAsCurrent

        public void setAsCurrent(java.util.List data,
                                 int i)
        Set Element of the list as the current level
        Overrides:
        setAsCurrent in class StructureData
        Parameters:
        i - the index.
      • getXPathData

        public java.lang.String getXPathData(java.lang.String xPathExpression)
                                      throws MXException
        Get Data using XPath expression
        Overrides:
        getXPathData in class StructureData
        Returns:
        Return value of XML field.
        Throws:
        MXException
      • getStructureObjectList

        public java.util.List getStructureObjectList(java.lang.String xPathExpression)
                                              throws MXException
        Get List of objects using XPath expression
        Overrides:
        getStructureObjectList in class StructureData
        Returns:
        Return list of structure object.
        Throws:
        MXException
      • setMessageID

        public void setMessageID(java.lang.String id)
        Set message id
        Overrides:
        setMessageID in class StructureData
      • getBuild

        public java.lang.String getBuild()
        Gets a build number
        Overrides:
        getBuild in class StructureData
        Returns:
        the MAXIMO build number.
      • toString

        public java.lang.String toString()
        return a string for structure to be able to use the structure as a string anywhere such as in System.out.println
        Overrides:
        toString in class OslcJSONStructureObject