Search in sources :

Example 6 with PublicationRep

use of cbit.vcell.modeldb.PublicationRep 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]);
}
Also used : PermissionException(org.vcell.util.PermissionException) SQLException(java.sql.SQLException) ArrayList(java.util.ArrayList) ExpressionException(cbit.vcell.parser.ExpressionException) PublicationRepresentation(org.vcell.rest.common.PublicationRepresentation) PublicationRep(cbit.vcell.modeldb.PublicationRep) VCellApiApplication(org.vcell.rest.VCellApiApplication) ResourceException(org.restlet.resource.ResourceException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

PublicationRep (cbit.vcell.modeldb.PublicationRep)6 ResourceException (org.restlet.resource.ResourceException)4 PublicationRepresentation (org.vcell.rest.common.PublicationRepresentation)4 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)4 PermissionException (org.vcell.util.PermissionException)4 ArrayList (java.util.ArrayList)3 VCellApiApplication (org.vcell.rest.VCellApiApplication)3 SimpleDateFormat (java.text.SimpleDateFormat)2 BigString (org.vcell.util.BigString)2 SimulationContext (cbit.vcell.mapping.SimulationContext)1 BioModelReferenceRep (cbit.vcell.modeldb.BioModelReferenceRep)1 OrderBy (cbit.vcell.modeldb.DatabaseServerImpl.OrderBy)1 MathModelReferenceRep (cbit.vcell.modeldb.MathModelReferenceRep)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 Configuration (freemarker.template.Configuration)1 SQLException (java.sql.SQLException)1 HashMap (java.util.HashMap)1 Form (org.restlet.data.Form)1 TemplateRepresentation (org.restlet.ext.freemarker.TemplateRepresentation)1 Representation (org.restlet.representation.Representation)1