com.ibm.tivoli.maximo.fdmbo

Class JSONMboSet

    • Field Detail

      • resourceName

        protected java.lang.String resourceName
      • resourceType

        protected java.lang.String resourceType
      • productName

        protected java.lang.String productName
      • url

        protected java.lang.String url
      • urlFormatted

        protected boolean urlFormatted
      • limit

        protected int limit
      • fetchComplete

        protected boolean fetchComplete
      • currentCount

        protected int currentCount
      • fullCount

        protected int fullCount
      • responseArray

        protected com.ibm.json.java.JSONArray responseArray
    • Constructor Detail

      • JSONMboSet

        public JSONMboSet(MboServerInterface ms)
                   throws java.rmi.RemoteException
        Constructor
        Parameters:
        ms - The JSON MboSet.
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
    • Method Detail

      • getMboInstance

        protected Mbo getMboInstance(MboSet ms)
                              throws MXException,
                                     java.rmi.RemoteException
        Factory to create the business objects This must be overridden in derived class
        Specified by:
        getMboInstance in class MboSet
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • deserialize

        public void deserialize(byte[] response,
                                JSONResourceInfo resourceInfo,
                                int index)
                         throws MXException,
                                java.rmi.RemoteException
        Turn a json string into a mbo, and add it to this set.
        Parameters:
        response - The json string in bytes
        resourceInfo - Info about the json resource that describes the the json and mbo association.
        index - index of the mbo in mboset
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • json2MboSet

        public void json2MboSet(com.ibm.json.java.JSONArray jsonArray,
                                JSONResourceInfo resourceInfo,
                                int start,
                                int end)
                         throws java.rmi.RemoteException,
                                MXException
        Convert JSON into mbo and add the mbo to this set.
        Parameters:
        jsonArray - JSON object(s)
        resourceInfo - JSON resource info
        start - starting object index
        end - ending object index
        Throws:
        java.rmi.RemoteException
        MXException
      • json2Mbo

        public void json2Mbo(java.lang.Object jsonObj,
                             JSONObjectInfo detailInfo,
                             MboRemote parentMbo)
                      throws java.rmi.RemoteException,
                             MXException
        Turn a json object into a mbo. This method is called recursively to process related objects.
        Parameters:
        jsonObj - The current json object
        detailInfo - The current json object info
        parentMbo - The parent Mbo.
        Throws:
        java.rmi.RemoteException
        MXException
      • setAttributeValue

        protected void setAttributeValue(java.lang.String attributeName,
                                         java.lang.Object value,
                                         MboRemote mbo,
                                         java.lang.String formatType,
                                         java.lang.String dateFormatValue)
                                  throws java.rmi.RemoteException,
                                         MXException
        Set the attribute value to a serialized mbo from JSON.
        Parameters:
        attributeName - The attribute name.
        value - The value to be set.
        mbo - The serialized mbo.
        Throws:
        java.rmi.RemoteException
        MXException
      • toBeSaved

        public boolean toBeSaved()
                          throws java.rmi.RemoteException
        Has the collection be modified in any way so that it needs to be put in storage ?
        Specified by:
        toBeSaved in interface MboSetRemote
        Overrides:
        toBeSaved in class NonPersistentMboSet
        Throws:
        java.rmi.RemoteException
      • setRelationship

        public void setRelationship(java.lang.String relationClause)
        Sets relationship.
        Specified by:
        setRelationship in interface MboSetRemote
        Overrides:
        setRelationship in class MboSet
        Parameters:
        relationClause - relation clause
      • setAppWhere

        public void setAppWhere(java.lang.String whereClause)
                         throws java.rmi.RemoteException,
                                MXException
        Sets application where clause.
        Specified by:
        setAppWhere in interface MboSetRemote
        Overrides:
        setAppWhere in class MboSet
        Parameters:
        whereClause - where clause
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Getter method., Assembles the where clause used to get records.
      • getCountFromResponse

        public int getCountFromResponse(byte[] response)
                                 throws MXException,
                                        java.rmi.RemoteException
        Get count of the returned response. It can count of the rows or count only
        Parameters:
        response - invoke response
        Returns:
        count
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • reset

        public void reset()
                   throws MXException,
                          java.rmi.RemoteException
        Clears the current contents of the collection. This will cause a requery to the database. Save changes you wish to keep before calling this method. All linked Mbos and MboSets are closed. It will also rest on JSON parameters
        Specified by:
        reset in interface MboSetRemote
        Overrides:
        reset in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MboSet.save()
      • resetJSON

        public void resetJSON()
        Resets JSON variables
      • load

        public void load(int index)
                  throws MXException,
                         java.rmi.RemoteException
        Default implementation of load of the external data to MboSet
        Parameters:
        index - index of the Mbo in MboSet
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • invoke

        public byte[] invoke(int index,
                             boolean forCount)
                      throws MXException,
                             java.rmi.RemoteException
        Default implementation of invoke of the external data to MboSet
        Parameters:
        index - index of the Mbo in MboSet
        forCount - is invoke for count only or data
        Returns:
        response in byte array
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • setAdditionalData

        public void setAdditionalData(MboRemote mbo,
                                      com.ibm.json.java.JSONObject jo)
                               throws MXException,
                                      java.rmi.RemoteException
        Default implementation set set non-generic data (like id)
        Parameters:
        mbo - business object
        jo - JSON Object
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • bytesToJSONArray

        public com.ibm.json.java.JSONArray bytesToJSONArray(byte[] data)
                                                     throws MXException
        Convers byte array to JSONArray
        Parameters:
        data - byte aray of data
        Returns:
        JSONArray object
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getDataAsDouble

        public void getDataAsDouble(java.lang.Object value,
                                    java.lang.String attributeName,
                                    MboRemote mbo)
                             throws MXException,
                                    java.rmi.RemoteException
        Gets data from JSON as double and sets it to the Mbo
        Parameters:
        value - data value as native object
        attributeName - attribute name
        mbo - Mbo to set data
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • setUserWhereAfterParse

        public void setUserWhereAfterParse(java.lang.String where)
                                    throws MXException,
                                           java.rmi.RemoteException
        Set the user where. This method should be called instead setUserWhere() if the where clause is directly entered by the user through a GUI interface. This method parses the string looking for order by clause. It is more expensive than setUserWhere() and should be avoided is possible.
        Specified by:
        setUserWhereAfterParse in interface MboSetRemote
        Overrides:
        setUserWhereAfterParse in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MboSet.setUserWhereAfterParse(String)
      • setBulkUpdate

        public void setBulkUpdate(boolean bulk)
        Set build update indicator
        Parameters:
        build - bulk update support
      • setResourceName

        public void setResourceName(java.lang.String resourceName)
        Set resource name
        Parameters:
        resourceName - resource name
      • getResourceName

        public java.lang.String getResourceName()
                                         throws MXException,
                                                java.rmi.RemoteException
        Figure out resource name using relationship, Mbo name
        Returns:
        resource name
        Throws:
        MXException
        java.rmi.RemoteException
      • formatResourceName

        public java.lang.String formatResourceName(java.lang.String where)
        Parse relationship and extract resource name and other information including: - resource name - end point name - bulk update - url
        Parameters:
        where - where clause
        Returns:
        resource name
      • getProductName

        public java.lang.String getProductName()
                                        throws MXException,
                                               java.rmi.RemoteException
        Figure out resource name using relationship, Mbo name
        Returns:
        resource name
        Throws:
        MXException
        java.rmi.RemoteException
      • getMetaData

        public java.util.Map getMetaData()
                                  throws MXException,
                                         java.rmi.RemoteException
        Return meta data map for invoke
        Returns:
        meta data
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getBulkUpdate

        public boolean getBulkUpdate()
        Return bulk update indicator
        Returns:
        bulk update
      • getEndPointName

        public java.lang.String getEndPointName()
                                         throws MXException,
                                                java.rmi.RemoteException
        Return end point name
        Returns:
        end point name
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getLimit

        public int getLimit()
                     throws java.rmi.RemoteException,
                            MXException
        Formats limit parameter for paging.
        Returns:
        page fetch limit
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getURL

        public java.lang.String getURL()
        Return formatted URL
        Returns:
        bulk update
      • setDateFormatType

        public void setDateFormatType(java.lang.String dateFormatType)
        Set date format type parameter
        Parameters:
        dateFormatType - date format type
      • getDateFormatType

        public java.lang.String getDateFormatType()
        Return date format type parameter
        Returns:
        date format type
      • setDateFormat

        public void setDateFormat(java.lang.String dateFormat)
        Set date format parameter
        Parameters:
        dateFormatType - date format
      • getDateFormat

        public java.lang.String getDateFormat()
        Return date format parameter
        Returns:
        date format type
      • getNullFormat

        public java.lang.String getNullFormat()
        Return null format.
        Returns:
        null format
      • supportsUpdate

        public boolean supportsUpdate()