/** Retrieves members from RPC */
  public void retrieveData() {

    JsonClient js = new JsonClient();
    String param;

    if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
      param = "vo=" + entityId;
      if (!attributes.isEmpty()) {
        // parse lists
        for (String attribute : attributes) {
          param += "&specificAttributes[]=" + attribute;
        }
      }
      if (showAllAdmins) {
        js.retrieveData(VO_JSON_URL, param, this);
      } else {
        js.retrieveData(VO_DIRECT_JSON_URL, param, this);
      }
    } else if (entity.equals(PerunEntity.GROUP)) {
      param = "group=" + entityId;
      if (!attributes.isEmpty()) {
        // parse lists
        for (String attribute : attributes) {
          param += "&specificAttributes[]=" + attribute;
        }
      }
      if (showAllAdmins) {
        js.retrieveData(GROUP_JSON_URL, param, this);
      } else {
        js.retrieveData(GROUP_DIRECT_JSON_URL, param, this);
      }
    } else if (entity.equals(PerunEntity.FACILITY)) {
      param = "facility=" + entityId;
      if (!attributes.isEmpty()) {
        // parse lists
        for (String attribute : attributes) {
          param += "&specificAttributes[]=" + attribute;
        }
      }
      if (showAllAdmins) {
        js.retrieveData(FACILITY_JSON_URL, param, this);
      } else {
        js.retrieveData(FACILITY_DIRECT_JSON_URL, param, this);
      }
    } else if (entity.equals(PerunEntity.SECURITY_TEAM)) {
      param = "securityTeam=" + entityId;
      if (!attributes.isEmpty()) {
        // parse lists
        for (String attribute : attributes) {
          param += "&specificAttributes[]=" + attribute;
        }
      }
      if (showAllAdmins) {
        js.retrieveData(SECURITY_JSON_URL, param, this);
      } else {
        js.retrieveData(SECURITY_DIRECT_JSON_URL, param, this);
      }
    }
  }
Esempio n. 2
0
  /** Retrieves members from RPC */
  public void retrieveData() {

    JsonClient js = new JsonClient();
    String param;

    if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
      param = "vo=" + entityId;
      js.retrieveData(VO_JSON_URL, param, this);
    } else if (entity.equals(PerunEntity.GROUP)) {
      param = "group=" + entityId;
      js.retrieveData(GROUP_JSON_URL, param, this);
    } else if (entity.equals(PerunEntity.FACILITY)) {
      param = "facility=" + entityId;
      js.retrieveData(FACILITY_JSON_URL, param, this);
    }
  }
Esempio n. 3
0
  /** /** Retrieve data from RPC */
  public void retrieveData() {

    String param = "";

    if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
      param = "vo=" + this.id;
    } else if (entity.equals(PerunEntity.GROUP)) {
      param = "group=" + this.id;
    }

    if (type.length() != 0) {
      param += "&type=" + type;
    }

    JsonClient js = new JsonClient();
    js.setHidden(true);
    js.retrieveData(JSON_URL, param, this);
  }
Esempio n. 4
0
  /**
   * Returns the table with member-Groups
   *
   * @return CellTable widget
   */
  public CellTable<Group> getTable() {

    // Retrieves data
    this.retrieveData();

    // Table data provider.
    dataProvider = new ListDataProvider<Group>(list);

    // Cell table
    table = new PerunTable<Group>(list);

    // Connect the table to the data provider.
    dataProvider.addDataDisplay(table);

    // Sorting
    ListHandler<Group> columnSortHandler = new ListHandler<Group>(dataProvider.getList());
    table.addColumnSortHandler(columnSortHandler);

    // Table selection
    table.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<Group>createCheckboxManager());

    // Set empty content & loader
    table.setEmptyTableWidget(loaderImage);

    if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
      loaderImage.setEmptyResultMessage(
          "VO has no groups of managers (try to switch to 'Users' view).");
    } else if (entity.equals(PerunEntity.GROUP)) {
      loaderImage.setEmptyResultMessage(
          "Group has no groups of managers (try to switch to 'Users' view).");
    } else if (entity.equals(PerunEntity.FACILITY)) {
      loaderImage.setEmptyResultMessage(
          "Facility has no groups of managers (try to switch to 'Users' view).");
    }

    // Checkbox column column
    table.addCheckBoxColumn();

    // Create Group ID column.
    Column<Group, String> groupIdColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<Group, String>() {
              public String getValue(Group object) {
                return String.valueOf(object.getId());
              }
            },
            this.tableFieldUpdater);

    groupIdColumn.setSortable(true);
    columnSortHandler.setComparator(
        groupIdColumn, new GeneralComparator<Group>(GeneralComparator.Column.ID));

    table.setColumnWidth(groupIdColumn, 110.0, Unit.PX);

    if (JsonUtils.isExtendedInfoVisible()) {
      table.addColumn(groupIdColumn, "Group ID");
    }

    table.addNameColumn(tableFieldUpdater);
    table.addDescriptionColumn(tableFieldUpdater);

    return table;
  }
  /**
   * Returns the table with member-users
   *
   * @return CellTable widget
   */
  public CellTable<User> getTable() {

    // Retrieves data
    this.retrieveData();

    // Table data provider.
    dataProvider = new ListDataProvider<User>(list);

    // Cell table
    table = new PerunTable<User>(list);

    // Connect the table to the data provider.
    dataProvider.addDataDisplay(table);

    if (entity.equals(PerunEntity.VIRTUAL_ORGANIZATION)) {
      loaderImage.setEmptyResultMessage("VO has no managers (try to switch to 'Groups' view).");
    } else if (entity.equals(PerunEntity.GROUP)) {
      loaderImage.setEmptyResultMessage("Group has no managers (try to switch to 'Groups' view).");
    } else if (entity.equals(PerunEntity.FACILITY)) {
      loaderImage.setEmptyResultMessage(
          "Facility has no managers (try to switch to 'Groups' view).");
    } else if (entity.equals(PerunEntity.SECURITY_TEAM)) {
      loaderImage.setEmptyResultMessage(
          "SecurityTeam has no members (try to switch to 'Groups' view).");
    }

    // Sorting
    ListHandler<User> columnSortHandler = new ListHandler<User>(dataProvider.getList());
    table.addColumnSortHandler(columnSortHandler);

    // Table selection
    table.setSelectionModel(
        selectionModel, DefaultSelectionEventManager.<User>createCheckboxManager());

    // Set empty content & loader
    table.setEmptyTableWidget(loaderImage);

    // Checkbox column column
    if (checkable) {
      table.addCheckBoxColumn();
    }

    // Create User ID column.
    Column<User, String> userIdColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<User, String>() {
              public String getValue(User object) {
                return String.valueOf(object.getId());
              }
            },
            this.tableFieldUpdater);

    userIdColumn.setSortable(true);
    columnSortHandler.setComparator(
        userIdColumn, new GeneralComparator<User>(GeneralComparator.Column.ID));

    table.setColumnWidth(userIdColumn, 110.0, Unit.PX);

    if (JsonUtils.isExtendedInfoVisible()) {
      table.addColumn(userIdColumn, "User ID");
    }

    table.setHyperlinksAllowed(false);
    table.addNameColumn(tableFieldUpdater);

    // Create organization column.
    Column<User, String> organizationColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<User, String>() {
              public String getValue(User object) {
                Attribute at = object.getAttribute("urn:perun:user:attribute-def:def:organization");
                if (at != null
                    && at.getValue() != null
                    && !"null".equalsIgnoreCase(at.getValue())) {
                  return at.getValue();
                }
                return "";
              }
            },
            this.tableFieldUpdater);

    // Create e-mail column.
    Column<User, String> emailColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<User, String>() {
              public String getValue(User object) {
                Attribute at =
                    object.getAttribute("urn:perun:user:attribute-def:def:preferredMail");
                if (at != null
                    && at.getValue() != null
                    && !"null".equalsIgnoreCase(at.getValue())) {
                  return at.getValue().replace(",", " ");
                }
                return "";
              }
            },
            this.tableFieldUpdater);

    // Create name column.
    Column<User, String> loginsColumn =
        JsonUtils.addColumn(
            new JsonUtils.GetValue<User, String>() {
              public String getValue(User object) {
                return object.getLogins();
              }
            },
            this.tableFieldUpdater);

    organizationColumn.setSortable(true);
    columnSortHandler.setComparator(
        organizationColumn, new RichUserComparator(RichUserComparator.Column.ORGANIZATION));

    emailColumn.setSortable(true);
    columnSortHandler.setComparator(
        emailColumn, new RichUserComparator(RichUserComparator.Column.EMAIL));

    // Add the other columns.
    table.addColumn(organizationColumn, "Organization");
    table.addColumn(emailColumn, "E-mail");
    table.addColumn(loginsColumn, "Logins");

    return table;
  }