jford       2005/04/02 09:31:08

  Modified:    src/java/org/apache/jetspeed/portal Portlet.java
                        BasePortletSet.java
               src/java/org/apache/jetspeed/portal/portlets
                        ContainerTestPortlet.java AbstractPortlet.java
               src/java/org/apache/jetspeed/portal/security/portlets
                        PortletWrapper.java
  Log:
  Added new setTitle method that takes a rundata parameter and modifies the 
current psml entry/profile
  
  PR: JS1-541
  
  Revision  Changes    Path
  1.49      +3 -2      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java
  
  Index: Portlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/Portlet.java,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Portlet.java      29 Mar 2004 21:38:42 -0000      1.48
  +++ Portlet.java      2 Apr 2005 17:31:08 -0000       1.49
  @@ -83,7 +83,8 @@
       /**
       Set the title for this Portlet
       */
  -    public void setTitle( String title );
  +    public void setTitle( String title);
  +    public void setTitle( String title, RunData runData );
   
       /**
       <p>
  
  
  
  1.37      +16 -3     
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java
  
  Index: BasePortletSet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/BasePortletSet.java,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -r1.36 -r1.37
  --- BasePortletSet.java       21 Mar 2005 18:21:41 -0000      1.36
  +++ BasePortletSet.java       2 Apr 2005 17:31:08 -0000       1.37
  @@ -22,6 +22,7 @@
   
   // Jetspeed stuff
   import org.apache.jetspeed.om.security.JetspeedUser;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.persistence.PersistenceManager;
  @@ -35,7 +36,6 @@
   import org.apache.jetspeed.util.MimeType;
   
   // turbine stuff
  -import org.apache.turbine.services.localization.Localization;
   import org.apache.turbine.util.RunData;
   
   // ECS stuff
  @@ -329,7 +329,7 @@
               {
                   this.portlets.clear();
               }
  -            return new StringElement(Localization.getString(rundata, 
"SECURITY_NO_ACCESS"));
  +            return new 
StringElement(CustomLocalization.getString("SECURITY_NO_ACCESS", rundata));
           }
           else
           {
  @@ -535,6 +535,19 @@
   
           meta.setTitle(title);
       }
  +    
  +    public void setTitle( String title, RunData rundata ) {
  +     setTitle(title);
  +     
  +     PortletInstance instance = PersistenceManager.getInstance(this, 
rundata);
  +     instance.getEntry().setTitle(title);
  +     
  +        try {
  +             PersistenceManager.store(instance);
  +             } catch (PortalPersistenceException e) {
  +                     logger.error("Exception occurred", e);
  +             }
  +    }
   
       /**
       */
  
  
  
  1.10      +8 -1      
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java
  
  Index: ContainerTestPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/ContainerTestPortlet.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ContainerTestPortlet.java 29 Mar 2004 21:38:42 -0000      1.9
  +++ ContainerTestPortlet.java 2 Apr 2005 17:31:08 -0000       1.10
  @@ -434,6 +434,13 @@
       {
           return true;
       }
  +
  +     /**
  +      * @see org.apache.jetspeed.portal.Portlet#setTitle(java.lang.String, 
org.apache.turbine.util.RunData)
  +      */
  +     public void setTitle(String title, RunData runData)
  +     {
  +     }
       
   
   }
  
  
  
  1.67      +32 -20    
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java
  
  Index: AbstractPortlet.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/AbstractPortlet.java,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -u -r1.66 -r1.67
  --- AbstractPortlet.java      21 Mar 2005 18:21:43 -0000      1.66
  +++ AbstractPortlet.java      2 Apr 2005 17:31:08 -0000       1.67
  @@ -17,40 +17,35 @@
   package org.apache.jetspeed.portal.portlets;
   
   //jetspeed
  +import java.util.Hashtable;
  +import java.util.Iterator;
  +
  +import org.apache.ecs.ConcreteElement;
   import org.apache.jetspeed.capability.CapabilityMap;
   import org.apache.jetspeed.capability.CapabilityMapFactory;
   import org.apache.jetspeed.om.registry.MediaTypeEntry;
   import org.apache.jetspeed.om.registry.PortletEntry;
   import org.apache.jetspeed.portal.BasePortletConfig;
  -import org.apache.jetspeed.portal.expire.Expire;
  -import org.apache.jetspeed.portal.expire.ExpireFactory;
   import org.apache.jetspeed.portal.Portlet;
   import org.apache.jetspeed.portal.PortletConfig;
   import org.apache.jetspeed.portal.PortletException;
  -import org.apache.jetspeed.portal.PortletState;
  -import org.apache.jetspeed.services.persistence.PersistenceManager;
  -import org.apache.jetspeed.services.persistence.PortalPersistenceException;
   import org.apache.jetspeed.portal.PortletInstance;
  -import org.apache.jetspeed.services.portletcache.Cacheable;
  +import org.apache.jetspeed.portal.PortletState;
  +import org.apache.jetspeed.portal.expire.Expire;
  +import org.apache.jetspeed.portal.expire.ExpireFactory;
   import org.apache.jetspeed.services.Registry;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
  +import org.apache.jetspeed.services.persistence.PersistenceManager;
  +import org.apache.jetspeed.services.persistence.PortalPersistenceException;
  +import org.apache.jetspeed.services.portletcache.Cacheable;
  +import org.apache.jetspeed.util.JetspeedClearElement;
   import org.apache.jetspeed.util.JetspeedException;
   import org.apache.jetspeed.util.MetaData;
   import org.apache.jetspeed.util.MimeType;
  -
  -//ecs
  -import org.apache.jetspeed.util.JetspeedClearElement;
  -import org.apache.ecs.ConcreteElement;
  -
  -//turbine stuff
   import org.apache.turbine.services.cache.CachedObject;
   import org.apache.turbine.services.cache.Refreshable;
   import org.apache.turbine.util.RunData;
  -
  -//java stuff
  -import java.util.Hashtable;
  -import java.util.Iterator;
   /**
   <p>
   Should be used by most Portlets that wish to conform to default behavior
  @@ -511,21 +506,38 @@
        * Set the title for this Portlet.
        * @param title Portlet title.
        */
  -    public void setTitle( String title ) {
  +    public void setTitle(String title)
  +    {
  +
           PortletConfig pc = getPortletConfig();
  -        if (pc==null) {
  +        if (pc == null)
  +        {
               pc = new BasePortletConfig();
               setPortletConfig(pc);
           }
   
           MetaData meta = pc.getMetainfo();
  -        if (meta==null) {
  +        if (meta == null)
  +        {
               meta = new MetaData();
               pc.setMetainfo(meta);
           }
   
           meta.setTitle(title);
       }
  +    
  +    public void setTitle( String title, RunData rundata ) {
  +     setTitle(title);
  +     
  +     PortletInstance instance = PersistenceManager.getInstance(this, 
rundata);
  +     instance.getEntry().setTitle(title);
  +     
  +        try {
  +             PersistenceManager.store(instance);
  +             } catch (PortalPersistenceException e) {
  +                     logger.error("Exception occurred", e);
  +             }
  +    }
   
   
       /**
  
  
  
  1.26      +14 -3     
jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java
  
  Index: PortletWrapper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/security/portlets/PortletWrapper.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- PortletWrapper.java       29 Mar 2004 21:38:43 -0000      1.25
  +++ PortletWrapper.java       2 Apr 2005 17:31:08 -0000       1.26
  @@ -23,6 +23,7 @@
   import org.apache.jetspeed.portal.PortletConfig;
   import org.apache.jetspeed.portal.PortletException;
   import org.apache.jetspeed.portal.PortletInstance;
  +import org.apache.jetspeed.services.customlocalization.CustomLocalization;
   import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
   import org.apache.jetspeed.services.logging.JetspeedLogger;
   import org.apache.jetspeed.services.portletcache.Cacheable;
  @@ -35,7 +36,6 @@
   
   // Turbine imports
   import org.apache.turbine.util.RunData;
  -import org.apache.turbine.services.localization.Localization;
   
   // ECS
   import org.apache.ecs.ConcreteElement;
  @@ -127,7 +127,7 @@
               {
                   PortletStats.logAccess(rundata, this, 
PortletStats.ACCESS_DENIED);
               }
  -            return new JetspeedClearElement(Localization.getString(rundata, 
"SECURITY_NO_ACCESS_TO_PORTLET"));
  +            return new 
JetspeedClearElement(CustomLocalization.getString("SECURITY_NO_ACCESS_TO_PORTLET",
 rundata));
           }
       }
   
  @@ -200,6 +200,17 @@
           wrappedPortlet.setTitle(title);
           /* } */
       }
  +    
  +    /**
  +    Set the title for this Portlet
  +    */
  +    public void setTitle(String title, RunData runData)
  +    {
  +        if( !checkPermission(runData, JetspeedSecurity.PERMISSION_CUSTOMIZE 
) )
  +        {
  +             wrappedPortlet.setTitle(title, runData);
  +        }
  +    }
   
   
       /**
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to