public OperationOptions getOperationOptions(final ExternalResource resource) {
// -------------------------------------
// Ask just for mapped attributes
// -------------------------------------
final OperationOptionsBuilder oob = new OperationOptionsBuilder();
final Set<String> attributesToGet = new HashSet<String>(Arrays.asList(new String[]{Name.NAME, Uid.NAME,
OperationalAttributes.ENABLE_NAME}));
for (SchemaMapping mapping : resource.getMappings()) {
final String extAttrName = SchemaMappingUtil.getExtAttrName(mapping);
if (StringUtils.hasText(extAttrName)) {
attributesToGet.add(extAttrName);
}
}
oob.setAttributesToGet(attributesToGet);
// -------------------------------------
return oob.build();
}