Search in sources :

Example 41 with ObjectNotFoundException

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();
    }
}
Also used : PermissionException(org.vcell.util.PermissionException) VCSimulationIdentifier(cbit.vcell.solver.VCSimulationIdentifier) KeyValue(org.vcell.util.document.KeyValue) User(org.vcell.util.document.User) RpcSimServerProxy(org.vcell.rest.rpc.RpcSimServerProxy) VCMessageSession(cbit.vcell.message.VCMessageSession) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) BigString(org.vcell.util.BigString) UserLoginInfo(org.vcell.util.document.UserLoginInfo) SimulationRep(cbit.vcell.modeldb.SimulationRep) PropertyVetoException(java.beans.PropertyVetoException) MatrixException(cbit.vcell.matrix.MatrixException) ModelException(cbit.vcell.model.ModelException) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) SQLException(java.sql.SQLException) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) ExpressionException(cbit.vcell.parser.ExpressionException) UseridIDExistsException(org.vcell.util.UseridIDExistsException) MappingException(cbit.vcell.mapping.MappingException) MathException(cbit.vcell.math.MathException) DataAccessException(org.vcell.util.DataAccessException)

Example 42 with ObjectNotFoundException

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());
    }
// }
}
Also used : PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) VCellApiApplication(org.vcell.rest.VCellApiApplication) SimDataRepresentation(org.vcell.rest.common.SimDataRepresentation) ResourceException(org.restlet.resource.ResourceException) DataSetMetadata(cbit.vcell.simdata.DataSetMetadata) SimulationRep(cbit.vcell.modeldb.SimulationRep) PermissionException(org.vcell.util.PermissionException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) ResourceException(org.restlet.resource.ResourceException)

Example 43 with ObjectNotFoundException

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;
}
Also used : FieldDataIdentifierSpec(cbit.vcell.field.FieldDataIdentifierSpec) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) ExternalDataIdentifier(org.vcell.util.document.ExternalDataIdentifier)

Example 44 with ObjectNotFoundException

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());
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) SQLException(java.sql.SQLException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException)

Example 45 with ObjectNotFoundException

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());
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) SQLException(java.sql.SQLException) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)62 DataAccessException (org.vcell.util.DataAccessException)26 KeyValue (org.vcell.util.document.KeyValue)21 ResultSet (java.sql.ResultSet)18 Statement (java.sql.Statement)17 PermissionException (org.vcell.util.PermissionException)17 SQLException (java.sql.SQLException)13 User (org.vcell.util.document.User)12 BigString (org.vcell.util.BigString)11 XmlParseException (cbit.vcell.xml.XmlParseException)10 VersionInfo (org.vcell.util.document.VersionInfo)10 Field (cbit.sql.Field)9 SimulationRep (cbit.vcell.modeldb.SimulationRep)9 XMLSource (cbit.vcell.xml.XMLSource)9 Table (cbit.sql.Table)8 OuterJoin (cbit.vcell.modeldb.DatabasePolicySQL.OuterJoin)8 PropertyVetoException (java.beans.PropertyVetoException)8 ResourceException (org.restlet.resource.ResourceException)8 VCellApiApplication (org.vcell.rest.VCellApiApplication)8 BioModel (cbit.vcell.biomodel.BioModel)7