List of usage examples for org.jdom2 Element Element
public Element(final String name, final String uri)
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job phase. * * @return The Job phase Element.//from w w w .j a v a 2 s. c o m */ public Element getPhase(Job job) { Element element = new Element(JobAttribute.EXECUTION_PHASE.getAttributeName(), UWS.NS); element.addContent(job.getExecutionPhase().toString()); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job quote. * * @return The Job quote Element.//from www.j a v a 2 s . co m */ public Element getQuote(Job job) { Element element = new Element(JobAttribute.QUOTE.getAttributeName(), UWS.NS); Date date = job.getQuote(); if (date == null) element.setAttribute("nil", "true", UWS.XSI_NS); else element.addContent(dateFormat.format(date)); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job startTime. * * @return The Job startTime Element./*from w w w. j av a 2 s .co m*/ */ public Element getStartTime(Job job) { Element element = new Element(JobAttribute.START_TIME.getAttributeName(), UWS.NS); Date date = job.getStartTime(); if (date == null) element.setAttribute("nil", "true", UWS.XSI_NS); else element.addContent(dateFormat.format(date)); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job endTime. * * @return The Job endTime Element./*from w w w . j av a 2s . com*/ */ public Element getEndTime(Job job) { Element element = new Element(JobAttribute.END_TIME.getAttributeName(), UWS.NS); Date date = job.getEndTime(); if (date == null) element.setAttribute("nil", "true", UWS.XSI_NS); else element.addContent(dateFormat.format(date)); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job creationTime. * * @return The Job creationTime Element. *//*from w w w . j a v a2 s . c o m*/ public Element getCreationTime(Job job) { Element element = new Element(JobAttribute.CREATION_TIME.getAttributeName(), UWS.NS); Date date = job.getCreationTime(); if (date == null) element.setAttribute("nil", "true", UWS.XSI_NS); else element.addContent(dateFormat.format(date)); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job executionDuration. * * @return The Job executionDuration Element. *//* w w w. jav a2s . c om*/ public Element getExecutionDuration(Job job) { Element element = new Element(JobAttribute.EXECUTION_DURATION.getAttributeName(), UWS.NS); element.addContent(Long.toString(job.getExecutionDuration())); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job destruction. * * @return The Job destruction Element.//from w ww . j av a 2 s . c om */ public Element getDestruction(Job job) { Element element = new Element(JobAttribute.DESTRUCTION_TIME.getAttributeName(), UWS.NS); Date date = job.getDestructionTime(); if (date == null) element.setAttribute("nil", "true", UWS.XSI_NS); else element.addContent(dateFormat.format(date)); return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job parameters. * * @return The Job parameters Element./* w ww.ja v a2 s .c o m*/ */ public Element getParameters(Job job) { Element element = new Element(JobAttribute.PARAMETERS.getAttributeName(), UWS.NS); for (Parameter parameter : job.getParameterList()) { Element e = new Element(JobAttribute.PARAMETER.getAttributeName(), UWS.NS); e.setAttribute("id", parameter.getName()); e.addContent(parameter.getValue()); element.addContent(e); } return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job results. * * @return The Job results Element./*from w w w. j a v a2s . com*/ */ public Element getResults(Job job) { Element element = new Element(JobAttribute.RESULTS.getAttributeName(), UWS.NS); for (Result result : job.getResultsList()) { Element e = new Element(JobAttribute.RESULT.getAttributeName(), UWS.NS); e.setAttribute("id", result.getName()); e.setAttribute("href", result.getURI().toASCIIString(), UWS.XLINK_NS); element.addContent(e); } return element; }
From source file:ca.nrc.cadc.uws.JobWriter.java
License:Open Source License
/** * Get an Element representing the Job errorSummary. * * @return The Job errorSummary Element. *///from www. ja v a 2 s.c om public Element getErrorSummary(Job job) { Element eleErrorSummary = null; ErrorSummary es = job.getErrorSummary(); if (es != null) { eleErrorSummary = new Element(JobAttribute.ERROR_SUMMARY.getAttributeName(), UWS.NS); eleErrorSummary.setAttribute("type", es.getErrorType().toString().toLowerCase()); eleErrorSummary.setAttribute("hasDetail", Boolean.toString(es.getHasDetail())); Element eleMessage = new Element(JobAttribute.ERROR_SUMMARY_MESSAGE.getAttributeName(), UWS.NS); eleMessage.addContent(job.getErrorSummary().getSummaryMessage()); eleErrorSummary.addContent(eleMessage); } return eleErrorSummary; }