private void addAttributeValue(String attrName, Set<Object> currentValues, Object valueToAdd) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException {
checkModifyBreak();
delayOperation();
if (resource != null && !resource.isTolerateDuplicateValues()) {
for (Object currentValue: currentValues) {
if (currentValue.equals(valueToAdd)) {
throw new IllegalArgumentException("The value '"+valueToAdd+"' of attribute '"+attrName+"' conflicts with existing value: Attempt to add value that already exists");
}
if (resource.isCaseIgnoreValues() && (valueToAdd instanceof String)) {
if (StringUtils.equalsIgnoreCase((String)currentValue, (String)valueToAdd)) {
throw new IllegalArgumentException("The value '"+valueToAdd+"' of attribute '"+attrName+"' conflicts with existing value: Attempt to add value that already exists");
}
}
}
}
if (resource != null && resource.isMonsterization() && DummyResource.VALUE_MONSTER.equals(valueToAdd)) {
Iterator<Object> iterator = currentValues.iterator();
while (iterator.hasNext()) {
if (DummyResource.VALUE_COOKIE.equals(iterator.next())) {
iterator.remove();
}
}
}
Set<Object> valuesToCheck = new HashSet<>();
valuesToCheck.addAll(currentValues);
valuesToCheck.add(valueToAdd);
checkSchema(attrName, valuesToCheck, "add");
currentValues.add(valueToAdd);
}