com.ibm.tivoli.maximo.miniapps.scheduler.compare.max

Class CompareMaxModelHelper

  • java.lang.Object
    • com.ibm.tivoli.maximo.miniapps.scheduler.compare.max.CompareMaxModelHelper


  • public class CompareMaxModelHelper
    extends java.lang.Object
    Takes 2 models and emits Node events based on if the node is ONLY in the left, ONLY in the right, or shared between the two models. In the event that nodes are shared, the the NODE is emitted 3 times. Once to show they are common, and then once from the left node, and then again for the right node. In this way a NodeEmitter can process the emits and build an aternate structure based on what is being emitted. NOTE, the models are sorted before processing so the order of the MODEL nodes is determined by the MODEL ID for each row. The concept of the NodeEmitter is intentionally vague. The NodeEmitter can be used to reconstuct a new model based on comparing these 2 models. In the end, the NodeEmitter implementation will depend on how you are presenting the comparable models. In the case of TreeGrid Gantt, the NodeEmitter will likley build TreeGrid gantt JSON model of the compared gantt models. The following gives a visual representation of how a "compare" might be processed based on 2 models.
    BEGIN DUMPING MODEL: LEFT MODEL
    ACTIVITY: ROOT [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: B [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: D [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: C [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: A [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
          ACTIVITY: A-1 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
             ACTIVITY: A-1-1 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
             ACTIVITY: A-1-2 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
    END DUMPING MODEL: LEFT MODEL
    
    BEGIN DUMPING MODEL: RIGHT MODEL
    ACTIVITY: ROOT [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 10:00:00 AM]
       ACTIVITY: B [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: D [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       ACTIVITY: C [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 10:00:00 AM]
       ACTIVITY: E [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
          ACTIVITY: E-1 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
             ACTIVITY: E-1-1 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
             ACTIVITY: E-1-2 [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
    END DUMPING MODEL: RIGHT MODEL
    
    Now show how the 2 models are processed
    =================================
    COMMON: ROOT; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 10:00:00 AM]
    BEGIN CHILDREN
       LEFT ONLY: A; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       LEFT ONLY: A-1; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       LEFT ONLY: A-1-1; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       LEFT ONLY: A-1-2; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       COMMON: B; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       COMMON MODIFIED: C; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 10:00:00 AM]
       BEGIN CHILDREN
          LEFT  MODIFIED: C; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
          RIGHT MODIFIED: C; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 10:00:00 AM]
       END CHILDREN
       COMMON: D; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       RIGHT ONLY: E; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       RIGHT ONLY: E-1; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       RIGHT ONLY: E-1-1; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
       RIGHT ONLY: E-1-2; [Jan 16, 2016 7:00:00 AM - Jan 16, 2016 9:00:00 AM]
    END CHILDREN 
     
    • Constructor Detail

      • CompareMaxModelHelper

        public CompareMaxModelHelper(IMXGanttModel leftModelFuture,
                                     IMXGanttModel rightModelFuture,
                                     CompareMaxModelHelper.ModelHelper helper,
                                     MXSession session)
        Creates a Helper using 2 future models (left and right conceptually). and the NodeEmitter will be used to emit model node events. The NodeEmitter will have enough information to reconstruct the model and know which nodes are ONLY in the left, or ONLY in the right, or shared by both. In the case of shared nodes, the emitter will also be notified of the common node, and each instance of the modified node. Note that the concept of left and right are purely metaphorical. How the charts are physically related (left, right, top, bottom, etc) is not relevant, so left and right are used purely to create an imaginary visual relationship.
        Parameters:
        leftModelFuture -
        rightModelFuture -
        nodeEmitter -
    • Method Detail

      • loadMissingNodes

        public void loadMissingNodes()
                              throws java.rmi.RemoteException,
                                     MXException
        Loads missing nodes in both sides.
        Throws:
        java.rmi.RemoteException
        MXException
      • processModels

        public void processModels(int pageNumber)
        Processes the 2 gantt models and will emit node events to the node emitter.
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.io.IOException
      • processMismatchModels

        public void processMismatchModels()
        Processes the 2 gantt models and will emit node events to the node emitter.
        Throws:
        java.lang.InterruptedException
        java.util.concurrent.ExecutionException
        java.io.IOException
      • getTotalDifferencesCount

        public int getTotalDifferencesCount()
      • getMissingLeftTasks

        public java.util.List getMissingLeftTasks()
      • getMissingRightTasks

        public java.util.List getMissingRightTasks()