Coverage Report - org.apache.maven.plugin.changes.Release
 
Classes in this File Line Coverage Branch Coverage Complexity
Release
41%
12/29
10%
1/10
1,545
 
 1  
 package org.apache.maven.plugin.changes;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.util.ArrayList;
 23  
 import java.util.List;
 24  
 import java.util.Iterator;
 25  
 
 26  
 /**
 27  
  * A release in a changes.xml file.
 28  
  *
 29  
  * @version $Id: org.apache.maven.plugin.changes.Release.html 816584 2012-05-08 12:33:35Z hboutemy $
 30  
  */
 31  
 public class Release
 32  
 {
 33  
     public static final String ADD_ACTION = "add";
 34  
 
 35  
     public static final String FIX_ACTION = "fix";
 36  
 
 37  
     public static final String UPDATE_ACTION = "update";
 38  
 
 39  
     public static final String REMOVE_ACTION = "remove";
 40  
 
 41  
 
 42  
     private List action;
 43  
 
 44  
     private String dateRelease;
 45  
 
 46  
     private String description;
 47  
 
 48  
     private String version;
 49  
 
 50  
     public Release()
 51  6
     {
 52  6
     }
 53  
 
 54  
     public void setAction( List action )
 55  
     {
 56  2
         this.action = action;
 57  2
     }
 58  
 
 59  
     public List getAction()
 60  
     {
 61  2
         if ( action == null )
 62  
         {
 63  0
             action = new ArrayList();
 64  
         }
 65  2
         return action;
 66  
     }
 67  
 
 68  
     public void addAction( Action act )
 69  
     {
 70  0
         if ( action == null )
 71  
         {
 72  0
             action = new ArrayList();
 73  
         }
 74  0
         action.add( act );
 75  0
     }
 76  
 
 77  
     public void setDateRelease( String dateRelease )
 78  
     {
 79  2
         this.dateRelease = dateRelease;
 80  2
     }
 81  
 
 82  
     public String getDateRelease()
 83  
     {
 84  2
         return dateRelease;
 85  
     }
 86  
 
 87  
     public void setDescription( String description )
 88  
     {
 89  0
         this.description = description;
 90  0
     }
 91  
 
 92  
     public String getDescription()
 93  
     {
 94  0
         return description;
 95  
     }
 96  
 
 97  
     public void setVersion( String version )
 98  
     {
 99  2
         this.version = version;
 100  2
     }
 101  
 
 102  
     public String getVersion()
 103  
     {
 104  2
         return version;
 105  
     }
 106  
 
 107  
     /**
 108  
      * Returns the actions for the specified type.
 109  
      *
 110  
      * @param actionType the action type
 111  
      * @return the actions with the specified type
 112  
      */
 113  
     public List getActions( final String actionType )
 114  
     {
 115  0
         final List result = new ArrayList();
 116  0
         if ( getAction() == null )
 117  
         {
 118  0
             return new ArrayList();
 119  
         }
 120  0
         final Iterator it = getAction().iterator();
 121  0
         while ( it.hasNext() )
 122  
         {
 123  0
             Action action = (Action) it.next();
 124  0
             if ( actionType.equals( action.getType() ) )
 125  
             {
 126  0
                 result.add( action );
 127  
             }
 128  
         }
 129  
 
 130  0
         return result;
 131  
     }
 132  
 }