Coverage Report - org.kuali.student.enrollment.lpr.mock.LuiPersonRelationServiceMockPersistenceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
LuiPersonRelationServiceMockPersistenceImpl
0%
0/170
0%
0/108
4.261
 
 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.util.ArrayList;
 19  
 import java.util.Collection;
 20  
 import java.util.HashMap;
 21  
 import java.util.List;
 22  
 import java.util.Map;
 23  
 import java.util.UUID;
 24  
 
 25  
 import org.kuali.student.common.dto.AttributeInfo;
 26  
 import org.kuali.student.common.dto.ContextInfo;
 27  
 import org.kuali.student.common.dto.CriteriaInfo;
 28  
 import org.kuali.student.common.dto.StateInfo;
 29  
 import org.kuali.student.common.dto.StatusInfo;
 30  
 import org.kuali.student.common.exceptions.AlreadyExistsException;
 31  
 import org.kuali.student.common.exceptions.DisabledIdentifierException;
 32  
 import org.kuali.student.common.exceptions.DoesNotExistException;
 33  
 import org.kuali.student.common.exceptions.InvalidParameterException;
 34  
 import org.kuali.student.common.exceptions.MissingParameterException;
 35  
 import org.kuali.student.common.exceptions.OperationFailedException;
 36  
 import org.kuali.student.common.exceptions.PermissionDeniedException;
 37  
 import org.kuali.student.common.exceptions.ReadOnlyException;
 38  
 import org.kuali.student.common.exceptions.VersionMismatchException;
 39  
 import org.kuali.student.common.infc.HoldsLprService;
 40  
 import org.kuali.student.common.infc.HoldsLuiService;
 41  
 import org.kuali.student.common.infc.StateInfc;
 42  
 import org.kuali.student.datadictionary.infc.DictionaryEntryInfc;
 43  
 import org.kuali.student.enrollment.lpr.dto.LuiPersonRelationInfo;
 44  
 import org.kuali.student.enrollment.lpr.service.LuiPersonRelationConstants;
 45  
 import org.kuali.student.enrollment.lpr.service.LuiPersonRelationService;
 46  
 import org.kuali.student.enrollment.lui.dto.LuiInfo;
 47  
 import org.kuali.student.enrollment.lui.service.LuiService;
 48  
 
 49  
 /**
 50  
  * @author nwright
 51  
  */
 52  0
 public class LuiPersonRelationServiceMockPersistenceImpl extends LuiPersonRelationServiceAdapter
 53  
         implements LuiPersonRelationService, HoldsLprService, HoldsLuiService {
 54  
 
 55  
     private LuiService luiService;
 56  
 
 57  
     @Override
 58  
     public LuiService getLuiService() {
 59  0
         return luiService;
 60  
     }
 61  
 
 62  
     @Override
 63  
     public void setLuiService(LuiService luiService) {
 64  0
         this.luiService = luiService;
 65  0
     }
 66  
     
 67  0
     private Map<String, LuiPersonRelationInfo> lprCache = new HashMap<String, LuiPersonRelationInfo>();
 68  
 
 69  
     @Override
 70  
     public List<String> createBulkRelationshipsForPerson(String personId,
 71  
             List<String> luiIdList,
 72  
             String relationState,
 73  
             String luiPersonRelationType,
 74  
             LuiPersonRelationInfo luiPersonRelationInfo,
 75  
             ContextInfo context)
 76  
             throws AlreadyExistsException, DoesNotExistException,
 77  
             DisabledIdentifierException, InvalidParameterException,
 78  
             MissingParameterException, OperationFailedException,
 79  
             PermissionDeniedException {
 80  0
         List<String> lprIds = new ArrayList<String>(luiIdList.size());
 81  0
         for (String luiId : luiIdList) {
 82  0
             LuiPersonRelationInfo lprInfo = new LuiPersonRelationInfo.Builder(luiPersonRelationInfo).luiId(luiId).build();
 83  
 
 84  0
             String lprId = this.createLuiPersonRelation(personId,
 85  
                     luiId,
 86  
                     luiPersonRelationType,
 87  
                     lprInfo,
 88  
                     context);
 89  0
             lprIds.add(lprId);
 90  0
         }
 91  0
         return lprIds;
 92  
     }
 93  
 
 94  
     @Override
 95  
     public String createLuiPersonRelation(String personId, String luiId,
 96  
             String luiPersonRelationType,
 97  
             LuiPersonRelationInfo luiPersonRelationInfo,
 98  
             ContextInfo context) throws
 99  
             AlreadyExistsException,
 100  
             DoesNotExistException,
 101  
             DisabledIdentifierException,
 102  
             InvalidParameterException,
 103  
             MissingParameterException,
 104  
             OperationFailedException,
 105  
             PermissionDeniedException {
 106  0
         MockHelper helper = new MockHelper();
 107  0
         LuiPersonRelationInfo.Builder builder = new LuiPersonRelationInfo.Builder(luiPersonRelationInfo);
 108  0
         builder.id(UUID.randomUUID().toString()).personId(personId).luiId(luiId).type(luiPersonRelationType).metaInfo(helper.createMeta(context));
 109  0
         LuiPersonRelationInfo copy = builder.build();
 110  0
         this.lprCache.put(copy.getId(), copy);
 111  0
         return copy.getId();
 112  
     }
 113  
 
 114  
     @Override
 115  
     public StatusInfo deleteLuiPersonRelation(String luiPersonRelationId, ContextInfo context) throws
 116  
             DoesNotExistException,
 117  
             InvalidParameterException,
 118  
             MissingParameterException,
 119  
             OperationFailedException,
 120  
             PermissionDeniedException {
 121  0
         if (this.lprCache.remove(luiPersonRelationId) == null) {
 122  0
             throw new DoesNotExistException(luiPersonRelationId);
 123  
         }
 124  0
         return new StatusInfo.Builder().success(Boolean.TRUE).build();
 125  
     }
 126  
 
 127  
     @Override
 128  
     public LuiPersonRelationInfo fetchLuiPersonRelation(String luiPersonRelationId,
 129  
             ContextInfo context)
 130  
             throws DoesNotExistException, InvalidParameterException,
 131  
             MissingParameterException, OperationFailedException,
 132  
             PermissionDeniedException {
 133  0
         LuiPersonRelationInfo bean = this.lprCache.get(
 134  
                 luiPersonRelationId);
 135  0
         if (bean == null) {
 136  0
             throw new DoesNotExistException(luiPersonRelationId);
 137  
         }
 138  0
         return bean;
 139  
     }
 140  
 
 141  
     @Override
 142  
     public List<String> findAllValidLuisForPerson(String personId,
 143  
             String luiPersonRelationType,
 144  
             String relationState,
 145  
             String atpId,
 146  
             ContextInfo context) throws
 147  
             DoesNotExistException,
 148  
             DisabledIdentifierException,
 149  
             InvalidParameterException,
 150  
             MissingParameterException,
 151  
             OperationFailedException,
 152  
             PermissionDeniedException {
 153  0
         List<String> luiIds = new ArrayList();
 154  0
         for (LuiPersonRelationInfo lpr : this.lprCache.values()) {
 155  0
             if (!personId.equals(lpr.getPersonId())) {
 156  0
                 continue;
 157  
             }
 158  0
             if (!luiPersonRelationType.equals(lpr.getType())) {
 159  0
                 continue;
 160  
             }
 161  0
             if (!relationState.equals(lpr.getState())) {
 162  0
                 continue;
 163  
             }
 164  0
             LuiInfo lui = luiService.getLui(lpr.getLuiId(), context);
 165  0
             if (!atpId.equals(lui.getAtpKey())) {
 166  0
                 continue;
 167  
             }
 168  0
             luiIds.add(lpr.getLuiId());
 169  0
         }
 170  0
         return luiIds;
 171  
     }
 172  
 
 173  
 //    @Override
 174  
 //    public List<String> findAllValidPeopleForLui(String luiId,
 175  
 //                                                 String luiPersonRelationType,
 176  
 //                                                 String relationState,
 177  
 //                                                 ContextInfo context) throws
 178  
 //            DoesNotExistException,
 179  
 //            DisabledIdentifierException,
 180  
 //            InvalidParameterException,
 181  
 //            MissingParameterException,
 182  
 //            OperationFailedException,
 183  
 //            PermissionDeniedException {
 184  
 //        List<String> personIds = new ArrayList();
 185  
 //        for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 186  
 //            if (!luiId.equals(bean.getLuiId())) {
 187  
 //                continue;
 188  
 //            }
 189  
 //            if (!luiPersonRelationType.equals(bean.getType())) {
 190  
 //                continue;
 191  
 //            }
 192  
 //            if (!relationState.equals(bean.getState())) {
 193  
 //                continue;
 194  
 //            }
 195  
 //            LuiInfo lui = luiService.getLui(bean.getLuiId(), context);
 196  
 //            personIds.add(bean.getPersonId());
 197  
 //        }
 198  
 //        return personIds;
 199  
 //    }
 200  
 
 201  
     
 202  
     @Override
 203  
     public List<StateInfo> getStatesByProcess(
 204  
             String processKey,
 205  
             ContextInfo context)
 206  
             throws DoesNotExistException, InvalidParameterException,
 207  
             MissingParameterException, OperationFailedException {
 208  
         // check type is valid
 209  0
         this.getLuiPersonRelationTypeEnum(processKey);
 210  0
         if (isInstructorType(processKey)) {
 211  0
             List<StateInfo> states = new ArrayList<StateInfo>(LuiPersonRelationStateEnum.COURSE_INSTRUCTOR_STATES.length);
 212  0
             for (StateInfc state : LuiPersonRelationStateEnum.COURSE_INSTRUCTOR_STATES) {
 213  0
                 states.add(new StateInfo.Builder(state).build());
 214  
             }
 215  0
             return states;
 216  
         }
 217  0
         if (processKey.equals(LuiPersonRelationConstants.ADVISOR_TYPE_KEY)) {
 218  0
             List<StateInfo> states = new ArrayList<StateInfo>(LuiPersonRelationStateEnum.COURSE_INSTRUCTOR_STATES.length);
 219  0
             for (StateInfc state : LuiPersonRelationStateEnum.PROGRAM_ADVISOR_STATES) {
 220  0
                 states.add(new StateInfo.Builder(state).build());
 221  
             }
 222  0
             return states;
 223  
         }
 224  0
         if (isStudentCourseType(processKey)) {
 225  0
             List<StateInfo> states = new ArrayList<StateInfo>(LuiPersonRelationStateEnum.COURSE_STUDENT_STATES.length);
 226  0
             for (StateInfc state : LuiPersonRelationStateEnum.COURSE_STUDENT_STATES) {
 227  0
                 states.add(new StateInfo.Builder(state).build());
 228  
             }
 229  0
             return states;
 230  
         }
 231  0
         if (isStudentProgramType(processKey)) {
 232  0
             List<StateInfo> states = new ArrayList<StateInfo>(LuiPersonRelationStateEnum.PROGRAM_STUDENT_STATES.length);
 233  0
             for (StateInfc state : LuiPersonRelationStateEnum.PROGRAM_STUDENT_STATES) {
 234  0
                 states.add(new StateInfo.Builder(state).build());
 235  
             }
 236  0
             return states;
 237  
         }
 238  0
         throw new IllegalArgumentException(processKey);
 239  
     }
 240  
 
 241  
     private boolean isInstructorType(String typeKey) {
 242  0
         for (LuiPersonRelationTypeEnum type : LuiPersonRelationTypeEnum.COURSE_INSTRUCTOR_TYPES) {
 243  0
             if (type.getKey().equals(typeKey)) {
 244  0
                 return true;
 245  
             }
 246  
         }
 247  0
         return false;
 248  
     }
 249  
 
 250  
     private boolean isStudentCourseType(String typeKey) {
 251  0
         for (LuiPersonRelationTypeEnum type : LuiPersonRelationTypeEnum.COURSE_STUDENT_TYPES) {
 252  0
             if (type.getKey().equals(typeKey)) {
 253  0
                 return true;
 254  
             }
 255  
         }
 256  0
         return false;
 257  
     }
 258  
 
 259  
     private boolean isStudentProgramType(String typeKey) {
 260  0
         if (LuiPersonRelationTypeEnum.REGISTRANT.getKey().equals(typeKey)) {
 261  0
             return true;
 262  
         }
 263  0
         return false;
 264  
     }
 265  
 
 266  
     @Override
 267  
     public List<String> findLuiIdsRelatedToPerson(String personId,
 268  
             String luiPersonRelationType,
 269  
             String relationState,
 270  
             ContextInfo context) throws
 271  
             DoesNotExistException,
 272  
             DisabledIdentifierException,
 273  
             InvalidParameterException,
 274  
             MissingParameterException,
 275  
             OperationFailedException,
 276  
             PermissionDeniedException {
 277  0
         List<String> luiIds = new ArrayList();
 278  0
         for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 279  0
             if (!personId.equals(bean.getPersonId())) {
 280  0
                 continue;
 281  
             }
 282  0
             if (!luiPersonRelationType.equals(bean.getType())) {
 283  0
                 continue;
 284  
             }
 285  0
             if (!relationState.equals(bean.getState())) {
 286  0
                 continue;
 287  
             }
 288  
 
 289  0
             luiIds.add(bean.getLuiId());
 290  
         }
 291  0
         return luiIds;
 292  
     }
 293  
 
 294  
     @Override
 295  
     public List<String> findLuiPersonRelationIds(String personId, String luiId,
 296  
             ContextInfo context) throws
 297  
             DoesNotExistException,
 298  
             DisabledIdentifierException,
 299  
             InvalidParameterException,
 300  
             MissingParameterException,
 301  
             OperationFailedException,
 302  
             PermissionDeniedException {
 303  0
         List<String> lprIds = new ArrayList();
 304  0
         for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 305  0
             if (!personId.equals(bean.getPersonId())) {
 306  0
                 continue;
 307  
             }
 308  0
             if (!luiId.equals(bean.getLuiId())) {
 309  0
                 continue;
 310  
             }
 311  0
             lprIds.add(bean.getId());
 312  
         }
 313  0
         return lprIds;
 314  
     }
 315  
 
 316  
     @Override
 317  
     public List<String> findLuiPersonRelationIdsForLui(String luiId,
 318  
             ContextInfo context) throws
 319  
             DoesNotExistException,
 320  
             InvalidParameterException,
 321  
             MissingParameterException,
 322  
             OperationFailedException,
 323  
             PermissionDeniedException {
 324  0
         List<String> lprIds = new ArrayList();
 325  0
         for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 326  0
             if (!luiId.equals(bean.getLuiId())) {
 327  0
                 continue;
 328  
             }
 329  0
             lprIds.add(bean.getId());
 330  
         }
 331  0
         return lprIds;
 332  
     }
 333  
 
 334  
     @Override
 335  
     public List<String> findLuiPersonRelationIdsForPerson(String personId,
 336  
             ContextInfo context)
 337  
             throws DoesNotExistException, DisabledIdentifierException,
 338  
             InvalidParameterException, MissingParameterException,
 339  
             OperationFailedException, PermissionDeniedException {
 340  0
         List<String> lprIds = new ArrayList();
 341  0
         for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 342  0
             if (!personId.equals(bean.getPersonId())) {
 343  0
                 continue;
 344  
             }
 345  0
             lprIds.add(bean.getId());
 346  
         }
 347  0
         return lprIds;
 348  
     }
 349  
 
 350  
     // TODO: Add this method to the service interface
 351  
     private LuiPersonRelationTypeEnum getLuiPersonRelationTypeEnum(String typeKey)
 352  
             throws DoesNotExistException {
 353  0
         for (LuiPersonRelationTypeEnum type : LuiPersonRelationTypeEnum.values()) {
 354  0
             if (type.getKey().equals(typeKey)) {
 355  0
                 return type;
 356  
             }
 357  
         }
 358  0
         throw new DoesNotExistException(typeKey);
 359  
     }
 360  
 
 361  
 //    @Override
 362  
 //    public List<LuiPersonRelationTypeInfo> findLuiPersonRelationTypesForLuiPersonRelation(
 363  
 //            String personId,
 364  
 //            String luiId,
 365  
 //            String relationState,
 366  
 //            ContextInfo context)
 367  
 //            throws DoesNotExistException, DisabledIdentifierException,
 368  
 //            InvalidParameterException, MissingParameterException,
 369  
 //            OperationFailedException, PermissionDeniedException {
 370  
 //        // TODO: reevaluate if this method is needed -- I can see no use case for it
 371  
 //        Map<String, LuiPersonRelationTypeInfo> types = new HashMap();
 372  
 //        for (LuiPersonRelationInfo lpr : this.lprCache.values()) {
 373  
 //            if (!lpr.getPersonId().equals(personId)) {
 374  
 //                continue;
 375  
 //            }
 376  
 //            if (!lpr.getLuiId().equals(luiId)) {
 377  
 //                continue;
 378  
 //            }
 379  
 //            if (!lpr.getState().equals(relationState)) {
 380  
 //                continue;
 381  
 //            }
 382  
 //            LuiPersonRelationTypeInfo type = this.getLuiPersonRelationType(lpr.getType());
 383  
 //            types.put(type.getKey(), type);
 384  
 //        }
 385  
 //        return new ArrayList(types.values());
 386  
 //    }
 387  
     @Override
 388  
     public List<LuiPersonRelationInfo> findLuiPersonRelations(String personId,
 389  
             String luiId,
 390  
             ContextInfo context)
 391  
             throws DoesNotExistException, DisabledIdentifierException,
 392  
             InvalidParameterException, MissingParameterException,
 393  
             OperationFailedException, PermissionDeniedException {
 394  0
         List<LuiPersonRelationInfo> lprs = new ArrayList();
 395  0
         for (LuiPersonRelationInfo bean : this.lprCache.values()) {
 396  0
             if (!personId.equals(bean.getPersonId())) {
 397  0
                 continue;
 398  
             }
 399  0
             if (!luiId.equals(bean.getLuiId())) {
 400  0
                 continue;
 401  
             }
 402  0
             lprs.add(bean);
 403  
         }
 404  0
         return lprs;
 405  
     }
 406  
 
 407  
     @Override
 408  
     public List<LuiPersonRelationInfo> findLuiPersonRelationsByIdList(
 409  
             List<String> luiPersonRelationIdList,
 410  
             ContextInfo context)
 411  
             throws DoesNotExistException,
 412  
             InvalidParameterException,
 413  
             MissingParameterException,
 414  
             OperationFailedException,
 415  
             PermissionDeniedException {
 416  0
         List<LuiPersonRelationInfo> lprs = new ArrayList();
 417  0
         for (String id : luiPersonRelationIdList) {
 418  0
             LuiPersonRelationInfo bean = this.fetchLuiPersonRelation(id, context);
 419  0
             lprs.add(bean);
 420  0
         }
 421  0
         return lprs;
 422  
     }
 423  
 
 424  
     @Override
 425  
     public List<LuiPersonRelationInfo> findLuiPersonRelationsForLui(String luiId,
 426  
             ContextInfo context)
 427  
             throws DoesNotExistException, InvalidParameterException,
 428  
             MissingParameterException, OperationFailedException,
 429  
             PermissionDeniedException {
 430  0
         List<String> ids = this.findLuiPersonRelationIdsForLui(luiId, context);
 431  0
         return this.findLuiPersonRelationsByIdList(ids, context);
 432  
     }
 433  
 
 434  
     @Override
 435  
     public List<LuiPersonRelationInfo> findLuiPersonRelationsForPerson(
 436  
             String personId,
 437  
             ContextInfo context)
 438  
             throws DoesNotExistException, DisabledIdentifierException,
 439  
             InvalidParameterException, MissingParameterException,
 440  
             OperationFailedException, PermissionDeniedException {
 441  0
         List<String> ids = this.findLuiPersonRelationIdsForPerson(personId, context);
 442  0
         return this.findLuiPersonRelationsByIdList(ids, context);
 443  
     }
 444  
 
 445  
     @Override
 446  
     public LuiPersonRelationInfo updateLuiPersonRelation(String luiPersonRelationId,
 447  
             LuiPersonRelationInfo luiPersonRelationInfo,
 448  
             ContextInfo context)
 449  
             throws DoesNotExistException,
 450  
             InvalidParameterException,
 451  
             MissingParameterException,
 452  
             ReadOnlyException,
 453  
             OperationFailedException,
 454  
             PermissionDeniedException,
 455  
             VersionMismatchException {
 456  0
         LuiPersonRelationInfo existing = this.lprCache.get(
 457  
                 luiPersonRelationId);
 458  0
         if (existing == null) {
 459  0
             throw new DoesNotExistException(luiPersonRelationId);
 460  
         }
 461  0
         if (!luiPersonRelationInfo.getMetaInfo().getVersionInd().equals(
 462  
                 existing.getMetaInfo().getVersionInd())) {
 463  0
             throw new VersionMismatchException(
 464  
                     "Updated by " + existing.getMetaInfo().getUpdateId() + " on "
 465  
                     + existing.getMetaInfo().getUpdateId() + " with version of "
 466  
                     + existing.getMetaInfo().getVersionInd());
 467  
         }
 468  0
         LuiPersonRelationInfo.Builder builder = new LuiPersonRelationInfo.Builder(luiPersonRelationInfo).metaInfo(new MockHelper ().updateMeta(existing.getMetaInfo(), context));
 469  
         // update attributes in order to be different than that in luiPersonRelationInfo
 470  0
         List<AttributeInfo> atts = new ArrayList<AttributeInfo>();
 471  0
         for (AttributeInfo att : luiPersonRelationInfo.getAttributes()) {
 472  0
             atts.add(new AttributeInfo.Builder(att).build());
 473  
         }
 474  0
         builder.attributes(atts);
 475  0
         LuiPersonRelationInfo copy = builder.build();
 476  0
         this.lprCache.put(luiPersonRelationId, copy);
 477  
         // mirroring what was done before immutable DTO's; why returning copy of copy?
 478  0
         return new LuiPersonRelationInfo.Builder(copy).build();
 479  
     }
 480  
 
 481  
     @Override
 482  
     public List<String> searchForLuiPersonRelationIds(CriteriaInfo criteria, ContextInfo context)
 483  
             throws InvalidParameterException,
 484  
             MissingParameterException,
 485  
             OperationFailedException,
 486  
             PermissionDeniedException {
 487  
 
 488  
         // get the dictionary entry for the LPR object
 489  0
         String dictionaryEntryKey = LuiPersonRelationConstants.REF_OBJECT_URI_LUI_PERSON_RELATION;
 490  
         DictionaryEntryInfc dictionaryEntry;
 491  
         try {
 492  0
             dictionaryEntry = this.getDataDictionaryEntry(dictionaryEntryKey, context);
 493  0
         } catch (DoesNotExistException ex) {
 494  0
            throw new OperationFailedException (dictionaryEntryKey + " is not in the dictionary", ex);
 495  0
         }
 496  
 
 497  
         // validate the criteria
 498  0
         CriteriaValidatorParser validator = new CriteriaValidatorParser();
 499  0
         validator.setCriteria(criteria);
 500  0
         validator.setDictionaryEntry(dictionaryEntry);
 501  0
         validator.validate();
 502  
 
 503  
         // now do the in memory matching
 504  0
         CriteriaMatcherInMemory<LuiPersonRelationInfo> matcher = new CriteriaMatcherInMemory<LuiPersonRelationInfo>();
 505  0
         matcher.setDictionaryEntry(dictionaryEntry);
 506  0
         matcher.setCriteria(criteria);
 507  0
         matcher.setParsedOperators(validator.getParsedOperators());
 508  0
         matcher.setParsedValues(validator.getParsedValues());
 509  0
         Collection<LuiPersonRelationInfo> allValues = this.lprCache.values();
 510  0
         List<LuiPersonRelationInfo> selected = matcher.findMatching(allValues);
 511  0
         List<String> selectedIds = new ArrayList<String>();
 512  0
         for (LuiPersonRelationInfo info : selected) {
 513  0
             selectedIds.add(info.getId());
 514  
         }
 515  0
         return selectedIds;
 516  
     }
 517  
     
 518  
     @Override
 519  
     public StateInfo getState(String processKey, String stateKey, ContextInfo context) throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException {
 520  
 
 521  0
         if (isInstructorType(processKey)) {
 522  0
             for (StateInfc state : LuiPersonRelationStateEnum.COURSE_INSTRUCTOR_STATES) {
 523  0
                 if(state.getKey().equals(stateKey)) return (new StateInfo.Builder(state).build());
 524  
             }
 525  
         }
 526  0
         if (processKey.equals(LuiPersonRelationConstants.ADVISOR_TYPE_KEY)) {
 527  0
             for (StateInfc state : LuiPersonRelationStateEnum.PROGRAM_ADVISOR_STATES) {
 528  0
                 if(state.getKey().equals(stateKey)) return (new StateInfo.Builder(state).build());
 529  
             }
 530  
         }
 531  0
         if (isStudentCourseType(processKey)) {
 532  0
             for (StateInfc state : LuiPersonRelationStateEnum.COURSE_STUDENT_STATES) {
 533  0
                 if(state.getKey().equals(stateKey)) return (new StateInfo.Builder(state).build());
 534  
             }
 535  
         }
 536  0
         if (isStudentProgramType(processKey)) {
 537  0
             for (StateInfc state : LuiPersonRelationStateEnum.PROGRAM_STUDENT_STATES) {
 538  0
                 if(state.getKey().equals(stateKey)) return (new StateInfo.Builder(state).build());
 539  
             }
 540  
         }
 541  
         
 542  0
         throw new DoesNotExistException("Requested state does not exist!");
 543  
     }
 544  
 }
 545