|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.sandev.TaskHeap.HeapCalculator.HeapCalculatorNodeDecl
org.sandev.TaskHeap.HeapCalculator.HeapCalculatorNodeBase
org.sandev.TaskHeap.HeapCalculator.HeapCalculatorNode
public class HeapCalculatorNode
Implementation of the HeapCalculator node.
| Field Summary | |
|---|---|
static java.lang.String |
DAY14COLOR
|
static java.lang.String |
DAY1COLOR
|
static java.lang.String |
DAY2COLOR
|
static java.lang.String |
DAY30COLOR
|
static java.lang.String |
DAY7COLOR
|
protected static java.lang.String |
EXTERNALPLANSTATUS
|
static java.lang.String |
OLDCOLOR
|
protected static java.lang.String |
PARALLELPLANSTATUS
|
protected static java.lang.String |
SEQUENTIALPLANSTATUS
|
| Fields inherited from class org.sandev.TaskHeap.HeapCalculator.HeapCalculatorNodeDecl |
|---|
peerAuthUserLookupNode, peerIDLookupNode |
| Fields inherited from interface org.sandev.basics.nodecommon.Controllable |
|---|
OPERATION_FAIL, OPERATION_RESUME, OPERATION_SHUTDOWN, OPERATION_STARTUP, OPERATION_STR_FAIL, OPERATION_STR_RESUME, OPERATION_STR_SHUTDOWN, OPERATION_STR_STARTUP, OPERATION_STR_SUSPEND, OPERATION_STR_UNDEFINED, OPERATION_STRINGS, OPERATION_SUSPEND, OPERATION_UNDEFINED, SHUTDOWN_ERROR_RESTART_GLOBAL, SHUTDOWN_ERROR_RESTART_LOCAL, SHUTDOWN_ERROR_TERMINATE, SHUTDOWN_NORMAL, STATE_FAILED, STATE_FAILING, STATE_RESUMING, STATE_RUNNING, STATE_STARTING, STATE_STOPPED, STATE_STOPPING, STATE_STR_FAILED, STATE_STR_FAILING, STATE_STR_RESUMING, STATE_STR_RUNNING, STATE_STR_STARTING, STATE_STR_STOPPED, STATE_STR_STOPPING, STATE_STR_SUSPENDED, STATE_STR_SUSPENDING, STATE_STR_UNDEFINED, STATE_STRINGS, STATE_SUSPENDED, STATE_SUSPENDING, STATE_UNDEFINED |
| Constructor Summary | |
|---|---|
HeapCalculatorNode()
|
|
| Method Summary | |
|---|---|
protected java.util.Date |
calcRelativeDate(RelativeDeadline rel,
java.util.Date date)
Given a relative deadline definition and the due date, figure out the effective deadline date. |
protected PlanTreeElement |
createTree(long heapID,
org.sandev.basics.util.AuthUser user)
Given the ID of a heap, create the display tree for it using the fully expanded view of the heap owner. |
protected PlanTreeElement |
findElem(long refid,
PlanTreeElement root)
Search the given tree for the specified element and return it. |
protected PlanComponentInterface |
findPCI(long refid,
PlanComponentInterface[] pcis)
Return the component matching the given id, or null if not found. |
protected PlanTreeElement |
findRoot(PlanTreeElement root,
long rootID)
Walk the tree to find the specified root. |
protected java.lang.String |
getActivityColor(PlanComponentInterface pci,
HeapAttributes ha)
Return the activity color for the given component. |
protected int |
getAssignedTo(PlanTreeElement elem,
HeapAssociation assoc)
Given a work item and an association to it, return the responsibility level. |
protected int |
getBasicPlanStatus(PlanComponentInterface pci)
Return the basic planStatus value assuming no current plan marked. |
protected long[] |
getChildIDs(PlanComponentInterface pci,
PlanTreeElement elem,
PlanTreeElement reftreeroot)
Return an array of the child IDs reading first from the component or from the tree elem if the pci is null. |
protected java.util.Date |
getElemDueDate(PlanTreeElement elem,
HeapAttributes ha,
PlanComponentInterface[] pcis,
PlanTreeElement reftree)
Compute the due date for the given element. |
protected int |
getInitialItemExpansion(PlanComponentInterface pci)
Return the item expansion for the given component. |
protected PlanTreeElement |
getInterimRefElement(PlanComponentInterface pci,
PlanTreeElement parent)
Given a component, return a temporary tree entry for it with enough information to dereference the due date. |
protected java.lang.String |
getLineBackground(int line,
java.lang.String path,
java.lang.String drillpath)
Figure out the line number background color and return it. |
protected java.lang.String |
getShortDescription(PlanComponentInterface pci)
Return the first part of the given description. |
protected java.lang.String |
getStatus(PlanComponentInterface pci,
org.sandev.basics.util.AuthUser user)
Return the status to display for the given component. |
protected java.lang.String |
getTargetCompletion(PlanTreeElement elem,
ElapsedTimeCalendar cal)
Return the targeted completion day as a canonical date string. |
protected int |
getTimeEstimate(PlanComponentInterface pci)
Return the time estimate for the given component. |
protected int |
getTotalTime(PlanComponentInterface pci)
Returns the estimated time unless this was closed out, in which case it returns zero. |
protected PlanTreeElement |
getTreeRoot(PlanTreeElement elem)
Given a tree element, walk up to the root and return it. |
protected java.lang.String |
getUnderscores(java.lang.String label)
Get the indent level corresponding to the given label. |
protected void |
initDueDateFields(PlanTreeElement elem,
PlanComponentInterface pci)
Intialize the element due date fields from the given component. |
protected boolean |
isFinishedOrClosed(PlanTreeElement elem)
Return true if the given element is finished or closed, false otherwise. |
protected void |
logTree(PlanTreeElement elem)
Dump the tree out to the log file for debugging. |
protected PlanTreeElement |
makeTreeElem(long planComponentID,
PlanTreeElement refTreeRoot,
PlanComponentInterface[] pcis,
PlanTreeElement parent,
java.lang.String label,
org.sandev.basics.util.AuthUser user,
ElapsedTimeCalendar cal,
HeapAttributes ha,
org.sandev.basics.util.IntReference lineNumber)
Create a new tree element for the given ID and return it. |
void |
onDelivery(ExternalPlanUpdate update)
Update our heap view to reflect the new information. |
void |
onDelivery(PlanUpdate update)
Update our heap view to reflect the new information. |
void |
onDelivery(TaskUpdate update)
Update our heap view to reflect the new information. |
org.sandev.basics.sandmessages.AggregateUpdate |
onReceive(org.sandev.basics.sandmessages.AggregateUpdate au)
Pass the update through, then update our heap with any components that were changed before returning the result. |
HeapDisplay |
onReceive(HeapDisplay hd)
Given the id of a heap and the display parameters, return the display tree. |
protected void |
recalcTimesFromChildren(PlanTreeElement elem)
Recalc the timeEstimate and totalTime from the child values. |
protected void |
recomputeDeadlineFields(PlanTreeElement elem,
ElapsedTimeCalendar cal,
HeapAttributes ha,
PlanComponentInterface[] pcis,
PlanTreeElement reftree)
Recompute the deadline fields for the given element. |
protected RelativeDeadline |
reldefForPCI(PlanComponentInterface pci)
Given a component, return a RelativeDeadline for it. |
protected PlanTreeElement |
translateTree(PlanTreeElement root,
PlanTreeElement parent,
org.sandev.basics.util.AuthUser user,
DisplayParams params,
HeapAssociation assoc,
org.sandev.basics.util.IntReference currPlanMark)
Using the given tree as a source, create a full copy translating each element based on the given user and display params. |
protected void |
updateTree(PlanComponentInterface[] pcis,
org.sandev.basics.util.AuthUser user)
Update the heap to take into account changes to the given heap components. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DAY1COLOR
public static final java.lang.String DAY2COLOR
public static final java.lang.String DAY7COLOR
public static final java.lang.String DAY14COLOR
public static final java.lang.String DAY30COLOR
public static final java.lang.String OLDCOLOR
protected static final java.lang.String PARALLELPLANSTATUS
protected static final java.lang.String SEQUENTIALPLANSTATUS
protected static final java.lang.String EXTERNALPLANSTATUS
| Constructor Detail |
|---|
public HeapCalculatorNode()
| Method Detail |
|---|
public HeapDisplay onReceive(HeapDisplay hd)
throws org.sandev.basics.structs.SandException
onReceive in class HeapCalculatorNodeBaseorg.sandev.basics.structs.SandException
public org.sandev.basics.sandmessages.AggregateUpdate onReceive(org.sandev.basics.sandmessages.AggregateUpdate au)
throws org.sandev.basics.structs.SandException
onReceive in class HeapCalculatorNodeBaseorg.sandev.basics.structs.SandException
public void onDelivery(TaskUpdate update)
throws org.sandev.basics.structs.SandException
onDelivery in class HeapCalculatorNodeBaseorg.sandev.basics.structs.SandException
public void onDelivery(ExternalPlanUpdate update)
throws org.sandev.basics.structs.SandException
onDelivery in class HeapCalculatorNodeBaseorg.sandev.basics.structs.SandException
public void onDelivery(PlanUpdate update)
throws org.sandev.basics.structs.SandException
onDelivery in class HeapCalculatorNodeBaseorg.sandev.basics.structs.SandException
protected PlanTreeElement createTree(long heapID,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected PlanTreeElement translateTree(PlanTreeElement root,
PlanTreeElement parent,
org.sandev.basics.util.AuthUser user,
DisplayParams params,
HeapAssociation assoc,
org.sandev.basics.util.IntReference currPlanMark)
protected void updateTree(PlanComponentInterface[] pcis,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
This method is synchronized to keep the tree display consistent even if several updates are being processed at the same time. If this ever becomes a chokepoint, then we can subdivide to synchronize on the HeapAttribute instances so only updates within the same heap have to queue up.
If there is no tree set in the HeapAttributes yet, then this method does nothing. Updates that occur in batch should not trigger creation of the heap tree, and the tree created on the next request will reflect any updates that occurred beforehand.
Since the tree itself is contantly being referenced to create displays, the update process works by making a deep copy of the entire tree, making the modifications to the copy, and then updating the HeapAttributes heap field with the result. Changing the value of the heap field in the HeapAttributes object is an atomic operation, so this should prevent any update anomalies. While it is possible in some instances to only change a part of the tree, when things are being moved around between plans this is not generally possible. Optimizing for the simple case doesn't seem worth the added complexity right now.
org.sandev.basics.structs.SandExceptionprotected java.lang.String getShortDescription(PlanComponentInterface pci)
protected java.lang.String getLineBackground(int line,
java.lang.String path,
java.lang.String drillpath)
protected int getBasicPlanStatus(PlanComponentInterface pci)
protected int getInitialItemExpansion(PlanComponentInterface pci)
protected int getTimeEstimate(PlanComponentInterface pci)
protected int getTotalTime(PlanComponentInterface pci)
protected java.lang.String getUnderscores(java.lang.String label)
protected java.lang.String getStatus(PlanComponentInterface pci,
org.sandev.basics.util.AuthUser user)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected java.lang.String getActivityColor(PlanComponentInterface pci,
HeapAttributes ha)
protected void recalcTimesFromChildren(PlanTreeElement elem)
protected java.lang.String getTargetCompletion(PlanTreeElement elem,
ElapsedTimeCalendar cal)
protected boolean isFinishedOrClosed(PlanTreeElement elem)
protected PlanTreeElement findRoot(PlanTreeElement root,
long rootID)
protected int getAssignedTo(PlanTreeElement elem,
HeapAssociation assoc)
protected PlanTreeElement makeTreeElem(long planComponentID,
PlanTreeElement refTreeRoot,
PlanComponentInterface[] pcis,
PlanTreeElement parent,
java.lang.String label,
org.sandev.basics.util.AuthUser user,
ElapsedTimeCalendar cal,
HeapAttributes ha,
org.sandev.basics.util.IntReference lineNumber)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected long[] getChildIDs(PlanComponentInterface pci,
PlanTreeElement elem,
PlanTreeElement reftreeroot)
protected void initDueDateFields(PlanTreeElement elem,
PlanComponentInterface pci)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandExceptionprotected RelativeDeadline reldefForPCI(PlanComponentInterface pci)
protected void recomputeDeadlineFields(PlanTreeElement elem,
ElapsedTimeCalendar cal,
HeapAttributes ha,
PlanComponentInterface[] pcis,
PlanTreeElement reftree)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected java.util.Date getElemDueDate(PlanTreeElement elem,
HeapAttributes ha,
PlanComponentInterface[] pcis,
PlanTreeElement reftree)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected java.util.Date calcRelativeDate(RelativeDeadline rel,
java.util.Date date)
protected PlanTreeElement getInterimRefElement(PlanComponentInterface pci,
PlanTreeElement parent)
throws org.sandev.basics.structs.SandException
org.sandev.basics.structs.SandException
protected PlanComponentInterface findPCI(long refid,
PlanComponentInterface[] pcis)
protected PlanTreeElement findElem(long refid,
PlanTreeElement root)
protected PlanTreeElement getTreeRoot(PlanTreeElement elem)
protected void logTree(PlanTreeElement elem)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||