List of usage examples for org.jdom2 Element getChildText
public String getChildText(final String cname)
From source file:org.yawlfoundation.yawl.elements.YAWLServiceReference.java
License:Open Source License
/** * Returns a YAWL service from XML (if valid). * @param serialisedService//from w ww . j a v a2 s. com * @return an instantiated YAWL Service, or null if the XML was invalid */ public static YAWLServiceReference unmarshal(String serialisedService) { YAWLServiceReference service = null; Element serviceElem = JDOMUtil.stringToElement(serialisedService); if (serviceElem != null) { String uri = serviceElem.getAttributeValue("id"); String name = serviceElem.getChildText("servicename"); String password = serviceElem.getChildText("servicepassword"); String docStr = serviceElem.getChildText("documentation"); String assignable = serviceElem.getChildText("assignable"); service = new YAWLServiceReference(uri, null, name, password); service.setDocumentation(docStr); if (assignable != null) service.setAssignable(assignable.equalsIgnoreCase("true")); } return service; }
From source file:org.yawlfoundation.yawl.engine.instance.CaseInstance.java
License:Open Source License
public void fromXML(Element instance) { if (instance != null) { caseID = instance.getChildText("caseid"); String startStr = instance.getChildText("starttime"); if (startStr != null) startTime = new Long(startStr); String params = instance.getChildText("caseparams"); if (params != null) caseParams = JDOMUtil.decodeEscapes(params); String specIdentifier = instance.getChildText("specidentifier"); String specVersion = instance.getChildText("specversion"); String specURI = instance.getChildText("specuri"); specID = new YSpecificationID(specIdentifier, specVersion, specURI); Element logDataElem = instance.getChild("logdataitemlist"); if (logDataElem != null) { logData = new YLogDataItemList(logDataElem); }// w w w.ja va 2s . co m } }
From source file:org.yawlfoundation.yawl.engine.instance.ParameterInstance.java
License:Open Source License
public void fromXML(Element instance) { if (instance != null) { name = instance.getChildText("name"); dataType = instance.getChildText("dataType"); dataSchema = instance.getChildText("dataSchema"); setUsage(instance.getChildText("usage")); inputPredicate = instance.getChildText("inputPredicate"); outputPredicate = instance.getChildText("outputPredicate"); originalValue = instance.getChildText("originalValue"); defaultValue = instance.getChildText("defaultValue"); value = instance.getChildText("value"); }//from ww w. j a v a 2 s.co m }
From source file:org.yawlfoundation.yawl.engine.instance.WorkItemInstance.java
License:Open Source License
public void fromXML(Element instance) { if (instance != null) { id = instance.getChildText("id"); taskID = instance.getChildText("taskid"); taskName = instance.getChildText("taskname"); caseID = instance.getChildText("caseid"); status = instance.getChildText("status"); resourceName = instance.getChildText("resource"); timerStatus = instance.getChildText("timerStatus"); enabledTime = strToLong(instance.getChildText("enabledtime")); startTime = strToLong(instance.getChildText("starttime")); completionTime = strToLong(instance.getChildText("completiontime")); timerExpiry = strToLong(instance.getChildText("timerexpiry")); }// w ww . j a v a2 s . c o m }
From source file:org.yawlfoundation.yawl.engine.interfce.Marshaller.java
License:Open Source License
public static TaskInformation unmarshalTaskInformation(String taskInfoAsXML) { YParametersSchema paramsForTaskNCase = new YParametersSchema(); YAttributeMap attributemap = new YAttributeMap(); Element taskInfo = JDOMUtil.stringToElement(taskInfoAsXML); // if the string was encased in response tags, go down one level if (taskInfoAsXML.startsWith("<response>")) { taskInfo = taskInfo.getChild("taskInfo"); }/*from w ww. j ava 2s .c om*/ String taskID = taskInfo.getChildText("taskID"); String taskName = taskInfo.getChildText("taskName"); String taskDocumentation = taskInfo.getChildText("taskDocumentation"); String decompositionID = taskInfo.getChildText("decompositionID"); Element yawlService = taskInfo.getChild("yawlService"); Element specElem = taskInfo.getChild("specification"); String specIdentifier = specElem.getChildText("identifier"); String specVersion = specElem.getChildText("version"); String specURI = specElem.getChildText("uri"); YSpecificationID specificationID = new YSpecificationID(specIdentifier, specVersion, specURI); Element attributes = taskInfo.getChild("attributes"); if (attributes != null) { for (Element attribute : attributes.getChildren()) { attributemap.put(attribute.getName(), attributes.getChildText(attribute.getName())); } } Element params = taskInfo.getChild("params"); for (Element paramElem : params.getChildren()) { if ("formalInputParam".equals(paramElem.getName())) { paramsForTaskNCase.setFormalInputParam(paramElem.getText()); continue; } YParameter param = new YParameter(null, paramElem.getName()); YDecompositionParser.parseParameter(paramElem, param, null, false); if (param.isInput()) { paramsForTaskNCase.setInputParam(param); } else { paramsForTaskNCase.setOutputParam(param); } String paramOrdering = paramElem.getChildText("ordering"); if (paramOrdering != null) { int order = Integer.parseInt(paramOrdering); param.setOrdering(order); } } TaskInformation taskInformation = new TaskInformation(paramsForTaskNCase, taskID, specificationID, taskName, taskDocumentation, decompositionID); taskInformation.setAttributes(attributemap); return taskInformation; }
From source file:org.yawlfoundation.yawl.engine.interfce.Marshaller.java
License:Open Source License
/** * Creates a list of SpecificationDatas from formatted XML. * These are brief meta data summary//w w w . j a v a 2 s . c o m * information objects that describe a workflow specification. * @param specificationSummaryListXML * @return the list */ public static List<SpecificationData> unmarshalSpecificationSummary(String specificationSummaryListXML) { List<SpecificationData> specSummaryList = new ArrayList<SpecificationData>(); Element specElem = JDOMUtil.stringToElement(specificationSummaryListXML); for (Element specElement : specElem.getChildren()) { String specID = specElement.getChildText("id"); String specURI = specElement.getChildText("uri"); String specName = specElement.getChildText("name"); String specDoco = specElement.getChildText("documentation"); String specStatus = specElement.getChildText("status"); String version = specElement.getChildText("version"); String rootNetID = specElement.getChildText("rootNetID"); String specVersion = specElement.getChildText("specversion"); String dataGateway = specElement.getChildText("externalDataGateway"); if (specURI != null && specStatus != null) { YSpecificationID ySpecID = new YSpecificationID(specID, specVersion, specURI); SpecificationData specData = new SpecificationData(ySpecID, specName, specDoco, specStatus, YSchemaVersion.fromString(version)); specData.setRootNetID(rootNetID); specData.setExternalDataGateway(dataGateway); specSummaryList.add(specData); Element inputParams = specElement.getChild("params"); if (inputParams != null) { for (Element paramElem : inputParams.getChildren()) { YParameter param = new YParameter(null, YParameter._INPUT_PARAM_TYPE); YDecompositionParser.parseParameter(paramElem, param, null, false);//todo check correctness specData.addInputParam(param); } } specData.setMetaTitle(specElement.getChildText("metaTitle")); Element authors = specElement.getChild("authors"); if (authors != null) { for (Element authorElem : authors.getChildren()) { specData.setAuthors(authorElem.getText()); } } } } return specSummaryList; }
From source file:org.yawlfoundation.yawl.engine.interfce.Marshaller.java
License:Open Source License
public static WorkItemRecord unmarshalWorkItem(Element workItemElement) { if (workItemElement == null) return null; WorkItemRecord wir;/* w w w . j ava2 s. c o m*/ String status = workItemElement.getChildText("status"); String caseID = workItemElement.getChildText("caseid"); String taskID = workItemElement.getChildText("taskid"); String specURI = workItemElement.getChildText("specuri"); String enablementTime = workItemElement.getChildText("enablementTime"); if (caseID != null && taskID != null && specURI != null && enablementTime != null && status != null) { wir = new WorkItemRecord(caseID, taskID, specURI, enablementTime, status); wir.setExtendedAttributes(unmarshalWorkItemAttributes(workItemElement)); wir.setUniqueID(workItemElement.getChildText("uniqueid")); wir.setTaskName(workItemElement.getChildText("taskname")); wir.setDocumentation(workItemElement.getChildText("documentation")); wir.setAllowsDynamicCreation(workItemElement.getChildText("allowsdynamiccreation")); wir.setRequiresManualResourcing(workItemElement.getChildText("requiresmanualresourcing")); wir.setCodelet(workItemElement.getChildText("codelet")); wir.setDeferredChoiceGroupID(workItemElement.getChildText("deferredChoiceGroupID")); wir.setSpecVersion(workItemElement.getChildText("specversion")); wir.setFiringTime(workItemElement.getChildText("firingTime")); wir.setStartTime(workItemElement.getChildText("startTime")); wir.setCompletionTimeMs(workItemElement.getChildText("completionTime")); wir.setEnablementTimeMs(workItemElement.getChildText("enablementTimeMs")); wir.setFiringTimeMs(workItemElement.getChildText("firingTimeMs")); wir.setStartTimeMs(workItemElement.getChildText("startTimeMs")); wir.setCompletionTimeMs(workItemElement.getChildText("completionTimeMs")); wir.setTimerTrigger(workItemElement.getChildText("timertrigger")); wir.setTimerExpiry(workItemElement.getChildText("timerexpiry")); wir.setStartedBy(workItemElement.getChildText("startedBy")); wir.setTag(workItemElement.getChildText("tag")); wir.setCustomFormURL(workItemElement.getChildText("customform")); String specid = workItemElement.getChildText("specidentifier"); if (specid != null) wir.setSpecIdentifier(specid); String resStatus = workItemElement.getChildText("resourceStatus"); if (resStatus != null) wir.setResourceStatus(resStatus); Element data = workItemElement.getChild("data"); if ((null != data) && (data.getContentSize() > 0)) wir.setDataList((Element) data.getContent(0)); Element updateddata = workItemElement.getChild("updateddata"); if ((null != updateddata) && (updateddata.getContentSize() > 0)) wir.setUpdatedData((Element) updateddata.getContent(0)); Element logPredicate = workItemElement.getChild("logPredicate"); if (logPredicate != null) { wir.setLogPredicateStarted(logPredicate.getChildText("start")); wir.setLogPredicateCompletion(logPredicate.getChildText("completion")); } return wir; } throw new IllegalArgumentException("Input element could not be parsed."); }
From source file:org.yawlfoundation.yawl.exceptions.YDataStateException.java
License:Open Source License
public static YDataStateException unmarshall(Document exceptionDoc) { Element root = exceptionDoc.getRootElement(); String queryString = root.getChildText(QUERYSTRING_NM); Element queriedData = root.getChild(QUERIEDDATA_NM); Element schema = root.getChild(SCHEMA_NM); Element dataInput = root.getChild(DATAINPUT_NM); String xercesErrors = root.getChildText(XERCESERRORS_NM); String source = root.getChildText(SOURCE_NM); String message = parseMessage(exceptionDoc); if (queryString == null) { return new YDataValidationException(_out.outputString(schema), dataInput, xercesErrors, source, message);//from ww w .j a v a 2s.c o m } else if (schema == null) { return new YDataQueryException(queryString, queriedData, source, message); } return new YDataStateException(queryString, queriedData, _out.outputString(schema), dataInput, xercesErrors, source, message); }
From source file:org.yawlfoundation.yawl.logging.table.YLogEvent.java
License:Open Source License
public void fromXML(Element xml) { eventID = strToLong(xml.getAttributeValue("key")); instanceID = strToLong(xml.getChildText("instanceKey")); descriptor = xml.getChildText("descriptor"); timestamp = strToLong(xml.getChildText("timestamp")); serviceID = strToLong(xml.getChildText("serviceKey")); rootNetInstanceID = strToLong(xml.getChildText("rootNetInstanceKey")); }
From source file:org.yawlfoundation.yawl.logging.YLogDataItem.java
License:Open Source License
private void fromXML(Element e) { if (e != null) { name = JDOMUtil.decodeEscapes(e.getChildText("name")); value = JDOMUtil.decodeEscapes(e.getChildText("value")); descriptor = JDOMUtil.decodeEscapes(e.getChildText("descriptor")); dataTypeName = JDOMUtil.decodeEscapes(e.getChildText("datatype")); dataTypeDefinition = JDOMUtil.decodeEscapes(e.getChildText("datatypedefinition")); }//from w ww .jav a 2 s.c o m }