diff --git a/vcell-api/src/main/java/org/vcell/rest/events/RestEventService.java b/vcell-api/src/main/java/org/vcell/rest/events/RestEventService.java
index 4e733e250c..a6eb5f9d6e 100644
--- a/vcell-api/src/main/java/org/vcell/rest/events/RestEventService.java
+++ b/vcell-api/src/main/java/org/vcell/rest/events/RestEventService.java
@@ -13,6 +13,7 @@
import org.vcell.api.common.events.EventWrapper.EventType;
import org.vcell.api.common.events.ExportEventRepresentation;
import org.vcell.api.common.events.SimulationJobStatusEventRepresentation;
+import org.vcell.api.utils.DTOOldAPI;
import org.vcell.rest.server.ClientTopicMessageCollector;
import org.vcell.util.Compare;
@@ -56,8 +57,8 @@ private void newEventMessage(MessageEvent event) {
if (event instanceof ExportEvent) {
ExportEvent exportEvent = (ExportEvent) event;
try {
- ExportEventRepresentation exportEventRep = exportEvent.toJsonRep();
- ExportEvent event2 = ExportEvent.fromJsonRep(this, exportEventRep);
+ ExportEventRepresentation exportEventRep = DTOOldAPI.exportEventToJsonRep(exportEvent);
+ ExportEvent event2 = DTOOldAPI.exportEventFromJsonRep(this, exportEventRep);
if (!Compare.isEqual(event2.getFormat(),exportEvent.getFormat())) {
throw new RuntimeException("Export event round-trip failed");
}
@@ -73,8 +74,8 @@ private void newEventMessage(MessageEvent event) {
}else if (event instanceof SimulationJobStatusEvent) {
SimulationJobStatusEvent simJobEvent = (SimulationJobStatusEvent)event;
try {
- SimulationJobStatusEventRepresentation simJobEventRep = simJobEvent.toJsonRep();
- SimulationJobStatusEvent event2 = SimulationJobStatusEvent.fromJsonRep(this, simJobEventRep);
+ SimulationJobStatusEventRepresentation simJobEventRep = DTOOldAPI.simulationJobStatusEventToJsonRep(simJobEvent);
+ SimulationJobStatusEvent event2 = DTOOldAPI.simulationJobStatusEventFromJsonRep(this, simJobEventRep);
if (!Compare.isEqual(event2.getJobStatus(),simJobEvent.getJobStatus())) {
throw new RuntimeException("SimulationJobStatus event round-trip failed");
}
@@ -119,8 +120,8 @@ private void newEventMessage(MessageEvent event) {
}else if (event instanceof DataJobEvent) {
DataJobEvent dataJobEvent = (DataJobEvent)event;
try {
- DataJobEventRepresentation dataJobEventRep = dataJobEvent.toJsonRep();
- DataJobEvent event2 = DataJobEvent.fromJsonRep(this, dataJobEventRep);
+ DataJobEventRepresentation dataJobEventRep = DTOOldAPI.dataJobRepToJsonRep(dataJobEvent);
+ DataJobEvent event2 = DTOOldAPI.dataJobEventFromJsonRep(this, dataJobEventRep);
if (!Compare.isEqual(event2.getDataIdString(),dataJobEvent.getDataIdString())) {
throw new RuntimeException("DataJob event round-trip failed");
}
diff --git a/vcell-apiclient/pom.xml b/vcell-apiclient/pom.xml
index 3f9f22fef0..b1d0894e3b 100644
--- a/vcell-apiclient/pom.xml
+++ b/vcell-apiclient/pom.xml
@@ -114,5 +114,10 @@
vcell-restclient
0.0.1-SNAPSHOT
+
+ org.vcell
+ vcell-core
+ 0.0.1-SNAPSHOT
+
diff --git a/vcell-apiclient/src/main/java/org/vcell/api/utils/DTOOldAPI.java b/vcell-apiclient/src/main/java/org/vcell/api/utils/DTOOldAPI.java
new file mode 100644
index 0000000000..e8f12a17b3
--- /dev/null
+++ b/vcell-apiclient/src/main/java/org/vcell/api/utils/DTOOldAPI.java
@@ -0,0 +1,252 @@
+package org.vcell.api.utils;
+
+import cbit.rmi.event.DataJobEvent;
+import cbit.rmi.event.ExportEvent;
+import cbit.rmi.event.SimulationJobStatusEvent;
+import cbit.vcell.export.server.HumanReadableExportData;
+import cbit.vcell.export.server.TimeSpecs;
+import cbit.vcell.export.server.VariableSpecs;
+import cbit.vcell.server.HtcJobID;
+import cbit.vcell.server.SimulationExecutionStatus;
+import cbit.vcell.server.SimulationJobStatus;
+import cbit.vcell.server.SimulationQueueEntryStatus;
+import cbit.vcell.solver.Simulation;
+import cbit.vcell.solver.VCSimulationIdentifier;
+import cbit.vcell.solver.server.SimulationMessage;
+import org.vcell.api.common.events.*;
+import org.vcell.util.document.KeyValue;
+import org.vcell.util.document.User;
+import org.vcell.util.document.VCDataJobID;
+import org.vcell.util.document.VCellServerID;
+
+import java.util.Date;
+
+public class DTOOldAPI {
+ public static DataJobEventRepresentation dataJobRepToJsonRep(DataJobEvent dataJobEvent) {
+ int eventType = dataJobEvent.getEventTypeID();
+ Double progress = dataJobEvent.getProgress();
+ String username = dataJobEvent.getVcDataJobID().getJobOwner().getName();
+ String userkey = dataJobEvent.getVcDataJobID().getJobOwner().getID().toString();
+ long jobid = dataJobEvent.getVcDataJobID().getJobID();
+ boolean isBackgroundTask = dataJobEvent.getVcDataJobID().isBackgroundTask();
+ String dataIdString = dataJobEvent.getDataIdString();
+ String dataKey = dataJobEvent.getDataKey().toString();
+
+ DataJobEventRepresentation rep = new DataJobEventRepresentation(
+ eventType, progress, username, userkey, jobid, isBackgroundTask, dataIdString, dataKey);
+ return rep;
+ }
+
+ public static DataJobEvent dataJobEventFromJsonRep(Object eventSource, DataJobEventRepresentation eventRep) {
+ Double progress = eventRep.progress;
+ org.vcell.util.document.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;
+ }
+
+ public static ExportEvent exportEventFromJsonRep(Object eventSource, ExportEventRepresentation rep) {
+ User user = new User(rep.username, new KeyValue(rep.userkey));
+ TimeSpecs timeSpecs = null;
+ if (rep.exportTimeSpecs!=null) {
+ timeSpecs = timeSpecsFromJsonRep(rep.exportTimeSpecs);
+ }
+ VariableSpecs variableSpecs = null;
+ if (rep.exportVariableSpecs!=null) {
+ variableSpecs = variableSpecsFromJsonRep(rep.exportVariableSpecs);
+ }
+ HumanReadableExportData humanReadableExportData1 = null;
+ if (rep.exportHumanReadableDataSpec!=null){
+ humanReadableExportData1 = humanReadableExportDataFromJsonRep(rep.exportHumanReadableDataSpec);
+ }
+ ExportEvent event = new ExportEvent(
+ eventSource, rep.jobid, user,
+ rep.dataIdString, new KeyValue(rep.dataKey), rep.eventType,
+ rep.format, rep.location, rep.progress,
+ timeSpecs, variableSpecs);
+ event.setHumanReadableExportData(humanReadableExportData1);
+ return event;
+ }
+
+ public static ExportEventRepresentation exportEventToJsonRep(ExportEvent event) {
+ ExportTimeSpecs exportTimeSpecs = null;
+ if (event.getTimeSpecs()!=null) {
+ exportTimeSpecs = exportTimeSpecsToJsonRep(event.getTimeSpecs());
+ }
+ ExportVariableSpecs exportVariableSpecs = null;
+ if (event.getVariableSpecs()!=null) {
+ exportVariableSpecs = variableSpecsToJsonRep(event.getVariableSpecs());
+ }
+ ExportHumanReadableDataSpec exportHumanReadableDataSpec = null;
+ if (event.getHumanReadableData() != null){
+ exportHumanReadableDataSpec = humanReadableExportDataToJsonRep(event.getHumanReadableData());
+ }
+
+ return new ExportEventRepresentation(
+ event.getEventTypeID(), event.getProgress(), event.getFormat(),
+ event.getLocation(), event.getUser().getName(), event.getUser().getID().toString(), event.getJobID(),
+ event.getDataIdString(), event.getDataKey().toString(),
+ exportTimeSpecs, exportVariableSpecs, exportHumanReadableDataSpec);
+ }
+
+ public static ExportTimeSpecs exportTimeSpecsToJsonRep(TimeSpecs timeSpecs) {
+ ExportTimeSpecs rep = new ExportTimeSpecs(timeSpecs.getBeginTimeIndex(), timeSpecs.getEndTimeIndex(),
+ timeSpecs.getAllTimes(), timeSpecs.getModeID());
+ return rep;
+ }
+ public static TimeSpecs timeSpecsFromJsonRep(ExportTimeSpecs rep) {
+ TimeSpecs timeSpecs = new TimeSpecs(rep.beginTimeIndex, rep.endTimeIndex, rep.allTimes, rep.modeID);
+ return timeSpecs;
+ }
+
+
+ public static ExportVariableSpecs variableSpecsToJsonRep(VariableSpecs variableSpecs) {
+ ExportVariableSpecs rep = new ExportVariableSpecs(variableSpecs.getVariableNames(), variableSpecs.getModeID());
+ return rep;
+ }
+
+ public static VariableSpecs variableSpecsFromJsonRep(ExportVariableSpecs rep) {
+ VariableSpecs variableSpecs = new VariableSpecs(rep.variableNames, rep.modeID);
+ return variableSpecs;
+ }
+
+ public static ExportHumanReadableDataSpec humanReadableExportDataToJsonRep(HumanReadableExportData hr) {
+ return new ExportHumanReadableDataSpec(hr.biomodelName, hr.applicationName, hr.simulationName, hr.differentParameterValues, hr.serverSavedFileName, hr.applicationType,
+ hr.nonSpatial, hr.subVolume, hr.zSlices, hr.tSlices, hr.numChannels);
+ }
+
+ public static HumanReadableExportData humanReadableExportDataFromJsonRep(ExportHumanReadableDataSpec rep) {
+ HumanReadableExportData hre = new HumanReadableExportData(rep.simulationName, rep.applicationName, rep.bioModelName, rep.differentParameterValues,
+ rep.serverSavedFileName, rep.applicationType, rep.nonSpatial, rep.subVolume);
+ hre.zSlices = rep.zSlices;
+ hre.tSlices = rep.tSlices;
+ hre.numChannels = rep.numChannels;
+ return hre;
+ }
+
+ public static SimulationJobStatusEvent simulationJobStatusEventFromJsonRep(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;
+
+ SimulationJobStatus.SchedulerStatus schedulerStatus = null;
+ if (eventRep.jobStatus.schedulerStatus!=null) {
+ schedulerStatus = SimulationJobStatus.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(), HtcJobID.BatchSystemType.valueOf(htcBatchSystemType.name()));
+ }
+
+ SimulationMessage simMessage = null;
+ SimulationMessage.DetailedState detailedState = SimulationMessage.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, SimulationJobStatus.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;
+ }
+
+ public static SimulationJobStatusEventRepresentation simulationJobStatusEventToJsonRep(SimulationJobStatusEvent event) {
+ String vcellServerID = event.getJobStatus().getServerID().toString();
+ Date timeDateStamp = event.getJobStatus().getTimeDateStamp();
+ String simulationKey = event.getJobStatus().getVCSimulationIdentifier().getSimulationKey().toString();
+ int taskID = event.getJobStatus().getTaskID();
+ int jobIndex = event.getJobStatus().getJobIndex();
+ Date submitDate = event.getJobStatus().getSubmitDate();
+ String owner_userid = event.getUsername();
+ String onwer_userkey = event.getJobStatus().getVCSimulationIdentifier().getOwner().getID().toString();
+ SimulationJobStatusRepresentation.SchedulerStatus schedulerStatus =
+ SimulationJobStatusRepresentation.SchedulerStatus.valueOf(
+ event.getJobStatus().getSchedulerStatus().name());
+ SimulationJobStatusRepresentation.DetailedState detailedState =
+ SimulationJobStatusRepresentation.DetailedState.valueOf(
+ event.getJobStatus().getSimulationMessage().getDetailedState().name());
+ String detailedStateMessage = event.getJobStatus().getSimulationMessage().getDisplayMessage();
+
+ Long htcJobNumber = null;
+ String htcComputeServer = null;
+ SimulationJobStatusRepresentation.BatchSystemType htcBatchSystemType = null;
+ Date simexe_startDate = null;
+ Date simexe_latestUpdateDate = null;
+ Date simexe_endDate = null;
+ String computeHost = null;
+ Boolean hasData = null;
+ SimulationExecutionStatus simExeStatus = event.getJobStatus().getSimulationExecutionStatus();
+ if (simExeStatus!=null) {
+ HtcJobID htcJobID = simExeStatus.getHtcJobID();
+ if (htcJobID!=null) {
+ htcJobNumber = htcJobID.getJobNumber();
+ htcComputeServer = htcJobID.getServer();
+ htcBatchSystemType = SimulationJobStatusRepresentation.BatchSystemType.valueOf(htcJobID.getBatchSystemType().name());
+ }
+ simexe_startDate = simExeStatus.getStartDate();
+ simexe_latestUpdateDate = simExeStatus.getLatestUpdateDate();
+ simexe_endDate = simExeStatus.getEndDate();
+ computeHost = simExeStatus.getComputeHost();
+ hasData = simExeStatus.hasData();
+ }
+
+
+ Integer queuePriority = null;
+ Date queueDate = null;
+ SimulationJobStatusRepresentation.SimulationQueueID queueId = null;
+ SimulationQueueEntryStatus simQueueStatus = event.getJobStatus().getSimulationQueueEntryStatus();
+ if (simQueueStatus!=null) {
+ queuePriority = simQueueStatus.getQueuePriority();
+ queueDate = simQueueStatus.getQueueDate();
+ queueId = SimulationJobStatusRepresentation.SimulationQueueID.valueOf(simQueueStatus.getQueueID().name());
+ }
+
+ SimulationJobStatusRepresentation jobStatus = new SimulationJobStatusRepresentation(
+ vcellServerID, timeDateStamp, simulationKey,
+ taskID, jobIndex, submitDate, owner_userid, onwer_userkey,
+ schedulerStatus, detailedState, detailedStateMessage,
+ htcJobNumber, htcComputeServer, htcBatchSystemType,
+ queuePriority, queueDate, queueId,
+ simexe_startDate, simexe_latestUpdateDate, simexe_endDate, computeHost, hasData);
+ SimulationJobStatusEventRepresentation eventRep = new SimulationJobStatusEventRepresentation(jobStatus, event.getProgress(),
+ event.getTimepoint(), event.getUsername());
+ return eventRep;
+ }
+
+}
diff --git a/vcell-core/src/main/java/cbit/rmi/event/DataJobEvent.java b/vcell-core/src/main/java/cbit/rmi/event/DataJobEvent.java
index 85b2ab95bc..2ce7d2fcdc 100644
--- a/vcell-core/src/main/java/cbit/rmi/event/DataJobEvent.java
+++ b/vcell-core/src/main/java/cbit/rmi/event/DataJobEvent.java
@@ -10,9 +10,7 @@
package cbit.rmi.event;
-import org.vcell.api.common.events.DataJobEventRepresentation;
import org.vcell.util.document.KeyValue;
-import org.vcell.util.document.TimeSeriesJobResults;
import org.vcell.util.document.User;
import org.vcell.util.document.VCDataJobID;
@@ -117,30 +115,4 @@ public boolean isIntendedFor(User user){
return user.equals(getUser());
}
-public DataJobEventRepresentation toJsonRep() {
- int eventType = this.eventType;
- Double progress = this.progress;
- String username = this.vcDataJobID.getJobOwner().getName();
- String userkey = this.vcDataJobID.getJobOwner().getID().toString();
- long jobid = this.vcDataJobID.getJobID();
- boolean isBackgroundTask = this.vcDataJobID.isBackgroundTask();
- String dataIdString = this.dataIdString;
- String dataKey = this.dataKey.toString();
-
- DataJobEventRepresentation rep = new DataJobEventRepresentation(
- eventType, progress, username, userkey, jobid, isBackgroundTask, dataIdString, dataKey);
- return rep;
-}
-
-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;
-}
-
}
diff --git a/vcell-core/src/main/java/cbit/rmi/event/ExportEvent.java b/vcell-core/src/main/java/cbit/rmi/event/ExportEvent.java
index 77fe881a22..2f8b8a9e21 100644
--- a/vcell-core/src/main/java/cbit/rmi/event/ExportEvent.java
+++ b/vcell-core/src/main/java/cbit/rmi/event/ExportEvent.java
@@ -9,18 +9,14 @@
*/
package cbit.rmi.event;
+
import cbit.vcell.export.server.HumanReadableExportData;
-import org.vcell.api.common.events.ExportEventRepresentation;
-import org.vcell.api.common.events.ExportHumanReadableDataSpec;
-import org.vcell.api.common.events.ExportTimeSpecs;
-import org.vcell.api.common.events.ExportVariableSpecs;
+import cbit.vcell.export.server.TimeSpecs;
+import cbit.vcell.export.server.VariableSpecs;
import org.vcell.util.document.KeyValue;
import org.vcell.util.document.User;
import org.vcell.util.document.VCDataIdentifier;
-import cbit.vcell.export.server.TimeSpecs;
-import cbit.vcell.export.server.VariableSpecs;
-
/**
* This is the event class to support the cbit.vcell.desktop.controls.ExportListener interface.
*/
@@ -184,50 +180,7 @@ public String toString() {
}
-public ExportEventRepresentation toJsonRep() {
- ExportTimeSpecs exportTimeSpecs = null;
- if (timeSpecs!=null) {
- exportTimeSpecs = timeSpecs.toJsonRep();
- }
- ExportVariableSpecs exportVariableSpecs = null;
- if (variableSpecs!=null) {
- exportVariableSpecs = variableSpecs.toJsonRep();
- }
- ExportHumanReadableDataSpec exportHumanReadableDataSpec = null;
- if (humanReadableExportData != null){
- exportHumanReadableDataSpec = humanReadableExportData.toJsonRep();
- }
-
- return new ExportEventRepresentation(
- eventType,progress,format,
- location,user.getName(),user.getID().toString(), jobID,
- dataIdString, dataKey.toString(),
- exportTimeSpecs, exportVariableSpecs, exportHumanReadableDataSpec);
-}
-
-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);
- }
- HumanReadableExportData humanReadableExportData1 = null;
- if (rep.exportHumanReadableDataSpec!=null){
- humanReadableExportData1 = HumanReadableExportData.fromJsonRep(rep.exportHumanReadableDataSpec);
- }
- ExportEvent event = new ExportEvent(
- eventSource, rep.jobid, user,
- rep.dataIdString, new KeyValue(rep.dataKey), rep.eventType,
- rep.format, rep.location, rep.progress,
- timeSpecs, variableSpecs);
- event.setHumanReadableExportData(humanReadableExportData1);
- return event;
-}
public void setHumanReadableExportData(HumanReadableExportData humanReadableExportData){
this.humanReadableExportData = humanReadableExportData;
diff --git a/vcell-core/src/main/java/cbit/rmi/event/SimulationJobStatusEvent.java b/vcell-core/src/main/java/cbit/rmi/event/SimulationJobStatusEvent.java
index 44433c6982..e5fbd5619f 100644
--- a/vcell-core/src/main/java/cbit/rmi/event/SimulationJobStatusEvent.java
+++ b/vcell-core/src/main/java/cbit/rmi/event/SimulationJobStatusEvent.java
@@ -10,26 +10,11 @@
package cbit.rmi.event;
-import java.util.Date;
-
-import org.vcell.api.common.events.SimulationJobStatusEventRepresentation;
-import org.vcell.api.common.events.SimulationJobStatusRepresentation;
-import org.vcell.util.document.KeyValue;
-import org.vcell.util.document.User;
-import org.vcell.util.document.VCellServerID;
-
import cbit.vcell.message.VCMessagingConstants;
-import cbit.vcell.server.HtcJobID;
-import cbit.vcell.server.HtcJobID.BatchSystemType;
-import cbit.vcell.server.SimulationExecutionStatus;
import cbit.vcell.server.SimulationJobStatus;
-import cbit.vcell.server.SimulationJobStatus.SchedulerStatus;
-import cbit.vcell.server.SimulationJobStatus.SimulationQueueID;
-import cbit.vcell.server.SimulationQueueEntryStatus;
-import cbit.vcell.solver.Simulation;
import cbit.vcell.solver.VCSimulationIdentifier;
import cbit.vcell.solver.server.SimulationMessage;
-import cbit.vcell.solver.server.SimulationMessage.DetailedState;
+import org.vcell.util.document.User;
/**
* Insert the type's description here.
@@ -107,6 +92,10 @@ public User getUser() {
return null;
}
+public String getUsername() {
+ return username;
+}
+
@Override
public boolean isIntendedFor(User user){
if (user == null || username==null || username.equalsIgnoreCase(VCMessagingConstants.USERNAME_PROPERTY_VALUE_ALL)){
@@ -148,125 +137,4 @@ public boolean isSupercededBy(MessageEvent messageEvent) {
return false;
}
-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;
-}
-
-public SimulationJobStatusEventRepresentation toJsonRep() {
- String vcellServerID = this.jobStatus.getServerID().toString();
- Date timeDateStamp = this.jobStatus.getTimeDateStamp();
- String simulationKey = this.jobStatus.getVCSimulationIdentifier().getSimulationKey().toString();
- int taskID = this.jobStatus.getTaskID();
- int jobIndex = this.jobStatus.getJobIndex();
- Date submitDate = this.jobStatus.getSubmitDate();
- String owner_userid = this.username;
- String onwer_userkey = this.jobStatus.getVCSimulationIdentifier().getOwner().getID().toString();
- SimulationJobStatusRepresentation.SchedulerStatus schedulerStatus =
- SimulationJobStatusRepresentation.SchedulerStatus.valueOf(
- this.jobStatus.getSchedulerStatus().name());
- SimulationJobStatusRepresentation.DetailedState detailedState =
- SimulationJobStatusRepresentation.DetailedState.valueOf(
- this.jobStatus.getSimulationMessage().getDetailedState().name());
- String detailedStateMessage = this.jobStatus.getSimulationMessage().getDisplayMessage();
-
- Long htcJobNumber = null;
- String htcComputeServer = null;
- SimulationJobStatusRepresentation.BatchSystemType htcBatchSystemType = null;
- Date simexe_startDate = null;
- Date simexe_latestUpdateDate = null;
- Date simexe_endDate = null;
- String computeHost = null;
- Boolean hasData = null;
- SimulationExecutionStatus simExeStatus = this.jobStatus.getSimulationExecutionStatus();
- if (simExeStatus!=null) {
- HtcJobID htcJobID = simExeStatus.getHtcJobID();
- if (htcJobID!=null) {
- htcJobNumber = htcJobID.getJobNumber();
- htcComputeServer = htcJobID.getServer();
- htcBatchSystemType = SimulationJobStatusRepresentation.BatchSystemType.valueOf(htcJobID.getBatchSystemType().name());
- }
- simexe_startDate = simExeStatus.getStartDate();
- simexe_latestUpdateDate = simExeStatus.getLatestUpdateDate();
- simexe_endDate = simExeStatus.getEndDate();
- computeHost = simExeStatus.getComputeHost();
- hasData = simExeStatus.hasData();
- }
-
-
- Integer queuePriority = null;
- Date queueDate = null;
- SimulationJobStatusRepresentation.SimulationQueueID queueId = null;
- SimulationQueueEntryStatus simQueueStatus = this.jobStatus.getSimulationQueueEntryStatus();
- if (simQueueStatus!=null) {
- queuePriority = simQueueStatus.getQueuePriority();
- queueDate = simQueueStatus.getQueueDate();
- queueId = SimulationJobStatusRepresentation.SimulationQueueID.valueOf(simQueueStatus.getQueueID().name());
- }
-
- SimulationJobStatusRepresentation jobStatus = new SimulationJobStatusRepresentation(
- vcellServerID, timeDateStamp, simulationKey,
- taskID, jobIndex, submitDate, owner_userid, onwer_userkey,
- schedulerStatus, detailedState, detailedStateMessage,
- htcJobNumber, htcComputeServer, htcBatchSystemType,
- queuePriority, queueDate, queueId,
- simexe_startDate, simexe_latestUpdateDate, simexe_endDate, computeHost, hasData);
- SimulationJobStatusEventRepresentation eventRep = new SimulationJobStatusEventRepresentation(jobStatus, progress, timePoint, username);
- return eventRep;
-}
-
}
diff --git a/vcell-core/src/main/java/cbit/vcell/export/server/HumanReadableExportData.java b/vcell-core/src/main/java/cbit/vcell/export/server/HumanReadableExportData.java
index af354136eb..34122f0938 100644
--- a/vcell-core/src/main/java/cbit/vcell/export/server/HumanReadableExportData.java
+++ b/vcell-core/src/main/java/cbit/vcell/export/server/HumanReadableExportData.java
@@ -1,8 +1,5 @@
package cbit.vcell.export.server;
-import cbit.vcell.mapping.SimulationContext;
-import org.vcell.api.common.events.ExportHumanReadableDataSpec;
-
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
@@ -32,17 +29,4 @@ public HumanReadableExportData(String simulationName, String applicationName, St
this.nonSpatial = nonSpatial;
this.subVolume = subVolume;
}
-
- public ExportHumanReadableDataSpec toJsonRep() {
- return new ExportHumanReadableDataSpec(biomodelName, applicationName, simulationName, differentParameterValues, serverSavedFileName, applicationType, nonSpatial, subVolume,
- zSlices, tSlices, numChannels);
- }
- public static HumanReadableExportData fromJsonRep(ExportHumanReadableDataSpec rep) {
- HumanReadableExportData hre = new HumanReadableExportData(rep.simulationName, rep.applicationName, rep.bioModelName, rep.differentParameterValues,
- rep.serverSavedFileName, rep.applicationType, rep.nonSpatial, rep.subVolume);
- hre.zSlices = rep.zSlices;
- hre.tSlices = rep.tSlices;
- hre.numChannels = rep.numChannels;
- return hre;
- }
}
diff --git a/vcell-core/src/main/java/cbit/vcell/export/server/TimeSpecs.java b/vcell-core/src/main/java/cbit/vcell/export/server/TimeSpecs.java
index 94145ab7f2..3180555ca0 100644
--- a/vcell-core/src/main/java/cbit/vcell/export/server/TimeSpecs.java
+++ b/vcell-core/src/main/java/cbit/vcell/export/server/TimeSpecs.java
@@ -11,8 +11,6 @@
package cbit.vcell.export.server;
import java.io.Serializable;
-
-import org.vcell.api.common.events.ExportTimeSpecs;
/**
* This type was created in VisualAge.
*/
@@ -112,12 +110,5 @@ public String toString() {
buf.append(", modeID: " + modeID + "]");
return buf.toString();
}
-public ExportTimeSpecs toJsonRep() {
- ExportTimeSpecs rep = new ExportTimeSpecs(beginTimeIndex, endTimeIndex, allTimes, modeID);
- return rep;
-}
-public static TimeSpecs fromJsonRep(ExportTimeSpecs rep) {
- TimeSpecs timeSpecs = new TimeSpecs(rep.beginTimeIndex, rep.endTimeIndex, rep.allTimes, rep.modeID);
- return timeSpecs;
-}
+
}
diff --git a/vcell-core/src/main/java/cbit/vcell/export/server/VariableSpecs.java b/vcell-core/src/main/java/cbit/vcell/export/server/VariableSpecs.java
index 0577eef761..b18c8f598d 100644
--- a/vcell-core/src/main/java/cbit/vcell/export/server/VariableSpecs.java
+++ b/vcell-core/src/main/java/cbit/vcell/export/server/VariableSpecs.java
@@ -12,8 +12,6 @@
import java.io.Serializable;
import java.util.List;
-
-import org.vcell.api.common.events.ExportVariableSpecs;
/**
* This type was created in VisualAge.
*/
@@ -100,12 +98,4 @@ public String toString() {
buf.append(", modeID: " + modeID + "]");
return buf.toString();
}
-public ExportVariableSpecs toJsonRep() {
- ExportVariableSpecs rep = new ExportVariableSpecs(variableNames, modeID);
- return rep;
-}
-public static VariableSpecs fromJsonRep(ExportVariableSpecs rep) {
- VariableSpecs variableSpecs = new VariableSpecs(rep.variableNames, rep.modeID);
- return variableSpecs;
-}
}