@Test void testCreateGroup() { GroupValue bbmri_eric = groupValueFactory.createGroup( "bbmri_eric", "BBMRI Eric", "The world's largest biobank catalogue", true, ImmutableList.of("Manager", "Editor", "Viewer"), "bbmri_eric"); GroupValue groupValue = getTestGroupValue(); assertEquals(groupValue, bbmri_eric); }
public GroupValue createGroup( String groupName, String label, @Nullable @CheckForNull String description, boolean publiclyVisible, Collection<String> roleLabels, String packageValueName) { GroupValue.Builder groupBuilder = GroupValue.builder().setName(groupName).setLabel(label).setPublic(publiclyVisible); Optional.ofNullable(description).ifPresent(groupBuilder::setDescription); PackageValue.Builder packageBuilder = PackageValue.builder().setName(packageValueName).setLabel(label); Optional.ofNullable(description).ifPresent(packageBuilder::setDescription); PackageValue rootPackage = packageBuilder.build(); groupBuilder.setRootPackage(rootPackage); ImmutableList.Builder<RoleValue> rolesBuilder = groupBuilder.rolesBuilder(); roleLabels.stream() .map(roleLabel -> createRoleValue(groupName, label, roleLabel)) .forEach(rolesBuilder::add); return groupBuilder.build(); }
GroupValueFactory { public GroupValue createGroup( String groupName, String label, @Nullable @CheckForNull String description, boolean publiclyVisible, Collection<String> roleLabels, String packageValueName) { GroupValue.Builder groupBuilder = GroupValue.builder().setName(groupName).setLabel(label).setPublic(publiclyVisible); Optional.ofNullable(description).ifPresent(groupBuilder::setDescription); PackageValue.Builder packageBuilder = PackageValue.builder().setName(packageValueName).setLabel(label); Optional.ofNullable(description).ifPresent(packageBuilder::setDescription); PackageValue rootPackage = packageBuilder.build(); groupBuilder.setRootPackage(rootPackage); ImmutableList.Builder<RoleValue> rolesBuilder = groupBuilder.rolesBuilder(); roleLabels.stream() .map(roleLabel -> createRoleValue(groupName, label, roleLabel)) .forEach(rolesBuilder::add); return groupBuilder.build(); } }
GroupValueFactory { public GroupValue createGroup( String groupName, String label, @Nullable @CheckForNull String description, boolean publiclyVisible, Collection<String> roleLabels, String packageValueName) { GroupValue.Builder groupBuilder = GroupValue.builder().setName(groupName).setLabel(label).setPublic(publiclyVisible); Optional.ofNullable(description).ifPresent(groupBuilder::setDescription); PackageValue.Builder packageBuilder = PackageValue.builder().setName(packageValueName).setLabel(label); Optional.ofNullable(description).ifPresent(packageBuilder::setDescription); PackageValue rootPackage = packageBuilder.build(); groupBuilder.setRootPackage(rootPackage); ImmutableList.Builder<RoleValue> rolesBuilder = groupBuilder.rolesBuilder(); roleLabels.stream() .map(roleLabel -> createRoleValue(groupName, label, roleLabel)) .forEach(rolesBuilder::add); return groupBuilder.build(); }  }
GroupValueFactory { public GroupValue createGroup( String groupName, String label, @Nullable @CheckForNull String description, boolean publiclyVisible, Collection<String> roleLabels, String packageValueName) { GroupValue.Builder groupBuilder = GroupValue.builder().setName(groupName).setLabel(label).setPublic(publiclyVisible); Optional.ofNullable(description).ifPresent(groupBuilder::setDescription); PackageValue.Builder packageBuilder = PackageValue.builder().setName(packageValueName).setLabel(label); Optional.ofNullable(description).ifPresent(packageBuilder::setDescription); PackageValue rootPackage = packageBuilder.build(); groupBuilder.setRootPackage(rootPackage); ImmutableList.Builder<RoleValue> rolesBuilder = groupBuilder.rolesBuilder(); roleLabels.stream() .map(roleLabel -> createRoleValue(groupName, label, roleLabel)) .forEach(rolesBuilder::add); return groupBuilder.build(); }  GroupValue createGroup(
      String groupName,
      String label,
      @Nullable @CheckForNull String description,
      boolean publiclyVisible,
      Collection<String> roleLabels,
      String packageValueName); GroupValue createGroup(
      String groupName, String label, Collection<String> roleLabels, String packageValueName); static String createRoleName(String groupName, String roleLabel); }
GroupValueFactory { public GroupValue createGroup( String groupName, String label, @Nullable @CheckForNull String description, boolean publiclyVisible, Collection<String> roleLabels, String packageValueName) { GroupValue.Builder groupBuilder = GroupValue.builder().setName(groupName).setLabel(label).setPublic(publiclyVisible); Optional.ofNullable(description).ifPresent(groupBuilder::setDescription); PackageValue.Builder packageBuilder = PackageValue.builder().setName(packageValueName).setLabel(label); Optional.ofNullable(description).ifPresent(packageBuilder::setDescription); PackageValue rootPackage = packageBuilder.build(); groupBuilder.setRootPackage(rootPackage); ImmutableList.Builder<RoleValue> rolesBuilder = groupBuilder.rolesBuilder(); roleLabels.stream() .map(roleLabel -> createRoleValue(groupName, label, roleLabel)) .forEach(rolesBuilder::add); return groupBuilder.build(); }  GroupValue createGroup(
      String groupName,
      String label,
      @Nullable @CheckForNull String description,
      boolean publiclyVisible,
      Collection<String> roleLabels,
      String packageValueName); GroupValue createGroup(
      String groupName, String label, Collection<String> roleLabels, String packageValueName); static String createRoleName(String groupName, String roleLabel);  }