use of java.beans.PropertyVetoException in project vcell by virtualcell.
the class ServerDocumentManager method getBioModelUnresolved.
/**
* Insert the method's description here.
* Creation date: (11/14/00 4:02:44 PM)
* @return cbit.vcell.biomodel.BioModel
* @param bioModelInfo cbit.vcell.biomodel.BioModelInfo
*/
//
// this returns a BioModel that contains multiple instances of objects.
//
public String getBioModelUnresolved(QueryHashtable dbc, User user, KeyValue bioModelKey) throws DataAccessException, XmlParseException, java.sql.SQLException {
//
// get meta data associated with BioModel
//
BioModelMetaData bioModelMetaData = dbServer.getDBTopLevel().getBioModelMetaData(dbc, user, bioModelKey);
//
// get list of appropriate child components
//
KeyValue modelKey = bioModelMetaData.getModelKey();
KeyValue[] simKeys = getKeyArrayFromEnumeration(bioModelMetaData.getSimulationKeys());
KeyValue[] scKeys = getKeyArrayFromEnumeration(bioModelMetaData.getSimulationContextKeys());
Model model = dbServer.getDBTopLevel().getModel(dbc, user, modelKey);
Simulation[] simArray = new Simulation[simKeys.length];
for (int i = 0; i < simKeys.length; i++) {
Simulation sim = dbServer.getDBTopLevel().getSimulation(dbc, user, simKeys[i]);
//
try {
simArray[i] = (Simulation) BeanUtils.cloneSerializable(sim);
} catch (Throwable e) {
e.printStackTrace(System.out);
throw new RuntimeException("exception cloning Simulation: " + e.getMessage());
}
}
SimulationContext[] scArray = new SimulationContext[scKeys.length];
for (int i = 0; i < scKeys.length; i++) {
SimulationContext sc = dbServer.getDBTopLevel().getSimulationContext(dbc, user, scKeys[i]);
//
try {
scArray[i] = (SimulationContext) BeanUtils.cloneSerializable(sc);
scArray[i].getModel().refreshDependencies();
scArray[i].refreshDependencies();
scArray[i].setModel(model);
} catch (Throwable e) {
e.printStackTrace(System.out);
throw new RuntimeException("exception cloning Application: " + e.getMessage());
}
if (!scArray[i].getModel().getKey().compareEqual(modelKey)) {
// throw new DataAccessException("simulationContext("+scKeys[i]+").model = "+scArray[i].getModel().getKey()+", BioModel.model = "+modelKey);
System.out.println("simulationContext(" + scKeys[i] + ").model = " + scArray[i].getModel().getKey() + ", BioModel.model = " + modelKey);
}
}
//
// create new BioModel according to loaded BioModelMetaData
//
BioModel newBioModel = new BioModel(bioModelMetaData.getVersion());
try {
// newBioModel.setMIRIAMAnnotation(bioModelMetaData.getMIRIAMAnnotation());
System.err.println("< < < < NEED TO GET VCMETADATA FROM METADATA TABLE ... METADATA IS EMPTY. > > > >");
newBioModel.setModel(model);
newBioModel.setSimulationContexts(scArray);
//
for (int i = 0; i < simArray.length; i++) {
boolean bMathFound = false;
for (int j = 0; j < scArray.length; j++) {
if (simArray[i].getMathDescription().getVersion().getVersionKey().compareEqual(scArray[j].getMathDescription().getVersion().getVersionKey())) {
simArray[i].setMathDescription(scArray[j].getMathDescription());
bMathFound = true;
break;
}
}
if (!bMathFound) {
System.out.println("<<<<WARNING>>>>> ClientDocumentManager.getBioModel(), Simulation " + simArray[i].getName() + " is orphaned, Math(" + simArray[i].getMathDescription().getName() + ") not found in Applications");
simArray = (Simulation[]) BeanUtils.removeElement(simArray, simArray[i]);
i--;
}
}
newBioModel.setSimulations(simArray);
} catch (java.beans.PropertyVetoException e) {
e.printStackTrace(System.out);
throw new DataAccessException("PropertyVetoException caught " + e.getMessage());
}
//
// The BioModel is no longer cloned because the reference to this BioModel is no longer returned to the calling method.
// the only possible side effect is the "BioModel:refreshDependencies()" method call.
// this will reconnect internal listeners and other transient fields, and is not going to harm the cache integrity.
//
// //
// // clone BioModel (so that children can't be corrupted in the cache)
// //
// try {
// newBioModel = (BioModel)BeanUtils.cloneSerializable(newBioModel);
// }catch (Exception e){
// e.printStackTrace(System.out);
// throw new DataAccessException("BioModel clone failed: "+e.getMessage());
// }
newBioModel.refreshDependencies();
//
return cbit.vcell.xml.XmlHelper.bioModelToXML(newBioModel);
}
use of java.beans.PropertyVetoException in project vcell by virtualcell.
the class SimulationContextDbDriver method getSimulationContextSQL.
/**
* getModel method comment.
*/
private SimulationContext getSimulationContextSQL(QueryHashtable dbc, Connection con, User user, KeyValue simContextKey) throws /*, ReactStepDbDriver reactStepDB*/
SQLException, DataAccessException, IllegalMappingException, PropertyVetoException {
SimulationContext simContext = null;
String sql;
Field[] f = { new cbit.sql.StarField(simContextTable), userTable.userid };
Table[] t = { simContextTable, userTable };
String condition = simContextTable.id.getQualifiedColName() + " = " + simContextKey + " AND " + simContextTable.ownerRef.getQualifiedColName() + " = " + userTable.id.getQualifiedColName();
sql = DatabasePolicySQL.enforceOwnershipSelect(user, f, t, (OuterJoin) null, condition, null, dbSyntax);
// System.out.println(sql);
Statement stmt = con.createStatement();
try {
ResultSet rset = stmt.executeQuery(sql);
if (rset.next()) {
simContext = simContextTable.getSimContext(dbc, con, user, rset, geomDB, modelDB, mathDescDB);
} else {
throw new ObjectNotFoundException("SimulationContext id=" + simContextKey + " not found for user '" + user + "'");
}
} finally {
stmt.close();
}
DataSymbolTable.table.populateDataSymbols(con, simContextKey, simContext.getDataContext(), user, simContext.getModel().getUnitSystem());
ArrayList<AnnotatedFunction> outputFunctionList = ApplicationMathTable.table.getOutputFunctionsSimcontext(con, simContextKey, dbSyntax);
if (outputFunctionList != null) {
OutputFunctionContext outputFnContext = simContext.getOutputFunctionContext();
outputFnContext.setOutputFunctions(outputFunctionList);
}
SimContextTable.table.readAppComponents(con, simContext, dbSyntax);
assignStimuliSQL(con, simContextKey, simContext);
assignStructureMappingsSQL(dbc, con, simContextKey, simContext);
assignSpeciesContextSpecsSQL(con, simContextKey, simContext);
assignReactionSpecsSQL(con, simContextKey, simContext);
for (GeometryClass gc : simContext.getGeometry().getGeometryClasses()) {
try {
StructureSizeSolver.updateUnitStructureSizes(simContext, gc);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
simContext.getGeometryContext().enforceHierarchicalBoundaryConditions(simContext.getModel().getStructureTopology());
simContext.getModel().refreshDependencies();
assignAnalysisTasksSQL(con, simContextKey, simContext);
// really needed to calculate MembraneMapping parameters that are not stored (inside/outside flux correction factors).
simContext.refreshDependencies();
return simContext;
}
use of java.beans.PropertyVetoException in project vcell by virtualcell.
the class SimulationContextDbDriver method assignAnalysisTasksSQL.
/**
* This method was created in VisualAge.
* @param simContext cbit.vcell.mapping.SimulationContext
*/
private void assignAnalysisTasksSQL(Connection con, KeyValue simContextKey, SimulationContext simContext) throws SQLException, DataAccessException {
String sql;
AnalysisTaskXMLTable analysisTaskTable = AnalysisTaskXMLTable.table;
sql = " SELECT " + analysisTaskTable.analysisTaskXML.toString() + " FROM " + analysisTaskTable.getTableName() + " WHERE " + analysisTaskTable.simContextRef + " = " + simContextKey + " ORDER BY " + // order-by to maintain order ... not really necessary
analysisTaskTable.insertDate;
Statement stmt = con.createStatement();
try {
ResultSet rset = stmt.executeQuery(sql);
while (rset.next()) {
String analysisXML = (String) getLOB(rset, analysisTaskTable.analysisTaskXML, dbSyntax);
org.jdom.Element rootElement = XmlUtil.stringToXML(analysisXML, null).getRootElement();
cbit.vcell.modelopt.ParameterEstimationTask parameterEstimationTask = cbit.vcell.modelopt.ParameterEstimationTaskXMLPersistence.getParameterEstimationTask(rootElement, simContext);
simContext.addAnalysisTask(parameterEstimationTask);
}
} catch (MathException | MappingException | PropertyVetoException | ExpressionException e) {
lg.error(e.getMessage(), e);
throw new DataAccessException(e.getMessage());
} finally {
if (stmt != null) {
stmt.close();
}
}
}
use of java.beans.PropertyVetoException in project Payara by payara.
the class JmsHostWrapper method deepCopy.
public ConfigBeanProxy deepCopy(ConfigBeanProxy proxy) {
JmsHostWrapper clone = new JmsHostWrapper();
if (!(proxy instanceof JmsHost))
return null;
JmsHost host = (JmsHost) proxy;
try {
clone.setHost(host.getHost());
clone.setPort(host.getPort());
clone.setName(host.getName());
clone.setAdminPassword(host.getAdminPassword());
clone.setAdminUserName(host.getAdminUserName());
} catch (PropertyVetoException e) {
// todo : handle this exception
}
return null;
}
use of java.beans.PropertyVetoException in project Payara by payara.
the class SetEnvironmentWarningConfigurationCommand method execute.
@Override
public void execute(AdminCommandContext acc) {
Config config = targetUtil.getConfig(target);
ActionReport actionReport = acc.getActionReport();
EnvironmentWarningConfiguration environmentWarningConfiguration = config.getExtensionByType(EnvironmentWarningConfiguration.class);
if (environmentWarningConfiguration != null) {
try {
ConfigSupport.apply(new SingleConfigCode<EnvironmentWarningConfiguration>() {
@Override
public Object run(EnvironmentWarningConfiguration config) throws PropertyVetoException {
if (enabled != null) {
config.setEnabled(enabled);
}
if (message != null) {
config.setMessage(message);
}
if (backgroundColour != null) {
if (backgroundColour.matches("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")) {
config.setBackgroundColour(backgroundColour);
} else {
throw new PropertyVetoException("Invalid data for background colour, must be a hex value.", new PropertyChangeEvent(config, "backgroundColour", config.getBackgroundColour(), backgroundColour));
}
}
if (textColour != null) {
if (textColour.matches("^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$")) {
config.setTextColour(textColour);
} else {
throw new PropertyVetoException("Invalid data for text colour, must be a hex value.", new PropertyChangeEvent(config, "textColour", config.getTextColour(), textColour));
}
}
return null;
}
}, environmentWarningConfiguration);
} catch (TransactionFailure ex) {
// Set failure
actionReport.failure(Logger.getLogger(SetEnvironmentWarningConfigurationCommand.class.getName()), "Failed to update configuration", ex);
}
}
}
Aggregations