Coverage Report - org.kuali.student.enrollment.lpr.mock.LuiPersonRelationStateEnum
 
Classes in this File Line Coverage Branch Coverage Complexity
LuiPersonRelationStateEnum
0%
0/46
0%
0/2
1.556
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may        obtain a copy of the License at
 7  
  *
 8  
  *         http://www.osedu.org/licenses/ECL-2.0
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 package org.kuali.student.enrollment.lpr.mock;
 17  
 
 18  
 import java.io.Serializable;
 19  
 import java.text.ParseException;
 20  
 import java.text.SimpleDateFormat;
 21  
 import java.util.Date;
 22  
 import java.util.List;
 23  
 
 24  
 import org.kuali.student.common.infc.AttributeInfc;
 25  
 import org.kuali.student.common.infc.StateInfc;
 26  
 import org.kuali.student.enrollment.lpr.service.LuiPersonRelationConstants;
 27  
 
 28  
 /**
 29  
  * States for Learning Person Relations
 30  
  * <p/>
 31  
  * See https://wiki.kuali.org/display/STUDENT/LuiPeronRelation+Types+and+States#LuiPeronRelationTypesandStates-References
 32  
  *
 33  
  * @author nwright
 34  
  */
 35  0
 public enum LuiPersonRelationStateEnum implements StateInfc, Serializable {
 36  
 
 37  
     /**
 38  
      * Student states to courses
 39  
      */
 40  0
     PLANNED(LuiPersonRelationConstants.PLANNED_STATE_KEY, "Planned", "The student plans on taking this course or program", asDate("20100101"), null, null),
 41  0
     REGISTERED(LuiPersonRelationConstants.REGISTERED_STATE_KEY, "Registered", "The student is officially registered for the course or section", asDate("20100101"), null, null),
 42  0
     WAITLISTED(LuiPersonRelationConstants.WAITLISTED_STATE_KEY, "Waitlisted", "The student attempted to join but has been put on the waitlist", asDate("20100101"), null, null),
 43  0
     DROPPED(LuiPersonRelationConstants.DROPPED_STATE_KEY, "Dropped Early", "Student dropped the course before the normal deadline", asDate("20010101"), null, null),
 44  0
     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),
 45  
     /**
 46  
      * Instructor states
 47  
      */
 48  0
     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),
 49  0
     ASSIGNED(LuiPersonRelationConstants.ASSIGNED_STATE_KEY, "Assigned", "The instructor is assigned to teach this course or section.", asDate("20010101"), null, null),
 50  0
     UNASSIGNED(LuiPersonRelationConstants.UNASSIGNED_STATE_KEY, "Unassigned", "The instructor had been assigned but then that assignment was removed", asDate("20010101"), null, null),
 51  
     /**
 52  
      * Program states
 53  
      */
 54  0
     INQUIRED(LuiPersonRelationConstants.INQUIRED_STATE_KEY, "Inquired", "The student took an active step in contacting the program indicating their plans", asDate("20100101"), null, null),
 55  0
     APPLIED(LuiPersonRelationConstants.APPLIED_STATE_KEY, "Applied", "The student has applied for the program", asDate("20100101"), null, null),
 56  0
     ADMITTED(LuiPersonRelationConstants.ADMITTED_STATE_KEY, "Admitted", "The student has been admitted to the program ", asDate("20100101"), null, null),
 57  0
     DENIED(LuiPersonRelationConstants.DENIED_STATE_KEY, "Denied", "The student was denied admission to the program", asDate("20100101"), null, null),
 58  0
     CONFIRMED(LuiPersonRelationConstants.CONFIRMED_STATE_KEY, "Confirmed", "The student has confirmed that she plans to matriculate ", asDate("20100101"), null, null),
 59  0
     CANCELED(LuiPersonRelationConstants.CANCELED_STATE_KEY, "Canceled", "The student canceled prior to matriculation", asDate("20100101"), null, null),
 60  0
     DEFERED(LuiPersonRelationConstants.DEFERED_STATE_KEY, "Deferred", "The student defers matriculation to a different term", asDate("20100101"), null, null),
 61  0
     ENROLLED(LuiPersonRelationConstants.ENROLLED_STATE_KEY, "Enrolled", "The student is fully enrolled in the program ", asDate("20100101"), null, null),
 62  0
     TEMPORARY_ABSENCE(LuiPersonRelationConstants.TEMPORARY_ABSENCE_STATE_KEY, "Temporary Absence", "The student has temporarily not matriculated but is expected to return", asDate("20100101"), null, null),
 63  0
     WITHDRAWN(LuiPersonRelationConstants.WITHDRAWN_STATE_KEY, "Withdrawn", "The student was registered but then withdrew from the program", asDate("20100101"), null, null),
 64  0
     PROBATION(LuiPersonRelationConstants.PROBATION_STATE_KEY, "Probation", "The student must fulfill certain requirements in order to stay in the program", asDate("20100101"), null, null);
 65  
     /**
 66  
      * States used for isntructors of courses
 67  
      */
 68  0
     public static final LuiPersonRelationStateEnum[] COURSE_INSTRUCTOR_STATES = {TENATIVE, ASSIGNED, UNASSIGNED};
 69  
     /**
 70  
      * Types used for students in courses
 71  
      */
 72  0
     public static final LuiPersonRelationStateEnum[] COURSE_STUDENT_STATES = {PLANNED, REGISTERED, WAITLISTED, DROPPED, DROPPED_LATE};
 73  
     /**
 74  
      * States used for isntructors of PROGRAMS
 75  
      */
 76  0
     public static final LuiPersonRelationStateEnum[] PROGRAM_ADVISOR_STATES = {TENATIVE, ASSIGNED, UNASSIGNED};
 77  
     /**
 78  
      * Types used for students in PROGRAMS
 79  
      */
 80  0
     public static final LuiPersonRelationStateEnum[] PROGRAM_STUDENT_STATES = {PLANNED, INQUIRED, APPLIED, WAITLISTED, DENIED, CONFIRMED, CANCELED, DEFERED, ENROLLED, TEMPORARY_ABSENCE, WITHDRAWN, PROBATION};
 81  
     private static final long serialVersionUID = 1L;
 82  
     private String name;
 83  
     private String descr;
 84  
     private Date effectiveDate;
 85  
     private Date expirationDate;
 86  
     private List<? extends AttributeInfc> attributes;
 87  
     private String key;
 88  
 
 89  0
     LuiPersonRelationStateEnum(String key, String name, String descr, Date effectiveDate, Date expirationDate, List<? extends AttributeInfc> attributes) {
 90  0
         this.key = key;
 91  0
         this.name = name;
 92  0
         this.descr = descr;
 93  0
         this.effectiveDate = effectiveDate;
 94  0
         this.expirationDate = expirationDate;
 95  0
         this.attributes = attributes;
 96  0
     }
 97  
 
 98  
     @Override
 99  
     public String getName() {
 100  0
         return this.name;
 101  
     }
 102  
 
 103  
     @Override
 104  
     public String getDescr() {
 105  0
         return this.descr;
 106  
     }
 107  
 
 108  
     @Override
 109  
     public Date getEffectiveDate() {
 110  0
         return this.effectiveDate;
 111  
     }
 112  
 
 113  
     @Override
 114  
     public Date getExpirationDate() {
 115  0
         return this.expirationDate;
 116  
     }
 117  
 
 118  
     private void setAttributes(List<? extends AttributeInfc> attributes) {
 119  0
         this.attributes = attributes;
 120  0
     }
 121  
 
 122  
     @Override
 123  
     public List<? extends AttributeInfc> getAttributes() {
 124  0
         return this.attributes;
 125  
     }
 126  
 
 127  
     @Override
 128  
     public String getKey() {
 129  0
         return this.key;
 130  
     }
 131  
 
 132  
     private static Date asDate(String dateStr) {
 133  0
         if (dateStr == null) {
 134  0
             return null;
 135  
         }
 136  0
         SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
 137  
         try {
 138  0
             return df.parse(dateStr);
 139  0
         } catch (ParseException ex) {
 140  0
             throw new IllegalArgumentException(ex);
 141  
         }
 142  
     }
 143  
 }