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;
}
}
}
}
}
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);
}
}
}
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;
}
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());
}
}
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());
}
}
Aggregations