@Override public boolean apply(FieldRuleProperty fieldRuleProperty) { return fieldRuleProperty.getName().equalsIgnoreCase(name); } }).orNull();
@Override public boolean apply(FieldRuleProperty fieldRuleProperty) { return list.contains(fieldRuleProperty.getType()); } }));
public FieldRuleProperty build() { FieldRuleProperty property = new FieldRuleProperty(); property.setName(this.name); property.setDisplayName(this.displayName); property.setType(this.type); property.setHint(this.hint); property.setPlaceholder(this.placeholder); property.setSelectableValues(this.selectableValues); property.setObjectProperty(this.objectProperty); property.setValue(this.value); property.setRequired(this.required); property.setGroup(this.group); property.setGroupOrder(this.groupOrder); property.setHidden(this.hidden); property.setPattern(pattern); String invalidPatternMessage = StringUtils.isNotBlank(patternInvalidMessage) ? patternInvalidMessage : "Invalid Input"; property.setPatternInvalidMessage(invalidPatternMessage); property.setAdditionalProperties(additionalProperties); return property; } }
@JsonIgnore public void buildValueDisplayString() { StringBuffer sb = null; if (getProperties() != null) { for (FieldRuleProperty property : getProperties()) { if (!PolicyPropertyTypes.PROPERTY_TYPE.currentFeed.name().equalsIgnoreCase(property.getType())) { //get the values String value = property.getStringValue(); if (sb == null) { sb = new StringBuffer(); } else { sb.append(";"); } sb.append(property.getName() + ": " + value); } } } if (sb != null) { setPropertyValuesDisplayString(sb.toString()); } }
private Object getPropertyValue(BaseUiPolicyRule rule, Class<P> domainPolicyClass, PolicyPropertyRef reference) { for (FieldRuleProperty property : rule.getProperties()) { String name = property.getName(); if (name.equalsIgnoreCase(reference.name())) { String field = property.getObjectProperty(); String value = property.getStringValue(); Field f = FieldUtils.getField(domainPolicyClass, field, true); Object objectValue = convertStringToObject(value, f.getType()); return objectValue; } } return null; }
/** * Trasform a user interface object back to the domain policy class * * @param rule the ui object * @return the domain policy transformed */ @Override public P fromUiModel(U rule) throws PolicyTransformException { try { P domainPolicy = createClass(rule); if (hasConstructor(domainPolicy.getClass())) { for (FieldRuleProperty property : rule.getProperties()) { String field = property.getObjectProperty(); String value = property.getStringValue(); Field f = FieldUtils.getField(domainPolicy.getClass(), field, true); Object objectValue = convertStringToObject(value, f.getType()); f.set(domainPolicy, objectValue); } } afterFromUiModel(domainPolicy, rule); return domainPolicy; } catch (Exception e) { throw new PolicyTransformException(e); } }
public void addSelectableValue(LabelValue labelValue) { getSelectableValues().add(labelValue); }
@Override public boolean apply(FieldRuleProperty fieldRuleProperty) { return list.contains(fieldRuleProperty.getValue()); } }));
@JsonIgnore public String getStringValue() { if (StringUtils.isBlank(value) && values != null && !values.isEmpty()) { //join the values into a string comma separated StringBuffer sb = new StringBuffer(); for (LabelValue lv : getValues()) { if (!sb.toString().equalsIgnoreCase("")) { sb.append(","); } sb.append(lv.getValue()); } return sb.toString(); } else { return value; } }
public void addSelectableValue(String label, String value) { getSelectableValues().add(new LabelValue(label, value)); }