@Test(expectedExceptions = IllegalArgumentException.class) public void testValueInElementBadParameters2() { List<Object> parameters = createBadParameters2(); filter.setParameters(parameters); PrismPropertyValue<String> value = new PrismPropertyValue<String>(input); value = filter.apply(value); AssertJUnit.assertEquals(expected, value.getValue()); }
@Override public <T extends Object> PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue) { Validate.notNull(propertyValue, "Node must not be null."); String value = getStringValue(propertyValue); if (StringUtils.isEmpty(value)) { return propertyValue; } Validate.notEmpty(getParameters(), "Parameters must not be null or empty."); List<Replace> replaces = getReplaces(); for (Replace replace : replaces) { Matcher matcher = replace.getPattern().matcher(value); value = matcher.replaceAll(replace.getReplacement()); } propertyValue.setValue((T) value); return propertyValue; }
PatternFilter extends AbstractFilter { @Override public <T extends Object> PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue) { Validate.notNull(propertyValue, "Node must not be null."); String value = getStringValue(propertyValue); if (StringUtils.isEmpty(value)) { return propertyValue; } Validate.notEmpty(getParameters(), "Parameters must not be null or empty."); List<Replace> replaces = getReplaces(); for (Replace replace : replaces) { Matcher matcher = replace.getPattern().matcher(value); value = matcher.replaceAll(replace.getReplacement()); } propertyValue.setValue((T) value); return propertyValue; } }
PatternFilter extends AbstractFilter { @Override public <T extends Object> PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue) { Validate.notNull(propertyValue, "Node must not be null."); String value = getStringValue(propertyValue); if (StringUtils.isEmpty(value)) { return propertyValue; } Validate.notEmpty(getParameters(), "Parameters must not be null or empty."); List<Replace> replaces = getReplaces(); for (Replace replace : replaces) { Matcher matcher = replace.getPattern().matcher(value); value = matcher.replaceAll(replace.getReplacement()); } propertyValue.setValue((T) value); return propertyValue; }  }
PatternFilter extends AbstractFilter { @Override public <T extends Object> PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue) { Validate.notNull(propertyValue, "Node must not be null."); String value = getStringValue(propertyValue); if (StringUtils.isEmpty(value)) { return propertyValue; } Validate.notEmpty(getParameters(), "Parameters must not be null or empty."); List<Replace> replaces = getReplaces(); for (Replace replace : replaces) { Matcher matcher = replace.getPattern().matcher(value); value = matcher.replaceAll(replace.getReplacement()); } propertyValue.setValue((T) value); return propertyValue; }  @Override PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue); }
PatternFilter extends AbstractFilter { @Override public <T extends Object> PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue) { Validate.notNull(propertyValue, "Node must not be null."); String value = getStringValue(propertyValue); if (StringUtils.isEmpty(value)) { return propertyValue; } Validate.notEmpty(getParameters(), "Parameters must not be null or empty."); List<Replace> replaces = getReplaces(); for (Replace replace : replaces) { Matcher matcher = replace.getPattern().matcher(value); value = matcher.replaceAll(replace.getReplacement()); } propertyValue.setValue((T) value); return propertyValue; }  @Override PrismPropertyValue<T> apply(PrismPropertyValue<T> propertyValue); static final QName ELEMENT_REPLACE; static final QName ELEMENT_PATTERN; static final QName ELEMENT_REPLACEMENT; }