use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.
the class LdapProvisioning method createCalendarResource.
@Override
public CalendarResource createCalendarResource(String emailAddress, String password, Map<String, Object> calResAttrs) throws ServiceException {
emailAddress = emailAddress.toLowerCase().trim();
calResAttrs.put(Provisioning.A_zimbraAccountCalendarUserType, AccountCalendarUserType.RESOURCE.toString());
SpecialAttrs specialAttrs = mDIT.handleSpecialAttrs(calResAttrs);
CallbackContext callbackContext = new CallbackContext(CallbackContext.Op.CREATE);
Set<String> ocs = LdapObjectClass.getCalendarResourceObjectClasses(this);
Account acct = createAccount(emailAddress, password, calResAttrs, specialAttrs, ocs.toArray(new String[0]), false, null);
LdapCalendarResource resource = (LdapCalendarResource) getCalendarResourceById(acct.getId(), true);
AttributeManager.getInstance().postModify(calResAttrs, resource, callbackContext);
return resource;
}
use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.
the class LdapProvisioning method getCalendarResourceById.
private CalendarResource getCalendarResourceById(String zimbraId, boolean loadFromMaster) throws ServiceException {
if (zimbraId == null)
return null;
Account acct = accountCache.getById(zimbraId);
if (acct != null) {
if (acct instanceof LdapCalendarResource) {
return (LdapCalendarResource) acct;
} else {
// could be a non-resource Account
return null;
}
}
LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceById(zimbraId), null, loadFromMaster);
accountCache.put(resource);
return resource;
}
use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.
the class LdapProvisioning method getCalendarResourceByForeignPrincipal.
private CalendarResource getCalendarResourceByForeignPrincipal(String foreignPrincipal, boolean loadFromMaster) throws ServiceException {
LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceByForeignPrincipal(foreignPrincipal), null, loadFromMaster);
accountCache.put(resource);
return resource;
}
use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.
the class LdapProvisioning method getCalendarResourceByName.
private CalendarResource getCalendarResourceByName(String emailAddress, boolean loadFromMaster) throws ServiceException {
emailAddress = fixupAccountName(emailAddress);
Account acct = accountCache.getByName(emailAddress);
if (acct != null) {
if (acct instanceof LdapCalendarResource) {
return (LdapCalendarResource) acct;
} else {
// could be a non-resource Account
return null;
}
}
LdapCalendarResource resource = (LdapCalendarResource) getAccountByQuery(mDIT.mailBranchBaseDN(), filterFactory.calendarResourceByName(emailAddress), null, loadFromMaster);
accountCache.put(resource);
return resource;
}
use of com.zimbra.cs.account.ldap.entry.LdapCalendarResource in project zm-mailbox by Zimbra.
the class LdapProvisioning method makeAccount.
private Account makeAccount(String dn, ZAttributes attrs, MakeObjectOpt makeObjOpt) throws ServiceException {
String userType = attrs.getAttrString(Provisioning.A_zimbraAccountCalendarUserType);
boolean isAccount = (userType == null) || userType.equals(AccountCalendarUserType.USER.toString());
String emailAddress = attrs.getAttrString(Provisioning.A_zimbraMailDeliveryAddress);
if (emailAddress == null)
emailAddress = mDIT.dnToEmail(dn, attrs);
Account acct = (isAccount) ? new LdapAccount(dn, emailAddress, attrs, null, this) : new LdapCalendarResource(dn, emailAddress, attrs, null, this);
setAccountDefaults(acct, makeObjOpt);
return acct;
}
Aggregations