Package org.cip4.jdflib.util
Class StatusCounter
- java.lang.Object
-
- org.cip4.jdflib.util.StatusCounter
-
public class StatusCounter extends java.lang.ObjectUtility class for status JDF and JMF
-
-
Field Summary
Fields Modifier and Type Field Description protected VStringm_ignorePartsprotected JDFNodem_Nodeprotected VJDFAttributeMapm_vPartMapprotected java.util.HashSet<java.lang.String>setCopyResInfoprotected java.util.HashSet<java.lang.String>setTrackWaste
-
Constructor Summary
Constructors Constructor Description StatusCounter(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)construct a StatusUtil for a node n
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddEmployee(JDFEmployee employee)voidaddIgnorePart(JDFResource.EnumPartIDKey key)set the partIDKeys to be ignoredvoidaddModule(java.lang.String moduleID, java.lang.String moduleType)voidaddPhase(java.lang.String refID, double amount, double waste, boolean sumTotal)add the amount specified by amount and waste to the resource with id refIDvoidclearAmounts(java.lang.String refID)clear all the amounts in the resource with id refIDbooleanclearEmployees()JDFResourceLink[]getAmountLinks()get all total amounts of all tracked resourcesdoublegetCurrentCounter()java.lang.StringgetDeviceID()JDFDocgetDocJMFNotification(boolean bClean)JDFDocgetDocJMFPhaseTime()JDFDocgetDocJMFResource()java.util.Vector<JDFEmployee>getEmpoyees()java.lang.StringgetFirstRefID()get the refID of the first resource, i.e.VStringgetIcsVersions()java.lang.StringgetJobID()protected org.cip4.jdflib.util.StatusCounter.LinkAmountgetLinkAmount(int n)get the matching LinkAmount out of thisprotected org.cip4.jdflib.util.StatusCounter.LinkAmountgetLinkAmount(java.lang.String refID)get the matching LinkAmount out of thisjava.lang.StringgetLinkID(java.lang.String refID)get the matching LinkAmount out of thisVStringgetModuleeID()NodeIdentifiergetNodeIDentifier()doublegetPercentComplete()doublegetPhaseAmount(java.lang.String refID)get the total the amount of the resource with id refIDdouble[]getPhaseAmounts()get all phaseamounts of all tracked resourcesdoublegetPhaseWaste(java.lang.String refID)get the total the amount of the resource with id refIDdouble[]getPhaseWastes()get all phase waste amounts of all tracked resourcesdoublegetPlannedAmount(java.lang.String refID)doublegetPlannedWaste(java.lang.String refID)java.lang.StringgetQueueEntryID()JDFDategetStartDate()JDFAutoDeviceInfo.EnumDeviceStatusgetStatus()java.lang.StringgetStatusDetails()doublegetTotalAmount(java.lang.String refID)get the total the amount of the resource with id refIDdouble[]getTotalAmounts()get all total amounts of all tracked resourcesdoublegetTotalCounter()doublegetTotalWaste(java.lang.String refID)get the total the amount of the resource with id refIDdouble[]getTotalWastes()get all total amounts of all tracked resourcesbooleanremoveEmployee(JDFEmployee employee)voidreplaceEmployees(java.util.Vector<JDFEmployee> employees)replace all employees in this - update phases if necessaryvoidsetActiveNode(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)set the currently active nodevoidsetCopyResInResInfo(java.lang.String _refID, boolean b)set copying the resource into resourceInfo on or off for the resourcelink rlvoidsetCurrentCounter(double _currentCounter)voidsetDeviceID(java.lang.String deviceid)JDFNotificationsetEvent(java.lang.String eventID, java.lang.String eventValue, java.lang.String comment)set event, append the Event element and optionally the comment
overwrites existing valuesvoidsetFirstRefID(java.lang.String resID)set the id of the resource to be tracked in phasetimes, i.e.voidsetIcsVersions(VString icsVersions)voidsetOperationMode(JDFAutoMISDetails.EnumDeviceOperationMode _operationMode)voidsetPercentComplete(double percent)set percentComplete to percentvoidsetPhase(java.lang.String refID, double amount, double waste)set the phase the amount specified by amount and waste to the resource with id refIDbooleansetPhase(JDFElement.EnumNodeStatus nodeStatus, java.lang.String nodeStatusDetails, JDFAutoDeviceInfo.EnumDeviceStatus deviceStatus, java.lang.String deviceStatusDetails)Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate also prepare a status JMFvoidsetPhaseTimeAmounts(boolean bAddAmount)JDFProcessRunsetProcessResult(JDFElement.EnumNodeStatus endStatus)voidsetQueueEntryID(java.lang.String _queueEntryID)JDFResourceAuditsetResourceAudit(java.lang.String resID, JDFAutoResourceAudit.EnumReason reason)voidsetTotal(java.lang.String refID, double amount, boolean bWaste)set the total amount specified by amount and waste to the resource with id refID usually called when reading resource audits or resource signalsvoidsetTotalCounter(double _totalCounter)voidsetTrackWaste(java.lang.String resID, boolean b)set waste tracking on or off for the resourcelink rlvoidsetWorkType(JDFAutoMISDetails.EnumWorkType _workType)sets the MISDetails/@WorkType for default audis, resource audits and phaseTime elementsjava.lang.StringshortString()java.lang.StringtoString()voidupdatePercentComplete(double percent)update percentComplete by percentvoidwriteAll()
-
-
-
Field Detail
-
m_Node
protected JDFNode m_Node
-
m_vPartMap
protected VJDFAttributeMap m_vPartMap
-
m_ignoreParts
protected VString m_ignoreParts
-
setTrackWaste
protected java.util.HashSet<java.lang.String> setTrackWaste
-
setCopyResInfo
protected java.util.HashSet<java.lang.String> setCopyResInfo
-
-
Constructor Detail
-
StatusCounter
public StatusCounter(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)
construct a StatusUtil for a node n- Parameters:
node- the JDFNode that is being processedvPartMap- the map of Parts that is being processed excluding the waste partitionvResLinks- the reslinks that are tracked for amount handling
-
-
Method Detail
-
getTotalCounter
public double getTotalCounter()
- Returns:
- the total counter value
-
setTotalCounter
public void setTotalCounter(double _totalCounter)
- Parameters:
_totalCounter-
-
getCurrentCounter
public double getCurrentCounter()
- Returns:
- the value of currentCounter
-
setCurrentCounter
public void setCurrentCounter(double _currentCounter)
- Parameters:
_currentCounter-
-
addEmployee
public int addEmployee(JDFEmployee employee)
- Parameters:
employee-- Returns:
-
removeEmployee
public boolean removeEmployee(JDFEmployee employee)
- Parameters:
employee-- Returns:
-
getEmpoyees
public java.util.Vector<JDFEmployee> getEmpoyees()
- Returns:
- the vector of currently registered employees
-
clearEmployees
public boolean clearEmployees()
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object- See Also:
Object.toString()
-
writeAll
public void writeAll()
-
setPhaseTimeAmounts
public void setPhaseTimeAmounts(boolean bAddAmount)
- Parameters:
bAddAmount- if true, amounts are added to phasetimes
-
setActiveNode
public void setActiveNode(JDFNode node, VJDFAttributeMap vPartMap, VElement vResLinks)
set the currently active node- Parameters:
node- the JDFNode that is being processedvPartMap- the map of Parts that is being processed excluding the waste partitionvResLinks- the reslinks that are tracked for amount handling
-
getLinkAmount
protected org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(java.lang.String refID)
get the matching LinkAmount out of this- Parameters:
refID- the refID, name or usage of the resource of the bag - this MUST match the refID of a ResourceLink- Returns:
- the LinkAmount with matching refID, null if none found or bags is null
-
getLinkID
public java.lang.String getLinkID(java.lang.String refID)
get the matching LinkAmount out of this- Parameters:
refID- the refID, name or usage of the resource of the bag - this MUST match the refID of a ResourceLink- Returns:
- the actual refID of the matching resLink, null if none found or bags is null
-
getLinkAmount
protected org.cip4.jdflib.util.StatusCounter.LinkAmount getLinkAmount(int n)
get the matching LinkAmount out of this- Parameters:
n- the index of the resource of the bag - this MUST match the refID of a ResourceLink- Returns:
- the LinkAmount with matching n, null if none found or bags is null
-
getFirstRefID
public java.lang.String getFirstRefID()
get the refID of the first resource, i.e. the Resource that is being tracked in status messages- Returns:
- the rRef of the prime resource link
-
setFirstRefID
public void setFirstRefID(java.lang.String resID)
set the id of the resource to be tracked in phasetimes, i.e. THE resource that is counted- Parameters:
resID-
-
addIgnorePart
public void addIgnorePart(JDFResource.EnumPartIDKey key)
set the partIDKeys to be ignored- Parameters:
key-
-
clearAmounts
public void clearAmounts(java.lang.String refID)
clear all the amounts in the resource with id refID- Parameters:
refID- id of the resource
-
setPhase
public void setPhase(java.lang.String refID, double amount, double waste)set the phase the amount specified by amount and waste to the resource with id refID- Parameters:
refID- , type or usage of the resource, if null all are updatedamount- the amount for this phasewaste- the waste for this phase
-
addPhase
public void addPhase(java.lang.String refID, double amount, double waste, boolean sumTotal)add the amount specified by amount and waste to the resource with id refID- Parameters:
refID- , type or usage of the resource, if null all are updatedamount-waste-sumTotal- if true, also sum up the total amounts, else only phase
-
setTotal
public void setTotal(java.lang.String refID, double amount, boolean bWaste)set the total amount specified by amount and waste to the resource with id refID usually called when reading resource audits or resource signals- Parameters:
refID- , type or usage of the resource, if null all are updatedamount- the amount to setbWaste- if true, set total waste, else set total good
-
getTotalAmount
public double getTotalAmount(java.lang.String refID)
get the total the amount of the resource with id refID- Parameters:
refID- , type or usage of the resource,- Returns:
-
getTotalAmounts
public double[] getTotalAmounts()
get all total amounts of all tracked resources- Returns:
-
getAmountLinks
public JDFResourceLink[] getAmountLinks()
get all total amounts of all tracked resources- Returns:
-
getPhaseAmounts
public double[] getPhaseAmounts()
get all phaseamounts of all tracked resources- Returns:
-
getPercentComplete
public double getPercentComplete()
- Returns:
- the percent completed of the current node
-
getPhaseAmount
public double getPhaseAmount(java.lang.String refID)
get the total the amount of the resource with id refID- Parameters:
refID- , type or usage of the resource,- Returns:
-
getTotalWaste
public double getTotalWaste(java.lang.String refID)
get the total the amount of the resource with id refID- Parameters:
refID- , type or usage of the resource,- Returns:
-
getTotalWastes
public double[] getTotalWastes()
get all total amounts of all tracked resources- Returns:
-
getPhaseWastes
public double[] getPhaseWastes()
get all phase waste amounts of all tracked resources- Returns:
-
getPhaseWaste
public double getPhaseWaste(java.lang.String refID)
get the total the amount of the resource with id refID- Parameters:
refID- , type or usage of the resource,- Returns:
-
setEvent
public JDFNotification setEvent(java.lang.String eventID, java.lang.String eventValue, java.lang.String comment)
set event, append the Event element and optionally the comment
overwrites existing values- Parameters:
eventID- Event/@EventID to seteventValue- Event/@EventValue to setcomment- the comment text, if null no comment is set- Returns:
-
setPhase
public boolean setPhase(JDFElement.EnumNodeStatus nodeStatus, java.lang.String nodeStatusDetails, JDFAutoDeviceInfo.EnumDeviceStatus deviceStatus, java.lang.String deviceStatusDetails)
Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate also prepare a status JMF- Parameters:
nodeStatus- the new status of the nodenodeStatusDetails- the new statusDetails of the nodedeviceStatus- the new status of the devicedeviceStatusDetails- the new statusDetails of the device- Returns:
- true if the status changed
-
getDocJMFPhaseTime
public JDFDoc getDocJMFPhaseTime()
- Returns:
- the docJMFPhaseTime
-
getDocJMFResource
public JDFDoc getDocJMFResource()
- Returns:
- the docJMFResource
-
getDocJMFNotification
public JDFDoc getDocJMFNotification(boolean bClean)
- Parameters:
bClean-- Returns:
- the docJMFNotification
-
getDeviceID
public java.lang.String getDeviceID()
- Returns:
- the m_deviceID
-
getModuleeID
public VString getModuleeID()
- Returns:
- the m_moduleID
-
setDeviceID
public void setDeviceID(java.lang.String deviceid)
- Parameters:
deviceid- the m_deviceID to set
-
addModule
public void addModule(java.lang.String moduleID, java.lang.String moduleType)- Parameters:
moduleID-moduleType-
-
setTrackWaste
public void setTrackWaste(java.lang.String resID, boolean b)set waste tracking on or off for the resourcelink rl- Parameters:
resID- the resource id to the resource to trackb- tracking on or off
-
setCopyResInResInfo
public void setCopyResInResInfo(java.lang.String _refID, boolean b)set copying the resource into resourceInfo on or off for the resourcelink rl- Parameters:
_refID- the refid of the resourcelink to the resource to copyb- tracking on or off
-
setResourceAudit
public JDFResourceAudit setResourceAudit(java.lang.String resID, JDFAutoResourceAudit.EnumReason reason)
- Parameters:
resID- the resource ID to set/track reason for the auditreason-- Returns:
- JDFResourceAudit the generated audit
-
setProcessResult
public JDFProcessRun setProcessResult(JDFElement.EnumNodeStatus endStatus)
- Parameters:
endStatus-- Returns:
-
setQueueEntryID
public void setQueueEntryID(java.lang.String _queueEntryID)
- Parameters:
_queueEntryID-
-
getQueueEntryID
public java.lang.String getQueueEntryID()
- Returns:
- queueEntryID
-
setWorkType
public void setWorkType(JDFAutoMISDetails.EnumWorkType _workType)
sets the MISDetails/@WorkType for default audis, resource audits and phaseTime elements- Parameters:
_workType- the worktype to set, if null no MISDetails and no Worktype are added. closes all ongoing phases and starts a new phase
-
getStatus
public JDFAutoDeviceInfo.EnumDeviceStatus getStatus()
- Returns:
-
getStatusDetails
public java.lang.String getStatusDetails()
- Returns:
-
getStartDate
public JDFDate getStartDate()
- Returns:
-
setOperationMode
public void setOperationMode(JDFAutoMISDetails.EnumDeviceOperationMode _operationMode)
- Parameters:
_operationMode-
-
getPlannedAmount
public double getPlannedAmount(java.lang.String refID)
- Parameters:
refID- the resource ID or name- Returns:
- the planned amount for the resource
-
getPlannedWaste
public double getPlannedWaste(java.lang.String refID)
- Parameters:
refID- the resource ID or name- Returns:
- the planned waste for the resource
-
getNodeIDentifier
public NodeIdentifier getNodeIDentifier()
- Returns:
- the nodeID
-
setPercentComplete
public void setPercentComplete(double percent)
set percentComplete to percent- Parameters:
percent- the percentage to set
-
updatePercentComplete
public void updatePercentComplete(double percent)
update percentComplete by percent- Parameters:
percent- the percentage to increment
-
setIcsVersions
public void setIcsVersions(VString icsVersions)
- Parameters:
icsVersions- the icsVersions to set
-
getIcsVersions
public VString getIcsVersions()
- Returns:
- the icsVersions
-
replaceEmployees
public void replaceEmployees(java.util.Vector<JDFEmployee> employees)
replace all employees in this - update phases if necessary- Parameters:
employees-
-
shortString
public java.lang.String shortString()
-
getJobID
public java.lang.String getJobID()
-
-