ref 7126:SAI should make user specify the algorithm category

https://support.d4science.org/issues/7126

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/statistical-algorithms-importer@144128 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-02-22 15:01:00 +00:00
parent c1a7add41b
commit fea1fdb2bc
5 changed files with 46 additions and 83 deletions

View File

@ -1,54 +1,21 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input; package org.gcube.portlets.user.statisticalalgorithmsimporter.client.tools.input;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.properties.RequestedVREProperties;
import org.gcube.portlets.user.statisticalalgorithmsimporter.client.resource.StatAlgoImporterResources;
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.RequestedVRE;
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;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent; import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler; import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.shared.EventBus; import com.google.gwt.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.ButtonCell.ButtonScale;
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode; import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.ListStore;
import com.sencha.gxt.dnd.core.client.DND.Feedback;
import com.sencha.gxt.dnd.core.client.DndDragStartEvent;
import com.sencha.gxt.dnd.core.client.GridDragSource;
import com.sencha.gxt.dnd.core.client.GridDropTarget;
import com.sencha.gxt.widget.core.client.ContentPanel; import com.sencha.gxt.widget.core.client.ContentPanel;
import com.sencha.gxt.widget.core.client.button.ButtonBar;
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.MarginData; import com.sencha.gxt.widget.core.client.container.MarginData;
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.BeforeStartEditEvent;
import com.sencha.gxt.widget.core.client.event.BeforeStartEditEvent.BeforeStartEditHandler;
import com.sencha.gxt.widget.core.client.event.CancelEditEvent;
import com.sencha.gxt.widget.core.client.event.CancelEditEvent.CancelEditHandler;
import com.sencha.gxt.widget.core.client.event.CompleteEditEvent;
import com.sencha.gxt.widget.core.client.event.CompleteEditEvent.CompleteEditHandler;
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.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.TextField; import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.form.validator.RegExValidator; import com.sencha.gxt.widget.core.client.form.validator.RegExValidator;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.grid.Grid.GridCell;
import com.sencha.gxt.widget.core.client.grid.GridSelectionModel;
import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/** /**
* *
@ -64,12 +31,12 @@ public class ProjectInfoPanel extends ContentPanel {
private TextField algorithmName; private TextField algorithmName;
private TextField algorithmDescription; private TextField algorithmDescription;
private TextField algorithmCategory; private TextField algorithmCategory;
private ListStore<RequestedVRE> storeRequestedVRE; //private ListStore<RequestedVRE> storeRequestedVRE;
private Grid<RequestedVRE> gridRequestedVRE; //private Grid<RequestedVRE> gridRequestedVRE;
private GridRowEditing<RequestedVRE> gridRequestedVREEditing; //private GridRowEditing<RequestedVRE> gridRequestedVREEditing;
private TextButton btnAdd; //private TextButton btnAdd;
private boolean addStatus; //private boolean addStatus;
private int seq = 0; //private int seq = 0;
public ProjectInfoPanel(Project project, EventBus eventBus) { public ProjectInfoPanel(Project project, EventBus eventBus) {
super(); super();
@ -133,6 +100,7 @@ public class ProjectInfoPanel extends ContentPanel {
categoryLabel.setLabelWidth(LABAEL_WIDTH); categoryLabel.setLabelWidth(LABAEL_WIDTH);
// Grid // Grid
/*
RequestedVREProperties props = GWT.create(RequestedVREProperties.class); RequestedVREProperties props = GWT.create(RequestedVREProperties.class);
ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>( ColumnConfig<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
@ -149,7 +117,7 @@ public class ProjectInfoPanel extends ContentPanel {
ColumnModel<RequestedVRE> columns = new ColumnModel<RequestedVRE>(l); ColumnModel<RequestedVRE> columns = new ColumnModel<RequestedVRE>(l);
storeRequestedVRE = new ListStore<RequestedVRE>(props.id()); storeRequestedVRE = new ListStore<RequestedVRE>(props.id());*/
if (project != null && project.getInputData() != null if (project != null && project.getInputData() != null
&& project.getInputData().getProjectInfo() != null) { && project.getInputData().getProjectInfo() != null) {
@ -171,15 +139,16 @@ public class ProjectInfoPanel extends ContentPanel {
} }
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) { /*if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
storeRequestedVRE.addAll(project.getInputData() storeRequestedVRE.addAll(project.getInputData()
.getProjectInfo().getListRequestedVRE()); .getProjectInfo().getListRequestedVRE());
seq = project.getInputData().getProjectInfo() seq = project.getInputData().getProjectInfo()
.getListRequestedVRE().size(); .getListRequestedVRE().size();
} }*/
} }
/*
final GridSelectionModel<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>(); final GridSelectionModel<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>();
sm.setSelectionMode(SelectionMode.SINGLE); sm.setSelectionMode(SelectionMode.SINGLE);
@ -322,15 +291,16 @@ public class ProjectInfoPanel extends ContentPanel {
} }
} }
}); });
*/
// / // /
ToolBar toolBar = new ToolBar(); //ToolBar toolBar = new ToolBar();
toolBar.add(btnAdd, new BoxLayoutData(new Margins(0))); //toolBar.add(btnAdd, new BoxLayoutData(new Margins(0)));
FieldLabel requestedVRELabel = new FieldLabel(toolBar, "Requested VREs"); //FieldLabel requestedVRELabel = new FieldLabel(toolBar, "Requested VREs");
requestedVRELabel.setLabelWidth(LABAEL_WIDTH); //requestedVRELabel.setLabelWidth(LABAEL_WIDTH);
VerticalLayoutContainer vlc = new VerticalLayoutContainer(); VerticalLayoutContainer vlc = new VerticalLayoutContainer();
vlc.setAdjustForScroll(false); vlc.setAdjustForScroll(false);
@ -339,10 +309,10 @@ public class ProjectInfoPanel extends ContentPanel {
vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(categoryLabel, new VerticalLayoutData(1, -1, new Margins(0))); vlc.add(categoryLabel, new VerticalLayoutData(1, -1, new Margins(0)));
vlc.add(requestedVRELabel, //vlc.add(requestedVRELabel,
new VerticalLayoutData(1, -1, new Margins(0))); // 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(gridRequestedVRE, 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)));
} }
@ -372,6 +342,7 @@ public class ProjectInfoPanel extends ContentPanel {
algorithmCategory.clear(); algorithmCategory.clear();
} }
/*
if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) { if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) {
storeRequestedVRE.clear(); storeRequestedVRE.clear();
storeRequestedVRE.addAll(project.getInputData() storeRequestedVRE.addAll(project.getInputData()
@ -384,19 +355,21 @@ public class ProjectInfoPanel extends ContentPanel {
storeRequestedVRE.clear(); storeRequestedVRE.clear();
storeRequestedVRE.commitChanges(); storeRequestedVRE.commitChanges();
seq = 0; seq = 0;
} }*/
} else { } else {
algorithmName.clear(); algorithmName.clear();
algorithmDescription.clear(); algorithmDescription.clear();
algorithmCategory.clear(); algorithmCategory.clear();
storeRequestedVRE.clear(); //storeRequestedVRE.clear();
storeRequestedVRE.commitChanges(); //storeRequestedVRE.commitChanges();
seq = 0; //seq = 0;
} }
} }
/*
private void editingBeforeStart(BeforeStartEditEvent<RequestedVRE> event) { private void editingBeforeStart(BeforeStartEditEvent<RequestedVRE> event) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
@ -417,15 +390,15 @@ public class ProjectInfoPanel extends ContentPanel {
} catch (Throwable e) { } catch (Throwable e) {
e.printStackTrace(); e.printStackTrace();
} }
} }*/
public ProjectInfo getProjectInfo() { public ProjectInfo getProjectInfo() {
String name = algorithmName.getCurrentValue(); String name = algorithmName.getCurrentValue();
String description = algorithmDescription.getCurrentValue(); String description = algorithmDescription.getCurrentValue();
String category = algorithmCategory.getCurrentValue(); String category = algorithmCategory.getCurrentValue();
ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>( //ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>(
gridRequestedVRE.getStore().getAll()); // gridRequestedVRE.getStore().getAll());
return new ProjectInfo(name, description, category, listRequestedVRE); return new ProjectInfo(name, description, category);
} }
} }

