Author: thomas.heute(a)jboss.com
Date: 2008-07-24 15:39:08 -0400 (Thu, 24 Jul 2008)
New Revision: 11585
Modified:
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
Log:
- JBPORTAL-2084: fixed detection of need to call modifyRegistration.
- Now perform value normalization to consider empty String as null since we can get both
from JSF.
- Improved status reporting.
Modified:
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
---
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-07-24
19:30:06 UTC (rev 11584)
+++
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2008-07-24
19:39:08 UTC (rev 11585)
@@ -64,6 +64,7 @@
private static final String CANNOT_MODIFY_REG =
"bean_consumer_cannot_modify_reg";
private static final String CANNOT_ERASE_REG =
"bean_consumer_cannot_erase_reg";
private static final String MALFORMED_URL = "bean_consumer_malformed_url";
+ private static final String UPDATE_SUCCESS =
"bean_consumer_update_success";
public ConsumerBean()
{
@@ -297,6 +298,11 @@
public String update()
{
+ return internalUpdate(true);
+ }
+
+ private String internalUpdate(boolean showMessage)
+ {
if (consumer != null)
{
if (isModified())
@@ -324,6 +330,10 @@
}
}
+ if (showMessage)
+ {
+ beanContext.createInfoMessage(UPDATE_SUCCESS);
+ }
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
@@ -343,14 +353,22 @@
{
if (isModified())
{
- String updateResult = update();
+ String updateResult = internalUpdate(false);
if (updateResult == null)
{
return null;
}
}
- manager.refresh(consumer);
+ // if the registration is locally modified, bypassed the refresh as it will not
yield a proper result
+ if (!isRegistrationLocallyModified())
+ {
+ manager.refresh(consumer);
+ }
+ else
+ {
+ beanContext.createInfoMessage(ConsumerManagerBean.REFRESH_MODIFY);
+ }
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
@@ -464,9 +482,23 @@
private boolean isOldAndNewEqual(Object oldValue, Object newValue)
{
+ oldValue = normalizeStringIfNeeded(oldValue);
+ newValue = normalizeStringIfNeeded(newValue);
+
return (oldValue != null && !oldValue.equals(newValue)) || (oldValue ==
null && newValue != null);
}
+ /**
+ * Normalizes Strings by considering empty String as null as JSF would give either
+ *
+ * @param value
+ * @return
+ */
+ private Object normalizeStringIfNeeded(Object value)
+ {
+ return (value instanceof String && ((String)value).length() == 0) ? null :
value;
+ }
+
// Listeners
public void useWSDLListener(ValueChangeEvent event)
@@ -481,12 +513,12 @@
{
if (!registrationLocallyModified)
{
- registrationLocallyModified = isOldAndNewEqual(event.getOldValue(),
event.getNewValue());
-
- // FIX-ME: this should be handled better
- // if we modified locally, mark the registration info as modified as well
-
getProducerInfo().getRegistrationInfo().setModified(registrationLocallyModified);
- getProducerInfo().setModifyRegistrationRequired(true);
+ // only mark as locally modified if we had a previous value
+ Object oldValue = normalizeStringIfNeeded(event.getOldValue());
+ if (oldValue != null)
+ {
+ registrationLocallyModified = isOldAndNewEqual(oldValue,
event.getNewValue());
+ }
}
}
}
Modified:
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
---
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-07-24
19:30:06 UTC (rev 11584)
+++
tags/JBoss_Portal_2_6_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-07-24
19:39:08 UTC (rev 11585)
@@ -55,7 +55,7 @@
private static final String REFRESH_SUCCESS =
"bean_consumermanager_refresh_success";
private static final String REFRESH_FAILURE =
"bean_consumermanager_refresh_failure";
private static final String REFRESH_EXCEPTION =
"bean_consumermanager_refresh_exception";
- private static final String REFRESH_MODIFY =
"bean_consumermanager_refresh_modify";
+ static final String REFRESH_MODIFY = "bean_consumermanager_refresh_modify";
public ConsumerRegistry getRegistry()
{
Modified:
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
---
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-24
19:30:06 UTC (rev 11584)
+++
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-24
19:39:08 UTC (rev 11585)
@@ -146,6 +146,7 @@
bean_consumer_cannot_modify_reg = Couldn't modify registration!
bean_consumer_cannot_erase_reg = Couldn't erase local registration!
bean_consumer_malformed_url = ''{0}'' is not a valid URL: {1}
+bean_consumer_update_success = Successfully updated consumer!
# ConsumerManagerBean
bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the
new consumer!
Modified:
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
---
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-24
19:30:06 UTC (rev 11584)
+++
tags/JBoss_Portal_2_6_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-24
19:39:08 UTC (rev 11585)
@@ -133,4 +133,5 @@
bean_consumermanager_refresh_success=Le rafra\u00eechissement a r\u00e9ussi.
bean_producer_cancel_success=Toutes les modifications faites \u00e0 la configuration du
producteur ont \u00e9t\u00e9 annull\u00e9es!
bean_producer_save_success=La configuration du producteur a bien \u00e9t\u00e9
sauvegard\u00e9e!
-bean_consumermanager_refresh_modify=Les informations locales ont chang\u00e9, vous
devriez modifier votre enregistrement avec le producteur.
\ No newline at end of file
+bean_consumermanager_refresh_modify=Les informations locales ont chang\u00e9, vous
devriez modifier votre enregistrement avec le producteur.
+bean_consumer_update_success=Consommateur mis \u00e0 jour!
\ No newline at end of file