com.ibm.tivoli.maximo.miniapps.scheduler.constraint

Class ConstraintUtil

  • java.lang.Object
    • com.ibm.tivoli.maximo.miniapps.scheduler.constraint.ConstraintUtil


  • public class ConstraintUtil
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor and Description
      ConstraintUtil() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static boolean acceptDestination(MXActivity fromActivity, MXActivity toActivity, MXGanttModel mxGanttModel, ilog.views.gantt.IlvConstraintType constraintType)
      Makes sure that constraints cannot be draw TO Roots and dummys and PM type activities
      Following rules are covered
      -Constraint is not allowed on PM Forecasts.
      -You cannot link a predecessor task twice to the same successor task.
      -Constraint Cycle is detected, which is not allowed.
      -Same Constraint is being added again, which is not allowed.
      -Constraint is not allowed from root level nodes.
      -Constraint is only allowed within siblings of a parent
      static boolean acceptOrigin(MXActivity fromActivity, MXGanttModel mxGanttModel)
      Makes sure that constraints cannot be draw FROM Roots and dummys and PM type activities
      Following rules are covered
      -Constraint is not allowed on PM Forecasts.
      -Constraint is not allowed from top level nodes.
      -Constraint is not allowed from root level nodes.
      static void createLinkedConstraints(MXGanttModel model, BaseTreeGridMiniAppBean bean, java.util.List ids, java.lang.String projectId, SKDAppServiceBeanRemote serviceBean)
      For a given list of Activity IDs then create a Finish to Start constrain with the next Activity, IF POSSIBLE.
      static void createLinkedConstraints(Schedule model, AbstractTreeGridMiniAppBean bean, java.util.List ids, java.lang.String projectId)
      For a given list of Activity IDs then create a Finish to Start constrain with the next Activity, IF POSSIBLE.
      static ilog.views.gantt.IlvConstraintType getConstraintType(Dependency dep) 
      static java.util.List getDeletedDependencies(java.util.List oldDeps, java.util.List newDeps)
      Returns a list of dependencies for which the oldDeps has a dependency relationship that is not in newDeps
      static Dependency getDependenyTo(java.util.List deps, java.lang.String to)
      For the list of Dependencies, find the Dependency for the given "to"
      static java.util.List getInsertedDependencies(java.util.List oldDeps, java.util.List newDeps)
      For the given list of dependencies, return a new list of ONLY the ones that are newly added in newDeps
      static java.util.List getModifiedDependencies(java.util.List oldDeps, java.util.List newDeps)
      Returns a list of dependencies where they share the same from,to, but the type and/or lag has been modified.
      static boolean isCycleDetected(MXGanttModel mxGanttModel, ilog.views.gantt.IlvActivity fromActivity, ilog.views.gantt.IlvActivity toActivityToCheck, java.util.HashMap activityPathMap) 
      static boolean isValid(MXActivity from, MXActivity to, MXGanttModel model, UserInfo userInfo)
      Determine if a Constraint is valid from the given 'from' activity to the provided 'to' activity.
      static boolean isValidParent(java.lang.String parent, java.lang.String checkWonum, UserInfo userInfo)
      Check the parents based on the ID_PROPERTY.
      static java.lang.Double parseLeadLagHrs(java.lang.String lag)
      Given the lag string as "-12.5h" or "90m" convert it to a double Hours.
      static boolean performCPMALL(MXGanttModel model, BaseTreeGridMiniAppBean bean, DataBean appBean) 
      static boolean performCPMALL(Schedule model, BaseLargeGanttView bean, DataBean appBean) 
      static IMXActivity[] performCPMSelected(MXGanttModel model, BaseTreeGridMiniAppBean bean, java.util.List activityIds, DataBean appBean) 
      static IMXActivity[] performCPMSelected(Schedule model, BaseLargeGanttView bean, java.util.List activityIds, DataBean appBean) 
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConstraintUtil

        public ConstraintUtil()
    • Method Detail

      • acceptOrigin

        public static boolean acceptOrigin(MXActivity fromActivity,
                                           MXGanttModel mxGanttModel)
        Makes sure that constraints cannot be draw FROM Roots and dummys and PM type activities
        Following rules are covered
        -Constraint is not allowed on PM Forecasts.
        -Constraint is not allowed from top level nodes.
        -Constraint is not allowed from root level nodes.
        Returns:
        boolean
      • acceptDestination

        public static boolean acceptDestination(MXActivity fromActivity,
                                                MXActivity toActivity,
                                                MXGanttModel mxGanttModel,
                                                ilog.views.gantt.IlvConstraintType constraintType)
        Makes sure that constraints cannot be draw TO Roots and dummys and PM type activities
        Following rules are covered
        -Constraint is not allowed on PM Forecasts.
        -You cannot link a predecessor task twice to the same successor task.
        -Constraint Cycle is detected, which is not allowed.
        -Same Constraint is being added again, which is not allowed.
        -Constraint is not allowed from root level nodes.
        -Constraint is only allowed within siblings of a parent
        Parameters:
        IlvPoint - , IlvGraphic
        Returns:
        boolean
      • isCycleDetected

        public static boolean isCycleDetected(MXGanttModel mxGanttModel,
                                              ilog.views.gantt.IlvActivity fromActivity,
                                              ilog.views.gantt.IlvActivity toActivityToCheck,
                                              java.util.HashMap activityPathMap)
      • getConstraintType

        public static ilog.views.gantt.IlvConstraintType getConstraintType(Dependency dep)
      • getDependenyTo

        public static Dependency getDependenyTo(java.util.List deps,
                                                java.lang.String to)
        For the list of Dependencies, find the Dependency for the given "to"
        Parameters:
        deps -
        to -
        Returns:
      • getDeletedDependencies

        public static java.util.List getDeletedDependencies(java.util.List oldDeps,
                                                            java.util.List newDeps)
        Returns a list of dependencies for which the oldDeps has a dependency relationship that is not in newDeps
        Parameters:
        oldDeps -
        newDeps -
        Returns:
        List of deleted or an empty list
      • getInsertedDependencies

        public static java.util.List getInsertedDependencies(java.util.List oldDeps,
                                                             java.util.List newDeps)
        For the given list of dependencies, return a new list of ONLY the ones that are newly added in newDeps
        Parameters:
        oldDeps -
        newDeps -
        Returns:
        list of newly added dependencies or an empty list
      • getModifiedDependencies

        public static java.util.List getModifiedDependencies(java.util.List oldDeps,
                                                             java.util.List newDeps)
        Returns a list of dependencies where they share the same from,to, but the type and/or lag has been modified. New and Deleted dependencies are NOT considered modified, so this list will only contain dependencies that changed in terms for type (StartStart, StartEnd, etc) and/or lead/lag changed.
        Parameters:
        oldDeps -
        newDeps -
        Returns:
        list of modified dependicies or an empty list
      • parseLeadLagHrs

        public static java.lang.Double parseLeadLagHrs(java.lang.String lag)
        Given the lag string as "-12.5h" or "90m" convert it to a double Hours. If a lag has no postfix of h or m then it is assumed to be minutes.
        Parameters:
        lag -
        Returns:
        lag in Hours
      • performCPMALL

        public static boolean performCPMALL(Schedule model,
                                            BaseLargeGanttView bean,
                                            DataBean appBean)
                                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • createLinkedConstraints

        public static void createLinkedConstraints(MXGanttModel model,
                                                   BaseTreeGridMiniAppBean bean,
                                                   java.util.List ids,
                                                   java.lang.String projectId,
                                                   SKDAppServiceBeanRemote serviceBean)
                                            throws java.rmi.RemoteException,
                                                   MXException,
                                                   java.io.IOException
        For a given list of Activity IDs then create a Finish to Start constrain with the next Activity, IF POSSIBLE. WHen all Constraints are created, then run the CPM Selected on the selected Activities.
        Parameters:
        model -
        bean -
        ids -
        projectId -
        serviceBean -
        Throws:
        MXException
        java.io.IOException
        java.util.concurrent.ExecutionException
        java.lang.InterruptedException
        java.rmi.RemoteException
      • createLinkedConstraints

        public static void createLinkedConstraints(Schedule model,
                                                   AbstractTreeGridMiniAppBean bean,
                                                   java.util.List ids,
                                                   java.lang.String projectId)
                                            throws MXException,
                                                   java.io.IOException
        For a given list of Activity IDs then create a Finish to Start constrain with the next Activity, IF POSSIBLE. WHen all Constraints are created, then run the CPM Selected on the selected Activities.
        Parameters:
        model -
        bean -
        ids -
        projectId -
        Throws:
        MXException
        java.io.IOException
      • isValid

        public static boolean isValid(MXActivity from,
                                      MXActivity to,
                                      MXGanttModel model,
                                      UserInfo userInfo)
                               throws java.rmi.RemoteException,
                                      MXException
        Determine if a Constraint is valid from the given 'from' activity to the provided 'to' activity.
        Parameters:
        from -
        to -
        model -
        modelFuture -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
      • isValidParent

        public static boolean isValidParent(java.lang.String parent,
                                            java.lang.String checkWonum,
                                            UserInfo userInfo)
                                     throws java.rmi.RemoteException,
                                            MXException
        Check the parents based on the ID_PROPERTY. First time it extract the WONUM from the PROPERTY_ID, second time, it should not be present. TODO: Modify the code in order to work with a safe solution.
        Parameters:
        parent - ID_PROPERTY, For recursively calls it will be the FROM record's WONUM
        checkWonum - ID_PROPERTY, For recursively calls it will be the TO record's WONUM
        userInfo - needed to check it from data (Where the consistency was implemented for Scheduler plus)
        Returns:
        TRUE if it is a valid link, FALSE if not.
        Throws:
        java.rmi.RemoteException
        MXException