public void transformObjectsToStrings() { final Transformer toStringTransformer = new Transformer() { public Object transform(final Object input) { return getCustomField().getCustomFieldType().getStringFromSingularObject(input); } }; transformMultiMap(toStringTransformer, parameterMap); }
public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters) { return parameters.getFirstValueForNullKey(); }
public Object getStringValueFromCustomFieldParams(final CustomFieldParams parameters) { return parameters.getValuesForNullKey(); }
public void setDefaultValue(FieldConfig fieldConfig, Map<String, Option> cascadingOptions) { if (cascadingOptions != null) { final CustomFieldParams customFieldParams = new CustomFieldParamsImpl(fieldConfig.getCustomField(), cascadingOptions); customFieldParams.transformObjectsToStrings(); customFieldParams.setCustomField(null); genericConfigManager.update(DEFAULT_VALUE_TYPE, fieldConfig.getId().toString(), customFieldParams); } else { genericConfigManager.update(DEFAULT_VALUE_TYPE, fieldConfig.getId().toString(), null); } }
private CustomFieldParams getCustomFieldParamsFromIssue(Issue issue) { //JRA-16915: The CustomFieldParams returned should NEVER be null, since this may break calls to validate() methods //later on with a NPE. This can cause problems for example, when deleting values in a workflow transition //via SOAP, if a customfield value for an issue is null. Object valueFromIssue = getCustomFieldType().getValueFromIssue(this, issue); if (valueFromIssue != null) { CustomFieldParams paramsFromIssue = new CustomFieldParamsImpl(this, valueFromIssue); paramsFromIssue.transformObjectsToStrings(); return paramsFromIssue; } else { return new CustomFieldParamsImpl(this); } }
@Override public boolean hasParam(Map parameters) { CustomFieldParams relevantParams = getRelevantParams(parameters); return !relevantParams.isEmpty(); }
@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); }
public void put(final String key, final Collection<String> value) { addValue(key, value); }
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 Collection getValuesForNullKey() { return getValuesForKey(null); }
public Object getFirstValueForNullKey() { return getFirstValueForKey(null); }
public static void populateDefaults(FieldConfig config, Map<String, Object> customFieldValuesHolder) { CustomField cf = config.getCustomField(); Object defaultValues = cf.getCustomFieldType().getDefaultValue(config); CustomFieldParams paramsFromIssue; if (defaultValues != null) { paramsFromIssue = new CustomFieldParamsImpl(cf, defaultValues); paramsFromIssue.transformObjectsToStrings(); customFieldValuesHolder.put(cf.getId(), paramsFromIssue); } }
public Clause getSearchClause(final ApplicationUser user, final FieldValuesHolder fieldValuesHolder) { if (fieldValuesHolder.containsKey(urlParameterName)) { CustomFieldParams customFieldParams = (CustomFieldParams) fieldValuesHolder.get(urlParameterName); if (customFieldParams != null && !customFieldParams.isEmpty()) { return getClauseFromParams(user, customFieldParams); } } return null; }
public Object getStringValueFromCustomFieldParams(final CustomFieldParams parameters) { return parameters.getValuesForNullKey(); }
public Object getStringValueFromCustomFieldParams(CustomFieldParams parameters) { return parameters.getFirstValueForNullKey(); }
public void transform(final Transformer transformer) { transformMultiMap(transformer, parameterMap); }
public boolean contains(final String key, final String value) { final Collection c = getValuesForKey(key); if ((c != null) && !c.isEmpty()) { return c.contains(value); } else { return false; } }
public Object getStringValue(CustomField customField, FieldValuesHolder fieldValuesHolder) { CustomFieldParams customFieldParams = customField.getCustomFieldValues(fieldValuesHolder); return customFieldParams.getValuesForNullKey(); }
public void transformStringsToObjects() { final Transformer toObjectTransformer = new Transformer() { public Object transform(final Object input) { try { return getCustomField().getCustomFieldType().getSingularObjectFromString((String) input); } catch (final FieldValidationException e) { log.info("Failed to convert from string to singular object", e); return null; } } }; transformMultiMap(toObjectTransformer, parameterMap); }
public Object getStringValue(CustomField customField, FieldValuesHolder fieldValuesHolder) { CustomFieldParams customFieldParams = customField.getCustomFieldValues(fieldValuesHolder); return customFieldParams.getValuesForNullKey(); }