psdi.app.ci

Class CI

  • All Implemented Interfaces:
    java.rmi.Remote, CIRemote, AppActionInterface, MboConstants, MboRemote, StatefulMboRemote, MaxRemoteProxy


    public class CI
    extends StatefulMbo
    implements CIRemote
    MBO object to represent Configuration Item. See Configuration Item package description for details.

    This is a system level object.

    The key attribute for this object is: CINum.

    The attributes in this object are as follows:

    Attribute NameDescription
    CIIDUnique ID
    CINumAuthorized CI Identifier
    DescriptionDescription of the Authorized CI
    AssetnumIdentifier of Asset which is the CI.
    LocationIdentifier of Location which is the CI.
    ItemnumIdentifier of Item which is the CI.
    ServiceIdentifier of Service which is the CI.
    AssetLocOrgIdThe Organization to which the CI belongs to if the CI is Asset or Location.
    AssetLocSiteIdThe Site to which the CI belongs to if the CI is Asset or Location.
    ItemSetIdThe setid to which the CI belongs to if the CI is Item or Service.
    ClassStructureIdClassification of the CI.
    CILocationLocation where the CI is physically located.
    StatusCurrent life cycle state of the CI.
    StatusDateDate the CI status was last changed.
    ACTCIIDActual CI Identifier.
    ChangeByName of the user who last modified this CI object. This attribute defaults to the current user unless another value is provided.
    ChangeDateDate this CI object was last modified.This attribute defaults to the MXServer date/time unless another value is provided.
    CalnumCalendar used to specify when this CI object is normally in operation.
    ShiftNumShift Shift that is associated with the CI's calendar.
    • Field Detail

      • changeStatus

        protected boolean changeStatus
        Boolean flag which indicates if CI has gone through change status functionality Used in modify method, if gone through changestatus - there is no need to modify changedate and changeby for parent CI
      • changeStatusForCIs

        protected static TenantLevelObj changeStatusForCIs
      • CHANGESTATUSFORCIS_KEY

        protected static final java.lang.String CHANGESTATUSFORCIS_KEY
        See Also:
        Constant Field Values
      • sessionKey

        protected java.lang.String sessionKey
      • skipFieldCopy

        protected static java.util.HashSet skipFieldCopy
        This is a static HashSet that contains the names of the fields whose values need not be copied from the source Mbo to the target Mbo and is used only for duplication the CI Mbo. This HashSet is loaded in the loadSkipFieldCopyHashSet.
        See Also:
        CI.loadSkipFieldCopyHashSet(), CI.skipFieldCopy
    • Constructor Detail

      • CI

        public CI(MboSet ms)
           throws MXException,
                  java.rmi.RemoteException
        Constructs the CI object.

        Parameters:
        ms - MboSet
        Throws:
        none
        MXException
        java.rmi.RemoteException
    • Method Detail

      • init

        public void init()
                  throws MXException
        Initialization routine.
        Overrides:
        init in class Mbo
        Parameters:
        none -
        Throws:
        none
        MXException
      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Adds a new CI object.
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Parameters:
        none -
        Throws:
        none
        MXException
        java.rmi.RemoteException
      • getMboSet

        public MboSetRemote getMboSet(java.lang.String name)
                               throws MXException,
                                      java.rmi.RemoteException
        Description copied from class: Mbo
        Get a related MboSet for the object using the named relationship. Used for cross object linking; for example,Work Order to Asset.
        Specified by:
        getMboSet in interface MboRemote
        Overrides:
        getMboSet in class Mbo
        Parameters:
        name - The relationship provided to retrieve a related mboSet, usually using foreign keys. For example, "psdi.app.workorder.WOSetRemote.ASSET" is a relationship for the work order object to access the asset Set where "workorder.assetnum=asset.assetnum". The relationship can also be chained. Such as ASSET.ASSETSTATUS.
        Returns:
        The returned related set specified through the relationship.
        Throws:
        MXException - "A relationship called {0} does not exist for the {1} business object" exception will be thrown if the relationship was not found. "Unknown Object" exception will be thrown if the database object can not be found through the relationship.
        java.rmi.RemoteException
        See Also:
        Mbo.getMboSet(String)
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Saves a CI object. Check for asset and location association
        Overrides:
        save in class StatefulMbo
        Parameters:
        none -
        Throws:
        none
        MXException
        java.rmi.RemoteException
      • isParentInSelection

        protected boolean isParentInSelection(CI parent)
                                       throws MXException,
                                              java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • getParentCIsAndModify

        protected void getParentCIsAndModify(java.util.Date changedate,
                                             java.lang.String changeby)
                                      throws MXException,
                                             java.rmi.RemoteException
        Get immediate Parent CIs for a given CI and modify changedate and changeby, if propagatechange flag is set for the relationrule
        Parameters:
        changedate - The date the change was made
        changeby - User who made the change
        Throws:
        MXException
        java.rmi.RemoteException
      • modify

        public void modify()
                    throws MXException,
                           java.rmi.RemoteException
        called whenever a field is modified to update the changedate and changeby attributes
        Overrides:
        modify in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • getStatusHandler

        protected StatusHandler getStatusHandler()
        Gets a status handler to change the work order status.
        Specified by:
        getStatusHandler in class StatefulMbo
        Returns:
        a status handler to change the CI status.
      • loadSkipFieldCopyHashSet

        protected static void loadSkipFieldCopyHashSet()
                                                throws MXException,
                                                       java.rmi.RemoteException
        Loads the static HashSet with the names of the fields whose values need not be copied from the source Mbo to the duplicated Mbo when a duplicate operation is performed. As an example the changedate is one of the fields that need not be copied and the hashSet is loaded in the following way skipFieldCopy.add("CHANGEDATE") The following is the list of fields that are not copied from the source CI to the duplicated CI.

        1. CINUM
        2. CHANGEBY
        3. CHANGEDATE
        4. STATUS

        These are the field names that are loaded into the HashSet.

        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.skipCopyField(psdi.mbo.MboValueInfo), CI.skipCopyField(psdi.mbo.MboValueInfo), CI.duplicate()
      • skipCopyField

        protected boolean skipCopyField(MboValueInfo mvi)
                                 throws java.rmi.RemoteException,
                                        MXException
        Overrides the skipCopyField() in the Mbo. Since this method takes the MboValueInfo as its parameter just check to see if this field needs to be copied or skipped by using the data from the static HashSet. If this field does not need to be copied return true.
        Overrides:
        skipCopyField in class Mbo
        Parameters:
        The - MboValueInfo object of the MboValue that needs to be copied.
        Returns:
        True,if the field does not need to be copied.In all other cases return false.
        Throws:
        java.rmi.RemoteException
        MXException
        See Also:
        CI.loadSkipFieldCopyHashSet()
      • duplicate

        public MboRemote duplicate()
                            throws MXException,
                                   java.rmi.RemoteException
        Duplicates CI and related objects.
        The duplicated CI's cinum will be an autokeyed value if autokey is enabled. If autokey is not enabled, the cinum will need to be provided through the UI.

        Related objects that will also be duplicated are:

        • Doclinks
        • CISpec
        Specified by:
        duplicate in interface MboRemote
        Overrides:
        duplicate in class Mbo
        Returns:
        the newly duplicated CI MboRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.mbo.Mbo#isAutoKeyed.
      • getChildCIsAndDelete

        protected void getChildCIsAndDelete(long accessModifier)
                                     throws MXException,
                                            java.rmi.RemoteException
        Get immediate Child CIs for a given CI and delete them
        Throws:
        MXException
        java.rmi.RemoteException
      • getChildCIsAndDelete

        protected void getChildCIsAndDelete(long accessModifier,
                                            java.util.Hashtable cisToBeDeleted,
                                            java.util.Hashtable relationsToBeDeleted)
                                     throws MXException,
                                            java.rmi.RemoteException
        Get immediate Child CIs for a given CI and delete them
        Parameters:
        accessModifier -
        cisToBeDeleted - List of CI that have been marked for deletion
        relationsToBeDeleted - List of CIRelations that have been marked for deletion
        Throws:
        MXException
        java.rmi.RemoteException
      • partOfCollection

        protected java.lang.String partOfCollection()
                                             throws MXException,
                                                    java.rmi.RemoteException
        Checks if ci is part of collection Return the empty string if the ci is not part of collection , else return string of all the collections
        Returns:
        String of collections separated by commas
        Throws:
        MXException
        java.rmi.RemoteException
      • refMultiAssetLocCITables

        protected void refMultiAssetLocCITables(MboSetRemote refMboSet,
                                                java.lang.StringBuffer otherApps)
                                         throws MXException,
                                                java.rmi.RemoteException
        Loop through the MultiAssetLocCI table and get the uniquesid's of the tables
        Parameters:
        refMboSet - referenced Mbo Set
        otherApps - StringBuffer to store the strings of the tables
        Throws:
        MXException
        java.rmi.RemoteException
      • checkOtherApplications

        protected void checkOtherApplications()
                                       throws MXException,
                                              java.rmi.RemoteException
        Check if the CI is refered in other applications and throw exception
        Throws:
        MXException
        java.rmi.RemoteException
      • canDelete

        public void canDelete()
                       throws MXException,
                              java.rmi.RemoteException
        CI cannot be deleted for many reasons. CIs should not be referenced any process managers and other applications. The list of tables to be checked are MULTIASSETLOCCI, WORKORDER,WOACTIVITY, WOCHANGE, WORELEASE, TICKET, INCIDENT, PROBLEM and SR
        Overrides:
        canDelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long accessModifier)
                    throws MXException,
                           java.rmi.RemoteException
        Override delete to delete this and records associated with CI If CI is part of collections, throw warning before deleting CI and related records
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        accessModifier - The bitwise flag specified to determine if certain normal security checks are to be bypassed for this delete request. For example: if the accessModifer is NOACCESSCHECK, then the check for the object's NODELETE flag and the call to the object's canDelete() method will not be performed. If the accessModifer is NONE, then all the access checks are performed before this object is marked delete.
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        Mbo.delete(long)
      • delete

        protected void delete(long accessModifier,
                              java.util.Hashtable cisToBeDeleted,
                              java.util.Hashtable relationsToBeDeleted)
                       throws MXException,
                              java.rmi.RemoteException
        Delete this and records associated with CI using the ToBeDeleted hashtables. If CI is part of collections, throw warning before deleting CI and related records
        Parameters:
        accessModifier -
        cisToBeDeleted - List of CI that have been marked for deletion
        relationsToBeDeleted - List of CIRelations that have been marked for deletion
        Throws:
        MXException
        java.rmi.RemoteException
      • mboDelete

        protected void mboDelete(long accessModifier)
                          throws MXException,
                                 java.rmi.RemoteException
        Only delete this CI. This code has been added so that an overwritten delete method from CCICI.java can still call the Mbo delete code without having to do incomplete delete code first.
        Throws:
        MXException
        java.rmi.RemoteException
      • deleteIfNotMarkedForDelete

        protected void deleteIfNotMarkedForDelete(MboSetRemote relatedCISet,
                                                  java.util.Hashtable relationsToBeDeleted,
                                                  java.lang.String identifier)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Delete records if not deleted by the parent ci
        Parameters:
        relatedCISet - MboSet to be deleted
        relationsToBeDeleted - Hashtable that helps to not delete relations more than once
        identifier - String that identify if CIRelations or CIRelationHis will be deleted
        Throws:
        MXException
        java.rmi.RemoteException
      • deleteAssociatedRecords

        protected void deleteAssociatedRecords(java.util.Hashtable relationsToBeDeleted)
                                        throws MXException,
                                               java.rmi.RemoteException
        Delete records associated with this CI
        Throws:
        MXException
        java.rmi.RemoteException
      • getChildCIsAndChangeStatus

        protected void getChildCIsAndChangeStatus(java.lang.String status,
                                                  java.util.Date date,
                                                  java.lang.String memo)
                                           throws MXException,
                                                  java.rmi.RemoteException
        Get immediate Child CIs for a given CI and Change status for them
        Parameters:
        status - The new desired status.
        date - The effective date of the new status.
        memo - A string briefly describing the circumstances of the change. The memo can be null.
        Throws:
        MXException
        java.rmi.RemoteException
      • changeStatus

        public void changeStatus(java.lang.String status,
                                 java.util.Date date,
                                 java.lang.String memo)
                          throws MXException,
                                 java.rmi.RemoteException
        This method is overridden to add a wrapper to exceptions thrown during change status and to write warnings whether or not the status change is successful
        Specified by:
        changeStatus in interface CIRemote
        Specified by:
        changeStatus in interface StatefulMboRemote
        Overrides:
        changeStatus in class StatefulMbo
        Parameters:
        status - The new desired status. This is the translated status.
        date - The effective date of the new status.
        memo - A string briefly describing the circumstances of the change. The memo can be null.
        Throws:
        MXException - Thrown if there is a problem.
        java.rmi.RemoteException
        See Also:
        StatefulMbo.changeStatus(String,java.util.Date,String,long)
      • checkAssetUniqueRule

        protected void checkAssetUniqueRule()
                                     throws MXException,
                                            java.rmi.RemoteException
        Check if asset is associated with any CI
        Throws:
        MXException
        java.rmi.RemoteException
      • checkLocationUniqueRule

        protected void checkLocationUniqueRule()
                                        throws MXException,
                                               java.rmi.RemoteException
        Check if location is associated with any CI
        Throws:
        MXException
        java.rmi.RemoteException
      • copyCollectionToCollectDetailsSet

        public void copyCollectionToCollectDetailsSet(MboSetRemote collectionSet)
                                               throws MXException,
                                                      java.rmi.RemoteException
        Adds CIs to one or more Collections, on a selected list of CI's or a single CI. If the current CI is Decommissioned throw new MXApplicationException("collection", "DecommissionedCI")
        Specified by:
        copyCollectionToCollectDetailsSet in interface CIRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        psdi.app.ci.CI#copyCollectionsToCollectDetailsSet
      • setCIAttributesForWO

        protected void setCIAttributesForWO(AutoAttrUpdateRemote autoAttrUpdate)
                                     throws MXException,
                                            java.rmi.RemoteException
        For a given multiasset sets the ci attributes from the given autoattrupdate table
        Parameters:
        autoAttrUpdate - autoattrupdate record for a attribute change
        Throws:
        MXException
        java.rmi.RemoteException
      • createWorkorder

        public MboRemote createWorkorder(java.lang.String jpnum)
                                  throws MXException,
                                         java.rmi.RemoteException
        creates a Workorder with WOCLASS=WORKORDER from CI.
        Specified by:
        createWorkorder in interface AppActionInterface
        Parameters:
        jpnum - -job plan need be apply to the new work order
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • createChange

        public MboRemote createChange(java.lang.String jpnum)
                               throws MXException,
                                      java.rmi.RemoteException
        creates a Workorder with WOCLASS=CHANGE from CI.
        Specified by:
        createChange in interface AppActionInterface
        Parameters:
        jpnum - -job plan need be apply to the new work order
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • createRelease

        public MboRemote createRelease(java.lang.String jpnum)
                                throws MXException,
                                       java.rmi.RemoteException
        creates a Workorder with WOCLASS=RELEASE from CI.
        Specified by:
        createRelease in interface AppActionInterface
        Parameters:
        jpnum - -job plan need be apply to the new work order
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • createServiceRequest

        public MboRemote createServiceRequest(java.lang.String tickettemplateid)
                                       throws MXException,
                                              java.rmi.RemoteException
        creates a Ticket with Ticket Type = Service Request from CI.
        Specified by:
        createServiceRequest in interface AppActionInterface
        Parameters:
        tickettemplateid - - Ticket Template ID to be applied when this ticket is created.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • createProblem

        public MboRemote createProblem(java.lang.String tickettemplateid)
                                throws MXException,
                                       java.rmi.RemoteException
        creates a Ticket with Ticket Type = Problem from CI.
        Specified by:
        createProblem in interface AppActionInterface
        Parameters:
        tickettemplateid - - Ticket Template ID to be applied when this ticket is created.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • createIncident

        public MboRemote createIncident(java.lang.String tickettemplateid)
                                 throws MXException,
                                        java.rmi.RemoteException
        creates a Ticket with Ticket Type = Incident from CI.
        Specified by:
        createIncident in interface AppActionInterface
        Parameters:
        tickettemplateid - - Ticket Template ID to be applied when this ticket is created.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        Description copied from class: Mbo
        Unmark the Mbo for deletion. Can only be called after a delete() and before the save() has been performed. This method will also unmark associated Long Description and Translation Mbos.
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • undelete

        public void undelete(java.util.Hashtable cisToBeUndeleted)
                      throws MXException,
                             java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • undeleteAssociatedRecords

        protected void undeleteAssociatedRecords()
                                          throws MXException,
                                                 java.rmi.RemoteException
        Delete records associated with this CI
        Throws:
        MXException
        java.rmi.RemoteException
      • getChildCIsAndUndelete

        protected void getChildCIsAndUndelete()
                                       throws MXException,
                                              java.rmi.RemoteException
        Get immediate Child CIs for a given CI and delete them
        Throws:
        MXException
        java.rmi.RemoteException
      • getChildCIsAndUndelete

        protected void getChildCIsAndUndelete(java.util.Hashtable cisToBeUndeleted)
                                       throws java.rmi.RemoteException,
                                              MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • clearChangeStatusCacheForCIs

        public void clearChangeStatusCacheForCIs()
                                          throws java.rmi.RemoteException,
                                                 MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • clearChangeStatusForAllSessions

        public void clearChangeStatusForAllSessions()
                                             throws java.rmi.RemoteException,
                                                    MXException
        Throws:
        java.rmi.RemoteException
        MXException
      • actionOnAssetNumFld

        public void actionOnAssetNumFld(MboRemote asset)
                                 throws java.rmi.RemoteException,
                                        MXException
        Handle business logic for Asset mbo when Assetnum is set on CI object. the logic can't put on FldCIAssetNum since for new create Asset, asset mbo get from CI.getMboSet("ASSET") is empty. Therefore for any new create Asset, before save when assetnum is set, this method is to be called to run business logic on asset mbo.
        Specified by:
        actionOnAssetNumFld in interface CIRemote
        Parameters:
        asset -
        Throws:
        java.rmi.RemoteException
        MXException
      • setLinkToActualCI

        public void setLinkToActualCI(java.lang.String actcinum,
                                      long accessModifier)
                               throws java.rmi.RemoteException,
                                      MXException
        Sets the actcinum field on the CI to the specified value, using the specified access flags. The changes still need to be saved.
        Specified by:
        setLinkToActualCI in interface CIRemote
        Parameters:
        actcinum - The actcinum of the Actual CI to link the CI to.
        accessModifier - The access flags to use when setting the value. These are the same flags used on Mbo.setValue(String, String, long) and are defined in psdi.mbo.MboConstants. For no flags, specify MboConstants.NONE.
        Throws:
        java.rmi.RemoteException
        MXException - "Field is read only" exception will be thrown if the actcinum attribute is READONLY and the accessModifier does not specify NOACCESSCHECK.
      • statusAllowsChange

        public boolean statusAllowsChange()
                                   throws java.rmi.RemoteException,
                                          MXException
        Returns whether the business rules allow the CI to be updated in its current status. Returns true if the business rules allow the CI to be updated, false otherwise. This implementation always returns true. Extensions should AND their return value with the results of a call to super.
        Specified by:
        statusAllowsChange in interface CIRemote
        Throws:
        java.rmi.RemoteException
        MXException
      • getKeyForSession

        public java.lang.String getKeyForSession(UserInfo userInfo)
                                          throws java.rmi.RemoteException,
                                                 MXException
        11-14751 Generates a key that is unique for this user and session.
        Parameters:
        userInfo - The UserInfo for the logged in user.
        Returns:
        A String that is a concatenation of the MXServer hostname, server name and user session.
        Throws:
        java.rmi.RemoteException
        MXException
      • clearStatusChangeFields

        public void clearStatusChangeFields()
                                     throws java.rmi.RemoteException,
                                            MXException
        11-17451 This method clears data that is maintained for the user that is changing the status of a CI. It should be called by the change status bean when it is done, even if an exception occurs, but currently it is not, so some data might linger in the cache. The user could log out and log back in again to get another session if it is a problem.
        Specified by:
        clearStatusChangeFields in interface CIRemote
        Throws:
        java.rmi.RemoteException
        MXException