Search in sources :

Example 6 with MathModelInfo

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

the class TestingFrameworkWindowManager method updateTestCriteria.

/**
 * Insert the method's description here.
 * Creation date: (4/9/2003 1:31:08 PM)
 * @return cbit.vcell.numericstestingframework.TestSuiteInfo
 */
public void updateTestCriteria(TestCriteriaNew origTestCriteria, TestCriteriaNew newTestCriteria) throws DataAccessException {
    EditTestCriteriaOP testCriteriaOP = null;
    if (newTestCriteria instanceof TestCriteriaNewMathModel) {
        MathModelInfo regrMMInfo = ((TestCriteriaNewMathModel) newTestCriteria).getRegressionMathModelInfo();
        SimulationInfo regrsimInfo = ((TestCriteriaNewMathModel) newTestCriteria).getRegressionSimInfo();
        testCriteriaOP = new EditTestCriteriaOPMathModel(origTestCriteria.getTCritKey(), (regrMMInfo != null ? regrMMInfo.getVersion().getVersionKey() : null), (regrsimInfo != null ? regrsimInfo.getVersion().getVersionKey() : null), newTestCriteria.getMaxAbsError(), newTestCriteria.getMaxRelError());
    } else if (newTestCriteria instanceof TestCriteriaNewBioModel) {
        BioModelInfo regrBMInfo = ((TestCriteriaNewBioModel) newTestCriteria).getRegressionBioModelInfo();
        SimulationInfo regrsimInfo = ((TestCriteriaNewBioModel) newTestCriteria).getRegressionSimInfo();
        testCriteriaOP = new EditTestCriteriaOPBioModel(origTestCriteria.getTCritKey(), (regrBMInfo != null ? regrBMInfo.getVersion().getVersionKey() : null), (regrsimInfo != null ? regrsimInfo.getVersion().getVersionKey() : null), newTestCriteria.getMaxAbsError(), newTestCriteria.getMaxRelError());
    }
    getRequestManager().getDocumentManager().doTestSuiteOP(testCriteriaOP);
    RemoveTestResultsOP removeTestResults = new RemoveTestResultsOP(new BigDecimal[] { origTestCriteria.getTCritKey() });
    getRequestManager().getDocumentManager().doTestSuiteOP(removeTestResults);
}
Also used : EditTestCriteriaOPMathModel(cbit.vcell.numericstest.EditTestCriteriaOPMathModel) TestCriteriaNewMathModel(cbit.vcell.numericstest.TestCriteriaNewMathModel) TestCriteriaNewBioModel(cbit.vcell.numericstest.TestCriteriaNewBioModel) EditTestCriteriaOP(cbit.vcell.numericstest.EditTestCriteriaOP) BioModelInfo(org.vcell.util.document.BioModelInfo) EditTestCriteriaOPBioModel(cbit.vcell.numericstest.EditTestCriteriaOPBioModel) MathModelInfo(org.vcell.util.document.MathModelInfo) RemoveTestResultsOP(cbit.vcell.numericstest.RemoveTestResultsOP) SimulationInfo(cbit.vcell.solver.SimulationInfo)

Example 7 with MathModelInfo

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

the class TopLevelWindowManager method selectOpenModelsFromDesktop.

