use of org.apache.directory.api.ldap.model.entry.DefaultAttribute in project directory-ldap-api by apache.
the class SchemaElementImpl method nameToLdif.
/**
* @return the Names as Ldif lines
* @throws org.apache.directory.api.ldap.model.exception.LdapException If the conversion goes wrong
*/
private String nameToLdif() throws LdapException {
if (names.isEmpty()) {
return "";
} else {
Entry entry = new DefaultEntry();
Attribute attribute = new DefaultAttribute("m-name");
for (String name : names) {
attribute.add(name);
}
entry.put(attribute);
return LdifUtils.convertAttributesToLdif(entry);
}
}
use of org.apache.directory.api.ldap.model.entry.DefaultAttribute in project directory-ldap-api by apache.
the class SchemaElementImpl method descToLdif.
/**
* @return The description as a ldif line
* @throws org.apache.directory.api.ldap.model.exception.LdapException If the conversion goes wrong
*/
private String descToLdif() throws LdapException {
if (Strings.isEmpty(description)) {
return "";
} else {
Entry entry = new DefaultEntry();
Attribute attribute = new DefaultAttribute("m-description", description);
entry.put(attribute);
return LdifUtils.convertAttributesToLdif(entry);
}
}
use of org.apache.directory.api.ldap.model.entry.DefaultAttribute in project directory-ldap-api by apache.
the class SchemaElementImpl method extensionsToLdif.
/**
* Return the extensions formated as Ldif lines
*
* @param id The attributeId : can be m-objectClassExtension or
* m-attributeTypeExtension
* @return The extensions formated as ldif lines
* @throws org.apache.directory.api.ldap.model.exception.LdapException If the conversion goes wrong
*/
protected String extensionsToLdif(String id) throws LdapException {
StringBuilder sb = new StringBuilder();
Entry entry = new DefaultEntry();
Attribute attribute = new DefaultAttribute(id);
for (String extension : extensions.keySet()) {
attribute.add(extension);
}
sb.append(LdifUtils.convertAttributesToLdif(entry));
return sb.toString();
}
use of org.apache.directory.api.ldap.model.entry.DefaultAttribute in project directory-ldap-api by apache.
the class ModifyRequestDecorator method addAttributeTypeAndValues.
/**
* Add a new attributeTypeAndValue
*
* @param type The attribute's name
*/
public void addAttributeTypeAndValues(String type) {
currentAttribute = new DefaultAttribute(type);
Modification modification = new DefaultModification(currentOperation, currentAttribute);
getDecorated().addModification(modification);
}
use of org.apache.directory.api.ldap.model.entry.DefaultAttribute in project directory-ldap-api by apache.
the class SearchResultEntryDecorator method addAttribute.
/**
* Create a new attribute
*
* @param type The attribute's type
* @throws LdapException If the value is invalid
*/
public void addAttribute(String type) throws LdapException {
currentAttribute = new DefaultAttribute(type);
getDecorated().getEntry().put(currentAttribute);
}
Aggregations