Search in sources :

Example 46 with Version

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() + ")");
}
Also used : Version(org.vcell.util.document.Version)

Example 47 with Version

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() + ")");
}
Also used : Version(org.vcell.util.document.Version)

Example 48 with Version

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;
}
Also used : VersionFlag(org.vcell.util.document.VersionFlag) Version(org.vcell.util.document.Version) VCDocumentType(org.vcell.util.document.VCDocument.VCDocumentType)

Example 49 with Version

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);
}
Also used : PermissionException(org.vcell.util.PermissionException) User(org.vcell.util.document.User) KeyValue(org.vcell.util.document.KeyValue) PreparedStatement(java.sql.PreparedStatement) Statement(java.sql.Statement) MathModelMetaData(cbit.vcell.mathmodel.MathModelMetaData) BioModelMetaData(cbit.vcell.biomodel.BioModelMetaData) BigDecimal(java.math.BigDecimal) Geometry(cbit.vcell.geometry.Geometry) BigDecimal(java.math.BigDecimal) VersionFlag(org.vcell.util.document.VersionFlag) Version(org.vcell.util.document.Version) VersionableTypeVersion(org.vcell.util.document.VersionableTypeVersion) ResultSet(java.sql.ResultSet) GroupAccess(org.vcell.util.document.GroupAccess) DataAccessException(org.vcell.util.DataAccessException)

Example 50 with Version

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 + ")");
        }
    }
}
Also used : VersionInfo(org.vcell.util.document.VersionInfo) Version(org.vcell.util.document.Version) VersionableTypeVersion(org.vcell.util.document.VersionableTypeVersion) BigDecimal(java.math.BigDecimal) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

Version (org.vcell.util.document.Version)74 VCellSoftwareVersion (org.vcell.util.document.VCellSoftwareVersion)27 DataAccessException (org.vcell.util.DataAccessException)24 KeyValue (org.vcell.util.document.KeyValue)22 BigDecimal (java.math.BigDecimal)17 Geometry (cbit.vcell.geometry.Geometry)13 SimulationVersion (org.vcell.util.document.SimulationVersion)12 PropertyVetoException (java.beans.PropertyVetoException)10 User (org.vcell.util.document.User)10 VersionableTypeVersion (org.vcell.util.document.VersionableTypeVersion)10 Element (org.jdom.Element)9 MathDescription (cbit.vcell.math.MathDescription)8 RedistributionVersion (cbit.vcell.solvers.mb.MovingBoundarySolverOptions.RedistributionVersion)8 SimulationContext (cbit.vcell.mapping.SimulationContext)7 ResultSet (java.sql.ResultSet)7 Statement (java.sql.Statement)7 ImageException (cbit.image.ImageException)6 Simulation (cbit.vcell.solver.Simulation)6 VersionFlag (org.vcell.util.document.VersionFlag)6 Model (cbit.vcell.model.Model)5