001: /**
002: * Objective Database Abstraction Layer (ODAL)
003: * Copyright (c) 2004, The ODAL Development Group
004: * All rights reserved.
005: * For definition of the ODAL Development Group please refer to LICENCE.txt file
006: *
007: * Distributable under LGPL license.
008: * See terms of license at gnu.org.
009: */package com.completex.objective.components.persistency;
010:
011: /**
012: * Represents foreign key entry - pair of localColumn and foreignColumn names
013: *
014: * @author Gennady Krizhevsky
015: */
016: public class ForeignKeyEntry implements ModelConsts {
017:
018: private String foreignColumn;
019: private String localColumn;
020: private boolean internal;
021:
022: public ForeignKeyEntry() {
023: }
024:
025: public ForeignKeyEntry(String foreignColumn, String localColumn) {
026: this .foreignColumn = foreignColumn;
027: this .localColumn = localColumn;
028: }
029:
030: public String getForeignColumn() {
031: return foreignColumn;
032: }
033:
034: public void setForeignColumn(String referenceColumn) {
035: this .foreignColumn = referenceColumn;
036: }
037:
038: public String getLocalColumn() {
039: return localColumn;
040: }
041:
042: public void setLocalColumn(String localColumn) {
043: this .localColumn = localColumn;
044: }
045:
046: /**
047: *
048: * @return true if the value is from internal descriptor
049: */
050: public boolean isInternal() {
051: return internal;
052: }
053:
054: /**
055: *
056: * @return true if the value is from external descriptor
057: */
058: public boolean isExternal() {
059: return !internal;
060: }
061:
062: /**
063: *
064: * @param internal true if the value is from internal descriptor
065: */
066: public void setInternal(boolean internal) {
067: this .internal = internal;
068: }
069:
070: public String toString() {
071: return new StringBuffer().append("localColumn = ").append(
072: localColumn).append(" ").append("foreignColumn = ")
073: .append(foreignColumn).toString();
074: }
075:
076: public boolean equals(Object o) {
077: if (this == o)
078: return true;
079: if (o == null || getClass() != o.getClass())
080: return false;
081:
082: final ForeignKeyEntry that = (ForeignKeyEntry) o;
083:
084: if (foreignColumn != null ? !foreignColumn
085: .equals(that.foreignColumn)
086: : that.foreignColumn != null)
087: return false;
088: return !(localColumn != null ? !localColumn
089: .equals(that.localColumn) : that.localColumn != null);
090:
091: }
092:
093: public int hashCode() {
094: int result;
095: result = (foreignColumn != null ? foreignColumn.hashCode() : 0);
096: result = 29 * result
097: + (localColumn != null ? localColumn.hashCode() : 0);
098: return result;
099: }
100: }
|