Esempio n. 1
0
        public virtual void testDirectImage()
        {
            JDFElement.setLongID(false);
            doc  = new JDFDoc("JDF");
            node = doc.getJDFRoot();
            node.setType(EnumType.Combined);
            VString vTypes = new VString("ImageSetting ConventionalPrinting", " ");

            node.setTypes(vTypes);
            nodeInfo = node.appendNodeInfo();
            nodeInfo.setResStatus(EnumResStatus.Available, true);
            JDFRunList rl = (JDFRunList)node.appendMatchingResource(ElementName.RUNLIST, EnumProcessUsage.AnyInput, null);
            JDFByteMap bm = rl.appendByteMap();

            bm.appendFileSpec().setURL("FileInfo:///foo.tif");
            JDFExposedMedia xm = (JDFExposedMedia)node.appendMatchingResource(ElementName.EXPOSEDMEDIA, EnumProcessUsage.Plate, null);

            xm.setDescriptiveName("Real Plate");
            xm.appendMedia();
            JDFExposedMedia xmCyl = (JDFExposedMedia)node.appendMatchingResource(ElementName.EXPOSEDMEDIA, EnumProcessUsage.Cylinder, null);

            xmCyl.setDescriptiveName("Optional cylinder");
            node.linkMatchingResource(xmCyl, EnumProcessUsage.AnyOutput, null);
            Assert.AreEqual(3, node.getResourceLinkPool().numChildElements("ExposedMediaLink", null), "2 for cylinder one for plate");
            doc.write2File(sm_dirTestDataTemp + "webDirect.jdf", 2, false);
        }
Esempio n. 2
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal override JDFNodeInfo initNodeInfo()
        {
            JDFNodeInfo ni = base.initNodeInfo();

            if (theParentNode == null)
            {
                JDFEmployee emp = ni.appendEmployee();
                emp.setPersonalID("personalID1");
                emp.setRoles(new VString("CSR", null));
                if (returnURL != null)
                {
                    ni.setTargetRoute(returnURL);
                }

                if (jmfICSLevel >= 1 && misICSLevel >= 2 || misURL != null)
                {
                    JDFJMF jmf = ni.appendJMF();
                    jmf.setSenderID("MISGTSender");
                    JDFQuery q = jmf.appendQuery(EnumType.Status);
                    q.setID(q.getID() + (System.DateTime.Now.Ticks - 621355968000000000) / 10000 % 100000);

                    //ORIGINAL LINE: final JDFStatusQuParams statusQuParams = q.appendStatusQuParams();
                    JDFStatusQuParams statusQuParams = q.appendStatusQuParams();
                    statusQuParams.setJobID(theNode.getJobID(true));
                    statusQuParams.setJobPartID(theNode.getJobPartID(false));
                    statusQuParams.setJobDetails(EnumJobDetails.Brief);

                    //ORIGINAL LINE: final JDFSubscription subscription = q.appendSubscription();
                    JDFSubscription subscription = q.appendSubscription();
                    subscription.setRepeatTime(600);
                    subscription.setURL(misURL == null ? "http://MIS.printer.com/JMFSignal" : misURL);
                }
            }
            return(ni);
        }
Esempio n. 3
0
        ///
        ///
        protected internal override JDFNodeInfo initNodeInfo()
        {
            base.initNodeInfo();
            JDFNodeInfo ni = theNode.getCreateNodeInfo();

            ni.setStart(null);
            return(ni);
        }
Esempio n. 4
0
 public virtual void tearDown()
 {
     JDFElement.setLongID(true);
     JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_3);
     JDFAudit.setStaticAgentName(agentName);
     JDFAudit.setStaticAgentVersion(agentVersion);
     JDFAudit.setStaticAuthor(author);
     JDFNodeInfo.setDefaultWorkStepID(false);
 }
Esempio n. 5
0
            ///
            ///		 * <param name="node"> the jdf node </param>
            ///		 * <param name="resTarget"> </param>
            ///
            private void fixNodeStatusFromNodeInfo(JDFNode node, JDFResource resTarget)
            {
                EnumNodeStatus nodeStatus = node.getStatus();

                if (!EnumNodeStatus.Part.Equals(nodeStatus) && !EnumNodeStatus.Pool.Equals(node.getStatus()))
                {
                    node.setStatus(EnumNodeStatus.Part);
                    JDFNodeInfo ni = (JDFNodeInfo)resTarget;
                    if (!ni.hasAttribute(AttributeName.NODESTATUS))
                    {
                        ni.setNodeStatus(nodeStatus);
                    }
                }
            }
