psdi.app.location

Class LocHierarchy

  • java.lang.Object
    • Constructor Detail

      • LocHierarchy

        public LocHierarchy(MboSet ms)
                     throws MXException,
                            java.rmi.RemoteException
        Construct the LocHierarchy object
        Throws:
        MXException
        java.rmi.RemoteException
    • Method Detail

      • add

        public void add()
                 throws MXException,
                        java.rmi.RemoteException
        Add a new Lochierarchy record Field defaults are set
        Specified by:
        add in interface MboRemote
        Overrides:
        add in class Mbo
        Throws:
        MXApplicationException("locations", - "LocHierarchyNoAdd")is thrown when owner is null or owner is not locations and if it is not a lochierarchy or children set
        MXException
        java.rmi.RemoteException
      • appValidate

        public void appValidate()
                         throws MXException,
                                java.rmi.RemoteException
        last minute validate before save(). If there is a lochierarchy record with null parent and a new parent is being given, we will want to update the parent field of the existing null-parent lochierarchy while removing the new one being created.
        Overrides:
        appValidate in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Save() routine - upon save of this object, insert or update related objects.
        1) When a new lochierarchy is created,multiple locancestor records will need to be created to refrerence each parent in the hierarchy as ancestor- to represent the hierarchy in a flat manner,
        2) The children flag of the parent lochierarchy was set to yes while querying the parent hierarchy,
        3) Update the system to networked if a new top level hierarchy is created, resulting in multiple hierarchies in the system,
        4) Update the system to networked when associating multiple parents to one child.

        EXAMPLE: Associating a location "1001" to parent= "MH101"; i.e. adding a new lochierarchy record of 1001/MH101 as location/parent combination.
        The existing hierarchy for the parent MH101 is as (MAXdemo db):
        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST

        Adding this new Lochierarchy will result in creating the following LocAncestor records:

        LOCATIONANCESTOR
        10011001
        1001MH101
        1001W-MAINST
        1001W560
        1001WEST
        1001BOSTON

        Overrides:
        save in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException
      • isNetworked

        public boolean isNetworked()
                            throws MXException,
                                   java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • delete

        public void delete(long access)
                    throws MXException,
                           java.rmi.RemoteException
        delete(long) routine A lochierarchy record is deleted only when it itself and its children are being disconnected from the system or if the owning location is being deleted; No one should directly call the delete() method to process the removal of relationships or disconnecting nodes from the system. One should call one of the following three remote methods provided in LocHierarchyRemote implemented in this object:
        1. connectLocationAndChildrenToParent
        2. makeLocationTopLevel
        3. disconnectLocationAndChildrenFromSystem.
        Specified by:
        delete in interface MboRemote
        Overrides:
        delete in class Mbo
        Parameters:
        access - modifier such as NOACCESCHECK.
        Throws:
        MXApplicationException("locations","canNotCallDelete") - is thrown when deleteOption is not equal to DISCONNECTALL i.e all nodes are not disconnected in a hierarchy.
        MXException
        java.rmi.RemoteException
        See Also:
        LocHierarchy.connectLocationAndChildrenToParent, LocHierarchy.disconnectLocationAndChildrenFromSystem, LocHierarchy.makeLocationTopLevel
      • connectLocationAndChildrenToParent

        public void connectLocationAndChildrenToParent()
                                                throws MXException,
                                                       java.rmi.RemoteException
        Connect myself to my grandparent and process my children so they won't reference my parent as ancestor.
        This option is only good when this node has only one parent; when this option takes place, the following updates/deletes happen:
        1) Remove the locancestor record which references my parent as ancestor,
        2) Call the children to delete the Locancestor records that reference the parent as ancestor,
        3) Set my grandparent as my parent.

        EXAMPLE:
        Following table shows the Location and Parent hierarchy BEFORE the operation:
        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001MH101
        10021001

        AFTER the operation, the Location and Parent hierarchy becomes:

        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001W-MAINST
        10021001

        Specified by:
        connectLocationAndChildrenToParent in interface LocHierarchyRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        LocHierarchy.disconnectLocationAndChildrenFromSystem, LocHierarchy.makeLocationTopLevel
      • disconnectLocationAndChildrenFromSystem

        public void disconnectLocationAndChildrenFromSystem()
                                                     throws MXException,
                                                            java.rmi.RemoteException
        Disconnect myself from the system,delete my locancestor records, and call each child to do the same task.
        The Result:
        1) Myself, my children, and their children are disconnected from this system, meaning the Lochierarchy and Locancestor records are actually deleted,
        2) The "children" flag of my parent is updated to false if it should become childless after my disconnecting from the system.

        EXAMPLE:
        The location and parent hierarchy BEFORE disconnecting 1001 from the system:
        Lochierarchy:
        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001MH101
        10021001

        LocAncestor:

        LOCATIONANCESTOR
        BOSTONBOSTON
        WESTWEST
        WESTBOSTON
        W560W560
        W560WEST
        W560BOSTON
        W-MAINSTW-MAINST
        W-MAINSTW560
        W-MAINSTWEST
        W-MAINSTBOSTON
        MH101MH101
        MH101W-MAINST
        MH101W560
        MH101WEST
        MH101BOSTON
        10011001
        1001MH101
        1001W-MAINST
        1001W560
        1001WEST
        1001BOSTON
        10021002
        10021001
        1002MH101
        1002W-MAINST
        1002W560
        1002WEST
        1002BOSTON

        Disconnecting 1001 and children will result in:
        LocHierarchy:

        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST

        LocAncestor:

        LOCATIONANCESTOR
        BOSTONBOSTON
        WESTWEST
        WESTBOSTON
        W560W560
        W560WEST
        W560BOSTON
        W-MAINSTW-MAINST
        W-MAINSTW560
        W-MAINSTWEST
        W-MAINSTBOSTON
        MH101MH101
        MH101W-MAINST
        MH101W560
        MH101WEST
        MH101BOSTON

        Specified by:
        disconnectLocationAndChildrenFromSystem in interface LocHierarchyRemote
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        LocHierarchy.connectLocationAndChildrenToParent, LocHierarchy.makeLocationTopLevel
      • makeLocationTopLevel

        public void makeLocationTopLevel()
                                  throws MXException,
                                         java.rmi.RemoteException
        Makes the node top level, brings along its children to form its own hierarchy, and causes the system to become networked.
        When this option takes place, the following updates/deletes happen:
        1) If it is a PRIMARY system, should not allow this operation to take place.
        A primary system has to be hierarchical and making another top level in the same system will cause the system to become networked,
        2) Delete the locancestor records this node reference as ancestors and set the parent field to null,
        3) Delete the the children locancestor records that reference my parents as ancestors,
        4) Make the system networked if it is hierarchical,
        5) Update the "children" flag of the parent should it become childless after the node's forming its own top level hierarchy.

        EXAMPLE:
        The location and parent hierarchy BEFORE making 1001 top level and bringing along 1002:
        Lochierarchy:
        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001MH101
        10021001

        LocAncestor:

        LOCATIONANCESTOR
        BOSTONBOSTON
        WESTWEST
        WESTBOSTON
        W560W560
        W560WEST
        W560BOSTON
        W-MAINSTW-MAINST
        W-MAINSTW560
        W-MAINSTWEST
        W-MAINSTBOSTON
        MH101MH101
        MH101W-MAINST
        MH101W560
        MH101WEST
        MH101BOSTON
        10011001
        1001MH101
        1001W-MAINST
        1001W560
        1001WEST
        1001BOSTON
        10021002
        10021001
        1002MH101
        1002W-MAINST
        1002W560
        1002WEST
        1002BOSTON

        AFTER making top 1001 top level:
        LocHierarchy:

        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001
        10021001

        LocAncestor:

        LOCATIONANCESTOR
        BOSTONBOSTON
        WESTWEST
        WESTBOSTON
        W560W560
        W560WEST
        W560BOSTON
        W-MAINSTW-MAINST
        W-MAINSTW560
        W-MAINSTWEST
        W-MAINSTBOSTON
        MH101MH101
        MH101W-MAINST
        MH101W560
        MH101WEST
        MH101BOSTON
        10011001
        10021002
        10021001

        Specified by:
        makeLocationTopLevel in interface LocHierarchyRemote
        Throws:
        MXApplicationException("locations","invalidprocess") - is thrown when it is the primary system
        MXException
        java.rmi.RemoteException
        See Also:
        LocHierarchy.connectLocationAndChildrenToParent, LocHierarchy.disconnectLocationAndChildrenFromSystem
      • getOwningLocSystem

        public MboRemote getOwningLocSystem()
                                     throws MXException,
                                            java.rmi.RemoteException
        if this LocHierarchy descends from a LocSystem object, returns the LocSystem
        Throws:
        MXException
        java.rmi.RemoteException
      • changeSysToNetworked

        public void changeSysToNetworked()
                                  throws MXException,
                                         java.rmi.RemoteException
        changeSysToNetworked method - called to assess the status of the LOCSYSTEM.NETWORKED flag for the current LOCHIERARCHY.SYSTEMID. If it should be true, then it checks the value by calling the LOCSYSTEM method isNetworked. The LOCSYSTEM method makeHierarchyANetwork is called if LOCHIERARCHY.NETWORKED should be, and is not, set to true. The conditions under which LOCHIERARCHY.NETWORKED should be true are as follows: i. if the system contains a location that has more than one parent ii. if the system contains multiple top-level locations, that is, if there is more than one location for which LOCHIERARCHY.PARENT is null. This is the case even if the multiple hierarchies that descend from the multiple top-level locations do not intersect and are themselves hierarchical. As a result, you may have a networked system that does not contain a node with more than one parent. This method should be called any time: i. a new lochierarchy record is added ii. a lochierarchy record is removed with the LocHierarchySetRemote.MAKETOPLEVEL option, that is, when a location is removed from its position in the location hierarchy and placed as another top-level location within the same system.
        Throws:
        MXApplicationException("locations","invalidlocsystem") - is thrown when location system is null or invalid.
        MXException
        java.rmi.RemoteException
      • getSystem

        protected LocSystemRemote getSystem()
                                     throws MXException,
                                            java.rmi.RemoteException
        returns locSystem to indicate if the system this hierarchy belongs to is networked or not.
        Returns:
        locsystem mbo object
        Throws:
        MXException
        java.rmi.RemoteException
      • getParents

        public MboSetRemote getParents()
                                throws MXException,
                                       java.rmi.RemoteException
        Get this lochierarchy's parents.
        Throws:
        MXException
        java.rmi.RemoteException
      • getChildren

        public MboSetRemote getChildren()
                                 throws MXException,
                                        java.rmi.RemoteException
        Get this lochierarchy's children.
        Returns:
        children
        Throws:
        MXException
        java.rmi.RemoteException
      • isTop

        public boolean isTop()
                      throws MXException,
                             java.rmi.RemoteException
        Is the location top level (without parent)?
        Returns:
        Boolean value
        Throws:
        MXException
        java.rmi.RemoteException
      • hasChildren

        public boolean hasChildren()
                            throws MXException,
                                   java.rmi.RemoteException
        Does this location have children?
        Returns:
        Boolean value
        Throws:
        MXException
        java.rmi.RemoteException
      • hasParents

        public boolean hasParents()
                           throws MXException,
                                  java.rmi.RemoteException
        Does this location have parents?
        Returns:
        Boolean value
        Throws:
        MXException
        java.rmi.RemoteException
      • getHierarchies

        public java.lang.String[] getHierarchies()
                                          throws MXException,
                                                 java.rmi.RemoteException
        Get the location's parents; Will return an array of String that contains all the parents in the parent hierarchy.

        EXAMPLE:
        from the following hierarchy, for the 1001/MH101 locHierarchy, the array of parents returned will be:
        {"MH101","W-MAINST","W560","WEST","BOSTON"}.
        LOCATIONPARENT
        BOSTON
        WESTBOSTON
        W560WEST
        W-MAINSTW560
        MH101W-MAINST
        1001MH101
        10021001

        Returns:
        array of String that contains the node's parent thru the top-level parents.
        Throws:
        MXException
        java.rmi.RemoteException
      • getTop

        public MboSetRemote getTop()
                            throws MXException,
                                   java.rmi.RemoteException
        Get the top level mboSet in the hierarchy
        Returns:
        top parent
        Throws:
        MXException
        java.rmi.RemoteException
      • getMboSet

        public MboSetRemote getMboSet(java.lang.String name)
                               throws MXException,
                                      java.rmi.RemoteException
        if mboset name is CHILDREN and is passed from extended drilldown, then do not add the subselect
        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)
      • undelete

        public void undelete()
                      throws MXException,
                             java.rmi.RemoteException
        IJ37745 override Mbo undelete() method to also undelete LocAncestor set
        Specified by:
        undelete in interface MboRemote
        Overrides:
        undelete in class Mbo
        Throws:
        MXException
        java.rmi.RemoteException