public static OpenModelInfoHolder selectOpenModelsFromDesktop(Container requester, RequestManager requestManager, boolean bIncludeSimulations, String title, boolean bExcludeCompartmental) throws UserCancelException, DataAccessException {
    try {
        BeanUtils.setCursorThroughout(requester, Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        OpenModelInfoHolder[] simInfoHolders = requestManager.getOpenDesktopDocumentInfos(bIncludeSimulations);
        if (simInfoHolders == null || simInfoHolders.length == 0) {
            return null;
        }
        String[] colNames = null;
        if (bIncludeSimulations) {
            colNames = new String[] { "Simulation", "Scan Index", "Model", "Type", "Application", "Owner", "Date" };
        } else {
            colNames = new String[] { "Model", "Type", "Application", "Owner", "Date" };
        }
        Vector<String[]> rowsV = new Vector<String[]>();
        Vector<OpenModelInfoHolder> simInfoHolderV = new Vector<OpenModelInfoHolder>();
        for (int i = 0; i < simInfoHolders.length; i += 1) {
            if (bExcludeCompartmental && simInfoHolders[i].isCompartmental) {
                continue;
            }
            String[] rows = new String[colNames.length];
            int colIndex = 0;
            if (simInfoHolders[i] instanceof FDSimMathModelInfo) {
                MathModelInfo mmInfo = null;
                if (((FDSimMathModelInfo) simInfoHolders[i]).getMathModelVersion() != null) {
                    mmInfo = requestManager.getDocumentManager().getMathModelInfo(((FDSimMathModelInfo) simInfoHolders[i]).getMathModelVersion().getVersionKey());
                }
                if (bIncludeSimulations) {
                    rows[colIndex++] = simInfoHolders[i].getSimName();
                    rows[colIndex++] = simInfoHolders[i].jobIndex + "";
                }
                rows[colIndex++] = (mmInfo == null ? "New Document" : mmInfo.getVersion().getName());
                rows[colIndex++] = "MathModel";
                rows[colIndex++] = "";
                rows[colIndex++] = (simInfoHolders[i].simInfo == null ? "never saved" : simInfoHolders[i].simInfo.getOwner().getName());
                rows[colIndex++] = (mmInfo == null ? "never saved" : mmInfo.getVersion().getDate().toString());
            } else if (simInfoHolders[i] instanceof FDSimBioModelInfo) {
                BioModelInfo bmInfo = null;
                if (((FDSimBioModelInfo) simInfoHolders[i]).getBioModelVersion() != null) {
                    bmInfo = requestManager.getDocumentManager().getBioModelInfo(((FDSimBioModelInfo) simInfoHolders[i]).getBioModelVersion().getVersionKey());
                }
                if (bIncludeSimulations) {
                    rows[colIndex++] = simInfoHolders[i].getSimName();
                    rows[colIndex++] = simInfoHolders[i].jobIndex + "";
                }
                rows[colIndex++] = (bmInfo == null ? "New Document" : bmInfo.getVersion().getName());
                rows[colIndex++] = "BioModel";
                rows[colIndex++] = ((FDSimBioModelInfo) simInfoHolders[i]).getSimulationContext().getName();
                rows[colIndex++] = (simInfoHolders[i].simInfo == null ? "never saved" : simInfoHolders[i].simInfo.getOwner().getName());
                rows[colIndex++] = (bmInfo == null ? "never saved" : bmInfo.getVersion().getDate().toString());
            }
            rowsV.add(rows);
            simInfoHolderV.add(simInfoHolders[i]);
        }
        if (rowsV.size() == 0) {
            return null;
        }
        String[][] rows = new String[rowsV.size()][];
        rowsV.copyInto(rows);
        BeanUtils.setCursorThroughout(requester, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
        int[] selectionIndexArr = PopupGenerator.showComponentOKCancelTableList(requester, title, colNames, rows, ListSelectionModel.SINGLE_SELECTION);
        if (selectionIndexArr != null && selectionIndexArr.length > 0) {
            // simInfoHolders[selectionIndexArr[0]];
            return simInfoHolderV.elementAt(selectionIndexArr[0]);
        }
        throw UserCancelException.CANCEL_GENERIC;
    } finally {
        BeanUtils.setCursorThroughout(requester, Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    }
}
Also used : BioModelInfo(org.vcell.util.document.BioModelInfo) MathModelInfo(org.vcell.util.document.MathModelInfo) Vector(java.util.Vector)

Example 8 with MathModelInfo

use of org.vcell.util.document.MathModelInfo 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 MathModel saveAsNew(MathModel mathModel, java.lang.String newName, String[] independentSims) throws DataAccessException {
    try {
        String mathModelXML = null;
        try {
            mathModelXML = XmlHelper.mathModelToXML(mathModel);
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        // System.out.println(mathModelXML);
        String savedMathModelXML = sessionManager.getUserMetaDbServer().saveMathModelAs(new BigString(mathModelXML), newName, independentSims).toString();
        MathModel savedMathModel = getMathModelFromDatabaseXML(new XMLHolder<MathModel>(savedMathModelXML));
        KeyValue savedKey = savedMathModel.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedMathModelXML);
        }
        MathModelInfo savedMathModelInfo = new MathModelInfo(savedMathModel.getVersion(), savedMathModel.getMathDescription().getKey(), savedMathModel.createMathModelChildSummary(), VCellSoftwareVersion.fromSystemProperty());
        mathModelInfoHash.put(savedKey, savedMathModelInfo);
        updateGeometryRelatedHashes(savedMathModel.getMathDescription().getGeometry());
        fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedMathModelInfo));
        return savedMathModel;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) KeyValue(org.vcell.util.document.KeyValue) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) MathModelInfo(org.vcell.util.document.MathModelInfo) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 9 with MathModelInfo

