1 /*
2 * Copyright 2004 Carlos Sanchez.
3 *
4 * Licensed under the Apache 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.apache.org/licenses/LICENSE-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 net.sf.oness.common.model.auditing;
17
18 import java.util.Collection;
19 import java.util.Iterator;
20 import java.util.LinkedList;
21
22
23 /***
24 * Utils to manage Auditable objects
25 *
26 * @author Carlos Sanchez
27 * @version $Revision: 1.1 $
28 */
29 public class AuditingUtils {
30
31 /***
32 * Get the values not deleted from a collection
33 *
34 * @param values
35 * Colection of Auditable objects
36 * @return
37 */
38 public static Collection notDeleted(Collection values) {
39 Collection c = new LinkedList();
40 Iterator iter = values.iterator();
41 while (iter.hasNext()) {
42 Auditable value = (Auditable) iter.next();
43 if (value.getTransactionTime().isOpen())
44 c.add(value);
45 }
46 return c;
47 }
48 }