use of org.jbei.ice.lib.experiment.Study in project ice by JBEI.
the class PartResource method createPartExperiment.
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/experiments")
public Response createPartExperiment(@PathParam("id") final String partId, final Study study) {
try {
final String userId = requireUserId();
log(userId, "adding experiment " + study.toString() + " to " + partId);
Experiments experiments = new Experiments(userId, partId);
final Study created = experiments.createOrUpdateStudy(study);
return respond(Response.Status.OK, created);
} catch (PermissionException e) {
throw new WebApplicationException(Response.Status.FORBIDDEN);
} catch (IllegalArgumentException ile) {
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
}
use of org.jbei.ice.lib.experiment.Study in project ice by JBEI.
the class PartResource method getPartExperiments.
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("/{id}/experiments")
public Response getPartExperiments(@PathParam("id") final String partId) {
final String userId = requireUserId();
try {
Experiments experiments = new Experiments(userId, partId);
final List<Study> studies = experiments.getPartStudies();
return respond(Response.Status.OK, studies);
} catch (PermissionException e) {
throw new WebApplicationException(Response.Status.FORBIDDEN);
} catch (IllegalArgumentException ile) {
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
}
use of org.jbei.ice.lib.experiment.Study in project ice by JBEI.
the class Experiment method toDataTransferObject.
public Study toDataTransferObject() {
Study study = new Study();
study.setId(id);
study.setCreated(creationTime.getTime());
study.setLabel(label);
study.setOwnerEmail(this.ownerEmail);
study.setUrl(url);
return study;
}
Aggregations