use of org.jbei.ice.lib.experiment.Experiments in project ice by JBEI.
the class PartResource method deletePartExperiment.
@DELETE
@Path("/{id}/experiments/{eid}")
public Response deletePartExperiment(@PathParam("id") final String partId, @PathParam("eid") final long experimentId) {
try {
String userId = requireUserId();
log(userId, "deleting experiment " + experimentId + " for entry " + partId);
Experiments experiments = new Experiments(userId, partId);
return super.respond(experiments.deleteStudy(experimentId));
} 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.Experiments 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.Experiments 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);
}
}
Aggregations