use of org.opends.server.types.Attribute in project midpoint by Evolveum.
the class OpenDJController method getAttributeValues.
public static Collection<String> getAttributeValues(Entry response, String name) {
List<Attribute> attrs = response.getAttribute(name.toLowerCase());
if (attrs == null || attrs.size() == 0) {
return null;
}
assertEquals("Too many attributes for name " + name + ": ", 1, attrs.size());
Attribute attribute = attrs.get(0);
Collection<String> values = new ArrayList<String>(attribute.size());
Iterator<AttributeValue> iterator = attribute.iterator();
while (iterator.hasNext()) {
AttributeValue attributeValue = iterator.next();
values.add(attributeValue.getValue().toString());
}
return values;
}
use of org.opends.server.types.Attribute in project midpoint by Evolveum.
the class OpenDJController method getAttributeValueBinary.
public static byte[] getAttributeValueBinary(Entry response, String name) {
List<Attribute> attrs = response.getAttribute(name.toLowerCase());
if (attrs == null || attrs.size() == 0) {
return null;
}
assertEquals("Too many attributes for name " + name + ": ", 1, attrs.size());
Attribute attribute = attrs.get(0);
ByteString value = attribute.iterator().next().getValue();
return value.toByteArray();
}
use of org.opends.server.types.Attribute in project midpoint by Evolveum.
the class OpenDJController method toHumanReadableLdifoid.
public String toHumanReadableLdifoid(Entry entry) {
StringBuilder sb = new StringBuilder();
sb.append("dn: ").append(entry.getDN()).append("\n");
for (Attribute attribute : entry.getAttributes()) {
for (AttributeValue val : attribute) {
sb.append(attribute.getName());
sb.append(": ");
sb.append(val);
sb.append("\n");
}
}
return sb.toString();
}
Aggregations