git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-analysis/EcologicalEngineWPSExtension@93569 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
0a8a133065
commit
44a485f3d8
|
@ -38,14 +38,18 @@ public class WPS2SM {
|
|||
AnalysisLogger.getLogger().debug("WPS type:" + type.getStringValue());
|
||||
String guessedType = guessWPSLiteralType(type);
|
||||
AnalysisLogger.getLogger().debug("Guessed type: " + guessedType);
|
||||
|
||||
// rebuild Abstract
|
||||
if ((defaultValue==null || defaultValue.trim().length()==0) && (guessedType.equals(String.class.getName())))
|
||||
defaultValue=" ";
|
||||
if ((defaultValue==null || defaultValue.trim().length()==0))
|
||||
defaultValue=guessDefaultValue(guessedType);
|
||||
|
||||
AnalysisLogger.getLogger().debug("Guessed default value: " + defaultValue);
|
||||
|
||||
Abstract = buildParameterDescription(Abstract, null, uoms, minOcc, maxOcc, defaultValue);
|
||||
if ((maxOcc == 1)||(maxOcc<0)||(maxOcc == 0))
|
||||
converted = new PrimitiveType(guessedType, null, PrimitiveTypes.STRING, title, Abstract, defaultValue,true);
|
||||
converted = new PrimitiveType(guessedType, null, guessPrimitiveType(guessedType), title, Abstract, defaultValue,true);
|
||||
else
|
||||
converted = new PrimitiveTypesList(guessedType, PrimitiveTypes.STRING, title, Abstract, true);
|
||||
converted = new PrimitiveTypesList(String.class.getName(), PrimitiveTypes.STRING, title, Abstract, true);
|
||||
return converted;
|
||||
}
|
||||
|
||||
|
@ -198,6 +202,18 @@ public class WPS2SM {
|
|||
return String.class.getName();
|
||||
}
|
||||
|
||||
public static String guessDefaultValue(String type) {
|
||||
if (type.equals(String.class.getName()))
|
||||
return " ";
|
||||
else
|
||||
return "0";
|
||||
}
|
||||
|
||||
public static PrimitiveTypes guessPrimitiveType(String type) {
|
||||
if (type.equals(String.class.getName()))
|
||||
return PrimitiveTypes.STRING;
|
||||
else
|
||||
return PrimitiveTypes.NUMBER;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue