/// /// <summary> * add a queueentry to a queue based on the parameters of this you can get the new queueentry by {@link} /// * getQueueEntry(0) on the response /// * </summary> /// * <param name="theQueue"> the queue to submit to, note that the queue IS modified by this call </param> /// * <param name="responseIn"> the jmf that serves as a container for the new response /// * </param> /// * <returns> the response jmf to the submission message </returns> /// public virtual JDFResponse addEntry(JDFQueue theQueue, JDFJMF responseIn) { JDFCommand command = (JDFCommand)getParentNode_KElement(); JDFJMF jmf = command.createResponse(); JDFResponse resp = jmf.getResponse(0); if (responseIn != null) { resp = (JDFResponse)responseIn.copyElement(resp, null); } if (theQueue == null) { resp.setErrorText("No Queue specified"); resp.setReturnCode(2); return(resp); } if (!theQueue.canAccept()) { resp.setReturnCode(112); resp.copyElement(theQueue, null); return(resp); } JDFQueueEntry qe = theQueue.createQueueEntry(getHold()); string[] copyAtts = new string[] { AttributeName.GANGNAME, AttributeName.GANGPOLICY }; for (int i = 0; i < copyAtts.Length; i++) { if (hasAttribute(copyAtts[i])) { qe.copyAttribute(copyAtts[i], this, null, null, null); } } // TODO more attributes e.g prev. next... if (hasAttribute(AttributeName.PRIORITY)) { qe.setPriority(getPriority()); // calls the automated function, } // therfore not in the list above resp.copyElement(theQueue, null); resp.copyElement(qe, null); return(resp); }
public virtual void testCreateResponse() { JDFDoc doc = new JDFDoc(ElementName.JMF); JDFJMF jmf = doc.getJMFRoot(); JDFCommand command = (JDFCommand)jmf.appendMessageElement(EnumFamily.Command,EnumType.UpdateJDF); Assert.AreEqual("CommandUpdateJDF",command.getXSIType()); command.setType("foo:bar"); Assert.IsNull(command.getXSIType()); Assert.AreEqual("foo:bar",command.getType()); JDFJMF resp = command.createResponse(); JDFResponse response = resp.getResponse(0); Assert.AreEqual(resp.getMessageElement(null,null,0),response); Assert.AreEqual("foo:bar",response.getType()); Assert.AreEqual(command.getID(),response.getrefID()); }