Coverage report

  %line %branch
org.apache.jetspeed.om.impl.DisplayNameImpl
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.impl;
 18  
 
 19  
 import java.util.Locale;
 20  
 
 21  
 import org.apache.jetspeed.util.JetspeedLocale;
 22  
 import org.apache.jetspeed.om.common.MutableDisplayName;
 23  
 
 24  
 /**
 25  
  * DisplayNameImpl
 26  
  * 
 27  
  * @author <a href="mailto:weaver@apache.org">Scott T. Weaver</a>
 28  
  * @version $Id: DisplayNameImpl.java 516448 2007-03-09 16:25:47Z ate $
 29  
  *
 30  
  */
 31  
 public abstract class DisplayNameImpl implements MutableDisplayName
 32  
 {
 33  
     private String displayName;
 34  
     private Locale locale;
 35  
 	/**
 36  
 	* Tells OJB which class to use to materialize.  
 37  
 	*/
 38  0
 	protected String ojbConcreteClass = DisplayNameImpl.class.getName();
 39  
 	
 40  
 	protected long parentId;
 41  
     
 42  
 	protected long id;
 43  
     
 44  
  
 45  
     public DisplayNameImpl()
 46  
     {
 47  0
         super();
 48  
         // always init to default locale
 49  0
         locale = JetspeedLocale.getDefaultLocale();
 50  0
     }
 51  
 
 52  
     /**
 53  
      * 
 54  
      * @param locale Locale of this DisaplyName.
 55  
      * @param name The actual text of the display name.
 56  
      */
 57  
     public DisplayNameImpl(Locale locale, String name)
 58  
     {
 59  0
         this();
 60  0
         this.locale = locale;
 61  0
         this.displayName = name;        
 62  0
     }
 63  
 
 64  
     /**
 65  
      * @see org.apache.pluto.om.common.DisplayName#getDisplayName()
 66  
      */
 67  
     public String getDisplayName()
 68  
     {
 69  0
         return displayName;
 70  
     }
 71  
 
 72  
     /**
 73  
      * @see org.apache.pluto.om.common.DisplayName#getLocale()
 74  
      */
 75  
     public Locale getLocale()
 76  
     {
 77  0
         return locale;
 78  
     }
 79  
 
 80  
     /**
 81  
      * @see org.apache.jetspeed.om.common.MutableDisplayName#setDisplayName(java.lang.String)
 82  
      */
 83  
     public void setDisplayName(String displayName)
 84  
     {
 85  0
         this.displayName = displayName;
 86  0
     }
 87  
 
 88  
     /**
 89  
      * @see org.apache.jetspeed.om.common.MutableDisplayName#setLocale(java.util.Locale)
 90  
      */
 91  
     public void setLocale(Locale locale)
 92  
     {
 93  0
         this.locale = locale;
 94  0
     }
 95  
 
 96  
     public void setLanguage(String lang)
 97  
     {
 98  0
         String[] localeArray = lang.split("[-|_]");
 99  0
         String country = "";
 100  0
         String variant = "";
 101  0
         for (int i = 0; i < localeArray.length; i++)
 102  
         {
 103  0
             if (i == 0)
 104  
             {
 105  0
                 lang = localeArray[i];
 106  
             }
 107  0
             else if (i == 1)
 108  
             {
 109  0
                 country = localeArray[i];
 110  
             }
 111  0
             else if (i == 2)
 112  
             {
 113  0
                 variant = localeArray[i];
 114  
             }
 115  
         }
 116  0
         this.locale = new Locale(lang, country, variant);
 117  0
     }
 118  
 
 119  
 }

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