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
src/main/java/org/gcube/portlets/user/statisticalalgorithmsimporter

View File

@ -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<RequestedVRE> storeRequestedVRE;
private Grid<RequestedVRE> gridRequestedVRE;
private GridRowEditing<RequestedVRE> gridRequestedVREEditing;
private TextButton btnAdd;
private boolean addStatus;
private int seq = 0;
//private ListStore<RequestedVRE> storeRequestedVRE;
//private Grid<RequestedVRE> gridRequestedVRE;
//private GridRowEditing<RequestedVRE> 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<RequestedVRE, String> nameColumn = new ColumnConfig<RequestedVRE, String>(
@ -149,7 +117,7 @@ public class ProjectInfoPanel extends ContentPanel {
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
&& 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<RequestedVRE> sm = new GridSelectionModel<RequestedVRE>();
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<RequestedVRE> 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<RequestedVRE> listRequestedVRE = new ArrayList<>(
gridRequestedVRE.getStore().getAll());
return new ProjectInfo(name, description, category, listRequestedVRE);
//ArrayList<RequestedVRE> listRequestedVRE = new ArrayList<>(
// gridRequestedVRE.getStore().getAll());
return new ProjectInfo(name, description, category);
}
}

View File

@ -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());

View File

@ -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("");
}
}*/
}

View File

@ -63,12 +63,14 @@ public class AlgorithmNotification extends Thread {
List<GenericItemBean> 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();

View File

@ -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<RequestedVRE> listRequestedVRE;
// private ArrayList<RequestedVRE> listRequestedVRE;
public ProjectInfo() {
super();
}
public ProjectInfo(String algorithmName, String algorithmDescription,
String algorithmCategory, ArrayList<RequestedVRE> 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<RequestedVRE> getListRequestedVRE() {
return listRequestedVRE;
}
public void setListRequestedVRE(ArrayList<RequestedVRE> listRequestedVRE) {
this.listRequestedVRE = listRequestedVRE;
}
@Override
public String toString() {
return "ProjectInfo [algorithmName=" + algorithmName
+ ", algorithmDescription=" + algorithmDescription
+ ", algorithmCategory=" + algorithmCategory
+ ", listRequestedVRE=" + listRequestedVRE + "]";
+ ", algorithmCategory=" + algorithmCategory + "]";
}
}