Author: chris.laprun(a)jboss.com
Date: 2010-01-09 17:38:27 -0500 (Sat, 09 Jan 2010)
New Revision: 1210
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java
Log:
- Check for nulls as some elements are optional.
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java
===================================================================
---
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java 2010-01-09
22:37:09 UTC (rev 1209)
+++
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/state/mapping/RegistrationPropertyDescriptionMapping.java 2010-01-09
22:38:27 UTC (rev 1210)
@@ -25,6 +25,7 @@
import org.chromattic.api.annotations.PrimaryType;
import org.chromattic.api.annotations.Property;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.wsrp.registration.LocalizedString;
import org.gatein.wsrp.registration.RegistrationPropertyDescription;
@@ -67,9 +68,21 @@
public void initFrom(RegistrationPropertyDescription desc)
{
- setDescription(desc.getDescription().getValue());
- setHint(desc.getHint().getValue());
- setLabel(desc.getLabel().getValue());
+ LocalizedString description = desc.getDescription();
+ if (description != null)
+ {
+ setDescription(description.getValue());
+ }
+ LocalizedString hint = desc.getHint();
+ if (hint != null)
+ {
+ setHint(hint.getValue());
+ }
+ LocalizedString label = desc.getLabel();
+ if (label != null)
+ {
+ setLabel(label.getValue());
+ }
// convert QNames to Strings
setName(desc.getName().toString());
@@ -79,9 +92,21 @@
public RegistrationPropertyDescription toRegistrationPropertyDescription()
{
RegistrationPropertyDescription desc = new
RegistrationPropertyDescription(getName(), QName.valueOf(getType()));
- desc.setDefaultDescription(getDescription());
- desc.setHint(new LocalizedString(getHint()));
- desc.setLabel(new LocalizedString(getLabel()));
+ String description = getDescription();
+ if (!ParameterValidation.isNullOrEmpty(description))
+ {
+ desc.setDefaultDescription(description);
+ }
+ String hint = getHint();
+ if (!ParameterValidation.isNullOrEmpty(hint))
+ {
+ desc.setHint(new LocalizedString(hint));
+ }
+ String label = getLabel();
+ if (!ParameterValidation.isNullOrEmpty(label))
+ {
+ desc.setLabel(new LocalizedString(label));
+ }
return desc;
}