use of org.vcell.util.document.Version in project vcell by virtualcell.
the class GeometryMetaDataCellRenderer method setComponentProperties.
/**
* Insert the method's description here.
* Creation date: (5/8/01 8:35:45 AM)
* @return javax.swing.Icon
* @param nodeUserObject java.lang.Object
*/
protected void setComponentProperties(JLabel component, BioModelInfo bioModelInfo) {
// to load in defaults (e.g. icon)
super.setComponentProperties(component, bioModelInfo);
Version version = bioModelInfo.getVersion();
component.setToolTipText("BioModel that uses this geometry");
component.setText("\"" + version.getName() + "\" (" + version.getDate().toString() + ")");
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class GeometryMetaDataCellRenderer method setComponentProperties.
/**
* Insert the method's description here.
* Creation date: (5/8/01 8:35:45 AM)
* @return javax.swing.Icon
* @param nodeUserObject java.lang.Object
*/
protected void setComponentProperties(JLabel component, MathModelInfo mathModelInfo) {
// to load in defaults (e.g. icon)
super.setComponentProperties(component, mathModelInfo);
Version version = mathModelInfo.getVersion();
component.setToolTipText("Mathematical Model that uses this Geometry");
component.setText("\"" + version.getName() + "\" (" + version.getDate().toString() + ")");
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class ClientMDIManager method createCanonicalTitle.
/**
* Insert the method's description here.
* Creation date: (5/27/2006 4:10:10 PM)
* @return java.lang.String
* @param version cbit.sql.Version
*/
public static String createCanonicalTitle(VCDocument vcDocument) {
Version version = vcDocument.getVersion();
VCDocumentType docType = vcDocument.getDocumentType();
String docName = (version != null ? version.getName() : (vcDocument.getName() == null ? "NoName" : vcDocument.getName() + " (NoVersion)"));
java.util.Date docDate = (version != null ? version.getDate() : null);
VersionFlag versionFlag = (version != null ? version.getFlag() : null);
String title = (versionFlag != null && versionFlag.compareEqual(VersionFlag.Archived) ? "(" + CurateSpec.CURATE_TYPE_STATES[CurateSpec.ARCHIVE] + ") " : "") + (versionFlag != null && versionFlag.compareEqual(VersionFlag.Published) ? "(" + CurateSpec.CURATE_TYPE_STATES[CurateSpec.PUBLISH] + ") " : "") + (docType == VCDocumentType.BIOMODEL_DOC ? "BIOMODEL: " : "") + (docType == VCDocumentType.MATHMODEL_DOC ? "MATHMODEL: " : "") + (docType == VCDocumentType.GEOMETRY_DOC ? "GEOMETRY: " : "") + docName + " " + "(" + (docDate != null ? docDate.toString() : "NoDate") + ")";
title += " -- VCell " + DocumentWindowAboutBox.getVERSION_NO() + " (build " + DocumentWindowAboutBox.getBUILD_NO() + ")";
return title;
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class DbDriver method updateVersionableInit.
/**
* This method was created in VisualAge.
* @return cbit.image.VCImage
* @param user cbit.vcell.server.User
* @param image cbit.image.VCImage
*/
protected Version updateVersionableInit(InsertHashtable hash, Connection con, User user, Versionable versionable, boolean bVersion) throws DataAccessException, SQLException, RecordChangedException {
if (hash.getDatabaseKey(versionable) != null) {
throw new DataAccessException(versionable + " already inserted in this transaction");
}
if (versionable.getVersion() == null || versionable.getVersion().getVersionKey() == null) {
throw new DataAccessException(versionable + " Not expecting null key before update. Update Failed");
}
// Can only update things we own
if (!versionable.getVersion().getOwner().equals(user)) {
throw new PermissionException("Versionable name=" + versionable.getName() + " type=" + VersionTable.versionableTypeFromVersionable(versionable) + "\nuser=" + versionable.getVersion().getOwner() + " Not Equal to client user=" + user);
}
//
// get new Version info
//
User owner = user;
GroupAccess accessInfo = versionable.getVersion().getGroupAccess();
//
if (versionable instanceof BioModelMetaData || versionable instanceof MathModelMetaData || versionable instanceof Geometry) {
Statement stmt = null;
try {
stmt = con.createStatement();
String sql = "SELECT " + VersionTable.privacy_ColumnName + " FROM " + VersionTable.getVersionTable(versionable).getTableName() + " WHERE " + VersionTable.id_ColumnName + " = " + versionable.getVersion().getVersionKey();
ResultSet rset = stmt.executeQuery(sql);
BigDecimal dbgrpid = null;
if (rset.next()) {
dbgrpid = rset.getBigDecimal(VersionTable.privacy_ColumnName);
}
rset.close();
if (!dbgrpid.equals(versionable.getVersion().getGroupAccess().getGroupid())) {
accessInfo = getGroupAccessFromGroupID(con, dbgrpid);
}
} catch (Throwable e) {
// Don't fail, just keep the permission versionable came in with
} finally {
if (stmt != null) {
stmt.close();
}
}
}
KeyValue versionKey = keyFactory.getNewKey(con);
java.util.Date date = getNewDate(con);
//
// always use the previous BranchPointReference unless branching
//
KeyValue branchPointRefKey = versionable.getVersion().getBranchPointRefKey();
// Check for Archive and Publish not needed in update because versionflag is always forced to Current
VersionFlag versionFlag = null;
// if (bVersion){
// versionFlag = VersionFlag.Archived;
// }else{
versionFlag = VersionFlag.Current;
// }
String versionName = versionable.getVersion().getName();
java.math.BigDecimal branchID = versionable.getVersion().getBranchID();
String annot = versionable.getDescription();
//
// Insert Software Version
//
insertSoftwareVersion(con, versionKey);
//
return new Version(versionKey, versionName, owner, accessInfo, branchPointRefKey, branchID, date, versionFlag, annot);
}
use of org.vcell.util.document.Version in project vcell by virtualcell.
the class DbDriver method groupSetPrivate.
/**
* This method was created in VisualAge.
* @return cbit.sql.Versionable
* @param owner cbit.vcell.server.User
* @param versionable cbit.sql.Versionable
*/
public static void groupSetPrivate(Connection con, User owner, VersionableType vType, KeyValue vKey, DatabaseSyntax dbSyntax) throws SQLException, ObjectNotFoundException, DataAccessException /*, DependencyException*/
{
if ((con == null) || (vType == null) || (owner == null) || (vKey == null)) {
throw new IllegalArgumentException("Improper parameters for groupAccessSetPrivate");
}
//
Version currentVersion = permissionInit(con, vType, vKey, owner);
if (lg.isTraceEnabled())
lg.trace("DbDriver.groupAccessSetPrivate(owner=" + owner + ", type =" + vType.getTypeName() + ", key=" + vKey + ")");
BigDecimal updatedGroupID = GroupAccess.GROUPACCESS_NONE;
VersionTable vTable = VersionTable.getVersionTable(vType);
String set = vTable.privacy.getQualifiedColName() + " = " + updatedGroupID;
String cond = vTable.id.getQualifiedColName() + " = " + vKey;
String sql = DatabasePolicySQL.enforceOwnershipUpdate(owner, vTable, set, cond);
// System.out.println(sql);
int numRowsProcessed = updateCleanSQL(con, sql);
if (numRowsProcessed != 1) {
//
// check if update failed, or just already updated
//
Vector<VersionInfo> versionInfoList = getVersionableInfos(con, owner, vType, false, vKey, true, dbSyntax);
if (versionInfoList.size() == 0) {
throw new DataAccessException("groupSetPrivate failed " + vType.getTypeName() + "(" + vKey + ") record not found");
} else {
throw new DataAccessException("groupSetPrivate failed " + vType.getTypeName() + "(" + vKey + ")");
}
}
}
Aggregations