[gatein-commits] gatein SVN: r1561 - in portal/trunk: component/application-registry/src/main/java/org/exoplatform/application/gadget/impl and 7 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Feb 8 14:08:53 EST 2010


Author: julien_viet
Date: 2010-02-08 14:08:52 -0500 (Mon, 08 Feb 2010)
New Revision: 1561

Added:
   portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java
Modified:
   portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml
   portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
   portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java
   portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java
   portal/trunk/component/application-registry/src/test/java/conf/exo.portal.component.application-registry-configuration.xml
   portal/trunk/component/portal/src/main/java/conf/content-nodetypes.xml
   portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/ProtectedResource.java
   portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml
   portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
   portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
Log:
- use gatein namespace for gatein specific mixins
- introduce gtn:described mixin for name+description
- refactor other node types to use the gatein mixins


Modified: portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml
===================================================================
--- portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/application-registry/src/main/java/conf/application-nodetypes.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -39,14 +39,9 @@
     <supertypes>
       <supertype>nt:base</supertype>
       <supertype>mix:referenceable</supertype>
+      <supertype>gtn:described</supertype>
     </supertypes>
     <propertyDefinitions>
-      <propertyDefinition name="app:title" requiredType="String" autoCreated="false" mandatory="true" onParentVersion="COPY" protected="false" multiple="false">
-        <valueConstraints/>
-      </propertyDefinition>
-      <propertyDefinition name="app:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
-        <valueConstraints/>
-      </propertyDefinition>
       <propertyDefinition name="app:thumbnail" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
         <valueConstraints/>
       </propertyDefinition>
@@ -120,23 +115,16 @@
     <supertypes>
       <supertype>nt:base</supertype>
       <supertype>mix:referenceable</supertype>
+      <supertype>gtn:protectedresource</supertype>
+      <supertype>gtn:described</supertype>
     </supertypes>
     <propertyDefinitions>
-      <propertyDefinition name="app:displayname" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-        <valueConstraints/>
-      </propertyDefinition>
-      <propertyDefinition name="app:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
-        <valueConstraints/>
-      </propertyDefinition>
       <propertyDefinition name="app:creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
         <valueConstraints/>
       </propertyDefinition>
       <propertyDefinition name="app:lastmodificationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
         <valueConstraints/>
       </propertyDefinition>
-      <propertyDefinition name="app:accesspermissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-        <valueConstraints/>
-      </propertyDefinition>
     </propertyDefinitions>
     <childNodeDefinitions>
       <childNodeDefinition name="*" defaultPrimaryType="app:application" autoCreated="false" mandatory="false"
@@ -152,23 +140,16 @@
     <supertypes>
       <supertype>nt:base</supertype>
       <supertype>mix:referenceable</supertype>
+      <supertype>gtn:protectedresource</supertype>
+      <supertype>gtn:described</supertype>
     </supertypes>
       <propertyDefinitions>
-        <propertyDefinition name="app:displayname" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-          <valueConstraints/>
-        </propertyDefinition>
-        <propertyDefinition name="app:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
-          <valueConstraints/>
-        </propertyDefinition>
         <propertyDefinition name="app:creationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
           <valueConstraints/>
         </propertyDefinition>
         <propertyDefinition name="app:lastmodificationdate" requiredType="Date" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
           <valueConstraints/>
         </propertyDefinition>
-        <propertyDefinition name="app:accesspermissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-          <valueConstraints/>
-        </propertyDefinition>
       </propertyDefinitions>
   </nodeType>
 

Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/gadget/impl/GadgetDefinition.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -35,12 +35,12 @@
    @Name
    public abstract String getName();
 
-   @Property(name = "app:title")
+   @Property(name = "gtn:name")
    public abstract String getTitle();
 
    public abstract void setTitle(String title);
 
-   @Property(name = "app:description")
+   @Property(name = "gtn:description")
    public abstract String getDescription();
 
    public abstract void setDescription(String description);

Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/CategoryDefinition.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -50,12 +50,12 @@
    @Name
    public abstract String getName();
 
-   @Property(name = "app:displayname")
+   @Property(name = "gtn:name")
    public abstract String getDisplayName();
 
    public abstract void setDisplayName(String displayName);
 
-   @Property(name = "app:description")
+   @Property(name = "gtn:description")
    public abstract String getDescription();
 
    public abstract void setDescription(String description);
@@ -70,7 +70,7 @@
 
    public abstract void setLastModificationDate(Date date);
 
-   @Property(name = "app:accesspermissions")
+   @Property(name = "gtn:access-permissions")
    public abstract List<String> getAccessPermissions();
 
    public abstract void setAccessPermissions(List<String> accessPermissions);

Modified: portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java
===================================================================
--- portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/application-registry/src/main/java/org/exoplatform/application/registry/impl/ContentDefinition.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -42,12 +42,12 @@
    @Name
    public abstract String getName();
 
-   @Property(name = "app:displayname")
+   @Property(name = "gtn:name")
    public abstract String getDisplayName();
 
    public abstract void setDisplayName(String displayName);
 
