001/**
002 * Copyright 2005-2013 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.rice.krms.tree.node;
017
018import groovy.json.StringEscapeUtils;
019import org.apache.commons.lang.StringUtils;
020
021import java.io.Serializable;
022import java.util.List;
023
024/**
025 * @author Kuali Student Team
026 */
027public class CompareTreeNode implements Serializable {
028
029    private String firstElement;
030    private List<String> firstElementItems;
031    private String secondElement;
032    private List<String> secondElementItems;
033    private String thirdElement;
034    private List<String> thirdElementItems;
035    private String fourthElement;
036    private List<String> fourthElementItems;
037    private String fithElement;
038    private List<String> fithElementItems;
039
040    private int width;
041
042    public CompareTreeNode(int width){
043        this.setWidth(width);
044    }
045
046    public CompareTreeNode(int width, String... elements){
047        this(width);
048        for (int i = 0; i < elements.length; i++) {
049            switch (i) {
050                case 0:
051                    this.firstElement = elements[0];
052                    break;
053                case 1:
054                    this.secondElement = elements[1];
055                    break;
056                case 2:
057                    this.thirdElement = elements[2];
058                    break;
059                case 3:
060                    this.fourthElement= elements[3];
061                    break;
062                case 4:
063                    this.fithElement = elements[4];
064                    break;
065            }
066        }
067    }
068
069    public String getFirstElement() {
070        if((this.firstElement == null) || (this.firstElement.isEmpty())){
071            return org.apache.commons.lang.StringEscapeUtils.escapeHtml(" ");
072        }
073        return firstElement;
074    }
075
076    public void setFirstElement(String firstElement) {
077        this.firstElement = firstElement;
078    }
079
080    public List<String> getFirstElementItems() {
081        return firstElementItems;
082    }
083
084    public void setFirstElementItems(List<String> firstElementItems) {
085        this.firstElementItems = firstElementItems;
086    }
087
088    public String getSecondElement() {
089        if((this.secondElement == null) || (this.secondElement.isEmpty())){
090            return org.apache.commons.lang.StringEscapeUtils.escapeHtml(" ");
091        }
092        return secondElement;
093    }
094
095    public void setSecondElement(String secondElement) {
096        this.secondElement = secondElement;
097    }
098
099    public List<String> getSecondElementItems() {
100        return secondElementItems;
101    }
102
103    public void setSecondElementItems(List<String> secondElementItems) {
104        this.secondElementItems = secondElementItems;
105    }
106
107    public String getThirdElement() {
108        if((this.thirdElement == null) || (this.thirdElement.isEmpty())){
109            return org.apache.commons.lang.StringEscapeUtils.escapeHtml(" ");
110        }
111        return thirdElement;
112    }
113
114    public void setThirdElement(String thirdElement) {
115        this.thirdElement = thirdElement;
116    }
117
118    public List<String> getThirdElementItems() {
119        return thirdElementItems;
120    }
121
122    public void setThirdElementItems(List<String> thirdElementItems) {
123        this.thirdElementItems = thirdElementItems;
124    }
125
126    public String getFourthElement() {
127        if((this.fourthElement == null) || (this.fourthElement.isEmpty())){
128            return org.apache.commons.lang.StringEscapeUtils.escapeHtml(" ");
129        }
130        return fourthElement;
131    }
132
133    public void setFourthElement(String fourthElement) {
134        this.fourthElement = fourthElement;
135    }
136
137    public List<String> getFourthElementItems() {
138        return fourthElementItems;
139    }
140
141    public void setFourthElementItems(List<String> fourthElementItems) {
142        this.fourthElementItems = fourthElementItems;
143    }
144
145    public String getFithElement() {
146        if((this.fithElement == null) || (this.fithElement.isEmpty())){
147            return org.apache.commons.lang.StringEscapeUtils.escapeHtml(" ");
148        }
149        return fithElement;
150    }
151
152    public void setFithElement(String fithElement) {
153        this.fithElement = fithElement;
154    }
155
156    public List<String> getFithElementItems() {
157        return fithElementItems;
158    }
159
160    public void setFithElementItems(List<String> fithElementItems) {
161        this.fithElementItems = fithElementItems;
162    }
163
164    public int getWidth() {
165        return width;
166    }
167
168    public void setWidth(int width) {
169        this.width = width;
170    }
171}