[gatein-commits] gatein SVN: r6180 - in portal/branches/site-describability/component/portal/src: main/java/org/exoplatform/portal/config/model and 4 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Fri Apr 8 03:24:46 EDT 2011


Author: ndkhoiits
Date: 2011-04-08 03:24:45 -0400 (Fri, 08 Apr 2011)
New Revision: 6180

Modified:
   portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
   portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
   portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
   portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
   portal/branches/site-describability/component/portal/src/main/resources/binding.xml
   portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
   portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
   portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml
Log:
GTNPORTAL-1854 Init for adding label and description field in PortalConfig

Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/NewPortalConfig.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -36,6 +36,10 @@
    private String templateName;
 
    private String location;
+   
+   private String label;
+   
+   private String description;
 
    /**
     * @deprecated use the location instead
@@ -52,10 +56,12 @@
       this.ownerType = cfg.ownerType;
       this.templateLocation = cfg.templateLocation;
       this.location = cfg.location;
+      this.label = cfg.label;
+      this.description = cfg.description;
       this.templateName = cfg.templateName;
       this.predefinedOwner = new HashSet<String>(cfg.predefinedOwner);
    }
-
+   
    public NewPortalConfig(String path)
    {
       this.location = path;
@@ -126,10 +132,30 @@
       this.ownerType = ownerType;
    }
 
+   public String getLabel()
+   {
+      return label;
+   }
+
+   public void setLabel(String label)
+   {
+      this.label = label;
+   }
+
+   public String getDescription()
+   {
+      return description;
+   }
+
+   public void setDescription(String description)
+   {
+      this.description = description;
+   }
+
    @Override
    public String toString()
    {
-      return "PortalConfig[predefinedOwner=" + predefinedOwner + ",ownerType=" + ownerType + ",templateName=" + templateName + 
-         "location=" + location + "]";
+      return "PortalConfig[predefinedOwner=" + predefinedOwner + ",ownerType=" + ownerType + ",templateName="
+         + templateName + ",label=" + label + ",description=" + description + ",location=" + location + "]";
    }
 }

Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/config/model/PortalConfig.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -50,6 +50,10 @@
 
    private String locale;
 
+   private String label;
+   
+   private String description;
+   
    private String[] accessPermissions;
 
    private String editPermission;
@@ -95,6 +99,8 @@
       this.name = data.getName();
       this.type = data.getType();
       this.locale = data.getLocale();
+      this.label = data.getLabel();
+      this.description = data.getDescription();
       this.accessPermissions = data.getAccessPermissions().toArray(new String[data.getAccessPermissions().size()]);
       this.editPermission = data.getEditPermission();
       this.properties = new Properties(data.getProperties());
@@ -238,6 +244,26 @@
       setProperty(PortalProperties.SESSION_ALIVE, type);
    }
 
+   public void setDescription(String description)
+   {
+      this.description = description;
+   }
+
+   public String getDescription()
+   {
+      return description;
+   }
+
+   public void setLabel(String label)
+   {
+      this.label = label;
+   }
+
+   public String getLabel()
+   {
+      return label;
+   }
+
    static public class PortalConfigSet
    {
       private ArrayList<PortalConfig> portalConfigs;
@@ -281,6 +307,8 @@
          name,
          type,
          locale,
+         label,
+         description,
          accessPermissions,
          editPermission,
          properties,

Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/Mapper.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -19,6 +19,8 @@
 
 package org.exoplatform.portal.pom.data;
 
+import javassist.runtime.Desc;
+
 import org.exoplatform.portal.config.NoSuchDataException;
 import org.exoplatform.portal.config.StaleModelException;
 import org.exoplatform.portal.config.UserACL;
@@ -312,6 +314,8 @@
          accessPermissions = pr.getAccessPermissions();
          editPermission = pr.getEditPermission();
       }
+      
+      Described described = src.adapt(Described.class);
 
       //
       return new PortalData(
@@ -319,6 +323,8 @@
          src.getName(),
          type,
          attrs.getValue(MappedAttributes.LOCALE),
+         described.getName(),
+         described.getDescription(),
          accessPermissions,
          editPermission,
          Collections.unmodifiableMap(properties),
@@ -348,6 +354,10 @@
       ProtectedResource pr = dst.adapt(ProtectedResource.class);
       pr.setAccessPermissions(src.getAccessPermissions());
       pr.setEditPermission(src.getEditPermission());
+      
+      Described described = dst.adapt(Described.class);
+      described.setName(src.getLabel());
+      described.setDescription(src.getDescription());
 
       //
       org.gatein.mop.api.workspace.Page templates = dst.getRootPage().getChild("templates");

Modified: portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java
===================================================================
--- portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/java/org/exoplatform/portal/pom/data/PortalData.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -48,12 +48,18 @@
 
    /** . */
    private final ContainerData portalLayout;
