View Javadoc
1 /* 2 * $Header: /cvsroot/ebxmlrr/ebxmlrr/src/share/com/sun/ebxml/registry/query/filter/AssociationBranchProcessor.java,v 1.6 2002/03/06 04:40:40 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 * Class Declaration for AssociationBranchProcessor 14 * @see 15 * @author Nikola Stojanovic 16 */ 17 public class AssociationBranchProcessor extends BranchProcessor { 18 19 private SourceAssociationBranch sourceAssociationBranch = null; 20 private TargetAssociationBranch targetAssociationBranch = null; 21 22 23 protected String getName() { 24 25 return "Association"; 26 } 27 28 29 protected void setNativeBranch(Object branch) { 30 31 if (branch instanceof org.oasis.ebxml.registry.bindings.query.SourceAssociationBranch) { 32 sourceAssociationBranch = (SourceAssociationBranch)branch; 33 } 34 else if (branch instanceof org.oasis.ebxml.registry.bindings.query.TargetAssociationBranch) { 35 targetAssociationBranch = (TargetAssociationBranch)branch; 36 } 37 } 38 39 40 protected void buildFilterClauses() throws RegistryException { 41 42 convertAssociationFilter(); 43 convertExternalLinkFilter(); 44 convertExternalIdentifierFilter(); 45 } 46 47 48 protected void buildQueryClauses() throws RegistryException { 49 50 convertRegistryEntryQuery(); 51 convertRegistryObjectQuery(); 52 convertAssociationQuery(); 53 convertClassificationQuery(); 54 convertClassificationSchemeQuery(); 55 convertClassificationNodeQuery(); 56 convertOrganizationQuery(); 57 convertAuditableEventQuery(); 58 convertRegistryPackageQuery(); 59 convertExtrinsicObjectQuery(); 60 convertServiceQuery(); 61 } 62 63 64 protected void buildBranchClauses() throws RegistryException { 65 66 convertUserBranch(); 67 convertServiceBindingBranch(); 68 convertSpecificationLinkBranch(); 69 } 70 71 72 private void convertAssociationFilter() throws RegistryException { 73 74 AssociationFilter associationFilter = null; 75 76 if (sourceAssociationBranch != null) { 77 associationFilter = sourceAssociationBranch.getAssociationFilter(); 78 } 79 else if (targetAssociationBranch != null){ 80 associationFilter = targetAssociationBranch.getAssociationFilter(); 81 } 82 83 if (associationFilter != null) { 84 whereClause = filterProcessor.addNativeWhereClause(whereClause, associationFilter); 85 } 86 } 87 88 89 private void convertExternalLinkFilter() throws RegistryException { 90 91 ExternalLinkFilter externalLinkFilter = null; 92 93 if (sourceAssociationBranch != null) { 94 externalLinkFilter = sourceAssociationBranch.getAssociationBranchTypeChoice().getExternalLinkFilter(); 95 } 96 else if (targetAssociationBranch != null){ 97 externalLinkFilter = targetAssociationBranch.getAssociationBranchTypeChoice().getExternalLinkFilter(); 98 } 99 100 if (externalLinkFilter != null) { 101 whereClause = filterProcessor.addForeignWhereClause(whereClause, externalLinkFilter); 102 } 103 } 104 105 106 private void convertExternalIdentifierFilter() throws RegistryException { 107 108 ExternalIdentifierFilter externalIdentifierFilter = null; 109 110 if (sourceAssociationBranch != null) { 111 externalIdentifierFilter = sourceAssociationBranch.getAssociationBranchTypeChoice().getExternalIdentifierFilter(); 112 } 113 else if (targetAssociationBranch != null){ 114 externalIdentifierFilter = targetAssociationBranch.getAssociationBranchTypeChoice().getExternalIdentifierFilter(); 115 } 116 117 if (externalIdentifierFilter != null) { 118 whereClause = filterProcessor.addForeignWhereClause(whereClause, externalIdentifierFilter); 119 } 120 } 121 122 123 private void convertRegistryEntryQuery() throws RegistryException { 124 125 RegistryEntryQuery registryEntryQuery = null; 126 127 if (sourceAssociationBranch != null) { 128 registryEntryQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getRegistryEntryQuery(); 129 130 if (registryEntryQuery != null) { 131 RegistryEntryQueryProcessor queryProcessor = new RegistryEntryQueryProcessor(); 132 queryProcessor.setParentJoinColumn("targetObject"); 133 queryProcessor.setSelectColumn("id"); 134 whereClause = queryProcessor.addWhereClause(whereClause, registryEntryQuery); 135 } 136 } 137 else if (targetAssociationBranch != null){ 138 registryEntryQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getRegistryEntryQuery(); 139 140 if (registryEntryQuery != null) { 141 RegistryEntryQueryProcessor queryProcessor = new RegistryEntryQueryProcessor(); 142 queryProcessor.setParentJoinColumn("sourceObject"); 143 queryProcessor.setSelectColumn("id"); 144 whereClause = queryProcessor.addWhereClause(whereClause, registryEntryQuery); 145 } 146 } 147 } 148 149 150 private void convertRegistryObjectQuery() throws RegistryException { 151 152 RegistryObjectQuery registryObjectQuery = null; 153 154 if (sourceAssociationBranch != null) { 155 registryObjectQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getRegistryObjectQuery(); 156 157 if (registryObjectQuery != null) { 158 RegistryObjectQueryProcessor queryProcessor = new RegistryObjectQueryProcessor(); 159 queryProcessor.setParentJoinColumn("targetObject"); 160 queryProcessor.setSelectColumn("id"); 161 whereClause = queryProcessor.addWhereClause(whereClause, registryObjectQuery); 162 } 163 } 164 else if (targetAssociationBranch != null){ 165 registryObjectQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getRegistryObjectQuery(); 166 167 if (registryObjectQuery != null) { 168 RegistryObjectQueryProcessor queryProcessor = new RegistryObjectQueryProcessor(); 169 queryProcessor.setParentJoinColumn("sourceObject"); 170 queryProcessor.setSelectColumn("id"); 171 whereClause = queryProcessor.addWhereClause(whereClause, registryObjectQuery); 172 } 173 } 174 } 175 176 177 private void convertAssociationQuery() throws RegistryException { 178 179 AssociationQuery associationQuery = null; 180 181 if (sourceAssociationBranch != null) { 182 associationQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getAssociationQuery(); 183 184 if (associationQuery != null) { 185 AssociationQueryProcessor queryProcessor = new AssociationQueryProcessor(); 186 queryProcessor.setParentJoinColumn("targetObject"); 187 queryProcessor.setSelectColumn("id"); 188 whereClause = queryProcessor.addWhereClause(whereClause, associationQuery); 189 } 190 } 191 else if (targetAssociationBranch != null){ 192 associationQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getAssociationQuery(); 193 194 if (associationQuery != null) { 195 AssociationQueryProcessor queryProcessor = new AssociationQueryProcessor(); 196 queryProcessor.setParentJoinColumn("sourceObject"); 197 queryProcessor.setSelectColumn("id"); 198 whereClause = queryProcessor.addWhereClause(whereClause, associationQuery); 199 } 200 } 201 } 202 203 204 private void convertClassificationQuery() throws RegistryException { 205 206 ClassificationQuery classificationQuery = null; 207 208 if (sourceAssociationBranch != null) { 209 classificationQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getClassificationQuery(); 210 211 if (classificationQuery != null) { 212 ClassificationQueryProcessor queryProcessor = new ClassificationQueryProcessor(); 213 queryProcessor.setParentJoinColumn("targetObject"); 214 queryProcessor.setSelectColumn("id"); 215 whereClause = queryProcessor.addWhereClause(whereClause, classificationQuery); 216 } 217 } 218 else if (targetAssociationBranch != null){ 219 classificationQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getClassificationQuery(); 220 221 if (classificationQuery != null) { 222 ClassificationQueryProcessor queryProcessor = new ClassificationQueryProcessor(); 223 queryProcessor.setParentJoinColumn("sourceObject"); 224 queryProcessor.setSelectColumn("id"); 225 whereClause = queryProcessor.addWhereClause(whereClause, classificationQuery); 226 } 227 } 228 } 229 230 231 private void convertClassificationSchemeQuery() throws RegistryException { 232 233 ClassificationSchemeQuery classificationSchemeQuery = null; 234 235 if (sourceAssociationBranch != null) { 236 classificationSchemeQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getClassificationSchemeQuery(); 237 238 if (classificationSchemeQuery != null) { 239 ClassificationSchemeQueryProcessor queryProcessor = new ClassificationSchemeQueryProcessor(); 240 queryProcessor.setParentJoinColumn("targetObject"); 241 queryProcessor.setSelectColumn("id"); 242 whereClause = queryProcessor.addWhereClause(whereClause, classificationSchemeQuery); 243 } 244 } 245 else if (targetAssociationBranch != null){ 246 classificationSchemeQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getClassificationSchemeQuery(); 247 248 if (classificationSchemeQuery != null) { 249 ClassificationSchemeQueryProcessor queryProcessor = new ClassificationSchemeQueryProcessor(); 250 queryProcessor.setParentJoinColumn("sourceObject"); 251 queryProcessor.setSelectColumn("id"); 252 whereClause = queryProcessor.addWhereClause(whereClause, classificationSchemeQuery); 253 } 254 } 255 } 256 257 258 private void convertClassificationNodeQuery() throws RegistryException { 259 260 ClassificationNodeQuery classificationNodeQuery = null; 261 262 if (sourceAssociationBranch != null) { 263 classificationNodeQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getClassificationNodeQuery(); 264 265 if (classificationNodeQuery != null) { 266 ClassificationNodeQueryProcessor queryProcessor = new ClassificationNodeQueryProcessor(); 267 queryProcessor.setParentJoinColumn("targetObject"); 268 queryProcessor.setSelectColumn("id"); 269 whereClause = queryProcessor.addWhereClause(whereClause, classificationNodeQuery); 270 } 271 } 272 else if (targetAssociationBranch != null){ 273 classificationNodeQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getClassificationNodeQuery(); 274 275 if (classificationNodeQuery != null) { 276 ClassificationNodeQueryProcessor queryProcessor = new ClassificationNodeQueryProcessor(); 277 queryProcessor.setParentJoinColumn("sourceObject"); 278 queryProcessor.setSelectColumn("id"); 279 whereClause = queryProcessor.addWhereClause(whereClause, classificationNodeQuery); 280 } 281 } 282 } 283 284 285 private void convertOrganizationQuery() throws RegistryException { 286 287 OrganizationQuery organizationQuery = null; 288 289 if (sourceAssociationBranch != null) { 290 organizationQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getOrganizationQuery(); 291 292 if (organizationQuery != null) { 293 OrganizationQueryProcessor queryProcessor = new OrganizationQueryProcessor(); 294 queryProcessor.setParentJoinColumn("sourceObject"); 295 queryProcessor.setSelectColumn("id"); 296 whereClause = queryProcessor.addWhereClause(whereClause, organizationQuery); 297 } 298 } 299 else if (targetAssociationBranch != null) { 300 organizationQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getOrganizationQuery(); 301 302 if (organizationQuery != null) { 303 OrganizationQueryProcessor queryProcessor = new OrganizationQueryProcessor(); 304 queryProcessor.setParentJoinColumn("targetObject"); 305 queryProcessor.setSelectColumn("id"); 306 whereClause = queryProcessor.addWhereClause(whereClause, organizationQuery); 307 } 308 } 309 } 310 311 312 private void convertAuditableEventQuery() throws RegistryException { 313 314 AuditableEventQuery auditableEventQuery = null; 315 316 if (sourceAssociationBranch != null) { 317 auditableEventQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getAuditableEventQuery(); 318 319 if (auditableEventQuery != null) { 320 AuditableEventQueryProcessor queryProcessor = new AuditableEventQueryProcessor(); 321 queryProcessor.setParentJoinColumn("sourceObject"); 322 queryProcessor.setSelectColumn("id"); 323 whereClause = queryProcessor.addWhereClause(whereClause, auditableEventQuery); 324 } 325 } 326 else if (targetAssociationBranch != null) { 327 auditableEventQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getAuditableEventQuery(); 328 329 if (auditableEventQuery != null) { 330 AuditableEventQueryProcessor queryProcessor = new AuditableEventQueryProcessor(); 331 queryProcessor.setParentJoinColumn("targetObject"); 332 queryProcessor.setSelectColumn("id"); 333 whereClause = queryProcessor.addWhereClause(whereClause, auditableEventQuery); 334 } 335 } 336 } 337 338 339 private void convertRegistryPackageQuery() throws RegistryException { 340 341 RegistryPackageQuery registryPackageQuery = null; 342 343 if (sourceAssociationBranch != null) { 344 registryPackageQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getRegistryPackageQuery(); 345 346 if (registryPackageQuery != null) { 347 RegistryPackageQueryProcessor queryProcessor = new RegistryPackageQueryProcessor(); 348 queryProcessor.setParentJoinColumn("sourceObject"); 349 queryProcessor.setSelectColumn("id"); 350 whereClause = queryProcessor.addWhereClause(whereClause, registryPackageQuery); 351 } 352 } 353 else if (targetAssociationBranch != null) { 354 registryPackageQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getRegistryPackageQuery(); 355 356 if (registryPackageQuery != null) { 357 RegistryPackageQueryProcessor queryProcessor = new RegistryPackageQueryProcessor(); 358 queryProcessor.setParentJoinColumn("targetObject"); 359 queryProcessor.setSelectColumn("id"); 360 whereClause = queryProcessor.addWhereClause(whereClause, registryPackageQuery); 361 } 362 } 363 } 364 365 366 private void convertExtrinsicObjectQuery() throws RegistryException { 367 368 ExtrinsicObjectQuery extrinsicObjectQuery = null; 369 370 if (sourceAssociationBranch != null) { 371 extrinsicObjectQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getExtrinsicObjectQuery(); 372 373 if (extrinsicObjectQuery != null) { 374 ExtrinsicObjectQueryProcessor queryProcessor = new ExtrinsicObjectQueryProcessor(); 375 queryProcessor.setParentJoinColumn("sourceObject"); 376 queryProcessor.setSelectColumn("id"); 377 whereClause = queryProcessor.addWhereClause(whereClause, extrinsicObjectQuery); 378 } 379 } 380 else if (targetAssociationBranch != null) { 381 extrinsicObjectQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getExtrinsicObjectQuery(); 382 383 if (extrinsicObjectQuery != null) { 384 ExtrinsicObjectQueryProcessor queryProcessor = new ExtrinsicObjectQueryProcessor(); 385 queryProcessor.setParentJoinColumn("targetObject"); 386 queryProcessor.setSelectColumn("id"); 387 whereClause = queryProcessor.addWhereClause(whereClause, extrinsicObjectQuery); 388 } 389 } 390 } 391 392 393 private void convertServiceQuery() throws RegistryException { 394 395 ServiceQuery serviceQuery = null; 396 397 if (sourceAssociationBranch != null) { 398 serviceQuery = sourceAssociationBranch.getAssociationBranchTypeChoice().getServiceQuery(); 399 400 if (serviceQuery != null) { 401 ServiceQueryProcessor queryProcessor = new ServiceQueryProcessor(); 402 queryProcessor.setParentJoinColumn("sourceObject"); 403 queryProcessor.setSelectColumn("id"); 404 whereClause = queryProcessor.addWhereClause(whereClause, serviceQuery); 405 } 406 } 407 else if (targetAssociationBranch != null) { 408 serviceQuery = targetAssociationBranch.getAssociationBranchTypeChoice().getServiceQuery(); 409 410 if (serviceQuery != null) { 411 ServiceQueryProcessor queryProcessor = new ServiceQueryProcessor(); 412 queryProcessor.setParentJoinColumn("targetObject"); 413 queryProcessor.setSelectColumn("id"); 414 whereClause = queryProcessor.addWhereClause(whereClause, serviceQuery); 415 } 416 } 417 } 418 419 420 private void convertUserBranch() throws RegistryException { 421 422 UserBranch userBranch = null; 423 424 if (sourceAssociationBranch != null) { 425 userBranch = sourceAssociationBranch.getAssociationBranchTypeChoice().getUserBranch(); 426 427 if (userBranch != null) { 428 UserBranchProcessor branchProcessor = new UserBranchProcessor(); 429 branchProcessor.setParentJoinColumn("sourceObject"); 430 branchProcessor.setSelectColumn("id"); 431 whereClause = branchProcessor.addWhereClause(whereClause, userBranch); 432 } 433 } 434 else if (targetAssociationBranch != null) { 435 userBranch = targetAssociationBranch.getAssociationBranchTypeChoice().getUserBranch(); 436 437 if (userBranch != null) { 438 UserBranchProcessor branchProcessor = new UserBranchProcessor(); 439 branchProcessor.setParentJoinColumn("targetObject"); 440 branchProcessor.setSelectColumn("id"); 441 whereClause = branchProcessor.addWhereClause(whereClause, userBranch); 442 } 443 } 444 } 445 446 447 private void convertServiceBindingBranch() throws RegistryException { 448 449 ServiceBindingBranch serviceBindingBranch = null; 450 451 if (sourceAssociationBranch != null) { 452 serviceBindingBranch = sourceAssociationBranch.getAssociationBranchTypeChoice().getServiceBindingBranch(); 453 454 if (serviceBindingBranch != null) { 455 ServiceBindingBranchProcessor branchProcessor = new ServiceBindingBranchProcessor(); 456 branchProcessor.setParentJoinColumn("sourceObject"); 457 branchProcessor.setSelectColumn("id"); 458 whereClause = branchProcessor.addWhereClause(whereClause, serviceBindingBranch); 459 } 460 } 461 else if (targetAssociationBranch != null) { 462 serviceBindingBranch = targetAssociationBranch.getAssociationBranchTypeChoice().getServiceBindingBranch(); 463 464 if (serviceBindingBranch != null) { 465 ServiceBindingBranchProcessor branchProcessor = new ServiceBindingBranchProcessor(); 466 branchProcessor.setParentJoinColumn("targetObject"); 467 branchProcessor.setSelectColumn("id"); 468 whereClause = branchProcessor.addWhereClause(whereClause, serviceBindingBranch); 469 } 470 } 471 } 472 473 474 private void convertSpecificationLinkBranch() throws RegistryException { 475 476 SpecificationLinkBranch specificationLinkBranch = null; 477 478 if (sourceAssociationBranch != null) { 479 specificationLinkBranch = sourceAssociationBranch.getAssociationBranchTypeChoice().getSpecificationLinkBranch(); 480 481 if (specificationLinkBranch != null) { 482 SpecificationLinkBranchProcessor branchProcessor = new SpecificationLinkBranchProcessor(); 483 branchProcessor.setParentJoinColumn("sourceObject"); 484 branchProcessor.setSelectColumn("id"); 485 whereClause = branchProcessor.addWhereClause(whereClause, specificationLinkBranch); 486 } 487 } 488 else if (targetAssociationBranch != null) { 489 specificationLinkBranch = targetAssociationBranch.getAssociationBranchTypeChoice().getSpecificationLinkBranch(); 490 491 if (specificationLinkBranch != null) { 492 SpecificationLinkBranchProcessor branchProcessor = new SpecificationLinkBranchProcessor(); 493 branchProcessor.setParentJoinColumn("targetObject"); 494 branchProcessor.setSelectColumn("id"); 495 whereClause = branchProcessor.addWhereClause(whereClause, specificationLinkBranch); 496 } 497 } 498 } 499 }

This page was automatically generated by Maven