%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.portals.graffito.jcr.version.VersionIterator |
|
|
1 | /* |
|
2 | * Copyright 2004-2005 The Apache Software Foundation or its licensors, |
|
3 | * as applicable. |
|
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 | package org.apache.portals.graffito.jcr.version; |
|
19 | ||
20 | import java.util.Iterator; |
|
21 | ||
22 | import javax.jcr.version.Version; |
|
23 | ||
24 | ||
25 | /** |
|
26 | * VersionIterator is a wrapper class for JCR VersionIterator |
|
27 | * |
|
28 | * @author <a href="mailto:christophe.lombart@gmail.com">Christophe Lombart</a> |
|
29 | * |
|
30 | */ |
|
31 | public class VersionIterator implements Iterator |
|
32 | { |
|
33 | ||
34 | private javax.jcr.version.VersionIterator versionIterator; |
|
35 | ||
36 | public VersionIterator(javax.jcr.version.VersionIterator versionIterator) |
|
37 | 0 | { |
38 | 0 | this.versionIterator = versionIterator; |
39 | 0 | } |
40 | ||
41 | /** |
|
42 | * |
|
43 | * @see java.util.Iterator#hasNext() |
|
44 | */ |
|
45 | public boolean hasNext() |
|
46 | { |
|
47 | 0 | return versionIterator.hasNext(); |
48 | } |
|
49 | ||
50 | /** |
|
51 | * |
|
52 | * @see java.util.Iterator#next() |
|
53 | */ |
|
54 | public Object next() |
|
55 | { |
|
56 | ||
57 | try |
|
58 | { |
|
59 | 0 | Version version = versionIterator.nextVersion(); |
60 | 0 | return new org.apache.portals.graffito.jcr.version.Version(version); |
61 | } |
|
62 | 0 | catch (Exception e) |
63 | { |
|
64 | 0 | return null; |
65 | } |
|
66 | ||
67 | } |
|
68 | ||
69 | /** |
|
70 | * |
|
71 | * @return the versionIterator size |
|
72 | */ |
|
73 | public long getSize() |
|
74 | { |
|
75 | 0 | return versionIterator.getSize(); |
76 | } |
|
77 | ||
78 | /** |
|
79 | * |
|
80 | * @see java.util.Iterator#remove() |
|
81 | */ |
|
82 | public void remove() |
|
83 | { |
|
84 | 0 | versionIterator.remove(); |
85 | ||
86 | 0 | } |
87 | ||
88 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |