View Javadoc

1   package org.kuali.student.enrollment.lpr.dto;
2   
3   import java.io.Serializable;
4   import java.util.ArrayList;
5   import java.util.List;
6   
7   import javax.xml.bind.annotation.XmlAccessType;
8   import javax.xml.bind.annotation.XmlAccessorType;
9   import javax.xml.bind.annotation.XmlAnyElement;
10  import javax.xml.bind.annotation.XmlElement;
11  import javax.xml.bind.annotation.XmlType;
12  
13  import org.kuali.student.enrollment.lpr.infc.LprTransactionItem;
14  import org.kuali.student.enrollment.lpr.infc.LprTransactionItemRequestOption;
15  import org.kuali.student.enrollment.lpr.infc.LprTransactionItemResult;
16  import org.kuali.student.r2.common.dto.IdEntityInfo;
17  import org.w3c.dom.Element;
18  
19  @XmlAccessorType(XmlAccessType.FIELD)
20  @XmlType(name = "LprTransactionItemInfo", propOrder = {"id",
21      "personId",
22      "transactionId",
23      "newLuiId",
24      "existingLuiId",
25      "resultValuesGroupKeys",
26      "requestOptions",
27      "lprTransactionItemResult",
28      "name",
29      "descr",
30      "typeKey",
31      "stateKey",
32      "meta",
33      "attributes",
34      "_futureElements"})
35  public class LprTransactionItemInfo extends IdEntityInfo implements LprTransactionItem, Serializable {
36  
37      private static final long serialVersionUID = 1L;
38      @XmlElement
39      private String personId;
40      @XmlElement
41      private String transactionId;
42      @XmlElement
43      private String newLuiId;
44      @XmlElement
45      private String existingLuiId;
46      @XmlElement
47      private List<String> resultValuesGroupKeys;
48      @XmlElement
49      private List<LprTransactionItemRequestOptionInfo> requestOptions;
50      @XmlElement
51      private LprTransactionItemResultInfo lprTransactionItemResult;
52      @XmlAnyElement
53      private List<Element> _futureElements;
54  
55      public LprTransactionItemInfo() {
56          super();
57      }
58  
59      public LprTransactionItemInfo(LprTransactionItem lprTransactionItem) {
60  
61          super(lprTransactionItem);
62          if (null != lprTransactionItem) {
63              this.personId = lprTransactionItem.getPersonId();
64              this.transactionId = lprTransactionItem.getTransactionId();
65              this.newLuiId = lprTransactionItem.getNewLuiId();
66              this.existingLuiId = lprTransactionItem.getExistingLuiId();
67              
68              this.requestOptions = new ArrayList<LprTransactionItemRequestOptionInfo>();
69              if (null != lprTransactionItem.getRequestOptions()) {
70                  for (LprTransactionItemRequestOption reqOp : lprTransactionItem.getRequestOptions()) {
71                      this.requestOptions.add(new LprTransactionItemRequestOptionInfo(reqOp));
72                  }
73              }
74  
75              this.resultValuesGroupKeys = new ArrayList<String>();
76              if (null != lprTransactionItem.getResultValuesGroupKeys()) {
77                  resultValuesGroupKeys.addAll(lprTransactionItem.getResultValuesGroupKeys());
78              }
79              LprTransactionItemResult result = lprTransactionItem.getLprTransactionItemResult();
80              if (result != null) {
81              	// only set the result if there is a result in the item.
82              	this.lprTransactionItemResult = new LprTransactionItemResultInfo(result);	
83              }
84  
85              this._futureElements = null;
86          }
87      }
88  
89      @Override
90      public LprTransactionItemResultInfo getLprTransactionItemResult() {
91          return lprTransactionItemResult;
92      }
93  
94      public void setLprTransactionResult(LprTransactionItemResultInfo lprTransactionResult) {
95          this.lprTransactionItemResult = lprTransactionResult;
96      }
97  
98      @Override
99      public List<LprTransactionItemRequestOptionInfo> getRequestOptions() {
100         if (requestOptions == null) {
101             requestOptions = new ArrayList<LprTransactionItemRequestOptionInfo> ();
102         }
103         return requestOptions;
104     }
105 
106     public void setRequestOptions(List<LprTransactionItemRequestOptionInfo> requestOptions) {
107         this.requestOptions = requestOptions;
108     }
109 
110     public void setNewLuiId(String newLuiId) {
111         this.newLuiId = newLuiId;
112     }
113 
114     public void setExistingLuiId(String existingLuiId) {
115         this.existingLuiId = existingLuiId;
116     }
117 
118     @Override
119     public String getNewLuiId() {
120         return newLuiId;
121     }
122 
123     @Override
124     public String getExistingLuiId() {
125         return existingLuiId;
126     }
127 
128     @Override
129     public String getPersonId() {
130         return personId;
131     }
132 
133     public void setPersonId(String personId) {
134         this.personId = personId;
135     }
136 
137     @Override
138     public String getTransactionId() {
139         return transactionId;
140     }
141 
142     public void setTransactionId(String transactionId) {
143         this.transactionId = transactionId;
144     }
145 
146     @Override
147     public List<String> getResultValuesGroupKeys() {
148         if (this.resultValuesGroupKeys == null) {
149             this.resultValuesGroupKeys = new ArrayList<String> ();
150         }
151         return resultValuesGroupKeys;
152     }
153 
154     public void setResultValuesGroupKeys(List<String> resultValuesGroupKeys) {
155         this.resultValuesGroupKeys = resultValuesGroupKeys;
156     }
157 
158     public void setLprTransactionItemResult(LprTransactionItemResultInfo lprTransactionItemResult) {
159         this.lprTransactionItemResult = lprTransactionItemResult;
160     }
161 
162 	@Override
163 	public String toString() {
164 		StringBuilder builder = new StringBuilder();
165 		builder.append("LprTransactionItemInfo [id=");
166 		builder.append(getId());
167 		builder.append(", type=");
168 		builder.append(getTypeKey());
169 		builder.append(", state=");
170 		builder.append(getStateKey());
171 		builder.append(", personId=");
172 		builder.append(personId);
173 		builder.append(", transactionId=");
174 		builder.append(transactionId);
175 		builder.append(", newLuiId=");
176 		builder.append(newLuiId);
177 		builder.append(", existingLuiId=");
178 		builder.append(existingLuiId);
179 		builder.append("]");
180 		return builder.toString();
181 	}
182     
183     
184 }