コード例 #1
0
  public String execute() {
    try {
      DataElementCategory category = dataElementCategoryService.getDataElementCategory(id);

      dataElementCategoryService.deleteDataElementCategory(category);
    } catch (DeleteNotAllowedException ex) {
      if (ex.getErrorCode().equals(DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS)) {
        message =
            i18n.getString("object_not_deleted_associated_by_objects") + " " + ex.getMessage();

        return ERROR;
      }
    }

    return SUCCESS;
  }
コード例 #2
0
  @Override
  public String execute() {
    DataElementCategoryCombo categoryCombo =
        dataElementCategoryService.getDataElementCategoryCombo(id);

    DataElementCategoryCombo defaultCategoryCombo =
        dataElementCategoryService.getDataElementCategoryComboByName(
            DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME);

    if (!categoryCombo.equals(defaultCategoryCombo)) {
      try {
        dataElementCategoryService.deleteDataElementCategoryCombo(categoryCombo);
      } catch (DeleteNotAllowedException ex) {
        if (ex.getErrorCode().equals(DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS)) {
          message =
              i18n.getString("object_not_deleted_associated_by_objects") + " " + ex.getMessage();
          return ERROR;
        }
      }
    }

    return SUCCESS;
  }