@Test public void test_translateCollections_emptyList() throws Exception{ GenericQueryResults.Builder builder = GenericQueryResults.Builder.create(); GenericQueryResults.Builder builder2 = GenericQueryResults.Builder.create(); List<Component> components = componentService.translateCollections(builder.build(), builder2.build()); assert components != null; assert components.isEmpty(); assertImmutableList(components); }
protected List<Component> translateCollections(QueryResults<ComponentBo> componentBos, QueryResults<DerivedComponentBo> derivedComponentBos){ List<Component> components = new ArrayList<Component>(); if (componentBos != null && CollectionUtils.isNotEmpty(componentBos.getResults())) { for (ComponentBo componentBo : componentBos.getResults()) { components.add(ComponentBo.to(componentBo)); } } if (derivedComponentBos != null && CollectionUtils.isNotEmpty(derivedComponentBos.getResults())) { for (DerivedComponentBo derivedComponentBo : derivedComponentBos.getResults()) { components.add(DerivedComponentBo.to(derivedComponentBo)); } } return Collections.unmodifiableList(components); }
ComponentServiceImpl implements ComponentService { protected List<Component> translateCollections(QueryResults<ComponentBo> componentBos, QueryResults<DerivedComponentBo> derivedComponentBos){ List<Component> components = new ArrayList<Component>(); if (componentBos != null && CollectionUtils.isNotEmpty(componentBos.getResults())) { for (ComponentBo componentBo : componentBos.getResults()) { components.add(ComponentBo.to(componentBo)); } } if (derivedComponentBos != null && CollectionUtils.isNotEmpty(derivedComponentBos.getResults())) { for (DerivedComponentBo derivedComponentBo : derivedComponentBos.getResults()) { components.add(DerivedComponentBo.to(derivedComponentBo)); } } return Collections.unmodifiableList(components); } }
ComponentServiceImpl implements ComponentService { protected List<Component> translateCollections(QueryResults<ComponentBo> componentBos, QueryResults<DerivedComponentBo> derivedComponentBos){ List<Component> components = new ArrayList<Component>(); if (componentBos != null && CollectionUtils.isNotEmpty(componentBos.getResults())) { for (ComponentBo componentBo : componentBos.getResults()) { components.add(ComponentBo.to(componentBo)); } } if (derivedComponentBos != null && CollectionUtils.isNotEmpty(derivedComponentBos.getResults())) { for (DerivedComponentBo derivedComponentBo : derivedComponentBos.getResults()) { components.add(DerivedComponentBo.to(derivedComponentBo)); } } return Collections.unmodifiableList(components); }  }
ComponentServiceImpl implements ComponentService { protected List<Component> translateCollections(QueryResults<ComponentBo> componentBos, QueryResults<DerivedComponentBo> derivedComponentBos){ List<Component> components = new ArrayList<Component>(); if (componentBos != null && CollectionUtils.isNotEmpty(componentBos.getResults())) { for (ComponentBo componentBo : componentBos.getResults()) { components.add(ComponentBo.to(componentBo)); } } if (derivedComponentBos != null && CollectionUtils.isNotEmpty(derivedComponentBos.getResults())) { for (DerivedComponentBo derivedComponentBo : derivedComponentBos.getResults()) { components.add(DerivedComponentBo.to(derivedComponentBo)); } } return Collections.unmodifiableList(components); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ComponentServiceImpl implements ComponentService { protected List<Component> translateCollections(QueryResults<ComponentBo> componentBos, QueryResults<DerivedComponentBo> derivedComponentBos){ List<Component> components = new ArrayList<Component>(); if (componentBos != null && CollectionUtils.isNotEmpty(componentBos.getResults())) { for (ComponentBo componentBo : componentBos.getResults()) { components.add(ComponentBo.to(componentBo)); } } if (derivedComponentBos != null && CollectionUtils.isNotEmpty(derivedComponentBos.getResults())) { for (DerivedComponentBo derivedComponentBo : derivedComponentBos.getResults()) { components.add(DerivedComponentBo.to(derivedComponentBo)); } } return Collections.unmodifiableList(components); }  @Override Component getComponentByCode(String namespaceCode, String componentCode); @Override List<Component> getAllComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getActiveComponentsByNamespaceCode(String namespaceCode); @Override List<Component> getDerivedComponentSet(String componentSetId); @Override @Transactional void publishDerivedComponents(String componentSetId, List<Component> components); ComponentSetDao getComponentSetDao(); void setComponentSetDao(ComponentSetDao componentSetDao); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }