@SuppressWarnings("rawtypes") public static <T> T getValueFromFilter( List<? extends ObjectFilter> conditions, QName propertyName) throws SchemaException { ItemPath propertyPath = new ItemPath(propertyName); for (ObjectFilter f : conditions) { if (f instanceof EqualFilter && propertyPath.equivalent(((EqualFilter) f).getFullPath())) { List<? extends PrismValue> values = ((EqualFilter) f).getValues(); if (values.size() > 1) { throw new SchemaException( "More than one " + propertyName + " defined in the search query."); } if (values.size() < 1) { throw new SchemaException("Search query does not have specified " + propertyName + "."); } return (T) ((PrismPropertyValue) values.get(0)).getValue(); } if (NaryLogicalFilter.class.isAssignableFrom(f.getClass())) { T value = getValueFromFilter(((NaryLogicalFilter) f).getConditions(), propertyName); if (value != null) { return value; } } } return null; }
public ContainerWrapper findContainerWrapper(ItemPath path) { for (ContainerWrapper wrapper : getContainers()) { if (path != null) { if (path.equivalent(wrapper.getPath())) { return wrapper; } } else { if (wrapper.getPath() == null) { return wrapper; } } } return null; }
private DateValidator getActivationRangeValidator(Form form, ItemPath path) { DateValidator validator = null; List<DateValidator> validators = form.getBehaviors(DateValidator.class); if (validators != null) { for (DateValidator val : validators) { if (path.equivalent(val.getIdentifier())) { validator = val; break; } } } if (validator == null) { validator = new DateValidator(); validator.setIdentifier(path); form.add(validator); } return validator; }
public PropertyWrapper( ContainerWrapper container, I property, boolean readonly, ValueStatus status) { Validate.notNull(property, "Property must not be null."); Validate.notNull(status, "Property status must not be null."); this.container = container; this.property = property; this.status = status; this.readonly = readonly; this.itemDefinition = getItemDefinition(); ItemPath passwordPath = new ItemPath(SchemaConstantsGenerated.C_CREDENTIALS, CredentialsType.F_PASSWORD); if (passwordPath.equivalent(container.getPath()) && PasswordType.F_VALUE.equals(property.getElementName())) { displayName = "prismPropertyPanel.name.credentials.password"; } values = createValues(); }