From: <hib...@li...> - 2006-04-20 21:33:40
|
Author: ste...@jb... Date: 2006-04-20 17:32:07 -0400 (Thu, 20 Apr 2006) New Revision: 9775 Removed: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/EntityPersisterReference.java branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinNode.java branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinSource.java branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinType.java branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PersisterReference.java branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PropertyReference.java Log: refactor to PersisterReference stuff Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/EntityPersisterReference.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/EntityPersisterReference.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/EntityPersisterReference.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,40 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import org.hibernate.type.AssociationType; -import org.hibernate.persister.entity.Queryable; - -/** - * @author Steve Ebersole - */ -public class EntityPersisterReference extends Node implements PersisterReference { - private String entityName; - private String alias; - private Queryable persister; - - public void initialize(String entityName, String alias) { - // todo : would much prefer this stuff to be constructor injection... - // todo : need a SF reference to resolve the persister... - this.entityName = entityName; - this.alias = alias; - } - - public String getName() { - return alias == null ? entityName : entityName + " (" + alias + ")"; - } - - public String getAlias() { - return alias; - } - - public AssociationType getPersisterType() { - return ( AssociationType ) persister.getType(); - } - - public PropertyReference retrievePropertyReference(String propertyName) { - return null; - } - - public String getDisplayText() { - return null; - } -} Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinNode.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinNode.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinNode.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,58 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import antlr.Token; - -/** - * Represents an HQL join. The coneptualization here is strictly that of - * the join in terms of the context of the HQL query which may or may not have - * direct correlation to any SQL join. - * - * @author Steve Ebersole - */ -public class JoinNode extends Node { - - // todo : we need to decide the tree structure of a join subtree. - // based on that decision, we may need to have references here - // to both the left-hand and right-hand persister references - - private JoinType joinType; - private JoinSource source; - private boolean fetch; - - public JoinNode() { - } - - public JoinNode(Token tok) { - super( tok ); - } - - public JoinNode(JoinType joinType, JoinSource source, boolean fetch) { - this.joinType = joinType; - this.source = source; - this.fetch = fetch; - } - - public JoinType getJoinType() { - return joinType; - } - - public void setJoinType(JoinType joinType) { - this.joinType = joinType; - } - - public JoinSource getSource() { - return source; - } - - public void setSource(JoinSource source) { - this.source = source; - } - - public boolean isFetch() { - return fetch; - } - - public void setFetch(boolean fetch) { - this.fetch = fetch; - } -} Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinSource.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinSource.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinSource.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,52 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import java.util.HashMap; -import java.io.Serializable; - -/** - * Represents the source of a join, in the context of the HQL query. - * - * @author Steve Ebersole - */ -public class JoinSource implements Serializable { - - /** - * Indicates a join using the HQL explicit join syntax (i.e. the join keyword). - */ - public static final JoinSource EXPLICIT = new JoinSource( "explicit" ); - /** - * Indicates a join defined by implicit syntax (i.e. a path expression). - */ - public static final JoinSource IMPLICIT = new JoinSource( "implicit" ); - /** - * Indicates a join that is the result of an indexed operation (i.e. []) - * on an indexed or keyed collection (list or map). - */ - public static final JoinSource INDEXED = new JoinSource( "indexed" ); - /** - * Indicates a theta-style join (i.e. from A a, B b where a.id = b.id...) - */ - public static final JoinSource THETA = new JoinSource( "theta" ); - - private static final HashMap INSTANCES = new HashMap(); - static { - INSTANCES.put( EXPLICIT.name, EXPLICIT ); - INSTANCES.put( IMPLICIT.name, IMPLICIT ); - INSTANCES.put( INDEXED.name, INDEXED ); - INSTANCES.put( THETA.name, THETA ); - } - - private final String name; - - private JoinSource(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - private Object readResolve() { - return INSTANCES.get( name ); - } -} Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinType.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinType.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/JoinType.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,62 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import java.io.Serializable; -import java.util.HashMap; - -/** - * Represents a canonical join type. - * <p/> - * Note that currently HQL really only supports inner and left outer joins - * (though cross joins can also be achieved). This is because joins in HQL - * are always defined in relation to a mapped association. However, when we - * start allowing users to specify ad-hoc joins this may need to change to - * allow the full spectrum of join types. Thus the others are provided here - * currently just for completeness and for future expansion. - * - * @author Steve Ebersole - */ -public class JoinType implements Serializable { - /** - * Represents an inner join. - */ - public static final JoinType INNER = new JoinType( "inner" ); - /** - * Represents a left outer join. - */ - public static final JoinType LEFT = new JoinType( "left outer" ); - /** - * Represents a right outer join. - */ - public static final JoinType RIGHT = new JoinType( "right outer" ); - /** - * Represents a cross join (aka a cartesian product). - */ - public static final JoinType CROSS = new JoinType( "cross" ); - /** - * Represents a full join. - */ - public static final JoinType FULL = new JoinType( "full" ); - - private static final HashMap INSTANCES = new HashMap(); - static { - INSTANCES.put( INNER.name, INNER ); - INSTANCES.put( LEFT.name, LEFT ); - INSTANCES.put( RIGHT.name, RIGHT ); - INSTANCES.put( CROSS.name, CROSS ); - INSTANCES.put( FULL.name, FULL ); - } - - private final String name; - - private JoinType(String name) { - this.name = name; - } - - public String toString() { - return name; - } - - private Object readResolve() { - return INSTANCES.get( name ); - } -} Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PersisterReference.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PersisterReference.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PersisterReference.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,17 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import org.hibernate.type.AssociationType; - -/** - * Represents a reference to a persister (either entity or collection) within - * an HQL statement. - * - * @author Steve Ebersole - */ -public interface PersisterReference extends DisplayableNode { - public String getName(); - public String getAlias(); - public AssociationType getPersisterType(); - - public PropertyReference retrievePropertyReference(String propertyName); -} Deleted: branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PropertyReference.java =================================================================== --- branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PropertyReference.java 2006-04-20 21:31:04 UTC (rev 9774) +++ branches/HQL_ANTLR_2/Hibernate3/src/org/hibernate/hql/ast/tree/PropertyReference.java 2006-04-20 21:32:07 UTC (rev 9775) @@ -1,15 +0,0 @@ -package org.hibernate.hql.ast.tree; - -import org.hibernate.type.Type; - -/** - * Represents a reference to a particular persister-managed property; also - * some special cases such as a collection property reference (e.g., size). - * - * @author Steve Ebersole - */ -public interface PropertyReference extends DisplayableNode { - public String getPropertyName(); - public Type getPropertyType(); - public PersisterReference getPersisterReference(); -} |