use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZCalDataSource method toIdElement.
public Element toIdElement(Element parent) {
Element src = parent.addElement(MailConstants.E_DS_CAL);
src.addAttribute(MailConstants.A_ID, getId());
return src;
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZCalDataSource method toElement.
public Element toElement(Element parent) {
Element src = parent.addElement(MailConstants.E_DS_CAL);
src.addAttribute(MailConstants.A_ID, data.getId());
src.addAttribute(MailConstants.A_NAME, data.getName());
src.addAttribute(MailConstants.A_DS_IS_ENABLED, data.isEnabled());
src.addAttribute(MailConstants.A_FOLDER, data.getFolderId());
return src;
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method createDataSource.
/**
* Creates a data source.
*
* @return the new data source id
*/
public String createDataSource(ZDataSource source) throws ServiceException {
Element req = newRequestElement(MailConstants.CREATE_DATA_SOURCE_REQUEST);
source.toElement(req);
return invoke(req).listElements().get(0).getAttribute(MailConstants.A_ID);
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method createMountpoint.
/**
* create a new mountpoint in the specified parent folder.
*
* @param parentId parent folder id
* @param name name of new folder
* @param defaultView default view of new folder.
* @param color
* @param flags
* @param ownerBy used to specify whether owner is an id or account name (email address)
* @param owner either the id or name of the owner
* @param itemBy used to specify whether sharedItem is an id or path to the shared item
* @param sharedItem either the id or path of the item
* @param reminderEnabled whether client should show reminders on appointments/tasks
*
* @return newly created folder
* @throws ServiceException on error
* @param color initial color
* @param flags initial flags
*/
public ZMountpoint createMountpoint(String parentId, String name, ZFolder.View defaultView, ZFolder.Color color, String flags, OwnerBy ownerBy, String owner, SharedItemBy itemBy, String sharedItem, boolean reminderEnabled) throws ServiceException {
Element req = newRequestElement(MailConstants.CREATE_MOUNTPOINT_REQUEST);
Element linkEl = req.addUniqueElement(MailConstants.E_MOUNT);
linkEl.addAttribute(MailConstants.A_NAME, name);
linkEl.addAttribute(MailConstants.A_FOLDER, parentId);
if (defaultView != null) {
linkEl.addAttribute(MailConstants.A_DEFAULT_VIEW, defaultView.name());
}
if (color != null) {
if (StringUtil.equal(color.getName(), Color.RGBCOLOR)) {
linkEl.addAttribute(MailConstants.A_RGB, color.getRgbColorValue());
} else {
linkEl.addAttribute(MailConstants.A_COLOR, color.getValue());
}
}
if (flags != null) {
linkEl.addAttribute(MailConstants.A_FLAGS, flags);
}
linkEl.addAttribute(ownerBy == OwnerBy.BY_ID ? MailConstants.A_ZIMBRA_ID : MailConstants.A_OWNER_NAME, owner);
linkEl.addAttribute(itemBy == SharedItemBy.BY_ID ? MailConstants.A_REMOTE_ID : MailConstants.A_PATH, sharedItem);
linkEl.addAttribute(MailConstants.A_REMINDER, reminderEnabled);
Element newMountEl = invoke(req).getElement(MailConstants.E_MOUNT);
ZMountpoint newMount = getMountpointById(newMountEl.getAttribute(MailConstants.A_ID));
return newMount != null ? newMount : new ZMountpoint(newMountEl, null, this);
}
use of com.zimbra.common.soap.Element in project zm-mailbox by Zimbra.
the class ZMailbox method getMiniCal.
public synchronized ZGetMiniCalResult getMiniCal(long startMsec, long endMsec, String[] folderIds) throws ServiceException {
Set<String> dates = mApptSummaryCache.getMiniCal(startMsec, endMsec, folderIds);
List<ZMiniCalError> errors = null;
if (dates == null) {
Element req = newRequestElement(MailConstants.GET_MINI_CAL_REQUEST);
req.addAttribute(MailConstants.A_CAL_START_TIME, startMsec);
req.addAttribute(MailConstants.A_CAL_END_TIME, endMsec);
for (String folderId : folderIds) {
Element folderElem = req.addElement(MailConstants.E_FOLDER);
folderElem.addAttribute(MailConstants.A_ID, folderId);
}
Element resp = invoke(req);
dates = new HashSet<String>();
for (Element date : resp.listElements(MailConstants.E_CAL_MINICAL_DATE)) {
dates.add(date.getTextTrim());
}
mApptSummaryCache.putMiniCal(dates, startMsec, endMsec, folderIds);
for (Element error : resp.listElements(MailConstants.E_ERROR)) {
String fid = error.getAttribute(MailConstants.A_ID);
String code = error.getAttribute(MailConstants.A_CAL_CODE);
String msg = error.getTextTrim();
if (errors == null) {
errors = new ArrayList<ZMiniCalError>();
}
errors.add(new ZMiniCalError(fid, code, msg));
}
}
return new ZGetMiniCalResult(dates, errors);
}
Aggregations