Search in sources :

Example 36 with BioModelInfo

use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.

the class VCDatabaseScanner method scanBioModels.

public void scanBioModels(BioModelVisitor databaseVisitor, Logger logger, User[] users, boolean bAbortOnDataAccessException) throws DataAccessException, XmlParseException {
    if (users == null) {
        users = getAllUsers();
    }
    // start visiting models and writing log
    logger.info("Start scanning bio-models......");
    for (int i = 0; i < users.length; i++) {
        User user = users[i];
        BioModelInfo[] bioModelInfos = dbServerImpl.getBioModelInfos(user, false);
        for (int j = 0; j < bioModelInfos.length; j++) {
            BioModelInfo bmi = bioModelInfos[j];
            if (!databaseVisitor.filterBioModel(bmi)) {
                continue;
            }
            try {
                BigString bioModelXML = dbServerImpl.getBioModelXML(user, bioModelInfos[j].getVersion().getVersionKey());
                BioModel bioModel = cbit.vcell.xml.XmlHelper.XMLToBioModel(new XMLSource(bioModelXML.toString()));
                bioModel.refreshDependencies();
                if (logger.isDebugEnabled()) {
                    // + bioModelInfos[j].getVersion().getName() + " -----> ");
                    logger.debug("---- " + (j + 1) + " ----> " + bioModel.getName());
                }
                databaseVisitor.visitBioModel(bioModel);
            } catch (Exception e2) {
                logger.warn("exception biomodel " + bmi.getModelKey(), e2);
                if (bAbortOnDataAccessException) {
                    throw e2;
                }
            }
        }
    }
}
Also used : User(org.vcell.util.document.User) BioModel(cbit.vcell.biomodel.BioModel) BioModelInfo(org.vcell.util.document.BioModelInfo) BigString(org.vcell.util.BigString) XMLSource(cbit.vcell.xml.XMLSource) SQLException(java.sql.SQLException) XmlParseException(cbit.vcell.xml.XmlParseException) DataAccessException(org.vcell.util.DataAccessException) RemoteException(java.rmi.RemoteException)

Example 37 with BioModelInfo

use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.

the class EditTestCriteriaPanel method selectBMApp.

/**
 * Comment
 */
private void selectBMApp() {
    BioModelInfo bmInfo = getTestingFrameworkWindowManager().selectBioModelInfo();
    if (bmInfo != null) {
        // getRefMathModelLabel().setText(null);
        // getRefSimLabel().setText(null);
        // getBioModelAppLabel().setText(null);
        String[] simContextNames = bmInfo.getBioModelChildSummary().getSimulationContextNames();
        String selection = (String) cbit.vcell.client.PopupGenerator.showListDialog(this, simContextNames, "choose application for testCase");
        if (selection != null) {
            setbioModelInfo(bmInfo);
            setappName(selection);
            setbmAppSimInfo(null);
            getBmAppSimLabel().setText(null);
            getBioModelAppLabel().setText("<html>" + getbioModelInfo().getVersion().getName() + "/" + getappName() + "<br>(BioModelKey=" + getbioModelInfo().getVersion().getVersionKey() + ")<br>" + getbioModelInfo().getVersion().getDate() + "</html>");
        // getBioModelAppLabel().setText(bmInfo.getVersion().getName()+"/"+getappName());
        // setReferenceMathModelInfo(null);
        // setReferenceSimInfo(null);
        }
    }
}
Also used : BioModelInfo(org.vcell.util.document.BioModelInfo)

Example 38 with BioModelInfo

use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.

the class ClientDocumentManager method getBioModelInfo.

/**
 * Insert the method's description here.
 * Creation date: (11/14/00 2:50:07 PM)
 * @return cbit.sql.Versionable
 * @param vType cbit.sql.VersionableType
 * @param key cbit.sql.KeyValue
 */
public synchronized BioModelInfo getBioModelInfo(KeyValue key) throws DataAccessException {
    if (key == null) {
        System.out.println("<<<NULL>>>> ClientDocumentManager.getBioModelInfo(" + key + ")");
        return null;
    }
    // 
    // first look in local cache for the Info object
    // 
    BioModelInfo bioModelInfo = (BioModelInfo) bioModelInfoHash.get(key);
    if (bioModelInfo != null) {
        return bioModelInfo;
    }
    // 
    // else refresh cache
    // 
    reloadBioModelInfos();
    // bBioModelInfosDirty = false;
    // 
    // now look in cache again (should be in there unless it was deleted from database).
    // 
    bioModelInfo = (BioModelInfo) bioModelInfoHash.get(key);
    if (bioModelInfo != null) {
        return bioModelInfo;
    }
    System.out.println("BioModelInfo(" + key + ") not found");
    return null;
}
Also used : BioModelInfo(org.vcell.util.document.BioModelInfo)