-   @Property(name = "app:description")
+   @Property(name = "gtn:description")
    public abstract String getDescription();
 
    public abstract void setDescription(String description);
@@ -62,7 +62,7 @@
 
    public abstract void setLastModificationDate(Date date);
 
-   @Property(name = "app:accesspermissions")
+   @Property(name = "gtn:access-permissions")
    public abstract List<String> getAccessPermissions();
 
    public abstract void setAccessPermissions(List<String> accessPermissions);

Modified: portal/trunk/component/application-registry/src/test/java/conf/exo.portal.component.application-registry-configuration.xml
===================================================================
--- portal/trunk/component/application-registry/src/test/java/conf/exo.portal.component.application-registry-configuration.xml	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/application-registry/src/test/java/conf/exo.portal.component.application-registry-configuration.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -262,6 +262,7 @@
  		  <init-params>
  		    <properties-param>
  		      <name>namespaces</name>
+          <property name="gtn" value="http://www.gatein.org/jcr/gatein/1.0/"/>
  		      <property name="app" value="http://www.gatein.org/jcr/application-registry/1.0/"/>
  		      </properties-param>
  		  </init-params>

Modified: portal/trunk/component/portal/src/main/java/conf/content-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/content-nodetypes.xml	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/portal/src/main/java/conf/content-nodetypes.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -20,17 +20,6 @@
 -->
 <nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
 
-    <nodeType name="mop:protectedresource" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
-      <propertyDefinitions>
-        <propertyDefinition name="mop:access-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-          <valueConstraints/>
-        </propertyDefinition>
-        <propertyDefinition name="mop:edit-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
-          <valueConstraints/>
-        </propertyDefinition>
-      </propertyDefinitions>
-    </nodeType>
-
     <nodeType name="mop:portletpreferences" isMixin="false" hasOrderableChildNodes="false" primaryItemName="">
       <supertypes>
         <supertype>mop:customizationstate</supertype>

Added: portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml
===================================================================
--- portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml	                        (rev 0)
+++ portal/trunk/component/portal/src/main/java/conf/gatein-nodetypes.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -0,0 +1,43 @@
+<!--
+  ~ Copyright (C) 2009 eXo Platform SAS.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software is distributed in the hope that it will be useful,
+  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  ~ Lesser General Public License for more details.
+  ~
+  ~ You should have received a copy of the GNU Lesser General Public
+  ~ License along with this software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+<nodeTypes xmlns:nt="http://www.jcp.org/jcr/nt/1.0" xmlns:mix="http://www.jcp.org/jcr/mix/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0">
+
+    <nodeType name="gtn:protectedresource" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+      <propertyDefinitions>
+        <propertyDefinition name="gtn:access-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+          <valueConstraints/>
+        </propertyDefinition>
+        <propertyDefinition name="gtn:edit-permissions" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="true">
+          <valueConstraints/>
+        </propertyDefinition>
+      </propertyDefinitions>
+    </nodeType>
+
+    <nodeType name="gtn:described" isMixin="true" hasOrderableChildNodes="false" primaryItemName="">
+      <propertyDefinitions>
+        <propertyDefinition name="gtn:name" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+          <valueConstraints/>
+        </propertyDefinition>
+        <propertyDefinition name="gtn:description" requiredType="String" autoCreated="false" mandatory="false" onParentVersion="COPY" protected="false" multiple="false">
+          <valueConstraints/>
+        </propertyDefinition>
+      </propertyDefinitions>
+    </nodeType>
+
+</nodeTypes>

Added: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java	                        (rev 0)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/Described.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.portal.mop;
+
+import org.chromattic.api.annotations.MixinType;
+import org.chromattic.api.annotations.Property;
+
+/**
+ * Something having a human readable name and a description. The semantic of the name is to be human readable, it
+ * can be expressed under various ways : name, display name, label, title, etc...
+ *
+ * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+ at MixinType(name = "gtn:described")
+public abstract class Described
+{
+
+   @Property(name = "gtn:name")
+   public abstract String getName();
+
+   public abstract void setName(String name);
+
+   @Property(name = "gtn:description")
+   public abstract String getDescription();
+
+   public abstract void setDescription(String description);
+
+
+}

Modified: portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/ProtectedResource.java
===================================================================
--- portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/ProtectedResource.java	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/portal/src/main/java/org/exoplatform/portal/mop/ProtectedResource.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -22,7 +22,6 @@
 import org.chromattic.api.annotations.MixinType;
 import org.chromattic.api.annotations.Property;
 
-import java.util.Collections;
 import java.util.List;
 
 /**
@@ -31,36 +30,18 @@
  * @author <a href="mailto:julien.viet at exoplatform.com">Julien Viet</a>
  * @version $Revision$
  */
