psdi.app.common

Class AncestorManager

  • java.lang.Object
    • psdi.app.common.AncestorManager


  • public class AncestorManager
    extends java.lang.Object
    This class updates Ancestors records for MboSets which implement ancestor records similarly to how the WOSet implements ancestor records. This class operates with the Mbos locally, not through remote interface.

    In this class I refer to the pivot as the record which may have children and/or a parent. This class creates ancestor records for the pivot - parent and pivot - child relationships. Ancestor records for the pivot-child relationship may be handled on the save of the child (where the child is the pivot and the pivot is the parent).

    One condition this class does not yet handle is the case where the parent of the pivot and the parent of the parent are not inserted yet. So far this is prevented by the client classes of this class.

    Another unhandled condition is when an existing child is assigned a new parent and reassigned to the original parent in the same MboSet. Assumptions
    If the pivot is a WO, the key attribute is WONUM and the ancestor table is WOAncestor.
    If the pivot is a PM, the key attribute is PMNUM and the ancestor table is PMAncestor.
    If the pivot is a ASSET, the key attribute is ASSETNUM and the ancestor table is AssetAncestor.
    The ancestor attribute in the ancestor table is ANCESTOR.
    The hierarchy levels attribute in the ancestor table is HIERARCHYLEVELS.
    The ancestor table has a primary key consisting of site/org attribute(s), the key attribute, the ancestor attribute, and the hierarchylevels attribute.
    The pivot MboSet has attributes PARENT and HASCHILDREN.
    The pivot MboSet (ASSET) has attributes PARENT and CHILDREN.
    That there is a PARENT relationship that fetches the Mbo identified by the PARENT attribute.
    That there is a CHILDREN relationship that fetches a Mbo's sub-records. If the parent is modifiable it is passed with the pivot to the AncestorManager and the pivot is a member of the parent's CHILDREN MboSet.
    That members of a CHILDREN set can be made top-level or be deleted, but may not be reassigned to a new parent from the CHILDREN MboSet.

    • Method Detail

      • updateAncestorRecords

        public static void updateAncestorRecords(AncMbo pivot,
                                                 AncMbo parent)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Throws:
        MXException
        java.rmi.RemoteException
      • updateAncestorRecords

        public static void updateAncestorRecords(AncMbo pivot)
                                          throws MXException,
                                                 java.rmi.RemoteException
        Searches for an existing AncestorManager to use or creates one if none found. The AM then makes neccessary changes to the ancestor records for the changed hierarchy. This version of the method takes a reference to the parent Mbo that's already loaded in memory.
        Parameters:
        pivot - The Mbo in memory the AM is being invoked for.
        Throws:
        MXException
        java.rmi.RemoteException