ParsedItemID pid = ParsedItemID.Parse(request.getAttribute("id"));
ParsedItemID pid = ParsedItemID.parse(request.getAttribute("id"));
    public Element handle(Element request, Map context) throws ServiceException {        long startTime = sWatch.start();        try {            ZimbraContext lc = getZimbraContext(context);            Mailbox mbox = getRequestedMailbox(lc);            Account acct = this.getRequestedAccount(lc);            OperationContext octxt = lc.getOperationContext();//            int invId = (int)request.getAttributeLong("id");            ParsedItemID pid = ParsedItemID.Parse(request.getAttribute("id"));            int compNum = (int)request.getAttributeLong("compNum");                        String verbStr = request.getAttribute(MailService.A_VERB);            ParsedVerb verb = parseVerb(verbStr);                        boolean updateOrg = request.getAttributeBool(MailService.A_APPT_UPDATE_ORGANIZER, true);            // FIXME -- HACK until client is fixed            updateOrg = true;                        if (sLog.isInfoEnabled()) {                sLog.info("<SendInviteReply id=" + pid.toString() + " verb=" + verb +" updateOrg="+updateOrg+"> " + lc.toString());            }                        int replyId = 0;                        synchronized (mbox) {                Invite inv = null;                                int apptId;                 int inviteMsgId;                                // the user could be accepting EITHER the original-mail-item (id="nnn") OR the                // appointment (id="aaaa-nnnn") --- work in both cases                if (pid.hasSubId()) {                    // directly accepting the appointment                    apptId = pid.getItemIDInt();                    inviteMsgId = pid.getSubIdInt();                    Appointment appt = mbox.getAppointmentById(apptId);                     inv = appt.getInvite(inviteMsgId, compNum);                } else {                    // accepting the message: go find the appointment and then the invite                    inviteMsgId = pid.getItemIDInt();                    Message msg = mbox.getMessageById(inviteMsgId);                    Message.ApptInfo info = msg.getApptInfo(compNum);                    apptId = info.getAppointmentId();                    Appointment appt = mbox.getAppointmentById(apptId);                    inv = appt.getInvite(inviteMsgId, compNum);                  }                if (updateOrg) {                    String replySubject = this.getReplySubject(verb, inv);                                        Calendar iCal = CalendarUtils.buildReplyCalendar(acct, inv, verb, replySubject);                    System.out.println("GENERATED ICAL:\n"+iCal.toString());                                        MimeMessage toSend = null;                                        ParseMimeMessage.MimeMessageData parsedMessageData = new ParseMimeMessage.MimeMessageData();                                        // did they specify a custom <m> message?  If so, then we don't have to build one...                    Element msgElem = request.getOptionalElement(MailService.E_MSG);                    if (msgElem != null) {                        MimeBodyPart[] mbps = new MimeBodyPart[1];                        mbps[0] = CalendarUtils.makeICalIntoMimePart(inv.getUid(), iCal);                                                // the <inv> element is *NOT* allowed -- we always build it manually                        // based on the params to the <SendInviteReply> and stick it in the                         // mbps (additionalParts) parameter...                        toSend = ParseMimeMessage.parseMimeMsgSoap(octxt, mbox, msgElem, mbps,                                 ParseMimeMessage.NO_INV_ALLOWED_PARSER, parsedMessageData);                    } else {                        // build a default "Accepted" response                        toSend = createDefaultReply(acct, inv, replySubject, verb, iCal);                     }                                        replyId = sendMimeMessage(octxt, mbox, acct, shouldSaveToSent(acct), parsedMessageData,                             toSend, inv.getMailItemId(), TYPE_REPLY);                                    }                mbox.modifyInvitePartStat(octxt, apptId, inviteMsgId, compNum, false, verb.getXmlPartStat());                                        /**                     * MOVE the replied-to message into the calendar folder: then, depending on user                     * prefs, copy it back into its original location....we do it this way so that we                      * don't have to walk all the Appointment DS's and modify them to point to the new                     * copy (we REALLY want the "live" copy to be the one in Calendar folder)                     **/                if (acct.getBooleanAttr(Provisioning.A_zimbraPrefDeleteInviteOnReply, true)) {                    mbox.move(octxt, inviteMsgId, MailItem.TYPE_MESSAGE, Mailbox.ID_FOLDER_TRASH);                }            }                        Element response = lc.createElement(MailService.SEND_INVITE_REPLY_RESPONSE);            if (replyId != 0) {                response.addAttribute(MailService.A_ID, replyId);            }            return response;        } finally {            sWatch.stop(startTime);        }    }