Enhancement on Task #10070
Updated enum list git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/Common/workspace-task-executor-library@167367 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
db36261b56
commit
7d7933c41b
2
pom.xml
2
pom.xml
|
@ -24,7 +24,7 @@
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<distroDirectory>distro</distroDirectory>
|
<distroDirectory>distro</distroDirectory>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|
|
@ -325,10 +325,10 @@ public class WorkspaceDataMinerTaskExecutor implements ExecutableTask<TaskConfig
|
||||||
* @return the parameter types
|
* @return the parameter types
|
||||||
*/
|
*/
|
||||||
public List<TaskParameterType> getParameterTypes(){
|
public List<TaskParameterType> getParameterTypes(){
|
||||||
String[] typeNames = Converter.convertEnumNamesToArraString(ParameterType.class);
|
List<ParameterType> typeNames = Converter.getEnumList(ParameterType.class);
|
||||||
List<TaskParameterType> types = new ArrayList<TaskParameterType>();
|
List<TaskParameterType> types = new ArrayList<TaskParameterType>();
|
||||||
for (String string : typeNames) {
|
for (ParameterType parameterType : typeNames) {
|
||||||
types.add(new TaskParameterType(string));
|
types.add(new TaskParameterType(parameterType.name()));
|
||||||
}
|
}
|
||||||
return types;
|
return types;
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.common.workspacetaskexecutor.util;
|
package org.gcube.common.workspacetaskexecutor.util;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
import org.gcube.common.workspacetaskexecutor.shared.dataminer.TaskComputation;
|
||||||
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
import org.gcube.data.analysis.dataminermanagercl.shared.data.computations.ComputationId;
|
||||||
|
@ -48,14 +50,14 @@ public class Converter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert enum names to arra string.
|
* Gets the enum list.
|
||||||
*
|
*
|
||||||
* @param e the e
|
* @param <E> the element type
|
||||||
* @return the string[]
|
* @param enumClass the enum class
|
||||||
|
* @return the enum list
|
||||||
*/
|
*/
|
||||||
public static String[] convertEnumNamesToArraString(Class<? extends Enum<?>> e){
|
public static <E extends Enum<E>> List<E> getEnumList(Class<E> enumClass) {
|
||||||
return Arrays.stream(e.getEnumConstants()).map(Enum::name).toArray(String[]::new);
|
return new ArrayList<E>(Arrays.asList(enumClass.getEnumConstants()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue