Package org.jboss.ejb.plugins.cmp.ejbql

Examples of org.jboss.ejb.plugins.cmp.ejbql.Node


/*  724 */     return data;
/*      */   }
/*      */
/*      */   public Object visit(ASTMemberOf node, Object data)
/*      */   {
/*  729 */     Node member = node.jjtGetChild(0);
/*  730 */     ASTPath colPath = (ASTPath)node.jjtGetChild(1);
/*  731 */     JDBCAbstractEntityBridge colEntity = (JDBCAbstractEntityBridge)colPath.getEntity();
/*      */
/*  733 */     StringBuffer sql = (StringBuffer)data;
/*      */
View Full Code Here


/*  934 */     ASTPath fromPath = (ASTPath)node.jjtGetChild(0);
/*  935 */     addInnerJoinPath(fromPath);
/*  936 */     String fromAlias = this.aliasManager.getAlias(fromPath.getPath(fromPath.size() - 2));
/*  937 */     CMPFieldBridge fromCMPField = fromPath.getCMPField();
/*      */
/*  939 */     Node toNode = node.jjtGetChild(1);
/*  940 */     if ((toNode instanceof ASTParameter))
/*      */     {
/*  942 */       ASTParameter toParam = (ASTParameter)toNode;
/*      */
/*  945 */       Class parameterType = getParameterType(toParam.number);
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTEntityComparison node, Object data)
/*      */   {
/*  981 */     StringBuffer buf = (StringBuffer)data;
/*  982 */     Node arg0 = node.jjtGetChild(0);
/*  983 */     Node arg1 = node.jjtGetChild(1);
/*  984 */     if (node.opp.equals("<>"))
/*      */     {
/*  986 */       compareEntity(true, arg0, arg1, buf);
/*      */     }
/*      */     else
View Full Code Here

/*      */
/*      */   private ASTPath getPathFromChildren(Node selectFunction)
/*      */   {
/* 1551 */     for (int childInd = 0; childInd < selectFunction.jjtGetNumChildren(); childInd++)
/*      */     {
/* 1553 */       Node child = selectFunction.jjtGetChild(childInd);
/* 1554 */       if ((child instanceof ASTPath))
/*      */       {
/* 1556 */         return (ASTPath)child;
/*      */       }
/* 1558 */       if (!(child instanceof SelectFunction))
/*      */         continue;
/* 1560 */       Node path = getPathFromChildren(child);
/* 1561 */       if (path != null)
/*      */       {
/* 1563 */         return (ASTPath)path;
/*      */       }
/*      */     }
View Full Code Here

/*  501 */     buf.append(')');
/*      */   }
/*      */
/*      */   public Object visit(ASTEJBQL node, Object data)
/*      */   {
/*  506 */     Node selectNode = node.jjtGetChild(0);
/*  507 */     Node fromNode = node.jjtGetChild(1);
/*  508 */     Node whereNode = null;
/*  509 */     Node orderByNode = null;
/*  510 */     Node limitNode = null;
/*      */
/*  512 */     for (int childNode = 2; childNode < node.jjtGetNumChildren(); childNode++)
/*      */     {
/*  514 */       Node temp = node.jjtGetChild(childNode);
/*  515 */       if ((temp instanceof ASTWhere))
/*      */       {
/*  517 */         whereNode = temp;
/*      */       }
/*  519 */       else if ((temp instanceof ASTOrderBy))
/*      */       {
/*  521 */         orderByNode = temp;
/*      */       } else {
/*  523 */         if (!(temp instanceof ASTLimitOffset))
/*      */           continue;
/*  525 */         limitNode = temp;
/*      */       }
/*      */
/*      */     }
/*      */
/*  530 */     StringBuffer select = new StringBuffer();
/*  531 */     selectNode.jjtAccept(this, select);
/*      */
/*  536 */     Set selectJoinPaths = new HashSet(this.ctermJoinPaths);
/*  537 */     Map selectCollectionMemberJoinPaths = new HashMap(this.ctermCollectionMemberJoinPaths);
/*  538 */     Map selectLeftJoinPaths = new HashMap(this.ctermLeftJoinPaths);
/*      */
/*  541 */     StringBuffer where = new StringBuffer();
/*  542 */     if (whereNode != null)
/*      */     {
/*  544 */       whereNode.jjtAccept(this, where);
/*      */     }
/*      */
/*  548 */     this.ctermJoinPaths = selectJoinPaths;
/*  549 */     this.ctermCollectionMemberJoinPaths = selectCollectionMemberJoinPaths;
/*  550 */     this.ctermLeftJoinPaths = selectLeftJoinPaths;
/*      */
/*  553 */     StringBuffer orderBy = new StringBuffer();
/*  554 */     if (orderByNode != null)
/*      */     {
/*  556 */       orderByNode.jjtAccept(this, orderBy);
/*      */
/*  559 */       for (int i = 0; i < orderByNode.jjtGetNumChildren(); i++)
/*      */       {
/*  561 */         Node orderByPath = orderByNode.jjtGetChild(i);
/*  562 */         ASTPath path = (ASTPath)orderByPath.jjtGetChild(0);
/*  563 */         if (isSelected(path))
/*      */           continue;
/*  565 */         select.append(", ");
/*  566 */         path.jjtAccept(this, select);
/*      */       }
View Full Code Here

/*      */
/*      */   public Object visit(ASTSelect node, Object data)
/*      */   {
/* 1017 */     StringBuffer buf = (StringBuffer)data;
/*      */
/* 1019 */     Node child0 = node.jjtGetChild(0);
/*      */
/* 1021 */     if ((child0 instanceof ASTPath))
/*      */     {
/* 1023 */       ASTPath path = (ASTPath)child0;
/*      */
/* 1025 */       if (path.isCMPField())
/*      */       {
/* 1028 */         JDBCCMPFieldBridge selectField = (JDBCCMPFieldBridge)path.getCMPField();
/* 1029 */         this.selectManager = ((JDBCStoreManager)selectField.getManager());
/* 1030 */         this.selectObject = selectField;
/* 1031 */         setTypeFactory(this.selectManager.getJDBCTypeFactory());
/*      */
/* 1033 */         addJoinPath(path);
/* 1034 */         this.selectAlias = this.aliasManager.getAlias(path.getPath(path.size() - 2));
/* 1035 */         SQLUtil.getColumnNamesClause(selectField, this.selectAlias, buf);
/*      */       }
/*      */       else
/*      */       {
/* 1040 */         JDBCEntityBridge selectEntity = (JDBCEntityBridge)path.getEntity();
/* 1041 */         this.selectManager = ((JDBCStoreManager)selectEntity.getManager());
/* 1042 */         this.selectObject = selectEntity;
/* 1043 */         setTypeFactory(this.selectManager.getJDBCTypeFactory());
/* 1044 */         selectEntity(path, node.distinct, buf);
/*      */       }
/*      */
/*      */     }
/*      */     else
/*      */     {
/* 1050 */       ASTPath path = getPathFromChildren(child0);
/*      */
/* 1052 */       if (path == null)
/*      */       {
/* 1054 */         throw new IllegalStateException("The function in SELECT clause does not contain a path expression.");
/*      */       }
/*      */
/* 1057 */       if (path.isCMPField())
/*      */       {
/* 1059 */         JDBCCMPFieldBridge selectField = (JDBCCMPFieldBridge)path.getCMPField();
/* 1060 */         this.selectManager = ((JDBCStoreManager)selectField.getManager());
/*      */       }
/* 1062 */       else if (path.isCMRField())
/*      */       {
/* 1064 */         JDBCCMRFieldBridge cmrField = (JDBCCMRFieldBridge)path.getCMRField();
/* 1065 */         this.selectManager = ((JDBCStoreManager)cmrField.getEntity().getManager());
/* 1066 */         addJoinPath(path);
/*      */       }
/*      */       else
/*      */       {
/* 1070 */         JDBCEntityBridge entity = (JDBCEntityBridge)path.getEntity();
/* 1071 */         this.selectManager = ((JDBCStoreManager)entity.getManager());
/* 1072 */         addJoinPath(path);
/*      */       }
/*      */
/* 1075 */       setTypeFactory(this.selectManager.getJDBCTypeFactory());
/* 1076 */       this.selectObject = child0;
/* 1077 */       child0.jjtAccept(this, buf);
/*      */     }
/*      */
/* 1080 */     return buf;
/*      */   }
View Full Code Here

/*      */
/*      */   public Object visit(ASTNullComparison node, Object data)
/*      */   {
/* 1094 */     StringBuffer buf = (StringBuffer)data;
/*      */
/* 1096 */     Node child0 = node.jjtGetChild(0);
/* 1097 */     if ((child0 instanceof ASTPath))
/*      */     {
/* 1099 */       ASTPath path = (ASTPath)child0;
/*      */
/* 1101 */       if (path.isCMRField())
View Full Code Here

/* 1342 */     ASTPath fromPath = (ASTPath)node.jjtGetChild(0);
/* 1343 */     addJoinPath(fromPath);
/* 1344 */     String fromAlias = this.aliasManager.getAlias(fromPath.getPath(fromPath.size() - 2));
/* 1345 */     JDBCCMPFieldBridge fromCMPField = (JDBCCMPFieldBridge)fromPath.getCMPField();
/*      */
/* 1347 */     Node toNode = node.jjtGetChild(1);
/* 1348 */     if ((toNode instanceof ASTParameter))
/*      */     {
/* 1350 */       ASTParameter toParam = (ASTParameter)toNode;
/*      */
/* 1353 */       Class parameterType = getParameterType(toParam.number);
View Full Code Here

/*      */   }
/*      */
/*      */   public Object visit(ASTEntityComparison node, Object data)
/*      */   {
/* 1392 */     StringBuffer buf = (StringBuffer)data;
/* 1393 */     Node arg0 = node.jjtGetChild(0);
/* 1394 */     Node arg1 = node.jjtGetChild(1);
/* 1395 */     if (node.opp.equals("<>"))
/*      */     {
/* 1397 */       compareEntity(true, arg0, arg1, buf);
/*      */     }
/*      */     else
View Full Code Here

/*      */   public Object visit(ASTLimitOffset node, Object data)
/*      */   {
/* 1710 */     int child = 0;
/* 1711 */     if (node.hasOffset)
/*      */     {
/* 1713 */       Node offsetNode = node.jjtGetChild(child++);
/* 1714 */       if ((offsetNode instanceof ASTParameter))
/*      */       {
/* 1716 */         ASTParameter param = (ASTParameter)offsetNode;
/* 1717 */         Class parameterType = getParameterType(param.number);
/* 1718 */         if ((Integer.TYPE != parameterType) && (Integer.class != parameterType))
/*      */         {
/* 1720 */           throw new UnsupportedOperationException("OFFSET parameter must be an int");
/*      */         }
/* 1722 */         this.offsetParam = param.number;
/*      */       }
/*      */       else
/*      */       {
/* 1726 */         ASTExactNumericLiteral param = (ASTExactNumericLiteral)offsetNode;
/* 1727 */         this.offsetValue = (int)param.value;
/*      */       }
/*      */     }
/* 1730 */     if (node.hasLimit)
/*      */     {
/* 1732 */       Node limitNode = node.jjtGetChild(child);
/* 1733 */       if ((limitNode instanceof ASTParameter))
/*      */       {
/* 1735 */         ASTParameter param = (ASTParameter)limitNode;
/* 1736 */         Class parameterType = getParameterType(param.number);
/* 1737 */         if ((Integer.TYPE != parameterType) && (Integer.class != parameterType))
View Full Code Here

TOP

Related Classes of org.jboss.ejb.plugins.cmp.ejbql.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.