use of com.zimbra.soap.mail.type.ModifyContactSpec in project zm-mailbox by Zimbra.
the class ZMailbox method modifyContact.
/**
* @param id of contact
* @param replace if true, replace all attrs with specified attrs, otherwise merge with existing
* @param attrs modified attrs, or <tt>null</tt>
* @param attachments modified attachments , or <tt>null</tt>
* @param members members of a contact group
* @return updated contact
* @throws ServiceException on error
*/
public ZContact modifyContact(String id, boolean replace, Map<String, String> attrs, Map<String, ZAttachmentInfo> attachments, Map<String, String> members) throws ServiceException {
ModifyContactSpec contactSpec = ModifyContactSpec.createForId(Integer.valueOf(id));
ModifyContactRequest mcReq = new ModifyContactRequest(contactSpec);
mcReq.setWantImapUid(true);
mcReq.setWantModifiedSequence(true);
mcReq.setReplace(replace);
addAttrsAndAttachmentsToContact(contactSpec, attrs, attachments);
if (members != null) {
for (Map.Entry<String, String> entry : members.entrySet()) {
contactSpec.addContactGroupMemberWithTypeAndValue(entry.getValue(), entry.getKey());
}
}
return new ZContact(invokeJaxbToElement(mcReq).getElement(MailConstants.E_CONTACT), this);
}
Aggregations