AttributeServiceImpl extends BaseGenericServiceImpl<Attribute> implements AttributeService { @Override public List<Attribute> findAttributesWithMultipleValues(final String attributeGroupCode) { List<Attribute> attr = attributeDao.findByNamedQuery( "ATTRIBUTES.WITH.MULTIPLE.VALUES.BY.GROUPCODE", attributeGroupCode, Boolean.TRUE); if (attr.isEmpty()) { return null; } return attr; } AttributeServiceImpl(final GenericDAO<Attribute, Long> attributeDao,
                                final AttributeGroupService attributeGroupService); @Override List<Attribute> findByAttributeGroupCode(final String attributeGroupCode); @Override Attribute findByAttributeCode(final String attributeCode); @Override List<Attribute> findAttributesWithMultipleValues(final String attributeGroupCode); @Override List<Attribute> findAttributes(final int start, final int offset, final String sort, final boolean sortDescending, final Map<String, List> filter); @Override int findAttributeCount(final Map<String, List> filter); @Override List<Attribute> findAvailableAttributes(final String attributeGroupCode, final List<String> exclude); @Override Attribute getByAttributeCode(final String attributeCode); @Override List<Attribute> findAttributesByCodes(final String attributeGroupCode, final List<String> codes); @Override List<Attribute> getAvailableAttributesByProductTypeId(final long productTypeId); @Override List<Attribute> getAvailableImageAttributesByGroupCode(final String attributeGroupCode); @Override List<Attribute> getAvailableAttributesByGroupCodeStartsWith(final String attributeGroupCode, final String codePrefix); @Override Set<String> getAllAttributeCodes(); @Override Set<String> getAllNavigatableAttributeCodes(); @Override Set<String> getAllSearchableAttributeCodes(); @Override Set<String> getAllSearchablePrimaryAttributeCodes(); @Override Set<String> getAllStorableAttributeCodes(); @Override Map<String, Integer> getSingleNavigatableAttributeCodesByProductType(final long productTypeId); @Override I18NModel getNavigatableAttributeDisplayValue(final String attrCode, final String value); @Override Map<String, I18NModel> getAllAttributeNames(); @Override Map<String, I18NModel> getAttributeNamesByCodes(final Set<String> codes);  }
@Test public void testFindAttributesWithMultipleValues1() { assertEquals(5, attributeService.findAttributesWithMultipleValues(AttributeGroupNames.PRODUCT).size()); }
@Test public void testFindAttributesWithMultipleValues2() { List<Attribute> list = attributeService.findAttributesWithMultipleValues(AttributeGroupNames.PRODUCT); assertNotNull(list); assertEquals(5, list.size()); list = attributeService.findAttributesWithMultipleValues(AttributeGroupNames.SHOP); assertNull(list); }