public void replaceAttributeValues(String name, Collection<Object> values) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); Set<Object> currentValues = attributes.get(name); if (currentValues == null) { currentValues = new HashSet<>(); attributes.put(name, currentValues); } else { currentValues.clear(); } currentValues.addAll(values); checkSchema(name, values, "replace"); recordModify(); }
public <T> void addAttributeValues(String name, Collection<T> valuesToAdd) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); Set<Object> currentValues = attributes.get(name); if (currentValues == null) { currentValues = new HashSet<>(); attributes.put(name, currentValues); } for(T valueToAdd: valuesToAdd) { addAttributeValue(name, currentValues, valueToAdd); } recordModify(); }
public void replaceAttributeValues(String name, Object... values) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); Set<Object> currentValues = attributes.get(name); if (currentValues == null) { currentValues = new HashSet<>(); attributes.put(name, currentValues); } else { currentValues.clear(); } List<Object> valuesList = Arrays.asList(values); currentValues.addAll(valuesList); checkSchema(name, valuesList, "replace"); if (valuesList.isEmpty()) { attributes.remove(name); } recordModify(); }
public void addAttributeValues(String name, String... valuesToAdd) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); Set<Object> currentValues = attributes.get(name); if (currentValues == null) { currentValues = new HashSet<>(); attributes.put(name, currentValues); } for (Object valueToAdd: valuesToAdd) { addAttributeValue(name, currentValues, valueToAdd); } recordModify(); }
public void setEnabled(Boolean enabled) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); this.enabled = enabled; recordModify(); }
public void setValidFrom(Date validFrom) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); this.validFrom = validFrom; recordModify(); }
public void setValidTo(Date validTo) throws ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); this.validTo = validTo; recordModify(); }
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); }
public <T> void removeAttributeValues(String name, Collection<T> values) throws SchemaViolationException, ConnectException, FileNotFoundException, SchemaViolationException, ConflictException, InterruptedException { checkModifyBreak(); delayOperation(); Set<Object> currentValues = attributes.get(name);