1452: Implement a GUI for StatMan Algorithms Importer
Task-Url: https://support.d4science.org/issues/1452 Added Main Code drag and drop git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@122283 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0e4a66f5a6
commit
7702d2c37d
|
@ -0,0 +1,24 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client;
|
||||||
|
|
||||||
|
import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface CommonMessages extends Messages {
|
||||||
|
|
||||||
|
//
|
||||||
|
@DefaultMessage("Attention")
|
||||||
|
String attention();
|
||||||
|
|
||||||
|
@DefaultMessage("Error")
|
||||||
|
String error();
|
||||||
|
|
||||||
|
@DefaultMessage("No Main Code set!")
|
||||||
|
String attentionNoMainCodeSet();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,7 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.Delete
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.MainCodeSetEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.MainCodeSetEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.StatAlgoImporterRibbonEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
|
||||||
|
@ -46,12 +47,11 @@ public class StatAlgoImporterController {
|
||||||
private StatAlgoImporterMonitor monitor;
|
private StatAlgoImporterMonitor monitor;
|
||||||
|
|
||||||
private enum InputRequestType {
|
private enum InputRequestType {
|
||||||
Save,
|
Save, SoftwareCreate;
|
||||||
SoftwareCreate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private InputRequestType inputRequestType;
|
private InputRequestType inputRequestType;
|
||||||
|
|
||||||
|
|
||||||
public StatAlgoImporterController() {
|
public StatAlgoImporterController() {
|
||||||
eventBus = new SimpleEventBus();
|
eventBus = new SimpleEventBus();
|
||||||
pm = new ProjectManager(eventBus);
|
pm = new ProjectManager(eventBus);
|
||||||
|
@ -135,7 +135,7 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
String currentLocaleCookie = Cookies.getCookie(LocaleInfo
|
||||||
.getLocaleCookieName());
|
.getLocaleCookieName());
|
||||||
Log.debug(Constants.STATRUNNER_LANG_COOKIE + ":" + currentLocaleCookie);
|
Log.debug(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE + ":" + currentLocaleCookie);
|
||||||
|
|
||||||
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
LocaleInfo currentLocaleInfo = LocaleInfo.getCurrentLocale();
|
||||||
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
Log.debug("Current Locale:" + currentLocaleInfo.getLocaleName());
|
||||||
|
@ -147,17 +147,23 @@ public class StatAlgoImporterController {
|
||||||
long nowLong = now.getTime();
|
long nowLong = now.getTime();
|
||||||
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
nowLong = nowLong + (1000 * 60 * 60 * 24 * 21);
|
||||||
now.setTime(nowLong);
|
now.setTime(nowLong);
|
||||||
String cookieLang = Cookies.getCookie(Constants.STATRUNNER_LANG_COOKIE);
|
String cookieLang = Cookies.getCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
||||||
if (cookieLang != null) {
|
if (cookieLang != null) {
|
||||||
Cookies.removeCookie(Constants.STATRUNNER_LANG_COOKIE);
|
Cookies.removeCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE);
|
||||||
}
|
}
|
||||||
Cookies.setCookie(Constants.STATRUNNER_LANG_COOKIE, localeName, now);
|
Cookies.setCookie(Constants.STATISTICAL_ALGORITHMS_IMPORTER_COOKIE, localeName, now);
|
||||||
com.google.gwt.user.client.Window.Location.reload();
|
com.google.gwt.user.client.Window.Location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
public void restoreUISession() {
|
public void restoreUISession() {
|
||||||
checkLocale();
|
checkLocale();
|
||||||
|
|
||||||
|
String value = com.google.gwt.user.client.Window.Location
|
||||||
|
.getParameter(Constants.STATISTICAL_ALGORITHMS_IMPORTER_ID);
|
||||||
|
|
||||||
|
pm.startProjectManager(value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind Controller to events on bus
|
// Bind Controller to events on bus
|
||||||
|
@ -218,6 +224,19 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
eventBus.addHandler(NewMainCodeEvent.TYPE,
|
||||||
|
new NewMainCodeEvent.NewMainCodeEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSet(NewMainCodeEvent event) {
|
||||||
|
Log.debug("Catch SaveNewMainCodeEvent");
|
||||||
|
doSetNewMainCodeEvent(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
pm.startProjectManager();
|
pm.startProjectManager();
|
||||||
|
|
||||||
|
@ -255,38 +274,39 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doInputReadyCommand(InputReadyEvent event) {
|
private void doInputReadyCommand(InputReadyEvent event) {
|
||||||
switch(inputRequestType){
|
switch (inputRequestType) {
|
||||||
case Save:
|
case Save:
|
||||||
pm.saveProject(event.getInputData(), monitor);
|
pm.saveProject(event.getInputData(), monitor);
|
||||||
break;
|
break;
|
||||||
case SoftwareCreate:
|
case SoftwareCreate:
|
||||||
pm.createSofware(event.getInputData(), monitor);
|
pm.createSofware(event.getInputData(), monitor);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void projectSaveRequest() {
|
private void projectSaveRequest() {
|
||||||
monitor= new StatAlgoImporterMonitor();
|
monitor = new StatAlgoImporterMonitor();
|
||||||
inputRequestType=InputRequestType.Save;
|
inputRequestType = InputRequestType.Save;
|
||||||
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
||||||
eventBus.fireEvent(inputRequestEvent);
|
eventBus.fireEvent(inputRequestEvent);
|
||||||
Log.debug("ProjectSaveRequest: " + inputRequestEvent);
|
Log.debug("ProjectSaveRequest: " + inputRequestEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void softwareCreateRequest() {
|
private void softwareCreateRequest() {
|
||||||
monitor= new StatAlgoImporterMonitor();
|
monitor = new StatAlgoImporterMonitor();
|
||||||
inputRequestType=InputRequestType.SoftwareCreate;
|
inputRequestType = InputRequestType.SoftwareCreate;
|
||||||
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
InputRequestEvent inputRequestEvent = new InputRequestEvent();
|
||||||
eventBus.fireEvent(inputRequestEvent);
|
eventBus.fireEvent(inputRequestEvent);
|
||||||
Log.debug("SoftwareCreateRequest: " + inputRequestEvent);
|
Log.debug("SoftwareCreateRequest: " + inputRequestEvent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void showCreateProjectDialog() {
|
private void showCreateProjectDialog() {
|
||||||
pm.createProject();
|
pm.createProject();
|
||||||
|
|
||||||
|
@ -300,9 +320,7 @@ public class StatAlgoImporterController {
|
||||||
private void showAddResourceDialog() {
|
private void showAddResourceDialog() {
|
||||||
pm.addResource();
|
pm.addResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void doMainCodeSetCommand(MainCodeSetEvent event) {
|
private void doMainCodeSetCommand(MainCodeSetEvent event) {
|
||||||
ItemDescription itemDescription = event.getItemDescription();
|
ItemDescription itemDescription = event.getItemDescription();
|
||||||
if (itemDescription != null && itemDescription.getId() != null) {
|
if (itemDescription != null && itemDescription.getId() != null) {
|
||||||
|
@ -310,6 +328,14 @@ public class StatAlgoImporterController {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doSetNewMainCodeEvent(
|
||||||
|
NewMainCodeEvent event) {
|
||||||
|
monitor = new StatAlgoImporterMonitor();
|
||||||
|
pm.setNewMainCode(event,monitor);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void doDeleteItemCommand(DeleteItemEvent event) {
|
private void doDeleteItemCommand(DeleteItemEvent event) {
|
||||||
ItemDescription itemDescription = event.getItemDescription();
|
ItemDescription itemDescription = event.getItemDescription();
|
||||||
|
@ -319,9 +345,6 @@ public class StatAlgoImporterController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private void showCodeUploadDialog() {
|
private void showCodeUploadDialog() {
|
||||||
CodeUploadDialog codeUploadDialog = new CodeUploadDialog(eventBus);
|
CodeUploadDialog codeUploadDialog = new CodeUploadDialog(eventBus);
|
||||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.codeparser;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.regexp.shared.RegExp;
|
import com.google.gwt.regexp.shared.RegExp;
|
||||||
|
@ -24,8 +24,8 @@ public class CodeParser {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedRowsVariables parse(String parameter, IOType ioType) {
|
public InputOutputVariables parse(String parameter, IOType ioType) {
|
||||||
SelectedRowsVariables selectedRowsVariables = null;
|
InputOutputVariables selectedRowsVariables = null;
|
||||||
|
|
||||||
if (parameter == null) {
|
if (parameter == null) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -40,7 +40,7 @@ public class CodeParser {
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0,
|
||||||
defaultValue.length() - 1);
|
defaultValue.length() - 1);
|
||||||
|
|
||||||
selectedRowsVariables = new SelectedRowsVariables(
|
selectedRowsVariables = new InputOutputVariables(
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
varDescription[0].trim(), varDescription[0].trim(),
|
||||||
defaultValue, checkDataType(varDescription[1].trim()),
|
defaultValue, checkDataType(varDescription[1].trim()),
|
||||||
ioType, parameter);
|
ioType, parameter);
|
||||||
|
@ -53,7 +53,7 @@ public class CodeParser {
|
||||||
if (defaultValue.endsWith("\""))
|
if (defaultValue.endsWith("\""))
|
||||||
defaultValue = defaultValue.substring(0,
|
defaultValue = defaultValue.substring(0,
|
||||||
defaultValue.length() - 1);
|
defaultValue.length() - 1);
|
||||||
selectedRowsVariables = new SelectedRowsVariables(
|
selectedRowsVariables = new InputOutputVariables(
|
||||||
varDescription[0].trim(), varDescription[0].trim(),
|
varDescription[0].trim(), varDescription[0].trim(),
|
||||||
defaultValue, checkDataType(varDescription[1].trim()),
|
defaultValue, checkDataType(varDescription[1].trim()),
|
||||||
ioType, parameter);
|
ioType, parameter);
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
|
|
||||||
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
import com.google.gwt.event.shared.HandlerRegistration;
|
||||||
|
import com.google.gwt.event.shared.HasHandlers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Main Code Set Event
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class NewMainCodeEvent extends
|
||||||
|
GwtEvent<NewMainCodeEvent.NewMainCodeEventHandler> {
|
||||||
|
|
||||||
|
public static Type<NewMainCodeEventHandler> TYPE = new Type<NewMainCodeEventHandler>();
|
||||||
|
private ItemDescription file;
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
public interface NewMainCodeEventHandler extends EventHandler {
|
||||||
|
void onSet(NewMainCodeEvent event);
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface HasSaveNewMainCodeEventHandler extends HasHandlers {
|
||||||
|
public HandlerRegistration addSaveNewMainCodeEventHandler(
|
||||||
|
NewMainCodeEventHandler handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public NewMainCodeEvent(ItemDescription file, String code) {
|
||||||
|
this.file = file;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void dispatch(NewMainCodeEventHandler handler) {
|
||||||
|
handler.onSet(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Type<NewMainCodeEventHandler> getAssociatedType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Type<NewMainCodeEventHandler> getType() {
|
||||||
|
return TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fire(HasHandlers source,
|
||||||
|
NewMainCodeEvent saveNewMainCodeEvent) {
|
||||||
|
source.fireEvent(saveNewMainCodeEvent);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemDescription getFile() {
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "NewMainCodeEvent [file=" + file + ", code=" + code + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.event;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
@ -20,7 +20,7 @@ public class NewSelectedRowsVariableEvent
|
||||||
GwtEvent<NewSelectedRowsVariableEvent.NewSelectedRowsVariableEventHandler> {
|
GwtEvent<NewSelectedRowsVariableEvent.NewSelectedRowsVariableEventHandler> {
|
||||||
|
|
||||||
public static Type<NewSelectedRowsVariableEventHandler> TYPE = new Type<NewSelectedRowsVariableEventHandler>();
|
public static Type<NewSelectedRowsVariableEventHandler> TYPE = new Type<NewSelectedRowsVariableEventHandler>();
|
||||||
private SelectedRowsVariables selectedRowsVariable;
|
private InputOutputVariables selectedRowsVariable;
|
||||||
|
|
||||||
public interface NewSelectedRowsVariableEventHandler extends EventHandler {
|
public interface NewSelectedRowsVariableEventHandler extends EventHandler {
|
||||||
void onNewVariable(NewSelectedRowsVariableEvent event);
|
void onNewVariable(NewSelectedRowsVariableEvent event);
|
||||||
|
@ -32,7 +32,7 @@ public class NewSelectedRowsVariableEvent
|
||||||
}
|
}
|
||||||
|
|
||||||
public NewSelectedRowsVariableEvent(
|
public NewSelectedRowsVariableEvent(
|
||||||
SelectedRowsVariables selectedRowsVariable) {
|
InputOutputVariables selectedRowsVariable) {
|
||||||
this.selectedRowsVariable = selectedRowsVariable;
|
this.selectedRowsVariable = selectedRowsVariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class NewSelectedRowsVariableEvent
|
||||||
source.fireEvent(newSelectedRowsVariableEvent);
|
source.fireEvent(newSelectedRowsVariableEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedRowsVariables getSelectedRowsVariable() {
|
public InputOutputVariables getSelectedRowsVariable() {
|
||||||
return selectedRowsVariable;
|
return selectedRowsVariable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||||
|
|
||||||
|
import com.google.gwt.i18n.client.Messages;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public interface CodeEditMessages extends Messages {
|
||||||
|
|
||||||
|
//
|
||||||
|
@DefaultMessage("Save")
|
||||||
|
String btnSaveText();
|
||||||
|
|
||||||
|
@DefaultMessage("Save")
|
||||||
|
String btnSaveToolTip();
|
||||||
|
|
||||||
|
@DefaultMessage("Input")
|
||||||
|
String btnAddInputText();
|
||||||
|
|
||||||
|
@DefaultMessage("Add input variable from code")
|
||||||
|
String btnAddInputToolTip();
|
||||||
|
|
||||||
|
@DefaultMessage("Output")
|
||||||
|
String btnAddOutputText();
|
||||||
|
|
||||||
|
@DefaultMessage("Add output variable from code")
|
||||||
|
String btnAddOutputToolTip();
|
||||||
|
|
||||||
|
@DefaultMessage("Code:")
|
||||||
|
String mainCodeFiledLabel();
|
||||||
|
|
||||||
|
@DefaultMessage("Select parameter in the code!")
|
||||||
|
String attentionSelectParameterInTheCode();
|
||||||
|
|
||||||
|
@DefaultMessage("No valid selected row, change selection and try again!")
|
||||||
|
String attentionNoValidSelectedRow();
|
||||||
|
|
||||||
|
@DefaultMessage("Code Saved")
|
||||||
|
String codeSavedHead();
|
||||||
|
|
||||||
|
@DefaultMessage("Code is saved!")
|
||||||
|
String codeSaved();
|
||||||
|
|
||||||
|
@DefaultMessage("Attention invalid file name for Main Code!")
|
||||||
|
String attentionInvalidFileNameForMainCode();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -2,8 +2,10 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.maindata;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.CommonMessages;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.codeparser.CodeParser;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.codeparser.CodeParser;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||||
|
@ -12,22 +14,31 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.utils.UtilsG
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterSessionExpiredException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.event.shared.EventBus;
|
import com.google.gwt.event.shared.EventBus;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.widget.core.client.ContentPanel;
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.box.PromptMessageBox;
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.DialogHideEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.DialogHideEvent.DialogHideHandler;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
|
||||||
|
import com.sencha.gxt.widget.core.client.toolbar.SeparatorToolItem;
|
||||||
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
|
|
||||||
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
|
import edu.ycp.cs.dh.acegwt.client.ace.AceEditor;
|
||||||
|
@ -51,15 +62,20 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
private TextButton btnSave;
|
private TextButton btnSave;
|
||||||
private TextButton btnAddInput;
|
private TextButton btnAddInput;
|
||||||
private TextButton btnAddOutput;
|
private TextButton btnAddOutput;
|
||||||
|
private Project project;
|
||||||
|
private TextField mainCodeField;
|
||||||
|
private CodeEditMessages msgs;
|
||||||
|
private CommonMessages msgsCommon;
|
||||||
|
|
||||||
public CodeEditPanel(Project project, EventBus eventBus) {
|
public CodeEditPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("CodeEditPanel");
|
Log.debug("CodeEditPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
this.project = project;
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
this.msgs = GWT.create(CodeEditMessages.class);
|
||||||
|
this.msgsCommon = GWT.create(CommonMessages.class);
|
||||||
init();
|
init();
|
||||||
create(project);
|
create();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,12 +88,12 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create(Project project) {
|
private void create() {
|
||||||
btnSave = new TextButton("Save");
|
btnSave = new TextButton(msgs.btnSaveText());
|
||||||
btnSave.setIcon(StatAlgoImporterResources.INSTANCE.save16());
|
btnSave.setIcon(StatAlgoImporterResources.INSTANCE.save16());
|
||||||
btnSave.setScale(ButtonScale.SMALL);
|
btnSave.setScale(ButtonScale.SMALL);
|
||||||
btnSave.setIconAlign(IconAlign.LEFT);
|
btnSave.setIconAlign(IconAlign.LEFT);
|
||||||
btnSave.setToolTip("Save");
|
btnSave.setToolTip(msgs.btnSaveToolTip());
|
||||||
btnSave.addSelectHandler(new SelectHandler() {
|
btnSave.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -87,11 +103,11 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
btnAddInput = new TextButton("Input");
|
btnAddInput = new TextButton(msgs.btnAddInputText());
|
||||||
btnAddInput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAddInput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
btnAddInput.setScale(ButtonScale.SMALL);
|
btnAddInput.setScale(ButtonScale.SMALL);
|
||||||
btnAddInput.setIconAlign(IconAlign.LEFT);
|
btnAddInput.setIconAlign(IconAlign.LEFT);
|
||||||
btnAddInput.setToolTip("Add input variable from code");
|
btnAddInput.setToolTip(msgs.btnAddInputToolTip());
|
||||||
btnAddInput.addSelectHandler(new SelectHandler() {
|
btnAddInput.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -102,11 +118,11 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
btnAddInput.disable();
|
btnAddInput.disable();
|
||||||
|
|
||||||
btnAddOutput = new TextButton("Output");
|
btnAddOutput = new TextButton(msgs.btnAddOutputText());
|
||||||
btnAddOutput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAddOutput.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
btnAddOutput.setScale(ButtonScale.SMALL);
|
btnAddOutput.setScale(ButtonScale.SMALL);
|
||||||
btnAddOutput.setIconAlign(IconAlign.LEFT);
|
btnAddOutput.setIconAlign(IconAlign.LEFT);
|
||||||
btnAddOutput.setToolTip("Add output variable from code");
|
btnAddOutput.setToolTip(msgs.btnAddOutputToolTip());
|
||||||
btnAddOutput.addSelectHandler(new SelectHandler() {
|
btnAddOutput.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -117,10 +133,17 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
btnAddOutput.disable();
|
btnAddOutput.disable();
|
||||||
|
|
||||||
|
mainCodeField = new TextField();
|
||||||
|
mainCodeField.setEmptyText("");
|
||||||
|
mainCodeField.setReadOnly(true);
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
||||||
toolBar.add(btnSave, new BoxLayoutData(new Margins(0)));
|
toolBar.add(btnSave, new BoxLayoutData(new Margins(0)));
|
||||||
toolBar.add(btnAddInput, new BoxLayoutData(new Margins(0)));
|
toolBar.add(btnAddInput, new BoxLayoutData(new Margins(0)));
|
||||||
toolBar.add(btnAddOutput, new BoxLayoutData(new Margins(0)));
|
toolBar.add(btnAddOutput, new BoxLayoutData(new Margins(0)));
|
||||||
|
toolBar.add(new SeparatorToolItem());
|
||||||
|
toolBar.add(new LabelToolItem(msgs.mainCodeFiledLabel()));
|
||||||
|
toolBar.add(mainCodeField, new BoxLayoutData(new Margins(0)));
|
||||||
|
|
||||||
editor = new AceEditor();
|
editor = new AceEditor();
|
||||||
|
|
||||||
|
@ -132,7 +155,14 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
editor.startEditor();
|
editor.startEditor();
|
||||||
editor.setShowPrintMargin(false);
|
editor.setShowPrintMargin(false);
|
||||||
|
|
||||||
if (project != null && project.getMainCode() != null) {
|
if (project != null && project.getMainCode() != null
|
||||||
|
&& project.getMainCode().getItemDescription() != null) {
|
||||||
|
if (project.getMainCode().getItemDescription().getName() != null) {
|
||||||
|
mainCodeField.setValue(project.getMainCode()
|
||||||
|
.getItemDescription().getName());
|
||||||
|
} else {
|
||||||
|
mainCodeField.setValue("");
|
||||||
|
}
|
||||||
loadCode();
|
loadCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,20 +188,22 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
Log.debug("Save Variable: " + ioType + ", " + parameter);
|
Log.debug("Save Variable: " + ioType + ", " + parameter);
|
||||||
if (parameter == null) {
|
if (parameter == null) {
|
||||||
Log.debug("No text selected");
|
Log.debug("No text selected");
|
||||||
UtilsGXT3.alert("Attention", "Select parameter in the code!");
|
UtilsGXT3.alert(msgsCommon.attention(),
|
||||||
|
msgs.attentionSelectParameterInTheCode());
|
||||||
} else {
|
} else {
|
||||||
createSelectedRowVariable(parameter, ioType);
|
createInputOutputVariable(parameter, ioType);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createSelectedRowVariable(String parameter, IOType ioType) {
|
private void createInputOutputVariable(String parameter, IOType ioType) {
|
||||||
CodeParser codeParser = new CodeParser();
|
CodeParser codeParser = new CodeParser();
|
||||||
SelectedRowsVariables selectedRowsVariable = codeParser.parse(
|
InputOutputVariables selectedRowsVariable = codeParser.parse(parameter,
|
||||||
parameter, ioType);
|
ioType);
|
||||||
if (selectedRowsVariable == null) {
|
if (selectedRowsVariable == null) {
|
||||||
Log.debug("No valid selection, change selection and try again!");
|
Log.debug("No valid selection, change selection and try again!");
|
||||||
UtilsGXT3.alert("Attention", "No valid selected row, change selection and try again!");
|
UtilsGXT3.alert(msgsCommon.attention(),
|
||||||
|
msgs.attentionNoValidSelectedRow());
|
||||||
} else {
|
} else {
|
||||||
NewSelectedRowsVariableEvent newSelectedRowsVariableEvent = new NewSelectedRowsVariableEvent(
|
NewSelectedRowsVariableEvent newSelectedRowsVariableEvent = new NewSelectedRowsVariableEvent(
|
||||||
selectedRowsVariable);
|
selectedRowsVariable);
|
||||||
|
@ -181,33 +213,42 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void saveCode() {
|
protected void saveCode() {
|
||||||
String code = editor.getText();
|
if (project != null && project.getMainCode() != null
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.saveCode(code,
|
&& project.getMainCode().getItemDescription() != null) {
|
||||||
new AsyncCallback<Void>() {
|
String code = editor.getText();
|
||||||
|
StatAlgoImporterServiceAsync.INSTANCE.saveCode(code,
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error("Error on save code: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert(msgsCommon.error(),
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
caught.printStackTrace();
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
|
||||||
eventBus.fireEvent(new SessionExpiredEvent(
|
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
|
||||||
} else {
|
|
||||||
Log.error("Error on save code: "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
UtilsGXT3.alert("Error",
|
|
||||||
caught.getLocalizedMessage());
|
|
||||||
}
|
}
|
||||||
caught.printStackTrace();
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
Log.debug("Code is saved!");
|
||||||
|
UtilsGXT3.info(msgs.codeSavedHead(),
|
||||||
|
msgs.codeSaved());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
});
|
||||||
public void onSuccess(Void result) {
|
} else {
|
||||||
Log.debug("Code is saved!");
|
saveNewMainCode();
|
||||||
UtilsGXT3.info("Code Saved", "Code is saved!");
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// Log.debug("Attention no Main Code Set!");
|
||||||
|
// UtilsGXT3.alert(msgsCommon.attention(),
|
||||||
|
// msgsCommon.attentionNoMainCodeSet());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadCode() {
|
private void loadCode() {
|
||||||
|
@ -221,7 +262,7 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
} else {
|
} else {
|
||||||
Log.error("Error retrieving code: "
|
Log.error("Error retrieving code: "
|
||||||
+ caught.getLocalizedMessage());
|
+ caught.getLocalizedMessage());
|
||||||
UtilsGXT3.alert("Error",
|
UtilsGXT3.alert(msgsCommon.error(),
|
||||||
caught.getLocalizedMessage());
|
caught.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
caught.printStackTrace();
|
caught.printStackTrace();
|
||||||
|
@ -254,8 +295,19 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void codeUpdate(Project project) {
|
public void codeUpdate(Project project) {
|
||||||
if (project != null && project.getMainCode() != null) {
|
this.project = project;
|
||||||
|
if (project != null && project.getMainCode() != null
|
||||||
|
&& project.getMainCode().getItemDescription() != null) {
|
||||||
|
if (project.getMainCode().getItemDescription().getName() != null) {
|
||||||
|
mainCodeField.setValue(project.getMainCode()
|
||||||
|
.getItemDescription().getName());
|
||||||
|
} else {
|
||||||
|
mainCodeField.setValue("");
|
||||||
|
}
|
||||||
loadCode();
|
loadCode();
|
||||||
|
} else {
|
||||||
|
editor.setText("");
|
||||||
|
mainCodeField.setValue("");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -308,4 +360,48 @@ public class CodeEditPanel extends ContentPanel {
|
||||||
return selectedText;
|
return selectedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void saveNewMainCode() {
|
||||||
|
final PromptMessageBox messageBox = new PromptMessageBox("Main Code",
|
||||||
|
"File name:");
|
||||||
|
// First option: Listening for the hide event and then figuring which
|
||||||
|
// button was pressed.
|
||||||
|
messageBox.addDialogHideHandler(new DialogHideHandler() {
|
||||||
|
@Override
|
||||||
|
public void onDialogHide(DialogHideEvent event) {
|
||||||
|
if (event.getHideButton() == PredefinedButton.OK) {
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Second option: Listen for a button click
|
||||||
|
messageBox.getButton(PredefinedButton.OK).addSelectHandler(
|
||||||
|
new SelectHandler() {
|
||||||
|
@Override
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
String fileName = messageBox.getTextField()
|
||||||
|
.getCurrentValue();
|
||||||
|
if (fileName != null && !fileName.isEmpty()) {
|
||||||
|
saveNewMainCodeOnServer(fileName);
|
||||||
|
} else {
|
||||||
|
Log.debug("Attention invalid file name for Main Code!");
|
||||||
|
UtilsGXT3.alert(msgsCommon.attention(),
|
||||||
|
msgs.attentionInvalidFileNameForMainCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
messageBox.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveNewMainCodeOnServer(String fileName){
|
||||||
|
ItemDescription file=new ItemDescription();
|
||||||
|
file.setName(fileName);
|
||||||
|
String code = editor.getText();
|
||||||
|
NewMainCodeEvent saveNewMainCodeEvent=new NewMainCodeEvent(file, code);
|
||||||
|
eventBus.fireEvent(saveNewMainCodeEvent);
|
||||||
|
Log.debug("Fired: "+saveNewMainCodeEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewMainCodeEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.monitor.StatAlgoImporterMonitor;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgoImporterServiceAsync;
|
||||||
|
@ -288,7 +289,8 @@ public class ProjectManager {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveProject(InputData inputData, final StatAlgoImporterMonitor monitor) {
|
public void saveProject(InputData inputData,
|
||||||
|
final StatAlgoImporterMonitor monitor) {
|
||||||
Log.debug("Save Project: " + inputData);
|
Log.debug("Save Project: " + inputData);
|
||||||
|
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData,
|
StatAlgoImporterServiceAsync.INSTANCE.saveProject(inputData,
|
||||||
|
@ -313,12 +315,13 @@ public class ProjectManager {
|
||||||
caught.getLocalizedMessage());
|
caught.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
caught.printStackTrace();
|
caught.printStackTrace();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createSofware(InputData inputData, final StatAlgoImporterMonitor monitor) {
|
public void createSofware(InputData inputData,
|
||||||
|
final StatAlgoImporterMonitor monitor) {
|
||||||
Log.debug("Create Software: " + inputData);
|
Log.debug("Create Software: " + inputData);
|
||||||
|
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData,
|
StatAlgoImporterServiceAsync.INSTANCE.createSoftware(inputData,
|
||||||
|
@ -329,7 +332,7 @@ public class ProjectManager {
|
||||||
monitor.hide();
|
monitor.hide();
|
||||||
fireProjectStatusSoftwareCreatedEvent();
|
fireProjectStatusSoftwareCreatedEvent();
|
||||||
UtilsGXT3.info("Create Software", "Software Created!");
|
UtilsGXT3.info("Create Software", "Software Created!");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -414,7 +417,38 @@ public class ProjectManager {
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setNewMainCode(NewMainCodeEvent newMainCodeEvent, final StatAlgoImporterMonitor monitor){
|
||||||
|
StatAlgoImporterServiceAsync.INSTANCE.setNewMainCode(newMainCodeEvent.getFile(),newMainCodeEvent.getCode(),
|
||||||
|
new AsyncCallback<ItemDescription>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
monitor.hide();
|
||||||
|
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
Log.error("Error on save new main code: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
caught.printStackTrace();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ItemDescription itemDescription) {
|
||||||
|
project.setMainCode(new MainCode(itemDescription));
|
||||||
|
fireProjectStatusMainCodeSetEvent();
|
||||||
|
monitor.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void deleteItem(ItemDescription itemDescription) {
|
public void deleteItem(ItemDescription itemDescription) {
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
|
StatAlgoImporterServiceAsync.INSTANCE.deleteResourceOnProject(
|
||||||
itemDescription, new AsyncCallback<Void>() {
|
itemDescription, new AsyncCallback<Void>() {
|
||||||
|
@ -488,14 +522,13 @@ public class ProjectManager {
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fireProjectStatusSoftwareCreatedEvent() {
|
protected void fireProjectStatusSoftwareCreatedEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
ProjectStatusEventType.SOFTWARE_CREATED, project);
|
ProjectStatusEventType.SOFTWARE_CREATED, project);
|
||||||
eventBus.fireEvent(projectStatusEvent);
|
eventBus.fireEvent(projectStatusEvent);
|
||||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void fireProjectStatusStartEvent() {
|
protected void fireProjectStatusStartEvent() {
|
||||||
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
ProjectStatusEvent projectStatusEvent = new ProjectStatusEvent(
|
||||||
|
@ -504,4 +537,31 @@ public class ProjectManager {
|
||||||
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
Log.debug("ProjectStatusEvent fired! " + projectStatusEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void startProjectManager(String value) {
|
||||||
|
|
||||||
|
StatAlgoImporterServiceAsync.INSTANCE.restoreUISession(value,
|
||||||
|
new AsyncCallback<Project>() {
|
||||||
|
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof StatAlgoImporterSessionExpiredException) {
|
||||||
|
eventBus.fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(Project p) {
|
||||||
|
if (p != null) {
|
||||||
|
project = p;
|
||||||
|
fireProjectStatusOpenEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
@ -13,16 +13,16 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface EnvironmentVariablesProperties extends
|
public interface GlobalVariablesProperties extends
|
||||||
PropertyAccess<EnvironmentVariables> {
|
PropertyAccess<GlobalVariables> {
|
||||||
|
|
||||||
ModelKeyProvider<EnvironmentVariables> id();
|
ModelKeyProvider<GlobalVariables> id();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, String> name();
|
ValueProvider<GlobalVariables, String> name();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, String> description();
|
ValueProvider<GlobalVariables, String> description();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, DataType> dataType();
|
ValueProvider<GlobalVariables, DataType> dataType();
|
||||||
|
|
||||||
ValueProvider<EnvironmentVariables, String> defaultValue();
|
ValueProvider<GlobalVariables, String> defaultValue();
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
|
@ -14,22 +14,22 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface SelectedRowsVariablesProperties extends
|
public interface InputOutputVariablesProperties extends
|
||||||
PropertyAccess<SelectedRowsVariables> {
|
PropertyAccess<InputOutputVariables> {
|
||||||
|
|
||||||
ModelKeyProvider<SelectedRowsVariables> id();
|
ModelKeyProvider<InputOutputVariables> id();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, String> name();
|
ValueProvider<InputOutputVariables, String> name();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, String> description();
|
ValueProvider<InputOutputVariables, String> description();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, DataType> dataType();
|
ValueProvider<InputOutputVariables, DataType> dataType();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, String> defaultValue();
|
ValueProvider<InputOutputVariables, String> defaultValue();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, IOType> ioType();
|
ValueProvider<InputOutputVariables, IOType> ioType();
|
||||||
|
|
||||||
ValueProvider<SelectedRowsVariables, String> sourceSelection();
|
ValueProvider<InputOutputVariables, String> sourceSelection();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DeployableVRE;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.RequestedVRE;
|
||||||
|
|
||||||
import com.sencha.gxt.core.client.ValueProvider;
|
import com.sencha.gxt.core.client.ValueProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
|
@ -12,12 +12,12 @@ import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface DeployableVREProperties extends PropertyAccess<DeployableVRE> {
|
public interface RequestedVREProperties extends PropertyAccess<RequestedVRE> {
|
||||||
|
|
||||||
ModelKeyProvider<DeployableVRE> id();
|
ModelKeyProvider<RequestedVRE> id();
|
||||||
|
|
||||||
ValueProvider<DeployableVRE, String> name();
|
ValueProvider<RequestedVRE, String> name();
|
||||||
|
|
||||||
ValueProvider<DeployableVRE, String> description();
|
ValueProvider<RequestedVRE, String> description();
|
||||||
|
|
||||||
}
|
}
|
|
@ -64,8 +64,16 @@ public interface StatAlgoImporterService extends RemoteService {
|
||||||
|
|
||||||
public void saveCode(String code) throws StatAlgoImporterServiceException;
|
public void saveCode(String code) throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException;
|
public void createSoftware(InputData inputData)
|
||||||
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
public String getUriFromResolver(ItemDescription itemDescription) throws StatAlgoImporterServiceException;
|
public String getPublicLink(ItemDescription itemDescription)
|
||||||
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
|
public Project restoreUISession(String value)
|
||||||
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
|
public ItemDescription setNewMainCode(ItemDescription itemDescription, String code)
|
||||||
|
throws StatAlgoImporterServiceException;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,10 +54,14 @@ public interface StatAlgoImporterServiceAsync {
|
||||||
AsyncCallback<Project> asyncCallback);
|
AsyncCallback<Project> asyncCallback);
|
||||||
|
|
||||||
void saveCode(String code, AsyncCallback<Void> asyncCallback);
|
void saveCode(String code, AsyncCallback<Void> asyncCallback);
|
||||||
|
|
||||||
|
void setNewMainCode(ItemDescription itemDescription, String code, AsyncCallback<ItemDescription> asyncCallback);
|
||||||
|
|
||||||
void createSoftware(InputData inputData, AsyncCallback<Void> callback);
|
void createSoftware(InputData inputData, AsyncCallback<Void> callback);
|
||||||
|
|
||||||
void getUriFromResolver(ItemDescription itemDescription,
|
void getPublicLink(ItemDescription itemDescription,
|
||||||
AsyncCallback<String> asyncCallback);
|
AsyncCallback<String> asyncCallback);
|
||||||
|
|
||||||
|
void restoreUISession(String value, AsyncCallback<Project> asyncCallback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,9 +119,11 @@ public class ExplorerProjectPanel extends ContentPanel {
|
||||||
create(event);
|
create(event);
|
||||||
break;
|
break;
|
||||||
case MAIN_CODE_SET:
|
case MAIN_CODE_SET:
|
||||||
|
reloadWSResourceExplorerPanel();
|
||||||
break;
|
break;
|
||||||
case SOFTWARE_CREATED:
|
case SOFTWARE_CREATED:
|
||||||
reloadWSResourceExplorerPanel();
|
reloadWSResourceExplorerPanel();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -354,8 +356,8 @@ public class ExplorerProjectPanel extends ContentPanel {
|
||||||
selectedItem.getId(), selectedItem.getName(),
|
selectedItem.getId(), selectedItem.getName(),
|
||||||
selectedItem.getOwner(), selectedItem.getPath(),
|
selectedItem.getOwner(), selectedItem.getPath(),
|
||||||
selectedItem.getType().name());
|
selectedItem.getType().name());
|
||||||
|
|
||||||
StatAlgoImporterServiceAsync.INSTANCE.getUriFromResolver(
|
StatAlgoImporterServiceAsync.INSTANCE.getPublicLink(
|
||||||
itemDescription, new AsyncCallback<String>() {
|
itemDescription, new AsyncCallback<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,10 +4,10 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.EnvironmentVariablesProperties;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.GlobalVariablesProperties;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -56,13 +56,13 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EnvironmentVariablesPanel extends ContentPanel {
|
public class GlobalVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ListStore<EnvironmentVariables> storeEnvironmentVariable;
|
private ListStore<GlobalVariables> storeGlobalVariable;
|
||||||
private Grid<EnvironmentVariables> gridEnvironmentVariable;
|
private Grid<GlobalVariables> gridGlobalVariable;
|
||||||
private GridRowEditing<EnvironmentVariables> gridEnvironmentVariableEditing;
|
private GridRowEditing<GlobalVariables> gridGlobalVariableEditing;
|
||||||
private TextButton btnAdd;
|
private TextButton btnAdd;
|
||||||
private boolean addStatus;
|
private boolean addStatus;
|
||||||
private int seq = 0;
|
private int seq = 0;
|
||||||
|
@ -75,9 +75,9 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
SafeHtml format(String value);
|
SafeHtml format(String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EnvironmentVariablesPanel(Project project, EventBus eventBus) {
|
public GlobalVariablesPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("EnvironmentVariablesPanel");
|
Log.debug("GlobalVariablesPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
@ -99,18 +99,18 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
private void create(Project project) {
|
private void create(Project project) {
|
||||||
// Grid
|
// Grid
|
||||||
EnvironmentVariablesProperties props = GWT
|
GlobalVariablesProperties props = GWT
|
||||||
.create(EnvironmentVariablesProperties.class);
|
.create(GlobalVariablesProperties.class);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> nameColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<GlobalVariables, String> nameColumn = new ColumnConfig<GlobalVariables, String>(
|
||||||
props.name(), 100, "Name");
|
props.name(), 100, "Name");
|
||||||
// nameColumn.setMenuDisabled(true);
|
// nameColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> descriptionColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<GlobalVariables, String> descriptionColumn = new ColumnConfig<GlobalVariables, String>(
|
||||||
props.description(), 100, "Description");
|
props.description(), 100, "Description");
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, DataType> inputTypeColumn = new ColumnConfig<EnvironmentVariables, DataType>(
|
ColumnConfig<GlobalVariables, DataType> inputTypeColumn = new ColumnConfig<GlobalVariables, DataType>(
|
||||||
props.dataType(), 100, "Type");
|
props.dataType(), 100, "Type");
|
||||||
// inputTypeColumn.setMenuDisabled(true);
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
inputTypeColumn.setCell(new AbstractCell<DataType>() {
|
inputTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||||
|
@ -124,53 +124,53 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ColumnConfig<EnvironmentVariables, String> defaultValueColumn = new ColumnConfig<EnvironmentVariables, String>(
|
ColumnConfig<GlobalVariables, String> defaultValueColumn = new ColumnConfig<GlobalVariables, String>(
|
||||||
props.defaultValue(), 100, "Default");
|
props.defaultValue(), 100, "Default");
|
||||||
// defaColumn.setMenuDisabled(true);
|
// defaColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ArrayList<ColumnConfig<EnvironmentVariables, ?>> l = new ArrayList<ColumnConfig<EnvironmentVariables, ?>>();
|
ArrayList<ColumnConfig<GlobalVariables, ?>> l = new ArrayList<ColumnConfig<GlobalVariables, ?>>();
|
||||||
l.add(nameColumn);
|
l.add(nameColumn);
|
||||||
l.add(descriptionColumn);
|
l.add(descriptionColumn);
|
||||||
l.add(inputTypeColumn);
|
l.add(inputTypeColumn);
|
||||||
l.add(defaultValueColumn);
|
l.add(defaultValueColumn);
|
||||||
|
|
||||||
ColumnModel<EnvironmentVariables> columns = new ColumnModel<EnvironmentVariables>(l);
|
ColumnModel<GlobalVariables> columns = new ColumnModel<GlobalVariables>(l);
|
||||||
|
|
||||||
storeEnvironmentVariable = new ListStore<EnvironmentVariables>(props.id());
|
storeGlobalVariable = new ListStore<GlobalVariables>(props.id());
|
||||||
|
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getListSelectedRows() != null) {
|
&& project.getInputData().getListGlobalVariables() != null) {
|
||||||
storeEnvironmentVariable.addAll(project.getInputData()
|
storeGlobalVariable.addAll(project.getInputData()
|
||||||
.getListEnvironmentVariables());
|
.getListGlobalVariables());
|
||||||
seq = project.getInputData().getListEnvironmentVariables().size();
|
seq = project.getInputData().getListGlobalVariables().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
final GridSelectionModel<EnvironmentVariables> sm = new GridSelectionModel<EnvironmentVariables>();
|
final GridSelectionModel<GlobalVariables> sm = new GridSelectionModel<GlobalVariables>();
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
gridEnvironmentVariable = new Grid<EnvironmentVariables>(
|
gridGlobalVariable = new Grid<GlobalVariables>(
|
||||||
storeEnvironmentVariable, columns);
|
storeGlobalVariable, columns);
|
||||||
gridEnvironmentVariable.setSelectionModel(sm);
|
gridGlobalVariable.setSelectionModel(sm);
|
||||||
gridEnvironmentVariable.getView().setStripeRows(true);
|
gridGlobalVariable.getView().setStripeRows(true);
|
||||||
gridEnvironmentVariable.getView().setColumnLines(true);
|
gridGlobalVariable.getView().setColumnLines(true);
|
||||||
gridEnvironmentVariable.getView().setAutoExpandColumn(nameColumn);
|
gridGlobalVariable.getView().setAutoExpandColumn(nameColumn);
|
||||||
gridEnvironmentVariable.getView().setAutoFill(true);
|
gridGlobalVariable.getView().setAutoFill(true);
|
||||||
gridEnvironmentVariable.setBorders(false);
|
gridGlobalVariable.setBorders(false);
|
||||||
gridEnvironmentVariable.setColumnReordering(false);
|
gridGlobalVariable.setColumnReordering(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GridDragSource<EnvironmentVariables> ds = new
|
* GridDragSource<GlobalVariables> ds = new
|
||||||
* GridDragSource<EnvironmentVariables>( gridEnvironmentVariable);
|
* GridDragSource<GlobalVariables>( gridGlobalVariable);
|
||||||
* ds.addDragStartHandler(new DndDragStartHandler() {
|
* ds.addDragStartHandler(new DndDragStartHandler() {
|
||||||
*
|
*
|
||||||
* @Override public void onDragStart(DndDragStartEvent event) {
|
* @Override public void onDragStart(DndDragStartEvent event) {
|
||||||
*
|
*
|
||||||
* @SuppressWarnings("unchecked") ArrayList<EnvironmentVariables>
|
* @SuppressWarnings("unchecked") ArrayList<GlobalVariables>
|
||||||
* draggingSelection = (ArrayList<EnvironmentVariables>) event
|
* draggingSelection = (ArrayList<GlobalVariables>) event
|
||||||
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
||||||
*
|
*
|
||||||
* } }); GridDropTarget<EnvironmentVariables> dt = new
|
* } }); GridDropTarget<GlobalVariables> dt = new
|
||||||
* GridDropTarget<EnvironmentVariables>( gridEnvironmentVariable);
|
* GridDropTarget<GlobalVariables>( gridGlobalVariable);
|
||||||
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -191,26 +191,26 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
comboInputType.setTriggerAction(TriggerAction.ALL);
|
comboInputType.setTriggerAction(TriggerAction.ALL);
|
||||||
addHandlersForComboInputType(inputTypePropertiesCombo.label());
|
addHandlersForComboInputType(inputTypePropertiesCombo.label());
|
||||||
|
|
||||||
gridEnvironmentVariableEditing = new GridRowEditing<EnvironmentVariables>(
|
gridGlobalVariableEditing = new GridRowEditing<GlobalVariables>(
|
||||||
gridEnvironmentVariable);
|
gridGlobalVariable);
|
||||||
gridEnvironmentVariableEditing.addEditor(nameColumn, new TextField());
|
gridGlobalVariableEditing.addEditor(nameColumn, new TextField());
|
||||||
gridEnvironmentVariableEditing.addEditor(descriptionColumn,
|
gridGlobalVariableEditing.addEditor(descriptionColumn,
|
||||||
new TextField());
|
new TextField());
|
||||||
gridEnvironmentVariableEditing.addEditor(inputTypeColumn,
|
gridGlobalVariableEditing.addEditor(inputTypeColumn,
|
||||||
comboInputType);
|
comboInputType);
|
||||||
gridEnvironmentVariableEditing.addEditor(defaultValueColumn,
|
gridGlobalVariableEditing.addEditor(defaultValueColumn,
|
||||||
new TextField());
|
new TextField());
|
||||||
|
|
||||||
btnAdd = new TextButton("Add");
|
btnAdd = new TextButton("Add");
|
||||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
btnAdd.setScale(ButtonScale.SMALL);
|
btnAdd.setScale(ButtonScale.SMALL);
|
||||||
btnAdd.setIconAlign(IconAlign.LEFT);
|
btnAdd.setIconAlign(IconAlign.LEFT);
|
||||||
btnAdd.setToolTip("Add Environment Variable");
|
btnAdd.setToolTip("Add Global Variable");
|
||||||
btnAdd.addSelectHandler(new SelectHandler() {
|
btnAdd.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
addEnvironmentVariable(event);
|
addGlobalVariable(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -218,78 +218,78 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
TextButton btnDelete = new TextButton("Delete");
|
TextButton btnDelete = new TextButton("Delete");
|
||||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
GridCell cell = gridEnvironmentVariableEditing.getActiveCell();
|
GridCell cell = gridGlobalVariableEditing.getActiveCell();
|
||||||
int rowIndex = cell.getRow();
|
int rowIndex = cell.getRow();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.cancelEditing();
|
gridGlobalVariableEditing.cancelEditing();
|
||||||
|
|
||||||
storeEnvironmentVariable.remove(rowIndex);
|
storeGlobalVariable.remove(rowIndex);
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.getCancelButton().setVisible(
|
gridGlobalVariableEditing.getCancelButton().setVisible(
|
||||||
true);
|
true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EnvironmentVariables> listSelected=storeEnvironmentVariable.getAll();
|
List<GlobalVariables> listSelected=storeGlobalVariable.getAll();
|
||||||
List<EnvironmentVariables> listNewSelected= new ArrayList<EnvironmentVariables>();
|
List<GlobalVariables> listNewSelected= new ArrayList<GlobalVariables>();
|
||||||
for(int i=0; i<listSelected.size(); i++){
|
for(int i=0; i<listSelected.size(); i++){
|
||||||
EnvironmentVariables var=listSelected.get(i);
|
GlobalVariables var=listSelected.get(i);
|
||||||
var.setId(i);
|
var.setId(i);
|
||||||
listNewSelected.add(var);
|
listNewSelected.add(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeEnvironmentVariable.clear();
|
storeGlobalVariable.clear();
|
||||||
storeEnvironmentVariable.addAll(listNewSelected);
|
storeGlobalVariable.addAll(listNewSelected);
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
|
|
||||||
seq=listNewSelected.size();
|
seq=listNewSelected.size();
|
||||||
Log.debug("Current Seq: "+seq);
|
Log.debug("Current Seq: "+seq);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonBar buttonBar = gridEnvironmentVariableEditing.getButtonBar();
|
ButtonBar buttonBar = gridGlobalVariableEditing.getButtonBar();
|
||||||
buttonBar.add(btnDelete);
|
buttonBar.add(btnDelete);
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridGlobalVariableEditing
|
||||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<EnvironmentVariables>() {
|
.addBeforeStartEditHandler(new BeforeStartEditHandler<GlobalVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeStartEdit(
|
public void onBeforeStartEdit(
|
||||||
BeforeStartEditEvent<EnvironmentVariables> event) {
|
BeforeStartEditEvent<GlobalVariables> event) {
|
||||||
editingBeforeStart(event);
|
editingBeforeStart(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridGlobalVariableEditing
|
||||||
.addCancelEditHandler(new CancelEditHandler<EnvironmentVariables>() {
|
.addCancelEditHandler(new CancelEditHandler<GlobalVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelEdit(
|
public void onCancelEdit(
|
||||||
CancelEditEvent<EnvironmentVariables> event) {
|
CancelEditEvent<GlobalVariables> event) {
|
||||||
storeEnvironmentVariable.rejectChanges();
|
storeGlobalVariable.rejectChanges();
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gridEnvironmentVariableEditing
|
gridGlobalVariableEditing
|
||||||
.addCompleteEditHandler(new CompleteEditHandler<EnvironmentVariables>() {
|
.addCompleteEditHandler(new CompleteEditHandler<GlobalVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCompleteEdit(
|
public void onCompleteEdit(
|
||||||
CompleteEditEvent<EnvironmentVariables> event) {
|
CompleteEditEvent<GlobalVariables> event) {
|
||||||
try {
|
try {
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.getCancelButton()
|
gridGlobalVariableEditing.getCancelButton()
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
@ -309,14 +309,14 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
vlc.setScrollMode(ScrollMode.NONE);
|
vlc.setScrollMode(ScrollMode.NONE);
|
||||||
|
|
||||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(gridEnvironmentVariable, new VerticalLayoutData(1, 1,
|
vlc.add(gridGlobalVariable, new VerticalLayoutData(1, 1,
|
||||||
new Margins(0)));
|
new Margins(0)));
|
||||||
|
|
||||||
add(vlc, new MarginData(new Margins(0)));
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editingBeforeStart(BeforeStartEditEvent<EnvironmentVariables> event) {
|
private void editingBeforeStart(BeforeStartEditEvent<GlobalVariables> event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -326,23 +326,23 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEnvironmentVariable(SelectEvent event) {
|
private void addGlobalVariable(SelectEvent event) {
|
||||||
try {
|
try {
|
||||||
seq++;
|
seq++;
|
||||||
EnvironmentVariables newEnvironmentVariable = new EnvironmentVariables(seq, "",
|
GlobalVariables newGlobalVariable = new GlobalVariables(seq, "",
|
||||||
"", "", DataType.STRING);
|
"", "", DataType.STRING);
|
||||||
Log.debug("New Environment Variable: " + newEnvironmentVariable);
|
Log.debug("New Global Variable: " + newGlobalVariable);
|
||||||
gridEnvironmentVariableEditing.cancelEditing();
|
gridGlobalVariableEditing.cancelEditing();
|
||||||
addStatus = true;
|
addStatus = true;
|
||||||
gridEnvironmentVariableEditing.getCancelButton().setVisible(false);
|
gridGlobalVariableEditing.getCancelButton().setVisible(false);
|
||||||
storeEnvironmentVariable.add(newEnvironmentVariable);
|
storeGlobalVariable.add(newGlobalVariable);
|
||||||
int row = storeEnvironmentVariable.indexOf(newEnvironmentVariable);
|
int row = storeGlobalVariable.indexOf(newGlobalVariable);
|
||||||
|
|
||||||
storeComboInputType.clear();
|
storeComboInputType.clear();
|
||||||
storeComboInputType.addAll(DataType.asList());
|
storeComboInputType.addAll(DataType.asList());
|
||||||
storeComboInputType.commitChanges();
|
storeComboInputType.commitChanges();
|
||||||
|
|
||||||
gridEnvironmentVariableEditing.startEditing(new GridCell(row, 0));
|
gridGlobalVariableEditing.startEditing(new GridCell(row, 0));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -350,28 +350,28 @@ public class EnvironmentVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
public void update(Project project) {
|
public void update(Project project) {
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getListSelectedRows() != null) {
|
&& project.getInputData().getListGlobalVariables() != null) {
|
||||||
storeEnvironmentVariable.clear();
|
storeGlobalVariable.clear();
|
||||||
storeEnvironmentVariable.addAll(project.getInputData().getListEnvironmentVariables());
|
storeGlobalVariable.addAll(project.getInputData().getListGlobalVariables());
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
seq = project.getInputData().getListEnvironmentVariables().size();
|
seq = project.getInputData().getListGlobalVariables().size();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
storeEnvironmentVariable.clear();
|
storeGlobalVariable.clear();
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
seq=0;
|
seq=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getEnvironmentVariables() {
|
public ArrayList<GlobalVariables> getGlobalVariables() {
|
||||||
ArrayList<EnvironmentVariables> listEnviromentVarialbles = new ArrayList<>(
|
ArrayList<GlobalVariables> listGlobalVarialbles = new ArrayList<>(
|
||||||
gridEnvironmentVariable.getStore().getAll());
|
gridGlobalVariable.getStore().getAll());
|
||||||
return listEnviromentVarialbles;
|
return listGlobalVarialbles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainCode(Project project) {
|
public void setMainCode(Project project) {
|
||||||
storeEnvironmentVariable.clear();
|
storeGlobalVariable.clear();
|
||||||
storeEnvironmentVariable.commitChanges();
|
storeGlobalVariable.commitChanges();
|
||||||
seq = 0;
|
seq = 0;
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
|
@ -5,11 +5,11 @@ import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DataTypePropertiesCombo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.IOTypePropertiesCombo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.IOTypePropertiesCombo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.SelectedRowsVariablesProperties;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.InputOutputVariablesProperties;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DataType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -54,17 +54,17 @@ import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SelectedRowsPanel extends ContentPanel {
|
public class InputOutputVariablesPanel extends ContentPanel {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private ListStore<SelectedRowsVariables> storeSelectedRows;
|
private ListStore<InputOutputVariables> storeInputOutputVariables;
|
||||||
private Grid<SelectedRowsVariables> gridSelectedRows;
|
private Grid<InputOutputVariables> gridInputOutputVariables;
|
||||||
private ListStore<DataType> storeComboDataType;
|
private ListStore<DataType> storeComboDataType;
|
||||||
private ComboBox<DataType> comboDataType;
|
private ComboBox<DataType> comboDataType;
|
||||||
private ListStore<IOType> storeComboIOType;
|
private ListStore<IOType> storeComboIOType;
|
||||||
private ComboBox<IOType> comboIOType;
|
private ComboBox<IOType> comboIOType;
|
||||||
private GridRowEditing<SelectedRowsVariables> gridSelectedRowsEditing;
|
private GridRowEditing<InputOutputVariables> gridInputOutputVariablesEditing;
|
||||||
private TextButton btnAdd;
|
private TextButton btnAdd;
|
||||||
private boolean addStatus;
|
private boolean addStatus;
|
||||||
private int seq = 0;
|
private int seq = 0;
|
||||||
|
@ -79,9 +79,9 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
SafeHtml format(String value);
|
SafeHtml format(String value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedRowsPanel(Project project, EventBus eventBus) {
|
public InputOutputVariablesPanel(Project project, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
Log.debug("SelectedRowsPanel");
|
Log.debug("InputOutputVariablesPanel");
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
|
||||||
// msgs = GWT.create(ServiceCategoryMessages.class);
|
// msgs = GWT.create(ServiceCategoryMessages.class);
|
||||||
|
@ -103,25 +103,25 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
|
|
||||||
private void create(Project project) {
|
private void create(Project project) {
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getListSelectedRows() != null) {
|
&& project.getInputData().getListInputOutputVariables() != null) {
|
||||||
seq = project.getInputData().getListSelectedRows().size();
|
seq = project.getInputData().getListInputOutputVariables().size();
|
||||||
} else {
|
} else {
|
||||||
seq = 0;
|
seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
SelectedRowsVariablesProperties props = GWT
|
InputOutputVariablesProperties props = GWT
|
||||||
.create(SelectedRowsVariablesProperties.class);
|
.create(InputOutputVariablesProperties.class);
|
||||||
|
|
||||||
ColumnConfig<SelectedRowsVariables, String> nameColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
ColumnConfig<InputOutputVariables, String> nameColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||||
props.name(), 100, "Name");
|
props.name(), 100, "Name");
|
||||||
// nameColumn.setMenuDisabled(true);
|
// nameColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<SelectedRowsVariables, String> descriptionColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
ColumnConfig<InputOutputVariables, String> descriptionColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||||
props.description(), 100, "Description");
|
props.description(), 100, "Description");
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<SelectedRowsVariables, DataType> dataTypeColumn = new ColumnConfig<SelectedRowsVariables, DataType>(
|
ColumnConfig<InputOutputVariables, DataType> dataTypeColumn = new ColumnConfig<InputOutputVariables, DataType>(
|
||||||
props.dataType(), 100, "Type");
|
props.dataType(), 100, "Type");
|
||||||
// inputTypeColumn.setMenuDisabled(true);
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
dataTypeColumn.setCell(new AbstractCell<DataType>() {
|
dataTypeColumn.setCell(new AbstractCell<DataType>() {
|
||||||
|
@ -135,11 +135,11 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ColumnConfig<SelectedRowsVariables, String> defaultValueColumn = new ColumnConfig<SelectedRowsVariables, String>(
|
ColumnConfig<InputOutputVariables, String> defaultValueColumn = new ColumnConfig<InputOutputVariables, String>(
|
||||||
props.defaultValue(), 100, "Default");
|
props.defaultValue(), 100, "Default");
|
||||||
// defaColumn.setMenuDisabled(true);
|
// defaColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<SelectedRowsVariables, IOType> ioTypeColumn = new ColumnConfig<SelectedRowsVariables, IOType>(
|
ColumnConfig<InputOutputVariables, IOType> ioTypeColumn = new ColumnConfig<InputOutputVariables, IOType>(
|
||||||
props.ioType(), 100, "I/O");
|
props.ioType(), 100, "I/O");
|
||||||
// inputTypeColumn.setMenuDisabled(true);
|
// inputTypeColumn.setMenuDisabled(true);
|
||||||
ioTypeColumn.setCell(new AbstractCell<IOType>() {
|
ioTypeColumn.setCell(new AbstractCell<IOType>() {
|
||||||
|
@ -153,58 +153,58 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ArrayList<ColumnConfig<SelectedRowsVariables, ?>> l = new ArrayList<ColumnConfig<SelectedRowsVariables, ?>>();
|
ArrayList<ColumnConfig<InputOutputVariables, ?>> l = new ArrayList<ColumnConfig<InputOutputVariables, ?>>();
|
||||||
l.add(nameColumn);
|
l.add(nameColumn);
|
||||||
l.add(descriptionColumn);
|
l.add(descriptionColumn);
|
||||||
l.add(dataTypeColumn);
|
l.add(dataTypeColumn);
|
||||||
l.add(defaultValueColumn);
|
l.add(defaultValueColumn);
|
||||||
l.add(ioTypeColumn);
|
l.add(ioTypeColumn);
|
||||||
|
|
||||||
ColumnModel<SelectedRowsVariables> columns = new ColumnModel<SelectedRowsVariables>(
|
ColumnModel<InputOutputVariables> columns = new ColumnModel<InputOutputVariables>(
|
||||||
l);
|
l);
|
||||||
|
|
||||||
storeSelectedRows = new ListStore<SelectedRowsVariables>(props.id());
|
storeInputOutputVariables = new ListStore<InputOutputVariables>(props.id());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ArrayList<SelectedRowsVariables> list = new ArrayList<>(); for (int i
|
* ArrayList<InputOutputVariablesVariables> list = new ArrayList<>(); for (int i
|
||||||
* = 0; i < 10; i++) { list.add(new SelectedRowsVariables(i, "Test" + i,
|
* = 0; i < 10; i++) { list.add(new InputOutputVariablesVariables(i, "Test" + i,
|
||||||
* "Desc", "defaultValue", InputType.STRING)); }
|
* "Desc", "defaultValue", InputType.STRING)); }
|
||||||
*
|
*
|
||||||
* storeEnvironmentVariable.addAll(list);
|
* storeEnvironmentVariable.addAll(list);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getListSelectedRows() != null) {
|
&& project.getInputData().getListInputOutputVariables() != null) {
|
||||||
storeSelectedRows.addAll(project.getInputData()
|
storeInputOutputVariables.addAll(project.getInputData()
|
||||||
.getListSelectedRows());
|
.getListInputOutputVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
final GridSelectionModel<SelectedRowsVariables> sm = new GridSelectionModel<SelectedRowsVariables>();
|
final GridSelectionModel<InputOutputVariables> sm = new GridSelectionModel<InputOutputVariables>();
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
gridSelectedRows = new Grid<SelectedRowsVariables>(storeSelectedRows,
|
gridInputOutputVariables = new Grid<InputOutputVariables>(storeInputOutputVariables,
|
||||||
columns);
|
columns);
|
||||||
gridSelectedRows.setSelectionModel(sm);
|
gridInputOutputVariables.setSelectionModel(sm);
|
||||||
gridSelectedRows.getView().setStripeRows(true);
|
gridInputOutputVariables.getView().setStripeRows(true);
|
||||||
gridSelectedRows.getView().setColumnLines(true);
|
gridInputOutputVariables.getView().setColumnLines(true);
|
||||||
gridSelectedRows.getView().setAutoExpandColumn(nameColumn);
|
gridInputOutputVariables.getView().setAutoExpandColumn(nameColumn);
|
||||||
gridSelectedRows.getView().setAutoFill(true);
|
gridInputOutputVariables.getView().setAutoFill(true);
|
||||||
gridSelectedRows.setBorders(false);
|
gridInputOutputVariables.setBorders(false);
|
||||||
gridSelectedRows.setColumnReordering(false);
|
gridInputOutputVariables.setColumnReordering(false);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GridDragSource<SelectedRowsVariables> ds = new
|
* GridDragSource<InputOutputVariablesVariables> ds = new
|
||||||
* GridDragSource<SelectedRowsVariables>( gridEnvironmentVariable);
|
* GridDragSource<InputOutputVariablesVariables>( gridEnvironmentVariable);
|
||||||
* ds.addDragStartHandler(new DndDragStartHandler() {
|
* ds.addDragStartHandler(new DndDragStartHandler() {
|
||||||
*
|
*
|
||||||
* @Override public void onDragStart(DndDragStartEvent event) {
|
* @Override public void onDragStart(DndDragStartEvent event) {
|
||||||
*
|
*
|
||||||
* @SuppressWarnings("unchecked") ArrayList<SelectedRowsVariables>
|
* @SuppressWarnings("unchecked") ArrayList<InputOutputVariablesVariables>
|
||||||
* draggingSelection = (ArrayList<SelectedRowsVariables>) event
|
* draggingSelection = (ArrayList<InputOutputVariablesVariables>) event
|
||||||
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
* .getData(); Log.debug("Start Drag: " + draggingSelection);
|
||||||
*
|
*
|
||||||
* } }); GridDropTarget<SelectedRowsVariables> dt = new
|
* } }); GridDropTarget<InputOutputVariablesVariables> dt = new
|
||||||
* GridDropTarget<SelectedRowsVariables>( gridEnvironmentVariable);
|
* GridDropTarget<InputOutputVariablesVariables>( gridEnvironmentVariable);
|
||||||
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
* dt.setFeedback(Feedback.BOTH); dt.setAllowSelfAsSource(true);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -249,24 +249,24 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
gridSelectedRowsEditing = new GridRowEditing<SelectedRowsVariables>(
|
gridInputOutputVariablesEditing = new GridRowEditing<InputOutputVariables>(
|
||||||
gridSelectedRows);
|
gridInputOutputVariables);
|
||||||
gridSelectedRowsEditing.addEditor(nameColumn, new TextField());
|
gridInputOutputVariablesEditing.addEditor(nameColumn, new TextField());
|
||||||
gridSelectedRowsEditing.addEditor(descriptionColumn, new TextField());
|
gridInputOutputVariablesEditing.addEditor(descriptionColumn, new TextField());
|
||||||
gridSelectedRowsEditing.addEditor(dataTypeColumn, comboDataType);
|
gridInputOutputVariablesEditing.addEditor(dataTypeColumn, comboDataType);
|
||||||
gridSelectedRowsEditing.addEditor(defaultValueColumn, new TextField());
|
gridInputOutputVariablesEditing.addEditor(defaultValueColumn, new TextField());
|
||||||
|
|
||||||
gridSelectedRowsEditing.addEditor(ioTypeColumn, comboIOType);
|
gridInputOutputVariablesEditing.addEditor(ioTypeColumn, comboIOType);
|
||||||
|
|
||||||
btnAdd = new TextButton();
|
btnAdd = new TextButton();
|
||||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
// btnAdd.setIconAlign(IconAlign.);
|
// btnAdd.setIconAlign(IconAlign.);
|
||||||
btnAdd.setToolTip("Add Environment Variable");
|
btnAdd.setToolTip("Add Input/Output Variable");
|
||||||
btnAdd.addSelectHandler(new SelectHandler() {
|
btnAdd.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
addSelectedRow(event);
|
addInputOutputVariable(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -274,77 +274,77 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
TextButton btnDelete = new TextButton("Delete");
|
TextButton btnDelete = new TextButton("Delete");
|
||||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
GridCell cell = gridSelectedRowsEditing.getActiveCell();
|
GridCell cell = gridInputOutputVariablesEditing.getActiveCell();
|
||||||
int rowIndex = cell.getRow();
|
int rowIndex = cell.getRow();
|
||||||
|
|
||||||
gridSelectedRowsEditing.cancelEditing();
|
gridInputOutputVariablesEditing.cancelEditing();
|
||||||
|
|
||||||
storeSelectedRows.remove(rowIndex);
|
storeInputOutputVariables.remove(rowIndex);
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
|
|
||||||
gridSelectedRowsEditing.getCancelButton().setVisible(true);
|
gridInputOutputVariablesEditing.getCancelButton().setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SelectedRowsVariables> listSelected=storeSelectedRows.getAll();
|
List<InputOutputVariables> listIOVariables=storeInputOutputVariables.getAll();
|
||||||
List<SelectedRowsVariables> listNewSelected= new ArrayList<SelectedRowsVariables>();
|
List<InputOutputVariables> listNewIOVariables= new ArrayList<InputOutputVariables>();
|
||||||
for(int i=0; i<listSelected.size(); i++){
|
for(int i=0; i<listIOVariables.size(); i++){
|
||||||
SelectedRowsVariables var=listSelected.get(i);
|
InputOutputVariables var=listIOVariables.get(i);
|
||||||
var.setId(i);
|
var.setId(i);
|
||||||
listNewSelected.add(var);
|
listNewIOVariables.add(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeSelectedRows.clear();
|
storeInputOutputVariables.clear();
|
||||||
storeSelectedRows.addAll(listNewSelected);
|
storeInputOutputVariables.addAll(listNewIOVariables);
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
|
|
||||||
seq=listNewSelected.size();
|
seq=listNewIOVariables.size();
|
||||||
Log.debug("Current Seq: "+seq);
|
Log.debug("Current Seq: "+seq);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonBar buttonBar = gridSelectedRowsEditing.getButtonBar();
|
ButtonBar buttonBar = gridInputOutputVariablesEditing.getButtonBar();
|
||||||
buttonBar.add(btnDelete);
|
buttonBar.add(btnDelete);
|
||||||
|
|
||||||
gridSelectedRowsEditing
|
gridInputOutputVariablesEditing
|
||||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<SelectedRowsVariables>() {
|
.addBeforeStartEditHandler(new BeforeStartEditHandler<InputOutputVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeStartEdit(
|
public void onBeforeStartEdit(
|
||||||
BeforeStartEditEvent<SelectedRowsVariables> event) {
|
BeforeStartEditEvent<InputOutputVariables> event) {
|
||||||
editingBeforeStart(event);
|
editingBeforeStart(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gridSelectedRowsEditing
|
gridInputOutputVariablesEditing
|
||||||
.addCancelEditHandler(new CancelEditHandler<SelectedRowsVariables>() {
|
.addCancelEditHandler(new CancelEditHandler<InputOutputVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelEdit(
|
public void onCancelEdit(
|
||||||
CancelEditEvent<SelectedRowsVariables> event) {
|
CancelEditEvent<InputOutputVariables> event) {
|
||||||
storeSelectedRows.rejectChanges();
|
storeInputOutputVariables.rejectChanges();
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gridSelectedRowsEditing
|
gridInputOutputVariablesEditing
|
||||||
.addCompleteEditHandler(new CompleteEditHandler<SelectedRowsVariables>() {
|
.addCompleteEditHandler(new CompleteEditHandler<InputOutputVariables>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCompleteEdit(
|
public void onCompleteEdit(
|
||||||
CompleteEditEvent<SelectedRowsVariables> event) {
|
CompleteEditEvent<InputOutputVariables> event) {
|
||||||
try {
|
try {
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
|
|
||||||
gridSelectedRowsEditing.getCancelButton()
|
gridInputOutputVariablesEditing.getCancelButton()
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
@ -364,14 +364,14 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
vlc.setScrollMode(ScrollMode.NONE);
|
vlc.setScrollMode(ScrollMode.NONE);
|
||||||
|
|
||||||
// vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
// vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(gridSelectedRows, new VerticalLayoutData(1, 1, new Margins(0)));
|
vlc.add(gridInputOutputVariables, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
|
|
||||||
add(vlc, new MarginData(new Margins(0)));
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editingBeforeStart(
|
private void editingBeforeStart(
|
||||||
BeforeStartEditEvent<SelectedRowsVariables> event) {
|
BeforeStartEditEvent<InputOutputVariables> event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -386,18 +386,18 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNewSelectedRowsVariable(
|
public void addNewInputOutputVariables(
|
||||||
SelectedRowsVariables selectedRowsVariable) {
|
InputOutputVariables inputOutputVariable) {
|
||||||
try {
|
try {
|
||||||
Log.debug("Current Seq: " + seq);
|
Log.debug("Current Seq: " + seq);
|
||||||
seq++;
|
seq++;
|
||||||
selectedRowsVariable.setId(seq);
|
inputOutputVariable.setId(seq);
|
||||||
Log.debug("New Selected Rows Variable: " + selectedRowsVariable);
|
Log.debug("New Input/Output Variable: " + inputOutputVariable);
|
||||||
storeSelectedRows.add(selectedRowsVariable);
|
storeInputOutputVariables.add(inputOutputVariable);
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
|
|
||||||
if (gridSelectedRowsEditing.isEditing()) {
|
if (gridInputOutputVariablesEditing.isEditing()) {
|
||||||
gridSelectedRowsEditing.cancelEditing();
|
gridInputOutputVariablesEditing.cancelEditing();
|
||||||
}
|
}
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -406,18 +406,18 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSelectedRow(SelectEvent event) {
|
private void addInputOutputVariable(SelectEvent event) {
|
||||||
try {
|
try {
|
||||||
Log.debug("Current Seq: " + seq);
|
Log.debug("Current Seq: " + seq);
|
||||||
seq++;
|
seq++;
|
||||||
SelectedRowsVariables newSelectedRowsVariable = new SelectedRowsVariables(
|
InputOutputVariables newInputOutputVariablesVariable = new InputOutputVariables(
|
||||||
seq, "", "", "", DataType.STRING, IOType.INPUT, "");
|
seq, "", "", "", DataType.STRING, IOType.INPUT, "");
|
||||||
Log.debug("New Selected Rows Variable: " + newSelectedRowsVariable);
|
Log.debug("New Input/Output Variable: " + newInputOutputVariablesVariable);
|
||||||
gridSelectedRowsEditing.cancelEditing();
|
gridInputOutputVariablesEditing.cancelEditing();
|
||||||
addStatus = true;
|
addStatus = true;
|
||||||
gridSelectedRowsEditing.getCancelButton().setVisible(false);
|
gridInputOutputVariablesEditing.getCancelButton().setVisible(false);
|
||||||
storeSelectedRows.add(newSelectedRowsVariable);
|
storeInputOutputVariables.add(newInputOutputVariablesVariable);
|
||||||
int row = storeSelectedRows.indexOf(newSelectedRowsVariable);
|
int row = storeInputOutputVariables.indexOf(newInputOutputVariablesVariable);
|
||||||
|
|
||||||
storeComboDataType.clear();
|
storeComboDataType.clear();
|
||||||
storeComboDataType.addAll(DataType.asList());
|
storeComboDataType.addAll(DataType.asList());
|
||||||
|
@ -427,39 +427,39 @@ public class SelectedRowsPanel extends ContentPanel {
|
||||||
storeComboIOType.addAll(IOType.asList());
|
storeComboIOType.addAll(IOType.asList());
|
||||||
storeComboIOType.commitChanges();
|
storeComboIOType.commitChanges();
|
||||||
|
|
||||||
gridSelectedRowsEditing.startEditing(new GridCell(row, 0));
|
gridInputOutputVariablesEditing.startEditing(new GridCell(row, 0));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update(Project project) {
|
public void update(Project project) {
|
||||||
Log.debug("Update Selected Rows: " + project);
|
Log.debug("Update Input/Output Variables: " + project);
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getListSelectedRows() != null) {
|
&& project.getInputData().getListInputOutputVariables() != null) {
|
||||||
storeSelectedRows.clear();
|
storeInputOutputVariables.clear();
|
||||||
storeSelectedRows.addAll(project.getInputData()
|
storeInputOutputVariables.addAll(project.getInputData()
|
||||||
.getListSelectedRows());
|
.getListInputOutputVariables());
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
seq = project.getInputData().getListSelectedRows().size();
|
seq = project.getInputData().getListInputOutputVariables().size();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
storeSelectedRows.clear();
|
storeInputOutputVariables.clear();
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
seq=0;
|
seq=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<SelectedRowsVariables> getSelectedRows() {
|
public ArrayList<InputOutputVariables> getInputOutputVariables() {
|
||||||
ArrayList<SelectedRowsVariables> listEnviromentVarialbles = new ArrayList<>(
|
ArrayList<InputOutputVariables> listInputOutputVarialbles = new ArrayList<>(
|
||||||
gridSelectedRows.getStore().getAll());
|
gridInputOutputVariables.getStore().getAll());
|
||||||
return listEnviromentVarialbles;
|
return listInputOutputVarialbles;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMainCode(Project project) {
|
public void setMainCode(Project project) {
|
||||||
storeSelectedRows.clear();
|
storeInputOutputVariables.clear();
|
||||||
storeSelectedRows.commitChanges();
|
storeInputOutputVariables.commitChanges();
|
||||||
seq = 0;
|
seq = 0;
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
|
@ -11,11 +11,11 @@ import com.google.gwt.i18n.client.Messages;
|
||||||
public interface InputVariableMessages extends Messages {
|
public interface InputVariableMessages extends Messages {
|
||||||
|
|
||||||
//
|
//
|
||||||
@DefaultMessage("Selected Rows")
|
@DefaultMessage("Input/Output")
|
||||||
String selectedRows();
|
String inputOutputVariables();
|
||||||
|
|
||||||
@DefaultMessage("Enviroment Variables")
|
@DefaultMessage("Global Variables")
|
||||||
String environmentVariables();
|
String globalVariables();
|
||||||
|
|
||||||
@DefaultMessage("Interpreter")
|
@DefaultMessage("Interpreter")
|
||||||
String interpreterInfo();
|
String interpreterInfo();
|
||||||
|
|
|
@ -3,7 +3,7 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputRequestEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.NewSelectedRowsVariableEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.ProjectStatusEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -97,7 +97,7 @@ public class InputVariablePanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addNewSelectedRowsVariable(
|
protected void addNewSelectedRowsVariable(
|
||||||
SelectedRowsVariables selectedRowsVariable) {
|
InputOutputVariables selectedRowsVariable) {
|
||||||
inputVariableTabPanel.addSelectedRowsVariable(selectedRowsVariable);
|
inputVariableTabPanel.addSelectedRowsVariable(selectedRowsVariable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.event.InputReadyEvent;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.InputData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ import com.sencha.gxt.widget.core.client.TabPanel;
|
||||||
public class InputVariableTabPanel extends TabPanel {
|
public class InputVariableTabPanel extends TabPanel {
|
||||||
private InputVariableMessages msgs;
|
private InputVariableMessages msgs;
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private EnvironmentVariablesPanel enviromentVariablesPanel;
|
private GlobalVariablesPanel globalVariablesPanel;
|
||||||
private SelectedRowsPanel selectedRowsPanel;
|
private InputOutputVariablesPanel inputOutputVariablesPanel;
|
||||||
private InterpreterInfoPanel interpreterInfoPanel;
|
private InterpreterInfoPanel interpreterInfoPanel;
|
||||||
private ProjectInfoPanel projectInfoPanel;
|
private ProjectInfoPanel projectInfoPanel;
|
||||||
|
|
||||||
|
@ -48,8 +48,8 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
public void startTabs(Project project) {
|
public void startTabs(Project project) {
|
||||||
Log.debug("Start InputVariable Tabs");
|
Log.debug("Start InputVariable Tabs");
|
||||||
addEnvironmentVariablesPanel(project);
|
addGlobalVariablesPanel(project);
|
||||||
addSelectedRowsPanel(project);
|
addInputOutputVariablesPanel(project);
|
||||||
addInterpreterInfoPanel(project);
|
addInterpreterInfoPanel(project);
|
||||||
addProjectInfoPanel(project);
|
addProjectInfoPanel(project);
|
||||||
setActiveWidget(getWidget(0));
|
setActiveWidget(getWidget(0));
|
||||||
|
@ -77,8 +77,8 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
//
|
//
|
||||||
public void setMainCode(Project project) {
|
public void setMainCode(Project project) {
|
||||||
try {
|
try {
|
||||||
enviromentVariablesPanel.setMainCode(project);
|
globalVariablesPanel.setMainCode(project);
|
||||||
selectedRowsPanel.setMainCode(project);
|
inputOutputVariablesPanel.setMainCode(project);
|
||||||
|
|
||||||
forceLayout();
|
forceLayout();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
@ -91,8 +91,8 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
public void updateTabs(Project project) {
|
public void updateTabs(Project project) {
|
||||||
try {
|
try {
|
||||||
enviromentVariablesPanel.update(project);
|
globalVariablesPanel.update(project);
|
||||||
selectedRowsPanel.update(project);
|
inputOutputVariablesPanel.update(project);
|
||||||
interpreterInfoPanel.update(project);
|
interpreterInfoPanel.update(project);
|
||||||
projectInfoPanel.update(project);
|
projectInfoPanel.update(project);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
@ -105,14 +105,14 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
public void requestInput() {
|
public void requestInput() {
|
||||||
InputData inputData = new InputData();
|
InputData inputData = new InputData();
|
||||||
if (enviromentVariablesPanel != null) {
|
if (globalVariablesPanel != null) {
|
||||||
inputData.setListEnvironmentVariables(enviromentVariablesPanel
|
inputData.setListGlobalVariables(globalVariablesPanel
|
||||||
.getEnvironmentVariables());
|
.getGlobalVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedRowsPanel != null) {
|
if (inputOutputVariablesPanel != null) {
|
||||||
inputData.setListSelectedRows(selectedRowsPanel
|
inputData.setListInputOutputVariables(inputOutputVariablesPanel
|
||||||
.getSelectedRows());
|
.getInputOutputVariables());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interpreterInfoPanel != null) {
|
if (interpreterInfoPanel != null) {
|
||||||
|
@ -134,24 +134,24 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add
|
// Add
|
||||||
private void addSelectedRowsPanel(Project project) {
|
private void addInputOutputVariablesPanel(Project project) {
|
||||||
TabItemConfig selectedRowsPanelItemConf = new TabItemConfig(
|
TabItemConfig inputOutputPanelItemConf = new TabItemConfig(
|
||||||
msgs.selectedRows(), false);
|
msgs.inputOutputVariables(), false);
|
||||||
|
|
||||||
selectedRowsPanel = new SelectedRowsPanel(project, eventBus);
|
inputOutputVariablesPanel = new InputOutputVariablesPanel(project, eventBus);
|
||||||
selectedRowsPanel.setHeaderVisible(false);
|
inputOutputVariablesPanel.setHeaderVisible(false);
|
||||||
add(selectedRowsPanel, selectedRowsPanelItemConf);
|
add(inputOutputVariablesPanel, inputOutputPanelItemConf);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addEnvironmentVariablesPanel(Project project) {
|
private void addGlobalVariablesPanel(Project project) {
|
||||||
TabItemConfig enviromentVariablePanelItemConf = new TabItemConfig(
|
TabItemConfig globalVariablePanelItemConf = new TabItemConfig(
|
||||||
msgs.environmentVariables(), false);
|
msgs.globalVariables(), false);
|
||||||
|
|
||||||
enviromentVariablesPanel = new EnvironmentVariablesPanel(project,
|
globalVariablesPanel = new GlobalVariablesPanel(project,
|
||||||
eventBus);
|
eventBus);
|
||||||
enviromentVariablesPanel.setHeaderVisible(false);
|
globalVariablesPanel.setHeaderVisible(false);
|
||||||
add(enviromentVariablesPanel, enviromentVariablePanelItemConf);
|
add(globalVariablesPanel, globalVariablePanelItemConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addInterpreterInfoPanel(Project project) {
|
private void addInterpreterInfoPanel(Project project) {
|
||||||
|
@ -176,9 +176,9 @@ public class InputVariableTabPanel extends TabPanel {
|
||||||
|
|
||||||
|
|
||||||
public void addSelectedRowsVariable(
|
public void addSelectedRowsVariable(
|
||||||
SelectedRowsVariables selectedRowsVariable) {
|
InputOutputVariables inputOutputVariable) {
|
||||||
setActiveWidget(selectedRowsPanel);
|
setActiveWidget(inputOutputVariablesPanel);
|
||||||
selectedRowsPanel.addNewSelectedRowsVariable(selectedRowsVariable);
|
inputOutputVariablesPanel.addNewInputOutputVariables(inputOutputVariable);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,17 +82,7 @@ public class InterpreterInfoPanel extends ContentPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void create(Project project) {
|
private void create(Project project) {
|
||||||
if (project != null
|
|
||||||
&& project.getInputData() != null
|
|
||||||
&& project.getInputData().getInterpreterInfo() != null
|
|
||||||
&& project.getInputData().getInterpreterInfo()
|
|
||||||
.getInterpreterPackagesInfo() != null) {
|
|
||||||
seq = project.getInputData().getInterpreterInfo()
|
|
||||||
.getInterpreterPackagesInfo().size();
|
|
||||||
} else {
|
|
||||||
seq = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
InterpreterPackageInfoProperties props = GWT
|
InterpreterPackageInfoProperties props = GWT
|
||||||
.create(InterpreterPackageInfoProperties.class);
|
.create(InterpreterPackageInfoProperties.class);
|
||||||
|
@ -130,6 +120,10 @@ public class InterpreterInfoPanel extends ContentPanel {
|
||||||
.getInterpreterPackagesInfo() != null) {
|
.getInterpreterPackagesInfo() != null) {
|
||||||
storeInterpreterPackageInfo.addAll(project.getInputData()
|
storeInterpreterPackageInfo.addAll(project.getInputData()
|
||||||
.getInterpreterInfo().getInterpreterPackagesInfo());
|
.getInterpreterInfo().getInterpreterPackagesInfo());
|
||||||
|
seq = project.getInputData().getInterpreterInfo()
|
||||||
|
.getInterpreterPackagesInfo().size();
|
||||||
|
} else {
|
||||||
|
seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
final GridSelectionModel<InterpreterPackageInfo> sm = new GridSelectionModel<InterpreterPackageInfo>();
|
final GridSelectionModel<InterpreterPackageInfo> sm = new GridSelectionModel<InterpreterPackageInfo>();
|
||||||
|
@ -349,6 +343,8 @@ public class InterpreterInfoPanel extends ContentPanel {
|
||||||
interpreterVersion.setValue(project.getInputData()
|
interpreterVersion.setValue(project.getInputData()
|
||||||
.getInterpreterInfo().getVersion());
|
.getInterpreterInfo().getVersion());
|
||||||
|
|
||||||
|
} else {
|
||||||
|
interpreterVersion.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.getInputData().getInterpreterInfo()
|
if (project.getInputData().getInterpreterInfo()
|
||||||
|
@ -358,7 +354,7 @@ public class InterpreterInfoPanel extends ContentPanel {
|
||||||
storeInterpreterPackageInfo.addAll(project.getInputData()
|
storeInterpreterPackageInfo.addAll(project.getInputData()
|
||||||
.getInterpreterInfo().getInterpreterPackagesInfo());
|
.getInterpreterInfo().getInterpreterPackagesInfo());
|
||||||
storeInterpreterPackageInfo.commitChanges();
|
storeInterpreterPackageInfo.commitChanges();
|
||||||
seq = project.getInputData().getListSelectedRows().size();
|
seq = project.getInputData().getInterpreterInfo().getInterpreterPackagesInfo().size();
|
||||||
} else {
|
} else {
|
||||||
seq = 0;
|
seq = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.DeployableVREProperties;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.RequestedVREProperties;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DeployableVRE;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.RequestedVRE;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
private TextField packageName;
|
private TextField algorithmName;
|
||||||
private TextField packageDescription;
|
private TextField algorithmDescription;
|
||||||
private ListStore<DeployableVRE> storeDeployableVRE;
|
private ListStore<RequestedVRE> storeRequestedVRE;
|
||||||
private Grid<DeployableVRE> gridDeployableVRE;
|
private Grid<RequestedVRE> gridRequestedVRE;
|
||||||
private GridRowEditing<DeployableVRE> gridDeployableVREEditing;
|
private GridRowEditing<RequestedVRE> gridRequestedVREEditing;
|
||||||
private TextButton btnAdd;
|
private TextButton btnAdd;
|
||||||
private boolean addStatus;
|
private boolean addStatus;
|
||||||
private int seq = 0;
|
private int seq = 0;
|
||||||
|
@ -89,86 +89,87 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
|
|
||||||
private void create(Project project) {
|
private void create(Project project) {
|
||||||
|
|
||||||
packageName = new TextField();
|
algorithmName = new TextField();
|
||||||
packageName.setAllowBlank(false);
|
algorithmName.setAllowBlank(false);
|
||||||
packageName.addValidator(new RegExValidator("^[a-zA-Z0-9]*$", "Attention only characters a-z,A-Z,0-9 are allowed"));
|
algorithmName.addValidator(new RegExValidator("^[a-zA-Z0-9_]*$",
|
||||||
packageName.setEmptyText("Enter name...");
|
"Attention only characters a-z,A-Z,0-9 are allowed"));
|
||||||
packageName.addChangeHandler(new ChangeHandler() {
|
algorithmName.setEmptyText("Enter name...");
|
||||||
|
algorithmName.addChangeHandler(new ChangeHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange(ChangeEvent event) {
|
public void onChange(ChangeEvent event) {
|
||||||
packageName.validate();
|
algorithmName.validate();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
FieldLabel packageNameLabel = new FieldLabel(packageName, "Name");
|
|
||||||
|
|
||||||
packageDescription = new TextField();
|
|
||||||
packageDescription.setAllowBlank(false);
|
|
||||||
packageDescription.setEmptyText("Enter description...");
|
|
||||||
FieldLabel projectDescriptionLabel = new FieldLabel(packageDescription,
|
|
||||||
"Description");
|
|
||||||
|
|
||||||
if (project != null && project.getInputData() != null
|
|
||||||
&& project.getInputData().getProjectInfo() != null) {
|
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getPackageName() != null) {
|
FieldLabel packageNameLabel = new FieldLabel(algorithmName, "Name");
|
||||||
packageName.setValue(project.getInputData().getProjectInfo()
|
|
||||||
.getPackageName());
|
|
||||||
}
|
|
||||||
if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
|
|
||||||
packageDescription.setValue(project.getInputData()
|
|
||||||
.getProjectInfo().getPackageDescription());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
algorithmDescription = new TextField();
|
||||||
|
algorithmDescription.setAllowBlank(false);
|
||||||
|
algorithmDescription.setEmptyText("Enter description...");
|
||||||
|
FieldLabel projectDescriptionLabel = new FieldLabel(
|
||||||
|
algorithmDescription, "Description");
|
||||||
|
|
||||||
// Grid
|
// Grid
|
||||||
DeployableVREProperties props = GWT
|
RequestedVREProperties props = GWT
|
||||||
.create(DeployableVREProperties.class);
|
.create(RequestedVREProperties.class);
|
||||||
|
|
||||||
ColumnConfig<DeployableVRE, String> nameColumn = new ColumnConfig<DeployableVRE, String>(
|
ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
|
||||||
props.name(), 100, "Name");
|
props.name(), 100, "Name");
|
||||||
// nameColumn.setMenuDisabled(true);
|
// nameColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ColumnConfig<DeployableVRE, String> descriptionColumn = new ColumnConfig<DeployableVRE, String>(
|
ColumnConfig<RequestedVRE, String> descriptionColumn = new ColumnConfig<RequestedVRE, String>(
|
||||||
props.description(), 100, "Description");
|
props.description(), 100, "Description");
|
||||||
// descriptionColumn.setMenuDisabled(true);
|
// descriptionColumn.setMenuDisabled(true);
|
||||||
|
|
||||||
ArrayList<ColumnConfig<DeployableVRE, ?>> l = new ArrayList<ColumnConfig<DeployableVRE, ?>>();
|
ArrayList<ColumnConfig<RequestedVRE, ?>> l = new ArrayList<ColumnConfig<RequestedVRE, ?>>();
|
||||||
l.add(nameColumn);
|
l.add(nameColumn);
|
||||||
l.add(descriptionColumn);
|
l.add(descriptionColumn);
|
||||||
|
|
||||||
ColumnModel<DeployableVRE> columns = new ColumnModel<DeployableVRE>(l);
|
ColumnModel<RequestedVRE> columns = new ColumnModel<RequestedVRE>(l);
|
||||||
|
|
||||||
storeDeployableVRE = new ListStore<DeployableVRE>(props.id());
|
storeRequestedVRE = new ListStore<RequestedVRE>(props.id());
|
||||||
|
|
||||||
|
if (project != null && project.getInputData() != null
|
||||||
|
&& project.getInputData().getProjectInfo() != null) {
|
||||||
|
|
||||||
|
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||||
|
algorithmName.setValue(project.getInputData().getProjectInfo()
|
||||||
|
.getAlgorithmName());
|
||||||
|
}
|
||||||
|
if (project.getInputData().getProjectInfo()
|
||||||
|
.getAlgorithmDescription() != null) {
|
||||||
|
algorithmDescription.setValue(project.getInputData()
|
||||||
|
.getProjectInfo().getAlgorithmDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
|
||||||
|
storeRequestedVRE.addAll(project.getInputData()
|
||||||
|
.getProjectInfo().getListRequestedVRE());
|
||||||
|
seq = project.getInputData().getProjectInfo()
|
||||||
|
.getListRequestedVRE().size();
|
||||||
|
}
|
||||||
|
|
||||||
if (project != null && project.getInputData() != null && project.getInputData().getProjectInfo()!=null
|
|
||||||
&& project.getInputData().getProjectInfo().getListDeployableVRE() != null) {
|
|
||||||
storeDeployableVRE.addAll(project.getInputData().getProjectInfo()
|
|
||||||
.getListDeployableVRE());
|
|
||||||
seq = project.getInputData().getProjectInfo()
|
|
||||||
.getListDeployableVRE().size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final GridSelectionModel<DeployableVRE> sm = new GridSelectionModel<DeployableVRE>();
|
final GridSelectionModel<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>();
|
||||||
sm.setSelectionMode(SelectionMode.SINGLE);
|
sm.setSelectionMode(SelectionMode.SINGLE);
|
||||||
|
|
||||||
gridDeployableVRE = new Grid<DeployableVRE>(storeDeployableVRE, columns);
|
gridRequestedVRE = new Grid<RequestedVRE>(storeRequestedVRE, columns);
|
||||||
gridDeployableVRE.setSelectionModel(sm);
|
gridRequestedVRE.setSelectionModel(sm);
|
||||||
gridDeployableVRE.getView().setStripeRows(true);
|
gridRequestedVRE.getView().setStripeRows(true);
|
||||||
gridDeployableVRE.getView().setColumnLines(true);
|
gridRequestedVRE.getView().setColumnLines(true);
|
||||||
gridDeployableVRE.getView().setAutoExpandColumn(nameColumn);
|
gridRequestedVRE.getView().setAutoExpandColumn(nameColumn);
|
||||||
gridDeployableVRE.getView().setAutoFill(true);
|
gridRequestedVRE.getView().setAutoFill(true);
|
||||||
gridDeployableVRE.setBorders(false);
|
gridRequestedVRE.setBorders(false);
|
||||||
gridDeployableVRE.setColumnReordering(false);
|
gridRequestedVRE.setColumnReordering(false);
|
||||||
|
|
||||||
// EDITING //
|
// EDITING //
|
||||||
gridDeployableVREEditing = new GridRowEditing<DeployableVRE>(
|
gridRequestedVREEditing = new GridRowEditing<RequestedVRE>(
|
||||||
gridDeployableVRE);
|
gridRequestedVRE);
|
||||||
gridDeployableVREEditing.addEditor(nameColumn, new TextField());
|
gridRequestedVREEditing.addEditor(nameColumn, new TextField());
|
||||||
gridDeployableVREEditing.addEditor(descriptionColumn, new TextField());
|
gridRequestedVREEditing.addEditor(descriptionColumn, new TextField());
|
||||||
|
|
||||||
btnAdd = new TextButton("Add");
|
btnAdd = new TextButton("Add");
|
||||||
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
btnAdd.setIcon(StatAlgoImporterResources.INSTANCE.add16());
|
||||||
|
@ -179,7 +180,7 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
addDeployableVRE(event);
|
addRequestedVRE(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -187,77 +188,77 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
TextButton btnDelete = new TextButton("Delete");
|
TextButton btnDelete = new TextButton("Delete");
|
||||||
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
btnDelete.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
GridCell cell = gridDeployableVREEditing.getActiveCell();
|
GridCell cell = gridRequestedVREEditing.getActiveCell();
|
||||||
int rowIndex = cell.getRow();
|
int rowIndex = cell.getRow();
|
||||||
|
|
||||||
gridDeployableVREEditing.cancelEditing();
|
gridRequestedVREEditing.cancelEditing();
|
||||||
|
|
||||||
storeDeployableVRE.remove(rowIndex);
|
storeRequestedVRE.remove(rowIndex);
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
|
|
||||||
gridDeployableVREEditing.getCancelButton().setVisible(true);
|
gridRequestedVREEditing.getCancelButton().setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<DeployableVRE> listSelected = storeDeployableVRE.getAll();
|
List<RequestedVRE> listSelected = storeRequestedVRE.getAll();
|
||||||
List<DeployableVRE> listNewSelected = new ArrayList<DeployableVRE>();
|
List<RequestedVRE> listNewSelected = new ArrayList<RequestedVRE>();
|
||||||
for (int i = 0; i < listSelected.size(); i++) {
|
for (int i = 0; i < listSelected.size(); i++) {
|
||||||
DeployableVRE var = listSelected.get(i);
|
RequestedVRE var = listSelected.get(i);
|
||||||
var.setId(i);
|
var.setId(i);
|
||||||
listNewSelected.add(var);
|
listNewSelected.add(var);
|
||||||
}
|
}
|
||||||
|
|
||||||
storeDeployableVRE.clear();
|
storeRequestedVRE.clear();
|
||||||
storeDeployableVRE.addAll(listNewSelected);
|
storeRequestedVRE.addAll(listNewSelected);
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
|
|
||||||
seq = listNewSelected.size();
|
seq = listNewSelected.size();
|
||||||
Log.debug("Current Seq: " + seq);
|
Log.debug("Current Seq: " + seq);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
ButtonBar buttonBar = gridDeployableVREEditing.getButtonBar();
|
ButtonBar buttonBar = gridRequestedVREEditing.getButtonBar();
|
||||||
buttonBar.add(btnDelete);
|
buttonBar.add(btnDelete);
|
||||||
|
|
||||||
gridDeployableVREEditing
|
gridRequestedVREEditing
|
||||||
.addBeforeStartEditHandler(new BeforeStartEditHandler<DeployableVRE>() {
|
.addBeforeStartEditHandler(new BeforeStartEditHandler<RequestedVRE>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBeforeStartEdit(
|
public void onBeforeStartEdit(
|
||||||
BeforeStartEditEvent<DeployableVRE> event) {
|
BeforeStartEditEvent<RequestedVRE> event) {
|
||||||
editingBeforeStart(event);
|
editingBeforeStart(event);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gridDeployableVREEditing
|
gridRequestedVREEditing
|
||||||
.addCancelEditHandler(new CancelEditHandler<DeployableVRE>() {
|
.addCancelEditHandler(new CancelEditHandler<RequestedVRE>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancelEdit(
|
public void onCancelEdit(
|
||||||
CancelEditEvent<DeployableVRE> event) {
|
CancelEditEvent<RequestedVRE> event) {
|
||||||
storeDeployableVRE.rejectChanges();
|
storeRequestedVRE.rejectChanges();
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gridDeployableVREEditing
|
gridRequestedVREEditing
|
||||||
.addCompleteEditHandler(new CompleteEditHandler<DeployableVRE>() {
|
.addCompleteEditHandler(new CompleteEditHandler<RequestedVRE>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCompleteEdit(
|
public void onCompleteEdit(
|
||||||
CompleteEditEvent<DeployableVRE> event) {
|
CompleteEditEvent<RequestedVRE> event) {
|
||||||
try {
|
try {
|
||||||
if (addStatus) {
|
if (addStatus) {
|
||||||
addStatus = false;
|
addStatus = false;
|
||||||
}
|
}
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
|
|
||||||
gridDeployableVREEditing.getCancelButton()
|
gridRequestedVREEditing.getCancelButton()
|
||||||
.setVisible(true);
|
.setVisible(true);
|
||||||
btnAdd.setEnabled(true);
|
btnAdd.setEnabled(true);
|
||||||
|
|
||||||
|
@ -269,7 +270,7 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
// /
|
// /
|
||||||
FieldLabel deployableVRELabel = new FieldLabel(null, "Deployable VRE");
|
FieldLabel requestedVRELabel = new FieldLabel(null, "Requested VREs");
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar();
|
ToolBar toolBar = new ToolBar();
|
||||||
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
|
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
|
||||||
|
@ -281,9 +282,10 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
vlc.add(packageNameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(packageNameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(projectDescriptionLabel, new VerticalLayoutData(1, -1,
|
vlc.add(projectDescriptionLabel, new VerticalLayoutData(1, -1,
|
||||||
new Margins(0)));
|
new Margins(0)));
|
||||||
vlc.add(deployableVRELabel, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(requestedVRELabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(0)));
|
||||||
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
vlc.add(toolBar, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
vlc.add(gridDeployableVRE, new VerticalLayoutData(1, 1, new Margins(0)));
|
vlc.add(gridRequestedVRE, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
|
|
||||||
add(vlc, new MarginData(new Margins(0)));
|
add(vlc, new MarginData(new Margins(0)));
|
||||||
}
|
}
|
||||||
|
@ -293,72 +295,73 @@ public class ProjectInfoPanel extends ContentPanel {
|
||||||
if (project != null && project.getInputData() != null
|
if (project != null && project.getInputData() != null
|
||||||
&& project.getInputData().getProjectInfo() != null) {
|
&& project.getInputData().getProjectInfo() != null) {
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getPackageName() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||||
packageName.setValue(project.getInputData().getProjectInfo()
|
algorithmName.setValue(project.getInputData().getProjectInfo()
|
||||||
.getPackageName());
|
.getAlgorithmName());
|
||||||
} else {
|
} else {
|
||||||
packageName.clear();
|
algorithmName.clear();
|
||||||
}
|
}
|
||||||
if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
|
if (project.getInputData().getProjectInfo()
|
||||||
packageDescription.setValue(project.getInputData()
|
.getAlgorithmDescription() != null) {
|
||||||
.getProjectInfo().getPackageDescription());
|
algorithmDescription.setValue(project.getInputData()
|
||||||
|
.getProjectInfo().getAlgorithmDescription());
|
||||||
} else {
|
} else {
|
||||||
packageDescription.clear();
|
algorithmDescription.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getListDeployableVRE() != null) {
|
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
|
||||||
storeDeployableVRE.clear();
|
storeRequestedVRE.clear();
|
||||||
storeDeployableVRE.addAll(project.getInputData()
|
storeRequestedVRE.addAll(project.getInputData()
|
||||||
.getProjectInfo().getListDeployableVRE());
|
.getProjectInfo().getListRequestedVRE());
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
seq = project.getInputData().getProjectInfo()
|
seq = project.getInputData().getProjectInfo()
|
||||||
.getListDeployableVRE().size();
|
.getListRequestedVRE().size();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
storeDeployableVRE.clear();
|
storeRequestedVRE.clear();
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
seq = 0;
|
seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
packageName.clear();
|
algorithmName.clear();
|
||||||
packageDescription.clear();
|
algorithmDescription.clear();
|
||||||
storeDeployableVRE.clear();
|
storeRequestedVRE.clear();
|
||||||
storeDeployableVRE.commitChanges();
|
storeRequestedVRE.commitChanges();
|
||||||
seq = 0;
|
seq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editingBeforeStart(BeforeStartEditEvent<DeployableVRE> event) {
|
private void editingBeforeStart(BeforeStartEditEvent<RequestedVRE> event) {
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDeployableVRE(SelectEvent event) {
|
private void addRequestedVRE(SelectEvent event) {
|
||||||
try {
|
try {
|
||||||
seq++;
|
seq++;
|
||||||
DeployableVRE newEnvironmentVariable = new DeployableVRE(seq, "",
|
RequestedVRE newRequestedVRE = new RequestedVRE(seq, "",
|
||||||
"");
|
"");
|
||||||
Log.debug("New DeployableVRE: " + newEnvironmentVariable);
|
Log.debug("New RequestedVRE: " + newRequestedVRE);
|
||||||
gridDeployableVREEditing.cancelEditing();
|
gridRequestedVREEditing.cancelEditing();
|
||||||
addStatus = true;
|
addStatus = true;
|
||||||
gridDeployableVREEditing.getCancelButton().setVisible(false);
|
gridRequestedVREEditing.getCancelButton().setVisible(false);
|
||||||
storeDeployableVRE.add(newEnvironmentVariable);
|
storeRequestedVRE.add(newRequestedVRE);
|
||||||
int row = storeDeployableVRE.indexOf(newEnvironmentVariable);
|
int row = storeRequestedVRE.indexOf(newRequestedVRE);
|
||||||
|
|
||||||
gridDeployableVREEditing.startEditing(new GridCell(row, 0));
|
gridRequestedVREEditing.startEditing(new GridCell(row, 0));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectInfo getProjectInfo() {
|
public ProjectInfo getProjectInfo() {
|
||||||
String name = packageName.getCurrentValue();
|
String name = algorithmName.getCurrentValue();
|
||||||
String description = packageDescription.getCurrentValue();
|
String description = algorithmDescription.getCurrentValue();
|
||||||
ArrayList<DeployableVRE> listDeployableVRE = new ArrayList<>(
|
ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>(
|
||||||
gridDeployableVRE.getStore().getAll());
|
gridRequestedVRE.getStore().getAll());
|
||||||
return new ProjectInfo(name, description, listDeployableVRE);
|
return new ProjectInfo(name, description, listRequestedVRE);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ import org.gcube.portlets.user.statisticalalgorithmsimporter.client.rpc.StatAlgo
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.file.CodeReader;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.generator.ProjectBuilder;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.FilesStorage;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.MainCodeSave;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.ProjectArchiver;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage.ProjectArchiver;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.server.uriresolver.UriResolverSMIClient;
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.code.CodeData;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.file.FileUploadMonitor;
|
||||||
|
@ -78,6 +78,27 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Project restoreUISession(String value)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
SessionUtil.getAslSession(session);
|
||||||
|
logger.debug("restoreUISession(): "+value);
|
||||||
|
Project project = SessionUtil.getProjectSession(session);
|
||||||
|
return project;
|
||||||
|
} catch (StatAlgoImporterServiceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("getCode(): " + e.getLocalizedMessage(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -354,6 +375,39 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemDescription setNewMainCode(ItemDescription fileDescription, String code)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
try {
|
||||||
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
|
logger.debug("saveCode(): itemDescription" + fileDescription+", code:"+code);
|
||||||
|
Project project = SessionUtil.getProjectSession(session);
|
||||||
|
if (project != null && project.getProjectFolder()!=null&&project.getProjectFolder().getItemDescription()!=null) {
|
||||||
|
MainCodeSave mainCodeSave=new MainCodeSave();
|
||||||
|
ItemDescription mainCodeItemDescription=mainCodeSave.save(aslSession, fileDescription, code,project);
|
||||||
|
MainCode mainCode=new MainCode(mainCodeItemDescription);
|
||||||
|
project.setMainCode(mainCode);
|
||||||
|
SessionUtil.setProjectSession(session, project);
|
||||||
|
return mainCodeItemDescription;
|
||||||
|
} else {
|
||||||
|
throw new StatAlgoImporterServiceException("No project open!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (StatAlgoImporterServiceException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw e;
|
||||||
|
} catch (Throwable e) {
|
||||||
|
logger.error("saveCode(): " + e.getLocalizedMessage(), e);
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException {
|
public void createSoftware(InputData inputData) throws StatAlgoImporterServiceException {
|
||||||
|
@ -384,24 +438,29 @@ public class StatAlgoImporterServiceImpl extends RemoteServiceServlet implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUriFromResolver(ItemDescription itemDescription)
|
public String getPublicLink(ItemDescription itemDescription)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
try {
|
try {
|
||||||
HttpSession session = this.getThreadLocalRequest().getSession();
|
HttpSession session = this.getThreadLocalRequest().getSession();
|
||||||
ASLSession aslSession = SessionUtil.getAslSession(session);
|
ASLSession aslSession = SessionUtil.getAslSession(session);
|
||||||
logger.debug("GetUriFromResolver(): "+itemDescription);
|
logger.debug("GetPublicLink(): "+itemDescription);
|
||||||
UriResolverSMIClient resolver=new UriResolverSMIClient();
|
FilesStorage filesStorage=new FilesStorage();
|
||||||
String link=resolver.resolve(itemDescription, aslSession);
|
String link=filesStorage.getPublicLink(aslSession.getUsername(),itemDescription.getId());
|
||||||
|
|
||||||
return link;
|
return link;
|
||||||
} catch (StatAlgoImporterServiceException e) {
|
} catch (StatAlgoImporterServiceException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw e;
|
throw e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.error("getUriFromResolver(): " + e.getLocalizedMessage(), e);
|
logger.error("getPublicLink(): " + e.getLocalizedMessage(), e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,9 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.IOType;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -45,7 +45,7 @@ public class AlgorithmGenerator {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Path tempFile = Files.createTempFile(project.getInputData()
|
Path tempFile = Files.createTempFile(project.getInputData()
|
||||||
.getProjectInfo().getPackageName(), EXTENTION_JAVA);
|
.getProjectInfo().getAlgorithmNameToClassName(), EXTENTION_JAVA);
|
||||||
|
|
||||||
List<String> lines = createJavaCode();
|
List<String> lines = createJavaCode();
|
||||||
Files.write(tempFile, lines, Charset.defaultCharset(),
|
Files.write(tempFile, lines, Charset.defaultCharset(),
|
||||||
|
@ -80,7 +80,7 @@ public class AlgorithmGenerator {
|
||||||
"import org.gcube.dataanalysis.executor.rscripts.generic.GenericRScript;",
|
"import org.gcube.dataanalysis.executor.rscripts.generic.GenericRScript;",
|
||||||
"", "public class "
|
"", "public class "
|
||||||
+ project.getInputData().getProjectInfo()
|
+ project.getInputData().getProjectInfo()
|
||||||
.getPackageName()
|
.getAlgorithmNameToClassName()
|
||||||
+ " extends GenericRScript {", "",
|
+ " extends GenericRScript {", "",
|
||||||
|
|
||||||
" public static enum operators {",
|
" public static enum operators {",
|
||||||
|
@ -88,20 +88,20 @@ public class AlgorithmGenerator {
|
||||||
" };", "", " @Override",
|
" };", "", " @Override",
|
||||||
" public String getDescription() {", " return \""
|
" public String getDescription() {", " return \""
|
||||||
+ project.getInputData().getProjectInfo()
|
+ project.getInputData().getProjectInfo()
|
||||||
.getPackageDescription() + "\";", " }", "",
|
.getAlgorithmDescription() + "\";", " }", "",
|
||||||
" protected void initVariables(){",
|
" protected void initVariables(){",
|
||||||
" mainScriptName=\"" + mainScriptRelativePath + "\";",
|
" mainScriptName=\"" + mainScriptRelativePath + "\";",
|
||||||
" packageURL=\"" + packageUrl + "\";",
|
" packageURL=\"" + packageUrl + "\";",
|
||||||
" environmentalvariables = new ArrayList<String>();"));
|
" environmentalvariables = new ArrayList<String>();"));
|
||||||
|
|
||||||
for (EnvironmentVariables envVariable : project.getInputData()
|
for (GlobalVariables envVariable : project.getInputData()
|
||||||
.getListEnvironmentVariables()) {
|
.getListGlobalVariables()) {
|
||||||
code.add(" environmentalvariables.add(\"" + envVariable.getName()
|
code.add(" environmentalvariables.add(\"" + envVariable.getName()
|
||||||
+ "\");");
|
+ "\");");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
for (InputOutputVariables selVariable : project.getInputData()
|
||||||
.getListSelectedRows()) {
|
.getListInputOutputVariables()) {
|
||||||
switch (selVariable.getIoType()) {
|
switch (selVariable.getIoType()) {
|
||||||
case INPUT:
|
case INPUT:
|
||||||
code.add(" inputvariables.add(\"" + selVariable.getName()
|
code.add(" inputvariables.add(\"" + selVariable.getName()
|
||||||
|
@ -137,8 +137,8 @@ public class AlgorithmGenerator {
|
||||||
|
|
||||||
private void createInputParameters(ArrayList<String> code) {
|
private void createInputParameters(ArrayList<String> code) {
|
||||||
|
|
||||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
for (InputOutputVariables selVariable : project.getInputData()
|
||||||
.getListSelectedRows()) {
|
.getListInputOutputVariables()) {
|
||||||
if (selVariable.getIoType().compareTo(IOType.INPUT) == 0) {
|
if (selVariable.getIoType().compareTo(IOType.INPUT) == 0) {
|
||||||
switch (selVariable.getDataType()) {
|
switch (selVariable.getDataType()) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
|
@ -208,8 +208,8 @@ public class AlgorithmGenerator {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void createOutputParameters(ArrayList<String> code) {
|
private void createOutputParameters(ArrayList<String> code) {
|
||||||
for (SelectedRowsVariables selVariable : project.getInputData()
|
for (InputOutputVariables selVariable : project.getInputData()
|
||||||
.getListSelectedRows()) {
|
.getListInputOutputVariables()) {
|
||||||
if (selVariable.getIoType().compareTo(IOType.OUTPUT) == 0) {
|
if (selVariable.getIoType().compareTo(IOType.OUTPUT) == 0) {
|
||||||
switch (selVariable.getDataType()) {
|
switch (selVariable.getDataType()) {
|
||||||
case BOOLEAN:
|
case BOOLEAN:
|
||||||
|
|
|
@ -9,7 +9,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.DeployableVRE;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.RequestedVRE;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterPackageInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -22,7 +22,8 @@ import org.slf4j.LoggerFactory;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class InfoGenerator {
|
public class InfoGenerator {
|
||||||
private static final String EXTENTION_TXT = ".txt";
|
private static final String INFO_NAME = "Info";
|
||||||
|
private static final String INFO_EXTENTION = ".txt";
|
||||||
public static final Logger logger = LoggerFactory
|
public static final Logger logger = LoggerFactory
|
||||||
.getLogger(InfoGenerator.class);
|
.getLogger(InfoGenerator.class);
|
||||||
|
|
||||||
|
@ -38,13 +39,12 @@ public class InfoGenerator {
|
||||||
return "IntegrationInfoGenerator [project=" + project + "]";
|
return "IntegrationInfoGenerator [project=" + project + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Path createIntegrationInfo() throws StatAlgoImporterServiceException {
|
public Path createInfo() throws StatAlgoImporterServiceException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Path tempFile = Files.createTempFile(project.getInputData()
|
Path tempFile = Files.createTempFile(INFO_NAME, INFO_EXTENTION);
|
||||||
.getProjectInfo().getPackageName(), EXTENTION_TXT);
|
|
||||||
|
|
||||||
List<String> lines = createInfo();
|
List<String> lines = createInfoData();
|
||||||
Files.write(tempFile, lines, Charset.defaultCharset(),
|
Files.write(tempFile, lines, Charset.defaultCharset(),
|
||||||
StandardOpenOption.WRITE);
|
StandardOpenOption.WRITE);
|
||||||
logger.debug(tempFile.toString());
|
logger.debug(tempFile.toString());
|
||||||
|
@ -59,35 +59,39 @@ public class InfoGenerator {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> createInfo() {
|
private List<String> createInfoData() {
|
||||||
ArrayList<String> infos = new ArrayList<String>();
|
ArrayList<String> infos = new ArrayList<String>();
|
||||||
if (project.getInputData() != null) {
|
if (project.getInputData() != null) {
|
||||||
if (project.getInputData().getProjectInfo() != null) {
|
if (project.getInputData().getProjectInfo() != null) {
|
||||||
if (project.getInputData().getProjectInfo().getPackageName() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmName() != null) {
|
||||||
infos.add("Package Name: "
|
infos.add("Algorithm Name: "
|
||||||
+ project.getInputData().getProjectInfo()
|
+ project.getInputData().getProjectInfo()
|
||||||
.getPackageName());
|
.getAlgorithmNameToUpper());
|
||||||
|
infos.add("Class Name: org.gcube.dataanalysis.executor.rscripts."+ project.getInputData().getProjectInfo()
|
||||||
|
.getAlgorithmNameToUpper());
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
infos.add("Package Name: ");
|
infos.add("Algorithm Name: ");
|
||||||
|
infos.add("Class Name: ");
|
||||||
}
|
}
|
||||||
infos.add("");
|
infos.add("");
|
||||||
if (project.getInputData().getProjectInfo().getPackageDescription() != null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmDescription() != null) {
|
||||||
infos.add("Package Description: "
|
infos.add("Algorithm Description: "
|
||||||
+ project.getInputData().getProjectInfo()
|
+ project.getInputData().getProjectInfo()
|
||||||
.getPackageDescription());
|
.getAlgorithmDescription());
|
||||||
} else {
|
} else {
|
||||||
infos.add("Package Description: ");
|
infos.add("Algorithm Description: ");
|
||||||
}
|
}
|
||||||
infos.add("");
|
infos.add("");
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo()
|
if (project.getInputData().getProjectInfo()
|
||||||
.getListDeployableVRE() != null
|
.getListRequestedVRE() != null
|
||||||
&& project.getInputData().getProjectInfo()
|
&& project.getInputData().getProjectInfo()
|
||||||
.getListDeployableVRE().size() > 0) {
|
.getListRequestedVRE().size() > 0) {
|
||||||
infos.add("Deployable VRE:");
|
infos.add("Deployable VRE:");
|
||||||
for (DeployableVRE deployableVRE : project.getInputData()
|
for (RequestedVRE deployableVRE : project.getInputData()
|
||||||
.getProjectInfo().getListDeployableVRE()) {
|
.getProjectInfo().getListRequestedVRE()) {
|
||||||
infos.add("" + deployableVRE.getName() + ", " + deployableVRE.getDescription());
|
infos.add("" + deployableVRE.getName() + " " + deployableVRE.getDescription());
|
||||||
}
|
}
|
||||||
infos.add("");
|
infos.add("");
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,9 +94,9 @@ public class ProjectBuilder {
|
||||||
"Attention No Project Information Set!");
|
"Attention No Project Information Set!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.getInputData().getProjectInfo().getPackageName() == null) {
|
if (project.getInputData().getProjectInfo().getAlgorithmName() == null) {
|
||||||
throw new StatAlgoImporterServiceException(
|
throw new StatAlgoImporterServiceException(
|
||||||
"Attention No Project Class Name Set!");
|
"Attention No Algorithm Name Set!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (project.getMainCode() == null) {
|
if (project.getMainCode() == null) {
|
||||||
|
@ -133,7 +133,7 @@ public class ProjectBuilder {
|
||||||
algorithmItem = filesStorage.createItemOnWorkspace(aslSession
|
algorithmItem = filesStorage.createItemOnWorkspace(aslSession
|
||||||
.getUsername(), Files.newInputStream(algorithmJava,
|
.getUsername(), Files.newInputStream(algorithmJava,
|
||||||
StandardOpenOption.READ), project.getInputData()
|
StandardOpenOption.READ), project.getInputData()
|
||||||
.getProjectInfo().getPackageName()
|
.getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ ALGORITHM_EXTENTION, ALGORITHM_DESCRIPTION,
|
+ ALGORITHM_EXTENTION, ALGORITHM_DESCRIPTION,
|
||||||
ALGORITHM_MIMETYPE, project.getProjectTarget()
|
ALGORITHM_MIMETYPE, project.getProjectTarget()
|
||||||
.getTargetFolder().getId());
|
.getTargetFolder().getId());
|
||||||
|
@ -207,7 +207,7 @@ public class ProjectBuilder {
|
||||||
try {
|
try {
|
||||||
projectPackageItem = filesStorage.createItemOnWorkspace(
|
projectPackageItem = filesStorage.createItemOnWorkspace(
|
||||||
aslSession.getUsername(), inputStream, project
|
aslSession.getUsername(), inputStream, project
|
||||||
.getInputData().getProjectInfo().getPackageName()
|
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ PROJECT_PACKAGE_EXTENTION,
|
+ PROJECT_PACKAGE_EXTENTION,
|
||||||
PROJECT_PACKAGE_DESCRIPTION, PROJECT_PACKAGE_MIMETYPE,
|
PROJECT_PACKAGE_DESCRIPTION, PROJECT_PACKAGE_MIMETYPE,
|
||||||
targetFolder.getId());
|
targetFolder.getId());
|
||||||
|
@ -242,7 +242,7 @@ public class ProjectBuilder {
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
InfoGenerator integrationInfoGenerator = new InfoGenerator(
|
InfoGenerator integrationInfoGenerator = new InfoGenerator(
|
||||||
project);
|
project);
|
||||||
infoTXT = integrationInfoGenerator.createIntegrationInfo();
|
infoTXT = integrationInfoGenerator.createInfo();
|
||||||
|
|
||||||
FilesStorage filesStorage = new FilesStorage();
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
WorkspaceItem infoItem;
|
WorkspaceItem infoItem;
|
||||||
|
@ -297,7 +297,7 @@ public class ProjectBuilder {
|
||||||
storage.downloadInputFile(ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL,
|
storage.downloadInputFile(ECOLOGICAL_ENGINE_SMART_EXECUTOR_JAR_URL,
|
||||||
ecologicalEngineSmartExecutorJar);
|
ecologicalEngineSmartExecutorJar);
|
||||||
Path algorithmTempFile = new File(tempDirectory.toFile(), project
|
Path algorithmTempFile = new File(tempDirectory.toFile(), project
|
||||||
.getInputData().getProjectInfo().getPackageName()
|
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ ALGORITHM_EXTENTION).toPath();
|
+ ALGORITHM_EXTENTION).toPath();
|
||||||
Files.copy(algorithmJava, algorithmTempFile);
|
Files.copy(algorithmJava, algorithmTempFile);
|
||||||
Path infoTempFile = new File(tempDirectory.toFile(),
|
Path infoTempFile = new File(tempDirectory.toFile(),
|
||||||
|
@ -322,7 +322,7 @@ public class ProjectBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyJarOnWorkspace(Path tempDirectory) throws StatAlgoImporterServiceException {
|
private void copyJarOnWorkspace(Path tempDirectory) throws StatAlgoImporterServiceException {
|
||||||
Path codeJar=Paths.get(tempDirectory.toString(),project.getInputData().getProjectInfo().getPackageName()
|
Path codeJar=Paths.get(tempDirectory.toString(),project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ JAR_EXTENTION);
|
+ JAR_EXTENTION);
|
||||||
|
|
||||||
FilesStorage filesStorage = new FilesStorage();
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
|
@ -331,7 +331,7 @@ public class ProjectBuilder {
|
||||||
try {
|
try {
|
||||||
codeJarItem = filesStorage.createItemOnWorkspace(aslSession
|
codeJarItem = filesStorage.createItemOnWorkspace(aslSession
|
||||||
.getUsername(), Files.newInputStream(codeJar,
|
.getUsername(), Files.newInputStream(codeJar,
|
||||||
StandardOpenOption.READ), project.getInputData().getProjectInfo().getPackageName()
|
StandardOpenOption.READ), project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ JAR_EXTENTION, CODE_JAR_DESCRIPTION,
|
+ JAR_EXTENTION, CODE_JAR_DESCRIPTION,
|
||||||
CODE_JAR_MIMETYPE, project.getProjectTarget()
|
CODE_JAR_MIMETYPE, project.getProjectTarget()
|
||||||
.getTargetFolder().getId());
|
.getTargetFolder().getId());
|
||||||
|
@ -369,7 +369,7 @@ public class ProjectBuilder {
|
||||||
|
|
||||||
ProcessBuilder pb = new ProcessBuilder("javac", "-cp",
|
ProcessBuilder pb = new ProcessBuilder("javac", "-cp",
|
||||||
tempDirectory.toAbsolutePath().toString() + "/*", project
|
tempDirectory.toAbsolutePath().toString() + "/*", project
|
||||||
.getInputData().getProjectInfo().getPackageName()
|
.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ ALGORITHM_EXTENTION);
|
+ ALGORITHM_EXTENTION);
|
||||||
pb.directory(tempDirectory.toFile());
|
pb.directory(tempDirectory.toFile());
|
||||||
Path logTXT = new File(tempDirectory.toFile(), LOG_TXT).toPath();
|
Path logTXT = new File(tempDirectory.toFile(), LOG_TXT).toPath();
|
||||||
|
@ -398,7 +398,7 @@ public class ProjectBuilder {
|
||||||
List<String> commands = new ArrayList<>();
|
List<String> commands = new ArrayList<>();
|
||||||
commands.add("jar");
|
commands.add("jar");
|
||||||
commands.add("-cvf");
|
commands.add("-cvf");
|
||||||
commands.add(project.getInputData().getProjectInfo().getPackageName()
|
commands.add(project.getInputData().getProjectInfo().getAlgorithmNameToClassName()
|
||||||
+ JAR_EXTENTION);
|
+ JAR_EXTENTION);
|
||||||
|
|
||||||
DirectoryStream<Path> directoryStream = Files
|
DirectoryStream<Path> directoryStream = Files
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.social;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.applicationsupportlayer.social.ApplicationNotificationsManager;
|
||||||
|
import org.gcube.applicationsupportlayer.social.NotificationsManager;
|
||||||
|
import org.gcube.common.homelibrary.util.WorkspaceUtil;
|
||||||
|
import org.gcube.portal.databook.shared.NotificationType;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.Constants;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TDMNotification notification sharing TR, templates or rules
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AlgorithmNotification extends Thread {
|
||||||
|
private static Logger logger = LoggerFactory
|
||||||
|
.getLogger(AlgorithmNotification.class);
|
||||||
|
private ASLSession aslSession;
|
||||||
|
private NotificationType notificationType;
|
||||||
|
private Project project;
|
||||||
|
|
||||||
|
public AlgorithmNotification(ASLSession aslSession, Project project) {
|
||||||
|
this.aslSession = aslSession;
|
||||||
|
this.project = project;
|
||||||
|
//this.notificationType = NotificationType.SAI_ALGORITHM_PUBLICATION;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
algorithmPublicationNotify();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void algorithmPublicationNotify() {
|
||||||
|
NotificationsManager nm = new ApplicationNotificationsManager(
|
||||||
|
aslSession, Constants.APPLICATION_ID);
|
||||||
|
/*
|
||||||
|
List<String> members = Arrays.asList("gianpaolo.coro",
|
||||||
|
"giancarlo.panichi", "roberto.cirillo");
|
||||||
|
for (String member : members) {
|
||||||
|
try {
|
||||||
|
nm.notifyAlgorithmPublicationRequest(
|
||||||
|
member,
|
||||||
|
project.getInputData().getProjectInfo()
|
||||||
|
.getAlgorithmName(),
|
||||||
|
new String(
|
||||||
|
Constants.STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK
|
||||||
|
+ "="
|
||||||
|
+ project.getProjectTarget()
|
||||||
|
.getCodeJar().getPublicLink()));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("Error in the notification(Type: "
|
||||||
|
+ notificationType
|
||||||
|
+ " - "
|
||||||
|
+ aslSession.getUsername()
|
||||||
|
+ " ="
|
||||||
|
+ "Algorithm [AlgorithmName="
|
||||||
|
+ project.getInputData().getProjectInfo()
|
||||||
|
.getAlgorithmName()
|
||||||
|
+ ", JarPublicLink="
|
||||||
|
+ project.getProjectTarget().getCodeJar()
|
||||||
|
.getPublicLink() + "] to " + member + "): "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,6 +22,7 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemNotFoundExcept
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
|
||||||
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongItemTypeException;
|
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongItemTypeException;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.folder.FolderItem;
|
||||||
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
|
||||||
import org.gcube.common.homelibrary.util.zip.ZipUtil;
|
import org.gcube.common.homelibrary.util.zip.ZipUtil;
|
||||||
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
|
import org.gcube.contentmanager.storageclient.model.protocol.smp.SMPUrl;
|
||||||
|
@ -46,6 +47,52 @@ public class FilesStorage {
|
||||||
public static final Logger logger = LoggerFactory
|
public static final Logger logger = LoggerFactory
|
||||||
.getLogger(FilesStorage.class);
|
.getLogger(FilesStorage.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param itemId
|
||||||
|
* Item id
|
||||||
|
* @return Public link
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
|
public String getPublicLink(String user, String itemId)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
Workspace ws;
|
||||||
|
try {
|
||||||
|
ws = HomeLibrary.getUserWorkspace(user);
|
||||||
|
|
||||||
|
WorkspaceItem workSpaceItem = ws.getItem(itemId);
|
||||||
|
if (workSpaceItem.isFolder()) {
|
||||||
|
throw new StatAlgoImporterServiceException(
|
||||||
|
"Attention this is a folder!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workSpaceItem instanceof FolderItem) {
|
||||||
|
return workSpaceItem.getPublicLink(true);
|
||||||
|
} else {
|
||||||
|
throw new StatAlgoImporterServiceException(
|
||||||
|
"Attention no public link for this item!");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
||||||
|
| HomeNotFoundException | ItemNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param itemId
|
||||||
|
* Item id
|
||||||
|
* @param folderId
|
||||||
|
* Folder id
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public void copyItemOnFolder(String user, String itemId, String folderId)
|
public void copyItemOnFolder(String user, String itemId, String folderId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
Workspace ws;
|
Workspace ws;
|
||||||
|
@ -71,6 +118,14 @@ public class FilesStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param itemId
|
||||||
|
* Item id
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public void deleteItemOnFolder(String user, String itemId)
|
public void deleteItemOnFolder(String user, String itemId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
Workspace ws;
|
Workspace ws;
|
||||||
|
@ -90,6 +145,14 @@ public class FilesStorage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param folderId
|
||||||
|
* Foler id
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public void deleteTargetFolder(String user, String folderId)
|
public void deleteTargetFolder(String user, String folderId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
Workspace ws;
|
Workspace ws;
|
||||||
|
@ -120,6 +183,15 @@ public class FilesStorage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param folderId
|
||||||
|
* Destination folder id
|
||||||
|
* @return Folder
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public WorkspaceFolder createTargetFolder(String user, String folderId)
|
public WorkspaceFolder createTargetFolder(String user, String folderId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
Workspace ws;
|
Workspace ws;
|
||||||
|
@ -147,6 +219,16 @@ public class FilesStorage {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* user
|
||||||
|
* @param inputStream
|
||||||
|
* input stream
|
||||||
|
* @param folderId
|
||||||
|
* destination folder
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public void saveStatisticalAlgorithmProject(String user,
|
public void saveStatisticalAlgorithmProject(String user,
|
||||||
InputStream inputStream, String folderId)
|
InputStream inputStream, String folderId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
|
@ -183,6 +265,22 @@ public class FilesStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* user
|
||||||
|
* @param inputStream
|
||||||
|
* input stream
|
||||||
|
* @param name
|
||||||
|
* item name
|
||||||
|
* @param description
|
||||||
|
* item description
|
||||||
|
* @param mimeType
|
||||||
|
* item mimetype
|
||||||
|
* @param folderId
|
||||||
|
* destination folder
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public void saveItemOnWorkspace(String user, InputStream inputStream,
|
public void saveItemOnWorkspace(String user, InputStream inputStream,
|
||||||
String name, String description, String mimeType, String folderId)
|
String name, String description, String mimeType, String folderId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
|
@ -216,6 +314,23 @@ public class FilesStorage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param inputStream
|
||||||
|
* Input stream
|
||||||
|
* @param name
|
||||||
|
* Item name
|
||||||
|
* @param description
|
||||||
|
* Item description
|
||||||
|
* @param mimeType
|
||||||
|
* Item mimetype
|
||||||
|
* @param folderId
|
||||||
|
* Destination folder
|
||||||
|
* @return Workspace item
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
public WorkspaceItem createItemOnWorkspace(String user,
|
public WorkspaceItem createItemOnWorkspace(String user,
|
||||||
InputStream inputStream, String name, String description,
|
InputStream inputStream, String name, String description,
|
||||||
String mimeType, String folderId)
|
String mimeType, String folderId)
|
||||||
|
@ -246,6 +361,12 @@ public class FilesStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param folderId
|
||||||
|
* Folder id
|
||||||
|
* @return Input stream
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
*/
|
*/
|
||||||
public InputStream retrieveProjectItemOnWorkspace(String user,
|
public InputStream retrieveProjectItemOnWorkspace(String user,
|
||||||
String folderId) throws StatAlgoImporterServiceException {
|
String folderId) throws StatAlgoImporterServiceException {
|
||||||
|
@ -279,6 +400,12 @@ public class FilesStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @param user
|
||||||
|
* User
|
||||||
|
* @param itemId
|
||||||
|
* Item id
|
||||||
|
* @return Input stream
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
*/
|
*/
|
||||||
public InputStream retrieveItemOnWorkspace(String user, String itemId)
|
public InputStream retrieveItemOnWorkspace(String user, String itemId)
|
||||||
throws StatAlgoImporterServiceException {
|
throws StatAlgoImporterServiceException {
|
||||||
|
@ -307,7 +434,7 @@ public class FilesStorage {
|
||||||
* User
|
* User
|
||||||
* @param remotePath
|
* @param remotePath
|
||||||
* File path on storage
|
* File path on storage
|
||||||
* @return InputStream back to read the file
|
* @return Input stream back to read the file
|
||||||
* @throws StatAlgoImporterServiceException
|
* @throws StatAlgoImporterServiceException
|
||||||
*/
|
*/
|
||||||
public InputStream retrieveImputStream(String user, WorkspaceItem wi)
|
public InputStream retrieveImputStream(String user, WorkspaceItem wi)
|
||||||
|
|
|
@ -0,0 +1,106 @@
|
||||||
|
package org.gcube.portlets.user.statisticalalgorithmsimporter.server.storage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.StandardOpenOption;
|
||||||
|
|
||||||
|
import org.gcube.application.framework.core.session.ASLSession;
|
||||||
|
import org.gcube.common.homelibrary.home.exceptions.InternalErrorException;
|
||||||
|
import org.gcube.common.homelibrary.home.workspace.WorkspaceItem;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.exception.StatAlgoImporterServiceException;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project;
|
||||||
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.workspace.ItemDescription;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Giancarlo Panichi
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MainCodeSave {
|
||||||
|
private static final String ALGORITHM_DESCRIPTION = "Algorithm";
|
||||||
|
private static final String ALGORITHM_MIMETYPE = "text/plain";
|
||||||
|
|
||||||
|
public static final Logger logger = LoggerFactory
|
||||||
|
.getLogger(MainCodeSave.class);
|
||||||
|
|
||||||
|
public MainCodeSave() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param aslSession
|
||||||
|
* @param file description of destination file
|
||||||
|
* @param code code to insert in the file
|
||||||
|
* @param project
|
||||||
|
* @return
|
||||||
|
* @throws StatAlgoImporterServiceException
|
||||||
|
*/
|
||||||
|
public ItemDescription save(ASLSession aslSession, ItemDescription file,
|
||||||
|
String code, Project project)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
Path tempFile = createTempFile(file, code);
|
||||||
|
ItemDescription mainCode = saveInWorkspace(tempFile, aslSession, file,
|
||||||
|
project);
|
||||||
|
return mainCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Path createTempFile(ItemDescription file, String code)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
try {
|
||||||
|
Path tempFile = Files.createTempFile(file.getName(), "");
|
||||||
|
|
||||||
|
Files.write(tempFile, code.getBytes(), StandardOpenOption.WRITE);
|
||||||
|
logger.debug(tempFile.toString());
|
||||||
|
|
||||||
|
return tempFile;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemDescription saveInWorkspace(Path tempFile,
|
||||||
|
ASLSession aslSession, ItemDescription file, Project project)
|
||||||
|
throws StatAlgoImporterServiceException {
|
||||||
|
FilesStorage filesStorage = new FilesStorage();
|
||||||
|
WorkspaceItem mainCodeItem;
|
||||||
|
|
||||||
|
try {
|
||||||
|
mainCodeItem = filesStorage.createItemOnWorkspace(
|
||||||
|
aslSession.getUsername(),
|
||||||
|
Files.newInputStream(tempFile, StandardOpenOption.READ),
|
||||||
|
file.getName(), ALGORITHM_DESCRIPTION, ALGORITHM_MIMETYPE,
|
||||||
|
project.getProjectFolder().getItemDescription().getId());
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage(),
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
|
||||||
|
ItemDescription mainCode;
|
||||||
|
try {
|
||||||
|
mainCode = new ItemDescription(mainCodeItem.getId(),
|
||||||
|
mainCodeItem.getName(), mainCodeItem.getOwner()
|
||||||
|
.getPortalLogin(), mainCodeItem.getPath(),
|
||||||
|
mainCodeItem.getType().name());
|
||||||
|
} catch (InternalErrorException e) {
|
||||||
|
logger.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new StatAlgoImporterServiceException(e.getLocalizedMessage());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return mainCode;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -9,15 +9,16 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared;
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public static final String APPLICATION_ID = "org.gcube.portlets.user.statisticalalgorithmsimporter.server.portlet.StatAlgoImporterPortlet";
|
public static final String APPLICATION_ID = "org.gcube.portlets.user.statisticalalgorithmsimporter.server.portlet.StatAlgoImporterPortlet";
|
||||||
public static final String STATRUNNER_ID = "StatRunnerId";
|
public static final String STATISTICAL_ALGORITHMS_IMPORTER_ID = "SAIId";
|
||||||
public static final String STATRUNNER_LANG_COOKIE = "StatRunnerLangCookie";
|
public static final String STATISTICAL_ALGORITHMS_IMPORTER_COOKIE = "SAILangCookie";
|
||||||
public static final String STATRUNNER_LANG = "StatRunnerLang";
|
public static final String STATISTICAL_ALGORITHMS_IMPORTER_LANG = "SAILang";
|
||||||
public final static String DEFAULT_USER = "giancarlo.panichi";
|
public final static String DEFAULT_USER = "giancarlo.panichi";
|
||||||
//public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
//public final static String DEFAULT_SCOPE = "/gcube/devNext";
|
||||||
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
|
||||||
|
public static final String FILE_UPLOADED_FIELD = "FileUploadedField";
|
||||||
|
public static final String STATISTICAL_ALGORITHMS_IMPORTER_JAR_PUBLIC_LINK = "JarPublicLink";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static final String FILE_UPLOADED_FIELD = "fileUploadedField";
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EnvironmentVariables implements Serializable {
|
public class GlobalVariables implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2519686355634242523L;
|
private static final long serialVersionUID = -2519686355634242523L;
|
||||||
private int id;
|
private int id;
|
||||||
|
@ -17,7 +17,7 @@ public class EnvironmentVariables implements Serializable {
|
||||||
private String defaultValue;
|
private String defaultValue;
|
||||||
private DataType dataType;
|
private DataType dataType;
|
||||||
|
|
||||||
public EnvironmentVariables() {
|
public GlobalVariables() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ public class EnvironmentVariables implements Serializable {
|
||||||
* @param defaultValue
|
* @param defaultValue
|
||||||
* @param dataType
|
* @param dataType
|
||||||
*/
|
*/
|
||||||
public EnvironmentVariables(int id, String name, String description,
|
public GlobalVariables(int id, String name, String description,
|
||||||
String defaultValue, DataType dataType) {
|
String defaultValue, DataType dataType) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -81,10 +81,12 @@ public class EnvironmentVariables implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EnvironmentVariables [id=" + id + ", name=" + name
|
return "GlobalVariables [id=" + id + ", name=" + name
|
||||||
+ ", description=" + description + ", defaultValue="
|
+ ", description=" + description + ", defaultValue="
|
||||||
+ defaultValue + ", dataType=" + dataType + "]";
|
+ defaultValue + ", dataType=" + dataType + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@ import java.io.Serializable;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class SelectedRowsVariables implements Serializable {
|
public class InputOutputVariables implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -2519686355634242523L;
|
private static final long serialVersionUID = -2519686355634242523L;
|
||||||
private int id;
|
private int id;
|
||||||
|
@ -19,11 +19,11 @@ public class SelectedRowsVariables implements Serializable {
|
||||||
private IOType ioType;
|
private IOType ioType;
|
||||||
private String sourceSelection;
|
private String sourceSelection;
|
||||||
|
|
||||||
public SelectedRowsVariables() {
|
public InputOutputVariables() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SelectedRowsVariables(String name, String description,
|
public InputOutputVariables(String name, String description,
|
||||||
String defaultValue, DataType dataType, IOType ioType,
|
String defaultValue, DataType dataType, IOType ioType,
|
||||||
String sourceSelection){
|
String sourceSelection){
|
||||||
super();
|
super();
|
||||||
|
@ -36,7 +36,7 @@ public class SelectedRowsVariables implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public SelectedRowsVariables(int id, String name, String description,
|
public InputOutputVariables(int id, String name, String description,
|
||||||
String defaultValue, DataType dataType, IOType ioType,
|
String defaultValue, DataType dataType, IOType ioType,
|
||||||
String sourceSelection) {
|
String sourceSelection) {
|
||||||
super();
|
super();
|
||||||
|
@ -107,7 +107,7 @@ public class SelectedRowsVariables implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "SelectedRowsVariables [id=" + id + ", name=" + name
|
return "InputOutputVariables [id=" + id + ", name=" + name
|
||||||
+ ", description=" + description + ", defaultValue="
|
+ ", description=" + description + ", defaultValue="
|
||||||
+ defaultValue + ", dataType=" + dataType + ", ioType="
|
+ defaultValue + ", dataType=" + dataType + ", ioType="
|
||||||
+ ioType + ", sourceSelection=" + sourceSelection + "]";
|
+ ioType + ", sourceSelection=" + sourceSelection + "]";
|
||||||
|
@ -115,4 +115,5 @@ public class SelectedRowsVariables implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -12,51 +12,61 @@ import java.util.ArrayList;
|
||||||
public class ProjectInfo implements Serializable {
|
public class ProjectInfo implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7304965177776383842L;
|
private static final long serialVersionUID = 7304965177776383842L;
|
||||||
private String packageName;
|
private String algorithmName;
|
||||||
private String packageDescription;
|
private String algorithmDescription;
|
||||||
private ArrayList<DeployableVRE> listDeployableVRE;
|
private ArrayList<RequestedVRE> listRequestedVRE;
|
||||||
|
|
||||||
public ProjectInfo() {
|
public ProjectInfo() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectInfo(String packageName, String pacakgeDescription,
|
public ProjectInfo(String algorithmName, String algorithmDescription,
|
||||||
ArrayList<DeployableVRE> listDeployableVRE) {
|
ArrayList<RequestedVRE> listRequestedVRE) {
|
||||||
super();
|
super();
|
||||||
this.packageName = packageName;
|
this.algorithmName = algorithmName;
|
||||||
this.packageDescription = pacakgeDescription;
|
this.algorithmDescription = algorithmDescription;
|
||||||
this.listDeployableVRE = listDeployableVRE;
|
this.listRequestedVRE = listRequestedVRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public String getAlgorithmName() {
|
||||||
return packageName;
|
return algorithmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPackageName(String packageName) {
|
public String getAlgorithmNameToUpper() {
|
||||||
this.packageName = packageName;
|
return algorithmName.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageDescription() {
|
public String getAlgorithmNameToClassName() {
|
||||||
return packageDescription;
|
return algorithmName.replaceAll("_", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPackageDescription(String packageDescription) {
|
public void setAlgorithmName(String algorithmName) {
|
||||||
this.packageDescription = packageDescription;
|
this.algorithmName = algorithmName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<DeployableVRE> getListDeployableVRE() {
|
public String getAlgorithmDescription() {
|
||||||
return listDeployableVRE;
|
return algorithmDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListDeployableVRE(ArrayList<DeployableVRE> listDeployableVRE) {
|
public void setAlgorithmDescription(String algorithmDescription) {
|
||||||
this.listDeployableVRE = listDeployableVRE;
|
this.algorithmDescription = algorithmDescription;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<RequestedVRE> getListRequestedVRE() {
|
||||||
|
return listRequestedVRE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListRequestedVRE(ArrayList<RequestedVRE> listRequestedVRE) {
|
||||||
|
this.listRequestedVRE = listRequestedVRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ProjectInfo [packageName=" + packageName
|
return "ProjectInfo [algorithmName=" + algorithmName
|
||||||
+ ", packageDescription=" + packageDescription
|
+ ", algorithmDescription=" + algorithmDescription
|
||||||
+ ", listDeployableVRE=" + listDeployableVRE + "]";
|
+ ", listRequestedVRE=" + listRequestedVRE + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,18 @@ import java.io.Serializable;
|
||||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DeployableVRE implements Serializable {
|
public class RequestedVRE implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -7548059008384829524L;
|
private static final long serialVersionUID = -7548059008384829524L;
|
||||||
private int id;
|
private int id;
|
||||||
private String name;
|
private String name;
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
public DeployableVRE() {
|
public RequestedVRE() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeployableVRE(int id, String name, String description) {
|
public RequestedVRE(int id, String name, String description) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
@ -52,10 +52,11 @@ public class DeployableVRE implements Serializable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DeployableVRE [id=" + id + ", name=" + name + ", description="
|
return "RequestedVRE [id=" + id + ", name=" + name + ", description="
|
||||||
+ description + "]";
|
+ description + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,10 +3,10 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.EnvironmentVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.GlobalVariables;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InterpreterInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.ProjectInfo;
|
||||||
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.SelectedRowsVariables;
|
import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input.InputOutputVariables;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -19,40 +19,29 @@ public class InputData implements Serializable {
|
||||||
private static final long serialVersionUID = -2405068429998054485L;
|
private static final long serialVersionUID = -2405068429998054485L;
|
||||||
private ProjectInfo projectInfo;
|
private ProjectInfo projectInfo;
|
||||||
private InterpreterInfo interpreterInfo;
|
private InterpreterInfo interpreterInfo;
|
||||||
private ArrayList<EnvironmentVariables> listEnvironmentVariables;
|
private ArrayList<GlobalVariables> listGlobalVariables;
|
||||||
private ArrayList<SelectedRowsVariables> listSelectedRows;
|
private ArrayList<InputOutputVariables> listInputOutputVariables;
|
||||||
|
|
||||||
|
|
||||||
public InputData() {
|
public InputData() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputData(ArrayList<EnvironmentVariables> listEnvironmentVariables,
|
public InputData(ProjectInfo projectInfo, InterpreterInfo interpreterInfo,
|
||||||
ArrayList<SelectedRowsVariables> listSelectedRows,
|
ArrayList<GlobalVariables> listGlobalVariables,
|
||||||
InterpreterInfo interpreterInfo, ProjectInfo projectInfo) {
|
ArrayList<InputOutputVariables> listInputOutputVariables) {
|
||||||
super();
|
super();
|
||||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
|
||||||
this.listSelectedRows = listSelectedRows;
|
|
||||||
this.interpreterInfo = interpreterInfo;
|
|
||||||
this.projectInfo = projectInfo;
|
this.projectInfo = projectInfo;
|
||||||
|
this.interpreterInfo = interpreterInfo;
|
||||||
|
this.listGlobalVariables = listGlobalVariables;
|
||||||
|
this.listInputOutputVariables = listInputOutputVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<EnvironmentVariables> getListEnvironmentVariables() {
|
public ProjectInfo getProjectInfo() {
|
||||||
return listEnvironmentVariables;
|
return projectInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListEnvironmentVariables(
|
public void setProjectInfo(ProjectInfo projectInfo) {
|
||||||
ArrayList<EnvironmentVariables> listEnvironmentVariables) {
|
this.projectInfo = projectInfo;
|
||||||
this.listEnvironmentVariables = listEnvironmentVariables;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ArrayList<SelectedRowsVariables> getListSelectedRows() {
|
|
||||||
return listSelectedRows;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setListSelectedRows(
|
|
||||||
ArrayList<SelectedRowsVariables> listSelectedRows) {
|
|
||||||
this.listSelectedRows = listSelectedRows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InterpreterInfo getInterpreterInfo() {
|
public InterpreterInfo getInterpreterInfo() {
|
||||||
|
@ -62,23 +51,31 @@ public class InputData implements Serializable {
|
||||||
public void setInterpreterInfo(InterpreterInfo interpreterInfo) {
|
public void setInterpreterInfo(InterpreterInfo interpreterInfo) {
|
||||||
this.interpreterInfo = interpreterInfo;
|
this.interpreterInfo = interpreterInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectInfo getProjectInfo() {
|
public ArrayList<GlobalVariables> getListGlobalVariables() {
|
||||||
return projectInfo;
|
return listGlobalVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProjectInfo(ProjectInfo projectInfo) {
|
public void setListGlobalVariables(
|
||||||
this.projectInfo = projectInfo;
|
ArrayList<GlobalVariables> listGlobalVariables) {
|
||||||
|
this.listGlobalVariables = listGlobalVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<InputOutputVariables> getListInputOutputVariables() {
|
||||||
|
return listInputOutputVariables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListInputOutputVariables(
|
||||||
|
ArrayList<InputOutputVariables> listInputOutputVariables) {
|
||||||
|
this.listInputOutputVariables = listInputOutputVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "InputData [projectInfo=" + projectInfo + ", interpreterInfo="
|
return "InputData [projectInfo=" + projectInfo + ", interpreterInfo="
|
||||||
+ interpreterInfo + ", listEnvironmentVariables="
|
+ interpreterInfo + ", listGlobalVariables="
|
||||||
+ listEnvironmentVariables + ", listSelectedRows="
|
+ listGlobalVariables + ", listInputOutputVariables="
|
||||||
+ listSelectedRows + "]";
|
+ listInputOutputVariables + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue