use of org.forgerock.opendj.ldap.Modification in project OpenAM by OpenRock.
the class ModSet method remove.
/**
* Removes the first attribute with the specified name in the set of modifications.
* @param name name of the attribute to remove
*/
public synchronized void remove(String name) {
for (int i = 0; i < modifications.size(); i++) {
Modification mod = modifications.get(i);
Attribute attr = mod.getAttribute();
if (name.equalsIgnoreCase(attr.getAttributeDescriptionAsString())) {
modifications.remove(i);
return;
}
}
}
use of org.forgerock.opendj.ldap.Modification in project OpenAM by OpenRock.
the class Validation method validateAttributes.
/**
* Determines whether each attribute in the ModSet is valid.
*
* @param modSet
* modSet to test
* @param cls
* Class associated with these attributes
* @param guid
* the guid of the Organization where the config data is stored
* @exception UMSException
* failure
* @exception DataConstraintException
* data validation failure
*/
public static void validateAttributes(ModSet modSet, Class cls, Guid guid) throws UMSException, DataConstraintException {
if (modSet == null) {
return;
}
for (int i = 0; i < modSet.size(); i++) {
Modification ldapMod = modSet.elementAt(i);
if (!ModificationType.DELETE.equals(ldapMod.getModificationType())) {
Attr attr = new Attr(ldapMod.getAttribute());
validateAttribute(attr, cls, guid);
}
}
}
use of org.forgerock.opendj.ldap.Modification in project OpenAM by OpenRock.
the class COSManager method toModifications.
private Collection<Modification> toModifications(ModificationType type, AttrSet attrSet) {
Collection<Modification> modifications = new HashSet<>();
Enumeration<Attr> attributes = attrSet.getAttributes();
while (attributes.hasMoreElements()) {
modifications.add(new Modification(type, attributes.nextElement().toLDAPAttribute()));
}
return modifications;
}
use of org.forgerock.opendj.ldap.Modification in project OpenAM by OpenRock.
the class ModSet method add.
/**
* Specifies another modification to be added to the set of modifications.
* @param op the type of modification to make. This can be one of the following:
* <P>
* <UL>
* <LI><CODE>LDAPModification.ADD</CODE> (the value should be added to the attribute)
* <LI><CODE>LDAPModification.DELETE</CODE> (the value should be removed from the attribute)
* <LI><CODE>LDAPModification.REPLACE</CODE> (the value should replace the existing value of the attribute)
* </UL><P>
* If you are working with a binary value (not a string value), you need to bitwise OR (|) the
* modification type with <CODE>LDAPModification.BVALUES</CODE>.
* <P>
*
* @param attr the attribute (possibly with values) to modify
*/
public synchronized void add(int op, Attribute attr) {
Modification mod = new Modification(ModificationType.valueOf(op), attr);
modifications.add(mod);
}
use of org.forgerock.opendj.ldap.Modification in project OpenAM by OpenRock.
the class PersistentObject method modify.
/**
* Modifies the values of a single attribute for the entity.
* <P>
* IMPORTANT: To make the changes persistent, you need to call the save
* method to save the changes.
* <P>
*
* @param attr
* Attribute value to be modified
* @param modificationType
* Operation type in the modification. Input values include
*
* <pre>
* ModificationType.ADD,
* ModificationType.DELETE,
* ModificationType.REPLACE,
* ModificationType.INCREMENT
* </pre>
*
* @see ModSet
*
* @supported.api
*/
public void modify(Attr attr, ModificationType modificationType) {
Modification modification = new Modification(modificationType, attr.toLDAPAttribute());
modify(Collections.singleton(modification));
}
Aggregations