use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class GeomDbDriver method getGeometry.
/**
* This method was created in VisualAge.
* @return cbit.vcell.model.Model
* @param rset java.sql.ResultSet
*/
private Geometry getGeometry(QueryHashtable dbc, Connection con, User user, ResultSet rset) throws SQLException, DataAccessException {
//
// get Image reference
//
java.math.BigDecimal bigD = rset.getBigDecimal(geomTable.imageRef.toString());
KeyValue imageRef = null;
if (!rset.wasNull()) {
imageRef = new KeyValue(bigD);
}
//
// get geometry object
//
Geometry tempGeometry = null;
try {
tempGeometry = geomTable.getGeometry(rset, con);
} catch (PropertyVetoException e) {
throw new DataAccessException(e.getMessage());
}
Geometry geom = null;
//
// get image for this geometry
//
VCImage vcImage = null;
if (imageRef != null) {
// permission checking for the image is disabled because it is a child of this geometry
vcImage = getVCImage(dbc, con, user, imageRef, false);
}
if (vcImage != null) {
geom = new Geometry(tempGeometry, vcImage);
} else {
geom = tempGeometry;
}
//
// get SubVolumes for this geometry
//
SubVolume[] subVolumes = getSubVolumesFromGeometry(dbc, con, geom.getVersion().getVersionKey());
if (subVolumes != null) {
try {
geom.getGeometrySpec().setSubVolumes(subVolumes);
} catch (java.beans.PropertyVetoException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
}
}
//
if (geom.getDimension() > 0) {
getSurfaceDescription(con, geom);
}
//
if (geom.getDimension() > 0) {
getFilaments(con, geom);
}
//
// get SurfaceClasses for this geometry
//
SurfaceClass[] surfaceClasses = getSurfaceClassesFromGeometry(dbc, con, geom.getVersion().getVersionKey());
if (surfaceClasses != null) {
try {
geom.getGeometrySurfaceDescription().setSurfaceClasses(surfaceClasses);
} catch (java.beans.PropertyVetoException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
}
}
return geom;
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class MathDescriptionDbDriver method getMathDescriptionSQL.
/**
* This method was created in VisualAge.
* @return cbit.vcell.math.MathDescription
* @param user cbit.vcell.server.User
* @param mathDescKey cbit.sql.KeyValue
*/
private MathDescription getMathDescriptionSQL(QueryHashtable dbc, Connection con, User user, KeyValue mathDescKey) throws SQLException, DataAccessException, ObjectNotFoundException {
String sql;
Field[] f = { userTable.userid, new cbit.sql.StarField(mathDescTable) };
Table[] t = { mathDescTable, userTable };
String condition = mathDescTable.id.getQualifiedColName() + " = " + mathDescKey + " AND " + userTable.id.getQualifiedColName() + " = " + mathDescTable.ownerRef.getQualifiedColName();
sql = DatabasePolicySQL.enforceOwnershipSelect(user, f, t, (OuterJoin) null, condition, null, dbSyntax);
// System.out.println(sql);
MathDescription mathDescription = null;
Statement stmt = con.createStatement();
try {
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
//
// note: must call mathDescTable.getMathDescription() first (rset.getBytes(language) must be called first)
//
mathDescription = mathDescTable.getMathDescription(rset, con, dbSyntax);
//
// get Geometry reference and assign to mathDescription
//
java.math.BigDecimal bigD = rset.getBigDecimal(MathDescTable.table.geometryRef.toString());
KeyValue geomRef = null;
if (!rset.wasNull()) {
geomRef = new KeyValue(bigD);
} else {
throw new DataAccessException("Error: Geometry Reference Cannot be Null for MathDescription");
}
Geometry geom = (Geometry) geomDB.getVersionable(dbc, con, user, VersionableType.Geometry, geomRef, false);
try {
mathDescription.setGeometry(geom);
} catch (java.beans.PropertyVetoException e) {
e.printStackTrace(System.out);
throw new DataAccessException("DataAccess Exception: " + e.getMessage());
}
} else {
throw new ObjectNotFoundException("MathDescription id=" + mathDescKey + " not found for user '" + user + "'");
}
} finally {
// Release resources include resultset
stmt.close();
}
return mathDescription;
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class MathModelDbDriver method getSimulationEntriesFromMathModel.
/**
* getModels method comment.
*/
KeyValue[] getSimulationEntriesFromMathModel(Connection con, KeyValue mathModelKey) throws SQLException, DataAccessException {
// if (lg.isTraceEnabled()) lg.trace("MathModelDbDriver.getSimulationEntriesFromMathModel(mathModelKey=" + mathModelKey + ")");
String sql;
sql = " SELECT " + mathModelSimLinkTable.simRef + " FROM " + mathModelSimLinkTable.getTableName() + " WHERE " + mathModelSimLinkTable.mathModelRef + " = " + mathModelKey + " ORDER BY " + mathModelSimLinkTable.id;
Statement stmt = con.createStatement();
java.util.Vector<KeyValue> keyList = new Vector<KeyValue>();
try {
ResultSet rset = stmt.executeQuery(sql);
//
while (rset.next()) {
KeyValue key = mathModelSimLinkTable.getSimulationKey(rset);
keyList.addElement(key);
}
} finally {
// Release resources include resultset
stmt.close();
}
//
// put results in an array
//
KeyValue[] keyArray = new KeyValue[keyList.size()];
keyList.copyInto(keyArray);
return keyArray;
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class MathModelTable method getMathModelMetaData.
/**
* This method was created in VisualAge.
* @return cbit.vcell.math.MathDescription
* @param user cbit.vcell.server.User
* @param rset java.sql.ResultSet
*/
public MathModelMetaData getMathModelMetaData(ResultSet rset, Connection con, KeyValue[] simulationKeys, DatabaseSyntax dbSyntax) throws SQLException, DataAccessException {
//
// Get Version
//
java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
Version mathModelVersion = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
KeyValue mathDescrRef = new KeyValue(rset.getBigDecimal(table.mathRef.toString()));
// MathModelMetaData mathModelMetaData = new MathModelMetaData(version,mathRef,simulationKeys);
MathModelMetaData mathModelMetaData = populateOutputFunctions(con, mathDescrRef, mathModelVersion, simulationKeys, dbSyntax);
return mathModelMetaData;
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class MathModelTable method getInfo.
/**
* This method was created in VisualAge.
* @return cbit.vcell.geometry.GeometryInfo
* @param rset java.sql.ResultSet
* @param log cbit.vcell.server.SessionLog
*/
public VersionInfo getInfo(ResultSet rset, Connection con, DatabaseSyntax dbSyntax) throws SQLException, org.vcell.util.DataAccessException {
KeyValue mathRef = new KeyValue(rset.getBigDecimal(table.mathRef.toString()));
java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
String serialDbChildSummary = DbDriver.varchar2_CLOB_get(rset, MathModelTable.table.childSummarySmall, MathModelTable.table.childSummaryLarge, dbSyntax);
String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
return new MathModelInfo(version, mathRef, serialDbChildSummary, VCellSoftwareVersion.fromString(softwareVersion));
}
Aggregations