1 package org.codehaus.mojo.dashboard.report.plugin.configuration;
2
3 /*
4 * Copyright 2007 David Vicente
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 import java.util.ArrayList;
20 import java.util.Hashtable;
21 import java.util.Iterator;
22 import java.util.List;
23 import java.util.Map;
24
25 /**
26 * @author <a href="dvicente72@gmail.com">David Vicente</a>
27 *
28 */
29 public class Configuration
30 {
31 private String version;
32
33 private List sections = new ArrayList();
34
35 private Map map = new Hashtable();
36
37 public Configuration()
38 {
39
40 }
41
42 public String getVersion()
43 {
44 return version;
45 }
46
47 public List getSections()
48 {
49 return sections;
50 }
51
52 public void setSections( List sections )
53 {
54 this.sections = sections;
55 }
56
57 public Section getSectionById( String artifactId)
58 {
59 if( map == null || map.isEmpty() )
60 {
61 map = new Hashtable();
62
63 Iterator iter = this.sections.iterator();
64
65 while ( iter.hasNext() )
66 {
67 Section section = (Section) iter.next();
68 map.put( section.getId(), section );
69 }
70 }
71 return (Section) map.get( artifactId );
72 }
73
74 }