| 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.HashMap; |
| 22 | |
import java.util.HashSet; |
| 23 | |
import java.util.LinkedHashSet; |
| 24 | |
import java.util.List; |
| 25 | |
import java.util.Map; |
| 26 | |
import java.util.Set; |
| 27 | |
|
| 28 | 0 | public class TypeServiceMockImpl implements TypeService { |
| 29 | |
|
| 30 | 0 | private Map<String, TypeInfo> allTypes = new HashMap<String, TypeInfo>(); |
| 31 | 0 | private Map<String, Map<String, TypeTypeRelationInfo>> relationOwners = new HashMap<String, Map<String, TypeTypeRelationInfo>>(); |
| 32 | 0 | private Map<String, Map<String, TypeInfo>> allowedTypes = new HashMap<String, Map<String, TypeInfo>>(); |
| 33 | |
|
| 34 | |
{ |
| 35 | 0 | init(); |
| 36 | 0 | } |
| 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."); |
| 50 | |
} |
| 51 | |
|
| 52 | |
@Override |
| 53 | |
public List<String> getRefObjectUris(ContextInfo contextInfo) throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 54 | 0 | Set<String> set = new LinkedHashSet<String>(); |
| 55 | 0 | for (TypeInfo info : allTypes.values()) { |
| 56 | 0 | if (info.getRefObjectUri() != null) { |
| 57 | 0 | set.add(info.getRefObjectUri()); |
| 58 | |
} |
| 59 | |
} |
| 60 | 0 | return new ArrayList(set); |
| 61 | |
} |
| 62 | |
|
| 63 | |
@Override |
| 64 | |
public List<TypeInfo> getTypesByRefObjectUri(@WebParam(name = "refObjectUri") String refObjectUri, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 65 | 0 | throw new OperationFailedException("Method not implemented."); |
| 66 | |
} |
| 67 | |
|
| 68 | |
private TypeInfo getType(String typeKey) { |
| 69 | 0 | return allTypes.get(typeKey); |
| 70 | |
} |
| 71 | |
|
| 72 | |
|
| 73 | |
public List<TypeInfo> getTypesByRefObjectURI(@WebParam(name = "refObjectURI") String refObjectURI, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 74 | 0 | throw new OperationFailedException("Method not implemented."); |
| 75 | |
} |
| 76 | |
|
| 77 | |
@Override |
| 78 | |
public List<TypeInfo> getAllowedTypesForType(@WebParam(name = "ownerTypeKey") String ownerTypeKey, @WebParam(name = "relatedRefObjectURI") String relatedRefObjectURI, @WebParam(name = "context") ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException { |
| 79 | 0 | Map<String, TypeInfo> relationTypes = allowedTypes.get(ownerTypeKey); |
| 80 | 0 | if (relationTypes != null) { |
| 81 | 0 | return new ArrayList<TypeInfo>(relationTypes.values()); |
| 82 | |
} else { |
| 83 | 0 | return new ArrayList<TypeInfo>(); |
| 84 | |
} |
| 85 | |
} |
| 86 | |
|
| 87 | |
@Override |
| 88 | |
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 { |
| 89 | 0 | throw new OperationFailedException("Method not implemented."); |
| 90 | |
} |
| 91 | |
|
| 92 | |
@Override |
| 93 | |
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 { |
| 94 | 0 | throw new OperationFailedException("Method not implemented."); |
| 95 | |
} |
| 96 | |
|
| 97 | |
@Override |
| 98 | |
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 { |
| 99 | 0 | throw new OperationFailedException("Method not implemented."); |
| 100 | |
} |
| 101 | |
|
| 102 | |
@Override |
| 103 | |
public StatusInfo deleteType(@WebParam(name = "typeKey") String typeKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 104 | 0 | throw new OperationFailedException("Method not implemented."); |
| 105 | |
} |
| 106 | |
|
| 107 | |
@Override |
| 108 | |
public TypeTypeRelationInfo getTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 109 | 0 | throw new OperationFailedException("Method not implemented."); |
| 110 | |
} |
| 111 | |
|
| 112 | |
@Override |
| 113 | |
public List<TypeTypeRelationInfo> getTypeTypeRelationsByIds(@WebParam(name = "typeTypeRelationIds") List<String> typeTypeRelationIds, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 114 | 0 | throw new OperationFailedException("Method not implemented."); |
| 115 | |
} |
| 116 | |
|
| 117 | |
|
| 118 | |
public List<TypeTypeRelationInfo> getTypeTypeRelationsByKeys(@WebParam(name = "typeTypeRelationKeys") List<String> typeTypeRelationKeys, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 119 | 0 | throw new OperationFailedException("Method not implemented."); |
| 120 | |
} |
| 121 | |
|
| 122 | |
@Override |
| 123 | |
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 { |
| 124 | 0 | Map<String, TypeTypeRelationInfo> relationTypes = relationOwners.get(ownerTypeKey); |
| 125 | 0 | if (relationTypes != null) { |
| 126 | 0 | return new ArrayList<TypeTypeRelationInfo>(relationTypes.values()); |
| 127 | |
} else { |
| 128 | 0 | return new ArrayList<TypeTypeRelationInfo>(); |
| 129 | |
} |
| 130 | |
} |
| 131 | |
|
| 132 | |
@Override |
| 133 | |
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 { |
| 134 | 0 | throw new OperationFailedException("Method not implemented."); |
| 135 | |
} |
| 136 | |
|
| 137 | |
@Override |
| 138 | |
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 { |
| 139 | 0 | throw new OperationFailedException("Method not implemented."); |
| 140 | |
} |
| 141 | |
|
| 142 | |
@Override |
| 143 | |
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 { |
| 144 | 0 | throw new OperationFailedException("Method not implemented."); |
| 145 | |
} |
| 146 | |
|
| 147 | |
@Override |
| 148 | |
public StatusInfo deleteTypeTypeRelation(@WebParam(name = "typeTypeRelationKey") String typeTypeRelationKey, @WebParam(name = "contextInfo") ContextInfo contextInfo) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException { |
| 149 | 0 | throw new OperationFailedException("Method not implemented."); |
| 150 | |
} |
| 151 | |
|
| 152 | |
private void init() { |
| 153 | 0 | List<String[]> typeArrays = new ArrayList<String[]>(); |
| 154 | 0 | typeArrays.add(new String[]{"kuali.atp.type.AcademicCalendar", "Academic Calendar", "Academic Calendar", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 155 | 0 | typeArrays.add(new String[]{"kuali.atp.type.HolidayCalendar", "Holiday Calendar", "Holiday Calendar", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 156 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Fall", "Fall", "Fall Semester", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 157 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Spring", "Spring", "Spring Semester", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 158 | 0 | typeArrays.add(new String[]{"kuali.atp.type.FallSpring", "Fall-Spring", "Fall & Spring Semesters", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 159 | 0 | typeArrays.add(new String[]{"kuali.atp.type.AY", "AY", "Full Academic Year", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 160 | 0 | typeArrays.add(new String[]{"kuali.atp.type.FY", "FY", "Fiscal Year", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 161 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Holiday", "Holiday", "Holiday", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 162 | 0 | typeArrays.add(new String[]{"kuali.atp.type.SpringBreak", "SpringBreak", "Spring Break", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 163 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Thanksgiving", "Thanksgiving", "Thanksgiving", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 164 | 0 | typeArrays.add(new String[]{"kuali.atp.type.HalfFall1", "Fall Half-Semester 1", "Fall Half-Semester 1", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 165 | 0 | typeArrays.add(new String[]{"kuali.atp.type.HalfFall2", "Fall Half-Semester 2", "Fall Half-Semester 2", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 166 | 0 | typeArrays.add(new String[]{"kuali.atp.type.HalfSpring1", "Spring Half-Semester 1", "Spring Half-Semester 1", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 167 | 0 | typeArrays.add(new String[]{"kuali.atp.type.HalfSpring2", "Spring Half-Semester 1", "Spring Half-Semester 2", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 168 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Mini-mester1A", "Mini Semester 1A", "Mini Semester 1A", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 169 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Mini-mester1B", "Mini Semester 1B", "Mini Semester 1B", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 170 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Mini-mester2C", "Mini Semester 2C", "Mini Semester 2C", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 171 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Mini-mester2D", "Mini Semester 2D", "Mini Semester 2D", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 172 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Session1", "Session 1", "Session 1", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 173 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Session2", "Session 2", "Session 2", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 174 | 0 | typeArrays.add(new String[]{"kuali.atp.type.SessionG1", "Session G1", "Session G1", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 175 | 0 | typeArrays.add(new String[]{"kuali.atp.type.SessionG2", "Session G2", "Session G2", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 176 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Summer", "Summer", "Summer Semester", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 177 | 0 | typeArrays.add(new String[]{"kuali.atp.type.SummerEve", "Summer Eve", "Summer Eve", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 178 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Winter", "Winter", "Winter", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 179 | 0 | typeArrays.add(new String[]{"kuali.atp.type.Adhoc", "Ad hoc", "Ad hoc", "http://student.kuali.org/wsdl/atp/AtpInfo", "0"}); |
| 180 | 0 | for (String[] typeArray : typeArrays) { |
| 181 | 0 | createTypeInfo(typeArray[0], typeArray[1]); |
| 182 | |
} |
| 183 | |
|
| 184 | |
|
| 185 | 0 | Set<TypeInfo> termGroup = new HashSet<TypeInfo>(); |
| 186 | 0 | TypeInfo termGroupType = createTypeInfo("kuali.atp.type.group.term", null); |
| 187 | |
|
| 188 | 0 | termGroup.add(getType("kuali.atp.type.Fall")); |
| 189 | 0 | termGroup.add(getType("kuali.atp.type.FallSpring")); |
| 190 | 0 | termGroup.add(getType("kuali.atp.type.HalfFall1")); |
| 191 | 0 | termGroup.add(getType("kuali.atp.type.HalfFall2")); |
| 192 | 0 | termGroup.add(getType("kuali.atp.type.Winter")); |
| 193 | 0 | termGroup.add(getType("kuali.atp.type.Spring")); |
| 194 | 0 | termGroup.add(getType("kuali.atp.type.HalfSpring1")); |
| 195 | 0 | termGroup.add(getType("kuali.atp.type.HalfSpring2")); |
| 196 | 0 | termGroup.add(getType("kuali.atp.type.SpringBreak")); |
| 197 | 0 | termGroup.add(getType("kuali.atp.type.Summer")); |
| 198 | 0 | termGroup.add(getType("kuali.atp.type.SummerEve")); |
| 199 | 0 | termGroup.add(getType("kuali.atp.type.Session1")); |
| 200 | 0 | termGroup.add(getType("kuali.atp.type.Mini-mester1A")); |
| 201 | 0 | termGroup.add(getType("kuali.atp.type.Mini-mester1B")); |
| 202 | 0 | termGroup.add(getType("kuali.atp.type.Session2")); |
| 203 | 0 | termGroup.add(getType("kuali.atp.type.Mini-mester2C")); |
| 204 | 0 | termGroup.add(getType("kuali.atp.type.Mini-mester2D")); |
| 205 | 0 | termGroup.add(getType("kuali.atp.type.SessionG1")); |
| 206 | 0 | termGroup.add(getType("kuali.atp.type.SessionG2")); |
| 207 | 0 | termGroup.add(getType("kuali.atp.type.Adhoc")); |
| 208 | 0 | for (TypeInfo type : termGroup) { |
| 209 | 0 | createTypeTypeRelationInfo(termGroupType, type); |
| 210 | |
} |
| 211 | |
|
| 212 | |
|
| 213 | 0 | List<String[]> allowedArrays = new ArrayList<String[]>(); |
| 214 | 0 | 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"}); |
| 215 | 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"}); |
| 216 | 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"}); |
| 217 | 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"}); |
| 218 | 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"}); |
| 219 | 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"}); |
| 220 | 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"}); |
| 221 | 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"}); |
| 222 | 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"}); |
| 223 | 0 | 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"}); |
| 224 | 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"}); |
| 225 | 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"}); |
| 226 | 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"}); |
| 227 | 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"}); |
| 228 | 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"}); |
| 229 | 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.SummerEve", "6", "AcademicCalendar can contain SummerEve"}); |
| 230 | 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"}); |
| 231 | 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"}); |
| 232 | 0 | for (String[] allowedArray : allowedArrays) { |
| 233 | 0 | associate(allowedArray[0], allowedArray[1], allowedArray[2], allowedArray[3], allowedArray[4], allowedArray[5]); |
| 234 | |
} |
| 235 | |
|
| 236 | 0 | } |
| 237 | |
|
| 238 | |
private TypeInfo createTypeInfo(String typeKey, String typeName) { |
| 239 | 0 | TypeInfo type = new TypeInfo(); |
| 240 | 0 | type.setKey(typeKey); |
| 241 | 0 | type.setName(typeName); |
| 242 | 0 | allTypes.put(type.getKey(), type); |
| 243 | 0 | return type; |
| 244 | |
} |
| 245 | |
|
| 246 | |
private TypeTypeRelationInfo createTypeTypeRelationInfo(TypeInfo ownerType, TypeInfo relatedType) { |
| 247 | 0 | return createTypeTypeRelationInfo(ownerType.getKey(), relatedType.getKey()); |
| 248 | |
} |
| 249 | |
|
| 250 | |
private TypeTypeRelationInfo createTypeTypeRelationInfo(String ownerTypeKey, String relatedTypeKey) { |
| 251 | 0 | TypeTypeRelationInfo relation = new TypeTypeRelationInfo(); |
| 252 | 0 | relation.setOwnerTypeKey(ownerTypeKey); |
| 253 | 0 | relation.setRelatedTypeKey(relatedTypeKey); |
| 254 | |
|
| 255 | 0 | Map<String, TypeTypeRelationInfo> relationTypes = relationOwners.get(relation.getOwnerTypeKey()); |
| 256 | 0 | if (null == relationTypes) { |
| 257 | 0 | relationTypes = (Map) new HashMap<String, Map<String, TypeTypeRelationInfo>>(); |
| 258 | 0 | relationOwners.put(relation.getOwnerTypeKey(), relationTypes); |
| 259 | |
} |
| 260 | 0 | relationTypes.put(relation.getRelatedTypeKey(), relation); |
| 261 | |
|
| 262 | 0 | return relation; |
| 263 | |
} |
| 264 | |
|
| 265 | |
private void associate(String relationKey, String relationTypeKey, String ownerTypeKey, String relatedTypeKey, String relationRank, String relationName) { |
| 266 | 0 | TypeTypeRelationInfo relation = new TypeTypeRelationInfo(); |
| 267 | |
|
| 268 | 0 | relation.setTypeKey(relationTypeKey); |
| 269 | 0 | relation.setOwnerTypeKey(ownerTypeKey); |
| 270 | 0 | relation.setRelatedTypeKey(relatedTypeKey); |
| 271 | 0 | relation.setRank(Integer.parseInt(relationRank)); |
| 272 | |
|
| 273 | 0 | Map<String, TypeInfo> types = allowedTypes.get(relation.getOwnerTypeKey()); |
| 274 | 0 | if (null == types) { |
| 275 | 0 | types = (Map) new HashMap<String, Map<String, TypeInfo>>(); |
| 276 | 0 | allowedTypes.put(relation.getOwnerTypeKey(), types); |
| 277 | |
} |
| 278 | 0 | TypeInfo relatedType = allTypes.get(relation.getRelatedTypeKey()); |
| 279 | 0 | types.put(relation.getRelatedTypeKey(), relatedType); |
| 280 | 0 | } |
| 281 | |
} |