%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.fulcrum.security.memory.MemoryHelper |
|
|
1 | package org.apache.fulcrum.security.memory; |
|
2 | /* |
|
3 | * Copyright 2001-2004 The Apache Software Foundation |
|
4 | * |
|
5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
6 | * you may not use this file except in compliance with the License. |
|
7 | * You may obtain a copy of the License at |
|
8 | * |
|
9 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
10 | * |
|
11 | * Unless required by applicable law or agreed to in writing, software |
|
12 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
14 | * See the License for the specific language governing permissions and |
|
15 | * limitations under the License. |
|
16 | */ |
|
17 | ||
18 | import java.util.Iterator; |
|
19 | import java.util.List; |
|
20 | ||
21 | import org.apache.fulcrum.security.entity.SecurityEntity; |
|
22 | ||
23 | ||
24 | /** |
|
25 | * |
|
26 | * This implementation keeps all objects in memory. This is mostly meant to help |
|
27 | * with testing and prototyping of ideas. |
|
28 | * |
|
29 | * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a> |
|
30 | * @version $Id: MemoryHelper.java 223060 2004-07-07 16:51:27Z epugh $ |
|
31 | */ |
|
32 | 30 | public class MemoryHelper |
33 | { |
|
34 | ||
35 | /** Our Unique ID counter */ |
|
36 | 30 | private static int uniqueId = 0; |
37 | ||
38 | public static Integer getUniqueId() |
|
39 | { |
|
40 | 615 | return new Integer(++uniqueId); |
41 | } |
|
42 | ||
43 | public static boolean checkExists(List securityEntities, String name){ |
|
44 | 1533 | boolean exists = false; |
45 | 16632 | for (Iterator i = securityEntities.iterator(); i.hasNext();) |
46 | { |
|
47 | 13566 | SecurityEntity securityEntity = (SecurityEntity) i.next(); |
48 | 13566 | if (securityEntity.getName().equalsIgnoreCase(name)) |
49 | { |
|
50 | 870 | exists = true; |
51 | } |
|
52 | } |
|
53 | 1533 | return exists; |
54 | } |
|
55 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |