View Javadoc

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: 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      {
52      }
53  
54      public void setAction( List action )
55      {
56          this.action = action;
57      }
58  
59      public List getAction()
60      {
61          if ( action == null )
62          {
63              action = new ArrayList();
64          }
65          return action;
66      }
67  
68      public void addAction( Action act )
69      {
70          if ( action == null )
71          {
72              action = new ArrayList();
73          }
74          action.add( act );
75      }
76  
77      public void setDateRelease( String dateRelease )
78      {
79          this.dateRelease = dateRelease;
80      }
81  
82      public String getDateRelease()
83      {
84          return dateRelease;
85      }
86  
87      public void setDescription( String description )
88      {
89          this.description = description;
90      }
91  
92      public String getDescription()
93      {
94          return description;
95      }
96  
97      public void setVersion( String version )
98      {
99          this.version = version;
100     }
101 
102     public String getVersion()
103     {
104         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         final List result = new ArrayList();
116         if ( getAction() == null )
117         {
118             return new ArrayList();
119         }
120         final Iterator it = getAction().iterator();
121         while ( it.hasNext() )
122         {
123             Action action = (Action) it.next();
124             if ( actionType.equals( action.getType() ) )
125             {
126                 result.add( action );
127             }
128         }
129 
130         return result;
131     }
132 }