use of com.zimbra.cs.mailbox.Note.Rectangle in project zm-mailbox by Zimbra.
the class CreateNote method handle.
public Element handle(Element request, Map<String, Object> context) throws ServiceException {
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Mailbox mbox = getRequestedMailbox(zsc);
OperationContext octxt = getOperationContext(zsc, context);
ItemIdFormatter ifmt = new ItemIdFormatter(zsc);
Element t = request.getElement(MailConstants.E_NOTE);
ItemId iidFolder = new ItemId(t.getAttribute(MailConstants.A_FOLDER), zsc);
String content = t.getAttribute(MailConstants.E_CONTENT);
byte color = (byte) t.getAttributeLong(MailConstants.A_COLOR, MailItem.DEFAULT_COLOR);
String strBounds = t.getAttribute(MailConstants.A_BOUNDS, null);
Rectangle bounds = new Rectangle(strBounds);
Note note = mbox.createNote(octxt, content, bounds, color, iidFolder.getId());
Element response = zsc.createElement(MailConstants.CREATE_NOTE_RESPONSE);
if (note != null)
ToXML.encodeNote(response, ifmt, octxt, note);
return response;
}
use of com.zimbra.cs.mailbox.Note.Rectangle in project zm-mailbox by Zimbra.
the class NoteAction method handleNote.
private String handleNote(Map<String, Object> context, Element request, String operation) throws ServiceException {
Element action = request.getElement(MailConstants.E_ACTION);
ZimbraSoapContext zsc = getZimbraSoapContext(context);
Mailbox mbox = getRequestedMailbox(zsc);
OperationContext octxt = getOperationContext(zsc, context);
ItemId iid = new ItemId(action.getAttribute(MailConstants.A_ID), zsc);
if (operation.equals(OP_EDIT)) {
String content = action.getAttribute(MailConstants.E_CONTENT);
mbox.editNote(octxt, iid.getId(), content);
} else if (operation.equals(OP_REPOSITION)) {
String strBounds = action.getAttribute(MailConstants.A_BOUNDS, null);
mbox.repositionNote(octxt, iid.getId(), new Rectangle(strBounds));
} else
throw ServiceException.INVALID_REQUEST("unknown operation: " + operation, null);
return new ItemIdFormatter(zsc).formatItemId(iid);
}
Aggregations