1 package xdoclet.modules.ojb.model; 2 3 17 18 import java.util.*; 19 20 import xdoclet.modules.ojb.constraints.*; 21 22 27 public class ModelDef extends DefBase 28 { 29 30 private SortedMap _classDefs = new TreeMap(); 31 32 private SortedMap _tableDefs = new TreeMap(); 33 34 37 public ModelDef() 38 { 39 super(""); 40 } 41 42 48 public boolean hasClass(String qualifiedName) 49 { 50 return _classDefs.containsKey(qualifiedName.replace('$', '.')); 51 } 52 53 61 public ClassDescriptorDef getClass(String qualifiedName) 62 { 63 return (ClassDescriptorDef)_classDefs.get(qualifiedName.replace('$', '.')); 64 } 65 66 72 public void addClass(ClassDescriptorDef classDef) 73 { 74 classDef.setOwner(this); 75 _classDefs.put(classDef.getQualifiedName(), classDef); 78 } 79 80 85 public Iterator getClasses() 86 { 87 return _classDefs.values().iterator(); 88 } 89 90 95 public int getNumClasses() 96 { 97 return _classDefs.size(); 98 } 99 100 107 public void process() throws ConstraintException 108 { 109 ClassDescriptorDef classDef; 110 111 for (Iterator it = getClasses(); it.hasNext();) 113 { 114 classDef = (ClassDescriptorDef)it.next(); 115 if (!classDef.hasBeenProcessed()) 116 { 117 classDef.process(); 118 } 119 } 120 } 121 122 128 public void checkConstraints(String checkLevel) throws ConstraintException 129 { 130 for (Iterator it = getClasses(); it.hasNext();) 132 { 133 ((ClassDescriptorDef)it.next()).checkConstraints(checkLevel); 134 } 135 new ModelConstraints().check(this, checkLevel); 139 } 140 } 141 | Popular Tags |