@Test public void testToModificationRemoveAttributeNoValue() { final Field field = new Field(); field.setType(FieldType.GROUP); field.setName("memberOf"); final RemoveModificationDetails details = new RemoveModificationDetails(DN, field); final Modification modification = converter.toModification(details); assertEquals("Unexpected operation", ModificationOperation.REMOVE_ATTRIBUTE, modification.getOperation()); assertEquals("Unexpected values", 0, modification.getAttribute().size()); }
public Modification toModification(ModificationDetails modificationDetails) { final String value = null == modificationDetails.getValue() ? null : modificationDetails.getValue().toString(); Operation operation = modificationDetails.getOperation(); String strAttribute = modificationDetails.getAttribute().getName(); switch (operation) { case ADD: return new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, strAttribute, value); case REMOVE: return null == value ? new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute) : new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute, value); case REPLACE: return new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, strAttribute, value); default: return null; } }
ApacheAPIConverter { public Modification toModification(ModificationDetails modificationDetails) { final String value = null == modificationDetails.getValue() ? null : modificationDetails.getValue().toString(); Operation operation = modificationDetails.getOperation(); String strAttribute = modificationDetails.getAttribute().getName(); switch (operation) { case ADD: return new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, strAttribute, value); case REMOVE: return null == value ? new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute) : new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute, value); case REPLACE: return new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, strAttribute, value); default: return null; } } }
ApacheAPIConverter { public Modification toModification(ModificationDetails modificationDetails) { final String value = null == modificationDetails.getValue() ? null : modificationDetails.getValue().toString(); Operation operation = modificationDetails.getOperation(); String strAttribute = modificationDetails.getAttribute().getName(); switch (operation) { case ADD: return new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, strAttribute, value); case REMOVE: return null == value ? new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute) : new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute, value); case REPLACE: return new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, strAttribute, value); default: return null; } }  }
ApacheAPIConverter { public Modification toModification(ModificationDetails modificationDetails) { final String value = null == modificationDetails.getValue() ? null : modificationDetails.getValue().toString(); Operation operation = modificationDetails.getOperation(); String strAttribute = modificationDetails.getAttribute().getName(); switch (operation) { case ADD: return new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, strAttribute, value); case REMOVE: return null == value ? new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute) : new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute, value); case REPLACE: return new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, strAttribute, value); default: return null; } }  Modification toModification(ModificationDetails modificationDetails); }
ApacheAPIConverter { public Modification toModification(ModificationDetails modificationDetails) { final String value = null == modificationDetails.getValue() ? null : modificationDetails.getValue().toString(); Operation operation = modificationDetails.getOperation(); String strAttribute = modificationDetails.getAttribute().getName(); switch (operation) { case ADD: return new DefaultModification(ModificationOperation.ADD_ATTRIBUTE, strAttribute, value); case REMOVE: return null == value ? new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute) : new DefaultModification(ModificationOperation.REMOVE_ATTRIBUTE, strAttribute, value); case REPLACE: return new DefaultModification(ModificationOperation.REPLACE_ATTRIBUTE, strAttribute, value); default: return null; } }  Modification toModification(ModificationDetails modificationDetails);  }