[portal-commits] JBoss Portal SVN: r9156 - in branches/JBoss_Portal_Branch_2_6/wsrp/src: resources/portal-wsrp-sar/xsd and 1 other directory.

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Wed Nov 28 03:40:39 EST 2007


Author: chris.laprun at jboss.com
Date: 2007-11-28 03:40:39 -0500 (Wed, 28 Nov 2007)
New Revision: 9156

Modified:
   branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java
   branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd
Log:
- Allow label to be optional.
- Don't output LocalizedString elements if not needed.

Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java	2007-11-28 08:38:11 UTC (rev 9155)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerConfigurationProvider.java	2007-11-28 08:40:39 UTC (rev 9156)
@@ -123,15 +123,35 @@
       }
       else if ("label".equals(localName))
       {
-         value = propertyDescription.getLabel();
+         value = getLocalizedStringOrNull(propertyDescription.getLabel());
       }
       else if ("hint".equals(localName))
       {
-         value = propertyDescription.getHint();
+         value = getLocalizedStringOrNull(propertyDescription.getHint());
       }
       return value;
    }
 
+   private LocalizedString getLocalizedStringOrNull(LocalizedString string)
+   {
+      if (string != null)
+      {
+         String value = string.getValue();
+         if (value == null || value.length() == 0)
+         {
+            return null;
+         }
+         else
+         {
+            return string;
+         }
+      }
+      else
+      {
+         return null;
+      }
+   }
+
    public Object getAttributeValue(LocalizedString localizedString, String namespaceUri, String localName)
    {
       Object value = null;

Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd	2007-11-28 08:38:11 UTC (rev 9155)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/xsd/jboss-wsrp-producer_2_6.xsd	2007-11-28 08:40:39 UTC (rev 9156)
@@ -52,7 +52,7 @@
       <xs:sequence>
          <xs:element name="name" type="xs:QName"/>
          <xs:element name="type" type="xs:QName"/>
-         <xs:element name="label" type="wpc:LocalizedString"/>
+         <xs:element name="label" type="wpc:LocalizedString" minOccurs="0"/>
          <xs:element name="hint" type="wpc:LocalizedString" minOccurs="0"/>
       </xs:sequence>
    </xs:complexType>




More information about the portal-commits mailing list