From fea1fdb2bcee8ca7e088b89f5df107853cbaa4dd Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Wed, 22 Feb 2017 15:01:00 +0000 Subject: [PATCH] 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 --- .../client/tools/input/ProjectInfoPanel.java | 91 +++++++------------ .../server/annotation/WPS4RParser.java | 8 +- .../server/generator/InfoGenerator.java | 4 +- .../server/social/AlgorithmNotification.java | 8 +- .../shared/input/ProjectInfo.java | 18 +--- 5 files changed, 46 insertions(+), 83 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java index 743002b..5cbe568 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/client/tools/input/ProjectInfoPanel.java @@ -1,54 +1,21 @@ 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.RequestedVRE; import org.gcube.portlets.user.statisticalalgorithmsimporter.shared.project.Project; 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.ChangeHandler; 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.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.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.VerticalLayoutContainer; 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.TextField; 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 algorithmDescription; private TextField algorithmCategory; - private ListStore storeRequestedVRE; - private Grid gridRequestedVRE; - private GridRowEditing gridRequestedVREEditing; - private TextButton btnAdd; - private boolean addStatus; - private int seq = 0; + //private ListStore storeRequestedVRE; + //private Grid gridRequestedVRE; + //private GridRowEditing gridRequestedVREEditing; + //private TextButton btnAdd; + //private boolean addStatus; + //private int seq = 0; public ProjectInfoPanel(Project project, EventBus eventBus) { super(); @@ -133,6 +100,7 @@ public class ProjectInfoPanel extends ContentPanel { categoryLabel.setLabelWidth(LABAEL_WIDTH); // Grid + /* RequestedVREProperties props = GWT.create(RequestedVREProperties.class); ColumnConfig nameColumn = new ColumnConfig( @@ -149,7 +117,7 @@ public class ProjectInfoPanel extends ContentPanel { ColumnModel columns = new ColumnModel(l); - storeRequestedVRE = new ListStore(props.id()); + storeRequestedVRE = new ListStore(props.id());*/ if (project != null && project.getInputData() != 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() .getProjectInfo().getListRequestedVRE()); seq = project.getInputData().getProjectInfo() .getListRequestedVRE().size(); - } + }*/ } - + + /* final GridSelectionModel sm = new GridSelectionModel(); sm.setSelectionMode(SelectionMode.SINGLE); @@ -322,15 +291,16 @@ public class ProjectInfoPanel extends ContentPanel { } } }); - + + */ // / - ToolBar toolBar = new ToolBar(); - toolBar.add(btnAdd, new BoxLayoutData(new Margins(0))); + //ToolBar toolBar = new ToolBar(); + //toolBar.add(btnAdd, new BoxLayoutData(new Margins(0))); - FieldLabel requestedVRELabel = new FieldLabel(toolBar, "Requested VREs"); - requestedVRELabel.setLabelWidth(LABAEL_WIDTH); + //FieldLabel requestedVRELabel = new FieldLabel(toolBar, "Requested VREs"); + //requestedVRELabel.setLabelWidth(LABAEL_WIDTH); VerticalLayoutContainer vlc = new VerticalLayoutContainer(); vlc.setAdjustForScroll(false); @@ -339,10 +309,10 @@ public class ProjectInfoPanel extends ContentPanel { vlc.add(nameLabel, 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(requestedVRELabel, - 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(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))); } @@ -372,6 +342,7 @@ public class ProjectInfoPanel extends ContentPanel { algorithmCategory.clear(); } + /* if (project.getInputData().getProjectInfo().getListRequestedVRE() != null) { storeRequestedVRE.clear(); storeRequestedVRE.addAll(project.getInputData() @@ -384,19 +355,21 @@ public class ProjectInfoPanel extends ContentPanel { storeRequestedVRE.clear(); storeRequestedVRE.commitChanges(); seq = 0; - } + }*/ } else { algorithmName.clear(); algorithmDescription.clear(); algorithmCategory.clear(); - storeRequestedVRE.clear(); - storeRequestedVRE.commitChanges(); - seq = 0; + //storeRequestedVRE.clear(); + //storeRequestedVRE.commitChanges(); + //seq = 0; } } + /* + private void editingBeforeStart(BeforeStartEditEvent event) { // TODO Auto-generated method stub @@ -417,15 +390,15 @@ public class ProjectInfoPanel extends ContentPanel { } catch (Throwable e) { e.printStackTrace(); } - } + }*/ public ProjectInfo getProjectInfo() { String name = algorithmName.getCurrentValue(); String description = algorithmDescription.getCurrentValue(); String category = algorithmCategory.getCurrentValue(); - ArrayList listRequestedVRE = new ArrayList<>( - gridRequestedVRE.getStore().getAll()); - return new ProjectInfo(name, description, category, listRequestedVRE); + //ArrayList listRequestedVRE = new ArrayList<>( + // gridRequestedVRE.getStore().getAll()); + return new ProjectInfo(name, description, category); } } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/annotation/WPS4RParser.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/annotation/WPS4RParser.java index 56f251b..ab82f8e 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/annotation/WPS4RParser.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/annotation/WPS4RParser.java @@ -114,7 +114,7 @@ public class WPS4RParser { if (project.getInputData() == null) { ProjectInfo projectInfo = new ProjectInfo( wpsAlgorithmInfo.getAlgorithmName(), - wpsAlgorithmInfo.getDescription(), null, null); + wpsAlgorithmInfo.getDescription(), null); InputData inputData = new InputData(projectInfo, null, null, wpsAlgorithmInfo.getInputOutputVariables()); project.setInputData(inputData); @@ -123,7 +123,7 @@ public class WPS4RParser { InputData inputData = project.getInputData(); ProjectInfo projectInfo = new ProjectInfo( wpsAlgorithmInfo.getAlgorithmName(), - wpsAlgorithmInfo.getDescription(), null, null); + wpsAlgorithmInfo.getDescription(), null); inputData.setProjectInfo(projectInfo); inputData.setListInputOutputVariables(wpsAlgorithmInfo .getInputOutputVariables()); @@ -133,9 +133,7 @@ public class WPS4RParser { wpsAlgorithmInfo.getAlgorithmName(), wpsAlgorithmInfo.getDescription(), project .getInputData().getProjectInfo() - .getAlgorithmCategory(), project - .getInputData().getProjectInfo() - .getListRequestedVRE()); + .getAlgorithmCategory()); inputData.setProjectInfo(projectInfo); inputData.setListInputOutputVariables(wpsAlgorithmInfo .getInputOutputVariables()); diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/InfoGenerator.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/InfoGenerator.java index f12ea1b..96db29f 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/InfoGenerator.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/generator/InfoGenerator.java @@ -9,7 +9,6 @@ import java.util.ArrayList; import java.util.List; 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.project.Project; import org.slf4j.Logger; @@ -91,6 +90,7 @@ public class InfoGenerator { infos.add(""); + /* if (project.getInputData().getProjectInfo() .getListRequestedVRE() != null && project.getInputData().getProjectInfo() @@ -101,7 +101,7 @@ public class InfoGenerator { infos.add("" + deployableVRE.getName() + " " + deployableVRE.getDescription()); } infos.add(""); - } + }*/ } diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/social/AlgorithmNotification.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/social/AlgorithmNotification.java index 148aa59..db9bdc7 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/social/AlgorithmNotification.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/server/social/AlgorithmNotification.java @@ -63,12 +63,14 @@ public class AlgorithmNotification extends Thread { List recipients = retrieveRecipients(); String subject = "[SAI] New software publication requested"; - String body = "The user " + String body = "The user: " + serviceCredentials.getFullName() - + "\n\n has requested to publish the algorithm " + + "\nin VRE: " + + serviceCredentials.getScope() + + "\n\nhas requested to publish the algorithm: " + project.getInputData().getProjectInfo() .getAlgorithmName() - + " with the following jar " + + "\nwith the following jar: " + project.getProjectTarget().getProjectDeploy() .getCodeJar().getPublicLink(); diff --git a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/input/ProjectInfo.java b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/input/ProjectInfo.java index 77a4d31..e96326c 100644 --- a/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/input/ProjectInfo.java +++ b/src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter/shared/input/ProjectInfo.java @@ -1,7 +1,6 @@ package org.gcube.portlets.user.statisticalalgorithmsimporter.shared.input; import java.io.Serializable; -import java.util.ArrayList; /** * @@ -15,19 +14,19 @@ public class ProjectInfo implements Serializable { private String algorithmName; private String algorithmDescription; private String algorithmCategory; - private ArrayList listRequestedVRE; + + // private ArrayList listRequestedVRE; public ProjectInfo() { super(); } public ProjectInfo(String algorithmName, String algorithmDescription, - String algorithmCategory, ArrayList listRequestedVRE) { + String algorithmCategory) { super(); this.algorithmName = algorithmName; this.algorithmDescription = algorithmDescription; this.algorithmCategory = algorithmCategory; - this.listRequestedVRE = listRequestedVRE; } public String getAlgorithmName() { @@ -62,20 +61,11 @@ public class ProjectInfo implements Serializable { this.algorithmCategory = algorithmCategory; } - public ArrayList getListRequestedVRE() { - return listRequestedVRE; - } - - public void setListRequestedVRE(ArrayList listRequestedVRE) { - this.listRequestedVRE = listRequestedVRE; - } - @Override public String toString() { return "ProjectInfo [algorithmName=" + algorithmName + ", algorithmDescription=" + algorithmDescription - + ", algorithmCategory=" + algorithmCategory - + ", listRequestedVRE=" + listRequestedVRE + "]"; + + ", algorithmCategory=" + algorithmCategory + "]"; } }