use of org.vcell.util.document.Version in project vcell by virtualcell.
the class SimulationDbDriver method updateVersionableInit.
/**
* This method was created in VisualAge.
* @return cbit.image.VCImage
* @param user cbit.vcell.server.User
* @param image cbit.image.VCImage
*/
protected SimulationVersion updateVersionableInit(InsertHashtable hash, Connection con, User user, Versionable versionable, boolean bVersion, boolean bMathematicallyEquivalent) throws DataAccessException, SQLException, RecordChangedException {
SimulationVersion dbSimulationVersion = ((Simulation) versionable).getSimulationVersion();
Version newVersion = updateVersionableInit(hash, con, user, versionable, bVersion);
//
// point to oldest mathematically equivalent ancestor, this will be used for all identification (status/data).
//
KeyValue parentSimRef = null;
if (bMathematicallyEquivalent) {
if (dbSimulationVersion == null) {
throw new RuntimeException("Simulation must have been saved for bMathematicallyEquivalent to be true");
}
if (dbSimulationVersion.getParentSimulationReference() != null) {
// //
// // mathematically equivalent, prior link is transitive (B->C and A==B, then A->C)
// //
parentSimRef = dbSimulationVersion.getParentSimulationReference();
} else {
// //
// // mathematically equivalent, no prior link (A==B, then A->B)
// //
parentSimRef = dbSimulationVersion.getVersionKey();
}
}
return new SimulationVersion(newVersion.getVersionKey(), newVersion.getName(), newVersion.getOwner(), newVersion.getGroupAccess(), newVersion.getBranchPointRefKey(), newVersion.getBranchID(), newVersion.getDate(), newVersion.getFlag(), newVersion.getAnnot(), parentSimRef);
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class SimulationTable 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) throws SQLException, DataAccessException {
KeyValue mathRef = new KeyValue(rset.getBigDecimal(SimulationTable.table.mathRef.toString()));
java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
SimulationVersion simulationVersion = (SimulationVersion) version;
String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
return new SimulationInfo(mathRef, simulationVersion, VCellSoftwareVersion.fromString(softwareVersion));
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class VersionTable method getVersion.
/**
* This method was created in VisualAge.
* @return cbit.util.Version
* @param rset ResultSet
* @param log SessionLog
*/
public static Version getVersion(ResultSet rset, GroupAccess groupAccess) throws SQLException, DataAccessException {
KeyValue vBranchPointRef = null;
java.math.BigDecimal vBranchID = null;
java.util.Date vDate = null;
VersionFlag vFlag = null;
String vAnnot = null;
//
java.math.BigDecimal vBranchPointRefDB = rset.getBigDecimal(versionBranchPointRef_ColumnName);
if (rset.wasNull()) {
vBranchPointRef = null;
} else {
vBranchPointRef = new KeyValue(vBranchPointRefDB);
}
java.math.BigDecimal vBranchIDDB = rset.getBigDecimal(versionBranchID_ColumnName);
if (rset.wasNull()) {
vBranchID = null;
} else {
vBranchID = vBranchIDDB;
}
vDate = getDate(rset, versionDate_ColumnName);
if (vDate == null) {
throw new DataAccessException("could not parse date");
}
//
vFlag = VersionFlag.fromInt(rset.getInt(VersionTable.versionFlag_ColumnName));
//
String vAnnotDB = rset.getString(versionAnnot_ColumnName);
if (rset.wasNull()) {
vAnnot = null;
} else {
vAnnot = org.vcell.util.TokenMangler.getSQLRestoredString(vAnnotDB);
}
boolean bFoundParentSimRefColumn = false;
KeyValue parentSimRef = null;
try {
java.sql.ResultSetMetaData rsetMetaData = rset.getMetaData();
int numColumns = rsetMetaData.getColumnCount();
for (int i = 0; i < numColumns; i++) {
if (rsetMetaData.getColumnName(i + 1).toUpperCase().endsWith(SimulationTable.table.versionParentSimRef.toString().toUpperCase())) {
bFoundParentSimRefColumn = true;
break;
}
}
if (bFoundParentSimRefColumn) {
java.math.BigDecimal parentSimRefDB = rset.getBigDecimal(SimulationTable.table.versionParentSimRef.toString());
if (rset.wasNull()) {
parentSimRef = null;
} else {
parentSimRef = new KeyValue(parentSimRefDB);
}
}
} catch (SQLException e) {
e.printStackTrace(System.out);
lg.warn("VersionTable.getVersion(): consuming exception for missing column " + versionParentSimRef_ColumnName + ": " + e.getMessage(), e);
}
//
KeyValue key = new KeyValue(rset.getBigDecimal(Table.id_ColumnName));
String name = TokenMangler.getSQLRestoredString(rset.getString(VersionTable.name_ColumnName));
String ownerName = rset.getString(UserTable.table.userid.toString());
KeyValue ownerID = new KeyValue(rset.getBigDecimal(VersionTable.ownerRef_ColumnName));
User owner = new User(ownerName, ownerID);
//
if (bFoundParentSimRefColumn) {
return new SimulationVersion(key, name, owner, groupAccess, vBranchPointRef, vBranchID, vDate, vFlag, vAnnot, parentSimRef);
} else {
return new Version(key, name, owner, groupAccess, vBranchPointRef, vBranchID, vDate, vFlag, vAnnot);
}
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class GeomDbDriver method updateVersionable.
/**
* This method was created in VisualAge.
* @return cbit.image.VCImage
* @param user cbit.vcell.server.User
* @param image cbit.image.VCImage
*/
public KeyValue updateVersionable(InsertHashtable hash, Connection con, User user, VCImage vcImage, boolean bVersion) throws DataAccessException, SQLException, RecordChangedException {
Version newVersion = null;
try {
newVersion = updateVersionableInit(hash, con, user, vcImage, bVersion);
insertVCImage(hash, con, user, vcImage, newVersion);
} catch (ImageException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException("ImageException: " + e.getMessage());
}
return newVersion.getVersionKey();
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class GeometryTable 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) throws SQLException, DataAccessException {
java.math.BigDecimal groupid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
Version version = getVersion(rset, DbDriver.getGroupAccessFromGroupID(con, groupid));
int dim = rset.getInt(GeometryTable.table.dimension.toString());
double oX = rset.getBigDecimal(GeometryTable.table.originX.toString()).doubleValue();
double oY = rset.getBigDecimal(GeometryTable.table.originY.toString()).doubleValue();
double oZ = rset.getBigDecimal(GeometryTable.table.originZ.toString()).doubleValue();
org.vcell.util.Origin origin = new org.vcell.util.Origin(oX, oY, oZ);
double extentX = rset.getBigDecimal(ExtentTable.table.extentX.toString()).doubleValue();
double extentY = rset.getBigDecimal(ExtentTable.table.extentY.toString()).doubleValue();
double extentZ = rset.getBigDecimal(ExtentTable.table.extentZ.toString()).doubleValue();
org.vcell.util.Extent extent = new org.vcell.util.Extent(extentX, extentY, extentZ);
KeyValue imgRef = null;
java.math.BigDecimal bigDecimal = rset.getBigDecimal(GeometryTable.table.imageRef.toString());
if (!rset.wasNull()) {
imgRef = new KeyValue(bigDecimal);
}
String softwareVersion = rset.getString(SoftwareVersionTable.table.softwareVersion.toString());
GeometryInfo geomInfo = new GeometryInfo(version, dim, extent, origin, imgRef, VCellSoftwareVersion.fromString(softwareVersion));
return geomInfo;
/*GeometryInfo geomInfo = new GeometryInfo();
geomInfo.dimension = rset.getInt(GeometryTable.dimension.toString());
geomInfo.originX = rset.getDouble(GeometryTable.originX.toString());
geomInfo.originY = rset.getDouble(GeometryTable.originY.toString());
geomInfo.originZ = rset.getDouble(GeometryTable.originZ.toString());
geomInfo.extentRef = new KeyValue(rset.getBigDecimal(GeometryTable.extentRef.toString(), 0));
geomInfo.imageRef = new KeyValue(rset.getBigDecimal(GeometryTable.imageRef.toString(), 0));
geomInfo.version = getVersion(rset,log);
return geomInfo;
*/
}
Aggregations