001: /*
002:
003: This software is OSI Certified Open Source Software.
004: OSI Certified is a certification mark of the Open Source Initiative.
005:
006: The license (Mozilla version 1.0) can be read at the MMBase site.
007: See http://www.MMBase.org/license
008:
009: */
010: package org.mmbase.storage.search;
011:
012: /**
013: * A relationstep refers to a table of relations between the previous and next step. Relationstep are used to create a path of related objects.
014: * <p>
015: * This corresponds to a constraint joining the three tables in SQL SELECT-syntax.
016: * <p>
017: * Note that tables can also be joined using FieldCompareConstraints.
018: *
019: * @author Rob van Maris
020: * @version $Id: RelationStep.java,v 1.10 2007/12/06 08:13:36 michiel Exp $
021: * @since MMBase-1.7
022: */
023: public interface RelationStep extends Step {
024:
025: /**
026: * Directionality following relations both ways (source to destination AND destination to source).
027: * Whether unidirectional relations are shown is dependent on the value of the checkedDirectionality property.
028: */
029: int DIRECTIONS_BOTH = 0;
030:
031: /**
032: * Directionality following relations from source to destination.
033: * E.g. where the previous step is source and the next step is destination.
034: * Whether unidirectional relations are shown is dependent on the value of the checkedDirectionality property.
035: */
036: int DIRECTIONS_DESTINATION = 1;
037:
038: /**
039: * Directionality following relations from destination to source.
040: * E.g. where the previous step is destination and the next step is source.
041: * This value ignores the value of the checkedDirectionality property.
042: */
043: int DIRECTIONS_SOURCE = 2;
044:
045: /**
046: * Directionality following relations both ways, including unidirectional relations.
047: * This value ignores the value of the checkedDirectionality property.
048: */
049: int DIRECTIONS_ALL = 4;
050:
051: /**
052: * Directionality following relations from destination to source.
053: * E.g. where the previous step is destination and the next step is source.
054: * Whether unidirectional relations are shown is dependent on the value of the checkedDirectionality property.
055: */
056: int DIRECTIONS_EITHER = 5;
057:
058: /**
059: * Directionality names corresponding to the direction values.
060: * As a result DIRECTIONALITY_DESCRIPTIONS[directionality] is the directionality
061: * name: "both", "destination", "source", "all" or "either".
062: */
063: public final static String[] DIRECTIONALITY_DESCRIPTIONS = new String[] {
064: "both", "destination", "source", null, // reserved
065: "all", "either" };
066:
067: /**
068: * Gets the value of the checkedDirectionality property. This property
069: * determines how uni/bi-directionality affects which relations are
070: * followed from destination to source, when the directionality property
071: * is set to {@link #DIRECTIONS_SOURCE} or {@link #DIRECTIONS_BOTH}.
072: * <p>
073: * When this value is true, only bi-directional relations are followed
074: * from destination to source.
075: * Otherwise unidirectional relations are followed from destination to
076: * source as well.
077: */
078: boolean getCheckedDirectionality();
079:
080: /**
081: * Gets the directionality mode used with this relation. This is one of
082: * values defined in this class.
083: */
084: int getDirectionality();
085:
086: /**
087: * Gets the role for this relation, if specified.
088: * I.e. the nodenumber of the corresponding
089: * {@link org.mmbase.module.corebuilders.RelDef RelDef} node, or
090: * <code>null</code>.
091: */
092: Integer getRole();
093:
094: /**
095: * Gets the previous step.
096: */
097: Step getPrevious();
098:
099: /**
100: * Gets the next step.
101: */
102: Step getNext();
103:
104: /**
105: * Compares this relationstep to the specified object. The result is
106: * <code>true</code> if and only if the argument is a non-null
107: * RelationStep object with the same directionality and role,
108: * associated with the same tablename,
109: * using the same alias and including the same nodes.
110: *
111: * @param obj The object to compare with.
112: * @return <code>true</code> if the objects are equal,
113: * <code>false</code> otherwise.
114: * @see Step#equals
115: */
116: public boolean equals(Object obj);
117:
118: // javadoc is inherited
119: public int hashCode();
120:
121: /**
122: * Returns a string representation of this RelationStep.
123: * The string representation has the form
124: * "RelationStep(tablename:<tablename>, alias:<alias>,
125: * nodes:<nodes>, dir:<dir>, role:<role>)"
126: * where
127: * <ul>
128: * <li><em><tablename></em> is the tablename returnedby
129: * {@link #getTableName getTableName()}
130: * <li><em><alias></em> is the alias returned by {@link #getAlias getAlias()}
131: * <li><em><nodes></em> is the string representation of the ordered list
132: * of nodenumbers returned by {@link #getNodes getNodes()}
133: * <li><em><dir></em> is the name of
134: * the directionality returned by
135: * {@link #getDirectionality getDirectionality()}
136: * <li><em><role></em> is the role returned by
137: * {@link #getRole getRole()}
138: * </ul>
139: *
140: * @return A string representation of this RelationStep.
141: */
142: public String toString();
143:
144: }
|