001/**
002 * Copyright 2010-2014 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.common.util.config;
017
018import java.util.ArrayList;
019import java.util.List;
020
021import javax.xml.bind.annotation.XmlAccessType;
022import javax.xml.bind.annotation.XmlAccessorType;
023import javax.xml.bind.annotation.XmlAttribute;
024import javax.xml.bind.annotation.XmlElement;
025import javax.xml.bind.annotation.XmlRootElement;
026
027import org.kuali.common.util.CollectionUtils;
028
029/**
030 * @deprecated
031 */
032@Deprecated
033@XmlRootElement
034@XmlAccessorType(XmlAccessType.PROPERTY)
035public class ContextConfig {
036
037        String id;
038        List<Location> locations = new ArrayList<Location>();
039        List<ContextConfig> contexts = new ArrayList<ContextConfig>();
040
041        public ContextConfig(ContextConfig config) {
042                super();
043                this.id = config.getId();
044                for (Location location : CollectionUtils.toEmptyList(config.getLocations())) {
045                        this.locations.add(new Location(location));
046                }
047                for (ContextConfig child : CollectionUtils.toEmptyList(config.getContexts())) {
048                        this.contexts.add(new ContextConfig(child));
049                }
050        }
051
052        public ContextConfig() {
053                this((String) null);
054        }
055
056        public ContextConfig(String name) {
057                this(name, null);
058        }
059
060        public ContextConfig(String name, List<Location> locations) {
061                super();
062                this.id = name;
063                this.locations = locations;
064        }
065
066        @XmlAttribute
067        public String getId() {
068                return id;
069        }
070
071        @XmlElement(name = "location")
072        public List<Location> getLocations() {
073                return locations;
074        }
075
076        @XmlElement(name = "context")
077        public List<ContextConfig> getContexts() {
078                return contexts;
079        }
080
081        public void setLocations(List<Location> locations) {
082                this.locations = locations;
083        }
084
085        public void setContexts(List<ContextConfig> children) {
086                this.contexts = children;
087        }
088
089        public void setId(String name) {
090                this.id = name;
091        }
092
093}