use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class ClientDocumentManager method setGroupPrivate.
/**
* Insert the method's description here.
* Creation date: (11/28/00 5:43:44 PM)
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
public BioModelInfo setGroupPrivate(BioModelInfo bioModelInfo) throws DataAccessException {
try {
//
// unpublish from database
//
BioModelInfo newBioModelInfo = (BioModelInfo) setGroupPrivate0(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 save.
/**
* Insert the method's description here.
* Creation date: (10/28/00 12:08:30 AM)
*/
public BioModel save(BioModel bioModel, 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().saveBioModel(new BigString(bioModelXML), 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());
}
// copy some transient info from the old model to the new one
for (SimulationContext newsc : scArr) {
SimulationContext oldsc = bioModel.getSimulationContext(newsc.getName());
newsc.getTaskCallbackProcessor().initialize((oldsc.getTaskCallbackProcessor()));
newsc.setMostRecentlyCreatedOutputSpec(oldsc.getMostRecentlyCreatedOutputSpec());
newsc.setMd5hash(oldsc.getMd5hash());
}
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());
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class ClientDocumentManager method reloadBioModelInfos.
/**
* Insert the method's description here.
* Creation date: (11/14/00 5:33:21 PM)
* @return cbit.vcell.biomodel.BioModelInfo[]
*/
private void reloadBioModelInfos() throws DataAccessException {
try {
System.out.println("ClientDocumentManager.reloadBioModelInfos()");
BioModelInfo[] bioModelInfos = sessionManager.getUserMetaDbServer().getBioModelInfos(true);
if (bioModelInfos != null) {
bioModelInfoHash.clear();
for (int i = 0; i < bioModelInfos.length; i++) {
bioModelInfoHash.put(bioModelInfos[i].getVersion().getVersionKey(), bioModelInfos[i]);
}
}
} catch (RemoteProxyException e) {
handleRemoteProxyException(e);
throw new DataAccessException("RemoteProxyException: " + e.getMessage());
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DatabaseWindowManager method comparePreviousEdition.
/**
* Comment
*/
public void comparePreviousEdition() {
//
if (getPanelSelection() == null) {
PopupGenerator.showErrorDialog(this, "Error Comparing documents : No first document selected");
return;
}
VCDocumentInfo thisDocumentInfo = getPanelSelection();
//
// Get the previous version of the documentInfo
//
VCDocumentInfo[] documentVersionsList = null;
try {
documentVersionsList = getDocumentVersionDates(thisDocumentInfo);
} catch (DataAccessException e) {
PopupGenerator.showErrorDialog(this, "Error accessing second document!");
}
if (documentVersionsList == null || documentVersionsList.length == 0) {
PopupGenerator.showErrorDialog(this, "Error Comparing documents : Not Enough Versions to Compare!");
return;
}
//
// Obtaining the previous version of the current biomodel. Set the previousBioModelInfo to
// the first version in the bioModelVersionList. Then compare all the versions in the list
// with the previousBioModelInfo to see if any of them are before previousBioModelInfo
// datewise. If so, update previousBioModelInfo. The biomodelinfo stored in previousBioModelInfo
// when it comes out of the loop is the previous version of the biomodel.
//
VCDocumentInfo previousDocumentInfo = documentVersionsList[0];
boolean bPrevious = false;
for (int i = 0; i < documentVersionsList.length; i++) {
if (documentVersionsList[i].getVersion().getDate().before(thisDocumentInfo.getVersion().getDate())) {
bPrevious = true;
previousDocumentInfo = documentVersionsList[i];
} else {
break;
}
}
if (previousDocumentInfo.equals(documentVersionsList[0]) && !bPrevious) {
PopupGenerator.showErrorDialog(this, "Current Version is the oldest! Choose another Version or Model to compare!");
return;
}
// Check if both document types are of the same kind. If not, throw an error.
if (((thisDocumentInfo instanceof BioModelInfo) && !(previousDocumentInfo instanceof BioModelInfo)) || ((thisDocumentInfo instanceof MathModelInfo) && !(previousDocumentInfo instanceof MathModelInfo)) || ((thisDocumentInfo instanceof GeometryInfo) && !(previousDocumentInfo instanceof GeometryInfo))) {
PopupGenerator.showErrorDialog(this, "Error Comparing documents : The two documents are not of the same type!");
return;
}
// Now that we have both the document versions to be compared, do the comparison and display the result
compareWithOther(previousDocumentInfo, thisDocumentInfo);
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DatabaseWindowManager method getDocumentVersionDates.
/**
* Insert the method's description here.
* Creation date: (10/3/2002 10:34:00 AM)
*/
private VCDocumentInfo[] getDocumentVersionDates(VCDocumentInfo thisDocumentInfo) throws DataAccessException {
//
if (thisDocumentInfo == null) {
return new VCDocumentInfo[0];
}
VCDocumentInfo[] vcDocumentInfos = null;
if (thisDocumentInfo instanceof BioModelInfo) {
vcDocumentInfos = getRequestManager().getDocumentManager().getBioModelInfos();
} else if (thisDocumentInfo instanceof MathModelInfo) {
vcDocumentInfos = getRequestManager().getDocumentManager().getMathModelInfos();
} else if (thisDocumentInfo instanceof GeometryInfo) {
vcDocumentInfos = getRequestManager().getDocumentManager().getGeometryInfos();
}
//
// From the list of biomodels in the workspace, get list of biomodels with the same branch ID.
// This is the list of different versions of the same biomodel.
//
Vector<VCDocumentInfo> documentBranchList = new Vector<VCDocumentInfo>();
for (int i = 0; i < vcDocumentInfos.length; i++) {
VCDocumentInfo vcDocumentInfo = vcDocumentInfos[i];
if (vcDocumentInfo.getVersion().getBranchID().equals(thisDocumentInfo.getVersion().getBranchID())) {
documentBranchList.add(vcDocumentInfo);
}
}
if (documentBranchList.size() == 0) {
PopupGenerator.showErrorDialog(this, "Error comparing BioModels : No Versions of document ");
return new VCDocumentInfo[0];
}
VCDocumentInfo[] vcDocumentInfosInBranch = new VCDocumentInfo[documentBranchList.size()];
documentBranchList.copyInto(vcDocumentInfosInBranch);
//
// From the versions list, remove the currently selected version and return the remaining list of
// versions for the biomodel
//
VCDocumentInfo[] revisedDocInfosInBranch = new VCDocumentInfo[vcDocumentInfosInBranch.length - 1];
int j = 0;
for (int i = 0; i < vcDocumentInfosInBranch.length; i++) {
if (!thisDocumentInfo.getVersion().getDate().equals(vcDocumentInfosInBranch[i].getVersion().getDate())) {
revisedDocInfosInBranch[j] = vcDocumentInfosInBranch[i];
j++;
}
}
return revisedDocInfosInBranch;
}
Aggregations