opDef = opsManager.getOperationDefinition(caller,definitionId);
}
catch (OperationDefinitionNotFoundException odnfe) {
throw new StuffNotFoundException("Operation definition with id " + definitionId);
}
OperationRest operationRest = new OperationRest(resourceId,definitionId);
operationRest.setId((int)System.currentTimeMillis()); // TODO better id (?)(we need one for pUT later on)
operationRest.setReadyToSubmit(false);
operationRest.setName(opDef.getName());
ConfigurationDefinition paramDefinition = opDef.getParametersConfigurationDefinition();
if (paramDefinition != null) {
for (PropertyDefinition propDefs : paramDefinition.getNonGroupedProperties()) { // TODO extend to all properties ?
operationRest.getParams().put(propDefs.getName(),"TODO"); // TODO type and value of the value
}
}
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/operation/{id}");
URI uri = uriBuilder.build(operationRest.getId());
Link editLink = new Link("edit",uri.toString());
operationRest.addLink(editLink);
Response.ResponseBuilder builder = Response.ok(operationRest);
putToCache(operationRest.getId(),OperationRest.class,operationRest);
return builder.build();
}