Update of 
/var/cvs/contributions/CMSContainer_Portlets/portlets-preferences/src/java/com/finalist/portlets/preferences
In directory 
james.mmbase.org:/tmp/cvs-serv32496/portlets-preferences/src/java/com/finalist/portlets/preferences

Modified Files:
      Tag: b1_5
        ProfilePortlet.java 
Log Message:
CMSC-950 - Fixed wrong JSP includes and corrected words; removed dependencies. 
Cleaned code.


See also: 
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Portlets/portlets-preferences/src/java/com/finalist/portlets/preferences
See also: http://www.mmbase.org/jira/browse/CMSC-950


Index: ProfilePortlet.java
===================================================================
RCS file: 
/var/cvs/contributions/CMSContainer_Portlets/portlets-preferences/src/java/com/finalist/portlets/preferences/ProfilePortlet.java,v
retrieving revision 1.1
retrieving revision 1.1.2.1
diff -u -b -r1.1 -r1.1.2.1
--- ProfilePortlet.java 17 Jun 2008 11:42:58 -0000      1.1
+++ ProfilePortlet.java 27 Nov 2008 14:28:29 -0000      1.1.2.1
@@ -2,7 +2,6 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Set;
@@ -14,8 +13,6 @@
 import javax.portlet.RenderResponse;
 
 import org.apache.commons.lang.StringUtils;
-import org.mmbase.util.logging.Logger;
-import org.mmbase.util.logging.Logging;
 
 import com.finalist.cmsc.portlets.CmscPortlet;
 import com.finalist.cmsc.services.community.domain.PreferenceVO;
@@ -24,15 +21,15 @@
 
 public class ProfilePortlet extends CmscPortlet {
    
-   private static Logger log = 
Logging.getLoggerInstance(ProfilePortlet.class.getName());
-  
    public static final String PREFERENCES_TYPE = "perference";
    
-  enum PREFERENCETYPE {profile,preference};
+   enum PREFERENCETYPE {
+      profile, preference
+   };
    
    @Override
    protected void doEditDefaults(RenderRequest request, RenderResponse 
response) throws IOException, PortletException {
-     doView(request, response);//doEditDefaults(request, response);
+      doView(request, response);// doEditDefaults(request, response);
    }
    
    @SuppressWarnings("unchecked")
@@ -52,12 +49,12 @@
       request.setAttribute("profile", profile);
       doInclude("view", "/community/profile/user.jsp", request, response);
 
-      Set<String> webInfResources = 
getPortletContext().getResourcePaths(getAggregationDir()+"view/community/preferences");
 
+      Set<String> webInfResources = 
getPortletContext().getResourcePaths(getAggregationDir() + 
"view/community/preferences");
       List<String> formUrls = new ArrayList<String>();
-      if(webInfResources != null) {
-         for(String resource :webInfResources) {
-            if(resource.lastIndexOf("/") > 0) {
-               resource = 
"preferences"+resource.substring(resource.lastIndexOf("/"));
+      if (webInfResources != null) {
+         for (String resource : webInfResources) {
+            if (resource.lastIndexOf("/") > 0) {
+               resource = "preferences" + 
resource.substring(resource.lastIndexOf("/"));
                formUrls.add(resource);
             }
          }
@@ -70,13 +67,12 @@
 
    }
 
-   @SuppressWarnings("unchecked")
    @Override
    public void processView(ActionRequest request, ActionResponse response) 
throws PortletException, IOException {
       String preferenceType = request.getParameter("action");
-      if(StringUtils.isNotEmpty(preferenceType)) {
-         
if(preferenceType.equalsIgnoreCase(PREFERENCETYPE.profile.toString())) {
-            StringBuffer bf= new StringBuffer(); 
+      if (StringUtils.isNotEmpty(preferenceType)) {
+         if 
(preferenceType.equalsIgnoreCase(PREFERENCETYPE.profile.toString())) {
+            StringBuffer bf = new StringBuffer();
             UserProfile profile = new UserProfile();            
             profile.setFirstName(request.getParameter("firstName"));
             profile.setAccount(request.getParameter("account"));
@@ -86,7 +82,7 @@
             profile.setPasswordText(request.getParameter("passwordText"));
             
profile.setPasswordConfirmation(request.getParameter("passwordConfirmation"));
             profile.setEmail(request.getParameter("email"));   
-            if(StringUtils.isBlank(profile.getEmail())) {
+            if (StringUtils.isBlank(profile.getEmail())) {
                bf.append("community.profile.email.empty,");
             }
             else if(!ProfileUtil.isEmail(profile.getEmail())) {
@@ -97,9 +93,9 @@
                   bf.append("community.profile.password.not_equal");
                }
             }
-            if(bf.length()  > 0) { 
+            if (bf.length() > 0) {
                String errorKeys = bf.toString();
-               response.setRenderParameter("errors",  
errorKeys.endsWith(",")?errorKeys.substring(0,errorKeys.length()-1):errorKeys);
+               response.setRenderParameter("errors", errorKeys.endsWith(",") ? 
errorKeys.substring(0, errorKeys.length() - 1) : errorKeys);
             }
             else {
                ProfileUtil.updateUserProfile(profile);
@@ -123,18 +119,18 @@
    } 
    
    @SuppressWarnings("unchecked")
-   private  List<PreferenceVO> getPreferences(ActionRequest request){
+   private List<PreferenceVO> getPreferences(ActionRequest request) {
       Enumeration<String> parameterNames = request.getParameterNames();
       List<PreferenceVO> preferences = new ArrayList<PreferenceVO>();
-      while(parameterNames.hasMoreElements()){
+      while (parameterNames.hasMoreElements()) {
          String key = parameterNames.nextElement();
          int index = key.indexOf("_key_");
-         if(index > 0){
-            String module = key.substring(0,index);
+         if (index > 0) {
+            String module = key.substring(0, index);
             PreferenceVO preference = new PreferenceVO();
             preference.setModule(module);
             preference.setKey(request.getParameter(key));
-            
preference.setValue(request.getParameter(module+"_value_"+key.substring(index+5)));
+            preference.setValue(request.getParameter(module + "_value_" + 
key.substring(index + 5)));
             
preference.setAuthenticationId(ProfileUtil.getCurrentUserId().toString());
             preferences.add(preference);
          }
_______________________________________________
Cvs mailing list
Cvs@lists.mmbase.org
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to