| <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>InquiryHelper.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">jUDDI Core - OpenJPA</a> > <a href="index.source.html" class="el_package">org.apache.juddi.api.impl</a> > <span class="el_source">InquiryHelper.java</span></div><h1>InquiryHelper.java</h1><pre class="source lang-java linenums">/* |
| * Copyright 2001-2008 The Apache Software Foundation. |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| * |
| */ |
| package org.apache.juddi.api.impl; |
| |
| import java.util.ArrayList; |
| import java.util.Date; |
| import java.util.LinkedList; |
| import java.util.List; |
| |
| import javax.persistence.EntityManager; |
| import javax.xml.ws.Holder; |
| import org.apache.commons.configuration.ConfigurationException; |
| |
| import org.apache.commons.logging.Log; |
| import org.apache.commons.logging.LogFactory; |
| import org.apache.juddi.config.AppConfig; |
| import org.apache.juddi.config.Property; |
| import org.apache.juddi.mapping.MappingModelToApi; |
| import org.apache.juddi.model.BindingTemplate; |
| import org.apache.juddi.query.FetchBindingTemplatesQuery; |
| import org.apache.juddi.query.FetchBusinessEntitiesQuery; |
| import org.apache.juddi.query.FetchBusinessServicesQuery; |
| import org.apache.juddi.query.FetchTModelsQuery; |
| import org.apache.juddi.query.FindBindingByCategoryGroupQuery; |
| import org.apache.juddi.query.FindBindingByCategoryQuery; |
| import org.apache.juddi.query.FindBindingByTModelKeyQuery; |
| import org.apache.juddi.query.FindBusinessByCategoryGroupQuery; |
| import org.apache.juddi.query.FindBusinessByCategoryQuery; |
| import org.apache.juddi.query.FindBusinessByCombinedCategoryQuery; |
| import org.apache.juddi.query.FindBusinessByDiscoveryURLQuery; |
| import org.apache.juddi.query.FindBusinessByIdentifierQuery; |
| import org.apache.juddi.query.FindBusinessByNameQuery; |
| import org.apache.juddi.query.FindBusinessByTModelKeyQuery; |
| import org.apache.juddi.query.FindServiceByCategoryGroupQuery; |
| import org.apache.juddi.query.FindServiceByCategoryQuery; |
| import org.apache.juddi.query.FindServiceByCombinedCategoryQuery; |
| import org.apache.juddi.query.FindServiceByNameQuery; |
| import org.apache.juddi.query.FindServiceByTModelKeyQuery; |
| import org.apache.juddi.query.FindTModelByCategoryGroupQuery; |
| import org.apache.juddi.query.FindTModelByCategoryQuery; |
| import org.apache.juddi.query.FindTModelByIdentifierQuery; |
| import org.apache.juddi.query.FindTModelByNameQuery; |
| import org.apache.juddi.query.util.FindQualifiers; |
| import org.apache.juddi.v3.error.ErrorMessage; |
| import org.apache.juddi.v3.error.InvalidKeyPassedException; |
| import org.uddi.api_v3.BindingDetail; |
| import org.uddi.api_v3.BusinessList; |
| import org.uddi.api_v3.Direction; |
| import org.uddi.api_v3.FindBinding; |
| import org.uddi.api_v3.FindBusiness; |
| import org.uddi.api_v3.FindRelatedBusinesses; |
| import org.uddi.api_v3.FindService; |
| import org.uddi.api_v3.FindTModel; |
| import org.uddi.api_v3.ListDescription; |
| import org.uddi.api_v3.Name; |
| import org.uddi.api_v3.RelatedBusinessesList; |
| import org.uddi.api_v3.ServiceList; |
| import org.uddi.api_v3.TModelBag; |
| import org.uddi.api_v3.TModelList; |
| import org.uddi.v3_service.DispositionReportFaultMessage; |
| |
| /**Co |
| * Used to factor out inquiry functionality as it is used in more than one spot. |
| * |
| * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a> |
| */ |
| <span class="nc" id="L81">public class InquiryHelper {</span> |
| |
| <span class="fc" id="L83"> private static Log logger = LogFactory.getLog(InquiryHelper.class);</span> |
| |
| public static List<Object> findBinding(FindBinding body, FindQualifiers findQualifiers, EntityManager em) throws DispositionReportFaultMessage { |
| |
| <span class="fc" id="L87"> List<Object> keysFound = new LinkedList<Object>();</span> |
| <span class="pc bpc" id="L88" title="1 of 4 branches missed."> if (body.getServiceKey()!=null && body.getServiceKey().length() > 0) {</span> |
| <span class="fc" id="L89"> keysFound = findBindingsByServiceKey(em, body.getServiceKey(), keysFound);</span> |
| } |
| |
| <span class="fc bfc" id="L92" title="All 2 branches covered."> if (body.getTModelBag() == null)</span> |
| <span class="fc" id="L93"> body.setTModelBag(new TModelBag());</span> |
| // First perform the embedded FindTModel search which will augment the tModel bag with any resulting tModel keys. |
| <span class="fc" id="L95"> doFindTModelEmbeddedSearch(em, body.getFindQualifiers(), body.getFindTModel(), body.getTModelBag());</span> |
| <span class="fc" id="L96"> keysFound = FindBindingByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), body.getServiceKey(), keysFound);</span> |
| <span class="fc" id="L97"> keysFound = FindBindingByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), body.getServiceKey(), keysFound);</span> |
| <span class="fc" id="L98"> keysFound = FindBindingByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(), body.getServiceKey(), keysFound);</span> |
| |
| <span class="fc" id="L100"> return keysFound;</span> |
| } |
| |
| public static BindingDetail getBindingDetailFromKeys(FindBinding body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound) throws DispositionReportFaultMessage { |
| <span class="fc" id="L104"> return getBindingDetailFromKeys(body, findQualifiers, em, keysFound, null, null, null, null);</span> |
| } |
| |
| public static BindingDetail getBindingDetailFromKeys(FindBinding body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound, |
| Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows) |
| throws DispositionReportFaultMessage { |
| |
| <span class="fc" id="L111"> BindingDetail result = new BindingDetail();</span> |
| <span class="fc" id="L112"> ListDescription listDesc = new ListDescription();</span> |
| <span class="fc" id="L113"> result.setListDescription(listDesc);</span> |
| |
| // Sort and retrieve the final results with paging taken into account |
| <span class="fc" id="L116"> List<?> queryResults = FetchBindingTemplatesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);</span> |
| |
| // Set the currentIndex to 0 or the value of the subscriptionStartIndex |
| <span class="fc" id="L119"> int currentIndex = 0;</span> |
| <span class="pc bpc" id="L120" title="3 of 4 branches missed."> if (subscriptionStartIndex != null && subscriptionStartIndex.value != null)</span> |
| <span class="nc" id="L121"> currentIndex = subscriptionStartIndex.value;</span> |
| |
| <span class="fc" id="L123"> int returnedRowCount = 0;</span> |
| |
| <span class="fc bfc" id="L125" title="All 2 branches covered."> while (currentIndex < queryResults.size()) {</span> |
| <span class="fc" id="L126"> Object item = queryResults.get(currentIndex);</span> |
| |
| <span class="fc" id="L128"> org.apache.juddi.model.BindingTemplate modelBindingTemplate = (org.apache.juddi.model.BindingTemplate)item;</span> |
| <span class="fc" id="L129"> org.uddi.api_v3.BindingTemplate apiBindingTemplate = new org.uddi.api_v3.BindingTemplate();</span> |
| |
| <span class="pc bpc" id="L131" title="3 of 4 branches missed."> if (modifiedAfter != null && modifiedAfter.after(modelBindingTemplate.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L132"> currentIndex++;</span> |
| <span class="nc" id="L133"> continue;</span> |
| } |
| |
| <span class="pc bpc" id="L136" title="3 of 4 branches missed."> if (modifiedBefore != null && modifiedBefore.before(modelBindingTemplate.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L137"> currentIndex++;</span> |
| <span class="nc" id="L138"> continue;</span> |
| } |
| |
| <span class="fc" id="L141"> MappingModelToApi.mapBindingTemplate(modelBindingTemplate, apiBindingTemplate);</span> |
| |
| <span class="fc" id="L143"> result.getBindingTemplate().add(apiBindingTemplate);</span> |
| |
| <span class="fc" id="L145"> returnedRowCount++;</span> |
| // If the returned rows equals the max allowed, we can end the loop (applies to subscription calls only) |
| <span class="pc bpc" id="L147" title="1 of 2 branches missed."> if (subscriptionMaxRows != null) {</span> |
| <span class="nc bnc" id="L148" title="All 2 branches missed."> if (returnedRowCount == subscriptionMaxRows)</span> |
| <span class="nc" id="L149"> break;</span> |
| } |
| |
| <span class="fc" id="L152"> currentIndex++;</span> |
| <span class="fc" id="L153"> }</span> |
| |
| // If the loop was broken prematurely (max row count hit) we set the subscriptionStartIndex to the next index to start with. |
| // Otherwise, set it to null so the subscription call won't trigger chunk token generation. |
| <span class="pc bpc" id="L157" title="1 of 2 branches missed."> if (currentIndex < (queryResults.size() - 1)) {</span> |
| <span class="nc bnc" id="L158" title="All 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="nc" id="L159"> subscriptionStartIndex.value = currentIndex + 1;</span> |
| <span class="nc" id="L160"> result.setTruncated(Boolean.TRUE);</span> |
| } |
| else { |
| <span class="pc bpc" id="L163" title="1 of 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="nc" id="L164"> subscriptionStartIndex.value = null;</span> |
| <span class="fc" id="L165"> result.setTruncated(Boolean.FALSE);</span> |
| } |
| <span class="fc" id="L167"> result.getListDescription().setListHead(currentIndex);</span> |
| <span class="fc" id="L168"> result.getListDescription().setActualCount(result.getBindingTemplate().size());</span> |
| <span class="fc" id="L169"> result.getListDescription().setIncludeCount(returnedRowCount);</span> |
| <span class="fc" id="L170"> return result;</span> |
| } |
| |
| public static List<Object> findBusiness(FindBusiness body, FindQualifiers findQualifiers, EntityManager em) throws DispositionReportFaultMessage { |
| |
| <span class="fc" id="L175"> List<Object> keysFound = null;</span> |
| |
| // First perform the embedded FindTModel search which will augment the tModel bag with any resulting tModel keys. |
| <span class="fc bfc" id="L178" title="All 2 branches covered."> if (body.getTModelBag() == null)</span> |
| <span class="fc" id="L179"> body.setTModelBag(new TModelBag());</span> |
| <span class="fc" id="L180"> doFindTModelEmbeddedSearch(em, body.getFindQualifiers(), body.getFindTModel(), body.getTModelBag());</span> |
| |
| // The embedded find_relatedBusinesses search is performed first. This is done the same as the actual API call, except the resulting business keys are |
| // extracted and placed in the keysFound array to restrict future searches to only those keys. |
| <span class="pc bpc" id="L184" title="1 of 2 branches missed."> if (body.getFindRelatedBusinesses() != null) {</span> |
| <span class="nc" id="L185"> FindRelatedBusinesses frb = body.getFindRelatedBusinesses();</span> |
| |
| <span class="nc" id="L187"> org.uddi.api_v3.RelatedBusinessInfos relatedBusinessInfos = new org.uddi.api_v3.RelatedBusinessInfos();</span> |
| <span class="nc bnc" id="L188" title="All 2 branches missed."> if (body.getFindRelatedBusinesses().getBusinessKey() != null ) {</span> |
| <span class="nc" id="L189"> getRelatedBusinesses(em, Direction.FROM_KEY, frb.getBusinessKey(), frb.getKeyedReference(), relatedBusinessInfos);</span> |
| <span class="nc" id="L190"> getRelatedBusinesses(em, Direction.TO_KEY, frb.getBusinessKey(), frb.getKeyedReference(), relatedBusinessInfos);</span> |
| } |
| <span class="nc bnc" id="L192" title="All 2 branches missed."> else if (body.getFindRelatedBusinesses().getFromKey() != null)</span> |
| <span class="nc" id="L193"> getRelatedBusinesses(em, Direction.FROM_KEY, frb.getFromKey(), frb.getKeyedReference(), relatedBusinessInfos);</span> |
| <span class="nc bnc" id="L194" title="All 2 branches missed."> else if (body.getFindRelatedBusinesses().getToKey() != null)</span> |
| <span class="nc" id="L195"> getRelatedBusinesses(em, Direction.TO_KEY, frb.getToKey(), frb.getKeyedReference(), relatedBusinessInfos);</span> |
| |
| <span class="nc" id="L197"> List<Object> relatedBusinessKeys = new ArrayList<Object>(0);</span> |
| <span class="nc bnc" id="L198" title="All 2 branches missed."> for (org.uddi.api_v3.RelatedBusinessInfo rbi : relatedBusinessInfos.getRelatedBusinessInfo())</span> |
| <span class="nc" id="L199"> relatedBusinessKeys.add(rbi.getBusinessKey());</span> |
| |
| <span class="nc" id="L201"> keysFound = relatedBusinessKeys;</span> |
| } |
| |
| <span class="fc" id="L204"> keysFound = FindBusinessByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), keysFound);</span> |
| <span class="fc" id="L205"> keysFound = FindBusinessByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(), keysFound);</span> |
| <span class="fc" id="L206"> keysFound = FindBusinessByDiscoveryURLQuery.select(em, findQualifiers, body.getDiscoveryURLs(), keysFound);</span> |
| <span class="fc bfc" id="L207" title="All 2 branches covered."> if (findQualifiers.isCombineCategoryBags()) {</span> |
| <span class="fc" id="L208"> keysFound = FindBusinessByCombinedCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);</span> |
| } else { |
| <span class="fc" id="L210"> keysFound = FindBusinessByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);</span> |
| } |
| |
| <span class="fc" id="L213"> keysFound = FindBusinessByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);</span> |
| <span class="fc" id="L214"> keysFound = FindBusinessByNameQuery.select(em, findQualifiers, body.getName(), keysFound);</span> |
| |
| // If there no keys in the bag then remove the empty TModelBag |
| <span class="fc bfc" id="L217" title="All 2 branches covered."> if (body.getTModelBag().getTModelKey().size()==0) body.setTModelBag(null);</span> |
| |
| <span class="fc" id="L219"> return keysFound;</span> |
| } |
| |
| public static BusinessList getBusinessListFromKeys(FindBusiness body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound) throws DispositionReportFaultMessage { |
| <span class="fc" id="L223"> return getBusinessListFromKeys(body, findQualifiers, em, keysFound, null, null, null, null);</span> |
| } |
| |
| public static BusinessList getBusinessListFromKeys(FindBusiness body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound, |
| Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows) |
| throws DispositionReportFaultMessage { |
| |
| <span class="fc" id="L230"> BusinessList result = new BusinessList();</span> |
| <span class="fc" id="L231"> ListDescription listDesc = new ListDescription();</span> |
| <span class="fc" id="L232"> result.setListDescription(listDesc);</span> |
| |
| // Sort and retrieve the final results taking paging into account |
| <span class="fc" id="L235"> List<?> queryResults = FetchBusinessEntitiesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);</span> |
| |
| <span class="fc" id="L237"> boolean enabled = true;</span> |
| try { |
| //AppConfig.reloadConfig(); |
| <span class="fc" id="L240"> enabled= AppConfig.getConfiguration().getBoolean(Property.JUDDI_ENABLE_FIND_BUSINESS_TMODEL_BAG_FILTERING, true);</span> |
| <span class="nc" id="L241"> } catch (ConfigurationException ex) {</span> |
| <span class="nc" id="L242"> logger.error(ex);</span> |
| <span class="fc" id="L243"> }</span> |
| <span class="pc bpc" id="L244" title="1 of 2 branches missed."> if (enabled) {</span> |
| <span class="fc" id="L245"> logger.info("FindBusiness by tModelBag is enabled! Loaded from " + AppConfig.getConfigFileURL());</span> |
| <span class="fc" id="L246"> List<?> serviceResults = null;</span> |
| <span class="fc bfc" id="L247" title="All 2 branches covered."> for (int i = 0; i < queryResults.size(); i++) {</span> |
| <span class="fc" id="L248"> org.apache.juddi.model.BusinessEntity be = (org.apache.juddi.model.BusinessEntity) queryResults.get(i);</span> |
| |
| <span class="fc" id="L250"> List<Object> keysIn = new ArrayList<Object>();</span> |
| <span class="fc" id="L251"> List<org.apache.juddi.model.BusinessService> services = be.getBusinessServices();</span> |
| <span class="fc bfc" id="L252" title="All 2 branches covered."> for (int j = 0; j < services.size(); j++) {</span> |
| <span class="fc" id="L253"> keysIn.add(services.get(j).getEntityKey());</span> |
| } |
| |
| <span class="fc" id="L256"> serviceResults = FindServiceByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), null, keysIn);</span> |
| <span class="pc bpc" id="L257" title="1 of 2 branches missed."> if (serviceResults == null) {</span> |
| <span class="nc" id="L258"> be.setBusinessServices(null);</span> |
| } else { |
| <span class="fc" id="L260"> ListDescription ldesc = new ListDescription();</span> |
| <span class="fc" id="L261"> result.setListDescription(listDesc);</span> |
| <span class="fc" id="L262"> List<?> srvcs = FetchBusinessServicesQuery.select(em, findQualifiers, serviceResults, body.getMaxRows(),</span> |
| <span class="fc" id="L263"> body.getListHead(), ldesc);</span> |
| <span class="fc" id="L264"> be.setBusinessServices((List<org.apache.juddi.model.BusinessService>) srvcs);</span> |
| } |
| } |
| } |
| |
| |
| <span class="pc bpc" id="L270" title="1 of 4 branches missed."> if (queryResults != null && queryResults.size() > 0)</span> |
| <span class="fc" id="L271"> result.setBusinessInfos(new org.uddi.api_v3.BusinessInfos());</span> |
| |
| // Set the currentIndex to 0 or the value of the subscriptionStartIndex |
| <span class="fc" id="L274"> int currentIndex = 0;</span> |
| <span class="pc bpc" id="L275" title="3 of 4 branches missed."> if (subscriptionStartIndex != null && subscriptionStartIndex.value != null)</span> |
| <span class="nc" id="L276"> currentIndex = subscriptionStartIndex.value;</span> |
| |
| <span class="fc" id="L278"> int returnedRowCount = 0;</span> |
| |
| <span class="pc bpc" id="L280" title="1 of 4 branches missed."> while (queryResults!=null && currentIndex < queryResults.size()) {</span> |
| <span class="fc" id="L281"> Object item = queryResults.get(currentIndex);</span> |
| |
| <span class="fc" id="L283"> org.apache.juddi.model.BusinessEntity modelBusinessEntity = (org.apache.juddi.model.BusinessEntity)item;</span> |
| <span class="fc" id="L284"> org.uddi.api_v3.BusinessInfo apiBusinessInfo = new org.uddi.api_v3.BusinessInfo();</span> |
| |
| <span class="pc bpc" id="L286" title="3 of 4 branches missed."> if (modifiedAfter != null && modifiedAfter.after(modelBusinessEntity.getModifiedIncludingChildren())){</span> |
| <span class="nc" id="L287"> currentIndex++;</span> |
| <span class="nc" id="L288"> continue;</span> |
| } |
| |
| <span class="pc bpc" id="L291" title="3 of 4 branches missed."> if (modifiedBefore != null && modifiedBefore.before(modelBusinessEntity.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L292"> currentIndex++;</span> |
| <span class="nc" id="L293"> continue;</span> |
| } |
| |
| <span class="fc" id="L296"> MappingModelToApi.mapBusinessInfo(modelBusinessEntity, apiBusinessInfo);</span> |
| |
| <span class="fc" id="L298"> result.getBusinessInfos().getBusinessInfo().add(apiBusinessInfo);</span> |
| |
| <span class="fc" id="L300"> returnedRowCount++;</span> |
| // If the returned rows equals the max allowed, we can end the loop (applies to subscription calls only) |
| <span class="pc bpc" id="L302" title="1 of 2 branches missed."> if (subscriptionMaxRows != null) {</span> |
| <span class="nc bnc" id="L303" title="All 2 branches missed."> if (returnedRowCount == subscriptionMaxRows)</span> |
| <span class="nc" id="L304"> break;</span> |
| } |
| |
| <span class="fc" id="L307"> currentIndex++;</span> |
| <span class="fc" id="L308"> }</span> |
| |
| // If the loop was broken prematurely (max row count hit) we set the subscriptionStartIndex to the next index to start with. |
| // Otherwise, set it to null so the subscription call won't trigger chunk token generation. |
| <span class="pc bpc" id="L312" title="2 of 4 branches missed."> if (queryResults!=null && currentIndex < (queryResults.size() - 1)) {</span> |
| <span class="nc bnc" id="L313" title="All 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="nc" id="L314"> subscriptionStartIndex.value = currentIndex + 1;</span> |
| <span class="nc" id="L315"> result.setTruncated(Boolean.TRUE);</span> |
| } |
| else { |
| <span class="pc bpc" id="L318" title="1 of 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="nc" id="L319"> subscriptionStartIndex.value = null;</span> |
| <span class="fc" id="L320"> result.setTruncated(Boolean.FALSE);</span> |
| } |
| <span class="fc" id="L322"> return result;</span> |
| } |
| |
| public static List<?> findService(FindService body, FindQualifiers findQualifiers, EntityManager em) throws DispositionReportFaultMessage { |
| |
| <span class="fc" id="L327"> List<Object> keysFound = null;</span> |
| |
| // First perform the embedded FindTModel search which will augment the tModel bag with any resulting tModel keys. |
| <span class="pc bpc" id="L330" title="1 of 2 branches missed."> if (body.getTModelBag() == null)</span> |
| <span class="fc" id="L331"> body.setTModelBag(new TModelBag());</span> |
| <span class="fc" id="L332"> doFindTModelEmbeddedSearch(em, body.getFindQualifiers(), body.getFindTModel(), body.getTModelBag());</span> |
| |
| <span class="fc" id="L334"> keysFound = FindServiceByTModelKeyQuery.select(em, findQualifiers, body.getTModelBag(), body.getBusinessKey(), keysFound);</span> |
| <span class="fc bfc" id="L335" title="All 2 branches covered."> if (findQualifiers.isCombineCategoryBags()) {</span> |
| <span class="fc" id="L336"> keysFound = FindServiceByCombinedCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), body.getBusinessKey(), keysFound);</span> |
| } else { |
| <span class="fc" id="L338"> keysFound = FindServiceByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), body.getBusinessKey(), keysFound);</span> |
| } |
| <span class="fc" id="L340"> keysFound = FindServiceByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(), body.getBusinessKey(), keysFound);</span> |
| |
| <span class="pc bpc" id="L342" title="1 of 4 branches missed."> if (body.getFindTModel()==null && body.getCategoryBag()==null && </span> |
| <span class="pc bpc" id="L343" title="2 of 4 branches missed."> ( body.getTModelBag()==null || body.getTModelBag().getTModelKey().size() == 0) </span> |
| <span class="pc bpc" id="L344" title="3 of 4 branches missed."> && body.getName().size() == 0 && body.getBusinessKey() != null) {</span> |
| //support searching for all services for a business |
| <span class="nc" id="L346"> findQualifiers.setApproximateMatch(true);</span> |
| <span class="nc" id="L347"> body.getName().add(new Name("%", null));</span> |
| } |
| <span class="fc" id="L349"> keysFound = FindServiceByNameQuery.select(em, findQualifiers, body.getName(), body.getBusinessKey(), keysFound);</span> |
| |
| <span class="pc bpc" id="L351" title="1 of 2 branches missed."> if (body.getTModelBag().getTModelKey().size()==0) body.setTModelBag(null);</span> |
| <span class="fc" id="L352"> return keysFound;</span> |
| } |
| |
| public static ServiceList getServiceListFromKeys(FindService body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound) throws DispositionReportFaultMessage { |
| <span class="fc" id="L356"> return getServiceListFromKeys(body, findQualifiers, em, keysFound, null, null, null, null);</span> |
| } |
| |
| public static ServiceList getServiceListFromKeys(FindService body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound, |
| Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows) |
| throws DispositionReportFaultMessage { |
| <span class="fc" id="L362"> ServiceList result = new ServiceList();</span> |
| <span class="fc" id="L363"> ListDescription listDesc = new ListDescription();</span> |
| <span class="fc" id="L364"> result.setListDescription(listDesc);</span> |
| |
| // Sort and retrieve the final results taking paging into account |
| <span class="fc" id="L367"> List<?> queryResults = FetchBusinessServicesQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);</span> |
| <span class="pc bpc" id="L368" title="1 of 4 branches missed."> if (queryResults != null && queryResults.size() > 0)</span> |
| <span class="fc" id="L369"> result.setServiceInfos(new org.uddi.api_v3.ServiceInfos());</span> |
| |
| // Set the currentIndex to 0 or the value of the subscriptionStartIndex |
| <span class="fc" id="L372"> int currentIndex = 0;</span> |
| <span class="pc bpc" id="L373" title="1 of 4 branches missed."> if (subscriptionStartIndex != null && subscriptionStartIndex.value != null)</span> |
| <span class="nc" id="L374"> currentIndex = subscriptionStartIndex.value;</span> |
| |
| <span class="fc" id="L376"> int returnedRowCount = 0;</span> |
| <span class="pc bpc" id="L377" title="1 of 2 branches missed."> if (logger.isDebugEnabled()) logger.debug("Period = " + modifiedAfter + " ---- " + modifiedBefore);</span> |
| <span class="pc bpc" id="L378" title="1 of 4 branches missed."> while (queryResults!=null && currentIndex < queryResults.size()) {</span> |
| <span class="fc" id="L379"> Object item = queryResults.get(currentIndex);</span> |
| |
| <span class="fc" id="L381"> org.apache.juddi.model.BusinessService modelBusinessService = (org.apache.juddi.model.BusinessService)item;</span> |
| <span class="fc" id="L382"> org.uddi.api_v3.ServiceInfo apiServiceInfo = new org.uddi.api_v3.ServiceInfo();</span> |
| |
| <span class="fc" id="L384"> logger.debug(modelBusinessService.getEntityKey() + " is modified " + modelBusinessService.getModifiedIncludingChildren() + " " + modelBusinessService.getModifiedIncludingChildren().getTime() );</span> |
| <span class="fc bfc" id="L385" title="All 4 branches covered."> if (modifiedAfter != null && modifiedAfter.after(modelBusinessService.getModifiedIncludingChildren())) {</span> |
| <span class="fc" id="L386"> currentIndex++;</span> |
| <span class="fc" id="L387"> continue;</span> |
| } |
| |
| <span class="pc bpc" id="L390" title="1 of 4 branches missed."> if (modifiedBefore != null && modifiedBefore.before(modelBusinessService.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L391"> currentIndex++;</span> |
| <span class="nc" id="L392"> continue;</span> |
| } |
| <span class="fc" id="L394"> MappingModelToApi.mapServiceInfo(modelBusinessService, apiServiceInfo);</span> |
| |
| <span class="fc" id="L396"> result.getServiceInfos().getServiceInfo().add(apiServiceInfo);</span> |
| |
| <span class="fc" id="L398"> returnedRowCount++;</span> |
| // If the returned rows equals the max allowed, we can end the loop (applies to subscription calls only) |
| <span class="fc bfc" id="L400" title="All 2 branches covered."> if (subscriptionMaxRows != null) {</span> |
| <span class="pc bpc" id="L401" title="1 of 2 branches missed."> if (returnedRowCount == subscriptionMaxRows)</span> |
| <span class="nc" id="L402"> break;</span> |
| } |
| |
| <span class="fc" id="L405"> currentIndex++;</span> |
| <span class="fc" id="L406"> }</span> |
| |
| // If the loop was broken prematurely (max row count hit) we set the subscriptionStartIndex to the next index to start with. |
| // Otherwise, set it to null so the subscription call won't trigger chunk token generation. |
| <span class="pc bpc" id="L410" title="2 of 4 branches missed."> if (queryResults!=null && currentIndex < (queryResults.size() - 1)) {</span> |
| <span class="nc bnc" id="L411" title="All 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="nc" id="L412"> subscriptionStartIndex.value = currentIndex + 1;</span> |
| <span class="nc" id="L413"> result.setTruncated(Boolean.TRUE);</span> |
| } |
| else { |
| <span class="fc bfc" id="L416" title="All 2 branches covered."> if (subscriptionStartIndex != null)</span> |
| <span class="fc" id="L417"> subscriptionStartIndex.value = null;</span> |
| <span class="fc" id="L418"> result.setTruncated(Boolean.FALSE);</span> |
| } |
| |
| <span class="fc" id="L421"> return result;</span> |
| } |
| |
| public static List<Object> findTModel(FindTModel body, FindQualifiers findQualifiers, EntityManager em) throws DispositionReportFaultMessage { |
| <span class="fc" id="L425"> List<Object> keysFound = null;</span> |
| |
| <span class="fc" id="L427"> keysFound = FindTModelByIdentifierQuery.select(em, findQualifiers, body.getIdentifierBag(), keysFound);</span> |
| <span class="fc" id="L428"> keysFound = FindTModelByCategoryQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);</span> |
| <span class="fc" id="L429"> keysFound = FindTModelByCategoryGroupQuery.select(em, findQualifiers, body.getCategoryBag(), keysFound);</span> |
| <span class="fc" id="L430"> keysFound = FindTModelByNameQuery.select(em, findQualifiers, body.getName(), keysFound);</span> |
| |
| <span class="fc" id="L432"> return keysFound;</span> |
| } |
| |
| public static TModelList getTModelListFromKeys(FindTModel body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound) throws DispositionReportFaultMessage { |
| <span class="fc" id="L436"> return getTModelListFromKeys(body, findQualifiers, em, keysFound, null, null, null, null);</span> |
| } |
| |
| public static TModelList getTModelListFromKeys(FindTModel body, FindQualifiers findQualifiers, EntityManager em, List<?> keysFound, |
| Date modifiedAfter, Date modifiedBefore, Holder<Integer> subscriptionStartIndex, Integer subscriptionMaxRows) |
| throws DispositionReportFaultMessage { |
| <span class="fc" id="L442"> TModelList result = new TModelList();</span> |
| <span class="fc" id="L443"> ListDescription listDesc = new ListDescription();</span> |
| <span class="fc" id="L444"> result.setListDescription(listDesc);</span> |
| |
| // Sort and retrieve the final results taking paging into account |
| <span class="fc" id="L447"> List<?> queryResults = FetchTModelsQuery.select(em, findQualifiers, keysFound, body.getMaxRows(), body.getListHead(), listDesc);</span> |
| <span class="pc bpc" id="L448" title="1 of 4 branches missed."> if (queryResults != null && queryResults.size() > 0)</span> |
| <span class="fc" id="L449"> result.setTModelInfos(new org.uddi.api_v3.TModelInfos());</span> |
| |
| // Set the currentIndex to 0 or the value of the subscriptionStartIndex |
| <span class="fc" id="L452"> int currentIndex = 0;</span> |
| <span class="fc bfc" id="L453" title="All 4 branches covered."> if (subscriptionStartIndex != null && subscriptionStartIndex.value != null)</span> |
| <span class="fc" id="L454"> currentIndex = subscriptionStartIndex.value;</span> |
| |
| <span class="fc" id="L456"> int returnedRowCount = 0;</span> |
| |
| <span class="pc bpc" id="L458" title="1 of 4 branches missed."> while (queryResults!=null && currentIndex < queryResults.size()) {</span> |
| <span class="fc" id="L459"> Object item = queryResults.get(currentIndex);</span> |
| |
| <span class="fc" id="L461"> org.apache.juddi.model.Tmodel modelTModel = (org.apache.juddi.model.Tmodel)item;</span> |
| <span class="fc" id="L462"> org.uddi.api_v3.TModelInfo apiTModelInfo = new org.uddi.api_v3.TModelInfo();</span> |
| |
| <span class="pc bpc" id="L464" title="1 of 4 branches missed."> if (modifiedAfter != null && modifiedAfter.after(modelTModel.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L465"> currentIndex++;</span> |
| <span class="nc" id="L466"> continue;</span> |
| } |
| |
| <span class="pc bpc" id="L469" title="1 of 4 branches missed."> if (modifiedBefore != null && modifiedBefore.before(modelTModel.getModifiedIncludingChildren())) {</span> |
| <span class="nc" id="L470"> currentIndex++;</span> |
| <span class="nc" id="L471"> continue;</span> |
| } |
| |
| <span class="fc" id="L474"> MappingModelToApi.mapTModelInfo(modelTModel, apiTModelInfo);</span> |
| |
| <span class="fc" id="L476"> result.getTModelInfos().getTModelInfo().add(apiTModelInfo);</span> |
| |
| <span class="fc" id="L478"> returnedRowCount++;</span> |
| // If the returned rows equals the max allowed, we can end the loop (applies to subscription calls only) |
| <span class="fc bfc" id="L480" title="All 2 branches covered."> if (subscriptionMaxRows != null) {</span> |
| <span class="fc bfc" id="L481" title="All 2 branches covered."> if (returnedRowCount == subscriptionMaxRows)</span> |
| <span class="fc" id="L482"> break;</span> |
| } |
| |
| <span class="fc" id="L485"> currentIndex++;</span> |
| <span class="fc" id="L486"> }</span> |
| |
| // If the loop was broken prematurely (max row count hit) we set the subscriptionStartIndex to the next index to start with. |
| // Otherwise, set it to null so the subscription call won't trigger chunk token generation. |
| <span class="pc bpc" id="L490" title="1 of 4 branches missed."> if (queryResults!=null && currentIndex < (queryResults.size() - 1)) {</span> |
| <span class="pc bpc" id="L491" title="1 of 2 branches missed."> if (subscriptionStartIndex != null)</span> |
| <span class="fc" id="L492"> subscriptionStartIndex.value = currentIndex + 1;</span> |
| <span class="fc" id="L493"> result.setTruncated(Boolean.TRUE);</span> |
| } |
| else { |
| <span class="fc bfc" id="L496" title="All 2 branches covered."> if (subscriptionStartIndex != null)</span> |
| <span class="fc" id="L497"> subscriptionStartIndex.value = null;</span> |
| <span class="fc" id="L498"> result.setTruncated(Boolean.FALSE);</span> |
| } |
| |
| <span class="fc" id="L501"> return result;</span> |
| } |
| |
| |
| /* |
| * Retrieves related businesses based on the focal business and the direction (fromKey or toKey). The focal business is retrieved and then the |
| * appropriate publisher assertion collection is examined for matches. The assertion must be "completed" and if a keyedReference is passed, it must |
| * match exactly. Successful assertion matches are mapped to a RelationBusinessInfo structure and added to the passed in RelationalBusinessInfos |
| * structure. |
| */ |
| public static void getRelatedBusinesses(EntityManager em, |
| Direction direction, |
| String focalKey, |
| org.uddi.api_v3.KeyedReference keyedRef, |
| org.uddi.api_v3.RelatedBusinessInfos relatedBusinessInfos) |
| throws DispositionReportFaultMessage { |
| <span class="nc" id="L517"> getRelatedBusinesses(em, direction, focalKey, keyedRef, relatedBusinessInfos, null, null);</span> |
| <span class="nc" id="L518"> }</span> |
| |
| public static void getRelatedBusinesses(EntityManager em, |
| Direction direction, |
| String focalKey, |
| org.uddi.api_v3.KeyedReference keyedRef, |
| org.uddi.api_v3.RelatedBusinessInfos relatedBusinessInfos, |
| Date modifiedAfter, |
| Date modifiedBefore) |
| throws DispositionReportFaultMessage { |
| <span class="pc bpc" id="L528" title="1 of 2 branches missed."> if (relatedBusinessInfos == null)</span> |
| <span class="nc" id="L529"> relatedBusinessInfos = new org.uddi.api_v3.RelatedBusinessInfos();</span> |
| <span class="fc" id="L530"> org.apache.juddi.model.BusinessEntity focalBusiness = null;</span> |
| try { |
| <span class="fc" id="L532"> focalBusiness = em.find(org.apache.juddi.model.BusinessEntity.class, focalKey);</span> |
| <span class="pc" id="L533"> } catch (ClassCastException e) {}</span> |
| <span class="pc bpc" id="L534" title="1 of 2 branches missed."> if (focalBusiness == null)</span> |
| <span class="nc" id="L535"> throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.BusinessNotFound", focalKey));</span> |
| |
| <span class="fc" id="L537"> List<org.apache.juddi.model.PublisherAssertion> pubAssertList = null;</span> |
| <span class="fc bfc" id="L538" title="All 2 branches covered."> if (direction == Direction.FROM_KEY)</span> |
| <span class="fc" id="L539"> pubAssertList = focalBusiness.getPublisherAssertionsForFromKey();</span> |
| else |
| <span class="fc" id="L541"> pubAssertList = focalBusiness.getPublisherAssertionsForToKey();</span> |
| |
| <span class="pc bpc" id="L543" title="1 of 2 branches missed."> if (pubAssertList != null) {</span> |
| <span class="fc bfc" id="L544" title="All 2 branches covered."> for (org.apache.juddi.model.PublisherAssertion modelPublisherAssertion : pubAssertList) {</span> |
| <span class="pc bpc" id="L545" title="1 of 4 branches missed."> if ("true".equalsIgnoreCase(modelPublisherAssertion.getFromCheck()) && "true".equalsIgnoreCase(modelPublisherAssertion.getToCheck())) {</span> |
| <span class="pc bpc" id="L546" title="1 of 2 branches missed."> if (keyedRef != null) {</span> |
| <span class="nc bnc" id="L547" title="All 2 branches missed."> if(!keyedRef.getTModelKey().equals(modelPublisherAssertion.getTmodelKey()) || </span> |
| <span class="nc bnc" id="L548" title="All 2 branches missed."> !keyedRef.getKeyName().equals(modelPublisherAssertion.getKeyName()) || </span> |
| <span class="nc bnc" id="L549" title="All 2 branches missed."> !keyedRef.getKeyValue().equals(modelPublisherAssertion.getKeyValue())) {</span> |
| <span class="nc" id="L550"> continue;</span> |
| } |
| } |
| |
| <span class="fc" id="L554"> org.apache.juddi.model.BusinessEntity modelRelatedBusiness = null;</span> |
| <span class="fc bfc" id="L555" title="All 2 branches covered."> if (direction == Direction.FROM_KEY)</span> |
| <span class="fc" id="L556"> modelRelatedBusiness = em.find(org.apache.juddi.model.BusinessEntity.class, modelPublisherAssertion.getId().getToKey());</span> |
| else |
| <span class="fc" id="L558"> modelRelatedBusiness = em.find(org.apache.juddi.model.BusinessEntity.class, modelPublisherAssertion.getId().getFromKey());</span> |
| |
| <span class="pc bpc" id="L560" title="3 of 4 branches missed."> if (modifiedAfter != null && modifiedAfter.after(modelRelatedBusiness.getModifiedIncludingChildren()))</span> |
| <span class="nc" id="L561"> continue;</span> |
| |
| <span class="pc bpc" id="L563" title="3 of 4 branches missed."> if (modifiedBefore != null && modifiedBefore.before(modelRelatedBusiness.getModifiedIncludingChildren()))</span> |
| <span class="nc" id="L564"> continue;</span> |
| |
| <span class="fc" id="L566"> org.uddi.api_v3.RelatedBusinessInfo apiRelatedBusinessInfo = new org.uddi.api_v3.RelatedBusinessInfo();</span> |
| |
| <span class="fc" id="L568"> MappingModelToApi.mapRelatedBusinessInfo(modelPublisherAssertion, modelRelatedBusiness, direction, apiRelatedBusinessInfo);</span> |
| |
| <span class="fc" id="L570"> relatedBusinessInfos.getRelatedBusinessInfo().add(apiRelatedBusinessInfo);</span> |
| } |
| <span class="fc" id="L572"> }</span> |
| } |
| |
| <span class="fc" id="L575"> }</span> |
| |
| public static RelatedBusinessesList getRelatedBusinessesList(FindRelatedBusinesses body, EntityManager em) throws DispositionReportFaultMessage { |
| <span class="fc" id="L578"> return getRelatedBusinessesList(body, em, null, null);</span> |
| } |
| |
| public static RelatedBusinessesList getRelatedBusinessesList(FindRelatedBusinesses body, EntityManager em, Date modifiedAfter, Date modifiedBefore) throws DispositionReportFaultMessage { |
| <span class="fc" id="L582"> RelatedBusinessesList result = new RelatedBusinessesList();</span> |
| <span class="fc" id="L583"> result.setBusinessKey(body.getBusinessKey());</span> |
| <span class="fc" id="L584"> ListDescription listDesc = new ListDescription();</span> |
| <span class="fc" id="L585"> result.setListDescription(listDesc);</span> |
| |
| // Either one of the businessKey, fromKey or toKey will be passed. This is considered the "focal" business to which related businesses must be |
| // found. Rather than use a query, it seems simpler to take advantage of the model's publisher assertion collections. |
| <span class="fc" id="L589"> org.uddi.api_v3.RelatedBusinessInfos relatedBusinessInfos = new org.uddi.api_v3.RelatedBusinessInfos();</span> |
| <span class="fc bfc" id="L590" title="All 2 branches covered."> if (body.getBusinessKey() != null ) {</span> |
| <span class="fc" id="L591"> InquiryHelper.getRelatedBusinesses(em, Direction.FROM_KEY, body.getBusinessKey(), body.getKeyedReference(), relatedBusinessInfos, modifiedAfter, modifiedBefore);</span> |
| <span class="fc" id="L592"> InquiryHelper.getRelatedBusinesses(em, Direction.TO_KEY, body.getBusinessKey(), body.getKeyedReference(), relatedBusinessInfos, modifiedAfter, modifiedBefore);</span> |
| } |
| <span class="fc bfc" id="L594" title="All 2 branches covered."> else if (body.getFromKey() != null) {</span> |
| <span class="fc" id="L595"> InquiryHelper.getRelatedBusinesses(em, Direction.FROM_KEY, body.getFromKey(), body.getKeyedReference(), relatedBusinessInfos, modifiedAfter, modifiedBefore);</span> |
| <span class="fc" id="L596"> result.setBusinessKey(body.getFromKey());</span> |
| <span class="pc bpc" id="L597" title="1 of 2 branches missed."> } else if (body.getToKey() != null) {</span> |
| <span class="fc" id="L598"> InquiryHelper.getRelatedBusinesses(em, Direction.TO_KEY, body.getToKey(), body.getKeyedReference(), relatedBusinessInfos, modifiedAfter, modifiedBefore);</span> |
| <span class="fc" id="L599"> result.setBusinessKey(body.getToKey());</span> |
| } |
| <span class="fc bfc" id="L601" title="All 2 branches covered."> if (relatedBusinessInfos.getRelatedBusinessInfo().size() > 0) {</span> |
| // TODO: Do proper pagination! |
| <span class="fc" id="L603"> listDesc.setActualCount(relatedBusinessInfos.getRelatedBusinessInfo().size());</span> |
| <span class="fc" id="L604"> listDesc.setIncludeCount(relatedBusinessInfos.getRelatedBusinessInfo().size());</span> |
| <span class="fc" id="L605"> listDesc.setListHead(1);</span> |
| |
| <span class="fc" id="L607"> result.setRelatedBusinessInfos(relatedBusinessInfos);</span> |
| } |
| |
| <span class="fc" id="L610"> return result;</span> |
| } |
| |
| /** |
| * Performs the necessary queries for the find_tModel search and adds resulting tModel keys to the tModelBag provided. |
| */ |
| private static void doFindTModelEmbeddedSearch(EntityManager em, |
| org.uddi.api_v3.FindQualifiers fq, |
| FindTModel findTmodel, |
| TModelBag tmodelBag) |
| throws DispositionReportFaultMessage { |
| |
| |
| <span class="pc bpc" id="L623" title="1 of 4 branches missed."> if (findTmodel != null && tmodelBag != null) {</span> |
| <span class="fc" id="L624"> org.apache.juddi.query.util.FindQualifiers findQualifiers = new org.apache.juddi.query.util.FindQualifiers();</span> |
| <span class="fc" id="L625"> findQualifiers.mapApiFindQualifiers(findTmodel.getFindQualifiers());</span> |
| |
| |
| <span class="fc" id="L628"> List<Object> tmodelKeysFound = null;</span> |
| <span class="fc" id="L629"> tmodelKeysFound = FindTModelByIdentifierQuery.select(em, findQualifiers, findTmodel.getIdentifierBag(), tmodelKeysFound);</span> |
| <span class="fc" id="L630"> tmodelKeysFound = FindTModelByCategoryQuery.select(em, findQualifiers, findTmodel.getCategoryBag(), tmodelKeysFound);</span> |
| <span class="fc" id="L631"> tmodelKeysFound = FindTModelByCategoryGroupQuery.select(em, findQualifiers, findTmodel.getCategoryBag(), tmodelKeysFound);</span> |
| <span class="fc" id="L632"> tmodelKeysFound = FindTModelByNameQuery.select(em, findQualifiers, findTmodel.getName(), tmodelKeysFound);</span> |
| |
| <span class="pc bpc" id="L634" title="1 of 4 branches missed."> if (tmodelKeysFound != null && tmodelKeysFound.size() > 0) {</span> |
| <span class="fc bfc" id="L635" title="All 2 branches covered."> for (Object item : tmodelKeysFound)</span> |
| <span class="fc" id="L636"> tmodelBag.getTModelKey().add((String)item);</span> |
| } |
| } |
| <span class="fc" id="L639"> }</span> |
| |
| private static List<Object> findBindingsByServiceKey(EntityManager em, String serviceKey, List<Object> keysFound) { |
| <span class="fc" id="L642"> org.apache.juddi.model.BusinessService modelBusinessService=em.find(org.apache.juddi.model.BusinessService.class, serviceKey);</span> |
| <span class="fc bfc" id="L643" title="All 2 branches covered."> for (BindingTemplate bt : modelBusinessService.getBindingTemplates()){</span> |
| <span class="fc" id="L644"> keysFound.add(bt.getEntityKey());</span> |
| <span class="fc" id="L645"> }</span> |
| <span class="fc" id="L646"> return keysFound;</span> |
| } |
| |
| |
| } |
| </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.7.9.201702052155</span></div></body></html> |