Exemple #1
0
  public AttachmentPanel(
      String id, TestCase test, boolean small, Boolean modLink, Boolean delLink) {
    super(id);
    SqlSessionMapper<AttachmentMapper> sesMapper =
        SqlConnection.getSessionMapper(AttachmentMapper.class);
    attachments = sesMapper.getMapper().getByTestcase(test.getId());
    sesMapper.close();

    renderTable(attachments, modLink, delLink);
  }
  public DeleteTestCasePage(final PageParameters params) {
    super(params);
    if (params.get("idTest").isNull()) {
      error("Parametro idTest non trovato");
      setResponsePage(ProjectPage.class);
    }
    SqlSessionMapper<TestCaseMapper> sesTestMapper =
        SqlConnection.getSessionMapper(TestCaseMapper.class);
    test = sesTestMapper.getMapper().get(BigInteger.valueOf(params.get("idTest").toInt()));
    sesTestMapper.close();
    add(new Label("testcaseName", test.getName()));
    Form<Project> delTestcaseForm = new Form<Project>("delTestcaseForm");
    delTestcaseForm.add(
        new Button("YesBtn") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            try {
              TestCaseUtil.deleteTestCase(test);
              PageParameters reqParams = new PageParameters();
              reqParams.add("idReq", test.getId_requirement());
              setResponsePage(RequirementPage.class, reqParams);
            } catch (JWTestException e) {
              error(e.getMessage());
            }
          }
        });

    delTestcaseForm.add(
        new Button("NoBtn") {
          private static final long serialVersionUID = 1L;

          @Override
          public void onSubmit() {
            setResponsePage(TestCasePage.class, params);
          }
        });
    add(delTestcaseForm);
  }