MetaGraphTx tx = metaGraphService.newTransaction();
GetGraphResponse getGraphResponse;
HttpHeaders headers = new HttpHeaders();
try {
ProjectMetadata projectMetadata = tx.getProject(projectId);
if (projectMetadata == null) {
throw new NotFound(ProjectMetadata.class, projectId);
}
GraphMetadata graphMetadata = tx.createGraph(projectMetadata);
graphMetadata.setProperties(item.getProperties());
headers.setLocation(builder.path("/graphs/{graphId}").buildAndExpand(projectMetadata.getId()).toUri());
getGraphResponse = new GetGraphResponse(graphMetadata);
} catch (Throwable t) {
tx.rollback();
throw t;