View Javadoc
1 /* 2 * $Header: 3 */ 4 5 package com.sun.ebxml.registry.query.filter; 6 7 import com.sun.ebxml.registry.*; 8 9 /*** 10 * Class Declaration for ClauseHandler 11 * @see 12 * @author Nikola Stojanovic 13 */ 14 public class ClauseHandler { 15 16 17 String buildConnectiveSQL(String leftArgument, String connectivePredicate, String rightArgument) { 18 19 return "((" + leftArgument + ") " + connectivePredicate + " (" + rightArgument + "))"; 20 } 21 22 23 String reverseSelect(String selectSQL) { 24 25 /* for now use logic of "SOME", not "ALL/NONE" 26 return "NOT " + selectSQL; 27 */ 28 return selectSQL; 29 } 30 31 32 String buildINSelect(String selectSQL) { 33 34 return "IN (" + selectSQL + ")"; 35 } 36 37 38 String addWhereClause(String currentWhereClause, ClauseType newClause) throws RegistryException { 39 40 if (newClause.isSubSelectNeeded) { 41 return addSubSelect(currentWhereClause, newClause); 42 } 43 else { 44 return addWhereClause(currentWhereClause, newClause.clause); 45 } 46 } 47 48 49 String addWhereClause(String currentWhereClause, String additionalWhereClause) throws RegistryException { 50 51 if (currentWhereClause != null) { 52 return buildConnectiveSQL(currentWhereClause, " AND ", additionalWhereClause); 53 } 54 else { 55 return additionalWhereClause; 56 } 57 } 58 59 60 String addSubSelect(String currentWhereClause, ClauseType newClause) throws RegistryException { 61 62 String inSelect = buildINSelect(newClause.clause); 63 64 if (newClause.isReverseSelectNeeded) { 65 inSelect = reverseSelect(inSelect); 66 } 67 68 if (currentWhereClause != null) { 69 return buildConnectiveSQL(currentWhereClause, " AND ", newClause.parentJoinColumn + " " + inSelect); 70 } 71 else { 72 return newClause.parentJoinColumn + " " + inSelect; 73 } 74 } 75 }

This page was automatically generated by Maven