コード例 #1
0
  @Override
  public ListGridRecord copyValues(ResourceGroupComposite from) {
    ListGridRecord record = new ListGridRecord();
    record.setAttribute("group", from);
    record.setAttribute("id", from.getResourceGroup().getId());
    record.setAttribute(NAME.propertyName(), from.getResourceGroup().getName());
    record.setAttribute(DESCRIPTION.propertyName(), from.getResourceGroup().getDescription());
    record.setAttribute(CATEGORY.propertyName(), from.getResourceGroup().getGroupCategory().name());

    record.setAttribute("explicitCount", String.valueOf(from.getExplicitCount()));
    record.setAttribute("explicitDown", String.valueOf(from.getExplicitDown()));
    record.setAttribute("explicitDisabled", String.valueOf(from.getExplicitDisabled()));
    record.setAttribute("implicitCount", String.valueOf(from.getImplicitCount()));
    record.setAttribute("implicitDown", String.valueOf(from.getImplicitDown()));
    record.setAttribute("implicitDisabled", String.valueOf(from.getImplicitDisabled()));

    record.setAttribute(AVAIL_CHILDREN.propertyName(), getExplicitFormatted(from));
    record.setAttribute(AVAIL_DESCENDANTS.propertyName(), getImplicitFormatted(from));

    if (from.getResourceGroup().getResourceType() != null) {
      record.setAttribute("resourceType", from.getResourceGroup().getResourceType());
      record.setAttribute(TYPE.propertyName(), from.getResourceGroup().getResourceType().getName());
      record.setAttribute(
          PLUGIN.propertyName(), from.getResourceGroup().getResourceType().getPlugin());
    }

    return record;
  }
コード例 #2
0
  @Override
  protected List<DataSourceField> addDataSourceFields() {
    List<DataSourceField> fields = super.addDataSourceFields();

    DataSourceField idDataField = new DataSourceIntegerField("id", MSG.common_title_id(), 50);
    idDataField.setPrimaryKey(true);
    idDataField.setCanEdit(false);
    fields.add(idDataField);

    DataSourceTextField nameDataField =
        new DataSourceTextField(NAME.propertyName(), NAME.title(), 200);
    nameDataField.setCanEdit(false);
    fields.add(nameDataField);

    DataSourceTextField descriptionDataField =
        new DataSourceTextField(DESCRIPTION.propertyName(), DESCRIPTION.title());
    descriptionDataField.setCanEdit(false);
    fields.add(descriptionDataField);

    DataSourceTextField typeNameDataField =
        new DataSourceTextField(TYPE.propertyName(), TYPE.title());
    fields.add(typeNameDataField);

    DataSourceTextField pluginNameDataField =
        new DataSourceTextField(PLUGIN.propertyName(), PLUGIN.title());
    fields.add(pluginNameDataField);

    DataSourceTextField categoryDataField =
        new DataSourceTextField(CATEGORY.propertyName(), CATEGORY.title());
    fields.add(categoryDataField);

    return fields;
  }
コード例 #3
0
  @Override
  public ResourceGroupComposite copyValues(Record from) {
    Integer idAttrib = from.getAttributeAsInt("id");
    String nameAttrib = from.getAttribute(NAME.propertyName());
    String descriptionAttrib = from.getAttribute(DESCRIPTION.propertyName());
    String typeNameAttrib = from.getAttribute(TYPE.propertyName());

    ResourceGroup rg = new ResourceGroup(nameAttrib);
    rg.setId(idAttrib);
    rg.setDescription(descriptionAttrib);
    if (typeNameAttrib != null) {
      ResourceType rt = new ResourceType();
      rt.setName(typeNameAttrib);
      String pluginNameAttrib = from.getAttribute(PLUGIN.propertyName());
      rt.setPlugin(pluginNameAttrib);
      rg.setResourceType(rt);
    }

    Long explicitCount = Long.valueOf(from.getAttribute("explicitCount"));
    Long explicitDown = Long.valueOf(from.getAttribute("explicitDown"));
    Long explicitUnknown = Long.valueOf(from.getAttribute("explicitUnknown"));
    Long explicitDisabled = Long.valueOf(from.getAttribute("explicitDisabled"));
    Long implicitCount = Long.valueOf(from.getAttribute("implicitCount"));
    Long implicitDown = Long.valueOf(from.getAttribute("implicitDown"));
    Long implicitUnknown = Long.valueOf(from.getAttribute("implicitUnknown"));
    Long implicitDisabled = Long.valueOf(from.getAttribute("implicitDisabled"));

    ResourceGroupComposite composite =
        new ResourceGroupComposite(
            explicitCount,
            explicitDown,
            explicitUnknown,
            explicitDisabled,
            implicitCount,
            implicitDown,
            implicitUnknown,
            implicitDisabled,
            rg);

    return composite;
  }