public class GanttModelUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
GanttModelUtil.CountingVisitor
Simple counting visitor
|
static class |
GanttModelUtil.FieldPredicate |
static class |
GanttModelUtil.FilterActivityVisitor
GanttModelUtil.IlvActivityVisitor that builds a list of Filtered activities based
on the GanttModelUtil.IFilter instance |
static class |
GanttModelUtil.FilterNodeVisitor
GanttModelUtil.IlvActivityVisitor that builds a list of Filtered activities based
on the GanttModelUtil.IFilter instance |
static class |
GanttModelUtil.FindByIDActivityVisitor
Visitor that will find an Activity by ID
|
static interface |
GanttModelUtil.HasCancelled
A "state" object can implement this if they want to "cancel" out of visitor operation
|
static class |
GanttModelUtil.IDPredicate |
static interface |
GanttModelUtil.IFilter<T>
Generic Filter class for any type
|
static interface |
GanttModelUtil.IlvActivityVisitor<T>
Simple visitor pattern for activities.
|
static interface |
GanttModelUtil.IlvHierarchyNodeVisitor<NodeType extends ilog.views.gantt.IlvHierarchyNode,StateType>
Generic
IlvHierarchyNode visitor for visiting any subclass of IlvHierarchyNode |
static interface |
GanttModelUtil.IlvNodeVisitor<T>
Generic Node Visitor that can visit nodes in an IlvHierarchyChart
|
static interface |
GanttModelUtil.IlvResourceVisitor<T>
Specific implementation of an
GanttModelUtil.IlvHierarchyNodeVisitor for IlvResource type objects. |
static class |
GanttModelUtil.MultipleFieldsPredicate |
static class |
GanttModelUtil.NodeLocation |
static interface |
GanttModelUtil.Predicate<T> |
static class |
GanttModelUtil.ResourceFieldPredicate |
static class |
GanttModelUtil.ResourceIDPredicate |
static class |
GanttModelUtil.SameTypeVisitor
Special visitor where isValid() will return true if each object
that is visited has the same type as any objectname in the list
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
PROPERTY_READ_ONLY_MODEL
Property on the ROOT activity to indicate that the model is readonly
|
static java.lang.String |
ROOT_NODE |
static java.lang.String |
WO_INTERNAL_STATUS_APPR
Internal Status for Approved WorkOrder
"APPR"
|
static java.util.List<java.lang.String> |
WORKORDER_OBJECTNAMES
Global List of WORKORDER type object names
|
Constructor and Description |
---|
GanttModelUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
addCrafts(java.util.HashSet crafts,
ilog.views.gantt.IlvActivity item,
ilog.views.gantt.IlvGanttChart ganttChart)
For a given Activity on the chart, add its crafts to the set of passed in crafts.
|
static DateRange |
calculateProjectMinMax(IMXGanttModel model) |
static com.ibm.json.java.JSONArray |
convertTreeInFlatList(com.ibm.json.java.JSONArray tree)
Converts a tree of Activities into a flat list.
|
static void |
copyProperties(ilog.views.gantt.IlvActivity src,
ilog.views.gantt.IlvActivity dest)
Copies all Non-Null properties from the source to the destination, but it will NOT overwrite
existing Non-Null properties in the destination.
|
static long |
count(java.util.Iterator<?> items)
Count the items
|
static long |
countActivities(ilog.views.gantt.IlvGanttModel model) |
static long |
countReservations(ilog.views.gantt.IlvGanttModel model) |
static long |
countResources(ilog.views.gantt.IlvGanttModel model) |
static ilog.views.gantt.IlvTimeInterval |
createUnionTimeInterval(ilog.views.gantt.IlvHierarchyNode... nodes)
Returns a TimeInterval that fits all the nodes that are passed in.
|
static void |
dumpActivity(MXGanttModel model,
ilog.views.gantt.IlvActivity rootActivity,
java.io.PrintStream out,
boolean simple,
int indent) |
static void |
dumpDebegInfoForContaints(java.lang.String msg,
java.util.Iterator<ilog.views.gantt.IlvConstraint> iter,
java.io.PrintStream out) |
static void |
dumpDebugCompareInfoForItems(java.lang.String msg,
ilog.views.gantt.property.IlvUserPropertyHolder item1,
ilog.views.gantt.property.IlvUserPropertyHolder item2,
java.io.PrintStream out)
Dumps 2 Activities and compares their properties
|
static void |
dumpDebugInfoForContstraint(ilog.views.gantt.IlvConstraint c,
java.io.PrintStream out) |
static void |
dumpDebugInfoForResource(ilog.views.gantt.IlvResource selectedresource,
ilog.views.gantt.IlvGanttModel model,
java.io.PrintStream out) |
static void |
dumpModel(java.lang.String msg,
MXGanttModel model,
java.io.PrintStream out,
boolean simple) |
static void |
dumpReservationsForResource(MXResource mxr,
MXGanttModel model,
java.io.PrintStream out) |
static java.lang.String |
encodeTreeGridActivityContraints(IMXGanttModel model,
IMXActivity mxa)
Encodes the Contstaints and form the IlvConstaints coming from this
activity and update the Activity's DECENDENTS field with the newly
calculated descendents.
|
static ilog.views.gantt.IlvHierarchyNode |
find(GanttModelUtil.Predicate idp,
ilog.views.gantt.IlvHierarchyNode start,
ilog.views.gantt.IlvGanttModel model) |
static ilog.views.gantt.IlvActivity |
findActivityById(java.lang.String id,
ilog.views.gantt.IlvHierarchyNode start,
ilog.views.gantt.IlvGanttModel model) |
static IMXActivity |
findActivityById(java.lang.String id,
MXGanttModel model) |
static ilog.views.gantt.IlvResource |
findResourceById(java.lang.String id,
ilog.views.gantt.IlvHierarchyNode start,
ilog.views.gantt.IlvGanttModel model) |
static ilog.views.gantt.IlvActivity |
getActivityById(ilog.views.gantt.IlvGanttModel model,
ilog.views.gantt.IlvActivity parent,
java.lang.String id)
Convenience method for finding an Activiy by ID
|
static ilog.views.gantt.IlvHierarchyNode[] |
getChildren(ilog.views.gantt.IlvHierarchyNode item,
ilog.views.gantt.IlvGanttModel model)
Convenience Method that returns all direct children for a given node
|
static java.util.Date |
getEarliestStartTime(ilog.views.gantt.IlvActivity[] selected)
Given an array of items, then return the earliest start time for all the activities
|
static long |
getFormattedProjectID(java.lang.String projectId) |
static java.lang.String |
getID(ilog.views.gantt.IlvHierarchyNode node)
Returns the ID for a Resource or Activity
|
static java.lang.String |
getID(IMXActivity mxa)
Returns the TreeGrid ID for this activity and creates one, if one does
not exist.
|
static java.lang.String |
getID(java.lang.String actid)
Given an activity ID from ILOG create a TreeGrid compatible ID
|
static java.util.Date |
getLatestEndTime(ilog.views.gantt.IlvActivity[] selected)
Given the array of items, return the latest end time for all the activites
|
static ilog.views.gantt.IlvActivity |
getParent(ilog.views.gantt.IlvActivity act,
ilog.views.gantt.IlvGanttModel model)
Returns the parent activity for the given activity in the model
|
static ilog.views.gantt.IlvActivity |
getParentSafely(ilog.views.gantt.IlvActivity act,
ilog.views.gantt.IlvGanttModel model)
Returns the parent activity for the given activity in the model.
|
static MXActivity |
getParentWorkorder(MXGanttModel model,
ilog.views.gantt.IlvActivity assignment) |
static java.lang.String |
getPecentCompleteFieldForType(IMXGanttModel.PercentCompleteType pcType) |
static java.lang.Object |
getProperty(java.lang.Object node,
java.lang.String prop)
Gets a property from a node
|
static <T> T |
getProperty(java.lang.Object node,
java.lang.String prop,
T defaultValue)
Gets a property from a Node and returns the default if not set.
|
static MXActivity |
getRelatedActivity(MXGanttModel model,
MXActivity activity,
MXResource resource,
GanttModelUtil.NodeLocation location) |
static MXResource |
getResourceForActivity(MXGanttModel model,
MXActivity mxa) |
static java.util.List<MXActivity> |
getSecondaryAssignmens(MXGanttModel model,
MXActivity primary) |
static MXTravelTimeConstraint |
getTravelTimeConstraintForToActivity(MXGanttModel theModel,
ilog.views.gantt.IlvActivity activity)
returns the 'TO' constraint for the passed in activity
|
static boolean |
hasAnyChildren(ilog.views.gantt.IlvHierarchyNode[] items,
ilog.views.gantt.IlvGanttModel model)
Returns true if ANY item has children
|
static boolean |
hasChildren(ilog.views.gantt.IlvHierarchyNode item,
ilog.views.gantt.IlvGanttModel model)
|
static double |
IlvDurationToDouble(ilog.views.gantt.IlvDuration lv,
UserInfo ui)
Convert IlvDuration to a double
|
static boolean |
isAssignment(ilog.views.gantt.IlvActivity act)
Returns true if the Activity is an Assignment
|
static boolean |
isAssignment(MXActivity mxa) |
static boolean |
isAssignmentDummy(ilog.views.gantt.IlvHierarchyNode node) |
static boolean |
isAverageRollupEnabled() |
static boolean |
isCompleted(MXActivity mxa) |
static boolean |
isDummy(ilog.views.gantt.IlvResource next) |
static boolean |
isDummy(IMXActivity act) |
static boolean |
isHidden(ilog.views.gantt.IlvHierarchyNode node) |
static boolean |
isHidden(MXActivity mxa) |
static boolean |
isLocked(MXActivity activity) |
static boolean |
isOtherAssignment(MXActivity mxa) |
static boolean |
isPM(ilog.views.gantt.IlvActivity act)
Returns true if the activity is a PM activity
|
static boolean |
isPM(ilog.views.gantt.IlvHierarchyNode act)
Returns true if the activity is a PM activity
|
static boolean |
isReadOnly(MXActivity mxa) |
static boolean |
isRootActivity(IMXActivity activity) |
static boolean |
isSecondary(MXActivity mxa) |
static boolean |
isTimeRollupEnabled() |
static boolean |
isWorkorder(ilog.views.gantt.IlvActivity act)
Returns true if the given
IlvActivity is a work order |
static boolean |
isWorkorderApproved(MXActivity source)
Returns true if the source is a workorder and it is approved
|
static void |
moveToDay(java.util.Calendar day,
ilog.views.gantt.IlvActivity[] selected,
ilog.views.gantt.IlvGanttModel model)
Given the Date and the selected items, it performs a Move To Day operation.
|
static GanttModelUtil.IlvActivityVisitor<java.util.Set<java.lang.String>> |
newAdjustTimeVisitor(ilog.views.gantt.IlvDuration adjustment)
Creates a visitor that will adjust the start and end times on an activity by the given
IlvDuration . |
static java.lang.String |
removeIDPrefix(java.lang.String actid)
Remove activity ID prefix.
|
static boolean |
setProperty(java.lang.Object node,
java.lang.String prop,
java.lang.Object val)
Sets a property, if possible, in the
IlvHierarchyNode . |
static boolean |
showRequirementIcon(MXActivity mxa) |
static boolean |
showWorklogIcon(MXActivity mxa) |
static java.lang.Object |
toStringArray(java.lang.String[] items) |
static boolean |
updateProperty(IMXActivity act,
java.lang.String prop,
java.lang.Object val) |
static <T> void |
visitActivities(ilog.views.gantt.IlvActivity[] items,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvActivityVisitor<T> visitor,
T state)
Applies an IlvActivityVisitor to each activity and it's children.
|
static <T> void |
visitActivity(ilog.views.gantt.IlvActivity item,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvActivityVisitor<T> visitor,
T state)
Applies an IlvActivityVisitor to each activity and it's children.
|
static <T> void |
visitNode(ilog.views.gantt.IlvHierarchyNode item,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvNodeVisitor<T> visitor,
T state)
Generic Visitor for visiting IlvHeirarchyNodes
|
static <T> void |
visitNodes(ilog.views.gantt.IlvHierarchyNode[] items,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvNodeVisitor<T> visitor,
T state)
Generic Visitor for IlvHierarchNodes
|
static <T> void |
visitResource(ilog.views.gantt.IlvResource item,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvResourceVisitor<T> visitor,
T state)
Allow an
IlvResource object to be visited by the visitor. |
static <T> void |
visitResources(ilog.views.gantt.IlvResource[] items,
ilog.views.gantt.IlvGanttModel model,
GanttModelUtil.IlvResourceVisitor<T> visitor,
T state)
Visits an array of Resources
|
public static final java.lang.String ROOT_NODE
public static final java.lang.String WO_INTERNAL_STATUS_APPR
public static final java.lang.String PROPERTY_READ_ONLY_MODEL
public static final java.util.List<java.lang.String> WORKORDER_OBJECTNAMES
public static ilog.views.gantt.IlvActivity findActivityById(java.lang.String id, ilog.views.gantt.IlvHierarchyNode start, ilog.views.gantt.IlvGanttModel model)
public static IMXActivity findActivityById(java.lang.String id, MXGanttModel model)
public static ilog.views.gantt.IlvResource findResourceById(java.lang.String id, ilog.views.gantt.IlvHierarchyNode start, ilog.views.gantt.IlvGanttModel model)
public static ilog.views.gantt.IlvHierarchyNode find(GanttModelUtil.Predicate idp, ilog.views.gantt.IlvHierarchyNode start, ilog.views.gantt.IlvGanttModel model)
public static boolean isAssignment(MXActivity mxa)
public static boolean isOtherAssignment(MXActivity mxa)
public static boolean isReadOnly(MXActivity mxa)
public static boolean isLocked(MXActivity activity)
public static boolean isSecondary(MXActivity mxa)
public static boolean isHidden(MXActivity mxa)
public static boolean isHidden(ilog.views.gantt.IlvHierarchyNode node)
public static boolean showWorklogIcon(MXActivity mxa)
public static boolean showRequirementIcon(MXActivity mxa)
public static boolean isDummy(ilog.views.gantt.IlvResource next)
public static boolean isDummy(IMXActivity act)
public static boolean isCompleted(MXActivity mxa)
public static java.lang.Object toStringArray(java.lang.String[] items)
public static MXActivity getParentWorkorder(MXGanttModel model, ilog.views.gantt.IlvActivity assignment)
public static MXResource getResourceForActivity(MXGanttModel model, MXActivity mxa)
public static java.util.List<MXActivity> getSecondaryAssignmens(MXGanttModel model, MXActivity primary)
public static boolean isWorkorder(ilog.views.gantt.IlvActivity act)
IlvActivity
is a work orderact
- IlvActivity
instancepublic static boolean isAssignment(ilog.views.gantt.IlvActivity act)
act
- public static boolean isPM(ilog.views.gantt.IlvActivity act)
act
- public static boolean isPM(ilog.views.gantt.IlvHierarchyNode act)
act
- public static boolean hasChildren(ilog.views.gantt.IlvHierarchyNode item, ilog.views.gantt.IlvGanttModel model)
item
- IlvActivity
instance (can be MXActivity
or IlvHierarchyNode
)chart
- gantt chart to while the item belongspublic static boolean hasAnyChildren(ilog.views.gantt.IlvHierarchyNode[] items, ilog.views.gantt.IlvGanttModel model)
items
- ganttChart
- public static void addCrafts(java.util.HashSet crafts, ilog.views.gantt.IlvActivity item, ilog.views.gantt.IlvGanttChart ganttChart)
crafts
- HashSet
to which the crafts should be placeditem
- IlvActivity
item on the chartganttChart
- IlvGanttChart
gantt chartpublic static <T> void visitResource(ilog.views.gantt.IlvResource item, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvResourceVisitor<T> visitor, T state)
IlvResource
object to be visited by the visitor.T
- State objectitem
- Item being visitedchart
- Chart to which the item belongsvisitor
- Visitor that will accept the itemstate
- State that will be passed to the visitorpublic static <T> void visitResources(ilog.views.gantt.IlvResource[] items, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvResourceVisitor<T> visitor, T state)
T
- State Object generic Typeitems
- array of IlvResource itemschart
- chart to which the items belongvisitor
- visitor that will accept each of the itemsstate
- state that will be passed to the visitorpublic static <T> void visitActivity(ilog.views.gantt.IlvActivity item, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvActivityVisitor<T> visitor, T state)
item
- IlvActivity
parent activityganttChart
- IlvGanttChart
to which the IlvActivity
belongsvisitor
- GanttModelUtil.IlvActivityVisitor
that will visit each itempublic static <T> void visitNodes(ilog.views.gantt.IlvHierarchyNode[] items, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvNodeVisitor<T> visitor, T state)
T
- items
- ganttChart
- visitor
- state
- public static <T> void visitNode(ilog.views.gantt.IlvHierarchyNode item, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvNodeVisitor<T> visitor, T state)
public static <T> void visitActivities(ilog.views.gantt.IlvActivity[] items, ilog.views.gantt.IlvGanttModel model, GanttModelUtil.IlvActivityVisitor<T> visitor, T state)
item
- IlvActivity
parent activityganttChart
- IlvGanttChart
to which the IlvActivity
belongsvisitor
- GanttModelUtil.IlvActivityVisitor
that will visit each itempublic static final GanttModelUtil.IlvActivityVisitor<java.util.Set<java.lang.String>> newAdjustTimeVisitor(ilog.views.gantt.IlvDuration adjustment)
IlvDuration
.
IlvDuration
defines constants for ONE_DAY, ONE_WEEK, etc, or you can pass your own duration. This
visitor will tract each item that is visited in in the state Set
, to prevent the same item from
being visited more than once. The only use case for this is when you are processing multiple selected rows
of a selected parent.adjustment
- IlvDuration
to which to apply to the start and end timeGanttModelUtil.IlvActivityVisitor
implementation that will adjust by the given adjustmentpublic static void moveToDay(java.util.Calendar day, ilog.views.gantt.IlvActivity[] selected, ilog.views.gantt.IlvGanttModel model)
day
- selected
- gchart
- public static void dumpDebegInfoForContaints(java.lang.String msg, java.util.Iterator<ilog.views.gantt.IlvConstraint> iter, java.io.PrintStream out)
public static void dumpDebugInfoForContstraint(ilog.views.gantt.IlvConstraint c, java.io.PrintStream out)
public static void dumpDebugCompareInfoForItems(java.lang.String msg, ilog.views.gantt.property.IlvUserPropertyHolder item1, ilog.views.gantt.property.IlvUserPropertyHolder item2, java.io.PrintStream out)
item1
- item2
- public static void copyProperties(ilog.views.gantt.IlvActivity src, ilog.views.gantt.IlvActivity dest)
src
- dest
- public static java.util.Date getEarliestStartTime(ilog.views.gantt.IlvActivity[] selected)
selected
- public static java.util.Date getLatestEndTime(ilog.views.gantt.IlvActivity[] selected)
selected
- public static ilog.views.gantt.IlvActivity getParent(ilog.views.gantt.IlvActivity act, ilog.views.gantt.IlvGanttModel model)
act
- model
- public static ilog.views.gantt.IlvActivity getParentSafely(ilog.views.gantt.IlvActivity act, ilog.views.gantt.IlvGanttModel model)
act
- model
- public static java.lang.String getID(IMXActivity mxa)
act
- model
- public static java.lang.String getID(java.lang.String actid)
actid
- public static java.lang.String getID(ilog.views.gantt.IlvHierarchyNode node)
node
- public static boolean setProperty(java.lang.Object node, java.lang.String prop, java.lang.Object val)
IlvHierarchyNode
. The node must implement
IlvUserPropertyHolder
for this to work.node
- prop
- val
- public static java.lang.Object getProperty(java.lang.Object node, java.lang.String prop)
node
- prop
- public static <T> T getProperty(java.lang.Object node, java.lang.String prop, T defaultValue)
T
- node
- prop
- defaultValue
- public static ilog.views.gantt.IlvTimeInterval createUnionTimeInterval(ilog.views.gantt.IlvHierarchyNode... nodes)
charts
- public static boolean isWorkorderApproved(MXActivity source)
source
- public static ilog.views.gantt.IlvActivity getActivityById(ilog.views.gantt.IlvGanttModel model, ilog.views.gantt.IlvActivity parent, java.lang.String id)
model
- id
- public static ilog.views.gantt.IlvHierarchyNode[] getChildren(ilog.views.gantt.IlvHierarchyNode item, ilog.views.gantt.IlvGanttModel model)
item
- chart
- public static void dumpDebugInfoForResource(ilog.views.gantt.IlvResource selectedresource, ilog.views.gantt.IlvGanttModel model, java.io.PrintStream out)
public static long count(java.util.Iterator<?> items)
items
- public static long countActivities(ilog.views.gantt.IlvGanttModel model)
public static long countResources(ilog.views.gantt.IlvGanttModel model)
public static long countReservations(ilog.views.gantt.IlvGanttModel model)
public static void dumpModel(java.lang.String msg, MXGanttModel model, java.io.PrintStream out, boolean simple)
public static void dumpActivity(MXGanttModel model, ilog.views.gantt.IlvActivity rootActivity, java.io.PrintStream out, boolean simple, int indent)
public static boolean isAssignmentDummy(ilog.views.gantt.IlvHierarchyNode node)
public static void dumpReservationsForResource(MXResource mxr, MXGanttModel model, java.io.PrintStream out)
public static boolean updateProperty(IMXActivity act, java.lang.String prop, java.lang.Object val)
public static boolean isTimeRollupEnabled()
public static boolean isAverageRollupEnabled()
public static MXActivity getRelatedActivity(MXGanttModel model, MXActivity activity, MXResource resource, GanttModelUtil.NodeLocation location)
public static DateRange calculateProjectMinMax(IMXGanttModel model)
public static boolean isRootActivity(IMXActivity activity)
public static java.lang.String getPecentCompleteFieldForType(IMXGanttModel.PercentCompleteType pcType)
public static MXTravelTimeConstraint getTravelTimeConstraintForToActivity(MXGanttModel theModel, ilog.views.gantt.IlvActivity activity)
public static double IlvDurationToDouble(ilog.views.gantt.IlvDuration lv, UserInfo ui) throws java.lang.Exception
lv
- java.lang.Exception
public static java.lang.String encodeTreeGridActivityContraints(IMXGanttModel model, IMXActivity mxa) throws java.io.IOException
model
- mxa
- java.io.IOException
public static long getFormattedProjectID(java.lang.String projectId)
public static java.lang.String removeIDPrefix(java.lang.String actid)
actid
- public static com.ibm.json.java.JSONArray convertTreeInFlatList(com.ibm.json.java.JSONArray tree)
tree
-