ZimbraQuery.InQuery inq;
ZimbraQuery.BaseQuery inq;
    public ZimbraQuery.BaseQuery GetQuery(int modifier, int target, String tok) throws ParseException, ServiceException, MailServiceException    {        Integer folderId = null;        ItemId iid = null;        switch(target) {          case HAS:                if (!tok.equalsIgnoreCase("attachment")) {                    return new ZimbraQuery.HasQuery(mAnalyzer, modifier, tok);            }            tok = "any";            // otherwise FALL THROUGH to AttachmentQuery below!          case ATTACHMENT:            return new ZimbraQuery.AttachmentQuery(mAnalyzer, modifier,tok);          case TYPE:            return new ZimbraQuery.TypeQuery(mAnalyzer, modifier,tok);          case ITEM:            return ZimbraQuery.ItemQuery.Create(mAnalyzer, modifier, tok);          case INID:                  iid = new ItemId(tok, null);              folderId = iid.getId();              // FALL THROUGH TO BELOW!          case IN:            if (folderId == null)                folderId = (Integer) sFolderStrMap.get(tok.toLowerCase());            ZimbraQuery.InQuery inq;            if (iid != null && !iid.belongsTo(mMailbox)) {                inq = new ZimbraQuery.InQuery(mMailbox, mAnalyzer, modifier, iid);            } else if (folderId != null) {                inq = ZimbraQuery.InQuery.Create(mMailbox, mAnalyzer, modifier, folderId);            } else {                inq = ZimbraQuery.InQuery.Create(mMailbox, mAnalyzer, modifier, tok);            }            if (inq == null) {                throw MailServiceException.NO_SUCH_FOLDER(tok);            }            return inq;          case TAG:            return new ZimbraQuery.TagQuery(mAnalyzer, modifier, mMailbox.getTagByName(tok), true);          case IS:            GetQueryCallback cback = (GetQueryCallback)sIsStrMap.get(tok.toLowerCase());            if (cback != null) {                return cback.execute(mMailbox, mAnalyzer, modifier);            } else {                throw new ParseException("Unknown text after is: in query string");            }          case CONV:            if (tok.charAt(0) != '-') {                return new ZimbraQuery.ConvQuery(mAnalyzer, modifier, tok);            } else {                // virtual-conversation: search for the item-id with id = -1*X                return ZimbraQuery.ItemQuery.Create(mAnalyzer, modifier, tok.substring(1));            }          case DATE:          case DAY:          case WEEK:          case MONTH:          case YEAR:          case AFTER:          case BEFORE:          case CONV_START:          case CONV_END:          {              ZimbraQuery.DateQuery q = new ZimbraQuery.DateQuery(mAnalyzer, target);              q.parseDate(modifier, tok);              return q;          }          case TO:          case FROM:          case CC:            if (tok == null || tok.length() < 1) {                throw new ParseException("Missing required text after a TO/FROM/CC");            }            if (tok.charAt(0) == '@') {                return new ZimbraQuery.DomainQuery(mAnalyzer, modifier, target, tok);            }            return new ZimbraQuery.TextQuery(mMailbox, mAnalyzer, modifier,target,tok);          case SIZE:          case BIGGER:          case SMALLER:            return new ZimbraQuery.SizeQuery(mAnalyzer, modifier,target,tok);          default:            return new ZimbraQuery.TextQuery(mMailbox, mAnalyzer, modifier,target,tok);        }    }