@GET
 @Path("{id}/specification")
 @Produces(MediaType.APPLICATION_JSON)
 @Timed
 @UnitOfWork
 public String getSpecification(@PathParam("id") LongParam id) throws IOException {
   Optional<Orchestration> ent = dao.find(id.get());
   if (!ent.isPresent()) {
     throw new NotFoundException("Orchestration " + id.get() + " not found");
   }
   return engine.getGeneratedSpecification(ent.get());
 }
 @GET
 @Path("{id}")
 @Produces(MediaType.APPLICATION_JSON)
 @Timed
 @UnitOfWork
 public Orchestration get(@PathParam("id") LongParam id) {
   Optional<Orchestration> entity = dao.find(id.get());
   if (!entity.isPresent()) {
     throw new NotFoundException("Orchestration " + id.get() + " not found");
   }
   return entity.get();
 }
 @DELETE
 @Path("{id}")
 @Timed
 @UnitOfWork
 public void delete(@PathParam("id") LongParam id) {
   Optional<Orchestration> ent = dao.find(id.get());
   if (!ent.isPresent()) {
     throw new NotFoundException("Orchestration " + id.get() + " not found");
   }
   Orchestration entity = ent.get();
   if (entity.getState() == OrchestrationState.Started) {
     throw new WebApplicationException(Response.Status.CONFLICT);
   }
   dao.delete(entity);
 }
 @PUT
 @Path("{id}")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Timed
 @UnitOfWork
 public Orchestration update(@PathParam("id") LongParam id, Orchestration entity) {
   Optional<Orchestration> ent = dao.find(id.get());
   if (!ent.isPresent()) {
     throw new NotFoundException("Orchestration " + id.get() + " not found");
   }
   if (ent.get().getState() == OrchestrationState.Started) {
     throw new WebApplicationException(Response.Status.CONFLICT);
   }
   entity.setLastModified(LocalDateTime.now());
   return dao.merge(entity);
 }
 @POST
 @Path("{id}/stop")
 @Consumes(MediaType.APPLICATION_JSON)
 @Produces(MediaType.APPLICATION_JSON)
 @Timed
 @UnitOfWork
 public Orchestration stop(@PathParam("id") LongParam id) {
   Optional<Orchestration> ent = dao.find(id.get());
   if (!ent.isPresent()) {
     throw new NotFoundException("Orchestration " + id.get() + " not found");
   }
   Orchestration entity = ent.get();
   boolean result = engine.stop(entity);
   if (result) {
     entity.setState(OrchestrationState.Stopped);
     entity.setLastModified(LocalDateTime.now());
     dao.save(entity);
   }
   return entity;
 }