/** * Delete label * * @param account * @param labelId * @return */ @DELETE @Path("{id}") @Produces(MediaType.APPLICATION_JSON) public Response deleteLabel( @PathParam("user") String user, @PathParam("domain") String domain, @PathParam("id") Integer labelId) { Mailbox mailbox = new Mailbox(user, domain); try { labelDAO.delete(mailbox, labelId); } catch (IllegalLabelException ile) { throw new BadRequestException(ile.getMessage()); } catch (Exception e) { logger.error("Deleting label failed", e); throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR); } return Response.noContent().build(); }
response = JSONUtils.fromObject(labelDAO.getAllWithMetadata(mailbox)); } else { response = JSONUtils.fromObject(labelDAO.getAll(mailbox));
/** * Scrub mailbox and recalculate counters * * @param account * @return */ @POST @Path("counters") @Produces(MediaType.APPLICATION_JSON) public Response scrubCounters( @PathParam("user") final String user, @PathParam("domain") final String domain) { Mailbox mailbox = new Mailbox(user, domain); LabelMap calculatedCounters = messageDAO.scrub(mailbox, false); labelDAO.setCounters(mailbox, calculatedCounters); return Response.noContent().build(); }
newLabelId = labelDAO.add(mailbox, label); } catch (IllegalLabelException ile) { throw new BadRequestException(ile.getMessage());
labelDAO.update(mailbox, label); } catch (IllegalLabelException ile) { throw new BadRequestException(ile.getMessage());
/** * Scrub mailbox, rebuild indexes and recalculate counters * * @param account * @return */ @POST @Path("indexes") @Produces(MediaType.APPLICATION_JSON) public Response scrubIndexes( @PathParam("user") final String user, @PathParam("domain") final String domain) { Mailbox mailbox = new Mailbox(user, domain); LabelMap calculatedCounters = messageDAO.scrub(mailbox, true); labelDAO.setCounters(mailbox, calculatedCounters); return Response.noContent().build(); }