|
From: Walter M. <wal...@us...> - 2008-08-05 17:30:49
|
User: walterim
Date: 08/08/05 10:31:00
Modified: andromda-jsf2/src/main/resources/templates/jsf2/converters
EnumerationConverter.java.vsl
Log:
Stopped using properties to get the string value in the conversion. t was a wrong choice.
Revision Changes Path
1.5 +14 -7 cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl
Index: EnumerationConverter.java.vsl
===================================================================
RCS file: /cvsroot/andromdaplugins/cartridges/andromda-jsf2/src/main/resources/templates/jsf2/converters/EnumerationConverter.java.vsl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- EnumerationConverter.java.vsl 25 Feb 2008 14:21:24 -0000 1.4
+++ EnumerationConverter.java.vsl 5 Aug 2008 17:30:59 -0000 1.5
@@ -18,7 +18,7 @@
java.lang.Object value)
throws javax.faces.convert.ConverterException
{
- return value != null ? ${managedBeansPackage}.Messages.get("${enumeration.messageKey}."+value.toString(),null) : null;
+ return (value == null || value.toString().trim().length() == 0) ? "": ((${enumeration.fullyQualifiedName})value).toString();
}
/**
@@ -33,6 +33,12 @@
#if(${enumeration.literalType.fullyQualifiedName} == "java.lang.String")
return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(value) : null;
#elseif ($enumeration.literalType.primitive)
+ if(value == null || value.trim().length() == 0)
+ {
+ return null;
+ }
+ else
+ {
try {
#if(${enumeration.literalType.fullyQualifiedName} == "char")
char v = value.charAt(0);
@@ -44,6 +50,7 @@
} catch (Exception ex) {
throw new javax.faces.convert.ConverterException(ex);
}
+ }
#else
return value != null && value.trim().length() > 0 ? ${enumeration.fullyQualifiedName}.${enumeration.fromOperationName}(new ${enumeration.literalType.fullyQualifiedName}(value)) : null;
#end
|