001: /*
002:
003: Derby - Class org.apache.derby.iapi.sql.dictionary.SubConstraintDescriptor
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to you under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021:
022: package org.apache.derby.iapi.sql.dictionary;
023:
024: import org.apache.derby.catalog.UUID;
025: import org.apache.derby.iapi.services.sanity.SanityManager;
026:
027: /**
028: * This interface is used to get information from a SubConstraintDescriptor.
029: * A SubKeyConstraintDescriptor is used within the DataDictionary to
030: * get auxiliary constraint information from the system table
031: * that is auxiliary to sysconstraints.
032: *
033: * @version 0.1
034: * @author Jerry Brenner
035: */
036:
037: public abstract class SubConstraintDescriptor extends TupleDescriptor
038: implements UniqueTupleDescriptor {
039:
040: /**
041: public interface for this class:
042: <ol>
043: <li> public void setConstraintId(UUID constraintId);</li>
044: <li>public boolean hasBackingIndex();</li>
045: <li>public void setTableDescriptor(TableDescriptor td);</li>
046: <li>public TableDescriptor getTableDescriptor();</li>
047: </ol>
048: */
049:
050: // Implementation
051: TableDescriptor td;
052: UUID constraintId;
053:
054: /**
055: * Constructor for a SubConstraintDescriptorImpl
056: *
057: * @param constraintId The UUID of the constraint.
058: */
059:
060: SubConstraintDescriptor(UUID constraintId) {
061: this .constraintId = constraintId;
062: }
063:
064: /**
065: * Sets the UUID of the constraint.
066: *
067: * @param constraintId The constraint Id.
068: */
069: public void setConstraintId(UUID constraintId) {
070: this .constraintId = constraintId;
071: }
072:
073: /**
074: * Gets the UUID of the constraint.
075: *
076: * @return The UUID of the constraint.
077: */
078: public UUID getUUID() {
079: return constraintId;
080: }
081:
082: /**
083: * Does this constraint have a backing index?
084: *
085: * @return boolean Whether or not there is a backing index for this constraint.
086: */
087: public abstract boolean hasBackingIndex();
088:
089: /**
090: * Caches the TableDescriptor of the
091: * table that the constraint is on.
092: *
093: * @param td The TableDescriptor.
094: */
095: public void setTableDescriptor(TableDescriptor td) {
096: this .td = td;
097: }
098:
099: /**
100: * Returns the cached TableDescriptor, if
101: * supplied, that the constraint is on.
102: *
103: * @return The cached TableDescriptor,
104: * if supplied.
105: */
106: public TableDescriptor getTableDescriptor() {
107: return td;
108: }
109:
110: /**
111: * Convert the SubConstraintDescriptor to a String.
112: *
113: * @return A String representation of this SubConstraintDescriptor
114: */
115:
116: public String toString() {
117: if (SanityManager.DEBUG) {
118: return "constraintId: " + constraintId + "\n";
119: } else {
120: return "";
121: }
122: }
123:
124: }
|