01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.compass.gps.device.hibernate.scrollable.snapshot;
18:
19: import java.io.Serializable;
20: import java.util.HashMap;
21: import java.util.Iterator;
22:
23: /**
24: * An alias (usually <code>ScrollableResult</code>) level snapshot. Holds a
25: * collection of
26: * {@link org.compass.gps.device.hibernate.scrollable.snapshot.HibernateAliasRowSnapshot}s.
27: *
28: * @author kimchy
29: */
30: public class HibernateAliasSnapshot implements Serializable {
31:
32: private static final long serialVersionUID = 8610812620723482815L;
33:
34: private String alias;
35:
36: private HashMap rowEntries = new HashMap();
37:
38: public HibernateAliasSnapshot(String alias) {
39: this .alias = alias;
40: }
41:
42: public String getAlias() {
43: return alias;
44: }
45:
46: public void setAlias(String alias) {
47: this .alias = alias;
48: }
49:
50: public void putRow(HibernateAliasRowSnapshot rowSnapshot) {
51: this .rowEntries.put(rowSnapshot, rowSnapshot);
52: }
53:
54: public HibernateAliasRowSnapshot getRow(
55: HibernateAliasRowSnapshot rowSnapshot) {
56: return (HibernateAliasRowSnapshot) this .rowEntries
57: .get(rowSnapshot);
58: }
59:
60: public Iterator rowSnapshotIt() {
61: return this .rowEntries.values().iterator();
62: }
63:
64: public String toString() {
65: StringBuffer sb = new StringBuffer();
66: sb.append("alias [").append(alias).append("]");
67: for (Iterator it = rowEntries.values().iterator(); it.hasNext();) {
68: sb.append(it.next());
69: sb.append(", ");
70: }
71: return sb.toString();
72: }
73: }
|