use of cbit.vcell.simdata.DataSetTimeSeries in project vcell by virtualcell.
the class SimDataValuesServerResource method getSimDataValuesRepresentation.
private SimDataValuesRepresentation getSimDataValuesRepresentation(User vcellUser) {
// if (!application.authenticate(getRequest(), getResponse())){
// // not authenticated
// return new SimulationTaskRepresentation[0];
// }else{
RestDatabaseService restDatabaseService = ((VCellApiApplication) getApplication()).getRestDatabaseService();
try {
DataSetTimeSeries dataSetTimeSeries = restDatabaseService.getDataSetTimeSeries(this, vcellUser);
SimDataValuesRepresentation simDataRepresentation = new SimDataValuesRepresentation(dataSetTimeSeries);
return simDataRepresentation;
} catch (PermissionException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "not authorized to stop simulation");
} catch (ObjectNotFoundException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "simulation not found");
} catch (Exception e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e.getMessage());
}
// }
}
use of cbit.vcell.simdata.DataSetTimeSeries in project vcell by virtualcell.
the class RestDatabaseService method getDataSetTimeSeries.
public DataSetTimeSeries getDataSetTimeSeries(SimDataValuesServerResource resource, User vcellUser) throws DataAccessException, ObjectNotFoundException, SQLException {
if (vcellUser == null) {
vcellUser = VCellApiApplication.DUMMY_USER;
}
UserLoginInfo userLoginInfo = new UserLoginInfo(vcellUser.getName(), null);
// resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
String simId = resource.getAttribute(VCellApiApplication.SIMDATAID);
// resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
String jobIndexString = resource.getAttribute(VCellApiApplication.JOBINDEX);
KeyValue simKey = new KeyValue(simId);
SimulationRep simRep = getSimulationRep(simKey);
if (simRep == null) {
throw new ObjectNotFoundException("Simulation with key " + simKey + " not found");
}
int jobIndex = Integer.parseInt(jobIndexString);
// TODO: pass in variables names from the query parameters.
String[] variableNames = null;
User owner = simRep.getOwner();
VCMessageSession rpcSession = vcMessagingService.createProducerSession();
try {
RpcDataServerProxy rpcDataServerProxy = new RpcDataServerProxy(userLoginInfo, rpcSession);
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, owner);
VCDataIdentifier vcdID = new VCSimulationDataIdentifier(vcSimID, jobIndex);
DataSetTimeSeries dataSetTimeSeries = rpcDataServerProxy.getDataSetTimeSeries(vcdID, variableNames);
return dataSetTimeSeries;
} finally {
rpcSession.close();
}
}
Aggregations