/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
/** * Create an instance of {@link AttributeValueListKey } * */ public AttributeValueListKey createAttributeValueListKey() { return new AttributeValueListKey(); }
public Object createNewInstance() { return new AttributeValueListKey(); }
public Object createNewInstance() { return new AttributeValueListKey(); }
public Object createNewInstance() { return new AttributeValueListKey(); }
/** * Deletes an existing attribute value list. <p>Requires WRITE permission on namespace</p> * * @param namespace the namespace of the attribute value list * @param attributeValueListName the name of the attribute value list * * @return the attribute value list information */ @RequestMapping(value = ATTRIBUTE_VALUE_LIST_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_ATTRIBUTE_VALUE_LISTS_DELETE) public AttributeValueList deleteAttributeValueList(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return attributeValueListService.deleteAttributeValueList(new AttributeValueListKey(namespace, attributeValueListName)); }
/** * Retrieves a range of existing allowed attribute values. * * @param namespace the namespace * @param attributeValueListName the attribute value list name * * @return the allowed attribute values */ @RequestMapping(value = ALLOWED_ATTRIBUTE_VALUES_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_ALLOWED_ATTRIBUTE_VALUES_ALL_GET) public AllowedAttributeValuesInformation getAllowedAttributeValues(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return allowedAttributeValueService.getAllowedAttributeValues(new AttributeValueListKey(namespace, attributeValueListName)); }
/** * Gets an existing attribute value list. <p>Requires READ permission on namespace</p> * * @param namespace the namespace of the attribute value list * @param attributeValueListName the name of the attribute value list * * @return the attribute value list information */ @RequestMapping(value = ATTRIBUTE_VALUE_LIST_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_ATTRIBUTE_VALUE_LISTS_GET) public AttributeValueList getAttributeValueList(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return attributeValueListService.getAttributeValueList(new AttributeValueListKey(namespace, attributeValueListName)); }
/** * Deletes an existing attribute value list. <p>Requires WRITE permission on namespace</p> * * @param namespace the namespace of the attribute value list * @param attributeValueListName the name of the attribute value list * * @return the attribute value list information */ @RequestMapping(value = ATTRIBUTE_VALUE_LIST_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.DELETE) @Secured(SecurityFunctions.FN_ATTRIBUTE_VALUE_LISTS_DELETE) public AttributeValueList deleteAttributeValueList(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return attributeValueListService.deleteAttributeValueList(new AttributeValueListKey(namespace, attributeValueListName)); }
/** * Gets an existing attribute value list. <p>Requires READ permission on namespace</p> * * @param namespace the namespace of the attribute value list * @param attributeValueListName the name of the attribute value list * * @return the attribute value list information */ @RequestMapping(value = ATTRIBUTE_VALUE_LIST_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_ATTRIBUTE_VALUE_LISTS_GET) public AttributeValueList getAttributeValueList(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return attributeValueListService.getAttributeValueList(new AttributeValueListKey(namespace, attributeValueListName)); }
/** * Retrieves a range of existing allowed attribute values. * * @param namespace the namespace * @param attributeValueListName the attribute value list name * * @return the allowed attribute values */ @RequestMapping(value = ALLOWED_ATTRIBUTE_VALUES_URI_PREFIX + "/namespaces/{namespace}/attributeValueListNames/{attributeValueListName}", method = RequestMethod.GET) @Secured(SecurityFunctions.FN_ALLOWED_ATTRIBUTE_VALUES_ALL_GET) public AllowedAttributeValuesInformation getAllowedAttributeValues(@PathVariable("namespace") String namespace, @PathVariable("attributeValueListName") String attributeValueListName) { return allowedAttributeValueService.getAllowedAttributeValues(new AttributeValueListKey(namespace, attributeValueListName)); }
@Test public void testGetAttributeValueLists() { // Create an attribute value list key. AttributeValueListKeys attributeValueListKeys = new AttributeValueListKeys(Arrays.asList(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME))); // Mock calls to external methods. when(attributeValueListService.getAttributeValueLists()).thenReturn(attributeValueListKeys); // Call the method under test. AttributeValueListKeys result = attributeValueListRestController.getAttributeValueLists(); // Verify the external calls. verify(attributeValueListService).getAttributeValueLists(); verifyNoMoreInteractions(attributeValueListService); // Validate the result. assertEquals(attributeValueListKeys, result); } }
@Test public void createValidateAttributeValueListKey() { // Create an attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Mock calls to external methods. when(alternateKeyHelper.validateStringParameter("namespace", ATTRIBUTE_VALUE_LIST_NAMESPACE)).thenReturn(ATTRIBUTE_VALUE_LIST_NAMESPACE); when(alternateKeyHelper.validateStringParameter("An", "attribute value list name", ATTRIBUTE_VALUE_LIST_NAME)).thenReturn(ATTRIBUTE_VALUE_LIST_NAME); // Call the method under test. attributeValueListHelper.validateAttributeValueListKey(attributeValueListKey); // Verify the external calls. verify(alternateKeyHelper).validateStringParameter("namespace", ATTRIBUTE_VALUE_LIST_NAMESPACE); verify(alternateKeyHelper).validateStringParameter("An", "attribute value list name", ATTRIBUTE_VALUE_LIST_NAME); verifyNoMoreInteractions(alternateKeyHelper); // Validate the result. assertEquals(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME), attributeValueListKey); }
@Test public void testGetAttributeValueListByKey() { // Create and persist a attribute value list entity. AttributeValueListEntity attributeValueListEntity = attributeValueListDaoTestHelper.createAttributeValueListEntity(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Retrieve a attribute value list entity. assertEquals(attributeValueListEntity, attributeValueListDao.getAttributeValueListByKey(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME))); // Test case insensitivity. assertEquals(attributeValueListEntity, attributeValueListDao .getAttributeValueListByKey(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE.toUpperCase(), ATTRIBUTE_VALUE_LIST_NAME.toUpperCase()))); assertEquals(attributeValueListEntity, attributeValueListDao .getAttributeValueListByKey(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE.toLowerCase(), ATTRIBUTE_VALUE_LIST_NAME.toLowerCase()))); // Confirm negative results when using invalid values. assertNull(attributeValueListDao.getAttributeValueListByKey(new AttributeValueListKey(I_DO_NOT_EXIST, ATTRIBUTE_VALUE_LIST_NAME))); assertNull(attributeValueListDao.getAttributeValueListByKey(new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, I_DO_NOT_EXIST))); }
@Test public void testDeleteAttributeValueList() { // Create an attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Create an attribute value list. AttributeValueList attributeValueList = new AttributeValueList(ATTRIBUTE_VALUE_LIST_ID, attributeValueListKey); // Mock calls to external methods. when(attributeValueListService.deleteAttributeValueList(attributeValueListKey)).thenReturn(attributeValueList); // Call the method under test. AttributeValueList result = attributeValueListRestController.deleteAttributeValueList(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Verify the external calls. verify(attributeValueListService).deleteAttributeValueList(attributeValueListKey); verifyNoMoreInteractions(attributeValueListService); // Validate the result. assertEquals(attributeValueList, result); }
@Test public void testGetAttributeValueList() { // Create an attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Create an attribute value list. AttributeValueList attributeValueList = new AttributeValueList(ATTRIBUTE_VALUE_LIST_ID, attributeValueListKey); // Mock calls to external methods. when(attributeValueListService.getAttributeValueList(attributeValueListKey)).thenReturn(attributeValueList); // Call the method under test. AttributeValueList result = attributeValueListRestController.getAttributeValueList(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Verify the external calls. verify(attributeValueListService).getAttributeValueList(attributeValueListKey); verifyNoMoreInteractions(attributeValueListService); // Validate the result. assertEquals(attributeValueList, result); }
@Test public void testGetAttributeValueListEntity() { // Create an attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(ATTRIBUTE_VALUE_LIST_NAMESPACE, ATTRIBUTE_VALUE_LIST_NAME); // Create an attribute value list entity. AttributeValueListEntity attributeValueListEntity = new AttributeValueListEntity(); // Mock calls to external methods. when(attributeValueListDao.getAttributeValueListByKey(attributeValueListKey)).thenReturn(attributeValueListEntity); // Call the method under test. AttributeValueListEntity result = attributeValueListDaoHelper.getAttributeValueListEntity(attributeValueListKey); // Verify the external calls. verify(attributeValueListDao).getAttributeValueListByKey(attributeValueListKey); verifyNoMoreInteractions(attributeValueListDao); // Validate the result. assertEquals(attributeValueListEntity, result); }
private GlobalAttributeDefinitionEntity createGlobalAttributeDefinitionEntityWithAllowedAttributeValues() { // Create attribute value list key. AttributeValueListKey attributeValueListKey = new AttributeValueListKey(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME); List<String> allowedAttributeValueList = Arrays.asList(ALLOWED_ATTRIBUTE_VALUE, ALLOWED_ATTRIBUTE_VALUE_2); // Create and persist a attribute value list key entity. AttributeValueListEntity attributeValueListEntity = attributeValueListDaoTestHelper.createAttributeValueListEntity(NAMESPACE_CODE, ATTRIBUTE_VALUE_LIST_NAME); // Create and persist a list of allowed attribute values. List<AllowedAttributeValueEntity> allowedAttributeValueEntities = allowedAttributeValueDaoTestHelper.createAllowedAttributeValueEntities(attributeValueListKey, allowedAttributeValueList); attributeValueListEntity.getAllowedAttributeValues().addAll(allowedAttributeValueEntities); GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME); globalAttributeDefinitionEntity.setAttributeValueList(attributeValueListEntity); return globalAttributeDefinitionEntity; } }
/** * 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; } }