org.labkey.remoteapi.assay.SaveAssayRunsCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of labkey-client-api Show documentation
Show all versions of labkey-client-api Show documentation
The client-side library for Java developers is a separate JAR from the LabKey Server code base. It can be used by any Java program, including another Java web application.
package org.labkey.remoteapi.assay;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.labkey.remoteapi.PostCommand;
import java.util.List;
/**
* Saves runs on the server.
*/
public class SaveAssayRunsCommand extends PostCommand
{
private List _runs;
private String _protocolName;
/**
* @param protocolName name of the protocol to use
* @param runs the runs to be saved
*/
public SaveAssayRunsCommand(String protocolName, List runs)
{
super("assay", "saveAssayRuns");
_runs = runs;
_protocolName = protocolName;
}
public SaveAssayRunsCommand(SaveAssayRunsCommand source)
{
super(source);
_runs = source._runs;
}
@Override
public PostCommand copy()
{
return new SaveAssayRunsCommand(this);
}
@Override
public JSONObject getJsonObject()
{
JSONObject result = new JSONObject();
JSONArray runs = new JSONArray();
for (Run run : _runs)
{
runs.add(run.toJSONObject());
}
result.put("runs", runs);
result.put("protocolName", getProtocolName());
return result;
}
@Override
protected SaveAssayRunsResponse createResponse(String text, int status, String contentType, JSONObject json)
{
return new SaveAssayRunsResponse(text, status, contentType, json, this);
}
public List getRuns()
{
return _runs;
}
public void setRuns(List runs)
{
_runs = runs;
}
public String getProtocolName()
{
return _protocolName;
}
public void setProtocolName(String protocolName)
{
_protocolName = protocolName;
}
}