@Override public String apply(GroupJsonBean input) { return input.getName(); } }));
@Override public String apply(@Nullable GroupJsonBean group) { return group != null ? group.getName() : null; } };
@Override protected Collection<String> handleSetOperation(IssueContext issueCtx, Issue issue, Collection<String> currentFieldValue, JsonData operationValue, ErrorCollection errors) { GroupJsonBean group = operationValue.convertValue(field.getId(), GroupJsonBean.class, errors); return group == null ? null : Collections.singletonList(group.getName()); }
@Override protected Collection<String> handleAddOperation(IssueContext issueCtx, Issue issue, Collection<String> currentValue, JsonData operationValue, ErrorCollection errors) { GroupJsonBean newGroup = operationValue.convertValue(field.getId(), GroupJsonBean.class, errors); if (newGroup == null) { errors.addError(field.getId(), i18nHelper.getText("rest.group.value.not.group.objects"), ErrorCollection.Reason.VALIDATION_FAILED); return currentValue; } if (currentValue.contains(newGroup.getName())) { return currentValue; } List<String> newValue = Lists.newArrayListWithCapacity(currentValue.size() + 1); newValue.addAll(currentValue); newValue.add(newGroup.getName()); return newValue; }
@Override protected Collection<String> handleRemoveOperation(IssueContext issueCtx, Issue issue, Collection<String> currentValue, JsonData operationValue, ErrorCollection errors) { GroupJsonBean newGroup = operationValue.convertValue(field.getId(), GroupJsonBean.class, errors); if (newGroup == null) { errors.addError(field.getId(), i18nHelper.getText("rest.group.value.not.group.objects"), ErrorCollection.Reason.VALIDATION_FAILED); return currentValue; } return copyOf(filter(currentValue, not(equalTo(newGroup.getName())))); }
final Group group = groupManager.getGroup(groupJsonBean.getName()); sharedUsersBuilder.addAll(activeUsers(groupManager.getUsersInGroup(group)));