1 23 24 package com.sun.enterprise.deployment; 25 26 import java.util.*; 27 import java.lang.reflect.*; 28 import com.sun.enterprise.util.LocalStringManagerImpl; 29 30 31 38 39 public final class RelationshipDescriptor extends Descriptor { 40 41 private static LocalStringManagerImpl localStrings = 42 new LocalStringManagerImpl(RelationshipDescriptor.class); 43 44 private RelationRoleDescriptor source; private RelationRoleDescriptor sink; 47 private boolean isBidirectional = true; 48 49 public RelationshipDescriptor() { 50 } 51 52 public boolean isOneOne() { 53 return (!source.getIsMany() && !sink.getIsMany()); 54 } 55 56 public boolean isOneMany() { 57 return (!source.getIsMany() && sink.getIsMany()); 58 } 59 60 public boolean isManyOne() { 61 return (source.getIsMany() && !sink.getIsMany()); 62 } 63 64 public boolean isManyMany() { 65 return (source.getIsMany() && sink.getIsMany()); 66 } 67 68 72 public boolean hasParticipant(Descriptor desc) { 73 return ( (source.getOwner() == desc) || (sink.getOwner() == desc) ); 74 } 75 76 public RelationRoleDescriptor getSource() 77 { 78 return source; 79 } 80 public void setSource(RelationRoleDescriptor source) 81 { 82 this.source = source; 83 } 84 85 public void setSink(RelationRoleDescriptor sink) 86 { 87 this.sink = sink; 88 } 89 public RelationRoleDescriptor getSink() 90 { 91 return sink; 92 } 93 94 public void setIsBidirectional(boolean isBidirectional) 95 { 96 this.isBidirectional = isBidirectional; 97 } 98 public boolean getIsBidirectional() 99 { 100 return isBidirectional; 101 } 102 103 public void print(StringBuffer toStringBuffer) { 104 toStringBuffer.append("From EJB ").append(getSource().getName() 105 ).append(" cmr field : ").append(getSource().getCMRField() 106 ).append("(").append(getSource().getCMRFieldType()).append(") to EJB ").append(getSink().getName() 107 ).append(" isMany ").append(getSource().getIsMany() 108 ).append(" cascade-delete ").append(getSource().getCascadeDelete()); 109 } 110 } 111 | Popular Tags |