Search in sources :

Example 1 with MathModelMetaData

use of cbit.vcell.mathmodel.MathModelMetaData in project vcell by virtualcell.

the class LocalUserMetaDbServerMessaging method getMathModelMetaData.

/**
 * getVersionInfo method comment.
 * @throws RemoteException
 */
public MathModelMetaData getMathModelMetaData(KeyValue mathModelKey) throws DataAccessException {
    try {
        log.print("LocalUserMetaDbServerMessaging.getMathModelMetaData(key=" + mathModelKey + ")");
        MathModelMetaData mathModelMetaData = dbServerProxy.getMathModelMetaData(mathModelKey);
        return mathModelMetaData;
    } catch (DataAccessException e) {
        log.exception(e);
        throw e;
    } catch (Throwable e) {
        log.exception(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : MathModelMetaData(cbit.vcell.mathmodel.MathModelMetaData) DataAccessException(org.vcell.util.DataAccessException)

Example 2 with MathModelMetaData

use of cbit.vcell.mathmodel.MathModelMetaData in project vcell by virtualcell.

the class LocalUserMetaDbServerMessaging method getMathModelMetaDatas.

/**
 * getVersionInfo method comment.
 * @throws RemoteException
 */
public MathModelMetaData[] getMathModelMetaDatas(boolean bAll) throws DataAccessException {
    try {
        log.print("LocalUserMetaDbServerMessaging.getMathModelMetaDatas(bAll=" + bAll + ")");
        MathModelMetaData[] mathModelMetaDataArray = dbServerProxy.getMathModelMetaDatas(bAll);
        return mathModelMetaDataArray;
    } catch (DataAccessException e) {
        log.exception(e);
        throw e;
    } catch (Throwable e) {
        log.exception(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : MathModelMetaData(cbit.vcell.mathmodel.MathModelMetaData) DataAccessException(org.vcell.util.DataAccessException)

Example 3 with MathModelMetaData

use of cbit.vcell.mathmodel.MathModelMetaData in project vcell by virtualcell.

the class MathModelDbDriver method getMathModelMetaDatas.

/**
 * getModel method comment.
 */
MathModelMetaData[] getMathModelMetaDatas(Connection con, User user, boolean bAll) throws SQLException, DataAccessException, ObjectNotFoundException {
    if (user == null) {
        throw new IllegalArgumentException("Improper parameters for getMathModelMetaDatas");
    }
    if (lg.isTraceEnabled())
        lg.trace("MathModelDbDriver.getMathModelMetaData(user=" + user + ", bAll=" + bAll + ")");
    // 
    // to construct a MathModelMetaData as an immutable object, lets collect all keys first
    // (even before authentication).  If the user doesn't authenticate, then throw away the
    // child keys (from link tables).
    // 
    // 
    // get BioModelMetaData object for bioModelKey
    // 
    String sql;
    Field[] f = { new cbit.sql.StarField(mathModelTable), userTable.userid };
    Table[] t = { mathModelTable, userTable };
    String condition = userTable.id.getQualifiedColName() + " = " + mathModelTable.ownerRef.getQualifiedColName();
    if (!bAll) {
        condition += " AND " + userTable.id.getQualifiedColName() + " = " + user.getID();
    }
    sql = DatabasePolicySQL.enforceOwnershipSelect(user, f, t, (OuterJoin) null, condition, null, dbSyntax, true);
    // 
    StringBuffer newSQL = new StringBuffer(sql);
    newSQL.insert(7, Table.SQL_GLOBAL_HINT);
    sql = newSQL.toString();
    // 
    Statement stmt = con.createStatement();
    Vector<MathModelMetaData> mathModelMetaDataList = new Vector<MathModelMetaData>();
    try {
        ResultSet rset = stmt.executeQuery(sql);
        while (rset.next()) {
            MathModelMetaData mathModelMetaData = mathModelTable.getMathModelMetaData(rset, this, con, dbSyntax);
            mathModelMetaDataList.addElement(mathModelMetaData);
        }
    } finally {
        // Release resources include resultset
        stmt.close();
    }
    MathModelMetaData[] mathModelMetaDataArray = new MathModelMetaData[mathModelMetaDataList.size()];
    mathModelMetaDataList.copyInto(mathModelMetaDataArray);
    return mathModelMetaDataArray;
}
Also used : Table(cbit.sql.Table) Statement(java.sql.Statement) MathModelMetaData(cbit.vcell.mathmodel.MathModelMetaData) Field(cbit.sql.Field) OuterJoin(cbit.vcell.modeldb.DatabasePolicySQL.OuterJoin) ResultSet(java.sql.ResultSet) Vector(java.util.Vector)

Example 4 with MathModelMetaData

use of cbit.vcell.mathmodel.MathModelMetaData 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;
}
Also used : KeyValue(org.vcell.util.document.KeyValue) VCellSoftwareVersion(org.vcell.util.document.VCellSoftwareVersion) Version(org.vcell.util.document.Version) MathModelMetaData(cbit.vcell.mathmodel.MathModelMetaData)

Example 5 with MathModelMetaData

use of cbit.vcell.mathmodel.MathModelMetaData 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)

Aggregations

MathModelMetaData (cbit.vcell.mathmodel.MathModelMetaData)9 KeyValue (org.vcell.util.document.KeyValue)6 DataAccessException (org.vcell.util.DataAccessException)5 Version (org.vcell.util.document.Version)4 ResultSet (java.sql.ResultSet)3 Statement (java.sql.Statement)3 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)3 Field (cbit.sql.Field)2 Table (cbit.sql.Table)2 ServerRejectedSaveException (cbit.vcell.clientdb.ServerRejectedSaveException)2 Geometry (cbit.vcell.geometry.Geometry)2 MappingException (cbit.vcell.mapping.MappingException)2 MathDescription (cbit.vcell.math.MathDescription)2 MathModel (cbit.vcell.mathmodel.MathModel)2 OuterJoin (cbit.vcell.modeldb.DatabasePolicySQL.OuterJoin)2 Simulation (cbit.vcell.solver.Simulation)2 XmlParseException (cbit.vcell.xml.XmlParseException)2 PropertyVetoException (java.beans.PropertyVetoException)2 User (org.vcell.util.document.User)2 VCellSoftwareVersion (org.vcell.util.document.VCellSoftwareVersion)2