com.ibm.tivoli.maximo.fdmbo

Class RESTMboSet

    • Constructor Detail

      • RESTMboSet

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

      • getMimeType

        protected java.lang.String getMimeType()
        Returns:
        mime type for REST call
      • getMboInstance

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

        public void load(int index)
                  throws MXException,
                         java.rmi.RemoteException
        Implementation of load of the external data to MboSet using REST
        Overrides:
        load in class JSONMboSet
        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
        Implementation of invoke of the external data to MboSet for REST call
        Overrides:
        invoke in class JSONMboSet
        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
      • getOpAndValue

        public java.lang.Object[] getOpAndValue(java.lang.String expression)
        Parse expression to get operation and value
        Parameters:
        expression - expression to parse
        Returns:
        object array. First element operation and second value
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getHTTPQueryMethod

        public java.lang.String getHTTPQueryMethod()
        Get HTTP method.
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • formatUrl

        public java.lang.String formatUrl(java.lang.String url,
                                          java.lang.String method)
                                   throws java.rmi.RemoteException,
                                          MXException
        Formats where clause.
        Parameters:
        url - invoke url
        method - HTTP invoke method
        Returns:
        new formatted URL
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • formatUrlForSortPage

        public java.lang.String formatUrlForSortPage(java.lang.String url,
                                                     int index,
                                                     boolean forCount,
                                                     java.lang.String method)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Add sort and paging to existing URL.
        Parameters:
        url - invoke url
        index - index of the Mbo in MboSet
        forCount - formatted for count only or get whole data
        method - HTTP invoke method
        Returns:
        new formatted URL
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • formatPostData

        public byte[] formatPostData(int index,
                                     boolean forCount)
                              throws java.rmi.RemoteException,
                                     MXException
        Default implementation for formats where clause for POST.
        Parameters:
        index - Index of the row from getMbo(index)
        forCount - indicates if only count need to be retrieved
        Returns:
        byte data for POST
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • formatPostDataForNextPage

        public byte[] formatPostDataForNextPage(byte[] data,
                                                int index)
                                         throws java.rmi.RemoteException,
                                                MXException
        Default implementation for formats data for next page
        Parameters:
        data - original POST data
        index - Index of the row from getMbo(index)
        Returns:
        byte data for next page retrieval
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWhereSeparator

        public java.lang.String getWhereSeparator()
                                           throws MXException
        Formats where separator.
        Returns:
        encoded where separator
        Throws:
        MXException - Maximo Exception
      • formatWhere

        public void formatWhere(java.util.List whereList,
                                java.lang.String where)
                         throws java.rmi.RemoteException,
                                MXException
        Formats where clause.
        Parameters:
        whereList - list of where clauses
        where - where clause to add to the list
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • addOrderBy

        protected java.lang.String addOrderBy(java.lang.String url,
                                              java.lang.String orderBy)
        Formats order by clause.
        Parameters:
        formater - JSONQuery
        resourceInfo - resource info
        where - where clause
        Returns:
        formated URL
      • formatUrlForNextPage

        public java.lang.String formatUrlForNextPage(java.lang.String url,
                                                     int index,
                                                     java.lang.String method)
                                              throws java.rmi.RemoteException,
                                                     MXException
        Formats where clause.
        Parameters:
        url - url to add paging
        index - index of the Mbo in MboSet
        method - HTTP invoke method
        Returns:
        formatted URL
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • processPaging

        protected java.lang.String processPaging(java.lang.String url,
                                                 int index,
                                                 java.lang.String method)
                                          throws java.rmi.RemoteException,
                                                 MXException
        Formats URL for paging.
        Parameters:
        url - url to add paging
        index - index of the Mbo in MboSet
        method - HTTP invoke method
        Returns:
        formatted URL
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getOrderByClouse

        public java.lang.String getOrderByClouse()
        Return order by clause.
        Returns:
        order by clause
        Throws:
        MXException
        java.rmi.RemoteException
      • getCountClause

        public java.lang.String getCountClause()
        Return count clause.
        Returns:
        count clause
      • getPagingParams

        public java.lang.String[] getPagingParams()
        Return parameters for paging. First parameter is page size (limit) second is when to start (or skip)
        Returns:
        paging parameters array
        Throws:
        MXException
        java.rmi.RemoteException
      • getStringQualifier

        public java.lang.String getStringQualifier()
        Return string qualifies. If null - no qualifier. So value can be abc or 'abc'
        Returns:
        count clause
      • formatOrderBy

        protected java.lang.String formatOrderBy(java.lang.String sqlOB,
                                                 JSONResourceInfo resourceInfo)
                                          throws MXException
        Parses order by.
        Parameters:
        sqlOB - order by
        resourceInfo - resource info
        Returns:
        formatted string
        Throws:
        MXException - Maximo Exception
      • getUrl

        public java.lang.String getUrl(HTTPHandler handler,
                                       boolean forCount)
                                throws MXException,
                                       java.rmi.RemoteException
        Return original URL.
        Parameters:
        handler - handler name
        forCount - count indicator
        Returns:
        URL
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWhereToFormat

        public java.lang.String getWhereToFormat(java.lang.String where)
                                          throws java.rmi.RemoteException,
                                                 MXException
        Return formatted where clause.
        Parameters:
        where - where clause
        Returns:
        formated where
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • getWhereToFormat

        public java.lang.String getWhereToFormat(java.lang.String where,
                                                 boolean isRelationship)
                                          throws java.rmi.RemoteException,
                                                 MXException
        Return formatted where clause.
        Parameters:
        where - where clause
        isRelationship - is it relationship where or any other where
        Returns:
        formated where
        Throws:
        MXException - Maximo Exception
        java.rmi.RemoteException - Remote Exception
      • setDiscardableFlag

        protected void setDiscardableFlag(boolean state)
        Override this method so that the discardable flag can be turned off during loading. This is needed because we don't want mbo to be discarded during loading. Only getDiscardableMbo() can cause the mbo to be discarded.
        Overrides:
        setDiscardableFlag in class MboSet
      • moveTo

        public MboRemote moveTo(int pos)
                         throws MXException,
                                java.rmi.RemoteException
        Override this method so that the current index of the mboset doesn't change during loading through moveNext() call. This is because loading (calls getMbo(i)) and moveNext() increment the currIndex so causes currIndex to be incorrect.
        Specified by:
        moveTo in interface MboSetRemote
        Overrides:
        moveTo in class MboSet
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MboSet.getMbo(int)
      • moveNext

        public MboRemote moveNext()
                           throws MXException,
                                  java.rmi.RemoteException
        Override this method so that the current index of the mboset doesn't change during loading through moveNext() call. This is because loading (calls getMbo(i)) and moveNext() increment the currIndex so causes currIndex to be incorrect.
        Specified by:
        moveNext in interface MboSetRemote
        Overrides:
        moveNext in class MboSet
        Returns:
        The next MboRemote in this set.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        MboSet.getMbo(int)