View File

@ -114,7 +114,7 @@ public class WPS4RParser {
if (project.getInputData() == null) { if (project.getInputData() == null) {
ProjectInfo projectInfo = new ProjectInfo( ProjectInfo projectInfo = new ProjectInfo(
wpsAlgorithmInfo.getAlgorithmName(), wpsAlgorithmInfo.getAlgorithmName(),
wpsAlgorithmInfo.getDescription(), null, null); wpsAlgorithmInfo.getDescription(), null);
InputData inputData = new InputData(projectInfo, null, null, InputData inputData = new InputData(projectInfo, null, null,
wpsAlgorithmInfo.getInputOutputVariables()); wpsAlgorithmInfo.getInputOutputVariables());
project.setInputData(inputData); project.setInputData(inputData);
@ -123,7 +123,7 @@ public class WPS4RParser {
InputData inputData = project.getInputData(); InputData inputData = project.getInputData();
ProjectInfo projectInfo = new ProjectInfo( ProjectInfo projectInfo = new ProjectInfo(
wpsAlgorithmInfo.getAlgorithmName(), wpsAlgorithmInfo.getAlgorithmName(),
wpsAlgorithmInfo.getDescription(), null, null); wpsAlgorithmInfo.getDescription(), null);
inputData.setProjectInfo(projectInfo); inputData.setProjectInfo(projectInfo);
inputData.setListInputOutputVariables(wpsAlgorithmInfo inputData.setListInputOutputVariables(wpsAlgorithmInfo
.getInputOutputVariables()); .getInputOutputVariables());
@ -133,9 +133,7 @@ public class WPS4RParser {
wpsAlgorithmInfo.getAlgorithmName(), wpsAlgorithmInfo.getAlgorithmName(),
wpsAlgorithmInfo.getDescription(), project wpsAlgorithmInfo.getDescription(), project
.getInputData().getProjectInfo() .getInputData().getProjectInfo()
.getAlgorithmCategory(), project .getAlgorithmCategory());
.getInputData().getProjectInfo()
.getListRequestedVRE());
inputData.setProjectInfo(projectInfo); inputData.setProjectInfo(projectInfo);
inputData.setListInputOutputVariables(wpsAlgorithmInfo inputData.setListInputOutputVariables(wpsAlgorithmInfo
.getInputOutputVariables()); .getInputOutputVariables());

View File

@ -9,7 +9,6 @@ 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.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;
@ -91,6 +90,7 @@ public class InfoGenerator {
infos.add(""); infos.add("");
/*
if (project.getInputData().getProjectInfo() if (project.getInputData().getProjectInfo()
.getListRequestedVRE() != null .getListRequestedVRE() != null
&& project.getInputData().getProjectInfo() && project.getInputData().getProjectInfo()
@ -101,7 +101,7 @@ public class InfoGenerator {
infos.add("" + deployableVRE.getName() + " " + deployableVRE.getDescription()); infos.add("" + deployableVRE.getName() + " " + deployableVRE.getDescription());
} }
infos.add(""); infos.add("");
} }*/
} }

View File

@ -63,12 +63,14 @@ public class AlgorithmNotification extends Thread {
List<GenericItemBean> recipients = retrieveRecipients(); List<GenericItemBean> recipients = retrieveRecipients();
String subject = "[SAI] New software publication requested"; String subject = "[SAI] New software publication requested";
String body = "The user " String body = "The user: "
+ serviceCredentials.getFullName() + serviceCredentials.getFullName()
+ "\n\n has requested to publish the algorithm " + "\nin VRE: "
+ serviceCredentials.getScope()
+ "\n\nhas requested to publish the algorithm: "
+ project.getInputData().getProjectInfo() + project.getInputData().getProjectInfo()
.getAlgorithmName() .getAlgorithmName()
+ " with the following jar " + "\nwith the following jar: "
+ project.getProjectTarget().getProjectDeploy() + project.getProjectTarget().getProjectDeploy()
.getCodeJar().getPublicLink(); .getCodeJar().getPublicLink();

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input; package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList;
/** /**
* *
@ -15,19 +14,19 @@ public class ProjectInfo implements Serializable {
private String algorithmName; private String algorithmName;
private String algorithmDescription; private String algorithmDescription;
private String algorithmCategory; private String algorithmCategory;
private ArrayList<RequestedVRE> listRequestedVRE;
// private ArrayList<RequestedVRE> listRequestedVRE;
public ProjectInfo() { public ProjectInfo() {
super(); super();
} }
public ProjectInfo(String algorithmName, String algorithmDescription, public ProjectInfo(String algorithmName, String algorithmDescription,
String algorithmCategory, ArrayList<RequestedVRE> listRequestedVRE) { String algorithmCategory) {
super(); super();
this.algorithmName = algorithmName; this.algorithmName = algorithmName;
this.algorithmDescription = algorithmDescription; this.algorithmDescription = algorithmDescription;
this.algorithmCategory = algorithmCategory; this.algorithmCategory = algorithmCategory;
this.listRequestedVRE = listRequestedVRE;
} }
public String getAlgorithmName() { public String getAlgorithmName() {
@ -62,20 +61,11 @@ public class ProjectInfo implements Serializable {
this.algorithmCategory = algorithmCategory; this.algorithmCategory = algorithmCategory;
} }
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 [algorithmName=" + algorithmName return "ProjectInfo [algorithmName=" + algorithmName
+ ", algorithmDescription=" + algorithmDescription + ", algorithmDescription=" + algorithmDescription
+ ", algorithmCategory=" + algorithmCategory + ", algorithmCategory=" + algorithmCategory + "]";
+ ", listRequestedVRE=" + listRequestedVRE + "]";
} }
} }