/// /// <summary> * </summary> /// public virtual JDFProcessRun setProcessResult(EnumNodeStatus endStatus) { JDFAuditPool ap = m_Node.getCreateAuditPool(); JDFProcessRun pr = ap.addProcessRun(endStatus, null, m_vPartMap); return(pr); }
/// /// <summary> * Add a ProcessRun Audit /// * </summary> /// * <param name="s"> the node status at this time </param> /// * <param name="by"> the author keyword </param> /// * <returns> the newly created ProcessRun audit /// * /// * default: AddProcessRun(s, JDFConstants.EMPTYSTRING) </returns> /// public virtual JDFProcessRun addProcessRun(JDFElement.EnumNodeStatus s, string by, VJDFAttributeMap vmParts) { JDFProcessRun pr = (JDFProcessRun)addAudit(JDFAudit.EnumAuditType.ProcessRun, by); pr.setStart(null); pr.setEnd(null); pr.setEndStatus(s); pr.setPartMapVector(vmParts); return(pr); }
public virtual void testFixVersion() { JDFDoc d = new JDFDoc("JDF"); JDFNode n = d.getJDFRoot(); n.setType(EnumType.Bundling); JDFProcessRun pr = n.getAuditPool().addProcessRun(EnumNodeStatus.Completed, null, null); pr.setAttribute("Duration", "PT90S", null); Assert.AreEqual("PT90S", pr.getAttribute("Duration")); n.setAttribute("foo3", "a~.doc"); n.fixVersion(null); Assert.AreEqual("PT1M30S", pr.getAttribute("Duration")); Assert.AreEqual("a~.doc", n.getAttribute("foo3")); }
public virtual void testAuditsImageSetting() { for (int i = 0; i < vsSheet.Count; i++) { string sheet = vsSheet.stringAt(i); VJDFAttributeMap vmP = new VJDFAttributeMap(); JDFAttributeMap attributeMap = new JDFAttributeMap(EnumPartIDKey.SheetName, sheet); attributeMap.put("SignatureName", "Sig1"); vmP.Add(attributeMap); statCounter.setActiveNode(n, vmP, vRL); string refXM = rlXMOut.getrRef(); string refMedia = rlMediaIn.getrRef(); statCounter.setTrackWaste(refXM, true); statCounter.setTrackWaste(refMedia, false); statCounter.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn"); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); statCounter.addPhase(refMedia, 5, 0, true); statCounter.addPhase(refXM, 5, 0, true); statCounter.setPhase(EnumNodeStatus.InProgress, "Imaging", EnumDeviceStatus.Running, null); // JDFResourceAudit ra= statCounter.setResourceAudit(refMedia, EnumReason.ProcessResult); JDFProcessRun pr = statCounter.setProcessResult(EnumNodeStatus.Completed); pr.setDescriptiveName("we even have the utterly useless ProcessRun"); } d.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jdf", 2, false); JDFDoc d2 = statCounter.getDocJMFResource(); JDFJMF jmf = d2.getJMFRoot(); jmf.convertResponses(null); JDFSignal sig = jmf.appendSignal(org.cip4.jdflib.jmf.JDFMessage.EnumType.Notification); JDFNotification not = sig.appendNotification(); not.setXPathAttribute("MileStone/@MileStoneType", "PrepressCompleted"); not.setXPathAttribute("MileStone/@Amount", "5"); d2.write2File(sm_dirTestDataTemp + "ImageSetAmount_.jmf", 2, false); JDFDoc dStatusJMF = statCounter.getDocJMFPhaseTime(); jmf = dStatusJMF.getJMFRoot(); jmf.convertResponses(null); dStatusJMF.write2File(sm_dirTestDataTemp + "ImageSetPhaseTime_.jmf", 2, false); }
/// /// <summary> * overwrite this method in case you want to customize the hotfolder for returnqueueentryparams and paramtetrizing /// * the ReturnQueueEntryParams template is insufficient /// * </summary> /// * <param name="stringURL"> the file url of the hotfolder jdf in the local storage directory (NOT the hf) </param> /// * <param name="newCommand"> the command that was generated from the template </param> /// * <param name="jdfRoot"> the root jdfnode of the dropped file </param> /// protected internal virtual void extractReturnParams(string stringURL, JDFCommand newCommand, JDFNode jdfRoot) { JDFReturnQueueEntryParams rqp = newCommand.getCreateReturnQueueEntryParams(0); rqp.setURL(stringURL); JDFAuditPool ap = jdfRoot == null ? null : jdfRoot.getCreateAuditPool(); if (ap != null) { JDFProcessRun pr = (JDFProcessRun)ap.getAudit(-1, EnumAuditType.ProcessRun, null, null); string queueEID = pr == null ? null : pr.getAttribute(AttributeName.QUEUEENTRYID); if (!KElement.isWildCard(queueEID)) { rqp.setQueueEntryID(queueEID); } } }
public virtual void testCreateSubmitProcessRun() { JDFProcessRun pr = myAuditPool.createSubmitProcessRun(null); Assert.IsNotNull(pr.getSubmissionTime()); Assert.IsFalse(new JDFDate().before(pr.getSubmissionTime()), "has submissiontime before now"); Assert.IsTrue(pr.getAttribute(AttributeName.QUEUEENTRYID).StartsWith("qe")); JDFDoc d = new JDFDoc(ElementName.QUEUEENTRY); JDFQueueEntry qe = (JDFQueueEntry)d.getRoot(); JDFDate dat = new JDFDate(); dat.addOffset(0, 0, 6, 2); qe.setSubmissionTime(dat); qe.setQueueEntryID("q1"); pr = myAuditPool.createSubmitProcessRun(qe); Assert.AreEqual(dat, pr.getSubmissionTime()); Assert.AreEqual("q1", pr.getAttribute(AttributeName.QUEUEENTRYID)); }
/// /// <summary> * creates a ProcessRun when this is submitted should be called by the receiving device when it initially receives /// * and enqueues the JDF /// * </summary> /// * <param name="qe"> the queuentry element to copy information from, if null parameters will be genrated on the fly </param> /// * <returns> the newly created processRun </returns> /// public virtual JDFProcessRun createSubmitProcessRun(JDFQueueEntry qe) { JDFProcessRun pr = (JDFProcessRun)addAudit(EnumAuditType.ProcessRun, null); pr.setSubmissionTime(new JDFDate()); if (qe != null) { pr.setPartMapVector(qe.getPartMapVector()); pr.copyAttribute(AttributeName.QUEUEENTRYID, qe, null, null, null); if (qe.hasAttribute(AttributeName.SUBMISSIONTIME)) { pr.copyAttribute(AttributeName.SUBMISSIONTIME, qe, null, null, null); } } if (!pr.hasAttribute(AttributeName.SUBMISSIONTIME)) { pr.setSubmissionTime(new JDFDate()); } if (!pr.hasAttribute(AttributeName.QUEUEENTRYID)) { pr.setAttribute("QueueEntryID", "qe_" + JDFElement.uniqueID(0)); } return(pr); }
public virtual void testAudits() { testPlannedWasteICS(); VString vs = new VString("Cover Sheet1 Sheet2", " "); VElement vRL = new VElement(); vRL.Add(rlOut); vRL.Add(rlMediaIn); for (int j = 0; j < 2; j++) { bool bMinimal = j == 0; for (int i = 0; i < vs.Count; i++) { string sheet = vs.stringAt(i); VJDFAttributeMap vmP = new VJDFAttributeMap(); vmP.Add(new JDFAttributeMap(EnumPartIDKey.SheetName, sheet)); StatusCounter stUtil = new StatusCounter(n, vmP, vRL); string refComp = rlOut.getrRef(); string refMedia = rlMediaIn.getrRef(); stUtil.setTrackWaste(refComp, true); stUtil.setTrackWaste(refMedia, true); if (i == 0) { stUtil.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn"); } stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange"); stUtil.addPhase(refMedia, 0, 200, true); stUtil.addPhase(refComp, 0, 200, true); stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange"); if (i >= 1 && !bMinimal) { JDFResourceAudit ra = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult); stUtil.setResourceAudit(refComp, EnumReason.ProcessResult); stUtil.clearAmounts(refMedia); stUtil.addPhase(refMedia, 50, 0, true); JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput); ra2.setRef(ra); ra2.setDescriptiveName("manual reset to using only 50 sheets because 100 initially were wastes"); } stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); stUtil.addPhase(refMedia, 4000, 0, true); stUtil.addPhase(refComp, 4000, 0, true); stUtil.setPhase(EnumNodeStatus.Cleanup, "Washup during processing", EnumDeviceStatus.Cleanup, "Washup"); stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null); stUtil.addPhase(refMedia, 0, i == 0 ? 40 : 30, true); stUtil.addPhase(refComp, 0, i == 0 ? 40 : 30, true); stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); stUtil.addPhase(refMedia, 1000, 0, true); stUtil.addPhase(refComp, 1000, 0, true); stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); stUtil.addPhase(refMedia, i == 0 ? 5200 : 5400, 0, true); stUtil.addPhase(refComp, i == 0 ? 5200 : 5400, 0, true); stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null); JDFResourceAudit ra_1 = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult); if (!bMinimal) { stUtil.setResourceAudit(refComp, EnumReason.ProcessResult); stUtil.clearAmounts(refMedia); // Java to C# Conversion - Don't know the purpose of this unreachable code. Default to the false value since 1 != 0 //stUtil.addPhase(refMedia, 1 == 0 ? 10100 : 10200, 0, true); stUtil.addPhase(refMedia, 10200, 0, true); JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput); ra2.setRef(ra_1); ra2.setDescriptiveName("manual reset to using only 10200 sheets because 100 initially were wates"); } JDFProcessRun pr = stUtil.setProcessResult(EnumNodeStatus.Completed); pr.setDescriptiveName("we even have the utterly useless ProcessRun"); } if (bMinimal) { JDFAuditPool ap = n.getAuditPool(); VElement audits = ap.getAudits(EnumAuditType.PhaseTime, null, null); for (int i = 0; i < audits.Count; i++) { audits.item(i).deleteNode(); } } d.write2File(sm_dirTestDataTemp + "ConvPrintAmount_" + (bMinimal ? "min" : "full") + ".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); }