/** * Sets the attributes which are to be filtered. * * @param attributes attributes which are to be filtered */ public void setPrefilteredIdPAttributes(@Nullable @NullableElements final Collection<IdPAttribute> attributes) { final Collection<IdPAttribute> checkedAttributes = new ArrayList<>(); CollectionSupport.addIf(checkedAttributes, attributes, Predicates.notNull()); prefilteredAttributes = new HashMap<String, IdPAttribute>(checkedAttributes.size()); for (final IdPAttribute attribute : checkedAttributes) { prefilteredAttributes.put(attribute.getId(), attribute); } }
/** * Sets the attributes that have been filtered. * * @param attributes attributes that have been filtered */ public void setFilteredIdPAttributes(@Nullable @NullableElements final Collection<IdPAttribute> attributes) { final Collection<IdPAttribute> checkedAttributes = new ArrayList<>(); CollectionSupport.addIf(checkedAttributes, attributes, Predicates.notNull()); filteredAttributes = new HashMap<String, IdPAttribute>(checkedAttributes.size()); for (final IdPAttribute attribute : checkedAttributes) { filteredAttributes.put(attribute.getId(), attribute); } }
/** * Sets the encoders used to encode the values of this attribute in to protocol specific formats. * * @param attributeEncoders encoders used to encode the values of this attribute in to protocol specific formats */ public void setAttributeEncoders(@Nullable @NullableElements final Set<AttributeEncoder<?>> attributeEncoders) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); final Set<AttributeEncoder<?>> checkedEncoders = new HashSet<>(); CollectionSupport.addIf(checkedEncoders, attributeEncoders, Predicates.notNull()); encoders = ImmutableSet.copyOf(checkedEncoders); }
/** * Sets the transforms used to produce the transformed entity IDs. * * @param transformers transforms used to produce the transformed entity IDs */ public synchronized void setIdTransformers(final Collection<Converter<String, String>> transformers) { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); CollectionSupport.addIf(idTransformers, transformers, Predicates.notNull()); }
/** * Sets the list of dependencies for this plugin. * * @param pluginDependencies unmodifiable list of dependencies for this plugin */ public void setDependencies(@Nullable @NullableElements final Set<ResolverPluginDependency> pluginDependencies) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); final HashSet<ResolverPluginDependency> checkedDeps = new HashSet<>(); CollectionSupport.addIf(checkedDeps, pluginDependencies, Predicates.notNull()); dependencies = Collections.unmodifiableSet(checkedDeps); }
/** * Set the source attribute IDs. * * @param newSourceAttributes the source attribute IDs */ @Deprecated public void setSourceAttributes(@Nonnull @NullableElements final List<String> newSourceAttributes) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); Constraint.isNotNull(newSourceAttributes, "Source attribute list cannot be null"); sourceAttributes = new ArrayList<>(newSourceAttributes.size()); CollectionSupport.addIf(sourceAttributes, newSourceAttributes, Predicates.notNull()); }
/** * Gets the {@link ItemMetadata} to be added to each {@link Item}'s item metadata. * * @param metadata the {@link ItemMetadata} to be added to each {@link Item}'s item metadata */ public void setAdditionalItemMetadata(@Nonnull final Collection<ItemMetadata> metadata) { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(metadata, "additional metadata collection must not be null"); additionalItemMetadata = new LazyList<>(); CollectionSupport.addIf(additionalItemMetadata, metadata, Predicates.notNull()); }
/** * Constructor. * * @param policyId unique ID of this policy * @param requirementRule criterion used to determine if this policy is active for a given request * @param attributeRules value filtering policies employed if this policy is active */ public AttributeFilterPolicy(@Nonnull @NotEmpty @ParameterName(name="policyId") final String policyId, @Nonnull final @ParameterName(name="requirementRule") PolicyRequirementRule requirementRule, @Nullable @NullableElements final @ParameterName(name="attributeRules") Collection<AttributeRule> attributeRules) { setId(policyId); rule = Constraint.isNotNull(requirementRule, "Attribute filter policy activiation criterion can not be null"); final ArrayList<AttributeRule> checkedPolicies = new ArrayList<>(); CollectionSupport.addIf(checkedPolicies, attributeRules, Predicates.notNull()); if (null != attributeRules) { valuePolicies = ImmutableList.copyOf(Iterables.filter(attributeRules, Predicates.notNull())); } else { valuePolicies = Collections.EMPTY_LIST; } }