Coverage Report - org.kuali.student.enrollment.class1.lpr.service.impl.LprServiceMockImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
LprServiceMockImpl
0%
0/213
0%
0/132
3.125
 
 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.class1.lpr.service.impl;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Date;
 20  
 import java.util.LinkedHashMap;
 21  
 import java.util.List;
 22  
 import java.util.Map;
 23  
 import org.kuali.rice.core.api.criteria.QueryByCriteria;
 24  
 import org.kuali.student.enrollment.lpr.dto.LprInfo;
 25  
 import org.kuali.student.enrollment.lpr.dto.LprTransactionInfo;
 26  
 import org.kuali.student.enrollment.lpr.dto.LprTransactionItemInfo;
 27  
 import org.kuali.student.enrollment.lpr.service.LprService;
 28  
 import org.kuali.student.enrollment.lui.dto.LuiInfo;
 29  
 import org.kuali.student.enrollment.lui.service.LuiService;
 30  
 import org.kuali.student.r2.common.dto.BulkStatusInfo;
 31  
 import org.kuali.student.r2.common.dto.ContextInfo;
 32  
 import org.kuali.student.r2.common.dto.MetaInfo;
 33  
 import org.kuali.student.r2.common.dto.StatusInfo;
 34  
 import org.kuali.student.r2.common.dto.ValidationResultInfo;
 35  
 import org.kuali.student.r2.common.exceptions.AlreadyExistsException;
 36  
 import org.kuali.student.r2.common.exceptions.DataValidationErrorException;
 37  
 import org.kuali.student.r2.common.exceptions.DoesNotExistException;
 38  
 import org.kuali.student.r2.common.exceptions.InvalidParameterException;
 39  
 import org.kuali.student.r2.common.exceptions.MissingParameterException;
 40  
 import org.kuali.student.r2.common.exceptions.OperationFailedException;
 41  
 import org.kuali.student.r2.common.exceptions.PermissionDeniedException;
 42  
 import org.kuali.student.r2.common.exceptions.ReadOnlyException;
 43  
 import org.kuali.student.r2.common.exceptions.VersionMismatchException;
 44  
 import org.kuali.student.r2.common.util.constants.LprServiceConstants;
 45  
 import org.kuali.student.r2.core.class1.util.ValidationUtils;
 46  
 
 47  0
 public class LprServiceMockImpl implements LprService {
 48  
 
 49  
     private LuiService luiService;
 50  
 
 51  
     public LuiService getLuiService() {
 52  0
         return luiService;
 53  
     }
 54  
 
 55  
     public void setLuiService(LuiService luiService) {
 56  0
         this.luiService = luiService;
 57  0
     }
 58  
 
 59  
     @Override
 60  
     public LprInfo getLpr(String lprId, ContextInfo contextInfo)
 61  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 62  
             PermissionDeniedException {
 63  0
         if (!this.lprMap.containsKey(lprId)) {
 64  0
             throw new DoesNotExistException(lprId);
 65  
         }
 66  0
         return this.lprMap.get(lprId);
 67  
     }
 68  
 
 69  
     @Override
 70  
     public List<LprInfo> getLprsByIds(List<String> lprIds, ContextInfo contextInfo)
 71  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 72  
             PermissionDeniedException {
 73  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 74  0
         for (String id : lprIds) {
 75  0
             list.add(this.getLpr(id, contextInfo));
 76  
         }
 77  0
         return list;
 78  
     }
 79  
 
 80  
     @Override
 81  
     public List<String> getLuiIdsByPersonAndTypeAndState(String personId, String lprTypeKey, String relationState, ContextInfo contextInfo)
 82  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 83  
             PermissionDeniedException {
 84  0
         List<String> list = new ArrayList<String>();
 85  0
         for (LprInfo info : lprMap.values()) {
 86  0
             if (personId.equals(info.getPersonId())) {
 87  0
                 if (lprTypeKey.equals(info.getTypeKey())) {
 88  0
                     if (relationState.equals(info.getStateKey())) {
 89  0
                         list.add(info.getLuiId());
 90  
                     }
 91  
                 }
 92  
             }
 93  
         }
 94  0
         return list;
 95  
     }
 96  
 
 97  
     @Override
 98  
     public List<String> getPersonIdsByLuiAndTypeAndState(String luiId, String lprTypeKey, String relationState, ContextInfo contextInfo)
 99  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 100  
             PermissionDeniedException {
 101  0
         List<String> list = new ArrayList<String>();
 102  0
         for (LprInfo info : lprMap.values()) {
 103  0
             if (luiId.equals(info.getLuiId())) {
 104  0
                 if (lprTypeKey.equals(info.getTypeKey())) {
 105  0
                     if (relationState.equals(info.getStateKey())) {
 106  0
                         list.add(info.getId());
 107  
                     }
 108  
                 }
 109  
             }
 110  
         }
 111  0
         return list;
 112  
     }
 113  
 
 114  
     @Override
 115  
     public List<LprInfo> getLprsByPersonAndLui(String personId, String luiId, ContextInfo contextInfo)
 116  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 117  
             PermissionDeniedException {
 118  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 119  0
         for (LprInfo info : lprMap.values()) {
 120  0
             if (personId.equals(info.getPersonId())) {
 121  0
                 if (luiId.equals(info.getLuiId())) {
 122  0
                     list.add(info);
 123  
                 }
 124  
             }
 125  
         }
 126  0
         return list;
 127  
     }
 128  
 
 129  
     @Override
 130  
     public List<LprInfo> getLprsByPerson(String personId, ContextInfo contextInfo)
 131  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 132  
             PermissionDeniedException {
 133  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 134  0
         for (LprInfo info : lprMap.values()) {
 135  0
             if (personId.equals(info.getPersonId())) {
 136  0
                 list.add(info);
 137  
             }
 138  
         }
 139  0
         return list;
 140  
     }
 141  
 
 142  
     @Override
 143  
     public List<LprInfo> getLprsByLui(String luiId, ContextInfo contextInfo)
 144  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 145  
             PermissionDeniedException {
 146  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 147  0
         for (LprInfo info : lprMap.values()) {
 148  0
             if (luiId.equals(info.getLuiId())) {
 149  0
                 list.add(info);
 150  
             }
 151  
         }
 152  0
         return list;
 153  
     }
 154  
 
 155  
     @Override
 156  
     public List<LprInfo> getLprsByLuiAndType(String luiId, String lprTypeKey, ContextInfo contextInfo)
 157  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 158  
             PermissionDeniedException {
 159  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 160  0
         for (LprInfo info : lprMap.values()) {
 161  0
             if (luiId.equals(info.getTypeKey())) {
 162  0
                 if (lprTypeKey.equals(info.getTypeKey())) {
 163  0
                     list.add(info);
 164  
                 }
 165  
             }
 166  
         }
 167  0
         return list;
 168  
     }
 169  
 
 170  
     @Override
 171  
     public List<LprInfo> getLprsByPersonForAtp(String personId, String atpId, ContextInfo contextInfo)
 172  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 173  
             PermissionDeniedException {
 174  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 175  0
         for (LprInfo info : lprMap.values()) {
 176  0
             if (personId.equals(info.getPersonId())) {
 177  0
                 LuiInfo lui = luiService.getLui(info.getLuiId(), contextInfo);
 178  0
                 if (atpId.equals(lui.getAtpId())) {
 179  0
                     list.add(info);
 180  
                 }
 181  0
             }
 182  
         }
 183  0
         return list;
 184  
     }
 185  
 
 186  
     @Override
 187  
     public List<LprInfo> getLprsByPersonAndTypeForAtp(String personId, String atpId, String lprTypeKey, ContextInfo contextInfo)
 188  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 189  
             PermissionDeniedException {
 190  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 191  0
         for (LprInfo info : lprMap.values()) {
 192  0
             if (personId.equals(info.getPersonId())) {
 193  0
                 if (lprTypeKey.equals(info.getTypeKey())) {
 194  0
                     LuiInfo lui = luiService.getLui(info.getLuiId(), contextInfo);
 195  0
                     if (atpId.equals(lui.getAtpId())) {
 196  0
                         list.add(info);
 197  
                     }
 198  0
                 }
 199  
             }
 200  
         }
 201  0
         return list;
 202  
     }
 203  
 
 204  
     @Override
 205  
     public List<LprInfo> getLprsByPersonAndLuiType(String personId, String luiTypeKey, ContextInfo contextInfo)
 206  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 207  
             PermissionDeniedException {
 208  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 209  0
         for (LprInfo info : lprMap.values()) {
 210  0
             if (personId.equals(info.getTypeKey())) {
 211  0
                 if (luiTypeKey.equals(info.getTypeKey())) {
 212  0
                     list.add(info);
 213  
                 }
 214  
             }
 215  
         }
 216  0
         return list;
 217  
     }
 218  
 
 219  
     @Override
 220  
     public List<LprInfo> getLprsByPersonForAtpAndLuiType(String personId, String atpId, String luiTypeKey, ContextInfo contextInfo)
 221  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 222  
             PermissionDeniedException {
 223  0
         List<LprInfo> list = new ArrayList<LprInfo>();
 224  0
         for (LprInfo info : lprMap.values()) {
 225  0
             if (personId.equals(info.getTypeKey())) {
 226  0
                 if (atpId.equals(info.getTypeKey())) {
 227  0
                     if (luiTypeKey.equals(info.getTypeKey())) {
 228  0
                         list.add(info);
 229  
                     }
 230  
                 }
 231  
             }
 232  
         }
 233  0
         return list;
 234  
     }
 235  
 
 236  
     @Override
 237  
     public List<ValidationResultInfo> validateLpr(String validationType, String luiId, String personId, String lprTypeKey, LprInfo lprInfo, ContextInfo contextInfo)
 238  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 239  
             PermissionDeniedException {
 240  
         // validate
 241  0
         return new ArrayList<ValidationResultInfo>();
 242  
     }
 243  
 
 244  
     @Override
 245  
     public List<String> searchForLprIds(QueryByCriteria criteria, ContextInfo contextInfo)
 246  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 247  0
         throw new OperationFailedException("searchForLprIds has not been implemented");
 248  
     }
 249  
 
 250  
     @Override
 251  
     public List<LprInfo> searchForLprs(QueryByCriteria criteria, ContextInfo contextInfo)
 252  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 253  0
         throw new OperationFailedException("searchForLprs has not been implemented");
 254  
     }
 255  
     // cache variable 
 256  
     // The LinkedHashMap is just so the values come back in a predictable order
 257  0
     private Map<String, LprInfo> lprMap = new LinkedHashMap<String, LprInfo>();
 258  
 
 259  
     @Override
 260  
     public LprInfo createLpr(String personId, String luiId, String lprTypeKey, LprInfo lprInfo, ContextInfo contextInfo)
 261  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 262  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 263  
         // create 
 264  0
         if (!lprTypeKey.equals(lprInfo.getTypeKey())) {
 265  0
             throw new InvalidParameterException("The type parameter does not match the type on the info object");
 266  
         }
 267  
         // TODO: check the rest of the readonly fields that are specified on the create to make sure they match the info object
 268  0
         LprInfo copy = new LprInfo(lprInfo);
 269  0
         if (copy.getId() == null) {
 270  0
             copy.setId(lprMap.size() + "");
 271  
         }
 272  0
         copy.setMeta(newMeta(contextInfo));
 273  0
         lprMap.put(copy.getId(), copy);
 274  0
         return new LprInfo(copy);
 275  
     }
 276  
 
 277  
     @Override
 278  
     public List<BulkStatusInfo> createLprsForPerson(String personId, String lprTypeKey, List<LprInfo> lprInfos, ContextInfo contextInfo)
 279  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 280  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 281  0
         List<BulkStatusInfo> list = new ArrayList<BulkStatusInfo>(lprInfos.size());
 282  0
         for (LprInfo info : lprInfos) {
 283  0
             BulkStatusInfo bsi = new BulkStatusInfo();
 284  
             try {
 285  0
                 LprInfo created = this.createLpr(personId, info.getLuiId(), lprTypeKey, info, contextInfo);
 286  0
                 bsi.setSuccess(Boolean.TRUE);
 287  0
                 bsi.setId(created.getId());
 288  0
             } catch (DataValidationErrorException de) {
 289  0
                 bsi.setSuccess(Boolean.FALSE);
 290  0
                 bsi.setMessage(asString(de.getValidationResults()));
 291  0
             }
 292  0
             list.add(bsi);
 293  0
         }
 294  0
         return list;
 295  
     }
 296  
 
 297  
     private String asString(List<ValidationResultInfo> vris) {
 298  0
         StringBuilder sb = new StringBuilder();
 299  0
         String newLine = ";";
 300  0
         for (ValidationResultInfo vri : vris) {
 301  0
             sb.append(newLine);
 302  0
             newLine = "/n";
 303  0
             sb.append(vri.getMessage());
 304  
         }
 305  0
         return sb.toString();
 306  
     }
 307  
 
 308  
     @Override
 309  
     public List<BulkStatusInfo> createLprsForLui(String luiId, String lprTypeKey, List<LprInfo> lprInfos, ContextInfo contextInfo)
 310  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 311  
             OperationFailedException, PermissionDeniedException, ReadOnlyException {
 312  0
         List<BulkStatusInfo> list = new ArrayList<BulkStatusInfo>(lprInfos.size());
 313  0
         for (LprInfo info : lprInfos) {
 314  0
             BulkStatusInfo bsi = new BulkStatusInfo();
 315  
             try {
 316  0
                 LprInfo created = this.createLpr(info.getPersonId(), luiId, lprTypeKey, info, contextInfo);
 317  0
                 bsi.setSuccess(Boolean.TRUE);
 318  0
                 bsi.setId(created.getId());
 319  0
             } catch (DataValidationErrorException de) {
 320  0
                 bsi.setSuccess(Boolean.FALSE);
 321  0
                 bsi.setMessage(ValidationUtils.asString(de.getValidationResults()));
 322  0
             }
 323  0
             list.add(bsi);
 324  0
         }
 325  0
         return list;
 326  
     }
 327  
 
 328  
     @Override
 329  
     public LprInfo updateLpr(String lprId, LprInfo lprInfo, ContextInfo contextInfo)
 330  
             throws DoesNotExistException, DataValidationErrorException, InvalidParameterException, MissingParameterException,
 331  
             OperationFailedException, PermissionDeniedException, ReadOnlyException, VersionMismatchException {
 332  
         // update
 333  0
         if (!lprId.equals(lprInfo.getId())) {
 334  0
             throw new InvalidParameterException("The id parameter does not match the id on the info object");
 335  
         }
 336  0
         LprInfo copy = new LprInfo(lprInfo);
 337  0
         LprInfo old = this.getLpr(lprInfo.getId(), contextInfo);
 338  0
         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
 339  0
             throw new VersionMismatchException(old.getMeta().getVersionInd());
 340  
         }
 341  0
         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
 342  0
         this.lprMap.put(lprInfo.getId(), copy);
 343  0
         return new LprInfo(copy);
 344  
     }
 345  
 
 346  
     @Override
 347  
     public StatusInfo deleteLpr(String lprId, ContextInfo contextInfo)
 348  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 349  
             PermissionDeniedException {
 350  0
         if (this.lprMap.remove(lprId) == null) {
 351  0
             throw new DoesNotExistException(lprId);
 352  
         }
 353  0
         return newStatus();
 354  
     }
 355  
     // cache variable 
 356  
     // The LinkedHashMap is just so the values come back in a predictable order
 357  0
     private Map<String, LprTransactionInfo> lprTransactionMap = new LinkedHashMap<String, LprTransactionInfo>();
 358  
 
 359  
     @Override
 360  
     public LprTransactionInfo createLprTransaction(String lprTransactionType, LprTransactionInfo lprTransactionInfo, ContextInfo contextInfo)
 361  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 362  
             OperationFailedException, PermissionDeniedException {
 363  
         // create 
 364  0
         if (!lprTransactionType.equals(lprTransactionInfo.getTypeKey())) {
 365  0
             throw new InvalidParameterException("The type parameter does not match the type on the info object");
 366  
         }
 367  0
         LprTransactionInfo copy = new LprTransactionInfo(lprTransactionInfo);
 368  0
         if (copy.getId() == null) {
 369  0
             copy.setId(lprTransactionMap.size() + "");
 370  
         }
 371  0
         copy.setMeta(newMeta(contextInfo));
 372  
         
 373  0
         lprTransactionMap.put(copy.getId(), copy);
 374  0
         return new LprTransactionInfo(copy);
 375  
     }
 376  
 
 377  
     @Override
 378  
     public LprTransactionInfo createLprTransactionFromExisting(String lprTransactionId, ContextInfo contextInfo)
 379  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 380  
             OperationFailedException, PermissionDeniedException {
 381  0
         throw new OperationFailedException("createLprTransactionFromExisting has not been implemented");
 382  
     }
 383  
 
 384  
     @Override
 385  
     public LprTransactionInfo updateLprTransaction(String lprTransactionId, LprTransactionInfo lprTransactionInfo, ContextInfo contextInfo)
 386  
             throws DataValidationErrorException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 387  
             OperationFailedException, PermissionDeniedException, VersionMismatchException {
 388  
         // update
 389  0
         if (!lprTransactionId.equals(lprTransactionInfo.getId())) {
 390  0
             throw new InvalidParameterException("The id parameter does not match the id on the info object");
 391  
         }
 392  0
         LprTransactionInfo copy = new LprTransactionInfo(lprTransactionInfo);
 393  0
         LprTransactionInfo old = this.getLprTransaction(lprTransactionInfo.getId(), contextInfo);
 394  0
         if (!old.getMeta().getVersionInd().equals(copy.getMeta().getVersionInd())) {
 395  0
             throw new VersionMismatchException(old.getMeta().getVersionInd());
 396  
         }
 397  0
         copy.setMeta(updateMeta(copy.getMeta(), contextInfo));
 398  0
         this.lprTransactionMap.put(lprTransactionInfo.getId(), copy);
 399  0
         return new LprTransactionInfo(copy);
 400  
     }
 401  
 
 402  
     @Override
 403  
     public LprTransactionInfo getLprTransaction(String lprTransactionId, ContextInfo contextInfo)
 404  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 405  
             PermissionDeniedException {
 406  0
         if (!this.lprTransactionMap.containsKey(lprTransactionId)) {
 407  0
             throw new DoesNotExistException(lprTransactionId);
 408  
         }
 409  0
         return this.lprTransactionMap.get(lprTransactionId);
 410  
     }
 411  
 
 412  
     @Override
 413  
     public List<LprTransactionItemInfo> getLprTransactionItemsByPersonAndLui(String personId, String luiId, ContextInfo contextInfo)
 414  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 415  
             PermissionDeniedException {
 416  0
         List<LprTransactionItemInfo> list = new ArrayList<LprTransactionItemInfo>();
 417  0
         for (LprTransactionInfo trans : lprTransactionMap.values()) {
 418  0
             for (LprTransactionItemInfo info : trans.getLprTransactionItems()) {
 419  0
                 if (personId.equals(info.getPersonId())) {
 420  0
                     if (luiId.equals(info.getNewLuiId())) {
 421  0
                         list.add(info);
 422  0
                     } else if (luiId.equals(info.getExistingLuiId())) {
 423  0
                         list.add(info);
 424  
                     }
 425  
                 }
 426  
             }
 427  
         }
 428  0
         return list;
 429  
     }
 430  
 
 431  
     @Override
 432  
     public List<LprTransactionInfo> getLprTransactionsByIds(List<String> lprTransactionIds, ContextInfo contextInfo)
 433  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 434  
             PermissionDeniedException {
 435  0
         List<LprTransactionInfo> list = new ArrayList<LprTransactionInfo>();
 436  0
         for (String id : lprTransactionIds) {
 437  0
             list.add(this.getLprTransaction(id, contextInfo));
 438  
         }
 439  0
         return list;
 440  
     }
 441  
 
 442  
     @Override
 443  
     public List<LprTransactionItemInfo> getLprTransactionItemsByResultingLpr(String lprId, ContextInfo contextInfo)
 444  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 445  0
         List<LprTransactionItemInfo> list = new ArrayList<LprTransactionItemInfo>();
 446  0
         for (LprTransactionInfo trans : this.lprTransactionMap.values()) {
 447  0
             for (LprTransactionItemInfo info : trans.getLprTransactionItems()) {
 448  0
                 if (info.getLprTransactionItemResult() != null) {
 449  0
                     if (lprId.equals(info.getLprTransactionItemResult().getResultingLprId())) {
 450  0
                         list.add(info);
 451  
                     }
 452  
                 }
 453  
             }
 454  
         }
 455  0
         return list;
 456  
     }
 457  
 
 458  
     @Override
 459  
     public List<LprTransactionItemInfo> getLprTransactionItemsByLui(String luiId, ContextInfo contextInfo)
 460  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 461  0
         List<LprTransactionItemInfo> list = new ArrayList<LprTransactionItemInfo>();
 462  
 
 463  0
         for (LprTransactionInfo trans : lprTransactionMap.values()) {
 464  0
             for (LprTransactionItemInfo info : trans.getLprTransactionItems()) {
 465  0
                 if (luiId.equals(info.getNewLuiId())) {
 466  0
                     list.add(info);
 467  0
                 } else if (luiId.equals(info.getExistingLuiId())) {
 468  0
                     list.add(info);
 469  
                 }
 470  
             }
 471  
         }
 472  0
         return list;
 473  
     }
 474  
 
 475  
     @Override
 476  
     public List<LprTransactionInfo> getUnsubmittedLprTransactionsByRequestingPersonAndAtp(String requestingPersonId, String atpId, ContextInfo contextInfo)
 477  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 478  0
         List<LprTransactionInfo> list = new ArrayList<LprTransactionInfo>();
 479  0
         for (LprTransactionInfo info : lprTransactionMap.values()) {
 480  0
             if (requestingPersonId.equals(info.getRequestingPersonId())) {
 481  0
                 if (atpId.equals(info.getAtpId())) {
 482  0
                     if (info.getStateKey().equals(LprServiceConstants.LPRTRANS_NEW_STATE_KEY)) {
 483  0
                         list.add(info);
 484  
                     }
 485  
                 }
 486  
             }
 487  
         }
 488  0
         return list;
 489  
     }
 490  
 
 491  
     @Override
 492  
     public StatusInfo deleteLprTransaction(String lprTransactionId, ContextInfo contextInfo)
 493  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 494  
             PermissionDeniedException {
 495  0
         if (this.lprTransactionMap.remove(lprTransactionId) == null) {
 496  0
             throw new DoesNotExistException(lprTransactionId);
 497  
         }
 498  0
         return newStatus();
 499  
     }
 500  
 
 501  
     @Override
 502  
     public LprTransactionInfo processLprTransaction(String lprTransactionId, ContextInfo contextInfo)
 503  
             throws AlreadyExistsException, DoesNotExistException, InvalidParameterException, MissingParameterException,
 504  
             OperationFailedException, PermissionDeniedException {
 505  0
         throw new OperationFailedException("processLprTransaction has not been implemented");
 506  
     }
 507  
 
 508  
     @Override
 509  
     public List<ValidationResultInfo> verifyLprTransaction(String lprTransactionId, ContextInfo contextInfo)
 510  
             throws DoesNotExistException, InvalidParameterException, MissingParameterException, OperationFailedException,
 511  
             PermissionDeniedException {
 512  0
         throw new OperationFailedException("verifyLprTransaction has not been implemented");
 513  
     }
 514  
 
 515  
     @Override
 516  
     public List<LprTransactionInfo> searchForLprTransactions(QueryByCriteria criteria, ContextInfo contextInfo)
 517  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 518  0
         throw new OperationFailedException("searchForLprTransactions has not been implemented");
 519  
     }
 520  
 
 521  
     @Override
 522  
     public List<String> searchForLprTransactionIds(QueryByCriteria criteria, ContextInfo contextInfo)
 523  
             throws InvalidParameterException, MissingParameterException, OperationFailedException, PermissionDeniedException {
 524  0
         throw new OperationFailedException("searchForLprTransactionIds has not been implemented");
 525  
     }
 526  
 
 527  
     private MetaInfo newMeta(ContextInfo context) {
 528  0
         MetaInfo meta = new MetaInfo();
 529  0
         meta.setCreateId(context.getPrincipalId());
 530  0
         meta.setCreateTime(new Date());
 531  0
         meta.setUpdateId(context.getPrincipalId());
 532  0
         meta.setUpdateTime(meta.getCreateTime());
 533  0
         meta.setVersionInd("0");
 534  0
         return meta;
 535  
     }
 536  
 
 537  
     private StatusInfo newStatus() {
 538  0
         StatusInfo status = new StatusInfo();
 539  0
         status.setSuccess(Boolean.TRUE);
 540  0
         return status;
 541  
     }
 542  
 
 543  
     private MetaInfo updateMeta(MetaInfo old, ContextInfo context) {
 544  0
         MetaInfo meta = new MetaInfo(old);
 545  0
         meta.setUpdateId(context.getPrincipalId());
 546  0
         meta.setUpdateTime(new Date());
 547  0
         meta.setVersionInd((Integer.parseInt(meta.getVersionInd()) + 1) + "");
 548  0
         return meta;
 549  
     }
 550  
 }