use of com.zimbra.cs.account.callback.CallbackContext in project zm-mailbox by Zimbra.
the class LdapProvisioning method modifyEphemeralAttrsInLdap.
/**
* Modifies this entry. If any of the provided attributes are ephemeral,
* they will be stored in LDAP instead of routed to EphemeralStore.
* Used by LdapEphemeralStore.
* @param e
* @param attrs
* @throws ServiceException
*/
public void modifyEphemeralAttrsInLdap(Entry e, Map<String, ? extends Object> attrs) throws ServiceException {
CallbackContext callbackContext = new CallbackContext(CallbackContext.Op.MODIFY);
AttributeManager.getInstance().preModify(attrs, e, callbackContext, false, true);
modifyAttrsInternal(e, null, attrs, true);
AttributeManager.getInstance().postModify(attrs, e, callbackContext, true);
}
use of com.zimbra.cs.account.callback.CallbackContext in project zm-mailbox by Zimbra.
the class LdapProvisioning method createXMPPComponent.
@Override
public XMPPComponent createXMPPComponent(String name, Domain domain, Server server, Map<String, Object> inAttrs) throws ServiceException {
name = name.toLowerCase().trim();
// sanity checking
removeAttrIgnoreCase("objectclass", inAttrs);
removeAttrIgnoreCase(A_zimbraDomainId, inAttrs);
removeAttrIgnoreCase(A_zimbraServerId, inAttrs);
CallbackContext callbackContext = new CallbackContext(CallbackContext.Op.CREATE);
AttributeManager.getInstance().preModify(inAttrs, null, callbackContext, true);
ZLdapContext zlc = null;
try {
zlc = LdapClient.getContext(LdapServerType.MASTER, LdapUsage.CREATE_XMPPCOMPONENT);
ZMutableEntry entry = LdapClient.createMutableEntry();
entry.mapToAttrs(inAttrs);
entry.setAttr(A_objectClass, "zimbraXMPPComponent");
String compId = LdapUtil.generateUUID();
entry.setAttr(A_zimbraId, compId);
entry.setAttr(A_zimbraCreateTimestamp, LdapDateUtil.toGeneralizedTime(new Date()));
entry.setAttr(A_cn, name);
String dn = mDIT.xmppcomponentNameToDN(name);
entry.setDN(dn);
entry.setAttr(A_zimbraDomainId, domain.getId());
entry.setAttr(A_zimbraServerId, server.getId());
zlc.createEntry(entry);
XMPPComponent comp = getXMPPComponentById(compId, zlc, true);
AttributeManager.getInstance().postModify(inAttrs, comp, callbackContext);
return comp;
} catch (LdapEntryAlreadyExistException nabe) {
throw AccountServiceException.IM_COMPONENT_EXISTS(name);
} finally {
LdapClient.closeContext(zlc);
}
}
Aggregations