Example usage for org.json Json4Uws getJson

List of usage examples for org.json Json4Uws getJson

Introduction

In this page you can find the example usage for org.json Json4Uws getJson.

Prototype

public final static JSONObject getJson(final String key, final String value) throws JSONException 

Source Link

Document

Gets the JSON representation of the given pair key/value.

Usage

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getJobList(final JobList jobsList, final JobOwner owner, final boolean root)
        throws JSONException {
    return Json4Uws.getJson(jobsList, owner).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getJobID(final UWSJob job, final boolean root) throws JSONException {
    return Json4Uws.getJson(UWSJob.PARAM_JOB_ID, job.getJobId()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getRunID(final UWSJob job, final boolean root) throws JSONException {
    return Json4Uws.getJson(UWSJob.PARAM_RUN_ID, job.getRunId()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getOwnerID(final UWSJob job, final boolean root) throws JSONException {
    if (job.getOwner() == null)
        return "{}";
    else//from  w w w  .java 2 s. co m
        return Json4Uws.getJson(UWSJob.PARAM_OWNER, job.getOwner().getPseudo()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getPhase(final UWSJob job, final boolean root) throws JSONException {
    return Json4Uws.getJson(UWSJob.PARAM_PHASE, job.getPhase().toString()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getQuote(final UWSJob job, final boolean root) throws JSONException {
    return Json4Uws.getJson(UWSJob.PARAM_QUOTE, job.getQuote()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getExecutionDuration(final UWSJob job, final boolean root) throws JSONException {
    return Json4Uws.getJson(UWSJob.PARAM_EXECUTION_DURATION, job.getExecutionDuration()).toString();
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getDestructionTime(final UWSJob job, final boolean root) throws JSONException {
    if (job.getDestructionTime() != null) {
        return Json4Uws.getJson(UWSJob.PARAM_DESTRUCTION_TIME, ISO8601Format.format(job.getDestructionTime()))
                .toString();//w w w .ja  va2 s  . c  o m
    } else
        return "{}";
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getStartTime(final UWSJob job, final boolean root) throws JSONException {
    if (job.getDestructionTime() != null)
        return Json4Uws.getJson(UWSJob.PARAM_START_TIME, ISO8601Format.format(job.getDestructionTime()))
                .toString();//from  w w w.j a  va  2  s . co  m
    else
        return "{}";
}

From source file:uws.job.serializer.JSONSerializer.java

@Override
public String getEndTime(final UWSJob job, final boolean root) throws JSONException {
    if (job.getDestructionTime() != null)
        return Json4Uws.getJson(UWSJob.PARAM_END_TIME, ISO8601Format.format(job.getDestructionTime()))
                .toString();/*ww w.j  a  v a 2  s . com*/
    else
        return "{}";
}