Gianpaolo Coro 2014-03-26 12:00:02 +00:00
parent 0a8a133065
commit 44a485f3d8
1 changed files with 20 additions and 4 deletions

View File

@ -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;
}
}