Search in sources :

Example 16 with ObjectNotFoundException

use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.

the class ReactStepDbDriver method getSpecies.

/**
 * getModel method comment.
 */
public Species getSpecies(QueryHashtable dbc, Connection con, KeyValue speciesID) throws SQLException, DataAccessException, ObjectNotFoundException {
    // 
    // try to get Species from the object cache
    // 
    Species species = (Species) dbc.get(speciesID);
    if (species != null) {
        return species;
    }
    if (speciesID == null) {
        throw new IllegalArgumentException("Improper parameters for getSpecies");
    }
    // log.print("ReactStepDbDriver.getSpecies(speciesID=" + speciesID + ")");
    String sql;
    sql = " SELECT * " + " FROM " + speciesTable.getTableName() + " WHERE " + speciesTable.id + " = " + speciesID;
    // System.out.println(sql);
    Statement stmt = con.createStatement();
    try {
        ResultSet rset = stmt.executeQuery(sql);
        if (rset.next()) {
            species = getSpecies(dbc, rset, con);
        } else {
            throw new org.vcell.util.ObjectNotFoundException("Species id=" + speciesID + " not found");
        }
    } finally {
        // Release resources include resultset
        stmt.close();
    }
    // MIRIAMTable.table.setMIRIAMAnnotation(con, species, speciesID);
    return species;
}
Also used : Statement(java.sql.Statement) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) ResultSet(java.sql.ResultSet) Species(cbit.vcell.model.Species) DBSpecies(cbit.vcell.model.DBSpecies)

Example 17 with ObjectNotFoundException

use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.

the class DatabaseServerImpl method getVersionInfos.

/**
 * This method was created in VisualAge.
 * @return GeometryInfo
 * @param key KeyValue
 * @exception org.vcell.util.DataAccessException The exception description.
 * @exception java.rmi.RemoteException The exception description.
 */
private VersionInfo[] getVersionInfos(User user, KeyValue key, VersionableType vType, boolean bAll, boolean bCheckPermission) throws DataAccessException {
    try {
        if (lg.isTraceEnabled())
            lg.trace("DatabaseServerImpl.getVersionInfos(User=" + user + ",vType=" + vType + ",bAll=" + bAll + ")");
        Vector<VersionInfo> vector = dbTop.getVersionableInfos(user, key, vType, bAll, bCheckPermission, true);
        if (vType.equals(VersionableType.BioModelMetaData)) {
            BioModelInfo[] bioModelInfos = new BioModelInfo[vector.size()];
            vector.copyInto(bioModelInfos);
            return bioModelInfos;
        } else if (vType.equals(VersionableType.Geometry)) {
            GeometryInfo[] geoInfos = new GeometryInfo[vector.size()];
            vector.copyInto(geoInfos);
            return geoInfos;
        } else if (vType.equals(VersionableType.MathModelMetaData)) {
            MathModelInfo[] mathInfos = new MathModelInfo[vector.size()];
            vector.copyInto(mathInfos);
            return mathInfos;
        } else if (vType.equals(VersionableType.VCImage)) {
            VCImageInfo[] imgInfos = new VCImageInfo[vector.size()];
            vector.copyInto(imgInfos);
            return imgInfos;
        } else if (vType.equals(VersionableType.Simulation)) {
            SimulationInfo[] simInfos = new SimulationInfo[vector.size()];
            vector.copyInto(simInfos);
            return simInfos;
        } else {
            throw new IllegalArgumentException("Wrong VersinableType vType:" + vType);
        }
    } 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 : SQLException(java.sql.SQLException) BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) VersionInfo(org.vcell.util.document.VersionInfo) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) DataAccessException(org.vcell.util.DataAccessException) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 18 with ObjectNotFoundException

use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.

the class DatabaseServerImpl method groupAddUser.

/**
 * 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 groupAddUser(User user, VersionableType vType, KeyValue key, String addUserToGroup, boolean isHidden) throws DataAccessException, ObjectNotFoundException {
    try {
        if (lg.isTraceEnabled())
            lg.trace("DatabaseServerImpl.groupAddUser(vType=" + vType.getTypeName() + ", Key=" + key + ", userToAdd=" + addUserToGroup + ", isHidden=" + isHidden + ")");
        dbTop.groupAddUser(user, vType, key, true, addUserToGroup, isHidden);
        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 19 with ObjectNotFoundException

use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.

the class DatabaseServerImpl method getVCImageXML.

/**
 * getVersionable method comment.
 */
public BigString getVCImageXML(User user, KeyValue key) throws DataAccessException, ObjectNotFoundException {
    try {
        if (lg.isTraceEnabled())
            lg.trace("DatabaseServerImpl.getVCImageXML(user=" + user + ", Key=" + key + ")");
        boolean bCheckPermission = true;
        VCImage image = dbTop.getVCImage(new QueryHashtable(), user, key, bCheckPermission);
        return new BigString(XmlHelper.imageToXML(image));
    } 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 : QueryHashtable(cbit.sql.QueryHashtable) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) VCImage(cbit.image.VCImage) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException)

Example 20 with ObjectNotFoundException

use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.

the class GeomDbDriver method getExtentRefKeyFromGeometry.

/**
 * getModel method comment.
 */
private KeyValue getExtentRefKeyFromGeometry(Connection con, KeyValue geomKey) throws SQLException, DataAccessException, ObjectNotFoundException {
    if (geomKey == null) {
        throw new IllegalArgumentException("Improper parameters for getSizeKeyFromGeometry");
    }
    // log.print("GeomDbDriver.getSizeKeyFromGeometry(id="+geomKey+")");
    String sql;
    sql = " SELECT " + geomTable.extentRef + " FROM " + geomTable.getTableName() + " WHERE " + geomTable.id + " = " + geomKey;
    // System.out.println(sql);
    // Connection con = conFact.getConnection();
    Statement stmt = con.createStatement();
    try {
        ResultSet rset = stmt.executeQuery(sql);
        if (rset.next()) {
            return new KeyValue(rset.getBigDecimal(geomTable.extentRef.toString()));
        } else {
            throw new ObjectNotFoundException("getSizeKeyFromGeometry for Image id=" + geomKey + " not found");
        }
    } finally {
        // Release resources include resultset
        stmt.close();
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) Statement(java.sql.Statement) ObjectNotFoundException(org.vcell.util.ObjectNotFoundException) ResultSet(java.sql.ResultSet)

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