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); }
public override void setUp() { base.setUp(); JDFElement.setLongID(false); d = new JDFDoc("JDF"); n = d.getJDFRoot(); n.appendXMLComment("Example to illustrate JDF 1.3 Base and MIS compatible amount handling", null); n.setType(EnumType.Combined); inMedia = (JDFMedia)n.addResource(ElementName.MEDIA, null, EnumUsage.Input, null, null, null, null); outXM = (JDFExposedMedia)n.addResource(ElementName.EXPOSEDMEDIA, EnumUsage.Output); outXM.refMedia(inMedia); n.addTypes(EnumType.Interpreting); n.addTypes(EnumType.Rendering); n.addTypes(EnumType.ImageSetting); n.setJobID("RIP-job"); rlXMOut = n.getLink(outXM, null); rlMediaIn = n.getLink(inMedia, null); inMedia.setProductID("Media-ProductID"); inMedia.setMediaType(EnumMediaType.Plate); inMedia.setMediaTypeDetails("Aluminum"); vRL = new VElement(); vRL.Add(rlMediaIn); vRL.Add(rlXMOut); JDFExposedMedia xmPart = (JDFExposedMedia)outXM.addPartition(EnumPartIDKey.SignatureName, "Sig1"); vsSheet = new VString("Cover Sheet1 Sheet2", " "); vsCMYK = new VString("Cyan Magenta Yellow Black Spot1", " "); VElement v = xmPart.addPartitions(EnumPartIDKey.SheetName, vsSheet); for (int i = 0; i < v.Count; i++) { JDFResource xmPart2 = (JDFResource)v[i]; xmPart2.getCreatePartition(EnumPartIDKey.Side, "Front", null).addPartitions(EnumPartIDKey.Separation, vsCMYK); // xmPart2.getCreatePartition(EnumPartIDKey.Side,"Back",null). // addPartitions(EnumPartIDKey.Separation, vsCMYK); } statCounter = new StatusCounter(n, null, vRL); statCounter.setDeviceID("Rip-DeviceID"); statCounter.setCopyResInResInfo(rlMediaIn.getrRef(), true); }
/// /// <summary> * apply the parameters in this to all appropriate resources in parentNode or one of parentNode's children /// * </summary> /// * <param name="parentNode"> the node to search in </param> /// internal virtual void applyResourceCommand(JDFNode parentNode) { if (parentNode == null) { return; } VElement vNodes = parentNode.getvJDFNode(null, null, false); int size = vNodes.Count; for (int i = 0; i < size; i++) { JDFNode node = (JDFNode)vNodes[i]; if (!matchesNode(node)) { continue; } JDFResource resCmd = enclosingInstance.getResource(null); if (resCmd == null) { continue; } bool isIncremental = (enclosingInstance.getUpdateMethod() == EnumUpdateMethod.Incremental); // commented out, statements have no effect // double dAmount = -1.0; // if (hasAttribute (AttributeName.PRODUCTIONAMOUNT)) // { // dAmount = getProductionAmount (); // TODO: set ProductionAmount // } // final String strProcessUsage = getProcessUsage(); // TODO: use // ProcessUsage // final JDFElement.EnumNodeStatus status = getStatus(); // TODO: // set Status VJDFAttributeMap vamParts = enclosingInstance.getPartMapVector(); JDFResource resTarget = getTargetResource(node); if (resTarget == null) { resTarget = createNewResource(node, resCmd); if (resTarget == null) { continue; } } // get the most granular list of partIDKeys from the cmd or resource VString vsPartIDKeys = resTarget.getPartIDKeys(); VString vsPartIDKeysCmd = resCmd.getPartIDKeys(); int sizTarget = vsPartIDKeys == null ? 0 : vsPartIDKeys.Count; int sizCmd = vsPartIDKeysCmd == null ? 0 : vsPartIDKeysCmd.Count; if (sizCmd > sizTarget) { vsPartIDKeys = vsPartIDKeysCmd; } int sizeParts = vamParts == null ? 1 : vamParts.Count; for (int j = 0; j < sizeParts; j++) { JDFAttributeMap amParts = vamParts == null ? null : vamParts[j]; JDFResource resTargetPart = resTarget.getCreatePartition(amParts, vsPartIDKeys); if (resTargetPart == null) { continue; } string id = resTargetPart.getID(); if (!isIncremental) { JDFAttributeMap map = resTargetPart.getPartMap(); resTargetPart.flush(); resTargetPart.setAttributes(map); } JDFResource resCmdPart = resCmd.getPartition(amParts, EnumPartUsage.Implicit); JDFAttributeMap map2 = resCmdPart.getAttributeMap(); VString keys = map2.getKeys(); if (keys != null) { int keySize = keys.Count; for (int k = 0; k < keySize; k++) { string key = keys[k]; string @value = map2.get(key); if (@value == null || JDFConstants.EMPTYSTRING.Equals(@value)) { resCmdPart.removeAttribute(key); resTargetPart.removeAttribute(key); } } } resTargetPart.mergeElement(resCmdPart, false); resTarget.setID(id); } if (sizeParts > 0 && resTarget is JDFNodeInfo) { fixNodeStatusFromNodeInfo(node, resTarget); } } }
/// /// <summary> * append elements to the node that match this DevCap, if they do not exist /// * yet /// * </summary> /// * <param name="node"> /// * the node to append the elements to </param> /// * <param name="bAll"> /// * if false, only add if minOccurs>=1 and required=true or a /// * default exists /// * </param> /// * <returns> KElement - the last element that was appended </returns> /// public virtual KElement appendMatchingElementsToNode(JDFNode node, bool bAll, org.cip4.jdflib.util.VectorMap <int, JDFResource> indexResMap, bool bLink) { KElement e = null; EnumContext context = getContext(); if (!bLink && EnumContext.Link.Equals(context)) { return(null); } if (bLink && !EnumContext.Link.Equals(context)) { return(null); } JDFDevCap devCap = getDevCap(); if (devCap == null) { return(null); } int minOcc = devCap.getMinOccurs(); if (minOcc == 0 && bAll) { minOcc = 1; } string nam = getName(); for (int i = 0; i < minOcc; i++) { if (context.Equals(EnumContext.Element)) { // vElem - for a common return type in all cases if (nam.Equals(ElementName.JDF)) { // nop - should actually never get here } else { e = node.getCreateElement(nam, getDevNS(), i); } } else if (context.Equals(EnumContext.Resource) || context.Equals(EnumContext.Link)) { EnumUsage linkUsage = getLinkUsage(); string procUsage = getProcessUsage(); JDFAttributeMap map = new JDFAttributeMap(); EnumProcessUsage pu = null; if (procUsage != null && procUsage.Length > 0) { map.put(AttributeName.PROCESSUSAGE, procUsage); pu = EnumProcessUsage.getEnum(procUsage); } if (linkUsage != null) { map.put(AttributeName.USAGE, linkUsage.getName()); } VElement links = node.getResourceLinks(nam, map, null); // now look for the correct combinedprocessindex - remove all // non-matching JDFIntegerRangeList tocNum = getTypeOccurrenceNum(); JDFIntegerList tocNum2 = tocNum == null ? null : tocNum.getIntegerList(); if (links != null && tocNum != null) { for (int ll = links.Count - 1; ll >= 0; ll--) { JDFResourceLink rl = (JDFResourceLink)links[ll]; JDFIntegerList il = rl.getCombinedProcessIndex(); if (il == null || !il.Contains(tocNum2)) { links.RemoveAt(ll); } } } if (links == null || links.Count <= i) { JDFResource r = null; // get a link hook for the matching combinedprocessindex if (bLink) { int kk = (tocNum2 == null || tocNum2.Count == 0) ? -1 : tocNum2.getInt(0); if (EnumUsage.Input.Equals(linkUsage)) { kk--; } List <JDFResource> v = null; indexResMap.TryGetValue(kk, out v); if (v != null) { int sv = v.Count; for (int kkk = 0; kkk < sv; kkk++) { JDFResource rr = v[kkk]; if (rr.LocalName.Equals(nam)) { r = rr; break; } } } } // we found no matching existing res - make a new one if (r == null) { r = node.addResource(nam, null, linkUsage, pu, null, getDevNS(), null); string id = devCap.getAttribute(AttributeName.ID, null, null); if (id != null) { JDFResourceLink rl = node.getLink(r, linkUsage); r.setID(id); if (rl != null) { rl.setrRef(id); } } if (tocNum2 == null || tocNum2.Count == 0) { indexResMap.putOne(-1, r); //(new int(-1), r); } else { indexResMap.putOne((int)tocNum2.elementAt(0), r); // only } // support // 1 // now } else // preexisting resource - just link it { e = node.linkResource(r, linkUsage, pu); } e = node.getLink(r, linkUsage); if (e != null) { JDFResourceLink rl = (JDFResourceLink)e; rl.setCombinedProcessIndex(tocNum2); } // update partititons JDFEnumerationState pidKeys = devCap.getEnumerationState(AttributeName.PARTIDKEYS); if (pidKeys != null) { VString keys = pidKeys.getAllowedValueList(); if (keys != null && keys.Count > 0) { JDFAttributeMap keyMap = new JDFAttributeMap(); for (int k = 0; k < keys.Count; k++) { string sk = "PartKey" + k; string key = keys.stringAt(k); if (key.Equals("RunIndex")) { sk = "0~-1"; } keyMap.put(key, sk); } r.getCreatePartition(keyMap, keys); } } } } else if (context.Equals(EnumContext.JMF)) { // TODO __Lena__ ... } } return(e); }
/// /// * <param name="icsLevel"> </param> /// protected internal virtual void initPlateXM(EnumUsage usage) { JDFResourceLink rl = null; if (thePreviousNode != null) // either input (for cp, or output for // plateset) { rl = theNode.linkResource(thePreviousNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null); } if (rl == null && theParentNode != null) { rl = theNode.ensureLink(theParentNode.getResource(ElementName.EXPOSEDMEDIA, null, 0), usage, null); } JDFExposedMedia xm = (JDFExposedMedia)theNode.getCreateResource(ElementName.EXPOSEDMEDIA, usage, 0); xm.setPartUsage(EnumPartUsage.Explicit); rl = theNode.getLink(xm, null); JDFMedia m = ((JDFExposedMedia)xm.getLeaves(false)[0]).getMedia(); if (m == null) { m = initPlateMedia(); } else { m = (JDFMedia)m.getResourceRoot(); if (theParentNode != null) { theNode.ensureLink(theParentNode.getResource("Media", EnumUsage.Input, 0), EnumUsage.Input, null); } } xm.setResStatus(EnumResStatus.Unavailable, false); if (!bPartitionedPlateMedia && xm.getMedia() == null) { xm.refElement(m); } if (EnumUsage.Input.Equals(usage)) { rl.setProcessUsage(EnumProcessUsage.Plate); JDFResourceLink link = theNode.getLink(m, null); if (link != null) { link.deleteNode(); } } if (vParts != null) { for (int i = 0; i < vParts.Count; i++) { JDFAttributeMap part = new JDFAttributeMap(vParts[i]); JDFResource xmp = xm.getCreatePartition(part, partIDKeys); int ncols = "Front".Equals(part.get("Side")) ? nCols[0] : nCols[1]; for (int j = 0; j < ncols; j++) { part.put(EnumPartIDKey.Separation, cols.stringAt(j)); xmp.getCreatePartition(part, partIDKeys); } } if (bPartitionedPlateMedia) { VJDFAttributeMap vSheets = getReducedMap(new VString("Side Separation PartVersion", null)); for (int i = 0; i < vSheets.Count; i++) { JDFAttributeMap part = new JDFAttributeMap(vSheets[i]); JDFExposedMedia xmp = (JDFExposedMedia)xm.getCreatePartition(part, partIDKeys); if (xmp.getMedia() == null) { xmp.refMedia((JDFMedia)m.getCreatePartition(part, null)); } } } } }