use of org.vcell.util.document.KeyValue 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());
}
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class ExportServiceImpl method fireExportCompleted.
/**
* Insert the method's description here.
* Creation date: (4/1/2001 11:20:45 AM)
* @deprecated
*/
protected ExportEvent fireExportCompleted(long jobID, VCDataIdentifier vcdID, String format, String location, ExportSpecs exportSpecs) {
User user = null;
Object object = jobRequestIDs.get(new Long(jobID));
if (object != null) {
user = (User) object;
}
TimeSpecs timeSpecs = (exportSpecs != null) ? exportSpecs.getTimeSpecs() : (null);
VariableSpecs varSpecs = (exportSpecs != null) ? exportSpecs.getVariableSpecs() : (null);
final KeyValue dataKey;
if (vcdID instanceof VCSimulationDataIdentifier) {
dataKey = ((VCSimulationDataIdentifier) vcdID).getSimulationKey();
} else if (vcdID instanceof ExternalDataIdentifier) {
dataKey = ((ExternalDataIdentifier) vcdID).getSimulationKey();
} else {
throw new RuntimeException("unexpected VCDataIdentifier");
}
ExportEvent event = new ExportEvent(this, jobID, user, vcdID.getID(), dataKey, ExportEvent.EXPORT_COMPLETE, format, location, null, timeSpecs, varSpecs);
fireExportEvent(event);
return event;
}
use of org.vcell.util.document.KeyValue 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());
}
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class ClientDocumentManager method saveAsNew.
/**
* Insert the method's description here.
* Creation date: (2/5/01 4:58:40 PM)
*/
public VCImage saveAsNew(VCImage vcImage, java.lang.String newName) throws DataAccessException {
try {
String vcImageXML = null;
try {
vcImageXML = XmlHelper.imageToXML(vcImage);
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new DataAccessException(e.getMessage());
}
String savedVCImageXML = sessionManager.getUserMetaDbServer().saveVCImageAs(new BigString(vcImageXML), newName).toString();
VCImage savedVCImage = null;
try {
savedVCImage = XmlHelper.XMLToImage(savedVCImageXML);
} catch (XmlParseException e) {
e.printStackTrace(System.out);
throw new DataAccessException(e.getMessage());
}
savedVCImage.refreshDependencies();
KeyValue savedKey = savedVCImage.getVersion().getVersionKey();
if (xmlHash.get(savedKey) == null) {
xmlHash.put(savedKey, savedVCImageXML);
}
try {
ISize size = new ISize(savedVCImage.getNumX(), savedVCImage.getNumY(), savedVCImage.getNumZ());
GIFImage browseData = BrowseImage.makeBrowseGIFImage(savedVCImage);
VCImageInfo savedVCImageInfo = new VCImageInfo(savedVCImage.getVersion(), size, savedVCImage.getExtent(), browseData, VCellSoftwareVersion.fromSystemProperty());
imgInfoHash.put(savedKey, savedVCImageInfo);
fireDatabaseInsert(new DatabaseEvent(this, DatabaseEvent.INSERT, null, savedVCImageInfo));
} catch (Exception e) {
e.printStackTrace(System.out);
}
return savedVCImage;
} catch (RemoteProxyException e) {
e.printStackTrace(System.out);
throw new DataAccessException(VCellErrorMessages.FAIL_SAVE_MESSAGE + "\n\n" + e.getMessage());
}
}
use of org.vcell.util.document.KeyValue in project vcell by virtualcell.
the class ClientDocumentManager method getMathModel.
/**
* 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
*/
public MathModel getMathModel(KeyValue mathModelKey) throws DataAccessException {
XMLHolder<MathModel> mathModelXML = getMathModelXML(mathModelKey);
MathModel mathModel = getMathModelFromDatabaseXML(mathModelXML);
//
// preload SimulationJobStatus for all simulations if any missing from hash.
//
Simulation[] simulations = mathModel.getSimulations();
KeyValue[] simKeys = new KeyValue[simulations.length];
for (int i = 0; i < simulations.length; i++) {
VCSimulationIdentifier vcSimulationIdentifier = simulations[i].getSimulationInfo().getAuthoritativeVCSimulationIdentifier();
simKeys[i] = vcSimulationIdentifier.getSimulationKey();
}
preloadSimulationStatus(simKeys);
return mathModel;
}
Aggregations