Coverage report

  %line %branch
org.apache.jetspeed.om.folder.psml.MenuDefinitionImpl
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.om.folder.psml;
 18  
 
 19  
 import java.util.ArrayList;
 20  
 import java.util.Iterator;
 21  
 import java.util.List;
 22  
 
 23  
 import org.apache.jetspeed.om.folder.MenuDefinition;
 24  
 
 25  
 /**
 26  
  * This class implements the MenuDefinition
 27  
  * interface in a persistent object form for use by
 28  
  * the page manager component.
 29  
  * 
 30  
  * @author <a href="mailto:rwatler@apache.org">Randy Watler</a>
 31  
  * @version $Id: MenuDefinitionImpl.java 516448 2007-03-09 16:25:47Z ate $
 32  
  */
 33  
 public class MenuDefinitionImpl extends MenuMetadataImpl implements MenuDefinition
 34  
 {
 35  
     /**
 36  
      * name - name of menu definition
 37  
      */
 38  
     private String name;
 39  
 
 40  
     /**
 41  
      * options - comma separated option paths specification for menu
 42  
      */
 43  
     private String options;
 44  
 
 45  
     /**
 46  
      * depth - depth of inclusion for folder options
 47  
      */
 48  
     private int depth;
 49  
 
 50  
     /**
 51  
      * paths - generate ordered path options for options
 52  
      */
 53  
     private boolean paths;
 54  
 
 55  
     /**
 56  
      * regexp - interpret specified optionsas regexp
 57  
      */
 58  
     private boolean regexp;
 59  
 
 60  
     /**
 61  
      * profile - profile locator name filter for options
 62  
      */
 63  
     private String profile;
 64  
     
 65  
     /**
 66  
      * order - comma separated list of ordering patterns for options
 67  
      */
 68  
     private String order;
 69  
     
 70  
     /**
 71  
      * skin - skin name for menu
 72  
      */
 73  
     private String skin;
 74  
     
 75  
     /**
 76  
      * title - title for menu
 77  
      */
 78  
     private String title;
 79  
 
 80  
     /**
 81  
      * shortTitle - short title for menu
 82  
      */
 83  
     private String shortTitle;
 84  
 
 85  
     /**
 86  
      * menuElements - ordered polymorphic list of menu options nested
 87  
      *                menu, separator, include, and exclude definitions
 88  
      */
 89  
     private List menuElements;
 90  
 
 91  
     /**
 92  
      * menuElementImpls - ordered homogeneous list of menu elements
 93  
      */
 94  
     private List menuElementImpls;
 95  
 
 96  
     /**
 97  
      * MenuDefinitionImpl - constructor
 98  
      */
 99  
     public MenuDefinitionImpl()
 100  0
     {
 101  0
     }
 102  
 
 103  
     /**
 104  
      * getName - get menu name
 105  
      *
 106  
      * @return menu name
 107  
      */
 108  
     public String getName()
 109  
     {
 110  0
         return name;
 111  
     }
 112  
 
 113  
     /**
 114  
      * setName - set menu name
 115  
      *
 116  
      * @param name menu name
 117  
      */
 118  
     public void setName(String name)
 119  
     {
 120  0
         this.name = name;
 121  0
     }
 122  
 
 123  
     /**
 124  
      * getOptions - get comma separated menu options if not specified as elements
 125  
      *
 126  
      * @return option paths specification
 127  
      */
 128  
     public String getOptions()
 129  
     {
 130  0
         return options;
 131  
     }
 132  
 
 133  
     /**
 134  
      * setOptions - set comma separated menu options if not specified as elements
 135  
      *
 136  
      * @param options option paths specification
 137  
      */
 138  
     public void setOptions(String options)
 139  
     {
 140  0
         this.options = options;
 141  0
     }
 142  
 
 143  
     /**
 144  
      * getDepth - get depth of inclusion for folder menu options
 145  
      *
 146  
      * @return inclusion depth
 147  
      */
 148  
     public int getDepth()
 149  
     {
 150  0
         return depth;
 151  
     }
 152  
 
 153  
     /**
 154  
      * setDepth - set depth of inclusion for folder menu options
 155  
      *
 156  
      * @param depth inclusion depth
 157  
      */
 158  
     public void setDepth(int depth)
 159  
     {
 160  0
         this.depth = depth;
 161  0
     }
 162  
 
 163  
     /**
 164  
      * isPaths - get generate ordered path options for specified options
 165  
      *
 166  
      * @return paths options flag
 167  
      */
 168  
     public boolean isPaths()
 169  
     {
 170  0
         return paths;
 171  
     }
 172  
     
 173  
     /**
 174  
      * setPaths - set generate ordered path options for specified options
 175  
      *
 176  
      * @param paths paths options flag
 177  
      */
 178  
     public void setPaths(boolean paths)
 179  
     {
 180  0
         this.paths = paths;
 181  0
     }
 182  
     
 183  
     /**
 184  
      * isRegexp - get regexp flag for interpreting specified options
 185  
      *
 186  
      * @return regexp flag
 187  
      */
 188  
     public boolean isRegexp()
 189  
     {
 190  0
         return regexp;
 191  
     }
 192  
 
 193  
     /**
 194  
      * setRegexp - set regexp flag for interpreting specified options
 195  
      *
 196  
      * @param regexp regexp flag
 197  
      */
 198  
     public void setRegexp(boolean regexp)
 199  
     {
 200  0
         this.regexp = regexp;
 201  0
     }
 202  
 
 203  
     /**
 204  
      * getProfile - get profile locator used to filter specified options
 205  
      *
 206  
      * @return profile locator name
 207  
      */
 208  
     public String getProfile()
 209  
     {
 210  0
         return profile;
 211  
     }
 212  
 
 213  
     /**
 214  
      * setProfile - set profile locator used to filter specified options
 215  
      *
 216  
      * @param locatorName profile locator name
 217  
      */
 218  
     public void setProfile(String locatorName)
 219  
     {
 220  0
         profile = locatorName;
 221  0
     }
 222  
 
 223  
     /**
 224  
      * getOrder - get comma separated regexp ordering patterns for options
 225  
      *
 226  
      * @return ordering patterns list
 227  
      */
 228  
     public String getOrder()
 229  
     {
 230  0
         return order;
 231  
     }
 232  
 
 233  
     /**
 234  
      * setOrder - set comma separated regexp ordering patterns for options
 235  
      *
 236  
      * @param order ordering patterns list
 237  
      */
 238  
     public void setOrder(String order)
 239  
     {
 240  0
         this.order = order;
 241  0
     }
 242  
 
 243  
     /**
 244  
      * getSkin - get skin name for menu
 245  
      *
 246  
      * @return skin name
 247  
      */
 248  
     public String getSkin()
 249  
     {
 250  0
         return skin;
 251  
     }
 252  
 
 253  
     /**
 254  
      * setSkin - set skin name for menu
 255  
      *
 256  
      * @param name skin name
 257  
      */
 258  
     public void setSkin(String name)
 259  
     {
 260  0
         skin = name;
 261  0
     }
 262  
 
 263  
     /**
 264  
      * getTitle - get default title for menu
 265  
      *
 266  
      * @return title text
 267  
      */
 268  
     public String getTitle()
 269  
     {
 270  0
         return title;
 271  
     }
 272  
 
 273  
     /**
 274  
      * setTitle - set default title for menu
 275  
      *
 276  
      * @param title title text
 277  
      */
 278  
     public void setTitle(String title)
 279  
     {
 280  0
         this.title = title;
 281  0
     }
 282  
 
 283  
     /**
 284  
      * getShortTitle - get default short title for menu
 285  
      *
 286  
      * @return short title text
 287  
      */
 288  
     public String getShortTitle()
 289  
     {
 290  0
         return shortTitle; 
 291  
     }
 292  
 
 293  
     /**
 294  
      * setShortTitle - set default short title for menu
 295  
      *
 296  
      * @param title short title text
 297  
      */
 298  
     public void setShortTitle(String title)
 299  
     {
 300  0
         this.shortTitle = title;
 301  0
     }
 302  
 
 303  
     /**
 304  
      * getMenuElements - get ordered list of menu options,
 305  
      *                   nested menus, separators, included
 306  
      *                   menu, and excluded menu elements
 307  
      *
 308  
      * @return element list
 309  
      */
 310  
     public List getMenuElements()
 311  
     {
 312  0
         return menuElements;
 313  
     }
 314  
 
 315  
     /**
 316  
      * setMenuElements - set ordered list of menu elements
 317  
      *
 318  
      * @param elements element list
 319  
      */
 320  
     public void setMenuElements(List elements)
 321  
     {
 322  0
         menuElements = elements;
 323  0
     }
 324  
 
 325  
     /**
 326  
      * getMenuElementImpls - get ordered list of wrapped menu elements
 327  
      *
 328  
      * @return element list
 329  
      */
 330  
     public List getMenuElementImpls()
 331  
     {
 332  0
         return menuElementImpls;
 333  
     }
 334  
 
 335  
     /**
 336  
      * setMenuElementImpls - set ordered list of menu elements using
 337  
      *                       a list of wrapped menu elements
 338  
      *
 339  
      * @param elements element list
 340  
      */
 341  
     public void setMenuElementImpls(List elements)
 342  
     {
 343  0
         menuElementImpls = elements;
 344  0
     }
 345  
 
 346  
     /**
 347  
      * unmarshalled - notification that this instance has been
 348  
      *                loaded from the persistent store
 349  
      */
 350  
     public void unmarshalled()
 351  
     {
 352  
         // notify super class implementation
 353  0
         super.unmarshalled();
 354  
 
 355  
         // unwrap menu elements and propagate
 356  
         // unmarshalled notification
 357  0
         if (menuElementImpls != null)
 358  
         {
 359  0
             menuElements = new ArrayList(menuElementImpls.size());
 360  0
             Iterator menuElementIter = menuElementImpls.iterator();
 361  0
             while (menuElementIter.hasNext())
 362  
             {
 363  
                 // unwrap menu element
 364  0
                 Object menuElement = ((MenuElementImpl)menuElementIter.next()).getElement();
 365  0
                 menuElements.add(menuElement);
 366  
 
 367  
                 // propagate unmarshalled notification
 368  0
                 if (menuElement instanceof MenuMetadataImpl)
 369  
                 {
 370  0
                     ((MenuMetadataImpl)menuElement).unmarshalled();
 371  
                 }
 372  0
             }
 373  0
         }
 374  
         else
 375  
         {
 376  0
             menuElements = null;            
 377  
         }
 378  0
     }
 379  
 
 380  
     /**
 381  
      * marshalling - notification that this instance is to
 382  
      *               be saved to the persistent store
 383  
      */
 384  
     public void marshalling()
 385  
     {
 386  
         // wrap menu elements and propagate
 387  
         // marshalling notification
 388  0
         if (menuElements != null)
 389  
         {
 390  0
             menuElementImpls = new ArrayList(menuElements.size());
 391  0
             Iterator menuElementIter = menuElements.iterator();
 392  0
             while (menuElementIter.hasNext())
 393  
             {
 394  
                 // wrap menu element
 395  0
                 Object menuElement = menuElementIter.next();
 396  0
                 menuElementImpls.add(new MenuElementImpl(menuElement));
 397  
 
 398  
                 // propagate marshalling notification
 399  0
                 if (menuElement instanceof MenuDefinitionImpl)
 400  
                 {
 401  0
                     ((MenuDefinitionImpl)menuElement).unmarshalled();
 402  
                 }
 403  0
             }
 404  0
         }
 405  
         else
 406  
         {
 407  0
             menuElementImpls = null;            
 408  
         }
 409  0
     }
 410  
 }

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