Coverage Report - org.kuali.student.r2.common.service.impl.TypeServiceMockImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
TypeServiceMockImpl
0%
0/249
0%
0/26
2.304
 
 1  
 package org.kuali.student.r2.common.service.impl;
 2  
 
 3  
 import org.kuali.student.r2.common.dto.ContextInfo;
 4  
 import org.kuali.student.r2.common.dto.StatusInfo;
 5  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 6  
 import org.kuali.student.r2.common.exceptions.AlreadyExistsException;
 7  
 import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
 8  
 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
 9  
 import org.kuali.student.r2.common.exceptions.ReadOnlyException;
 10  
 import org.kuali.student.r2.common.exceptions.VersionMismatchException;
 11  
 import org.kuali.student.r2.core.type.dto.TypeInfo;
 12  
 import org.kuali.student.r2.core.type.dto.TypeTypeRelationInfo;
 13  
 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
 14  
 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
 15  
 import org.kuali.student.r2.common.exceptions.MissingParameterException;
 16  
 import org.kuali.student.r2.common.exceptions.OperationFailedException;
 17  
 import org.kuali.student.r2.core.type.service.TypeService;
 18  
 
 19  
 import javax.jws.WebParam;
 20  
 import java.util.ArrayList;
 21  
 import java.util.Date;
 22  
 import java.util.HashMap;
 23  
 import java.util.HashSet;
 24  
 import java.util.List;
 25  
 import java.util.Map;
 26  
 import java.util.Set;
 27  
 import org.kuali.student.r2.common.util.RichTextHelper;
 28  
 import org.kuali.student.r2.common.util.constants.AtpServiceConstants;
 29  
 import org.kuali.student.r2.common.util.constants.TypeServiceConstants;
 30  
 
 31  0
 public class TypeServiceMockImpl implements TypeService{
 32  
 
 33  0
     private Map<String, TypeInfo> allTypes = new HashMap<String, TypeInfo>();
 34  0
     private Map<String, Map<String, TypeTypeRelationInfo>> relationOwners = new HashMap<String, Map<String, TypeTypeRelationInfo>>();
 35  0
     private Map<String, Map<String, TypeInfo>> allowedTypes = new HashMap<String, Map<String, TypeInfo>>();
 36  0
     {init();}
 37  
 
 38  
     @Override
 39  
     public TypeInfo getType(@WebParam(name = "typeKey") String typeKey, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 40  0
         TypeInfo type = getType(typeKey);
 41  0
         if (type == null ) {
 42  0
             throw new DoesNotExistException(typeKey);
 43  
         }
 44  0
         return type;
 45  
     }
 46  
 
 47  
     @Override
 48  
     public List<TypeInfo> getTypesByKeys(@WebParam(name = "typeKeys") List<String> typeKeys, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 49  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 50  
     }
 51  
 
 52  
     @Override
 53  
     public List<TypeInfo> getTypesByRefObjectUri(@WebParam(name = "refObjectUri") String refObjectUri, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 54  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 55  
     }
 56  
 
 57  
     private TypeInfo getType(String typeKey) {
 58  0
         return allTypes.get(typeKey);
 59  
     }
 60  
 
 61  
 //    @Override
 62  
     public List<TypeInfo> getTypesByRefObjectURI(@WebParam(name = "refObjectURI") String refObjectURI, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 63  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 64  
     }
 65  
 
 66  
     @Override
 67  
     public List<TypeInfo> getAllowedTypesForType(@WebParam(name = "ownerTypeKey") String ownerTypeKey, @WebParam(name = "relatedRefObjectURI") String relatedRefObjectURI, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 68  0
         Map<String, TypeInfo> relationTypes = allowedTypes.get(ownerTypeKey);
 69  0
         if (relationTypes != null) {
 70  0
             return new ArrayList<TypeInfo>(relationTypes.values());
 71  
         } else {
 72  0
             return new ArrayList<TypeInfo>();
 73  
         }
 74  
     }
 75  
 
 76  
     @Override
 77  
     public List<ValidationResultInfo> validateType(@WebParam(name = "validationTypeKey") String validationTypeKey, @WebParam(name = "typeInfo") TypeInfo typeInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 78  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 79  
     }
 80  
 
 81  
     @Override
 82  
     public TypeInfo createType(@WebParam(name = "typeKey") String typeKey, @WebParam(name = "typeInfo") TypeInfo typeInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws AlreadyExistsException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 83  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 84  
     }
 85  
 
 86  
     @Override
 87  
     public TypeInfo updateType(@WebParam(name = "typeKey") String typeKey, @WebParam(name = "typeInfo") TypeInfo typeInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 88  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 89  
     }
 90  
 
 91  
     @Override
 92  
     public StatusInfo deleteType(@WebParam(name = "typeKey") String typeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 93  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 94  
     }
 95  
 
 96  
     @Override
 97  
     public TypeTypeRelationInfo getTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 98  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 99  
     }
 100  
 
 101  
     @Override
 102  
     public List<TypeTypeRelationInfo> getTypeTypeRelationsByIds(@WebParam(name = "typeTypeRelationIds") List<String> typeTypeRelationIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 103  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 104  
     }
 105  
 
 106  
 //    @Override
 107  
     public List<TypeTypeRelationInfo> getTypeTypeRelationsByKeys(@WebParam(name = "typeTypeRelationKeys") List<String> typeTypeRelationKeys, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 108  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 109  
     }
 110  
 
 111  
     @Override
 112  
     public List<TypeTypeRelationInfo> getTypeTypeRelationsByOwnerType(@WebParam(name = "ownerTypeKey") String ownerTypeKey, @WebParam(name = "relationTypeKey") String relationTypeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 113  0
         Map<String, TypeTypeRelationInfo> relationTypes = relationOwners.get(ownerTypeKey);
 114  0
         if (relationTypes != null) {
 115  0
             return new ArrayList<TypeTypeRelationInfo>(relationTypes.values());
 116  
         } else {
 117  0
             return new ArrayList<TypeTypeRelationInfo>();
 118  
         }
 119  
     }
 120  
 
 121  
     @Override
 122  
     public List<ValidationResultInfo> validateTypeTypeRelation(@WebParam(name = "validationTypeKey") String validationTypeKey, @WebParam(name = "typeKey") String typeKey, @WebParam(name = "typePeerKey") String typePeerKey, @WebParam(name = "typeTyperelationTypeKey") String typeTypeRelationTypeKey, @WebParam(name = "typeTypeRelationInfo") TypeTypeRelationInfo typeTypeRelationInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 123  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 124  
     }
 125  
 
 126  
     @Override
 127  
     public TypeTypeRelationInfo createTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "typeKey") String typeKey, @WebParam(name = "typePeerKey") String typePeerKey, @WebParam(name = "typeTypeRelationInfo") TypeTypeRelationInfo typeTypeRelationInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException {
 128  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 129  
     }
 130  
 
 131  
     @Override
 132  
     public TypeTypeRelationInfo updateTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "typeTypeRelationInfo") TypeTypeRelationInfo typeTypeRelationInfo, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 133  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 134  
     }
 135  
 
 136  
     @Override
 137  
     public StatusInfo deleteTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 138  0
         throw new OperationFailedException("Method not implemented."); // TODO implement
 139  
     }
 140  
 
 141  
 
 142  
     private void init() {
 143  0
         List<String[]> typeArrays = new ArrayList<String[]>();
 144  0
         typeArrays.add(new String[] {"kuali.atp.type.AcademicCalendar", "Academic Calendar", "Academic Calendar", AtpServiceConstants.REF_OBJECT_URI_ATP});
 145  0
         typeArrays.add(new String[] {"kuali.atp.type.HolidayCalendar", "Holiday Calendar", "Holiday Calendar", AtpServiceConstants.REF_OBJECT_URI_ATP});
 146  0
         typeArrays.add(new String[] {"kuali.atp.type.Fall", "Fall", "Fall Semester", AtpServiceConstants.REF_OBJECT_URI_ATP});
 147  0
         typeArrays.add(new String[] {"kuali.atp.type.Spring", "Spring", "Spring Semester", AtpServiceConstants.REF_OBJECT_URI_ATP});
 148  0
         typeArrays.add(new String[] {"kuali.atp.type.FallSpring", "Fall-Spring", "Fall & Spring Semesters", AtpServiceConstants.REF_OBJECT_URI_ATP});
 149  0
         typeArrays.add(new String[] {"kuali.atp.type.AY", "AY", "Full Academic Year", AtpServiceConstants.REF_OBJECT_URI_ATP});
 150  0
         typeArrays.add(new String[] {"kuali.atp.type.FY", "FY", "Fiscal Year", AtpServiceConstants.REF_OBJECT_URI_ATP});
 151  0
         typeArrays.add(new String[] {"kuali.atp.type.Holiday", "Holiday", "Holiday", AtpServiceConstants.REF_OBJECT_URI_ATP});
 152  0
         typeArrays.add(new String[] {"kuali.atp.type.SpringBreak", "SpringBreak", "Spring Break", AtpServiceConstants.REF_OBJECT_URI_ATP});
 153  0
         typeArrays.add(new String[] {"kuali.atp.type.Thanksgiving", "Thanksgiving", "Thanksgiving", AtpServiceConstants.REF_OBJECT_URI_ATP});
 154  0
         typeArrays.add(new String[] {"kuali.atp.type.HalfFall1", "Fall Half-Semester 1", "Fall Half-Semester 1", AtpServiceConstants.REF_OBJECT_URI_ATP});
 155  0
         typeArrays.add(new String[] {"kuali.atp.type.HalfFall2", "Fall Half-Semester 2", "Fall Half-Semester 2", AtpServiceConstants.REF_OBJECT_URI_ATP});
 156  0
         typeArrays.add(new String[] {"kuali.atp.type.HalfSpring1", "Spring Half-Semester 1", "Spring Half-Semester 1", AtpServiceConstants.REF_OBJECT_URI_ATP});
 157  0
         typeArrays.add(new String[] {"kuali.atp.type.HalfSpring2", "Spring Half-Semester 1", "Spring Half-Semester 2", AtpServiceConstants.REF_OBJECT_URI_ATP});
 158  0
         typeArrays.add(new String[] {"kuali.atp.type.Mini-mester1A", "Mini Semester 1A", "Mini Semester 1A", AtpServiceConstants.REF_OBJECT_URI_ATP});
 159  0
         typeArrays.add(new String[] {"kuali.atp.type.Mini-mester1B", "Mini Semester 1B", "Mini Semester 1B", AtpServiceConstants.REF_OBJECT_URI_ATP});
 160  0
         typeArrays.add(new String[] {"kuali.atp.type.Mini-mester2C", "Mini Semester 2C", "Mini Semester 2C", AtpServiceConstants.REF_OBJECT_URI_ATP});
 161  0
         typeArrays.add(new String[] {"kuali.atp.type.Mini-mester2D", "Mini Semester 2D", "Mini Semester 2D", AtpServiceConstants.REF_OBJECT_URI_ATP});
 162  0
         typeArrays.add(new String[] {"kuali.atp.type.Session1", "Session 1", "Session 1", AtpServiceConstants.REF_OBJECT_URI_ATP});
 163  0
         typeArrays.add(new String[] {"kuali.atp.type.Session2", "Session 2", "Session 2", AtpServiceConstants.REF_OBJECT_URI_ATP});
 164  0
         typeArrays.add(new String[] {"kuali.atp.type.SessionG1", "Session G1", "Session G1", AtpServiceConstants.REF_OBJECT_URI_ATP});
 165  0
         typeArrays.add(new String[] {"kuali.atp.type.SessionG2", "Session G2", "Session G2", AtpServiceConstants.REF_OBJECT_URI_ATP});
 166  0
         typeArrays.add(new String[] {"kuali.atp.type.Summer", "Summer", "Summer Semester", AtpServiceConstants.REF_OBJECT_URI_ATP});
 167  0
         typeArrays.add(new String[] {"kuali.atp.type.SummerEve", "Summer Eve", "Summer Eve", AtpServiceConstants.REF_OBJECT_URI_ATP});
 168  0
         typeArrays.add(new String[] {"kuali.atp.type.Winter", "Winter", "Winter", AtpServiceConstants.REF_OBJECT_URI_ATP});
 169  0
         typeArrays.add(new String[] {"kuali.atp.type.Adhoc", "Ad hoc", "Ad hoc", AtpServiceConstants.REF_OBJECT_URI_ATP});
 170  
 
 171  
         //holidays
 172  0
         typeArrays.add(new String[] {"kuali.atp.milestone.Christmas", "Christmas", "Christmas", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 173  0
         typeArrays.add(new String[] {"kuali.atp.milestone.ChristmasObserved", "Christmas Observed", "Christmas Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 174  0
         typeArrays.add(new String[] {"kuali.atp.milestone.FallBreak", "Fall Break", "Fall Break", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 175  0
         typeArrays.add(new String[] {"kuali.atp.milestone.LaborDay", "Labor Day", "Labor Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 176  0
         typeArrays.add(new String[] {"kuali.atp.milestone.IndependenceDay", "Independence Day", "Independence Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 177  0
         typeArrays.add(new String[] {"kuali.atp.milestone.IndependenceDayObserved", "Independence Day Observed", "Independence Day Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 178  0
         typeArrays.add(new String[] {"kuali.atp.milestone.MemorialDay", "Memorial Day", "Memorial Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 179  0
         typeArrays.add(new String[] {"kuali.atp.milestone.MemorialDayObserved", "Memorial Day Observed", "Memorial Day Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 180  0
         typeArrays.add(new String[] {"kuali.atp.milestone.MLKDay", "Martin Luther King Day", "Martin Luther King Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 181  0
         typeArrays.add(new String[] {"kuali.atp.milestone.MLKDayObserved", "MLK Day Observed", "MLK Day Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 182  0
         typeArrays.add(new String[] {"kuali.atp.milestone.NewYearsDay", "New Years Day", "New Years Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 183  0
         typeArrays.add(new String[] {"kuali.atp.milestone.NewYearsDayObserved", "New Years Day Observed", "New Years Day Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 184  0
         typeArrays.add(new String[] {"kuali.atp.milestone.PresidentsDay", "Presidents Day", "Presidents Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 185  0
         typeArrays.add(new String[] {"kuali.atp.milestone.SpringBreak", "Spring Break", "Spring Break", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 186  0
         typeArrays.add(new String[] {"kuali.atp.milestone.ThanksgivingBreak", "Thanksgiving Break", "Thanksgiving Break", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 187  0
         typeArrays.add(new String[] {"kuali.atp.milestone.VeteransDay", "Veterans Day", "Veterans Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 188  0
         typeArrays.add(new String[] {"kuali.atp.milestone.VeteransDayObserved", "Veterans Day Observed", "Veterans Day Observed", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 189  
 
 190  
         //events    -- type_key, name, type_descr, REF_OBJECT_URI
 191  0
         typeArrays.add(new String[] {"kuali.atp.milestone.FamilyWeekend", "Family Weekend", "Family Weekend", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 192  0
         typeArrays.add(new String[] {"kuali.atp.milestone.Homecoming", "Homecoming", "Homecoming", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 193  0
         typeArrays.add(new String[] {"kuali.atp.milestone.GraduationApplicationDeadline", "Graduation Application Deadline", "Deadline to apply for Graduation", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 194  0
         typeArrays.add(new String[] {"kuali.atp.milestone.AlumniDay", "Alumni Day", "Alumni Day", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 195  0
         typeArrays.add(new String[] {"kuali.atp.milestone.Baccalaureate", "Baccalaureate", "Baccalaureate", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 196  0
         typeArrays.add(new String[] {"kuali.atp.milestone.Commencement", "Commencement", "Commencement", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 197  
 
 198  
         //for AtpAtpRelations
 199  0
         typeArrays.add(new String[] {"kuali.atp.atp.relation.includes", "includes", "Includes", TypeServiceConstants.REF_OBJECT_URI_TYPE_TYPE_RELATION});
 200  0
         typeArrays.add(new String[] {"kuali.atp.atp.relation.associated", "associated", "Associated", TypeServiceConstants.REF_OBJECT_URI_TYPE_TYPE_RELATION});
 201  
 
 202  0
         for (String[] typeArray : typeArrays) {
 203  0
             createTypeInfo(typeArray[0], typeArray[1], typeArray[2], typeArray[3]);
 204  
         }
 205  
 
 206  
         // Term Types Grouping
 207  0
         Set<TypeInfo> termGroup = new HashSet<TypeInfo>();
 208  0
         TypeInfo termGroupType = createTypeInfo(AtpServiceConstants.ATP_TERM_GROUPING_TYPE_KEY, "Group for Terms", "Group for terms", AtpServiceConstants.REF_OBJECT_URI_ATP);
 209  
 
 210  0
         termGroup.add(getType("kuali.atp.type.Fall"));
 211  0
         termGroup.add(getType("kuali.atp.type.FallSpring"));
 212  0
         termGroup.add(getType("kuali.atp.type.HalfFall1"));
 213  0
         termGroup.add(getType("kuali.atp.type.HalfFall2"));
 214  0
         termGroup.add(getType("kuali.atp.type.Winter"));
 215  0
         termGroup.add(getType("kuali.atp.type.Spring"));
 216  0
         termGroup.add(getType("kuali.atp.type.HalfSpring1"));
 217  0
         termGroup.add(getType("kuali.atp.type.HalfSpring2"));
 218  0
         termGroup.add(getType("kuali.atp.type.SpringBreak"));
 219  0
         termGroup.add(getType("kuali.atp.type.Summer"));
 220  0
         termGroup.add(getType("kuali.atp.type.SummerEve"));
 221  0
         termGroup.add(getType("kuali.atp.type.Session1"));
 222  0
         termGroup.add(getType("kuali.atp.type.Mini-mester1A"));
 223  0
         termGroup.add(getType("kuali.atp.type.Mini-mester1B"));
 224  0
         termGroup.add(getType("kuali.atp.type.Session2"));
 225  0
         termGroup.add(getType("kuali.atp.type.Mini-mester2C"));
 226  0
         termGroup.add(getType("kuali.atp.type.Mini-mester2D"));
 227  0
         termGroup.add(getType("kuali.atp.type.SessionG1"));
 228  0
         termGroup.add(getType("kuali.atp.type.SessionG2"));
 229  0
         termGroup.add(getType("kuali.atp.type.Adhoc"));
 230  0
         for (TypeInfo type : termGroup) {
 231  0
             createTypeTypeRelationInfo(termGroupType, type);
 232  
         }
 233  
 
 234  
         //keydates
 235  0
         typeArrays.add(new String[] {"kuali.atp.milestone.AdvanceRegistrationPeriod", "Advance Registration Period", "Advance Registration Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 236  0
         typeArrays.add(new String[] {"kuali.atp.milestone.RegistrationPeriod", "Registration Period", "Registration Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 237  0
         typeArrays.add(new String[] {"kuali.atp.milestone.RegistrationBeginsTransfer", "Registration Begins Transfer", "Registration Begins Transfer", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 238  0
         typeArrays.add(new String[] {"kuali.atp.milestone.DropDeadlineWithoutRecord", "Drop Deadline Without Record", "Drop Deadline Without Record", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 239  0
         typeArrays.add(new String[] {"kuali.atp.milestone.FinalExamPeriod", "Final Exam Period", "Final Exam Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 240  0
         typeArrays.add(new String[] {"kuali.atp.milestone.GradesDue", "Grades Due", "Grades Due", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 241  0
         typeArrays.add(new String[] {"kuali.atp.milestone.InstructionalPeriod", "Instructional Period", "Instructional Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 242  
 
 243  
         //curriculum
 244  0
         typeArrays.add(new String[] {"kuali.atp.milestone.CoordinatorsKickoffMeeting", "Coordinators Kickoff Meeting", "Coordinators Kickoff Meeting", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 245  0
         typeArrays.add(new String[] {"kuali.atp.milestone.ProposalPeriod", "Proposal Period", "Proposal Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 246  0
         typeArrays.add(new String[] {"kuali.atp.milestone.ReviewPeriod", "Review Period", "Review Period", AtpServiceConstants.REF_OBJECT_URI_MILESTONE});
 247  
 
 248  0
         for (String[] typeArray : typeArrays) {
 249  0
             createTypeInfo(typeArray[0], typeArray[1], typeArray[2], typeArray[3]);
 250  
         }
 251  
 
 252  
         //Keydates grouping
 253  0
         Set<TypeInfo> keydateGroup = new HashSet<TypeInfo>();
 254  0
         TypeInfo keydateGroupType = createTypeInfo(AtpServiceConstants.MILESTONE_KEYDATE_GROUP, "Group for key dates", "Group for key dates", AtpServiceConstants.REF_OBJECT_URI_MILESTONE);
 255  0
         keydateGroup.add(getType("kuali.atp.milestone.AdvanceRegistrationPeriod"));
 256  0
         keydateGroup.add(getType("kuali.atp.milestone.InstructionalPeriod"));
 257  0
         keydateGroup.add(getType("kuali.atp.milestone.RegistrationPeriod"));
 258  0
         keydateGroup.add(getType("kuali.atp.milestone.RegistrationBeginsTransfer"));
 259  0
         keydateGroup.add(getType("kuali.atp.milestone.DropDeadlineWithoutRecord"));
 260  0
         keydateGroup.add(getType("kuali.atp.milestone.FinalExamPeriod"));
 261  0
         keydateGroup.add(getType("kuali.atp.milestone.GradesDue"));
 262  0
         for (TypeInfo type : keydateGroup) {
 263  0
             createTypeTypeRelationInfo(keydateGroupType, type);
 264  
         }
 265  
 
 266  
         //curriculum grouping
 267  0
         Set<TypeInfo> curriculumGroup = new HashSet<TypeInfo>();
 268  0
         TypeInfo curriculumGroupType = createTypeInfo("kuali.milestone.type.group.curriculum", "Curriculum", "Curriculum", AtpServiceConstants.REF_OBJECT_URI_MILESTONE);
 269  
 
 270  0
         curriculumGroup.add(getType("kuali.atp.milestone.CoordinatorsKickoffMeeting"));
 271  0
         curriculumGroup.add(getType("kuali.atp.milestone.ProposalPeriod"));
 272  0
         curriculumGroup.add(getType("kuali.atp.milestone.ReviewPeriod"));
 273  0
         for (TypeInfo type : curriculumGroup) {
 274  0
             createTypeTypeRelationInfo(curriculumGroupType, type);
 275  
         }
 276  
 
 277  
         //Holiday types Grouping
 278  0
         Set<TypeInfo> holidayGroup = new HashSet<TypeInfo>();
 279  0
         TypeInfo holidayGroupType = createTypeInfo(AtpServiceConstants.MILESTONE_HOLIDAY_GROUPING_TYPE_KEY, "Holidays", "Holidays", AtpServiceConstants.REF_OBJECT_URI_MILESTONE);
 280  
 
 281  0
         holidayGroup.add(getType("kuali.atp.milestone.Christmas"));
 282  0
         holidayGroup.add(getType("kuali.atp.milestone.ChristmasObserved"));
 283  0
         holidayGroup.add(getType("kuali.atp.milestone.FallBreak"));
 284  0
         holidayGroup.add(getType("kuali.atp.milestone.LaborDay"));
 285  0
         holidayGroup.add(getType("kuali.atp.milestone.IndependenceDay"));
 286  0
         holidayGroup.add(getType("kuali.atp.milestone.IndependenceDayObserved"));
 287  0
         holidayGroup.add(getType("kuali.atp.milestone.MemorialDay"));
 288  0
         holidayGroup.add(getType("kuali.atp.milestone.MemorialDayObserved"));
 289  0
         holidayGroup.add(getType("kuali.atp.milestone.MLKDay"));
 290  0
         holidayGroup.add(getType("kuali.atp.milestone.MLKDayObserved"));
 291  0
         holidayGroup.add(getType("kuali.atp.milestone.NewYearsDay"));
 292  0
         holidayGroup.add(getType("kuali.atp.milestone.NewYearsDayObserved"));
 293  0
         holidayGroup.add(getType("kuali.atp.milestone.PresidentsDay"));
 294  0
         holidayGroup.add(getType("kuali.atp.milestone.SpringBreak"));
 295  0
         holidayGroup.add(getType("kuali.atp.milestone.ThanksgivingBreak"));
 296  0
         holidayGroup.add(getType("kuali.atp.milestone.VeteransDay"));
 297  0
         holidayGroup.add(getType("kuali.atp.milestone.VeteransDayObserved"));
 298  
 
 299  0
         for (TypeInfo type : holidayGroup) {
 300  0
             createTypeTypeRelationInfo(holidayGroupType, type);
 301  
         }
 302  
 
 303  
         //Event types Grouping
 304  0
         Set<TypeInfo> eventGroup = new HashSet<TypeInfo>();
 305  
         //MILESTONE_EVENT_GROUPING_TYPE_KEY = "kuali.milestone.type.group.event";
 306  0
         TypeInfo eventGroupType = createTypeInfo(AtpServiceConstants.MILESTONE_EVENT_GROUPING_TYPE_KEY, "Acal Events", "Acal Events", AtpServiceConstants.REF_OBJECT_URI_MILESTONE);
 307  
 
 308  0
         eventGroup.add(getType("kuali.atp.milestone.FamilyWeekend"));
 309  0
         eventGroup.add(getType("kuali.atp.milestone.Homecoming"));
 310  0
         eventGroup.add(getType("kuali.atp.milestone.GraduationApplicationDeadline"));
 311  0
         eventGroup.add(getType("kuali.atp.milestone.AlumniDay"));
 312  0
         eventGroup.add(getType("kuali.atp.milestone.Baccalaureate"));
 313  0
         eventGroup.add(getType("kuali.atp.milestone.Commencement"));
 314  0
         for (TypeInfo type : eventGroup) {
 315  0
             createTypeTypeRelationInfo(eventGroupType, type);
 316  
         }
 317  
 
 318  
         // Allowed type relations
 319  0
         List<String[]> allowedArrays = new ArrayList<String[]>();
 320  
 //        allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.1", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.FallSpring", "1", "AcademicCalendar can contain FallSpring"});
 321  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.2", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.Fall", "2", "AcademicCalendar can contain Fall"});
 322  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.3", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.type.HalfFall1", "1", "Fall can contain HalfFall1"});
 323  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.4", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.type.HalfFall2", "2", "Fall can contain HalfFall2"});
 324  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.5", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.Winter", "3", "AcademicCalendar can contain Winter"});
 325  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.6", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.Spring", "4", "AcademicCalendar can contain Spring"});
 326  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.7", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.type.HalfSpring1", "1", "Spring can contain HalfSpring1"});
 327  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.8", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.type.SpringBreak", "2", "Spring can contain SpringBreak"});
 328  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.9", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.type.HalfSpring2", "3", "Spring can contain HalfSpring2"});
 329  
 //        allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.10", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.Session1", "5", "AcademicCalendar can contain Session1"});
 330  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.11", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Session1", "kuali.atp.type.Mini-mester1A", "1", "Session1 can contain Mini-mester1A"});
 331  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.12", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Session1", "kuali.atp.type.Mini-mester1B", "2", "Session1 can contain Mini-mester1B"});
 332  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.13", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.type.Session2", "2", "Summer can contain Session2"});
 333  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.14", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Session2", "kuali.atp.type.Mini-mester2C", "1", "Session2 can contain Mini-mester2C"});
 334  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.15", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Session2", "kuali.atp.type.Mini-mester2D", "2", "Session2 can contain Mini-mester2D"});
 335  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.16", "kuali.type.type.relation.type.allowed", "kuali.atp.type.AcademicCalendar", "kuali.atp.type.Summer", "6", "AcademicCalendar can contain SummerEve"});
 336  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.17", "kuali.type.type.relation.type.allowed", "kuali.atp.type.SummerEve", "kuali.atp.type.SessionG1", "1", "SummerEve can contain SessionG1"});
 337  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.18", "kuali.type.type.relation.type.allowed", "kuali.atp.type.SummerEve", "kuali.atp.type.SessionG2", "2", "SummerEve can contain SessionG2"});
 338  
         // key dates for fall term
 339  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.20", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.AdvanceRegistrationPeriod", "1", "Fall can have an advanced reg period"});
 340  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.21", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.InstructionalPeriod", "2", "Fall can have an instructional period"});
 341  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.22", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.RegistrationPeriod", "3", "Fall can have an reg period"});
 342  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.23", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.RegistrationBeginsTransfer", "4", "Fall can transfer reg period"});
 343  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.24", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.DropDeadlineWithoutRecord", "6", "Fall can have drop deadline"});
 344  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.25", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.FinalExamPeriod", "6", "Fall can have a final exam period"});
 345  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.26", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Fall", "kuali.atp.milestone.GradesDue", "7", "Fall can have a grading period"});
 346  
          // key dates for winter
 347  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.30", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.AdvanceRegistrationPeriod", "1", "Winter can have an advanced reg period"});
 348  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.31", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.InstructionalPeriod", "2", "Winter can have an instructional period"});
 349  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.32", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.RegistrationPeriod", "3", "Winter can have an reg period"});
 350  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.33", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.RegistrationBeginsTransfer", "4", "Winter can transfer reg period"});
 351  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.34", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.DropDeadlineWithoutRecord", "6", "Winter can have drop deadline"});
 352  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.35", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.FinalExamPeriod", "6", "Winter can have a final exam period"});
 353  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.36", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Winter", "kuali.atp.milestone.GradesDue", "7", "Winter can have a grading period"});
 354  
 
 355  
          // key dates for spring
 356  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.40", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.AdvanceRegistrationPeriod", "1", "Spring can have an advanced reg period"});
 357  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.41", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.InstructionalPeriod", "2", "Spring can have an instructional period"});
 358  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.42", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.RegistrationPeriod", "3", "Spring can have an reg period"});
 359  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.43", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.RegistrationBeginsTransfer", "4", "Spring can transfer reg period"});
 360  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.44", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.DropDeadlineWithoutRecord", "6", "Spring can have drop deadline"});
 361  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.45", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.FinalExamPeriod", "6", "Spring can have a final exam period"});
 362  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.46", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Spring", "kuali.atp.milestone.GradesDue", "7", "Spring can have a grading period"});
 363  
 
 364  
          // key dates for summer
 365  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.50", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.AdvanceRegistrationPeriod", "1", "Summer can have an advanced reg period"});
 366  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.51", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.InstructionalPeriod", "2", "Summer can have an instructional period"});
 367  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.52", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.RegistrationPeriod", "3", "Summer can have an reg period"});
 368  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.53", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.RegistrationBeginsTransfer", "4", "Summer can transfer reg period"});
 369  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.54", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.DropDeadlineWithoutRecord", "6", "Summer can have drop deadline"});
 370  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.55", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.FinalExamPeriod", "6", "Summer can have a final exam period"});
 371  0
         allowedArrays.add(new String[] {"kuali.atp.type.type.relation.allowed.56", "kuali.type.type.relation.type.allowed", "kuali.atp.type.Summer", "kuali.atp.milestone.GradesDue", "7", "Summer can have a grading period"});
 372  
 
 373  
  
 374  
         
 375  
         
 376  0
         for (String[] allowedArray : allowedArrays) {
 377  0
             associate(allowedArray[0], allowedArray[1], allowedArray[2], allowedArray[3], allowedArray[4], allowedArray[5]);
 378  
         }
 379  
 
 380  0
     }
 381  
 
 382  
     private TypeInfo createTypeInfo(String typeKey, String typeName, String descr, String refObjectUri) {
 383  0
         TypeInfo type = new TypeInfo();
 384  0
         type.setKey(typeKey);
 385  0
         type.setName(typeName);
 386  0
         type.setDescr(new RichTextHelper ().fromPlain(descr));
 387  0
         type.setRefObjectUri(refObjectUri);
 388  0
         type.setEffectiveDate(new Date ());
 389  0
         allTypes.put(type.getKey(), type);
 390  0
         return type;
 391  
     }
 392  
 
 393  
     private TypeTypeRelationInfo createTypeTypeRelationInfo(TypeInfo ownerType, TypeInfo relatedType) {
 394  0
         return createTypeTypeRelationInfo(ownerType.getKey(), relatedType.getKey());
 395  
     }
 396  
     private TypeTypeRelationInfo createTypeTypeRelationInfo(String ownerTypeKey, String relatedTypeKey) {
 397  0
         TypeTypeRelationInfo relation = new TypeTypeRelationInfo();
 398  0
         relation.setOwnerTypeKey(ownerTypeKey);
 399  0
         relation.setRelatedTypeKey(relatedTypeKey);
 400  
 
 401  0
         Map<String, TypeTypeRelationInfo> relationTypes = relationOwners.get(relation.getOwnerTypeKey());
 402  0
         if (null == relationTypes) {
 403  0
             relationTypes = (Map) new HashMap<String, Map<String, TypeTypeRelationInfo>>();
 404  0
             relationOwners.put(relation.getOwnerTypeKey(), relationTypes);
 405  
         }
 406  0
         relationTypes.put(relation.getRelatedTypeKey(), relation);
 407  
 
 408  0
         return relation;
 409  
     }
 410  
 
 411  
     private void associate(String relationKey, String relationTypeKey, String ownerTypeKey, String relatedTypeKey, String relationRank, String relationName) {
 412  0
         TypeTypeRelationInfo relation = new TypeTypeRelationInfo();
 413  
 
 414  0
         relation.setTypeKey(relationTypeKey);
 415  0
         relation.setOwnerTypeKey(ownerTypeKey);
 416  0
         relation.setRelatedTypeKey(relatedTypeKey);
 417  0
         relation.setRank(Integer.parseInt(relationRank));
 418  
 
 419  0
         Map<String, TypeInfo> types = allowedTypes.get(relation.getOwnerTypeKey());
 420  0
         if (null == types) {
 421  0
             types = (Map) new HashMap<String, Map<String, TypeInfo>>();
 422  0
             allowedTypes.put(relation.getOwnerTypeKey(), types);
 423  
         }
 424  0
         TypeInfo relatedType = allTypes.get(relation.getRelatedTypeKey());
 425  0
         types.put(relation.getRelatedTypeKey(), relatedType);
 426  0
     }
 427  
 }