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;
}
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());
}
}
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());
}
}
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());
}
}
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();
}
}
Aggregations