1 56 57 package org.objectstyle.cayenne.dataview.dvmodeler; 58 59 import org.jdom.*; 60 61 67 68 public class ObjRelationship extends DVObject { 69 ObjEntity sourceObjEntity; 70 ObjEntity targetObjEntity; 71 boolean toMany; 72 73 public ObjRelationship(DataMap dataMap, Element element) { 74 setName(element.getAttributeValue("name")); 75 String sourceName = element.getAttributeValue("source"); 76 sourceObjEntity = dataMap.getObjEntity(sourceName); 77 String targetName = element.getAttributeValue("target"); 78 targetObjEntity = dataMap.getObjEntity(targetName); 79 String toManyString = element.getAttributeValue("toMany"); 80 toMany = Boolean.valueOf(toManyString).booleanValue(); 81 } 82 83 public ObjEntity getSourceObjEntity(){ 84 return sourceObjEntity; 85 } 86 87 public ObjEntity getTargetObjEntity(){ 88 return targetObjEntity; 89 } 90 91 public boolean isToMany(){ 92 return toMany; 93 } 94 95 public String toString(){ 96 return getName(); 97 } 98 } 99 | Popular Tags |