Updated Boolean support
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@134532 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
d036cbbb11
commit
45e969b3df
|
@ -1,12 +1,12 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
<classpathentry kind="src" output="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry including="**/*.java" kind="src" output="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"/>
|
<classpathentry including="**/*.java" kind="src" output="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"/>
|
||||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="optional" value="true"/>
|
<attribute name="optional" value="true"/>
|
||||||
|
@ -26,5 +26,5 @@
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="output" path="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes"/>
|
<classpathentry kind="output" path="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<ReleaseNotes>
|
<ReleaseNotes>
|
||||||
|
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-2-0"
|
||||||
|
date="2016-12-01">
|
||||||
|
<Change>Updated Output support</Change>
|
||||||
|
</Changeset>
|
||||||
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-1-0"
|
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-1-0"
|
||||||
date="2016-10-01">
|
date="2016-10-01">
|
||||||
<Change>Updated to Auth 2.0</Change>
|
<Change>Updated to Auth 2.0</Change>
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>data-miner-manager</artifactId>
|
<artifactId>data-miner-manager</artifactId>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<name>data-miner-manager</name>
|
<name>data-miner-manager</name>
|
||||||
|
|
|
@ -3,18 +3,19 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
||||||
|
|
||||||
import org.gcube.portlets.user.dataminermanager.shared.StringUtil;
|
|
||||||
import org.gcube.portlets.user.dataminermanager.shared.parameters.ObjectParameter;
|
import org.gcube.portlets.user.dataminermanager.shared.parameters.ObjectParameter;
|
||||||
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
|
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
|
||||||
|
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.shared.StringLabelProvider;
|
||||||
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.BoxLayoutContainer.BoxLayoutPack;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
import com.sencha.gxt.widget.core.client.form.CheckBox;
|
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -25,7 +26,7 @@ import com.sencha.gxt.widget.core.client.form.CheckBox;
|
||||||
public class BooleanFld extends AbstractFld {
|
public class BooleanFld extends AbstractFld {
|
||||||
|
|
||||||
private SimpleContainer fieldContainer;
|
private SimpleContainer fieldContainer;
|
||||||
private CheckBox checkBox = new CheckBox();
|
private SimpleComboBox<String> listBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param parameter
|
* @param parameter
|
||||||
|
@ -39,41 +40,67 @@ public class BooleanFld extends AbstractFld {
|
||||||
|
|
||||||
ObjectParameter p = (ObjectParameter) parameter;
|
ObjectParameter p = (ObjectParameter) parameter;
|
||||||
|
|
||||||
if (p.getDefaultValue() != null)
|
listBox = new SimpleComboBox<String>(new StringLabelProvider<>());
|
||||||
checkBox.setValue(!p.getDefaultValue().toUpperCase()
|
listBox.add("true");
|
||||||
.equals("FALSE"));
|
listBox.add("false");
|
||||||
else
|
listBox.setAllowBlank(false);
|
||||||
checkBox.setValue(false);
|
listBox.setForceSelection(true);
|
||||||
checkBox.setBoxLabel(StringUtil.getCapitalWords(p.getName()));
|
listBox.setEditable(false);
|
||||||
|
listBox.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
if (p.getDefaultValue() != null&& !p.getDefaultValue().isEmpty()) {
|
||||||
|
Boolean b=Boolean.valueOf(p.getDefaultValue());
|
||||||
|
if(b){
|
||||||
|
listBox.setValue("true");
|
||||||
|
} else {
|
||||||
|
listBox.setValue("false");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
listBox.setValue("false");
|
||||||
|
}
|
||||||
|
|
||||||
HtmlLayoutContainer descr;
|
HtmlLayoutContainer descr;
|
||||||
|
|
||||||
if (p.getDescription() == null) {
|
if (p.getDescription() == null) {
|
||||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
descr = new HtmlLayoutContainer(
|
||||||
|
"<p style='margin-left:5px !important;'></p>");
|
||||||
descr.addStyleName("workflow-fieldDescription");
|
descr.addStyleName("workflow-fieldDescription");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
//checkBox.setToolTip(p.getDescription());
|
// listBox.setToolTip(p.getDescription());
|
||||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
descr = new HtmlLayoutContainer(
|
||||||
+ p.getDescription() + "</p>");
|
"<p style='margin-left:5px !important;'>"
|
||||||
|
+ p.getDescription() + "</p>");
|
||||||
descr.addStyleName("workflow-fieldDescription");
|
descr.addStyleName("workflow-fieldDescription");
|
||||||
}
|
}
|
||||||
|
horiz.add(listBox, new BoxLayoutData(new Margins()));
|
||||||
horiz.add(checkBox, new BoxLayoutData(new Margins()));
|
|
||||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||||
|
|
||||||
fieldContainer.add(horiz);
|
fieldContainer.add(horiz);
|
||||||
|
fieldContainer.forceLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return (checkBox.getValue() ? "true" : "false");
|
return listBox.getCurrentValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Widget getWidget() {
|
public Widget getWidget() {
|
||||||
return fieldContainer;
|
return fieldContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isValid() {
|
||||||
|
return listBox.isValid();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -190,9 +190,15 @@ public class WPS2DM {
|
||||||
guessPrimitiveType(guessedType), defaultValue);
|
guessPrimitiveType(guessedType), defaultValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
converted = new ListParameter(id, title, String.class.getName(),
|
if(guessedType.compareTo(Boolean.class.getName())==0){
|
||||||
|
converted = new ObjectParameter(id, title, guessedType, defaultValue);
|
||||||
|
} else {
|
||||||
|
converted = new ListParameter(id, title, String.class.getName(),
|
||||||
SEPARATOR);
|
SEPARATOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,9 +407,14 @@ public class WPS2DM {
|
||||||
}
|
}
|
||||||
if (values.length > 1) {
|
if (values.length > 1) {
|
||||||
ObjectParameter conv = (ObjectParameter) converted;
|
ObjectParameter conv = (ObjectParameter) converted;
|
||||||
converted = new EnumParameter(conv.getName(),
|
if (conv.getType() != null
|
||||||
conv.getDescription(), enumValues,
|
&& !conv.getType().isEmpty()
|
||||||
conv.getDefaultValue());
|
&& conv.getType().compareToIgnoreCase(
|
||||||
|
Boolean.class.getName()) != 0){
|
||||||
|
converted = new EnumParameter(conv.getName(),
|
||||||
|
conv.getDescription(), enumValues,
|
||||||
|
conv.getDefaultValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (wpsType.isSetComplexData()) {
|
} else if (wpsType.isSetComplexData()) {
|
||||||
|
@ -525,6 +536,9 @@ public class WPS2DM {
|
||||||
return Long.class.getName();
|
return Long.class.getName();
|
||||||
else if (typeS.contains("short"))
|
else if (typeS.contains("short"))
|
||||||
return Short.class.getName();
|
return Short.class.getName();
|
||||||
|
else if (typeS.contains("boolean"))
|
||||||
|
return Boolean.class.getName();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return String.class.getName();
|
return String.class.getName();
|
||||||
|
@ -538,6 +552,7 @@ public class WPS2DM {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String guessPrimitiveType(String type) {
|
public static String guessPrimitiveType(String type) {
|
||||||
|
|
||||||
if (type.equals(Integer.class.getName())) {
|
if (type.equals(Integer.class.getName())) {
|
||||||
return Integer.class.getName();
|
return Integer.class.getName();
|
||||||
} else if (type.equals(String.class.getName())) {
|
} else if (type.equals(String.class.getName())) {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package org.gcube.portlets.user.dataminermanager.server.storage;
|
package org.gcube.portlets.user.dataminermanager.server.storage;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -54,8 +53,7 @@ public class StorageUtil {
|
||||||
|
|
||||||
return properties.getProperties();
|
return properties.getProperties();
|
||||||
|
|
||||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
} catch (Throwable e) {
|
||||||
| HomeNotFoundException | ItemNotFoundException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException(e.getLocalizedMessage());
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
|
@ -86,8 +84,7 @@ public class StorageUtil {
|
||||||
|
|
||||||
return getInputStream(user, workSpaceItem);
|
return getInputStream(user, workSpaceItem);
|
||||||
|
|
||||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
} catch (Throwable e) {
|
||||||
| HomeNotFoundException | ItemNotFoundException e) {
|
|
||||||
logger.error(e.getLocalizedMessage());
|
logger.error(e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException(e.getLocalizedMessage());
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
|
@ -143,8 +140,7 @@ public class StorageUtil {
|
||||||
|
|
||||||
return workSpaceItem.getPublicLink(false);
|
return workSpaceItem.getPublicLink(false);
|
||||||
|
|
||||||
} catch (WorkspaceFolderNotFoundException | InternalErrorException
|
} catch (Throwable e) {
|
||||||
| HomeNotFoundException | ItemNotFoundException e) {
|
|
||||||
logger.error("Error retrieving public link: "
|
logger.error("Error retrieving public link: "
|
||||||
+ e.getLocalizedMessage());
|
+ e.getLocalizedMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -179,9 +175,7 @@ public class StorageUtil {
|
||||||
|
|
||||||
return fileZip;
|
return fileZip;
|
||||||
|
|
||||||
} catch (IOException | InternalErrorException
|
} catch (Throwable e) {
|
||||||
| WorkspaceFolderNotFoundException | HomeNotFoundException
|
|
||||||
| ItemNotFoundException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ServiceException(e.getLocalizedMessage());
|
throw new ServiceException(e.getLocalizedMessage());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue