View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/ebxmlrr/src/share/com/sun/ebxml/registry/query/filter/RegistryObjectQueryProcessor.java,v 1.7 2003/01/14 22:19:45 nstojano Exp $ 3 */ 4 5 package com.sun.ebxml.registry.query.filter; 6 7 import com.sun.ebxml.registry.*; 8 9 import org.oasis.ebxml.registry.bindings.query.*; 10 import org.oasis.ebxml.registry.bindings.rs.*; 11 12 13 /*** 14 * Class Declaration for RegistryObjectQueryProcessor 15 * @see 16 * @author Nikola Stojanovic 17 */ 18 public class RegistryObjectQueryProcessor extends QueryProcessor { 19 20 private RegistryObjectQueryType registryObjectQuery = new RegistryObjectQuery(); 21 22 23 protected String getName() { 24 25 return("RegistryObject"); 26 } 27 28 29 protected void setNativeQuery(RegistryObjectQueryType query) { 30 31 registryObjectQuery = (RegistryObjectQueryType)query; 32 } 33 34 35 protected void buildFilterClauses() throws RegistryException { 36 37 convertRegistryObjectFilter(); 38 convertExternalIdentifierFilters(); 39 } 40 41 42 protected void buildQueryClauses() throws RegistryException { 43 44 convertAuditableEventQueries(); 45 } 46 47 48 protected void buildBranchClauses() throws RegistryException { 49 50 convertNameBranch(); 51 convertDescriptionBranch(); 52 convertClassifiedByBranches(); 53 convertSlotBranches(); 54 convertSourceAssociationBranches(); 55 convertTargetAssociationBranches(); 56 } 57 58 59 private void convertRegistryObjectFilter() throws RegistryException { 60 61 if (registryObjectQuery.getRegistryObjectFilter() != null) { 62 whereClause = filterProcessor.addNativeWhereClause(whereClause, registryObjectQuery.getRegistryObjectFilter()); 63 } 64 } 65 66 67 private void convertExternalIdentifierFilters() throws RegistryException { 68 69 ExternalIdentifierFilter[] externalIdentifierFilter = registryObjectQuery.getExternalIdentifierFilter(); 70 71 if (externalIdentifierFilter.length > 0) { 72 filterProcessor.setSelectColumn("registryObject"); 73 74 for (int i=0; i<externalIdentifierFilter.length; i++) { 75 whereClause = filterProcessor.addNativeWhereClause(whereClause, externalIdentifierFilter[i]); 76 } 77 } 78 } 79 80 81 private void convertAuditableEventQueries() throws RegistryException { 82 83 AuditableEventQuery[] auditableEventQuery = registryObjectQuery.getAuditableEventQuery(); 84 85 if (auditableEventQuery.length > 0) { 86 AuditableEventQueryProcessor queryProcessor = new AuditableEventQueryProcessor(); 87 queryProcessor.setParentJoinColumn("id"); 88 queryProcessor.setSelectColumn("registryObject"); 89 90 for (int i=0; i<auditableEventQuery.length; i++) { 91 whereClause = queryProcessor.addWhereClause(whereClause, auditableEventQuery); 92 } 93 } 94 } 95 96 97 private void convertNameBranch() throws RegistryException { 98 99 if (registryObjectQuery.getNameBranch() != null) { 100 InternationalStringBranchProcessor branchProcessor = new InternationalStringBranchProcessor(); 101 branchProcessor.setSelectColumn("parent"); 102 whereClause = branchProcessor.addWhereClause(whereClause, registryObjectQuery.getNameBranch()); 103 } 104 } 105 106 107 private void convertDescriptionBranch() throws RegistryException { 108 109 if (registryObjectQuery.getDescriptionBranch() != null) { 110 InternationalStringBranchProcessor branchProcessor = new InternationalStringBranchProcessor(); 111 branchProcessor.setSelectColumn("parent"); 112 whereClause = branchProcessor.addWhereClause(whereClause, registryObjectQuery.getDescriptionBranch()); 113 } 114 } 115 116 117 private void convertClassifiedByBranches() throws RegistryException { 118 119 ClassifiedByBranch[] classifiedByBranch = registryObjectQuery.getClassifiedByBranch(); 120 121 if (classifiedByBranch.length > 0) { 122 123 for (int i=0; i<classifiedByBranch.length; i++) { 124 ClassifiedByBranchProcessor branchProcessor = new ClassifiedByBranchProcessor(); 125 branchProcessor.setSelectColumn("classifiedObject"); 126 whereClause = branchProcessor.addWhereClause(whereClause, classifiedByBranch[i]); 127 } 128 } 129 } 130 131 132 private void convertSlotBranches() throws RegistryException { 133 134 SlotBranch[] slotBranch = registryObjectQuery.getSlotBranch(); 135 136 if (slotBranch.length > 0) { 137 138 for (int i=0; i<slotBranch.length; i++) { 139 SlotBranchProcessor branchProcessor = new SlotBranchProcessor(); 140 branchProcessor.setSelectColumn("parent"); 141 whereClause = branchProcessor.addWhereClause(whereClause, slotBranch[i]); 142 } 143 } 144 } 145 146 147 private void convertSourceAssociationBranches() throws RegistryException { 148 149 SourceAssociationBranch[] sourceAssociationBranch = registryObjectQuery.getSourceAssociationBranch(); 150 151 if (sourceAssociationBranch.length > 0) { 152 153 for (int i=0; i<sourceAssociationBranch.length; i++) { 154 AssociationBranchProcessor branchProcessor = new AssociationBranchProcessor(); 155 branchProcessor.setSelectColumn("sourceObject"); 156 whereClause = branchProcessor.addWhereClause(whereClause, sourceAssociationBranch[i]); 157 } 158 } 159 } 160 161 162 private void convertTargetAssociationBranches() throws RegistryException { 163 164 TargetAssociationBranch[] targetAssociationBranch = registryObjectQuery.getTargetAssociationBranch(); 165 166 if (targetAssociationBranch.length > 0) { 167 168 for (int i=0; i<targetAssociationBranch.length; i++) { 169 AssociationBranchProcessor branchProcessor = new AssociationBranchProcessor(); 170 branchProcessor.setSelectColumn("targetObject"); 171 whereClause = branchProcessor.addWhereClause(whereClause, targetAssociationBranch[i]); 172 } 173 } 174 } 175 }

This page was automatically generated by Maven