Example 39 with BioModelInfo

use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.

the class ClientDocumentManager method setGroupPublic.

/**
 * Insert the method's description here.
 * Creation date: (11/28/00 5:43:44 PM)
 * @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
 */
public BioModelInfo setGroupPublic(BioModelInfo bioModelInfo) throws DataAccessException {
    try {
        // 
        // publish from database
        // 
        BioModelInfo newBioModelInfo = (BioModelInfo) setGroupPublic0(bioModelInfo, VersionableType.BioModelMetaData, bioModelInfoHash);
        // 
        // delete BioModelMetaData from cache
        // 
        xmlHash.remove(bioModelInfo.getVersion().getVersionKey());
        fireDatabaseUpdate(new DatabaseEvent(this, DatabaseEvent.UPDATE, bioModelInfo, newBioModelInfo));
        return newBioModelInfo;
    } catch (RemoteProxyException e) {
        handleRemoteProxyException(e);
        throw new DataAccessException(e.getMessage());
    }
}
Also used : BioModelInfo(org.vcell.util.document.BioModelInfo) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 40 with BioModelInfo

use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.

the class ClientDocumentManager method saveAsNew.

/**
 * Insert the method's description here.
 * Creation date: (1/19/01 11:27:52 AM)
 */
public BioModel saveAsNew(BioModel bioModel, java.lang.String newName, String[] independentSims) throws DataAccessException {
    try {
        String bioModelXML = null;
        try {
            bioModel.getVCMetaData().cleanupMetadata();
            bioModelXML = XmlHelper.bioModelToXML(bioModel);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        String savedBioModelXML = sessionManager.getUserMetaDbServer().saveBioModelAs(new BigString(bioModelXML), newName, independentSims).toString();
        BioModel savedBioModel = getBioModelFromDatabaseXML(new XMLHolder<BioModel>(savedBioModelXML));
        KeyValue savedKey = savedBioModel.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedBioModelXML);
        }
        BioModelInfo savedBioModelInfo = new BioModelInfo(savedBioModel.getVersion(), savedBioModel.getModel().getKey(), savedBioModel.createBioModelChildSummary(), VCellSoftwareVersion.fromSystemProperty());
        bioModelInfoHash.put(savedKey, savedBioModelInfo);
        SimulationContext[] scArr = savedBioModel.getSimulationContexts();
        for (int i = 0; i < scArr.length; i++) {
            updateGeometryRelatedHashes(scArr[i].getGeometry());
        }
        fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedBioModelInfo));
        return savedBioModel;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : KeyValue(org.vcell.util.document.KeyValue) BioModelInfo(org.vcell.util.document.BioModelInfo) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) SimulationContext(cbit.vcell.mapping.SimulationContext) BigString(org.vcell.util.BigString) BioModel(cbit.vcell.biomodel.BioModel) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Aggregations

BioModelInfo (org.vcell.util.document.BioModelInfo)79 DataAccessException (org.vcell.util.DataAccessException)38 MathModelInfo (org.vcell.util.document.MathModelInfo)37 BioModel (cbit.vcell.biomodel.BioModel)25 GeometryInfo (cbit.vcell.geometry.GeometryInfo)22 KeyValue (org.vcell.util.document.KeyValue)18 SimulationContext (cbit.vcell.mapping.SimulationContext)17 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)15 BigString (org.vcell.util.BigString)14 User (org.vcell.util.document.User)14 Vector (java.util.Vector)13 Simulation (cbit.vcell.solver.Simulation)12 XmlParseException (cbit.vcell.xml.XmlParseException)12 SQLException (java.sql.SQLException)12 XMLSource (cbit.vcell.xml.XMLSource)10 MathModel (cbit.vcell.mathmodel.MathModel)9 Hashtable (java.util.Hashtable)9 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)9 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)8 Geometry (cbit.vcell.geometry.Geometry)7