Example usage for org.jdom2 Element addContent

List of usage examples for org.jdom2 Element addContent

Introduction

In this page you can find the example usage for org.jdom2 Element addContent.

Prototype

@Override
public Element addContent(final Collection<? extends Content> newContent) 

Source Link

Document

Appends all children in the given collection to the end of the content list.

Usage

From source file:ca.nrc.cadc.uws.JobWriter.java

License:Open Source License

/**
 * Get an Element representing the Job jobId.
 *
 * @return The Job jobId Element.//from   ww  w . j  av  a2s. c o m
 */
public Element getJobId(Job job) {
    Element element = new Element(JobAttribute.JOB_ID.getAttributeName(), UWS.NS);
    element.addContent(job.getID());
    return element;
}

From source file:ca.nrc.cadc.uws.JobWriter.java

License:Open Source License

/**
 * Get an Element representing the Job runId.
 *
 * @return The Job runId Element.//from   w  ww  .j  a  va2s  . c  o m
 */
public Element getRunId(Job job) {
    Element element = new Element(JobAttribute.RUN_ID.getAttributeName(), UWS.NS);
    element.addContent(job.getRunID());
    return element;
}

From source file:ca.nrc.cadc.uws.JobWriter.java

License:Open Source License

/**
 * Get an Element representing the Job ownerId.
 *
 * @return The Job ownerId Element.//from w w  w . j ava  2 s  . c o m
 */
public Element getOwnerId(Job job) {
    Element element = new Element(JobAttribute.OWNER_ID.getAttributeName(), UWS.NS);
    if (job.getOwnerID() != null)
        element.addContent(job.getOwnerID());
    else
        element.setAttribute("nil", "true", UWS.XSI_NS);
    return element;
}

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 ww . j  a va  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./*w ww.ja  va2  s  .c o 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   ww  w .  j a va  2  s . c o 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./* www .  j a  va 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.
 *//*  w ww  . j  ava  2 s.  c om*/
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.
 *//*from  ww w.j  a  v a2 s.co m*/
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  a v  a 2  s  .  co m*/
 */
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;
}