Esempio n. 6
0
        public virtual void testApplyResourceCmdNodeInfo()
        {
            JDFDoc doc = new JDFDoc(ElementName.JMF);
            JDFJMF jmf = doc.getJMFRoot();

            JDFCommand c = jmf.appendCommand();

            jmf.setSenderID("DeviceSenderID");

            c.setType(EnumType.Resource);
            JDFResourceCmdParams rqp = c.appendResourceCmdParams();

            rqp.setJobID("JobID");
            rqp.setJobPartID("JobPartID");
            rqp.setResourceName(ElementName.NODEINFO);
            rqp.setUsage(EnumUsage.Input);
            JDFNodeInfo niRQP = (JDFNodeInfo)rqp.appendElement(ElementName.NODEINFO);

            JDFAttributeMap sheetMap = new JDFAttributeMap("SheetName", "S1");

            rqp.setPartMap(sheetMap);
            JDFNodeInfo niRQPS1 = (JDFNodeInfo)niRQP.getCreatePartition(sheetMap, null);

            niRQPS1.setNodeStatus(EnumNodeStatus.Aborted);
            JDFDoc  docJDF = new JDFDoc(ElementName.JDF);
            JDFNode jdf    = docJDF.getJDFRoot();

            jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting);
            jdf.setStatus(EnumNodeStatus.Waiting);
            jdf.setJobID("JobID");
            jdf.setJobPartID("JobPartID");

            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getPartStatus(null));
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getStatus());
            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus());
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus());
            Assert.AreEqual(EnumNodeStatus.Aborted, jdf.getPartStatus(sheetMap));

            sheetMap = new JDFAttributeMap("SheetName", "S2");
            rqp.setPartMap(sheetMap);
            niRQPS1.setAttributes(sheetMap);
            niRQPS1.setNodeStatus(EnumNodeStatus.Completed);

            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(EnumNodeStatus.Part, jdf.getStatus());
            Assert.AreEqual(EnumNodeStatus.Waiting, jdf.getNodeInfo().getNodeStatus());
            Assert.AreEqual(EnumNodeStatus.Completed, jdf.getPartStatus(sheetMap));
        }
Esempio n. 7
0
        public virtual void testResourceCommand()
        {
            JDFDoc  jdfDoc = JDFDoc.parseFile(sm_dirTestData + "ResourceCommandTest.jdf");
            JDFNode root   = jdfDoc.getJDFRoot();
            JDFResourceCmdParams @params;

            JDFAttributeMap amAttr = new JDFAttributeMap();

            amAttr.put("Start", "2006-11-02T14:13:18+01:00");
            amAttr.put("End", "2006-11-02T15:13:18+01:00");
            string partID, resID;

            for (int i = 0; i < 2; i++)
            {
                JDFAttributeMap amParts = new JDFAttributeMap();
                if (i == 0)
                {
                    amParts.put("SignatureName", "Sig001");
                    amParts.put("SheetName", "FB 001");
                    amParts.put("Side", "Front");
                    partID = "SFP0.C";
                    resID  = "Link49087948_000508";
                }
                else
                {
                    resID = "Link49165276_000704";
                    amParts.put("SignatureName", "Sig002");
                    amParts.put("SheetName", "FB 002");
                    amParts.put("Side", "Back");
                    partID = "SFP1.C";
                }
                @params = createResourceParams(partID, resID, amParts, amAttr);
                JDFNode n = root.getJobPart(partID, null);
                @params.applyResourceCommand(n);
                Assert.IsNotNull(n);
                JDFNodeInfo ni = (JDFNodeInfo)n.getChildWithAttribute(ElementName.NODEINFO, "ID", null, resID, 0, false);
                Assert.IsNotNull(ni);
                JDFNodeInfo nip = (JDFNodeInfo)ni.getPartition(amParts, null);
                Assert.IsNotNull(nip);
                Assert.IsFalse(nip.hasAttribute_KElement("ID", null, false));
                Assert.IsFalse(nip.hasAttribute_KElement("SheetName", null, false));
            }
        }
Esempio n. 8
0
        ///
        ///	 * <param name="icsLevel"> </param>
        ///
        protected internal virtual JDFNodeInfo initNodeInfo()
        {
            JDFNodeInfo ni = getNIFromParent && theParentNode != null?theParentNode.getNodeInfo() : null;

            if (ni == null)
            {
                ni = theNode.getCreateNodeInfo();
                ni.setResStatus(EnumResStatus.Available, false);
            }
            else
            {
                theNode.linkResource(ni, EnumUsage.Input, null);
            }

            if (returnURL != null)
            {
                ni.setTargetRoute(returnURL);
            }
            return(ni);
        }