- at MixinType(name = "mop:protectedresource")
+ at MixinType(name = "gtn:protectedresource")
 public abstract class ProtectedResource
 {
 
-   @Property(name = "mop:access-permissions")
+   @Property(name = "gtn:access-permissions")
    public abstract List<String> getAccessPermissions();
 
    public abstract void setAccessPermissions(List<String> accessPermissions);
 
-   @Property(name = "mop:edit-permissions")
+   @Property(name = "gtn:edit-permissions")
    public abstract String getEditPermission();
 
    public abstract void setEditPermission(String editPermission);
 
-/*
-   public String getEditPermission()
-   {
-      List<String> editPermissions = getEditPermissions();
-      return editPermissions.isEmpty() ? null : editPermissions.get(0);
-   }
-
-   public void setEditPermission(String editPermission)
-   {
-      setEditPermission(Collections.singletonList(editPermission));
-   }
-
-   @Property(name = "mop:edit-permissions")
-   public abstract List<String> getEditPermissions();
-
-   public abstract void setEditPermission(List<String> editPermissions);
-*/
-
 }

Modified: portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml
===================================================================
--- portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/portal/src/test/java/conf/exo.portal.component.portal-configuration1.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -114,6 +114,7 @@
  		  <init-params>
  		    <properties-param>
  		      <name>namespaces</name>
+          <property name="gtn" value="http://www.gatein.org/jcr/gatein/1.0/"/>
           <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
  		      </properties-param>
  		  </init-params>
@@ -126,8 +127,9 @@
  		    <values-param>
  		      <name>autoCreatedInNewRepository</name>
  		      <description>Node types configuration file</description>
-          <value>jar:/conf/mop-nodetypes.xml</value>
-          <value>jar:/conf/content-nodetypes.xml</value>
+           <value>jar:/conf/gatein-nodetypes.xml</value>
+           <value>jar:/conf/mop-nodetypes.xml</value>
+           <value>jar:/conf/content-nodetypes.xml</value>
  		    </values-param>
  		  </init-params>
  		</component-plugin>

Modified: portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java
===================================================================
--- portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/component/portal/src/test/java/org/exoplatform/portal/config/TestSavedPOM.java	2010-02-08 19:08:52 UTC (rev 1561)
@@ -194,12 +194,14 @@
 
       //
       UIContainer container1 = (UIContainer)it.next();
+      assertTrue(container1.isAdapted(ProtectedResource.class));
+      ProtectedResource container1PR = container1.adapt(ProtectedResource.class);
+      assertEquals(Collections.singletonList("container_1_access_permissions"), container1PR.getAccessPermissions());
       Attributes container1Attrs = container1.getAttributes();
       assertEquals("container_1", container1Attrs.getString("name"));
       assertEquals("container_1_title", container1Attrs.getString("title"));
       assertEquals("container_1_icon", container1Attrs.getString("icon"));
       assertEquals("container_1_template", container1Attrs.getString("template"));
-      assertEquals("container_1_access_permissions", container1Attrs.getString("access-permissions"));
       assertEquals("container_1_factory_id", container1Attrs.getString("factory-id"));
       assertEquals("container_1_decorator", container1Attrs.getString("decorator"));
       assertEquals("container_1_description", container1Attrs.getString("description"));
@@ -208,10 +210,12 @@
 
       //
       UIWindow application1 = (UIWindow)it.next();
+      assertTrue(application1.isAdapted(ProtectedResource.class));
+      ProtectedResource application1PR = application1.adapt(ProtectedResource.class);
+      assertEquals(Collections.singletonList("application_1_access_permissions"), application1PR.getAccessPermissions());
       Attributes application1Attrs = application1.getAttributes();
       assertEquals("application_1_theme", application1Attrs.getString("theme"));
       assertEquals("application_1_title", application1Attrs.getString("title"));
-      assertEquals("application_1_access_permissions", application1Attrs.getString("access-permissions"));
       assertEquals(true, (boolean)application1Attrs.getBoolean("show-info-bar"));
       assertEquals(true, (boolean)application1Attrs.getBoolean("show-state"));
       assertEquals(true, (boolean)application1Attrs.getBoolean("show-mode"));

Modified: portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml
===================================================================
--- portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml	2010-02-08 17:32:04 UTC (rev 1560)
+++ portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/jcr/jcr-configuration.xml	2010-02-08 19:08:52 UTC (rev 1561)
@@ -95,6 +95,7 @@
  		    <properties-param>
  		      <name>namespaces</name>
  		      <property name="dc" value="http://purl.org/dc/elements/1.1/"/>
+ 		      <property name="gtn" value="http://www.gatein.org/jcr/gatein/1.0/"/>
  		      <property name="mop" value="http://www.gatein.org/jcr/mop/1.0/"/>
  		      <property name="app" value="http://www.gatein.org/jcr/application-registry/1.0/"/>
  		      <property name="lgn" value="http://www.gatein.org/jcr/autologin/1.0/"/>
@@ -112,6 +113,7 @@
  		      <description>Node types configuration file</description>
  		      <value>jar:/conf/ext-nodetypes-config.xml</value>
  		      <value>jar:/conf/organization-nodetypes.xml</value>
+ 		      <value>jar:/conf/gatein-nodetypes.xml</value>
  		      <value>jar:/conf/mop-nodetypes.xml</value>
  		      <value>jar:/conf/application-nodetypes.xml</value>
           <value>jar:/conf/content-nodetypes.xml</value>



More information about the gatein-commits mailing list