Skip to content
Snippets Groups Projects
Commit 378977fa authored by Barbara B. Frosik's avatar Barbara B. Frosik
Browse files

adding start/end date to Gui

parent 60f9572e
No related branches found
No related tags found
No related merge requests found
...@@ -295,7 +295,9 @@ class ExperimentList extends JFrame ...@@ -295,7 +295,9 @@ class ExperimentList extends JFrame
for (int i = 0; i < selection.length; i++) { for (int i = 0; i < selection.length; i++) {
String experimentName = EXPERIMENT_PREFIX+(String)table.getModel().getValueAt(selection[i], Column.NAME.ordinal()); String experimentName = EXPERIMENT_PREFIX+(String)table.getModel().getValueAt(selection[i], Column.NAME.ordinal());
String description = (String)table.getModel().getValueAt(selection[i], Column.DESCRIPTION.ordinal()); String description = (String)table.getModel().getValueAt(selection[i], Column.DESCRIPTION.ordinal());
if (sconnection.addExperiment(experimentName, description) != ServiceConnection.ServiceConnectionStatus.SUCCESS) { String startDate = (String)table.getModel().getValueAt(selection[i], Column.START_DATE.ordinal());
String endDate = (String)table.getModel().getValueAt(selection[i], Column.END_DATE.ordinal());
if (sconnection.addExperiment(experimentName, description, startDate, endDate) != ServiceConnection.ServiceConnectionStatus.SUCCESS) {
continue; continue;
} }
addRole((String)table.getModel().getValueAt(selection[i], Column.MANAGER.ordinal()), experimentName, Role.MANAGER); addRole((String)table.getModel().getValueAt(selection[i], Column.MANAGER.ordinal()), experimentName, Role.MANAGER);
...@@ -381,7 +383,9 @@ class ExperimentList extends JFrame ...@@ -381,7 +383,9 @@ class ExperimentList extends JFrame
for (int i = 0; i < selection.length; i++) { for (int i = 0; i < selection.length; i++) {
String experimentName = EXPERIMENT_PREFIX+(String)table.getModel().getValueAt(selection[i], Column.NAME.ordinal()); String experimentName = EXPERIMENT_PREFIX+(String)table.getModel().getValueAt(selection[i], Column.NAME.ordinal());
String description = (String)table.getModel().getValueAt(selection[i], Column.DESCRIPTION.ordinal()); String description = (String)table.getModel().getValueAt(selection[i], Column.DESCRIPTION.ordinal());
if (sconnection.addExperiment(experimentName, description) != ServiceConnection.ServiceConnectionStatus.SUCCESS) { String startDate = (String)table.getModel().getValueAt(selection[i], Column.START_DATE.ordinal());
String endDate = (String)table.getModel().getValueAt(selection[i], Column.END_DATE.ordinal());
if (sconnection.addExperiment(experimentName, description, startDate, endDate) != ServiceConnection.ServiceConnectionStatus.SUCCESS) {
continue; continue;
} }
addRole((String)table.getModel().getValueAt(selection[i], Column.MANAGER.ordinal()), experimentName, Role.MANAGER); addRole((String)table.getModel().getValueAt(selection[i], Column.MANAGER.ordinal()), experimentName, Role.MANAGER);
......
...@@ -11,6 +11,8 @@ public class StorageServiceConnection extends ServiceConnection{ ...@@ -11,6 +11,8 @@ public class StorageServiceConnection extends ServiceConnection{
static final String EXPERIMENT_NAME = "name"; static final String EXPERIMENT_NAME = "name";
static final String EXPERIMENT_DESCRIPTION = "description"; static final String EXPERIMENT_DESCRIPTION = "description";
static final String EXPERIMENT_TYPE_ID = "experimentTypeId"; static final String EXPERIMENT_TYPE_ID = "experimentTypeId";
static final String EXPERIMENT_START_DATE = "startDate";
static final String EXPERIMENT_END_DATE = "endDate";
} }
class StorageServUrl { class StorageServUrl {
...@@ -19,7 +21,7 @@ public class StorageServiceConnection extends ServiceConnection{ ...@@ -19,7 +21,7 @@ public class StorageServiceConnection extends ServiceConnection{
static final String START_EXPERIMENT = "/experiments/start"; static final String START_EXPERIMENT = "/experiments/start";
} }
public int addExperiment(String name, String description) { public int addExperiment(String name, String description, String startDate, String endDate) {
Map<String, String> data = new HashMap<>(); Map<String, String> data = new HashMap<>();
if (name == null) { if (name == null) {
JOptionPane.showMessageDialog(null, "The experiment name is null", "Error",JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, "The experiment name is null", "Error",JOptionPane.ERROR_MESSAGE);
...@@ -29,6 +31,12 @@ public class StorageServiceConnection extends ServiceConnection{ ...@@ -29,6 +31,12 @@ public class StorageServiceConnection extends ServiceConnection{
} }
if (description != null) { if (description != null) {
data.put(Keyword.EXPERIMENT_DESCRIPTION, encode(description)); data.put(Keyword.EXPERIMENT_DESCRIPTION, encode(description));
}
if (startDate != null) {
data.put(Keyword.EXPERIMENT_START_DATE, encode(startDate));
}
if (endDate != null) {
data.put(Keyword.EXPERIMENT_END_DATE, encode(endDate));
} }
data.put(Keyword.EXPERIMENT_TYPE_ID, ESAF_EXPERIMENT_TYPE); data.put(Keyword.EXPERIMENT_TYPE_ID, ESAF_EXPERIMENT_TYPE);
return invokeSessionPostRequest(StorageServUrl.EXPERIMENT, data); return invokeSessionPostRequest(StorageServUrl.EXPERIMENT, data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment