View Javadoc

1   /**
2    * Copyright 2011 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10   * software distributed under the License is distributed on an "AS IS"
11   * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing
13   * permissions and limitations under the License.
14   */
15  
16  package org.kuali.common.impex.model;
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  
26  import org.kuali.common.util.CollectionUtils;
27  
28  /**
29   * This class represents any named connection between columns
30   */
31  @XmlAccessorType(XmlAccessType.PROPERTY)
32  public abstract class Constraint implements NamedElement {
33  
34  	String name;
35  	List<String> columnNames = new ArrayList<String>();
36  
37  	/**
38  	 * This is a copy constructor. It must create a perfect, deep, copy of this object
39  	 */
40  	public Constraint(Constraint constraint) {
41  		this.name = constraint.getName();
42  		this.columnNames = new ArrayList<String>(CollectionUtils.toEmptyList(constraint.getColumnNames()));
43  	}
44  
45  	public Constraint() {
46  		super();
47  	}
48  
49  	public Constraint(List<String> columnNames, String name) {
50  		this.columnNames = columnNames;
51  		this.name = name;
52  	}
53  
54  	@XmlElement(name = "column")
55  	public List<String> getColumnNames() {
56  		return columnNames;
57  	}
58  
59  	@Override
60  	@XmlAttribute
61  	public String getName() {
62  		return name;
63  	}
64  
65  	public void setName(String name) {
66  		this.name = name;
67  	}
68  
69  	public void setColumnNames(List<String> columnNames) {
70  		this.columnNames = columnNames;
71  	}
72  }