@Override public Set<Label> getValueFromCustomFieldParams(CustomFieldParams customFieldParams) throws FieldValidationException { if (customFieldParams == null || customFieldParams.isEmpty()) { return null; } final Collection<String> normalParams = (Collection<String>) customFieldParams.getValuesForKey(null); //single field types should not scope their parameters if (normalParams == null || normalParams.isEmpty()) { return null; } return convertStringsToLabels(normalParams); }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (!(o instanceof CustomFieldParams)) { return false; } final CustomFieldParams customFieldParams = (CustomFieldParams) o; if (customField == null && customFieldParams.getCustomField() != null) { return false; } if (customField != null && !customField.equals(customFieldParams.getCustomField())) { return false; } if (!parameterMap.equals(customFieldParams.getKeysAndValues())) { return false; } return true; }
public T getValueFromCustomFieldParams(CustomFieldParams parameters) throws FieldValidationException { Object o = parameters.getFirstValueForKey(null); // This method mandates that it cannot be a collection object. To provide backwards compatability I have assumed T == S. // If not it will break at run time. And hopefully plugin developers will see it. I'm assuming the method doesn't get used though, cause surely it would have broken before now // ParticipantsCustomField is an example of one which is actually a collection. return (T) getSingularObjectFromString((String) o); }
public Object getStringValueFromCustomFieldParams(final CustomFieldParams parameters) { return parameters.getValuesForNullKey(); }
return ((CustomFieldParams) value).isEmpty();
if (customFieldParams.containsKey(getParamKeyIssueId()) || issue == null) CustomFieldParams params = new CustomFieldParamsImpl(customFieldParams.getCustomField(), customFieldParams); params.put(getParamKeyIssueId(), ImmutableList.of(issue.getId().toString())); params.put(getParamKeyProjectId(), ImmutableList.of(issue.getProjectId().toString())); params.put(CustomFieldUtils.getParamKeyRequireProjectIds(), ImmutableList.of(Boolean.TRUE.toString()));
@Override public String getValueFromCustomFieldParams(CustomFieldParams customFieldParams) { Collection<String> normalParams = customFieldParams.getValuesForKey(null); return (normalParams != null && normalParams.contains(WITH_PERFORCE_JOB) ? WITH_PERFORCE_JOB : WITHOUT_PERFORCE_JOB); }
if (!customFieldParams.isEmpty()) remoteCustomFieldValues.addAll(getValuesFromMap(customFieldParams.getKeysAndValues(), customField));
if (customFieldParams.containsKey(NumberRangeSearcher.LESS_THAN_PARAM)) String s = (String) customFieldParams.getFirstValueForKey(NumberRangeSearcher.LESS_THAN_PARAM); if (s != null) if (customFieldParams.containsKey(NumberRangeSearcher.GREATER_THAN_PARAM)) String s = (String) customFieldParams.getFirstValueForKey(NumberRangeSearcher.GREATER_THAN_PARAM); if (s != null)
public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters) { return parameters.getFirstValueForNullKey(); }
private CustomFieldParams handleInvalidFunctionOperand(final TerminalClause clause) { CustomFieldParams customFieldParams = null; FunctionOperand fop = (FunctionOperand)clause.getOperand(); if (fop.getName().equals(CascadeOptionFunction.FUNCTION_CASCADE_OPTION)) { if (fop.getArgs().size() == 2) { customFieldParams = new CustomFieldParamsImpl(customField); customFieldParams.put(CascadingSelectCFType.PARENT_KEY, Collections.singleton(fop.getArgs().get(0))); customFieldParams.put(CascadingSelectCFType.CHILD_KEY, Collections.singleton(fop.getArgs().get(1))); } else if (fop.getArgs().size() == 1) { customFieldParams = new CustomFieldParamsImpl(customField); customFieldParams.put(CascadingSelectCFType.PARENT_KEY, Collections.singleton(fop.getArgs().get(0))); } if (customFieldParams != null) { String parentValue = (String) customFieldParams.getFirstValueForKey(CascadingSelectCFType.PARENT_KEY); final List<Option> options = jqlSelectOptionsUtil.getOptions(customField, new QueryLiteral(clause.getOperand(), parentValue), true); if (options.isEmpty() || options.get(0) == null) { return null; } } } return customFieldParams; }
public CustomFieldParamsImpl(final CustomField customField, final Object paramsObject) { if (paramsObject instanceof CustomFieldParams) { final CustomFieldParams params = (CustomFieldParams) paramsObject; deepCopy(params.getKeysAndValues()); } else if ((paramsObject instanceof Map) && !(paramsObject instanceof GenericEntity)) { final Map params = (Map) paramsObject; deepCopy(params); } else if (paramsObject instanceof Collection) { parameterMap.put(null, new ArrayList((Collection) paramsObject)); } else if (paramsObject != null) { final ArrayList list = new ArrayList(); //This is not generic because we write to that map //not only Strings... list.add(paramsObject); parameterMap.put(null, list); } else { log.debug("CustomFieldParamsImpl received a null object in constructor"); } this.customField = customField; }
public Object getStringValue(CustomField customField, FieldValuesHolder fieldValuesHolder) { StringBuilder resultBuilder = new StringBuilder(); CustomFieldParams customFieldParams = customField.getCustomFieldValues(fieldValuesHolder); if (customFieldParams != null) { @SuppressWarnings("unchecked") Collection<String> allValues = customFieldParams.getAllValues(); if (allValues != null) for (String label : allValues) resultBuilder.append(StringEscapeUtils.escapeHtml(label)).append(' '); } return StringUtils.trim(resultBuilder.toString()); }
public Object getStringValueFromCustomFieldParams(final CustomFieldParams parameters) { return parameters.getValuesForNullKey(); }
@Override public boolean hasParam(Map parameters) { CustomFieldParams relevantParams = getRelevantParams(parameters); return !relevantParams.isEmpty(); }
@Nullable private Option extractOptionFromParams(String key, CustomFieldParams relevantParams) throws FieldValidationException { Collection<String> params = relevantParams.getValuesForKey(key); if (params != null && !params.isEmpty()) { String selectValue = params.iterator().next(); if (ObjectUtils.isValueSelected(selectValue) && selectValue != null && !selectValue.equalsIgnoreCase("none")) { return getOptionFromStringValue(selectValue); } } return null; }
public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters) { return parameters.getFirstValueForNullKey(); }
@Override protected Clause getClauseFromParams(final User searcher, CustomFieldParams customFieldParams) { Collection<String> searchValuesUnTokenized = customFieldParams.getAllValues(); if (null != searchValuesUnTokenized && !searchValuesUnTokenized.isEmpty()) { final List<TerminalClause> terminalClauses = new ArrayList<TerminalClause>(); final Set<String> tokens = new LinkedHashSet<String>(); for (String searchValues : searchValuesUnTokenized) { tokens.addAll(Arrays.asList(searchValues.split("\\s"))); } final String clauseName = getClauseName(searcher, labelClauseNames); for (String token : tokens) { terminalClauses.add(new TerminalClauseImpl(clauseName, Operator.EQUALS, token)); } // don't unnecessarily return an OrClause return terminalClauses.size() == 1 ? terminalClauses.get(0) : new OrClause(terminalClauses); } return null; }
@Override public Object getStringValueFromCustomFieldParams(final CustomFieldParams parameters) { @SuppressWarnings ("unchecked") final Collection<String> valuesForNullKey = parameters.getValuesForNullKey(); if (valuesForNullKey != null) { final StringBuilder ret = new StringBuilder(); for (String value : valuesForNullKey) { ret.append(value).append(LabelsField.SEPARATOR_CHAR); } return ret.toString().trim(); } return null; }
public void validateFromParams(CustomFieldParams relevantParams, ErrorCollection errorCollectionToAddTo, FieldConfig config) if (relevantParams == null || relevantParams.isEmpty()) List params = new ArrayList(relevantParams.getValuesForKey(null)); Collection valuesForChild = relevantParams.getValuesForKey(CHILD_KEY); if (valuesForChild != null)