Esempio n. 9
0
        ///
        ///	 <summary> * populates this queuentry with the relevant parameters extracted from a JDF jobid, partmap, jobpartid etc.
        ///	 *  </summary>
        ///	 * <param name="jdf"> </param>
        ///
        public virtual void setFromJDF(JDFNode jdf)
        {
            if (jdf == null)
            {
                return;
            }
            setJobID(jdf.getJobID(true));
            setJobPartID(jdf.getJobPartID(false));
            setPartMapVector(jdf.getPartMapVector());

            if (!hasAttribute(AttributeName.PRIORITY))
            {
                JDFNodeInfo ni = jdf.getInheritedNodeInfo("@" + AttributeName.PRIORITY);
                if (ni != null)
                {
                    copyAttribute(AttributeName.PRIORITY, ni, null, null, null);
                }
            }

            this.eraseEmptyAttributes(true);
        }
Esempio n. 10
0
        ///
        ///	 <summary> * schedule this node the nodeinfo will be modified </summary>
        ///
        public virtual void schedule(VJDFAttributeMap nodesToCombine, int starthours, int durationhours)
        {
            VJDFAttributeMap nodesToCombineLocal = nodesToCombine;

            theNode.setPartStatus(nodesToCombineLocal, EnumNodeStatus.Waiting, null);
            JDFNodeInfo ni = theNode.getNodeInfo();

            if (nodesToCombineLocal == null)
            {
                nodesToCombineLocal = new VJDFAttributeMap();
                nodesToCombineLocal.Add(null);
            }
            for (int i = 0; i < nodesToCombineLocal.Count; i++)
            {
                JDFNodeInfo nip = (JDFNodeInfo)ni.getCreatePartition(nodesToCombineLocal[i], null);
                JDFDate     d   = new JDFDate();
                d.addOffset(0, 0, starthours, 0);
                nip.setStart(d);
                d.addOffset(0, 0, durationhours, 0);
                nip.setEnd(d);
            }
        }
Esempio n. 11
0
        ///
        ///	 * <param name="icsLevel">
        ///	 * @return </param>
        ///
        protected internal override JDFNodeInfo initNodeInfo()
        {
            JDFNodeInfo ni = base.initNodeInfo();

            if (vParts != null)
            {
                VJDFAttributeMap reducedMap = new VJDFAttributeMap(vParts);
                VString          reduceKeys = new VString(partIDKeys);
                // simplex and perfecting are one run only
                if (EnumWorkStyle.Simplex.Equals(workStyle) || EnumWorkStyle.Perfecting.Equals(workStyle))
                {
                    reduceKeys.Remove(AttributeName.SIDE);
                }
                reducedMap.reduceMap(reduceKeys.getSet());
                theNode.setPartStatus(reducedMap, EnumNodeStatus.Waiting, null);
                for (int i = 0; i < reducedMap.Count; i++)
                {
                    JDFAttributeMap part   = reducedMap[i];
                    JDFNodeInfo     niPart = (JDFNodeInfo)ni.getCreatePartition(part, partIDKeys);
                    niPart.setDescriptiveName("Printing for" + part.ToString());
                }
            }
            return(ni);
        }
