Beispiel #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
 public @ResponseBody Status deleteMailbox(@PathVariable("id") long id) {
   try {
     mailboxBo.delete(id);
     return new Status(1, "Mailbox deleted Successfully!");
   } catch (Exception e) {
     return new Status(0, e.toString());
   }
 }
Beispiel #2
0
  @RequestMapping(
      value = "/create/{id}",
      method = RequestMethod.POST,
      consumes = {MediaType.APPLICATION_FORM_URLENCODED_VALUE, MediaType.APPLICATION_JSON_VALUE})
  public @ResponseBody Mailbox addMailbox(
      @RequestBody Mailbox mailbox, @PathVariable("id") long address_id) {
    try {
      mailboxBo.create(mailbox, address_id);
    } catch (Exception e) {
      throw new InternalErrorException();
    }

    return mailbox;
  }
Beispiel #3
0
  @RequestMapping(value = "/{id}/address", method = RequestMethod.GET)
  public @ResponseBody Address getAddress(@PathVariable("id") long mailbox_id) {
    Address address = null;
    try {
      address = mailboxBo.getMailboxAddress(mailbox_id);
    } catch (Exception e) {
      throw new InternalErrorException();
    }

    if (address == null) {
      throw new ResourceNotFoundException();
    }

    return address;
  }
Beispiel #4
0
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  public @ResponseBody Mailbox getMailbox(@PathVariable("id") long id) {
    Mailbox mailbox = null;
    try {
      mailbox = mailboxBo.getById(id);
    } catch (Exception e) {
      throw new InternalErrorException();
    }

    if (mailbox == null) {
      throw new ResourceNotFoundException();
    }

    return mailbox;
  }