use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class DBTopLevel method getBioModelXML.
/**
* This method was created in VisualAge.
* @return cbit.sql.Versionable
* @param object cbit.sql.Versionable
* @param name java.lang.String
* @param bVersion boolean
* @exception org.vcell.util.DataAccessException The exception description.
* @exception java.sql.SQLException The exception description.
* @exception cbit.sql.RecordChangedException The exception description.
*/
String getBioModelXML(User user, KeyValue key, boolean bEnableRetry) throws DataAccessException, java.sql.SQLException, ObjectNotFoundException {
Object lock = new Object();
Connection con = conFactory.getConnection(lock);
DbDriver driver = getDbDriver(VersionableType.BioModelMetaData);
try {
//
// Getting the corresponding VersionInfo will fail if you don't have permission to the object.
// This is needed because the DbDriver-level services can return objects directly from the
// cache without checking for permissions first.
//
// This check is placed in DbTopLevel because this is the client API entry point.
// Child objects (of the requested object) are given permission by reachablity anyway,
// so if the user is allowed permission to the parent, no further checks are necessary.
//
Vector<VersionInfo> vInfos = getVersionableInfos(user, key, VersionableType.BioModelMetaData, true, true, false);
if (vInfos.size() == 0) {
throw new ObjectNotFoundException(VersionableType.BioModelMetaData.getTypeName() + " not found");
}
return driver.getVersionableXML(con, VersionableType.BioModelMetaData, key);
} catch (Throwable e) {
lg.error(e.getMessage(), e);
if (bEnableRetry && isBadConnection(con)) {
conFactory.failed(con, lock);
return getBioModelXML(user, key, false);
} else {
handle_DataAccessException_SQLException(e);
// never gets here;
return null;
}
} finally {
conFactory.release(con, lock);
}
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class ODESolverPlotSpecificationPanel method getSensitivityParameter.
/**
* // Method to obtain the sensitivity parameter (if applicable). The method checks the column description names in the
* // result set to find any column description that begins with the substring "sens" and contains the substring "wrt_".
* // If there is, then the last portion of that column description name is the parameter name. The sensitivity parameter
* // is also stored as a function column description in the result set (as a constant function). The value is extracted
* // from the result set, and a new Constant is created (with the name and value of the parameter) and returned. If no
* // column description starts with the substring "sens" or if the column for the parameter does not exist in the result
* // set, the method returns null.
*/
private Constant getSensitivityParameter() throws ExpressionException {
String sensParamName = "";
ColumnDescription[] fcds = getMyDataInterface().getAllColumnDescriptions();
// Check for any column description name that starts with the substring "sens" and contains "wrt_".
for (int i = 0; i < fcds.length; i++) {
if (fcds[i].getName().startsWith("sens_")) {
int c = fcds[i].getName().indexOf("wrt_");
sensParamName = fcds[i].getName().substring(c + 4);
if (!sensParamName.equals(null) || !sensParamName.equals("")) {
break;
}
}
}
double sensParamValue = 0.0;
if (sensParamName.equals("")) {
return null;
}
// If the sens param column exists in the result set, create a Constant and return it, else return null.
try {
sensParamValue = getMyDataInterface().extractColumn(sensParamName)[1];
} catch (ObjectNotFoundException e) {
// System.out.println("REUSULT SET DOES NOT HAVE SENSITIVITY ANALYSIS");
return null;
}
Constant sensParam = new Constant(sensParamName, new Expression(sensParamValue));
return sensParam;
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class ClientDocumentManager method getGeometryInfo.
/**
* Insert the method's description here.
* Creation date: (11/14/00 2:50:07 PM)
* @return cbit.sql.Versionable
* @param vType cbit.sql.VersionableType
* @param key cbit.sql.KeyValue
*/
public synchronized GeometryInfo getGeometryInfo(KeyValue key) throws DataAccessException {
if (key == null) {
System.out.println("<<<NULL>>>> ClientDocumentManager.getGeometryInfo(" + key + ")");
return null;
}
//
// first look in local cache for the Info object
//
GeometryInfo geometryInfo = (GeometryInfo) geoInfoHash.get(key);
if (geometryInfo != null) {
// System.out.println("<<<IN CACHE>>> ClientDocumentManager.getGeometryInfo("+key+")");
return geometryInfo;
}
//
// else get new list of info objects from database and stick in cache
//
reloadGeometryInfos();
// bGeometryInfosDirty = false;
//
// now look in cache again (should be in there unless it was deleted from database).
//
geometryInfo = (GeometryInfo) geoInfoHash.get(key);
if (geometryInfo != null) {
return geometryInfo;
} else {
throw new ObjectNotFoundException("GeometryInfo(" + key + ") not found");
}
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class ClientDocumentManager method getBioModelXML.
/**
* Insert the method's description here.
* Creation date: (3/29/2004 4:04:16 PM)
* @return java.lang.String
* @param vType cbit.sql.VersionableType
* @param vKey cbit.sql.KeyValue
*/
private XMLHolder<BioModel> getBioModelXML(KeyValue vKey) throws DataAccessException {
try {
String xmlString = (String) xmlHash.get(vKey);
if (xmlString == null) {
BigString xmlBS = sessionManager.getUserMetaDbServer().getBioModelXML(vKey);
xmlString = (xmlBS != null ? xmlBS.toString() : null);
if (xmlString != null) {
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(xmlString));
String newXmlString = XmlHelper.bioModelToXML(bioModel);
xmlHash.put(vKey, newXmlString);
return new XMLHolder<BioModel>(newXmlString, bioModel);
} else {
throw new RuntimeException("unexpected: UserMetaDbServer.getBioModelXML() returned null");
}
} else {
return new XMLHolder<BioModel>(xmlString);
}
} catch (ObjectNotFoundException e) {
throw new DataAccessException("BioModel (id=" + vKey + ") does not exist. It either " + "has been deleted or its reference is outdated. Please use menu 'Server->Reconnect' to update document references.");
} catch (Exception e) {
e.printStackTrace(System.out);
throw FailToLoadDocumentExc.createException(e, vKey, this);
}
}
use of org.vcell.util.ObjectNotFoundException in project vcell by virtualcell.
the class ClientDocumentManager method getMathModelXML.
/**
* Insert the method's description here.
* Creation date: (3/29/2004 4:04:16 PM)
* @return java.lang.String
* @param vType cbit.sql.VersionableType
* @param vKey cbit.sql.KeyValue
*/
private XMLHolder<MathModel> getMathModelXML(KeyValue vKey) throws DataAccessException {
try {
String xmlString = (String) xmlHash.get(vKey);
if (xmlString == null) {
xmlString = sessionManager.getUserMetaDbServer().getMathModelXML(vKey).toString();
if (xmlString != null) {
MathModel mathModel = XmlHelper.XMLToMathModel(new XMLSource(xmlString));
String newXmlString = XmlHelper.mathModelToXML(mathModel);
xmlHash.put(vKey, newXmlString);
return new XMLHolder<MathModel>(newXmlString, mathModel);
} else {
throw new RuntimeException("unexpected: UserMetaDbServer.getMathModelXML() returned null");
}
} else {
return new XMLHolder<MathModel>(xmlString);
}
} catch (ObjectNotFoundException e) {
throw new DataAccessException("MathModel (id=" + vKey + ") does not exist. It either " + "has been deleted or its reference is outdated. Please use menu 'Server->Reconnect' to update document references.");
} catch (Exception e) {
e.printStackTrace(System.out);
throw FailToLoadDocumentExc.createException(e, vKey, this);
}
}
Aggregations