Esempio n. 12
0
        ///
        ///	 <summary> * Copy all data from parentNode into the ancestor elements of this
        ///	 *  </summary>
        ///	 * <param name="parentNode"> the closest parent Node that contains the information to be copied </param>
        ///	 * <param name="bCopyNodeInfo"> if true, also copy the NodeInfo into the ancestor </param>
        ///	 * <param name="bCopyCustomerInfo"> if true, also copy the CustomerInfo into the ancestor </param>
        ///	 * <param name="bCopyComments"> if true, also copy the comments into the ancestor
        ///	 * @default copyNodeData(parentNode, false, false, false); </param>
        ///
        public virtual void copyNodeData(JDFNode parentNode, bool bCopyNodeInfo, bool bCopyCustomerInfo, bool bCopyComments)
        {
            VElement vAncestors = getPoolChildren(null);
            JDFNode  node       = parentNode;

            JDFNode thisParentNode = getParentJDF();

            int i;

            for (i = vAncestors.Count - 1; i >= 0; i--)
            {
                JDFAncestor ancestor = (JDFAncestor)vAncestors[i];
                if (!node.getID().Equals(ancestor.getNodeID()))
                {
                    throw new JDFException("JDFAncestorPool::CopyNodeData: Invalid pairing");
                }

                ancestor.setAttributes(node);
                ancestor.removeAttribute(AttributeName.XSITYPE);
                ancestor.renameAttribute(AttributeName.ID, AttributeName.NODEID, null, null);
                // only copy nodeinfo and customerinfo in real parent nodes, not in
                // this of partitioned spawns
                if (!thisParentNode.getID().Equals(node.getID()))
                {
                    if (bCopyNodeInfo)
                    {
                        JDFNodeInfo nodeInfo = node.getNodeInfo();
                        if (nodeInfo != null)
                        {
                            if (nodeInfo.getParentNode_KElement() is JDFResourcePool)
                            {
                                // add a low level refelement, the copying takes
                                // place inaddspawnedresources
                                JDFRefElement re = (JDFRefElement)ancestor.appendElement(ElementName.NODEINFO + JDFConstants.REF);
                                re.setrRef(nodeInfo.getID());
                                re.setPartMap(nodeInfo.getPartMap());
                            }
                            else
                            {
                                ancestor.copyElement(nodeInfo, null);
                            }
                        }
                    }

                    if (bCopyCustomerInfo)
                    {
                        JDFCustomerInfo customerInfo = node.getCustomerInfo();
                        if (customerInfo != null)
                        {
                            if (customerInfo.getParentNode_KElement() is JDFResourcePool)
                            {
                                // add a low level refelement, the copying takes
                                // place inaddspawnedresources
                                JDFRefElement re = (JDFRefElement)ancestor.appendElement(ElementName.CUSTOMERINFO + JDFConstants.REF);
                                re.setrRef(customerInfo.getID());
                                re.setPartMap(customerInfo.getPartMap());
                            }
                            else
                            {
                                ancestor.copyElement(customerInfo, null);
                            }
                        }
                    }

                    if (bCopyComments)
                    {
                        VElement v = node.getChildElementVector(ElementName.COMMENT, null, null, true, 0, false);
                        for (int j = 0; j < v.Count; j++)
                        {
                            ancestor.copyElement(v[j], null);
                        }
                    }
                }

                JDFNode node2 = node.getParentJDF();

                // 100602 RP added i--
                if (node2 == null)
                {
                    i--;
                    break;
                }
                node = node2;
            }

            // the original node was already spawned --> also copy the elements of
            // the original nodes Ancestorpool
            if (i >= 0)
            {
                VElement parentAncestors    = node.getAncestorPool().getPoolChildren(null);
                int      parentAncestorSize = parentAncestors.Count;
                if (parentAncestorSize < i + 1)
                {
                    throw new JDFException("JDFAncestorPool.CopyNodeData: Invalid AncestorPool pairing");
                }

                // now copy the ancestorpool elements that have not yet been added
                // from the original nodes
                for (; i >= 0; i--)
                {
                    JDFAncestor ancestor       = (JDFAncestor)vAncestors[i];
                    JDFAncestor parentAncestor = (JDFAncestor)parentAncestors[i];
                    ancestor.mergeElement(parentAncestor, false);
                }
            }
        }
Esempio n. 13
0
        protected internal static JDFDoc creatXMDoc()
        {
            JDFElement.setDefaultJDFVersion(EnumVersion.Version_1_3);
            JDFDoc  doc = new JDFDoc("JDF");
            JDFNode n   = doc.getJDFRoot();

            n.setJobPartID("P1");
            n.setJobID("J1");
            n.setType("ConventionalPrinting", true);
            n.appendElement("NS:Foobar", "www.foobar.com");

            n.appendMatchingResource("Layout", JDFNode.EnumProcessUsage.AnyInput, null);
            JDFComponent    comp = (JDFComponent)n.appendMatchingResource("Component", JDFNode.EnumProcessUsage.AnyOutput, null);
            JDFExposedMedia xm   = (JDFExposedMedia)n.appendMatchingResource("ExposedMedia", JDFNode.EnumProcessUsage.Plate, null);
            JDFNodeInfo     ni   = n.appendNodeInfo();
            JDFMedia        m    = xm.appendMedia();

            m.appendElement("NS:FoobarMedia", "www.foobar.com");

            Assert.AreEqual(EnumResourceClass.Consumable, m.getResourceClass(), "m Class");

            VString vs = new VString();

            vs.Add("SignatureName");
            vs.Add("SheetName");
            vs.Add("Side");

            JDFAttributeMap mPart1 = new JDFAttributeMap("SignatureName", "Sig1");

            mPart1.put("SheetName", "S1");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SheetName", "S2");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SignatureName", "Sig2");
            mPart1.put("SheetName", "S1");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);
            comp.appendElement("foo:bar", "www.foobar.com");

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("SheetName", "S2");
            mPart1.put("Side", "Front");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);

            mPart1.put("Side", "Back");
            xm.getCreatePartition(mPart1, vs);
            ni.getCreatePartition(mPart1, vs);
            comp.getCreatePartition(mPart1, vs);
            return(doc);
        }