View Javadoc
1   /**
2    * Copyright 2014 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   * Created by dietrich on 2014/08/05
16   */
17  package org.kuali.student.enrollment.class1.hold.dto;
18  
19  import org.apache.commons.lang.StringUtils;
20  import org.kuali.student.core.person.dto.PersonInfo;
21  import org.kuali.student.enrollment.class1.hold.util.HoldsConstants;
22  import org.kuali.student.r2.core.hold.dto.AppliedHoldInfo;
23  import org.kuali.student.r2.core.hold.dto.HoldIssueInfo;
24  
25  import java.io.Serializable;
26  import java.util.ArrayList;
27  import java.util.List;
28  
29  /**
30   * @author Kuali Student Team
31   */
32  public class AppliedHoldMaintenanceWrapper implements Serializable {
33  
34      /**
35       * APPLY, EDIT, EXPIRE or DELETE.
36       */
37      private String action;
38  
39      /**
40       * Contains the personal information for the selected student.
41       */
42      private PersonInfo person;
43  
44      private AppliedHoldWrapper maintenanceHold;
45  
46      public AppliedHoldMaintenanceWrapper() {
47          super();
48      }
49  
50      public String getAction() {
51          return action;
52      }
53  
54      public void setAction(String action) {
55          this.action = action;
56      }
57  
58      public PersonInfo getPerson() {
59          return person;
60      }
61  
62      public void setPerson(PersonInfo person) {
63          this.person = person;
64      }
65  
66      public AppliedHoldWrapper getMaintenanceHold() {
67          if (maintenanceHold == null) {
68              maintenanceHold = new AppliedHoldWrapper();
69          }
70          return maintenanceHold;
71      }
72  
73      public void setMaintenanceHold(AppliedHoldWrapper maintenanceHold) {
74          this.maintenanceHold = maintenanceHold;
75      }
76  
77      public String getHoldCode() {
78          return getMaintenanceHold().getHoldCode();
79      }
80  
81      public void setHoldCode(String holdCode) {
82          getMaintenanceHold().setHoldCode(holdCode.toUpperCase());
83      }
84  
85      public String getEffectiveTerm() {
86          return getMaintenanceHold().getEffectiveTerm();
87      }
88  
89      public void setEffectiveTerm(String effectiveTerm) {
90          getMaintenanceHold().setEffectiveTerm(effectiveTerm);
91      }
92  
93      public String getExpirationTerm() {
94          return getMaintenanceHold().getExpirationTerm();
95      }
96  
97      public void setExpirationTerm(String expirationTerm) {
98          getMaintenanceHold().setExpirationTerm(expirationTerm);
99      }
100 
101     public HoldIssueInfo getHoldIssue() {
102         return getMaintenanceHold().getHoldIssue();
103     }
104 
105     public void setHoldIssue(HoldIssueInfo holdIssue) {
106         getMaintenanceHold().setHoldIssue(holdIssue);
107     }
108 
109     public AppliedHoldInfo getAppliedHold() {
110         return getMaintenanceHold().getAppliedHold();
111     }
112 
113     public void setAppliedHold(AppliedHoldInfo appliedHold) {
114         getMaintenanceHold().setAppliedHold(appliedHold);
115     }
116 
117     public String getViewHeaderInfo() {
118 
119         if (this.getPerson() != null) {
120             return this.getPerson().getName() + " (" + this.getPerson().getId() + ")";
121         }
122 
123         return StringUtils.EMPTY;
124     }
125 
126     public String getPageHeaderInfo() {
127 
128         if (HoldsConstants.APPLIED_HOLDS_ACTION_APPLY.equals(this.getAction())) {
129             return "Apply Hold";
130         } else if (HoldsConstants.APPLIED_HOLDS_ACTION_EDIT.equals(this.getAction())) {
131             return "Edit Hold";
132         } else if (HoldsConstants.APPLIED_HOLDS_ACTION_EXPIRE.equals(this.getAction())) {
133             return "Expire Hold";
134         } else if (HoldsConstants.APPLIED_HOLDS_ACTION_DELETE.equals(this.getAction())) {
135             return "Delete Hold";
136         } else {
137             return "Maintain Hold";
138         }
139 
140     }
141 }