use of org.vcell.util.document.User in project vcell by virtualcell.
the class DataJobEvent method fromJsonRep.
public static DataJobEvent fromJsonRep(Object eventSource, DataJobEventRepresentation eventRep) {
Double progress = eventRep.progress;
User owner = new User(eventRep.username, new KeyValue(eventRep.userkey));
VCDataJobID dataJobID = new VCDataJobID(eventRep.jobid, owner, eventRep.isBackgroundTask);
int eventType = eventRep.eventType;
KeyValue dataKey = new KeyValue(eventRep.dataKey);
String dataIdString = eventRep.dataIdString;
DataJobEvent dataJobEvent = new DataJobEvent(dataJobID, eventType, dataKey, dataIdString, progress);
return dataJobEvent;
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class ExportEvent method fromJsonRep.
public static ExportEvent fromJsonRep(Object eventSource, ExportEventRepresentation rep) {
User user = new User(rep.username, new KeyValue(rep.userkey));
TimeSpecs timeSpecs = null;
if (rep.exportTimeSpecs != null) {
timeSpecs = TimeSpecs.fromJsonRep(rep.exportTimeSpecs);
}
VariableSpecs variableSpecs = null;
if (rep.exportVariableSpecs != null) {
variableSpecs = VariableSpecs.fromJsonRep(rep.exportVariableSpecs);
}
ExportEvent event = new ExportEvent(eventSource, rep.jobid, user, rep.dataIdString, new KeyValue(rep.dataKey), rep.eventType, rep.format, rep.location, rep.progress, timeSpecs, variableSpecs);
return event;
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class SimulationJobStatusEvent method fromJsonRep.
public static SimulationJobStatusEvent fromJsonRep(Object eventSource, SimulationJobStatusEventRepresentation eventRep) {
String simid = Simulation.createSimulationID(new KeyValue(eventRep.jobStatus.simulationKey));
int jobIndex = eventRep.jobStatus.jobIndex;
int taskID = eventRep.jobStatus.taskID;
VCellServerID serverID = VCellServerID.getServerID(eventRep.jobStatus.vcellServerID);
KeyValue simkey = new KeyValue(eventRep.jobStatus.simulationKey);
User owner = new User(eventRep.jobStatus.owner_userid, new KeyValue(eventRep.jobStatus.onwer_userkey));
VCSimulationIdentifier vcSimID = new VCSimulationIdentifier(simkey, owner);
Date submitDate = eventRep.jobStatus.submitDate;
SchedulerStatus schedulerStatus = null;
if (eventRep.jobStatus.schedulerStatus != null) {
schedulerStatus = SchedulerStatus.valueOf(eventRep.jobStatus.schedulerStatus.name());
}
HtcJobID htcJobID = null;
Long htcJobNumber = eventRep.jobStatus.htcJobNumber;
SimulationJobStatusRepresentation.BatchSystemType htcBatchSystemType = eventRep.jobStatus.htcBatchSystemType;
if (htcJobNumber != null) {
htcJobID = new HtcJobID(htcJobNumber.toString(), BatchSystemType.valueOf(htcBatchSystemType.name()));
}
SimulationMessage simMessage = null;
DetailedState detailedState = DetailedState.valueOf(eventRep.jobStatus.detailedState.name());
String message = eventRep.jobStatus.detailedStateMessage;
if (detailedState != null) {
simMessage = SimulationMessage.create(detailedState, message, htcJobID);
}
SimulationQueueEntryStatus simQueueStatus = null;
Date queueDate = eventRep.jobStatus.queueDate;
Integer queuePriority = eventRep.jobStatus.queuePriority;
SimulationJobStatusRepresentation.SimulationQueueID queueId2 = eventRep.jobStatus.queueId;
if (queueDate != null && queuePriority != null) {
simQueueStatus = new SimulationQueueEntryStatus(queueDate, queuePriority, SimulationQueueID.valueOf(queueId2.name()));
}
SimulationExecutionStatus simExeStatus = null;
Date startDate = eventRep.jobStatus.simexe_startDate;
String computeHost = eventRep.jobStatus.computeHost;
Date latestUpdateDate = eventRep.jobStatus.simexe_latestUpdateDate;
Date endDate = eventRep.jobStatus.simexe_endDate;
Boolean hasData = eventRep.jobStatus.hasData;
if (latestUpdateDate != null) {
simExeStatus = new SimulationExecutionStatus(startDate, computeHost, latestUpdateDate, endDate, hasData, htcJobID);
}
SimulationJobStatus jobStatus = new SimulationJobStatus(serverID, vcSimID, jobIndex, submitDate, schedulerStatus, taskID, simMessage, simQueueStatus, simExeStatus);
Double progress = eventRep.progress;
Double timepoint = eventRep.timePoint;
String username = eventRep.username;
SimulationJobStatusEvent event = new SimulationJobStatusEvent(eventSource, simid, jobStatus, progress, timepoint, username);
return event;
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class DatabaseWindowManager method isOwnerUserEqual.
/**
* Insert the method's description here.
* Creation date: (5/14/2004 5:35:55 PM)
*/
public boolean isOwnerUserEqual() {
User currentUser = getRequestManager().getDocumentManager().getUser();
User selectedDocOwner = null;
if (getPanelSelection() != null) {
selectedDocOwner = getPanelSelection().getVersion().getOwner();
}
if (Compare.isEqual(currentUser, selectedDocOwner)) {
return true;
} else {
return false;
}
}
use of org.vcell.util.document.User in project vcell by virtualcell.
the class TestingFrameworkWindowManager method compare.
/**
* Insert the method's description here.
* Creation date: (1/20/2003 11:52:18 AM)
* @return boolean
* @param mathDesc cbit.vcell.math.MathDescription
*/
public void compare(final TestCriteriaNew testCriteria, final SimulationInfo userDefinedRegrSimInfo) {
final String KEY_MERGEDDATAINFO = "KEY_MERGEDDATAINFO";
final String KEY_MERGEDDATASETVIEWERCNTRLR = "KEY_MERGEDDATASETVIEWERCNTRLR";
AsynchClientTask gatherDataTask = new AsynchClientTask("Gathering compare Dta...", AsynchClientTask.TASKTYPE_NONSWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
// create the merged data for the simulationInfo in testCriteria and the regression simInfo
SimulationInfo simInfo = testCriteria.getSimInfo();
SimulationInfo regrSimInfo = null;
if (userDefinedRegrSimInfo != null) {
regrSimInfo = userDefinedRegrSimInfo;
} else {
regrSimInfo = testCriteria.getRegressionSimInfo();
}
if (regrSimInfo == null) {
return;
}
VCDataIdentifier vcSimId1 = new VCSimulationDataIdentifier(simInfo.getAuthoritativeVCSimulationIdentifier(), 0);
VCDataIdentifier vcSimId2 = new VCSimulationDataIdentifier(regrSimInfo.getAuthoritativeVCSimulationIdentifier(), 0);
User user = simInfo.getOwner();
VCDataIdentifier[] vcIdentifierArray = new VCDataIdentifier[] { vcSimId2, vcSimId1 };
MergedDataInfo mergedDataInfo = new MergedDataInfo(user, vcIdentifierArray, MergedDataInfo.createDefaultPrefixNames(vcIdentifierArray.length));
hashTable.put(KEY_MERGEDDATAINFO, mergedDataInfo);
// get the data manager and wire it up
//
// get all "Data1.XXX" data identifiers ... and remove those which are functions
// add functions of the form DIFF_XXX = (Data1.XXX - Data2.XXX) for convenience in comparing results.
//
Simulation sim1 = ((ClientDocumentManager) getRequestManager().getDocumentManager()).getSimulation(simInfo);
Simulation sim2 = ((ClientDocumentManager) getRequestManager().getDocumentManager()).getSimulation(regrSimInfo);
boolean isSpatial = sim1.isSpatial();
if (sim2.isSpatial() != isSpatial) {
throw new RuntimeException("Cannot compare spatial and non-spatial data sets : " + simInfo + "& " + regrSimInfo);
}
DataManager mergedDataManager = getRequestManager().getDataManager(null, mergedDataInfo, isSpatial);
DataManager data1Manager = getRequestManager().getDataManager(null, vcSimId1, isSpatial);
DataManager data2Manager = getRequestManager().getDataManager(null, vcSimId2, isSpatial);
Vector<AnnotatedFunction> functionList = new Vector<AnnotatedFunction>();
AnnotatedFunction[] data1Functions = data1Manager.getFunctions();
AnnotatedFunction[] existingFunctions = mergedDataManager.getFunctions();
DataIdentifier[] data1Identifiers = data1Manager.getDataIdentifiers();
DataIdentifier[] data2Identifiers = data2Manager.getDataIdentifiers();
for (int i = 0; i < data1Identifiers.length; i++) {
//
// make sure dataIdentifier is not already a function
//
boolean bIsFunction = false;
for (int j = 0; j < data1Functions.length; j++) {
if (data1Identifiers[i].getName().equals(data1Functions[j].getName())) {
bIsFunction = true;
}
}
if (bIsFunction) {
continue;
}
//
// make sure corresponding identifier exists in "Data2"
//
boolean bIsInData2 = false;
for (int j = 0; j < data2Identifiers.length; j++) {
if (data2Identifiers[j].getName().equals(data1Identifiers[i].getName())) {
bIsInData2 = true;
}
}
if (!bIsInData2) {
continue;
}
//
// create "Diff" function
//
String data1Name = "Data1." + data1Identifiers[i].getName();
String data2Name = "Data2." + data1Identifiers[i].getName();
String functionName = "DIFF_" + data1Identifiers[i].getName();
VariableType varType = data1Identifiers[i].getVariableType();
Expression exp = new Expression(data1Name + "-" + data2Name);
AnnotatedFunction newFunction = new AnnotatedFunction(functionName, exp, data1Identifiers[i].getDomain(), "", varType, FunctionCategory.OUTPUTFUNCTION);
//
// make sure new "Diff" function isn't already in existing function list.
//
boolean bDiffFunctionAlreadyHere = false;
for (int j = 0; j < existingFunctions.length; j++) {
if (newFunction.getName().equals(existingFunctions[j].getName())) {
bDiffFunctionAlreadyHere = true;
}
}
if (bDiffFunctionAlreadyHere) {
continue;
}
functionList.add(newFunction);
}
OutputContext outputContext = null;
if (functionList.size() > 0) {
AnnotatedFunction[] newDiffFunctions = (AnnotatedFunction[]) BeanUtils.getArray(functionList, AnnotatedFunction.class);
outputContext = new OutputContext(newDiffFunctions);
}
MergedDatasetViewerController mergedDatasetViewerCtr = getRequestManager().getMergedDatasetViewerController(outputContext, mergedDataInfo, !isSpatial);
hashTable.put(KEY_MERGEDDATASETVIEWERCNTRLR, mergedDatasetViewerCtr);
}
};
AsynchClientTask showResultsTask = new AsynchClientTask("Showing Compare Results", AsynchClientTask.TASKTYPE_SWING_BLOCKING) {
@Override
public void run(Hashtable<String, Object> hashTable) throws Exception {
// make the viewer
MergedDatasetViewerController mergedDatasetViewerCtr = (MergedDatasetViewerController) hashTable.get(KEY_MERGEDDATASETVIEWERCNTRLR);
addDataListener(mergedDatasetViewerCtr);
DataViewer viewer = mergedDatasetViewerCtr.createViewer();
viewer.setDataViewerManager(TestingFrameworkWindowManager.this);
addExportListener(viewer);
VCDataIdentifier vcDataIdentifier = (MergedDataInfo) hashTable.get(KEY_MERGEDDATAINFO);
ChildWindowManager childWindowManager = TFWFinder.findChildWindowManager(getComponent());
ChildWindow childWindow = childWindowManager.addChildWindow(viewer, vcDataIdentifier, "Comparing ... " + vcDataIdentifier.getID());
childWindow.pack();
// childWindow.setSize(450, 450);
childWindow.setIsCenteredOnParent();
childWindow.show();
}
};
ClientTaskDispatcher.dispatch(getComponent(), new Hashtable<String, Object>(), new AsynchClientTask[] { gatherDataTask, showResultsTask }, false);
}
Aggregations