use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class BioModelEditor method setRightBottomPanelOnSelection.
@Override
protected void setRightBottomPanelOnSelection(Object[] selections) {
if (selections == null) {
return;
}
JComponent bottomComponent = rightBottomEmptyPanel;
int destComponentIndex = DocumentEditorTabID.object_properties.ordinal();
boolean bShowInDatabaseProperties = false;
boolean bShowPathway = false;
if (selections.length == 1) {
Object singleSelection = selections[0];
if (singleSelection instanceof ReactionStep) {
bottomComponent = getReactionPropertiesPanel();
} else if (singleSelection instanceof ReactionRule) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (singleSelection instanceof SpeciesContext) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (singleSelection instanceof MolecularType) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (singleSelection instanceof RbmObservable) {
bottomComponent = getObservablePropertiesPanel();
} else if (singleSelection instanceof Structure) {
bottomComponent = getStructurePropertiesPanel();
getStructurePropertiesPanel().setModel(bioModel.getModel());
} else if (singleSelection instanceof Parameter) {
bottomComponent = getParameterPropertiesPanel();
} else if (singleSelection instanceof SimulationContext) {
bottomComponent = getApplicationPropertiesPanel();
} else if (singleSelection instanceof ParameterEstimationTask) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
} else if (singleSelection instanceof Product || singleSelection instanceof Reactant) {
bottomComponent = getReactionParticipantPropertiesPanel();
} else if (singleSelection instanceof BioModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = bioModelMetaDataPanel;
} else if (singleSelection instanceof MathModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = mathModelMetaDataPanel;
} else if (singleSelection instanceof GeometryInfo) {
bShowInDatabaseProperties = true;
bottomComponent = geometryMetaDataPanel;
} else if (singleSelection instanceof SpeciesContextSpec) {
bottomComponent = getSpeciesContextSpecPanel();
} else if (singleSelection instanceof ReactionSpec) {
bottomComponent = getKineticsTypeTemplatePanel();
} else if (singleSelection instanceof ReactionRuleSpec) {
//
bottomComponent = getReactionRuleSpecPropertiesPanel();
} else if (singleSelection instanceof BioModelsNetModelInfo) {
bShowInDatabaseProperties = true;
bottomComponent = getBioModelsNetPropertiesPanel();
} else if (singleSelection instanceof Simulation) {
bottomComponent = getSimulationSummaryPanel();
} else if (singleSelection instanceof DataSymbol) {
bottomComponent = getDataSymbolsSpecPanel();
} else if (singleSelection instanceof BioEvent) {
bottomComponent = getEventPanel();
} else if (singleSelection instanceof SpatialObject) {
bottomComponent = getSpatialObjectPropertyPanel();
} else if (singleSelection instanceof SpatialProcess) {
bottomComponent = getSpatialProcessPropertyPanel();
} else if (singleSelection instanceof BioPaxObject) {
bottomComponent = bioPaxObjectPropertiesPanel;
} else if (singleSelection instanceof BioModel || singleSelection instanceof VCMetaData) {
bottomComponent = bioModelEditorAnnotationPanel;
} else if (singleSelection instanceof PathwayData) {
bShowPathway = true;
bottomComponent = getBioModelEditorPathwayPanel();
} else if (singleSelection instanceof Model) {
} else if (singleSelection instanceof RuleParticipantSignature) {
bottomComponent = getReactionRuleParticipantSignaturePropertiesPanel();
} else if (singleSelection instanceof CSGObject) {
bottomComponent = csgObjectPropertiesPanel;
csgObjectPropertiesPanel.setSimulationContext(getSelectedSimulationContext());
} else if (singleSelection instanceof DocumentEditorTreeFolderNode) {
DocumentEditorTreeFolderClass folderClass = ((DocumentEditorTreeFolderNode) singleSelection).getFolderClass();
if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && !(singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionPropertiesPanel();
} else if ((folderClass == DocumentEditorTreeFolderClass.REACTIONS_NODE) && (singleSelection instanceof ReactionRule)) {
bottomComponent = getReactionRulePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.STRUCTURES_NODE) {
bottomComponent = getStructurePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.SPECIES_NODE) {
bottomComponent = getSpeciesPropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.MOLECULAR_TYPES_NODE) {
bottomComponent = getMolecularTypePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.OBSERVABLES_NODE) {
bottomComponent = getObservablePropertiesPanel();
} else if (folderClass == DocumentEditorTreeFolderClass.APPLICATIONS_NODE) {
bottomComponent = getApplicationsPropertiesPanel();
getApplicationsPropertiesPanel().setBioModel(bioModel);
} else if (folderClass == DocumentEditorTreeFolderClass.PARAMETER_ESTIMATION_NODE) {
bottomComponent = parameterEstimationTaskPropertiesPanel;
}
}
}
if (bShowPathway) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) == bottomComponent) {
break;
}
}
String tabTitle = "Pathway Preview";
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(tabTitle, new TabCloseIcon(), bottomComponent);
}
} else if (bShowInDatabaseProperties) {
for (destComponentIndex = 0; destComponentIndex < rightBottomTabbedPane.getTabCount(); destComponentIndex++) {
Component c = rightBottomTabbedPane.getComponentAt(destComponentIndex);
if (c == bioModelMetaDataPanel || c == mathModelMetaDataPanel || c == geometryMetaDataPanel || c == getBioModelsNetPropertiesPanel()) {
break;
}
}
if (rightBottomTabbedPane.getTabCount() == destComponentIndex) {
rightBottomTabbedPane.addTab(DATABASE_PROPERTIES_TAB_TITLE, new TabCloseIcon(), bottomComponent);
}
}
if (rightBottomTabbedPane.getComponentAt(destComponentIndex) != bottomComponent) {
bottomComponent.setBorder(GuiConstants.TAB_PANEL_BORDER);
rightBottomTabbedPane.setComponentAt(destComponentIndex, bottomComponent);
rightSplitPane.repaint();
}
if (rightBottomTabbedPane.getSelectedComponent() != bottomComponent) {
rightBottomTabbedPane.setSelectedComponent(bottomComponent);
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DatabaseWindowPanel method dbTreePanelActionPerformed.
private void dbTreePanelActionPerformed(java.awt.event.ActionEvent e) {
String actionCommand = e.getActionCommand();
if (actionCommand.equals("Open") || actionCommand.equals(DatabaseWindowManager.BM_MM_GM_DOUBLE_CLICK_ACTION)) {
// check to see if open in new or this window
BioModelEditor bioModelEditor = null;
Container c = this;
while (c != null) {
if (c instanceof BioModelEditor) {
bioModelEditor = (BioModelEditor) c;
break;
}
c = c.getParent();
}
if (bioModelEditor != null && getSelectedDocumentInfo() instanceof BioModelInfo) {
if (bioModelEditor.getBioModelWindowManager().hasBlankDocument()) {
getDatabaseWindowManager().openSelected(bioModelEditor.getBioModelWindowManager(), false);
} else {
getDatabaseWindowManager().openSelected(bioModelEditor.getBioModelWindowManager(), true);
}
} else {
getDatabaseWindowManager().openSelected();
}
} else if (actionCommand.equals("Delete")) {
getDatabaseWindowManager().deleteSelected();
} else if (actionCommand.equals("Permission")) {
getDatabaseWindowManager().accessPermissions();
} else if (actionCommand.equals("Export")) {
getDatabaseWindowManager().exportDocument();
} else if (actionCommand.equals("Latest Edition")) {
getDatabaseWindowManager().compareLatestEdition();
} else if (actionCommand.equals("Previous Edition")) {
getDatabaseWindowManager().comparePreviousEdition();
} else if (actionCommand.equals("Another Edition...")) {
getDatabaseWindowManager().compareAnotherEdition();
} else if (actionCommand.equals("Another Model...")) {
getDatabaseWindowManager().compareAnotherModel();
} else if (actionCommand.equals("Models Using Geometry")) {
getDatabaseWindowManager().findModelsUsingSelectedGeometry();
} else if (actionCommand.equals("Archive")) {
getDatabaseWindowManager().archive();
} else if (actionCommand.equals("Publish")) {
getDatabaseWindowManager().publish();
} else if (actionCommand.equals(NEW_GEOMETRY)) {
getDatabaseWindowManager().createNewGeometry();
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class DatabaseWindowPanel method currentDocumentInfo.
/**
* Comment
*/
private void currentDocumentInfo() {
VCDocumentInfo selectedDocInfo = null;
switch(getJTabbedPane1().getSelectedIndex()) {
case 0:
{
// VCDocumentType.BIOMODEL_DOC
selectedDocInfo = (BioModelInfo) getBioModelDbTreePanel1().getSelectedVersionInfo();
break;
}
case 1:
{
// VCDocumentType.MATHMODEL_DOC
selectedDocInfo = (MathModelInfo) getMathModelDbTreePanel1().getSelectedVersionInfo();
break;
}
case 2:
{
// VCDocumentType.GEOMETRY_DOC
selectedDocInfo = (GeometryInfo) getGeometryTreePanel1().getSelectedVersionInfo();
break;
}
}
setSelectedDocumentInfo(selectedDocInfo);
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class MathVerifier method testDocumentLoad.
private void testDocumentLoad(boolean bUpdateDatabase, User user, VCDocumentInfo documentInfo, VCDocument vcDocumentFromDBCache) {
KeyValue versionKey = documentInfo.getVersion().getVersionKey();
// try{
// String vcDocumentXMLFromDBCacheRoundtrip = null;
// Compare self same
Exception bSameCachedAndNotCachedXMLExc = null;
Exception bSameCachedAndNotCachedObjExc = null;
Exception bSameSelfXMLCachedRoundtripExc = null;
Boolean bSameCachedAndNotCachedXML = null;
Boolean bSameCachedAndNotCachedObj = null;
Boolean bSameSelfCachedRoundtrip = null;
// Boolean bSameSelfObjCachedRoundTrip = null;
long startTime = 0;
// Long compareXMLTime = null;
// Long compareObjTime = null;
// Long loadOriginalXMLTime = null;
Long loadUnresolvedTime = null;
if (documentInfo instanceof BioModelInfo) {
Level existingLogLevel = VCMLComparator.getLogLevel();
try {
String xmlRndTrip0 = XmlHelper.bioModelToXML((BioModel) vcDocumentFromDBCache);
BioModel bioModelRndTrip0 = XmlHelper.XMLToBioModel(new XMLSource(xmlRndTrip0));
String xmlRndTrip1 = XmlHelper.bioModelToXML((BioModel) bioModelRndTrip0);
BioModel bioModelRndTrip1 = XmlHelper.XMLToBioModel(new XMLSource(xmlRndTrip1));
if (Compare.logger != null) {
Compare.loggingEnabled = true;
VCMLComparator.setLogLevel(Level.DEBUG);
}
bSameSelfCachedRoundtrip = VCMLComparator.compareEquals(xmlRndTrip0, xmlRndTrip1, true);
System.out.println("----------XML same=" + bSameSelfCachedRoundtrip);
boolean objectSame = bioModelRndTrip0.compareEqual(bioModelRndTrip1);
System.out.println("----------Objects same=" + objectSame);
bSameSelfCachedRoundtrip = bSameSelfCachedRoundtrip && objectSame;
} catch (Exception e) {
bSameSelfCachedRoundtrip = null;
lg.error(e.getMessage(), e);
bSameSelfXMLCachedRoundtripExc = e;
} finally {
Compare.loggingEnabled = false;
VCMLComparator.setLogLevel(existingLogLevel);
}
String fromDBBioModelUnresolvedXML = null;
try {
startTime = System.currentTimeMillis();
fromDBBioModelUnresolvedXML = dbServerImpl.getServerDocumentManager().getBioModelUnresolved(new QueryHashtable(), user, versionKey);
BioModel vcDocumentFromDBNotCached = XmlHelper.XMLToBioModel(new XMLSource(fromDBBioModelUnresolvedXML));
loadUnresolvedTime = System.currentTimeMillis() - startTime;
bSameCachedAndNotCachedObj = vcDocumentFromDBCache.compareEqual(vcDocumentFromDBNotCached);
} catch (Exception e) {
lg.error(e.getMessage(), e);
bSameCachedAndNotCachedObjExc = e;
}
if (fromDBBioModelUnresolvedXML != null) {
try {
String vcDocumentXMLFromDBCacheRegenerate = XmlHelper.bioModelToXML((BioModel) vcDocumentFromDBCache);
bSameCachedAndNotCachedXML = VCMLComparator.compareEquals(vcDocumentXMLFromDBCacheRegenerate, fromDBBioModelUnresolvedXML, true);
} catch (Exception e) {
lg.error(e.getMessage(), e);
bSameCachedAndNotCachedXMLExc = e;
}
}
} else {
Level existingLogLevel = VCMLComparator.getLogLevel();
try {
String xmlRndTrip0 = XmlHelper.mathModelToXML((MathModel) vcDocumentFromDBCache);
MathModel mathModelRndTrip0 = XmlHelper.XMLToMathModel(new XMLSource(xmlRndTrip0));
String xmlRndTrip1 = XmlHelper.mathModelToXML((MathModel) mathModelRndTrip0);
MathModel mathModelRndTrip1 = XmlHelper.XMLToMathModel(new XMLSource(xmlRndTrip1));
if (Compare.logger != null) {
Compare.loggingEnabled = true;
VCMLComparator.setLogLevel(Level.DEBUG);
}
bSameSelfCachedRoundtrip = VCMLComparator.compareEquals(xmlRndTrip0, xmlRndTrip1, true);
bSameSelfCachedRoundtrip = bSameSelfCachedRoundtrip && mathModelRndTrip0.compareEqual(mathModelRndTrip1);
} catch (Exception e) {
bSameSelfCachedRoundtrip = null;
lg.error(e.getMessage(), e);
bSameSelfXMLCachedRoundtripExc = e;
} finally {
Compare.loggingEnabled = false;
VCMLComparator.setLogLevel(existingLogLevel);
}
String fromDBMathModelUnresolvedXML = null;
try {
startTime = System.currentTimeMillis();
MathModel vcDocumentFromDBNotCached = dbServerImpl.getServerDocumentManager().getMathModelUnresolved(new QueryHashtable(), user, versionKey);
loadUnresolvedTime = System.currentTimeMillis() - startTime;
fromDBMathModelUnresolvedXML = XmlHelper.mathModelToXML(vcDocumentFromDBNotCached);
bSameCachedAndNotCachedObj = vcDocumentFromDBCache.compareEqual(vcDocumentFromDBNotCached);
} catch (Exception e) {
lg.error(e.getMessage(), e);
bSameCachedAndNotCachedObjExc = e;
}
if (fromDBMathModelUnresolvedXML != null) {
try {
String vcDocumentXMLFromDBCacheRegenerate = XmlHelper.mathModelToXML((MathModel) vcDocumentFromDBCache);
bSameCachedAndNotCachedXML = VCMLComparator.compareEquals(vcDocumentXMLFromDBCacheRegenerate, fromDBMathModelUnresolvedXML, true);
} catch (Exception e) {
lg.error(e.getMessage(), e);
bSameCachedAndNotCachedXMLExc = e;
}
}
}
if (bUpdateDatabase) {
updateLoadModelsStatTable_CompareTest(versionKey, null, /*loadOriginalXMLTime*/
loadUnresolvedTime, bSameCachedAndNotCachedXML, bSameCachedAndNotCachedObj, bSameSelfCachedRoundtrip, bSameCachedAndNotCachedXMLExc, bSameCachedAndNotCachedObjExc, bSameSelfXMLCachedRoundtripExc);
} else {
System.out.println("loadOriginalXMLTime=" + null + /*loadOriginalXMLTime*/
" loadUnresolvedTime=" + loadUnresolvedTime);
System.out.println("bSameCachedAndNotCachedXML=" + bSameCachedAndNotCachedXML + " bSameCachedAndNotCachedObj=" + bSameCachedAndNotCachedObj + " bSameSelfXMLCachedRoundtrip=" + bSameSelfCachedRoundtrip);
System.out.println("bSameCachedAndNotCachedXMLExc=" + bSameCachedAndNotCachedXMLExc + "\nbSameCachedAndNotCachedObjExc=" + bSameCachedAndNotCachedObjExc + "\nbSameSelfXMLCachedRoundtripExc=" + bSameSelfXMLCachedRoundtripExc);
System.out.println();
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class MathVerifier method scan.
/**
* Insert the method's description here.
* Creation date: (2/2/01 3:40:29 PM)
*/
public void scan(User[] users, boolean bUpdateDatabase, KeyValue[] bioAndMathModelKeys) throws MathException, MappingException, SQLException, DataAccessException, ModelException, ExpressionException {
// java.util.Calendar calendar = java.util.GregorianCalendar.getInstance();
// // calendar.set(2002,java.util.Calendar.MAY,7+1);
// calendar.set(2002,java.util.Calendar.JULY,1);
// final java.util.Date fluxCorrectionOrDisablingBugFixDate = calendar.getTime();
// // calendar.set(2001,java.util.Calendar.JUNE,13+1);
// calendar.set(2002,java.util.Calendar.JANUARY,1);
// final java.util.Date totalVolumeCorrectionFixDate = calendar.getTime();
KeyValue[] sortedBioAndMathModelKeys = null;
if (bioAndMathModelKeys != null) {
sortedBioAndMathModelKeys = bioAndMathModelKeys.clone();
Arrays.sort(sortedBioAndMathModelKeys, keyValueCpmparator);
}
for (int i = 0; i < users.length; i++) {
User user = users[i];
BioModelInfo[] bioModelInfos0 = dbServerImpl.getBioModelInfos(user, false);
MathModelInfo[] mathModelInfos0 = dbServerImpl.getMathModelInfos(user, false);
if (lg.isTraceEnabled())
lg.trace("Testing user '" + user + "'");
Vector<VCDocumentInfo> userBioAndMathModelInfoV = new Vector<VCDocumentInfo>();
userBioAndMathModelInfoV.addAll(Arrays.asList(bioModelInfos0));
userBioAndMathModelInfoV.addAll(Arrays.asList(mathModelInfos0));
//
for (int j = 0; j < userBioAndMathModelInfoV.size(); j++) {
//
// if certain Bio or Math models are requested, then filter all else out
//
VCDocumentInfo documentInfo = userBioAndMathModelInfoV.elementAt(j);
KeyValue versionKey = documentInfo.getVersion().getVersionKey();
if (sortedBioAndMathModelKeys != null) {
int srch = Arrays.binarySearch(sortedBioAndMathModelKeys, versionKey, keyValueCpmparator);
if (srch < 0) {
continue;
}
}
if (!(documentInfo instanceof BioModelInfo)) {
continue;
}
//
if (skipHash.contains(versionKey)) {
System.out.println("skipping " + (documentInfo instanceof BioModelInfo ? "BioModel" : "MathModel") + " with key '" + versionKey + "'");
continue;
}
try {
//
// read in the BioModel and MathModel from the database
//
VCDocument vcDocumentFromDBCache = null;
BigString vcDocumentXMLFromDBCache = null;
try {
long startTime = System.currentTimeMillis();
if (documentInfo instanceof BioModelInfo) {
vcDocumentXMLFromDBCache = new BigString(dbServerImpl.getServerDocumentManager().getBioModelXML(new QueryHashtable(), user, versionKey, false));
vcDocumentFromDBCache = XmlHelper.XMLToBioModel(new XMLSource(vcDocumentXMLFromDBCache.toString()));
} else {
vcDocumentXMLFromDBCache = new BigString(dbServerImpl.getServerDocumentManager().getMathModelXML(new QueryHashtable(), user, versionKey, false));
vcDocumentFromDBCache = XmlHelper.XMLToMathModel(new XMLSource(vcDocumentXMLFromDBCache.toString()));
}
if (bUpdateDatabase && testFlag.equals(MathVerifier.MV_LOAD_XML)) {
updateLoadModelsStatTable_LoadTest(System.currentTimeMillis() - startTime, versionKey, null);
}
} catch (Exception e) {
lg.error(e.getMessage(), e);
if (bUpdateDatabase && testFlag.equals(MathVerifier.MV_LOAD_XML)) {
updateLoadModelsStatTable_LoadTest(0, versionKey, e);
}
}
if (testFlag.equals(MathVerifier.MV_LOAD_XML)) {
//
if (vcDocumentXMLFromDBCache != null) {
testDocumentLoad(bUpdateDatabase, user, documentInfo, vcDocumentFromDBCache);
}
} else if (testFlag.equals(MathVerifier.MV_DEFAULT)) {
//
if (vcDocumentFromDBCache instanceof BioModel) {
BioModel bioModel = (BioModel) vcDocumentFromDBCache;
checkMathForBioModel(vcDocumentXMLFromDBCache, bioModel, user, bUpdateDatabase);
}
}
} catch (Throwable e) {
// exception in whole BioModel
lg.error(e.getMessage(), e);
// can't update anything in database, since we don't know what simcontexts are involved
}
}
}
}
Aggregations