public virtual void testDirectProof() { n.setXMLComment("Example workflow with initioal warmup phase, one direct proof and 100 copies of 10 sheets each.\n" + "The direct proof is acceptable and included in the good output"); digiParams.setDirectProofAmount(1); digiParams.setXMLComment("1 initial proof is requested"); rlComp.setAmount(100, null); JDFAuditPool ap = n.getAuditPool(); VElement vRL = new VElement(); vRL.Add(rlComp); vRL.Add(rlMedia); StatusCounter stCounter = new StatusCounter(n, null, vRL); stCounter.setDeviceID("MyDevice"); string mediaRef = rlMedia.getrRef(); stCounter.setTrackWaste(mediaRef, true); string compRef = rlComp.getrRef(); stCounter.setTrackWaste(compRef, false); doc.write2File(sm_dirTestDataTemp + "DigiPrintAmount_initial.jdf", 2, false); stCounter.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null); ap.getLastPhase(null, null).setXMLComment("Phase where warm up waste is produced"); stCounter.addPhase(mediaRef, 0, 2, true); stCounter.addPhase(compRef, 0, 20, true); stCounter.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null); stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); stCounter.addPhase(mediaRef, 1, 0, true); stCounter.addPhase(compRef, 10, 0, true); stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); ap.getLastPhase(null, null).setXMLComment("Phase where 1 proof is produced"); stCounter.setPhase(EnumNodeStatus.Stopped, "WaitForApproval", EnumDeviceStatus.Stopped, null); ap.getLastPhase(null, null).setXMLComment("Phase where the proof is evaluated while the device is stopped"); stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); stCounter.addPhase(mediaRef, 99, 0, true); stCounter.addPhase(compRef, 990, 0, true); stCounter.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); ap.getLastPhase(null, null).setXMLComment("Phase where the 100 copies are produced"); stCounter.setPhase(EnumNodeStatus.Completed, "Idle", EnumDeviceStatus.Idle, null); stCounter.setResourceAudit(mediaRef, EnumReason.ProcessResult); doc.write2File(sm_dirTestDataTemp + "DigiPrintProof_final.jdf", 2, false); }
/// /// <summary> * Set the Status and StatusDetails of this node update the PhaseTime audit or append a new phasetime as appropriate /// * also prepare a status JMF /// * </summary> /// * <param name="nodeStatus"> the new status of the node </param> /// * <param name="nodeStatusDetails"> the new statusDetails of the node </param> /// * <param name="deviceStatus"> the new status of the device </param> /// * <param name="deviceStatusDetails"> the new statusDetails of the device </param> /// * <param name="vPartMap"> the vector of parts to that should be set </param> /// * <param name="vResLink"> the resourcelinks that are used to fill the various amount attributes in jobphase and phasetime /// * </param> /// public virtual void setPhase(EnumNodeStatus nodeStatus, string nodeStatusDetails, EnumDeviceStatus deviceStatus, string deviceStatusDetails, AmountBag[] amounts) { docJMFPhaseTime = new JDFDoc(ElementName.JMF); JDFJMF jmf = docJMFPhaseTime.getJMFRoot(); docJMFResource = new JDFDoc(ElementName.JMF); JDFJMF jmfRes = docJMFResource.getJMFRoot(); AmountBag ab = getBag(getFirstRefID(), amounts); LinkAmount la = getLinkAmount(getFirstRefID()); AmountBag lastAb = la == null ? null : la.lastBag; JDFAuditPool ap = m_Node.getCreateAuditPool(); // TODO rethink when to send 2 phases JDFPhaseTime pt1 = ap.getLastPhase(m_vPartMap, null); JDFPhaseTime pt2 = pt1; bool bEnd = nodeStatus.Equals(EnumNodeStatus.Completed) || nodeStatus.Equals(EnumNodeStatus.Aborted); pt2 = ap.setPhase(nodeStatus, nodeStatusDetails, m_vPartMap, null); if (bEnd) { JDFProcessRun pr = (JDFProcessRun)ap.addAudit(EnumAuditType.ProcessRun, null); pr.setPartMapVector(m_vPartMap); VElement audits = ap.getAudits(EnumAuditType.PhaseTime, null, m_vPartMap); for (int i = 0; i < audits.Count; i++) { pr.addPhase((JDFPhaseTime)audits[i]); } pr.setEndStatus(nodeStatus); } if (pt1 != null && pt2 != pt1) // we explicitly added a new phasetime // audit, thus we need to add a closing // JMF for the original jobPhase { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt1); jp.setJobID(m_Node.getJobID(true)); jp.setJobPartID(m_Node.getJobPartID(false)); setJobPhaseAmounts(lastAb, jp); if (m_deviceID != null) { deviceInfo.setDeviceID(m_deviceID); } } if (pt2 != null) { JDFSignal s = (JDFSignal)jmf.appendMessageElement(JDFMessage.EnumFamily.Signal, JDFMessage.EnumType.Status); JDFDeviceInfo deviceInfo = s.appendDeviceInfo(); if (!bEnd) // don't write a jobphase for an idle device { JDFJobPhase jp = deviceInfo.createJobPhaseFromPhaseTime(pt2); setJobPhaseAmounts(ab, jp); } deviceInfo.setDeviceStatus(deviceStatus); deviceInfo.setStatusDetails(deviceStatusDetails); deviceInfo.setDeviceID(m_deviceID); m_Node.setPartStatus(m_vPartMap, nodeStatus, null); getVResLink(amounts, 2); // update the nodes links generateResourceSignal(amounts, jmfRes); if (bEnd) { pt2.deleteNode(); // zapp the last phasetime } else { pt2.setLinks(getVResLink(amounts, 1)); pt2.eraseEmptyAttributes(true); } } // cleanup! if (vLinkAmount != null) { for (int i = 0; i < vLinkAmount.Length; i++) { string refID = vLinkAmount[i].rl.getrRef(); AmountBag bag = getBag(refID, amounts); vLinkAmount[i].lastBag = new AmountBag(bag); } } jmf.eraseEmptyAttributes(true); }