Ejemplo n.º 1
0
  /** Delete resource. */
  @Delete
  public void deleteResource() {
    if (!isAuthenticated()) {
      setStatus(Status.CLIENT_ERROR_UNAUTHORIZED);
      return;
    }

    if (job == null) {
      setStatus(Status.CLIENT_ERROR_NOT_FOUND);

    } else {

      JobManager jobMan = webservice().getJobManager();
      if (jobMan.deleteJob(job.getId()) != null) {
        setStatus(Status.SUCCESS_NO_CONTENT);
      } else {
        setStatus(Status.CLIENT_ERROR_NOT_FOUND);
      }
    }
  }
Ejemplo n.º 2
0
  /*
   * (non-Javadoc)
   *
   * @see org.restlet.resource.Resource#doInit()
   */
  @Override
  public void doInit() {
    super.doInit();
    if (!isAuthenticated()) {
      return;
    }
    JobManager jobMan = webservice().getJobManager();
    String idParam = (String) getRequestAttributes().get("id");
    String msgSeqParam = getQuery().getFirstValue("msgSeq");

    if (msgSeqParam != null) {
      msgSeq = Integer.parseInt(msgSeqParam);
    }
    try {
      JobId id = JobIdFactory.newIdFromString(idParam);
      job = jobMan.getJob(id);
    } catch (Exception e) {
      logger.error(e.getMessage());
      job = null;
    }
  }