use of org.vcell.util.document.MathModelInfo 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 MathModel save(MathModel mathModel, String[] independentSims) throws DataAccessException {
    try {
        String mathModelXML = null;
        try {
            mathModelXML = XmlHelper.mathModelToXML(mathModel);
            if (LG.isInfoEnabled()) {
                LG.info(XmlUtil.beautify(mathModelXML));
            }
        } catch (XmlParseException e) {
            e.printStackTrace(System.out);
            throw new DataAccessException(e.getMessage());
        }
        String savedMathModelXML = sessionManager.getUserMetaDbServer().saveMathModel(new BigString(mathModelXML), independentSims).toString();
        MathModel savedMathModel = getMathModelFromDatabaseXML(new XMLHolder<MathModel>(savedMathModelXML));
        if (LG.isInfoEnabled()) {
            LG.info(XmlUtil.beautify(savedMathModelXML));
        }
        KeyValue savedKey = savedMathModel.getVersion().getVersionKey();
        if (xmlHash.get(savedKey) == null) {
            xmlHash.put(savedKey, savedMathModelXML);
        }
        MathModelInfo savedMathModelInfo = new MathModelInfo(savedMathModel.getVersion(), savedMathModel.getMathDescription().getKey(), savedMathModel.createMathModelChildSummary(), VCellSoftwareVersion.fromSystemProperty());
        mathModelInfoHash.put(savedKey, savedMathModelInfo);
        updateGeometryRelatedHashes(savedMathModel.getMathDescription().getGeometry());
        fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedMathModelInfo));
        return savedMathModel;
    } catch (RemoteProxyException e) {
        e.printStackTrace(System.out);
        throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
    }
}
Also used : MathModel(cbit.vcell.mathmodel.MathModel) KeyValue(org.vcell.util.document.KeyValue) BigString(org.vcell.util.BigString) XmlParseException(cbit.vcell.xml.XmlParseException) MathModelInfo(org.vcell.util.document.MathModelInfo) BigString(org.vcell.util.BigString) DataAccessException(org.vcell.util.DataAccessException) RemoteProxyException(cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)

Example 10 with MathModelInfo

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

the class ClientDocumentManager method removeUserFromGroup.

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

Aggregations

MathModelInfo (org.vcell.util.document.MathModelInfo)67 BioModelInfo (org.vcell.util.document.BioModelInfo)37 DataAccessException (org.vcell.util.DataAccessException)32 GeometryInfo (cbit.vcell.geometry.GeometryInfo)22 VCDocumentInfo (org.vcell.util.document.VCDocumentInfo)14 MathModel (cbit.vcell.mathmodel.MathModel)12 Vector (java.util.Vector)11 BioModel (cbit.vcell.biomodel.BioModel)10 KeyValue (org.vcell.util.document.KeyValue)10 RemoteProxyException (cbit.vcell.message.server.bootstrap.client.RemoteProxyVCellConnectionFactory.RemoteProxyException)8 Hashtable (java.util.Hashtable)8 ObjectNotFoundException (org.vcell.util.ObjectNotFoundException)8 User (org.vcell.util.document.User)8 Simulation (cbit.vcell.solver.Simulation)7 UserCancelException (org.vcell.util.UserCancelException)7 Geometry (cbit.vcell.geometry.Geometry)6 SimulationContext (cbit.vcell.mapping.SimulationContext)6 TestCriteriaNewBioModel (cbit.vcell.numericstest.TestCriteriaNewBioModel)6 TestCriteriaNewMathModel (cbit.vcell.numericstest.TestCriteriaNewMathModel)6 SimulationInfo (cbit.vcell.solver.SimulationInfo)6