Author: scottbw
Date: Thu Jun 9 19:16:55 2011
New Revision: 1134049
URL: http://svn.apache.org/viewvc?rev=1134049&view=rev
Log:
Updated Widget AJAX API implementation to use the new Author object including
localization; this means the correct encoded values are returned (see
WOOKIE-204).
Modified:
incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
Modified:
incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java?rev=1134049&r1=1134048&r2=1134049&view=diff
==============================================================================
---
incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
(original)
+++
incubator/wookie/trunk/src/org/apache/wookie/ajaxmodel/impl/WidgetAPIImpl.java
Thu Jun 9 19:16:55 2011
@@ -105,8 +105,14 @@ public class WidgetAPIImpl implements IW
IWidget widget = widgetInstance.getWidget();
String author = "";
- if (widget.getWidgetAuthor() != null) author =
WidgetFormattingUtils.getEncoded(widget.getDir(), widget.getWidgetAuthor());
-
+ String email = "";
+ String href = "";
+ if (widget.getAuthor() != null){
+ if (widget.getAuthor().getAuthor() != null) author =
WidgetFormattingUtils.getEncoded(widget.getAuthor().getDir(),
widget.getAuthor().getAuthor());
+ if (widget.getAuthor().getEmail() != null) email =
widget.getAuthor().getEmail();
+ if (widget.getAuthor().getHref() != null) href =
widget.getAuthor().getHref();
+ }
+
String name = "";
IName iname =
(IName)LocalizationUtils.getLocalizedElement(widget.getNames().toArray(new
IName[widget.getNames().size()]), locales, widget.getDefaultLocale());
if (iname != null && iname.getName() != null) name =
WidgetFormattingUtils.getEncoded(iname.getDir(), iname.getName());
@@ -130,8 +136,8 @@ public class WidgetAPIImpl implements IW
map.put("id", String.valueOf(widget.getGuid()));
//$NON-NLS-1$
map.put("author", author); //$NON-NLS-1$
- map.put("authorEmail",
String.valueOf(widget.getWidgetAuthorEmail()));//$NON-NLS-1$
- map.put("authorHref",
String.valueOf(widget.getWidgetAuthorHref()));//$NON-NLS-1$
+ map.put("authorEmail", email);//$NON-NLS-1$
+ map.put("authorHref", href);//$NON-NLS-1$
map.put("name", name);//$NON-NLS-1$
map.put("description", description);//$NON-NLS-1$
map.put("shortName", shortName); //$NON-NLS-1$