use of org.vcell.rest.common.PublicationRepresentation in project vcell by virtualcell.
the class PublicationsServerResource method getPublicationRepresentations.
private PublicationRepresentation[] getPublicationRepresentations(User vcellUser) {
ArrayList<PublicationRepresentation> publicationRepresentations = new ArrayList<PublicationRepresentation>();
RestDatabaseService restDatabaseService = ((VCellApiApplication) getApplication()).getRestDatabaseService();
try {
PublicationRep[] publicationReps = restDatabaseService.query(this, vcellUser);
for (PublicationRep publicationRep : publicationReps) {
PublicationRepresentation publicationRepresentation = new PublicationRepresentation(publicationRep);
publicationRepresentations.add(publicationRepresentation);
}
} catch (PermissionException ee) {
ee.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "not authorized");
} catch (DataAccessException | SQLException | ExpressionException e) {
e.printStackTrace();
throw new RuntimeException("failed to retrieve biomodels from VCell Database : " + e.getMessage());
}
return publicationRepresentations.toArray(new PublicationRepresentation[0]);
}
use of org.vcell.rest.common.PublicationRepresentation in project vcell by virtualcell.
the class PublicationServerResource method getPublicationRepresentation.
private PublicationRepresentation getPublicationRepresentation(User vcellUser) {
// if (!application.authenticate(getRequest(), getResponse())){
// // not authenticated
// return new SimulationTaskRepresentation[0];
// }else{
RestDatabaseService restDatabaseService = ((VCellApiApplication) getApplication()).getRestDatabaseService();
try {
PublicationRep publicationRep = restDatabaseService.query(this, vcellUser);
PublicationRepresentation publicationRepresentation = new PublicationRepresentation(publicationRep);
return publicationRepresentation;
} catch (PermissionException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "permission denied to requested resource");
} catch (ObjectNotFoundException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "publication not found");
} catch (Exception e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e.getMessage());
}
// }
}
Aggregations