001 /*
002 * Copyright 2011 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.osedu.org/licenses/ECL-2.0
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 */
016 package org.kuali.student.enrollment.lpr.mock;
017
018 import java.io.Serializable;
019 import java.text.ParseException;
020 import java.text.SimpleDateFormat;
021 import java.util.Date;
022 import java.util.List;
023
024 import org.kuali.student.common.infc.Attribute;
025 import org.kuali.student.common.infc.State;
026 import org.kuali.student.common.util.constants.LuiPersonRelationConstants;
027
028 /**
029 * States for Learning Person Relations
030 * <p/>
031 * See https://wiki.kuali.org/display/STUDENT/LuiPeronRelation+Types+and+States#LuiPeronRelationTypesandStates-References
032 *
033 * @author nwright
034 */
035 public enum LuiPersonRelationStateEnum implements State, Serializable {
036
037 /**
038 * Student states to courses
039 */
040 PLANNED(LuiPersonRelationConstants.PLANNED_STATE_KEY, "Planned", "The student plans on taking this course or program", asDate("20100101"), null, null),
041 REGISTERED(LuiPersonRelationConstants.REGISTERED_STATE_KEY, "Registered", "The student is officially registered for the course or section", asDate("20100101"), null, null),
042 WAITLISTED(LuiPersonRelationConstants.WAITLISTED_STATE_KEY, "Waitlisted", "The student attempted to join but has been put on the waitlist", asDate("20100101"), null, null),
043 DROPPED(LuiPersonRelationConstants.DROPPED_STATE_KEY, "Dropped Early", "Student dropped the course before the normal deadline", asDate("20010101"), null, null),
044 DROPPED_LATE(LuiPersonRelationConstants.DROPPED_LATE_STATE_KEY, "Dropped Late", "The student was registered but subsequently dropped the course or section past the normally allotted time period, typically resulting in a special grade or mark to so indicate", asDate("20010101"), null, null),
045 /**
046 * Instructor states
047 */
048 TENATIVE(LuiPersonRelationConstants.TENATIVE_STATE_KEY, "Tentative", "The instructor is proposed to teach this course or section but it has not yet been confirmed", asDate("20010101"), null, null),
049 ASSIGNED(LuiPersonRelationConstants.ASSIGNED_STATE_KEY, "Assigned", "The instructor is assigned to teach this course or section.", asDate("20010101"), null, null),
050 UNASSIGNED(LuiPersonRelationConstants.UNASSIGNED_STATE_KEY, "Unassigned", "The instructor had been assigned but then that assignment was removed", asDate("20010101"), null, null),
051 /**
052 * Program states
053 */
054 INQUIRED(LuiPersonRelationConstants.INQUIRED_STATE_KEY, "Inquired", "The student took an active step in contacting the program indicating their plans", asDate("20100101"), null, null),
055 APPLIED(LuiPersonRelationConstants.APPLIED_STATE_KEY, "Applied", "The student has applied for the program", asDate("20100101"), null, null),
056 ADMITTED(LuiPersonRelationConstants.ADMITTED_STATE_KEY, "Admitted", "The student has been admitted to the program ", asDate("20100101"), null, null),
057 DENIED(LuiPersonRelationConstants.DENIED_STATE_KEY, "Denied", "The student was denied admission to the program", asDate("20100101"), null, null),
058 CONFIRMED(LuiPersonRelationConstants.CONFIRMED_STATE_KEY, "Confirmed", "The student has confirmed that she plans to matriculate ", asDate("20100101"), null, null),
059 CANCELED(LuiPersonRelationConstants.CANCELED_STATE_KEY, "Canceled", "The student canceled prior to matriculation", asDate("20100101"), null, null),
060 DEFERED(LuiPersonRelationConstants.DEFERED_STATE_KEY, "Deferred", "The student defers matriculation to a different term", asDate("20100101"), null, null),
061 ENROLLED(LuiPersonRelationConstants.ENROLLED_STATE_KEY, "Enrolled", "The student is fully enrolled in the program ", asDate("20100101"), null, null),
062 TEMPORARY_ABSENCE(LuiPersonRelationConstants.TEMPORARY_ABSENCE_STATE_KEY, "Temporary Absence", "The student has temporarily not matriculated but is expected to return", asDate("20100101"), null, null),
063 WITHDRAWN(LuiPersonRelationConstants.WITHDRAWN_STATE_KEY, "Withdrawn", "The student was registered but then withdrew from the program", asDate("20100101"), null, null),
064 PROBATION(LuiPersonRelationConstants.PROBATION_STATE_KEY, "Probation", "The student must fulfill certain requirements in order to stay in the program", asDate("20100101"), null, null);
065 /**
066 * States used for isntructors of courses
067 */
068 public static final LuiPersonRelationStateEnum[] COURSE_INSTRUCTOR_STATES = {TENATIVE, ASSIGNED, UNASSIGNED};
069 /**
070 * Types used for students in courses
071 */
072 public static final LuiPersonRelationStateEnum[] COURSE_STUDENT_STATES = {PLANNED, REGISTERED, WAITLISTED, DROPPED, DROPPED_LATE};
073 /**
074 * States used for isntructors of PROGRAMS
075 */
076 public static final LuiPersonRelationStateEnum[] PROGRAM_ADVISOR_STATES = {TENATIVE, ASSIGNED, UNASSIGNED};
077 /**
078 * Types used for students in PROGRAMS
079 */
080 public static final LuiPersonRelationStateEnum[] PROGRAM_STUDENT_STATES = {PLANNED, INQUIRED, APPLIED, WAITLISTED, DENIED, CONFIRMED, CANCELED, DEFERED, ENROLLED, TEMPORARY_ABSENCE, WITHDRAWN, PROBATION};
081 private static final long serialVersionUID = 1L;
082 private String name;
083 private String descr;
084 private Date effectiveDate;
085 private Date expirationDate;
086 private List<? extends Attribute> attributes;
087 private String key;
088
089 LuiPersonRelationStateEnum(String key, String name, String descr, Date effectiveDate, Date expirationDate, List<? extends Attribute> attributes) {
090 this.key = key;
091 this.name = name;
092 this.descr = descr;
093 this.effectiveDate = effectiveDate;
094 this.expirationDate = expirationDate;
095 this.attributes = attributes;
096 }
097
098 @Override
099 public String getName() {
100 return this.name;
101 }
102
103 @Override
104 public String getDescr() {
105 return this.descr;
106 }
107
108 @Override
109 public Date getEffectiveDate() {
110 return this.effectiveDate;
111 }
112
113 @Override
114 public Date getExpirationDate() {
115 return this.expirationDate;
116 }
117
118 private void setAttributes(List<? extends Attribute> attributes) {
119 this.attributes = attributes;
120 }
121
122 @Override
123 public List<? extends Attribute> getAttributes() {
124 return this.attributes;
125 }
126
127 @Override
128 public String getKey() {
129 return this.key;
130 }
131
132 private static Date asDate(String dateStr) {
133 if (dateStr == null) {
134 return null;
135 }
136 SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
137 try {
138 return df.parse(dateStr);
139 } catch (ParseException ex) {
140 throw new IllegalArgumentException(ex);
141 }
142 }
143 }