private void setLabels(final CustomField field, final Issue issue, final Set<Label> value) { final Set<String> labelStrings = new LinkedHashSet<String>(); if (value != null) { for (Label label : value) { labelStrings.add(label.getLabel()); } } //validation should have already happened by now labelManager.setLabels(authContext.getUser(), issue.getId(), field.getIdAsLong(), labelStrings, false, false); }
public void createValue(final Issue issue, final Object value) { String labelString = (String) value; final Set<String> labels = getLabelSet(labelString); //validation should have already happened by now. No need to check the result labelManager.setLabels(authenticationContext.getUser(), issue.getId(), labels, false, false); }
@Override public LabelsResult setLabels(final ApplicationUser user, final SetLabelValidationResult result, final boolean sendNotification, final boolean causeChangeNotification) { notNull("result", result); if (!result.isValid()) { throw new IllegalArgumentException("Cannot set labels with invalid validation result!"); } Set<Label> newLabels; Set<String> cleanLabels = getCleanLabels(result.getLabels()); if (result.getCustomFieldId() != null) { newLabels = labelManager.setLabels(user, result.getIssueId(), result.getCustomFieldId(), cleanLabels, sendNotification, causeChangeNotification); } else { newLabels = labelManager.setLabels(user, result.getIssueId(), cleanLabels, sendNotification, causeChangeNotification); } return new LabelsResult(newLabels, new SimpleErrorCollection()); }
public void updateValue(final FieldLayoutItem fieldLayoutItem, final Issue issue, final ModifiedValue modifiedValue, final IssueChangeHolder issueChangeHolder) { final String oldLabelString = (String) modifiedValue.getOldValue(); final String labelString = (String) modifiedValue.getNewValue(); final Set<String> oldLabels = getLabelSet(oldLabelString); final Set<String> labels = getLabelSet(labelString); if (valueChanged(oldLabels, labels)) { final Set<Label> newLabels = labelManager.setLabels(authenticationContext.getUser(), issue.getId(), labels, false, false); issueChangeHolder.addChangeItem(new ChangeItemBean(ChangeItemBean.STATIC_FIELD, IssueFieldConstants.LABELS, null, oldLabelString, null, StringUtils.join(newLabels, SEPARATOR_CHAR))); } }