View Javadoc

1   /**
2    * Copyright 2010-2013 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.common.util.config;
17  
18  import java.util.ArrayList;
19  import java.util.List;
20  
21  import javax.xml.bind.annotation.XmlAccessType;
22  import javax.xml.bind.annotation.XmlAccessorType;
23  import javax.xml.bind.annotation.XmlAttribute;
24  import javax.xml.bind.annotation.XmlElement;
25  import javax.xml.bind.annotation.XmlRootElement;
26  
27  import org.kuali.common.util.CollectionUtils;
28  
29  @XmlRootElement(name = "project")
30  @XmlAccessorType(XmlAccessType.PROPERTY)
31  public class ProjectConfigContainer {
32  
33  	String groupId;
34  	String artifactId;
35  	List<Location> locations = new ArrayList<Location>();
36  	List<ContextConfig> contexts = new ArrayList<ContextConfig>();
37  
38  	public ProjectConfigContainer() {
39  		super();
40  	}
41  
42  	public ProjectConfigContainer(String groupId, String artifactId) {
43  		super();
44  		this.groupId = groupId;
45  		this.artifactId = artifactId;
46  	}
47  
48  	public ProjectConfigContainer(ProjectConfigContainer config) {
49  		super();
50  		this.groupId = config.getGroupId();
51  		this.artifactId = config.getArtifactId();
52  		for (Location location : CollectionUtils.toEmptyList(config.getLocations())) {
53  			this.locations.add(new Location(location));
54  		}
55  		for (ContextConfig context : CollectionUtils.toEmptyList(config.getContexts())) {
56  			this.contexts.add(new ContextConfig(context));
57  		}
58  	}
59  
60  	@XmlAttribute
61  	public String getGroupId() {
62  		return groupId;
63  	}
64  
65  	@XmlAttribute
66  	public String getArtifactId() {
67  		return artifactId;
68  	}
69  
70  	@XmlElement(name = "location")
71  	public List<Location> getLocations() {
72  		return locations;
73  	}
74  
75  	@XmlElement(name = "context")
76  	public List<ContextConfig> getContexts() {
77  		return contexts;
78  	}
79  
80  	public void setGroupId(String groupId) {
81  		this.groupId = groupId;
82  	}
83  
84  	public void setArtifactId(String artifactId) {
85  		this.artifactId = artifactId;
86  	}
87  
88  	public void setLocations(List<Location> locations) {
89  		this.locations = locations;
90  	}
91  
92  	public void setContexts(List<ContextConfig> contexts) {
93  		this.contexts = contexts;
94  	}
95  
96  }