use of com.zimbra.soap.mail.type.ActionSelector in project zm-mailbox by Zimbra.
the class ZMailbox method resetImapUid.
public ItemActionResponse resetImapUid(List<Integer> idList) throws ServiceException {
String ids = Joiner.on(",").join(idList);
ActionSelector action = ActionSelector.createForIdsAndOperation(ids, MailConstants.OP_RESET_IMAP_UID);
ItemActionRequest req = new ItemActionRequest(action);
return invokeJaxb(req);
}
use of com.zimbra.soap.mail.type.ActionSelector in project zm-mailbox by Zimbra.
the class SearchAction method getMsgActionRequest.
public static MsgActionRequest getMsgActionRequest(List<SearchHit> searchHits, String op) {
StringBuilder Ids = new StringBuilder();
for (SearchHit searchHit : searchHits) {
String id = searchHit.getId();
Ids.append(id);
Ids.append(",");
}
String IdsStr = Ids.length() > 0 ? Ids.substring(0, Ids.length() - 1) : "";
ActionSelector actionSelector = new ActionSelector(IdsStr, op);
MsgActionRequest req = new MsgActionRequest(actionSelector);
return req;
}
use of com.zimbra.soap.mail.type.ActionSelector in project zm-mailbox by Zimbra.
the class ZMailbox method copyItemAction.
public ItemActionResponse copyItemAction(ItemIdentifier targetFolder, List<ItemIdentifier> idList) throws ServiceException {
String ids = Joiner.on(',').join(idList);
ActionSelector action = ActionSelector.createForIdsAndOperation(ids, MailConstants.OP_COPY);
action.setFolder(targetFolder.toString(this.getAccountId()));
action.setNewlyCreatedIds(true);
ItemActionRequest req = new ItemActionRequest(action);
return invokeJaxb(req);
}
use of com.zimbra.soap.mail.type.ActionSelector in project zm-mailbox by Zimbra.
the class ZMailbox method delete.
/**
* Delete <tt>MailItem</tt>s with given ids. If there is no <tt>MailItem</tt> for a given id, that id is ignored.
*
* @param octxt operation context or {@code null}
* @param itemIds item ids
* @param nonExistingItems If not null, This gets populated with the item IDs of nonExisting items
*/
@Override
public void delete(OpContext octxt, List<Integer> itemIds, List<Integer> nonExistingItems) throws ServiceException {
String ids = Joiner.on(",").join(itemIds);
ActionSelector action = ActionSelector.createForIdsAndOperation(ids, MailConstants.OP_HARD_DELETE);
action.setNonExistentIds(true);
ItemActionRequest req = new ItemActionRequest(action);
ItemActionResponse resp = invokeJaxb(req);
ActionResult ar = resp.getAction();
for (String id : ar.getNonExistentIds().split(",")) {
if (id.length() > 0) {
nonExistingItems.add(Integer.parseInt(id));
}
}
}
use of com.zimbra.soap.mail.type.ActionSelector in project zm-mailbox by Zimbra.
the class TestTags method testAddTag.
@SuppressWarnings("deprecation")
@Test
public void testAddTag() throws Exception {
CreateTagRequest createTagReq = new CreateTagRequest();
TagSpec tag = new TagSpec("tag150146840461812563");
tag.setColor((byte) 5);
createTagReq.setTag(tag);
ZMailbox zMbox = TestUtil.getZMailbox(USER);
CreateTagResponse createResp = zMbox.invokeJaxb(createTagReq);
assertNotNull("CreateTagResponse should not be null", createResp);
TagInfo createdTag = createResp.getTag();
assertNotNull("CreateTagResponse/tag should not be null", createdTag);
assertNotNull("Created tag should have an ID", createdTag.getId());
assertNotNull("Created tag should have a color", createdTag.getColor());
assertTrue("Color of created tag should be 5", createdTag.getColor() == (byte) 5);
// use "update" and "t" element
ActionSelector msgAction = ActionSelector.createForIdsAndOperation(Integer.toString(mMessage1.getId()), MailConstants.OP_UPDATE);
msgAction.setTags(createdTag.getId());
MsgActionRequest msgActionReq = new MsgActionRequest(msgAction);
MsgActionResponse msgActionResp = zMbox.invokeJaxb(msgActionReq);
assertNotNull("MsgActionResponse should not be null", msgActionResp);
ActionResult res = msgActionResp.getAction();
assertNotNull("MsgActionResponse/action should not be null", res);
// use "tag" and "tag" element
msgAction = ActionSelector.createForIdsAndOperation(Integer.toString(mMessage3.getId()), MailConstants.OP_TAG);
msgAction.setTag(Integer.parseInt(createdTag.getId()));
msgActionReq = new MsgActionRequest(msgAction);
msgActionResp = zMbox.invokeJaxb(msgActionReq);
assertNotNull("MsgActionResponse should not be null", msgActionResp);
res = msgActionResp.getAction();
assertNotNull("MsgActionResponse/action should not be null", res);
}
Aggregations