コード例 #1
0
    @Override
    public ListGridRecord copyValues(AlertDefinition from) {
      // in order to support sorting our list grid on the parent and resource columns,
      // we have to assign these to something that is sortable
      ListGridRecord record = super.copyValues(from);
      Resource resource = from.getResource();

      record.setAttribute(FIELD_RESOURCE, resource.getName());

      Integer parentId =
          from.getParentId(); // a valid non-zero number means the alert def came from a template
      AlertDefinition groupAlertDefinition = from.getGroupAlertDefinition();

      if (parentId != null && parentId.intValue() > 0) {
        record.setAttribute(FIELD_PARENT, "<b>" + MSG.view_alert_definition_for_type() + "</b>");
      } else if (groupAlertDefinition != null) {
        record.setAttribute(FIELD_PARENT, "<b>" + MSG.view_alert_definition_for_group() + "</b>");
      }

      // for ancestry handling
      record.setAttribute(AncestryUtil.RESOURCE_ID, resource.getId());
      record.setAttribute(AncestryUtil.RESOURCE_NAME, resource.getName());
      record.setAttribute(AncestryUtil.RESOURCE_ANCESTRY, resource.getAncestry());
      record.setAttribute(AncestryUtil.RESOURCE_TYPE_ID, resource.getResourceType().getId());

      return record;
    }