Search in sources :

Example 1 with DomainType

use of org.vcell.vcellij.api.DomainType in project vcell by virtualcell.

the class SimulationServiceImpl method getVariableList.

public List<VariableInfo> getVariableList(SimulationInfo simInfo) throws ThriftDataAccessException, TException {
    SimulationServiceContext simServiceContext = sims.get(simInfo.id);
    if (simServiceContext == null) {
        throw new ThriftDataAccessException("simulation results not found");
    }
    try {
        DataSetControllerImpl datasetController = getDataSetController(simServiceContext);
        OutputContext outputContext = new OutputContext(new AnnotatedFunction[0]);
        final DataIdentifier[] dataIdentifiers;
        try {
            dataIdentifiers = datasetController.getDataIdentifiers(outputContext, simServiceContext.vcDataIdentifier);
        } catch (IOException | DataAccessException e) {
            e.printStackTrace();
            throw new RuntimeException("failed to retrieve variable information: " + e.getMessage(), e);
        }
        ArrayList<VariableInfo> varInfos = new ArrayList<VariableInfo>();
        for (DataIdentifier dataIdentifier : dataIdentifiers) {
            final DomainType domainType;
            if (dataIdentifier.getVariableType().equals(VariableType.VOLUME)) {
                domainType = DomainType.VOLUME;
            } else if (dataIdentifier.getVariableType().equals(VariableType.MEMBRANE)) {
                domainType = DomainType.MEMBRANE;
            } else {
                continue;
            }
            String domainName = "";
            if (dataIdentifier.getDomain() != null) {
                domainName = dataIdentifier.getDomain().getName();
            }
            VariableInfo varInfo = new VariableInfo(dataIdentifier.getName(), dataIdentifier.getDisplayName(), domainName, domainType);
            varInfos.add(varInfo);
        }
        return varInfos;
    } catch (Exception e) {
        e.printStackTrace();
        throw new ThriftDataAccessException("failed to retrieve variable list: " + e.getMessage());
    }
}
Also used : VCSimulationDataIdentifier(cbit.vcell.solver.VCSimulationDataIdentifier) DataIdentifier(cbit.vcell.simdata.DataIdentifier) VariableInfo(org.vcell.vcellij.api.VariableInfo) ArrayList(java.util.ArrayList) IOException(java.io.IOException) OutputContext(cbit.vcell.simdata.OutputContext) XMLStreamException(javax.xml.stream.XMLStreamException) ThriftDataAccessException(org.vcell.vcellij.api.ThriftDataAccessException) SbmlException(org.vcell.sbml.SbmlException) SBMLException(org.sbml.jsbml.SBMLException) XmlParseException(cbit.vcell.xml.XmlParseException) SolverException(cbit.vcell.solver.SolverException) TException(org.apache.thrift.TException) IOException(java.io.IOException) DataAccessException(org.vcell.util.DataAccessException) DomainType(org.vcell.vcellij.api.DomainType) ThriftDataAccessException(org.vcell.vcellij.api.ThriftDataAccessException) DataSetControllerImpl(cbit.vcell.simdata.DataSetControllerImpl) ThriftDataAccessException(org.vcell.vcellij.api.ThriftDataAccessException) DataAccessException(org.vcell.util.DataAccessException)

Aggregations

DataIdentifier (cbit.vcell.simdata.DataIdentifier)1 DataSetControllerImpl (cbit.vcell.simdata.DataSetControllerImpl)1 OutputContext (cbit.vcell.simdata.OutputContext)1 SolverException (cbit.vcell.solver.SolverException)1 VCSimulationDataIdentifier (cbit.vcell.solver.VCSimulationDataIdentifier)1 XmlParseException (cbit.vcell.xml.XmlParseException)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 TException (org.apache.thrift.TException)1 SBMLException (org.sbml.jsbml.SBMLException)1 SbmlException (org.vcell.sbml.SbmlException)1 DataAccessException (org.vcell.util.DataAccessException)1 DomainType (org.vcell.vcellij.api.DomainType)1 ThriftDataAccessException (org.vcell.vcellij.api.ThriftDataAccessException)1 VariableInfo (org.vcell.vcellij.api.VariableInfo)1