use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method autoComplete.
public synchronized List<ZAutoCompleteMatch> autoComplete(String query, int limit) throws ServiceException {
Element req = newRequestElement(MailConstants.AUTO_COMPLETE_REQUEST);
req.addAttribute(MailConstants.A_LIMIT, limit);
req.addAttribute(MailConstants.A_INCLUDE_GAL, getFeatures().getGalAutoComplete());
req.addUniqueElement(MailConstants.E_NAME).setText(query);
Element response = invoke(req);
List<ZAutoCompleteMatch> matches = new ArrayList<ZAutoCompleteMatch>();
for (Element match : response.listElements(MailConstants.E_MATCH)) {
matches.add(new ZAutoCompleteMatch(match, this));
}
return matches;
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method cancelAppointment.
public void cancelAppointment(String id, String component, ZTimeZone tz, ZDateTime instance, CancelRange range, ZOutgoingMessage message) throws ServiceException {
Element req = newRequestElement(MailConstants.CANCEL_APPOINTMENT_REQUEST);
req.addAttribute(MailConstants.A_ID, id);
req.addAttribute(MailConstants.E_INVITE_COMPONENT, component);
if (tz != null) {
tz.toElement(req);
}
if (instance != null) {
Element instEl = instance.toElement(MailConstants.E_INSTANCE, req);
if (range != null) {
instEl.addAttribute(MailConstants.A_CAL_RANGE, range.name());
}
}
if (message != null) {
getMessageElement(req, message, null);
}
mMessageCache.remove(id);
invoke(req);
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method createIdentity.
public void createIdentity(ZIdentity identity) throws ServiceException {
Element req = newRequestElement(AccountConstants.CREATE_IDENTITY_REQUEST);
identity.toElement(req);
invoke(req);
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method saveAttachmentsToBriefcase.
public synchronized List<String> saveAttachmentsToBriefcase(String mid, String[] partIds, String folderId) throws ServiceException {
if (partIds == null || partIds.length <= 0) {
return null;
}
List<String> docIds = new ArrayList<String>();
for (String pid : partIds) {
//!TODO We should do batch request for performance
Element req = newRequestElement(MailConstants.SAVE_DOCUMENT_REQUEST);
Element doc = req.addElement(MailConstants.E_DOC).addAttribute(MailConstants.A_FOLDER, folderId);
Element m = doc.addElement(MailConstants.E_MSG).addAttribute(MailConstants.A_ID, mid);
m.addAttribute(MailConstants.A_PART, pid);
Element rDoc = invoke(req).getElement(MailConstants.E_DOC);
if (rDoc == null) {
continue;
}
docIds.add(rDoc.getAttribute(MailConstants.A_ID));
}
return docIds;
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method createDocument.
public String createDocument(String folderId, String name, String attachmentId, boolean isNote) throws ServiceException {
Element req = newRequestElement(MailConstants.SAVE_DOCUMENT_REQUEST);
Element doc = req.addUniqueElement(MailConstants.E_DOC);
doc.addAttribute(MailConstants.A_NAME, name);
doc.addAttribute(MailConstants.A_FOLDER, folderId);
if (isNote) {
doc.addAttribute(MailConstants.A_FLAGS, ZItem.Flag.note.toString());
}
Element upload = doc.addElement(MailConstants.E_UPLOAD);
upload.addAttribute(MailConstants.A_ID, attachmentId);
return invoke(req).getElement(MailConstants.E_DOC).getAttribute(MailConstants.A_ID);
}
Aggregations