/** * Validates the attributes. * * @param attributes the attributes to validate. Null shouldn't be specified. * @return the validated attribute map * @throws IllegalArgumentException if any invalid attributes were found. */ public Map<String, String> validateAttributes(List<Attribute> attributes) throws IllegalArgumentException { // Validate attributes if they are specified. Map<String, String> attributeNameValidationMap = new HashMap<>(); if (!CollectionUtils.isEmpty(attributes)) { for (Attribute attribute : attributes) { attribute.setName(alternateKeyHelper.validateStringParameter("An", "attribute name", attribute.getName())); // Ensure the attribute key isn't a duplicate by using a map with a "lowercase" name as the key for case insensitivity. String validationMapKey = attribute.getName().toLowerCase(); if (attributeNameValidationMap.containsKey(validationMapKey)) { throw new IllegalArgumentException("Duplicate attribute name found: " + attribute.getName()); } attributeNameValidationMap.put(validationMapKey, attribute.getValue()); } } return attributeNameValidationMap; }
/** * Validates the attributes. * * @param attributes the attributes to validate. Null shouldn't be specified. * @return the validated attribute map * @throws IllegalArgumentException if any invalid attributes were found. */ public Map<String, String> validateAttributes(List<Attribute> attributes) throws IllegalArgumentException { // Validate attributes if they are specified. Map<String, String> attributeNameValidationMap = new HashMap<>(); if (!CollectionUtils.isEmpty(attributes)) { for (Attribute attribute : attributes) { attribute.setName(alternateKeyHelper.validateStringParameter("An", "attribute name", attribute.getName())); // Ensure the attribute key isn't a duplicate by using a map with a "lowercase" name as the key for case insensitivity. String validationMapKey = attribute.getName().toLowerCase(); if (attributeNameValidationMap.containsKey(validationMapKey)) { throw new IllegalArgumentException("Duplicate attribute name found: " + attribute.getName()); } attributeNameValidationMap.put(validationMapKey, attribute.getValue()); } } return attributeNameValidationMap; }
/** * Returns a list of business object data attributes created using hard coded test values. * * @return the newly created list of business object data attributes */ protected List<Attribute> getTestAttributes() { List<Attribute> attributes = new ArrayList<>(); Attribute attribute1 = new Attribute(); attributes.add(attribute1); attribute1.setName(ATTRIBUTE_NAME_1_MIXED_CASE); attribute1.setValue(ATTRIBUTE_VALUE_1); Attribute attribute2 = new Attribute(); attributes.add(attribute2); attribute2.setName(ATTRIBUTE_NAME_2_MIXED_CASE); attribute2.setValue(ATTRIBUTE_VALUE_2); return attributes; }
attribute.setName(entry.getKey()); attribute.setValue(entry.getValue());
attribute.setName(entry.getKey()); attribute.setValue(entry.getValue());
@Test(expected = PersistenceException.class) public void testCreateBusinessObjectDataAttributeValueTooLarge() throws Exception { final BusinessObjectDataCreateRequest businessObjectDataCreateRequest = businessObjectDataServiceTestHelper.getNewBusinessObjectDataCreateRequest(); // Create and add a duplicate attribute which is not allowed. Attribute newAttribute = new Attribute(); newAttribute.setName("Valid Name"); newAttribute.setValue(new String(new char[4001]).replace('\0', 'A')); // Test value greater than 4000 byte limit. businessObjectDataCreateRequest.getAttributes().add(newAttribute); executeWithoutLogging(SqlExceptionHelper.class, new Command() { @Override public void execute() { // Create the business object data which is invalid. businessObjectDataService.createBusinessObjectData(businessObjectDataCreateRequest); } }); }
sourceName = this.getName(); String copyName = ((String) strategy.copy(LocatorUtils.property(locator, "name", sourceName), sourceName, (this.name!= null))); copy.setName(copyName); } else { if (nameShouldBeCopiedAndSet == Boolean.FALSE) {
sourceName = this.getName(); String copyName = ((String) strategy.copy(LocatorUtils.property(locator, "name", sourceName), sourceName, (this.name!= null))); copy.setName(copyName); } else { if (nameShouldBeCopiedAndSet == Boolean.FALSE) {
sourceName = this.getName(); String copyName = ((String) strategy.copy(LocatorUtils.property(locator, "name", sourceName), sourceName, (this.name!= null))); copy.setName(copyName); } else { if (nameShouldBeCopiedAndSet == Boolean.FALSE) {
attribute.setName(storageAttributeEntity.getName()); attribute.setValue(storageAttributeEntity.getValue());
attribute.setName(storageAttributeEntity.getName()); attribute.setValue(storageAttributeEntity.getValue());
attribute.setName(attributeEntity.getName()); attribute.setValue(attributeEntity.getValue());
attribute.setName(attributeEntity.getName()); attribute.setValue(attributeEntity.getValue());
attribute.setName(attributeEntity.getName()); attribute.setValue(attributeEntity.getValue());
attribute.setName(attributeEntity.getName()); attribute.setValue(attributeEntity.getValue());
request.getBusinessObjectDataAttributes().get(0).setName(BLANK_TEXT); try