Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ServicesFilterByKeys |
|
| 2.0;2 |
1 | /* | |
2 | * Copyright 2010 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.contract.model.util; | |
17 | ||
18 | import java.util.ArrayList; | |
19 | import java.util.List; | |
20 | ||
21 | import org.kuali.student.contract.model.Service; | |
22 | ||
23 | /** | |
24 | * | |
25 | * @author nwright | |
26 | */ | |
27 | public class ServicesFilterByKeys implements ServicesFilter | |
28 | { | |
29 | List <String> keys; | |
30 | ||
31 | public ServicesFilterByKeys (List<String> keys) | |
32 | 0 | { |
33 | 0 | this.keys = keys; |
34 | 0 | } |
35 | ||
36 | ||
37 | @Override | |
38 | public List<Service> filter (List<Service> services) | |
39 | { | |
40 | 0 | List <Service> list = new ArrayList (); |
41 | 0 | for (Service target : services) |
42 | { | |
43 | 0 | if (keys.contains (target.getKey ())) |
44 | { | |
45 | 0 | list.add (target); |
46 | } | |
47 | } | |
48 | 0 | return list; |
49 | } | |
50 | } |