use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.
the class PeopleContainer method setMaxUserLimit.
/**
* Sets max user limit for a People Container.
*
* @param limit
* number of users allowed in a People Container
* @supported.api
*/
public void setMaxUserLimit(long limit) throws UMSException {
String value = (new Long(limit)).toString();
setAttribute(new Attr(MAX_USER_ATTR_NAME, value));
}
use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.
the class PersistentObject method readAttributesFromDataStore.
/**
* Read the attributes from data store
*
* @param attrNames
* names of attributes to get
* @return collection of Attr read from data store
*/
private Collection readAttributesFromDataStore(Collection attrNames) throws UMSException {
Collection attributes = DataLayer.getInstance().getAttributes(getPrincipal(), getGuid(), attrNames);
if (attributes == null) {
String[] args = { getDN() };
throw new UMSException(i18n.getString(IUMSConstants.READ_ATTRIBUTES_ERROR, args));
}
Collection foundAttributes = new ArrayList();
if (m_attrSet == null) {
m_attrSet = new AttrSet();
}
if (m_nullAttributes == null) {
m_nullAttributes = new ArrayList();
}
Iterator iter = attributes.iterator();
while (iter.hasNext()) {
Attr attr = (Attr) iter.next();
foundAttributes.add(attr.getName());
m_attrSet.replace(attr);
}
iter = attrNames.iterator();
while (iter.hasNext()) {
String attrName = (String) iter.next();
if (!foundAttributes.contains(attrName) && !m_nullAttributes.contains(attrName)) {
m_nullAttributes.add(attrName);
}
}
return attributes;
}
use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.
the class PersistentObject method getACI.
/**
* Returns all the ACIs of this object with the given name.
*
* @param name Name of the ACI to get.
* @return collecion of ACIs of this object.
* @throws ACIParseException in case of any error
*
* @supported.api
*/
public Collection getACI(String name) throws ACIParseException, UMSException {
Collection acis = new ArrayList();
Attr aciAttr = getAttribute(ACI.ACI);
if (aciAttr != null) {
String[] aciTexts = aciAttr.getStringValues();
int size = aciTexts.length;
for (int i = 0; i < size; i++) {
ACI aci = ACI.valueOf(aciTexts[i]);
if (aci.getName().equals(name)) {
acis.add(aci);
}
}
}
return acis;
}
use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.
the class PersistentObject method replaceACI.
/**
* Replaces an ACI of this object
*
* @param oldACI ACI to be replaced.
* @param newACI the new ACI.
* @throws AccessRightsException if an access rights exception occurs.
* @throws UMSException if any error.
*
* @supported.api
*/
public void replaceACI(ACI oldACI, ACI newACI) throws AccessRightsException, UMSException {
Attr attr = new Attr(ACI.ACI, oldACI.getACIText());
modify(attr, ModificationType.DELETE);
attr = new Attr(ACI.ACI, newACI.toString());
modify(attr, ModificationType.ADD);
save();
}
use of com.iplanet.services.ldap.Attr in project OpenAM by OpenRock.
the class ManagedRole method removeMember.
/**
* Removes a member from the role. The change is saved to persistent
* storage.
*
* @param member
* member to be removed from the role
* @exception UMSException
* on failure to save to persistent storage
* @supported.api
*/
public void removeMember(PersistentObject member) throws UMSException {
Principal principal = getPrincipal();
if (principal == null) {
throw new IllegalArgumentException(i18n.getString(IUMSConstants.BAD_PRINCIPAL_HDL));
}
member.modify(new Attr(MEMBER_ATTR_NAME, this.getDN()), ModificationType.DELETE);
// member.save();
DataLayer.getInstance().removeAttributeValue(principal, member.getGuid(), MEMBER_ATTR_NAME, this.getDN());
}
Aggregations