Coverage report

  %line %branch
org.apache.jetspeed.layout.impl.GetThemesAction
0% 
0% 

 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one or more
 3  
  * contributor license agreements.  See the NOTICE file distributed with
 4  
  * this work for additional information regarding copyright ownership.
 5  
  * The ASF licenses this file to You under the Apache License, Version 2.0
 6  
  * (the "License"); you may not use this file except in compliance with
 7  
  * the License.  You may obtain a copy of the License at
 8  
  * 
 9  
  *      http://www.apache.org/licenses/LICENSE-2.0
 10  
  * 
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 16  
  */
 17  
 package org.apache.jetspeed.layout.impl;
 18  
 
 19  
 import java.util.Map;
 20  
 
 21  
 import org.apache.commons.logging.Log;
 22  
 import org.apache.commons.logging.LogFactory;
 23  
 import org.apache.jetspeed.JetspeedActions;
 24  
 import org.apache.jetspeed.ajax.AjaxAction;
 25  
 import org.apache.jetspeed.ajax.AjaxBuilder;
 26  
 import org.apache.jetspeed.decoration.DecorationFactory;
 27  
 import org.apache.jetspeed.layout.PortletActionSecurityBehavior;
 28  
 import org.apache.jetspeed.request.RequestContext;
 29  
 
 30  
 /**
 31  
  * Get Portal-wide themes lists 
 32  
  * (page decorators, portlet decorators, layouts, desktop-page-decorators, desktop-portlet-decorators)
 33  
  *
 34  
  * AJAX Parameters: 
 35  
  *    none 
 36  
  *    
 37  
  * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
 38  
  * @version $Id: $
 39  
  */
 40  
 public class GetThemesAction 
 41  
     extends BasePortletAction 
 42  
     implements AjaxAction, AjaxBuilder, Constants
 43  
 {
 44  0
     protected static final Log log = LogFactory.getLog(GetThemesAction.class);
 45  
     protected DecorationFactory decorationFactory;
 46  
     
 47  
     public GetThemesAction(String template, 
 48  
                            String errorTemplate,
 49  
                            DecorationFactory decorationFactory,
 50  
                            PortletActionSecurityBehavior securityBehavior)
 51  
     {
 52  0
         super(template, errorTemplate, securityBehavior);
 53  0
         this.decorationFactory = decorationFactory;
 54  0
     }
 55  
 
 56  
     public boolean run( RequestContext requestContext, Map resultMap )
 57  
     {
 58  0
         boolean success = true;
 59  0
         String status = "success";
 60  
         try
 61  
         {
 62  0
             resultMap.put( ACTION, "getthemes" );
 63  0
             if (false == checkAccess( requestContext, JetspeedActions.VIEW ) )
 64  
             {
 65  0
                     success = false;
 66  0
                     resultMap.put( REASON, "Insufficient access to get themes" );
 67  0
                     return success;
 68  
             }                     
 69  0
             String type = getActionParameter(requestContext, TYPE );
 70  0
             String format = getActionParameter(requestContext, FORMAT );
 71  0
             if (format == null)
 72  0
                 format = "xml";
 73  0
             if (type == null || type.equals( PAGE_DECORATIONS ) )
 74  0
                 resultMap.put( PAGE_DECORATIONS, decorationFactory.getPageDecorations( requestContext ) );
 75  0
             if (type == null || type.equals( PORTLET_DECORATIONS ) )
 76  0
                 resultMap.put( PORTLET_DECORATIONS, decorationFactory.getPortletDecorations( requestContext ) );
 77  0
             if (type == null || type.equals( LAYOUTS ) )
 78  0
                 resultMap.put( LAYOUTS, decorationFactory.getLayouts( requestContext ) );
 79  0
             if (type == null || type.equals( DESKTOP_PAGE_DECORATIONS) )
 80  0
                 resultMap.put( DESKTOP_PAGE_DECORATIONS, decorationFactory.getDesktopPageDecorations( requestContext ) );
 81  0
             if (type == null || type.equals( DESKTOP_PORTLET_DECORATIONS ) )
 82  0
                 resultMap.put( DESKTOP_PORTLET_DECORATIONS, decorationFactory.getDesktopPortletDecorations( requestContext ) );
 83  0
             resultMap.put( TYPE, type );
 84  0
             resultMap.put( FORMAT, format );
 85  0
             resultMap.put( STATUS, status );
 86  
         } 
 87  0
         catch (Exception e)
 88  
         {
 89  
             // Log the exception
 90  0
             log.error( "exception while getting theme info", e );
 91  
             // Return a failure indicator
 92  0
             success = false;
 93  0
         }
 94  
 
 95  0
         return success;
 96  
 	}
 97  
     
 98  
     
 99  
 }

This report is generated by jcoverage, Maven and Maven JCoverage Plugin.