Beispiel #1
0
        private JDFResourceCmdParams createResourceParams(string strJobPartID, string strResourceID, JDFAttributeMap amParts, JDFAttributeMap amAttr)
        {
            JDFJMF jmf = JDFJMF.createJMF(EnumFamily.Command, JDFMessage.EnumType.Resource);

            JDFCommand cmd = jmf.getCommand(0);

            JDFResourceCmdParams @params = cmd.appendResourceCmdParams();

            const string strJobID      = "RefJob-1";
            const string strPartIDKeys = "SignatureName SheetName Side";

            @params.setJobID(strJobID);
            @params.setJobPartID(strJobPartID);
            @params.setResourceID(strResourceID);
            @params.setResourceName("NodeInfo");
            @params.setUpdateMethod(EnumUpdateMethod.Incremental);

            @params.setPartMap(amParts);

            JDFResource nodeInfo = @params.appendResource("NodeInfo");

            JDFResource resLeaf = nodeInfo.getCreatePartition(amParts, new VString(strPartIDKeys, null));

            resLeaf.setAttributes(amAttr);

            return(@params);
        }
Beispiel #2
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));
        }
Beispiel #3
0
        public virtual void testApplyResourceCmd()
        {
            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("Media");
            JDFMedia mediaRQP = (JDFMedia)rqp.appendElement("Media");

            mediaRQP.setDimension(new JDFXYPair(20, 30));

            JDFDoc  docJDF = new JDFDoc(ElementName.JDF);
            JDFNode jdf    = docJDF.getJDFRoot();

            jdf.setType(org.cip4.jdflib.node.JDFNode.EnumType.ConventionalPrinting);
            JDFMedia mediaJDF = (JDFMedia)jdf.addResource("Media", null, EnumUsage.Input, null, null, null, null);

            mediaJDF.setDimension(new JDFXYPair(40, 60));
            rqp.setJobID(jdf.getJobID(true));
            rqp.setJobPartID(jdf.getJobPartID(true));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2 = (JDFMedia)jdf.getMatchingResource("Media", EnumProcessUsage.AnyInput, null, 0);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension());

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

            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(200, 300));

            JDFMedia m2Sheet = (JDFMedia)m2.addPartition(EnumPartIDKey.SheetName, "S1");

            rqp.applyResourceCommand(jdf);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(200, 300), m2Sheet.getDimension(), "overwrote leaf root dimension");

            sheetMap.put(EnumPartIDKey.SheetName, "S2");
            rqp.setPartMap(sheetMap);
            mediaRQP.setDimension(new JDFXYPair(300, 400));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet2 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.IsNotNull(m2Sheet2);
            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(300, 400), m2Sheet2.getDimension(), "overwrote leaf root dimension");

            JDFMedia mPartRQP = (JDFMedia)mediaRQP.addPartition(EnumPartIDKey.SheetName, "S3");

            sheetMap.put(EnumPartIDKey.SheetName, "S3");
            rqp.setPartMap(sheetMap);
            mPartRQP.setDimension(new JDFXYPair(400, 600));

            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet3 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.AreEqual(new JDFXYPair(400, 600), m2Sheet3.getDimension(), "overwrote leaf root dimension");
            Assert.IsFalse(m2Sheet3.hasAttribute_KElement("ID", null, false));

            mPartRQP.setAttribute(AttributeName.DIMENSION, "");
            mediaRQP.removeAttribute(AttributeName.DIMENSION);
            rqp.applyResourceCommand(jdf);
            JDFMedia m2Sheet4 = (JDFMedia)m2.getPartition(sheetMap, null);

            Assert.AreEqual(new JDFXYPair(20, 30), m2.getDimension(), "retained root dimension");
            Assert.IsFalse(m2Sheet4.hasAttribute_KElement(AttributeName.DIMENSION, null, false), "removed leaf dimension");
        }