use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class RestDatabaseService method stopSimulation.
public SimulationRep stopSimulation(BiomodelSimulationStopServerResource resource, User vcellUser) throws PermissionException, ObjectNotFoundException, DataAccessException, SQLException {
// resource.getRequestAttributes().get(VCellApiApplication.SIMDATAID);
String simId = resource.getAttribute(VCellApiApplication.SIMULATIONID);
KeyValue simKey = new KeyValue(simId);
SimulationRep simRep = getSimulationRep(simKey);
if (simRep == null) {
throw new ObjectNotFoundException("Simulation with key " + simKey + " not found");
}
User owner = simRep.getOwner();
if (!owner.compareEqual(vcellUser)) {
throw new PermissionException("not authorized to stop simulation");
}
VCMessageSession rpcSession = vcMessagingService.createProducerSession();
try {
UserLoginInfo userLoginInfo = new UserLoginInfo(vcellUser.getName(), null);
try {
userLoginInfo.setUser(vcellUser);
} catch (Exception e) {
e.printStackTrace();
throw new DataAccessException(e.getMessage());
}
RpcSimServerProxy rpcSimServerProxy = new RpcSimServerProxy(userLoginInfo, rpcSession);
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simKey, owner);
rpcSimServerProxy.stopSimulation(vcellUser, vcSimID);
return simRep;
} finally {
rpcSession.close();
}
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class SimDataServerResource method getSimDataRepresentation.
private SimDataRepresentation getSimDataRepresentation(User vcellUser) {
// if (!application.authenticate(getRequest(), getResponse())){
// // not authenticated
// return new SimulationTaskRepresentation[0];
// }else{
RestDatabaseService restDatabaseService = ((VCellApiApplication) getApplication()).getRestDatabaseService();
try {
DataSetMetadata dataSetMetadata = restDatabaseService.getDataSetMetadata(this, vcellUser);
SimulationRep simRep = restDatabaseService.getSimulationRep(dataSetMetadata.getSimKey());
SimDataRepresentation simDataRepresentation = new SimDataRepresentation(dataSetMetadata, simRep.getScanCount());
return simDataRepresentation;
} catch (PermissionException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_UNAUTHORIZED, "not authorized");
} catch (ObjectNotFoundException e) {
e.printStackTrace();
throw new ResourceException(Status.CLIENT_ERROR_NOT_FOUND, "simulation metadata not found");
} catch (Exception e) {
throw new ResourceException(Status.SERVER_ERROR_INTERNAL, e.getMessage());
}
// }
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class DataSetControllerImpl method getFieldDataIdentifierSpecs_private.
private FieldDataIdentifierSpec[] getFieldDataIdentifierSpecs_private(FieldFunctionArguments[] fieldFuncArgumentsArr, User user, boolean bForceUpdate) throws DataAccessException {
Vector<ExternalDataIdentifier> userExtDataIdentifiersV = userExtDataIDH.get(user);
if (userExtDataIdentifiersV == null || userExtDataIdentifiersV.size() < fieldFuncArgumentsArr.length || bForceUpdate) {
// must refresh
ExternalDataIdentifierService extDataIDService = VCellServiceHelper.getInstance().loadService(ExternalDataIdentifierService.class);
userExtDataIDH = extDataIDService.getAllExternalDataIdentifiers();
userExtDataIdentifiersV = userExtDataIDH.get(user);
}
FieldDataIdentifierSpec[] fieldDataIdentifierSpecs = new FieldDataIdentifierSpec[fieldFuncArgumentsArr.length];
Arrays.fill(fieldDataIdentifierSpecs, null);
for (int i = 0; i < fieldFuncArgumentsArr.length; i++) {
for (int j = 0; userExtDataIdentifiersV != null && j < userExtDataIdentifiersV.size(); j++) {
if (fieldFuncArgumentsArr[i].getFieldName().equals(userExtDataIdentifiersV.elementAt(j).getName())) {
fieldDataIdentifierSpecs[i] = new FieldDataIdentifierSpec(fieldFuncArgumentsArr[i], userExtDataIdentifiersV.elementAt(j));
break;
}
}
if (fieldDataIdentifierSpecs[i] == null) {
throw new ObjectNotFoundException("The data locator for FieldData Function '" + fieldFuncArgumentsArr[i].getFieldName() + "' could not be found.");
}
}
return fieldDataIdentifierSpecs;
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class DatabaseServerImpl method groupRemoveUser.
/**
* This method was created in VisualAge.
* @return void
* @param key KeyValue
* @exception org.vcell.util.DataAccessException The exception description.
* @exception java.rmi.RemoteException The exception description.
*/
public VersionInfo groupRemoveUser(User user, VersionableType vType, KeyValue key, String userRemoveFromGroup, boolean isHiddenFromOwner) throws DataAccessException, ObjectNotFoundException {
try {
if (lg.isTraceEnabled())
lg.trace("DatabaseServerImpl.groupRemoveUser(vType=" + vType.getTypeName() + ", Key=" + key + ", userRemoveFromGroup=" + userRemoveFromGroup + ")");
dbTop.groupRemoveUser(user, vType, key, true, userRemoveFromGroup, isHiddenFromOwner);
VersionInfo newVersionInfo = (VersionInfo) (dbTop.getVersionableInfos(user, key, vType, false, true, true).elementAt(0));
return newVersionInfo;
} catch (SQLException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
} catch (ObjectNotFoundException e) {
lg.error(e.getMessage(), e);
throw new ObjectNotFoundException(e.getMessage());
} catch (Throwable e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
}
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class DatabaseServerImpl method groupSetPublic.
/**
* This method was created in VisualAge.
* @return void
* @param key KeyValue
* @exception org.vcell.util.DataAccessException The exception description.
* @exception java.rmi.RemoteException The exception description.
*/
public VersionInfo groupSetPublic(User user, VersionableType vType, KeyValue key) throws DataAccessException, ObjectNotFoundException {
try {
if (lg.isTraceEnabled())
lg.trace("DatabaseServerImpl.groupSetPublic(vType=" + vType.getTypeName() + ", Key=" + key + ")");
dbTop.groupSetPublic(user, vType, key, true);
VersionInfo newVersionInfo = (VersionInfo) (dbTop.getVersionableInfos(user, key, vType, false, true, true).elementAt(0));
return newVersionInfo;
} catch (SQLException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
} catch (ObjectNotFoundException e) {
lg.error(e.getMessage(), e);
throw new ObjectNotFoundException(e.getMessage());
} catch (Throwable e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
}
}
Aggregations