/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theAttributeValueListName; theAttributeValueListName = this.getAttributeValueListName(); strategy.appendField(locator, this, "attributeValueListName", buffer, theAttributeValueListName, (this.attributeValueListName!= null)); } return buffer; }
/** * Validates an attribute value list key. * * @param attributeValueListKey the attribute value list key */ public void validateAttributeValueListKey(AttributeValueListKey attributeValueListKey) { // Validate. Assert.notNull(attributeValueListKey, "An attribute value list key must be specified."); attributeValueListKey.setNamespace(alternateKeyHelper.validateStringParameter("namespace", attributeValueListKey.getNamespace())); attributeValueListKey.setAttributeValueListName( alternateKeyHelper.validateStringParameter("An", "attribute value list name", attributeValueListKey.getAttributeValueListName())); } }
/** * Creates the allowed attribute values information from the persisted entities. * * @param attributeValueListEntity the attribute value list entity * @param allowedAttributeValueEntities the list of allowed attribute value entities * * @return the allowed attribute values information */ private AllowedAttributeValuesInformation createAllowedAttributeValuesInformationFromEntities(AttributeValueListEntity attributeValueListEntity, Collection<AllowedAttributeValueEntity> allowedAttributeValueEntities) { // Create an allowed attribute values information instance. AllowedAttributeValuesInformation allowedAttributeValuesInformation = new AllowedAttributeValuesInformation(); // Add the attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(); allowedAttributeValuesInformation.setAttributeValueListKey(attributeValueListKey); attributeValueListKey.setNamespace(attributeValueListEntity.getNamespace().getCode()); attributeValueListKey.setAttributeValueListName(attributeValueListEntity.getName()); // Add the allowed attribute values. List<String> allowedAttributeValues = new ArrayList<>(); allowedAttributeValuesInformation.setAllowedAttributeValues(allowedAttributeValues); allowedAttributeValueEntities.forEach(allowedAttributeValueEntity -> { allowedAttributeValues.add(allowedAttributeValueEntity.getAllowedAttributeValue()); }); return allowedAttributeValuesInformation; }
@Test public void testGetAttributeValueListKeys() { // Create several attribute value list keys in random order. List<AttributeValueListKey> attributeValueListKeys = Arrays .asList(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME_2), new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE_2, ATTRIBUTE_VALUE_LIST_NAME_2), new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE_2, ATTRIBUTE_VALUE_LIST_NAME), new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME)); // Create and persist attribute value list entities. for (AttributeValueListKey attributeValueListKey : attributeValueListKeys) { attributeValueListDaoTestHelper .createAttributeValueListEntity(attributeValueListKey.getNamespace(), attributeValueListKey.getAttributeValueListName()); } // Retrieve a list of attribute value list keys. assertEquals(Arrays.asList(attributeValueListKeys.get(3), attributeValueListKeys.get(0)), attributeValueListDao.getAttributeValueLists(Arrays.asList(ATTRIBUTE_VALUE_LIST_NAMESPACE))); // Test case sensitivity. assertEquals(new ArrayList<>(), attributeValueListDao.getAttributeValueLists(Arrays.asList(ATTRIBUTE_VALUE_LIST_NAMESPACE.toUpperCase()))); assertEquals(new ArrayList<>(), attributeValueListDao.getAttributeValueLists(Arrays.asList(ATTRIBUTE_VALUE_LIST_NAMESPACE.toLowerCase()))); // Retrieve the list of keys for all attribute value lists registered in the system. assertEquals(Arrays.asList(attributeValueListKeys.get(3), attributeValueListKeys.get(0), attributeValueListKeys.get(2), attributeValueListKeys.get(1)), attributeValueListDao.getAttributeValueLists(null)); } }
/** * Creates and persists a new attribute value list entity from the request information. * * @param request the request * @param namespaceEntity the namespace * * @return the newly created attribute value list entity */ private AttributeValueListEntity createAttributeValueListEntity(AttributeValueListCreateRequest request, NamespaceEntity namespaceEntity) { // Create a new entity. AttributeValueListEntity attributeValueListEntity = new AttributeValueListEntity(); attributeValueListEntity.setNamespace(namespaceEntity); attributeValueListEntity.setName(request.getAttributeValueListKey().getAttributeValueListName()); // Persist and return the newly created entity. return attributeValueListDao.saveAndRefresh(attributeValueListEntity); } }
public String toString() { final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); }
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; }
/** * Creates the allowed attribute values information from the persisted entities. * * @param attributeValueListEntity the attribute value list entity * @param allowedAttributeValueEntities the list of allowed attribute value entities * * @return the allowed attribute values information */ private AllowedAttributeValuesInformation createAllowedAttributeValuesInformationFromEntities(AttributeValueListEntity attributeValueListEntity, Collection<AllowedAttributeValueEntity> allowedAttributeValueEntities) { // Create an allowed attribute values information instance. AllowedAttributeValuesInformation allowedAttributeValuesInformation = new AllowedAttributeValuesInformation(); // Add the attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(); allowedAttributeValuesInformation.setAttributeValueListKey(attributeValueListKey); attributeValueListKey.setNamespace(attributeValueListEntity.getNamespace().getCode()); attributeValueListKey.setAttributeValueListName(attributeValueListEntity.getName()); // Add the allowed attribute values. List<String> allowedAttributeValues = new ArrayList<>(); allowedAttributeValuesInformation.setAllowedAttributeValues(allowedAttributeValues); allowedAttributeValueEntities.forEach(allowedAttributeValueEntity -> { allowedAttributeValues.add(allowedAttributeValueEntity.getAllowedAttributeValue()); }); return allowedAttributeValuesInformation; }
/** * Creates and persists a new attribute value list entity from the request information. * * @param request the request * @param namespaceEntity the namespace * * @return the newly created attribute value list entity */ private AttributeValueListEntity createAttributeValueListEntity(AttributeValueListCreateRequest request, NamespaceEntity namespaceEntity) { // Create a new entity. AttributeValueListEntity attributeValueListEntity = new AttributeValueListEntity(); attributeValueListEntity.setNamespace(namespaceEntity); attributeValueListEntity.setName(request.getAttributeValueListKey().getAttributeValueListName()); // Persist and return the newly created entity. return attributeValueListDao.saveAndRefresh(attributeValueListEntity); } }
public String toString() { final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); }
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; }
/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theAttributeValueListName; theAttributeValueListName = this.getAttributeValueListName(); strategy.appendField(locator, this, "attributeValueListName", buffer, theAttributeValueListName, (this.attributeValueListName!= null)); } return buffer; }
/** * Validates an attribute value list key. * * @param attributeValueListKey the attribute value list key */ public void validateAttributeValueListKey(AttributeValueListKey attributeValueListKey) { // Validate. Assert.notNull(attributeValueListKey, "An attribute value list key must be specified."); attributeValueListKey.setNamespace(alternateKeyHelper.validateStringParameter("namespace", attributeValueListKey.getNamespace())); attributeValueListKey.setAttributeValueListName( alternateKeyHelper.validateStringParameter("An", "attribute value list name", attributeValueListKey.getAttributeValueListName())); } }
/** * Creates the attribute value list from the persisted entity. * * @param attributeValueListEntity the attribute value list entity * * @return the attribute value list */ public AttributeValueList createAttributeValueListFromEntity(AttributeValueListEntity attributeValueListEntity) { // Create the attribute value list. AttributeValueList attributeValueList = new AttributeValueList(); AttributeValueListKey attributeValueListKey = new AttributeValueListKey(); attributeValueListKey.setNamespace(attributeValueListEntity.getNamespace().getCode()); attributeValueListKey.setAttributeValueListName(attributeValueListEntity.getName()); attributeValueList.setAttributeValueListKey(attributeValueListKey); attributeValueList.setId(attributeValueListEntity.getId()); return attributeValueList; } }
public String toString() { final ToStringStrategy2 strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); }
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; }
/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theNamespace; theNamespace = this.getNamespace(); strategy.appendField(locator, this, "namespace", buffer, theNamespace, (this.namespace!= null)); } { String theAttributeValueListName; theAttributeValueListName = this.getAttributeValueListName(); strategy.appendField(locator, this, "attributeValueListName", buffer, theAttributeValueListName, (this.attributeValueListName!= null)); } return buffer; }