001: // THIS SOFTWARE IS PROVIDED BY SOFTARIS PTY.LTD. AND OTHER METABOSS
002: // CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING,
003: // BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
004: // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SOFTARIS PTY.LTD.
005: // OR OTHER METABOSS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
006: // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
007: // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
008: // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
009: // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
010: // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
011: // EVEN IF SOFTARIS PTY.LTD. OR OTHER METABOSS CONTRIBUTORS ARE ADVISED OF THE
012: // POSSIBILITY OF SUCH DAMAGE.
013: //
014: // Copyright 2000-2005 © Softaris Pty.Ltd. All Rights Reserved.
015: package com.metaboss.enterprise.ps;
016:
017: import java.io.Serializable;
018:
019: import com.metaboss.enterprise.datatypes.DataType;
020:
021: /** This structure contains the details of the required collection.
022: * It (or more precisely array of these) is passed to a storage record retrieval methods, like getAll() and
023: * getCount(). Passing it is in effect filtering down set of entities. Note that
024: * the actual search implementation details is not passed in this structure, so
025: * underlying storage implementation makes use of addtional collection metadata
026: * either at generation time or at run time or both). Each collection can define
027: * zero or more filtering criterias and zero or more ordering instructions.
028: * Collection itself can be arrived at in a number of different ways:
029: * <UL>
030: * <LI> By executing a set operation. Union, Intersection and Difference are supported.
031: * Union - all elements from both collections, Intersection - all elements found in both collections
032: * and Difference - all elements only found in first collection. In this case of set operations EntityRef, SetOperationName and
033: * FirstSetDetails and SecondSetDetails are populated.</LI>
034: * <LI> By selection of all domain entities associated with another entity.
035: * In this case only EntityRef, AssociationRef, AssociationRoleRef and AssociationRoleEntityInstanceId fields are populated</LI>
036: * <LI> By casting of one entity type to the other up and down along inheritance hierarchy.
037: * In this case only EntityRef and CastingSourceEntityRef are populated</LI>
038: * </UL>
039: * Note that DataTypes passed in this structure (as with all data fields passed
040: * to the storage layer) can not be concealed as this does not make any sence in selection process.
041: */
042: public final class STCollectionDetails implements Serializable {
043: /** Describes operation on one collection, result of which is collection containing subset
044: * of elements present in the original collection */
045: public final static String SETOPERATION_SUBSET = "Subset";
046:
047: /** Describes operation on two collections, result of which is collection containing all
048: * elements present in either (present in at least one of the two) collection */
049: public final static String SETOPERATION_UNION = "Union";
050:
051: /** Describes operation on two collections, result of which is collection containing all
052: * elements present in both collection (present in one and present in the other) */
053: public final static String SETOPERATION_INTERSECTION = "Intersection";
054:
055: /** Describes operation on two collections, result of which is collection containing all
056: * elements present in first collection and not present in the second */
057: public final static String SETOPERATION_DIFFERENCE = "Difference";
058:
059: /** Mandatory reference of the entity - type of this collection */
060: public String EntityRef;
061:
062: /** Array of filters to be applied to the collection. */
063: public STFilteringDetails[] Filters;
064:
065: /** Array of ordering instructions to be applied to the collection. */
066: public STOrderingDetails[] Sorters;
067:
068: /** This field together with ResultMaximumSize is used to limit this result
069: * set. This pair of fields is different to the
070: * SubsetStartOffset and SubsetMaximumSize in that this pair describes
071: * the narrowing of the filan result set where as the other describes the narrowing of the
072: * source result set */
073: public DataType ResultStartOffset;
074:
075: /** This field together with ResultStartOffset is used to limit this result
076: * set. This pair of fields is different to the
077: * SubsetStartOffset and SubsetMaximumSize in that this pair describes
078: * the narrowing of the filan result set where as the other describes the narrowing of the
079: * source result set */
080: public DataType ResultMaximumSize;
081:
082: /** Optional flag specifying that this collection has been created as full collection of all the entities in the domain */
083: public boolean AllEntitiesInDomain;
084:
085: /** Optional specific set operation name.
086: * Only populated if this collection has been created as the result of set operation */
087: public String SetOperationName;
088:
089: /** Collection details describing the first set.
090: * Only populated if this collection has been created as the result of set operation
091: * which is requiring the first set details */
092: public STCollectionDetails[] FirstSetDetails;
093:
094: /** Collection details describing the second set.
095: * Only populated if this collection has been created as the result of set operation
096: * which is requiring the second set details */
097: public STCollectionDetails[] SecondSetDetails;
098:
099: /** Optional reference of the role within given entity.
100: * Its presence makes this selector an association role selector. */
101: public String AssociationRoleRef;
102:
103: /** Optional instance identifier of the entity, where association comes from.
104: * If it is present it is include in the selection, selection is made of entities related to the given one */
105: public DataType AssociationRoleEntityInstanceId;
106:
107: /** Populated for cast operations. Contains the entity ref from which to cast */
108: public String CastingSourceEntityRef;
109:
110: /** Default constructor */
111: public STCollectionDetails() {
112: // Set all field values to null
113: EntityRef = null;
114: Filters = null;
115: Sorters = null;
116: ResultStartOffset = null;
117: ResultMaximumSize = null;
118: AllEntitiesInDomain = false;
119: SetOperationName = null;
120: FirstSetDetails = null;
121: SecondSetDetails = null;
122: AssociationRoleRef = null;
123: AssociationRoleEntityInstanceId = null;
124: CastingSourceEntityRef = null;
125: }
126:
127: /** Copy constructor */
128: public STCollectionDetails(STCollectionDetails pOther) {
129: // Copy all field values from the other structure
130: EntityRef = pOther.EntityRef;
131: Filters = pOther.Filters;
132: Sorters = pOther.Sorters;
133: ResultStartOffset = pOther.ResultStartOffset;
134: ResultMaximumSize = pOther.ResultMaximumSize;
135: AllEntitiesInDomain = pOther.AllEntitiesInDomain;
136: SetOperationName = pOther.SetOperationName;
137: FirstSetDetails = pOther.FirstSetDetails;
138: SecondSetDetails = pOther.SecondSetDetails;
139: AssociationRoleRef = pOther.AssociationRoleRef;
140: AssociationRoleEntityInstanceId = pOther.AssociationRoleEntityInstanceId;
141: CastingSourceEntityRef = pOther.CastingSourceEntityRef;
142: }
143: }
|