Author: scottbw
Date: Tue Jun 7 17:17:40 2011
New Revision: 1133100
URL: http://svn.apache.org/viewvc?rev=1133100&view=rev
Log:
Added "defaultLocale" to the Widget bean and updated the JPA and JCR
implementations. See WOOKIE-211.
Modified:
incubator/wookie/trunk/etc/ddl-schema/wookie-schema.xml
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd
incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java
Modified: incubator/wookie/trunk/etc/ddl-schema/wookie-schema.xml
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/etc/ddl-schema/wookie-schema.xml?rev=1133100&r1=1133099&r2=1133100&view=diff
==============================================================================
--- incubator/wookie/trunk/etc/ddl-schema/wookie-schema.xml (original)
+++ incubator/wookie/trunk/etc/ddl-schema/wookie-schema.xml Tue Jun 7 17:17:40
2011
@@ -24,6 +24,7 @@
<column name="id" primaryKey="true" required="true" type="INTEGER"/>
<column name="jpa_version" type="INTEGER"/>
<column name="package_path" size="255" type="VARCHAR"/>
+ <column name="default_locale" size="255" type="VARCHAR"/>
<column name="height" type="INTEGER"/>
<column name="width" type="INTEGER"/>
<column name="guid" required="true" size="255" type="VARCHAR"/>
Modified:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java?rev=1133100&r1=1133099&r2=1133100&view=diff
==============================================================================
---
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
(original)
+++
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/impl/WidgetImpl.java
Tue Jun 7 17:17:40 2011
@@ -43,6 +43,10 @@ import org.apache.wookie.beans.jcr.JCRPe
@Node(jcrType="wookie:widget", jcrMixinTypes="mix:referenceable",
discriminator=false)
public class WidgetImpl extends LocalizedBeanImpl implements IWidget,
IPathBean, IUuidBean
{
+
+ @Field(jcrName="wookie:defaultLocale")
+ private String defaultLocale;
+
@Field(path=true)
private String path;
@@ -113,6 +117,9 @@ public class WidgetImpl extends Localize
public void setPackagePath(String path) {
packagePath = path;
}
+
+
+
/* (non-Javadoc)
* @see org.apache.wookie.beans.IWidget#getDescriptions()
@@ -727,4 +734,12 @@ public class WidgetImpl extends Localize
{
return Utilities.getWidgetIconLocation(this, "en");
}
+
+ public String getDefaultLocale(){
+ return this.defaultLocale;
+ }
+
+ public voud setDefaultLocale(String locale){
+ this.defaultLocale = locale;
+ }
}
Modified:
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd?rev=1133100&r1=1133099&r2=1133100&view=diff
==============================================================================
---
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd
(original)
+++
incubator/wookie/trunk/modules/jcr/src/org/apache/wookie/beans/jcr/wookie-schema.cnd
Tue Jun 7 17:17:40 2011
@@ -89,6 +89,7 @@
- wookie:widgetVersion (string)
- wookie:dir (string)
- wookie:lang (string)
+- wookie:defaultLocale (string)
+ wookie:widgetTypes (nt:unstructured) = nt:unstructured
+ wookie:accessRequests (nt:unstructured) = nt:unstructured
+ wookie:features (nt:unstructured) = nt:unstructured
Modified: incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java?rev=1133100&r1=1133099&r2=1133100&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java (original)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/IWidget.java Tue Jun 7
17:17:40 2011
@@ -29,6 +29,19 @@ import org.apache.wookie.w3c.util.Locali
*/
public interface IWidget extends ILocalizedBean, IBean
{
+
+ /**
+ * Get the default locale
+ * @return
+ */
+ String getDefaultLocale();
+
+ /**
+ * Set the the default locale
+ * @param locale the locale to set as default
+ */
+ void setDefaultLocale(String locale);
+
/**
* Get the path to the .wgt file used to install the widget
* @return
@@ -325,7 +338,7 @@ public interface IWidget extends ILocali
public static String getWidgetTitle(IWidget widget, String locale)
{
IName[] names = widget.getNames().toArray(new
IName[widget.getNames().size()]);
- IName name = (IName)LocalizationUtils.getLocalizedElement(names,
new String[]{locale});
+ IName name = (IName)LocalizationUtils.getLocalizedElement(names,
new String[]{locale}, widget.getDefaultLocale());
return ((name != null) ?
WidgetFormattingUtils.getFormattedWidgetName(name) :
IW3CXMLConfiguration.UNKNOWN);
}
@@ -343,7 +356,7 @@ public interface IWidget extends ILocali
public static String getWidgetDescription(IWidget widget, String
locale)
{
IDescription[] descriptions =
widget.getDescriptions().toArray(new
IDescription[widget.getDescriptions().size()]);
- IDescription description =
(IDescription)LocalizationUtils.getLocalizedElement(descriptions, new
String[]{locale});
+ IDescription description =
(IDescription)LocalizationUtils.getLocalizedElement(descriptions, new
String[]{locale}, widget.getDefaultLocale());
return ((description != null) ?
WidgetFormattingUtils.getFormattedWidgetDescription(description) : null);
}
@@ -361,7 +374,7 @@ public interface IWidget extends ILocali
public static String getWidgetShortName(IWidget widget, String locale)
{
IName[] names = widget.getNames().toArray(new
IName[widget.getNames().size()]);
- IName name = (IName)LocalizationUtils.getLocalizedElement(names,
new String[]{locale});
+ IName name = (IName)LocalizationUtils.getLocalizedElement(names,
new String[]{locale}, widget.getDefaultLocale());
return ((name != null) ?
WidgetFormattingUtils.getFormattedWidgetShortName(name) :
IW3CXMLConfiguration.UNKNOWN);
}
@@ -375,7 +388,7 @@ public interface IWidget extends ILocali
public static String getUrl(IWidget widget, String locale)
{
IStartFile[] startFiles = widget.getStartFiles().toArray(new
IStartFile[widget.getStartFiles().size()]);
- IStartFile startFile =
(IStartFile)LocalizationUtils.getLocalizedElement(startFiles, new
String[]{locale});
+ IStartFile startFile =
(IStartFile)LocalizationUtils.getLocalizedElement(startFiles, new
String[]{locale}, widget.getDefaultLocale());
return ((startFile != null) ? startFile.getUrl() : null);
}
@@ -389,7 +402,7 @@ public interface IWidget extends ILocali
public static String getWidgetIconLocation(IWidget widget, String
locale)
{
IWidgetIcon[] icons = widget.getWidgetIcons().toArray(new
IWidgetIcon[widget.getWidgetIcons().size()]);
- IWidgetIcon icon =
(IWidgetIcon)LocalizationUtils.getLocalizedElement(icons, new String[]{locale});
+ IWidgetIcon icon =
(IWidgetIcon)LocalizationUtils.getLocalizedElement(icons, new String[]{locale},
widget.getDefaultLocale());
return ((icon != null) ? icon.getSrc() :
IW3CXMLConfiguration.DEFAULT_ICON_PATH);
}
}
Modified:
incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java
URL:
http://svn.apache.org/viewvc/incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java?rev=1133100&r1=1133099&r2=1133100&view=diff
==============================================================================
--- incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java
(original)
+++ incubator/wookie/trunk/src/org/apache/wookie/beans/jpa/impl/WidgetImpl.java
Tue Jun 7 17:17:40 2011
@@ -92,6 +92,10 @@ public class WidgetImpl extends Localize
private String guid;
@Basic
+ @Column(name="default_locale")
+ private String defaultLocale;
+
+ @Basic
@Column(name="widget_author")
private String widgetAuthor;
@@ -547,6 +551,20 @@ public class WidgetImpl extends Localize
packagePath = path;
}
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#getDefaultLocale()
+ */
+ public String getDefaultLocale() {
+ return this.defaultLocale;
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wookie.beans.IWidget#setDefaultLocale(java.lang.String)
+ */
+ public void setDefaultLocale(String locale) {
+ this.defaultLocale = locale;
+ }
}