01: /**
02: * Objective Database Abstraction Layer (ODAL)
03: * Copyright (c) 2004, The ODAL Development Group
04: * All rights reserved.
05: * For definition of the ODAL Development Group please refer to LICENCE.txt file
06: *
07: * Distributable under LGPL license.
08: * See terms of license at gnu.org.
09: */package com.completex.objective.components.persistency;
10:
11: import java.util.LinkedHashMap;
12: import java.util.Iterator;
13: import java.util.Set;
14: import java.util.Collection;
15: import java.util.Map;
16:
17: /**
18: * Map of <fkTableName, ForeignKeyEntries>
19: *
20: * @author Gennady Krizhevsky
21: */
22: public class ForeignKeys extends LinkedHashMap {
23:
24: public ForeignKeys(int initialCapacity, float loadFactor) {
25: super (initialCapacity, loadFactor);
26: }
27:
28: public ForeignKeys(int initialCapacity) {
29: super (initialCapacity);
30: }
31:
32: public ForeignKeys() {
33: }
34:
35: public ForeignKeys(Map m) {
36: super (m);
37: }
38:
39: public ForeignKeys(int initialCapacity, float loadFactor,
40: boolean accessOrder) {
41: super (initialCapacity, loadFactor, accessOrder);
42: }
43:
44: /**
45: * Extracts external only ForeignKeys object
46: * @return external only ForeignKeys object
47: */
48: public ForeignKeys getExternalForeignKeys() {
49: ForeignKeys foreignKeys = new ForeignKeys();
50: for (Iterator it = keySet().iterator(); it.hasNext();) {
51: String key = (String) it.next();
52: ForeignKeyEntries foreignKeyEntries = (ForeignKeyEntries) get(key);
53: if (foreignKeyEntries.isExternal()) {
54: foreignKeys.put(key, foreignKeyEntries);
55: }
56: }
57: return foreignKeys;
58: }
59:
60: }
|