-
+   
+   private final String label;
+   
+   private final String description;
+   
    public PortalData(
       String storageId,
       String name,
       String type,
       String locale,
+      String label,
+      String description,
       List<String> accessPermissions,
       String editPermission,
       Map<String, String> properties,
@@ -65,6 +71,8 @@
       //
       this.key = new PortalKey(type, name);
       this.locale = locale;
+      this.label = label;
+      this.description = description;
       this.accessPermissions = accessPermissions;
       this.editPermission = editPermission;
       this.properties = properties;
@@ -116,4 +124,14 @@
    {
       return portalLayout;
    }
+
+   public String getDescription()
+   {
+      return description;
+   }
+
+   public String getLabel()
+   {
+      return label;
+   }
 }

Modified: portal/branches/site-describability/component/portal/src/main/resources/binding.xml
===================================================================
--- portal/branches/site-describability/component/portal/src/main/resources/binding.xml	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/main/resources/binding.xml	2011-04-08 07:24:45 UTC (rev 6180)
@@ -104,7 +104,9 @@
   
   <mapping name="portal-config" class="org.exoplatform.portal.config.model.PortalConfig" ordered="false">
     <value name="portal-name" field="name"/>
-    <value name="locale" field="locale"/>    
+    <value name="label" field="label" default="" />
+    <value name="description" field="description" default="" />
+    <value name="locale" field="locale" />
     <value name="access-permissions" field="accessPermissions" usage="optional"/>
     <value name="edit-permission" field="editPermission" usage="optional"/>
     <value name="skin" field="skin" usage="optional"/>

Modified: portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java
===================================================================
--- portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestDataStorage.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -117,10 +117,14 @@
 
    public void testCreatePortal() throws Exception
    {
+      String label = "portal_foo";
+      String description = "This is new portal for testing";
       PortalConfig portal = new PortalConfig();
       portal.setType("portal");
       portal.setName("foo");
       portal.setLocale("en");
+      portal.setLabel(label);
+      portal.setDescription(description);
       portal.setAccessPermissions(new String[]{UserACL.EVERYONE});
 
       //
@@ -130,6 +134,8 @@
       assertNotNull(portal);
       assertEquals("portal", portal.getType());
       assertEquals("foo", portal.getName());
+      assertEquals(label, portal.getLabel());
+      assertEquals(description, portal.getDescription());
    }
 
    public void testPortalConfigSave() throws Exception

Modified: portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java
===================================================================
--- portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/java/org/exoplatform/portal/config/TestSerialization.java	2011-04-08 07:24:45 UTC (rev 6180)
@@ -159,6 +159,8 @@
          "foo02",
          "foo03",
          "foo04",
+         "foo10",
+         "foo11",
          Arrays.asList("foo05"),
          "foo06",
          Collections.singletonMap("foo07", "foo08"),

Modified: portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml
===================================================================
--- portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml	2011-04-07 23:52:39 UTC (rev 6179)
+++ portal/branches/site-describability/component/portal/src/test/resources/portal/portal/classic/portal.xml	2011-04-08 07:24:45 UTC (rev 6180)
@@ -25,6 +25,8 @@
   <locale>en</locale>
   <access-permissions>Everyone</access-permissions>
   <edit-permission>*:/platform/administrators</edit-permission>
+  <label>Classic</label>
+  <description>This is classic portal for testing</description>
     
  	<portal-layout> 		
 		<application>



More information about the gatein-commits mailing list