1 21 package oracle.toplink.essentials.internal.ejb.cmp3.metadata.columns; 23 24 import java.util.List ; 25 import java.util.ArrayList ; 26 27 import javax.persistence.PrimaryKeyJoinColumn; 28 import javax.persistence.PrimaryKeyJoinColumns; 29 30 36 public class MetadataPrimaryKeyJoinColumns { 37 private String m_sourceTableName; 38 private String m_targetTableName; 39 protected List <MetadataPrimaryKeyJoinColumn> m_pkJoinColumns; 40 41 44 public MetadataPrimaryKeyJoinColumns(String sourceTableName, String targetTableName) { 45 m_sourceTableName = sourceTableName; 46 m_targetTableName = targetTableName; 47 m_pkJoinColumns = new ArrayList <MetadataPrimaryKeyJoinColumn>(); 48 } 49 50 53 public MetadataPrimaryKeyJoinColumns(PrimaryKeyJoinColumn[] primaryKeyJoinColumns, String sourceTableName, String targetTableName) { 54 this(sourceTableName, targetTableName); 55 56 for (PrimaryKeyJoinColumn pkJoinColumn : primaryKeyJoinColumns) { 58 m_pkJoinColumns.add(new MetadataPrimaryKeyJoinColumn(pkJoinColumn, sourceTableName, targetTableName)); 59 } 60 } 61 62 65 public MetadataPrimaryKeyJoinColumns(PrimaryKeyJoinColumns primaryKeyJoinColumns, PrimaryKeyJoinColumn primaryKeyJoinColumn, String sourceTableName, String targetTableName) { 66 this(sourceTableName, targetTableName); 67 68 if (primaryKeyJoinColumns != null) { 70 for (PrimaryKeyJoinColumn pkJoinColumn : primaryKeyJoinColumns.value()) { 71 m_pkJoinColumns.add(new MetadataPrimaryKeyJoinColumn(pkJoinColumn, sourceTableName, targetTableName)); 72 } 73 } 74 75 if (primaryKeyJoinColumn != null) { 77 m_pkJoinColumns.add(new MetadataPrimaryKeyJoinColumn(primaryKeyJoinColumn, sourceTableName, targetTableName)); 78 } 79 } 80 81 84 public List <MetadataPrimaryKeyJoinColumn> values() { 85 if (m_pkJoinColumns.isEmpty()) { 87 m_pkJoinColumns.add(new MetadataPrimaryKeyJoinColumn(m_sourceTableName, m_targetTableName)); 88 } 89 90 return m_pkJoinColumns; 91 } 92 93 96 public boolean loadedFromXML() { 97 return false; 98 } 99 100 103 public int size() { 104 return m_pkJoinColumns.size(); 105 } 106 } 107 | Popular Tags |