@Override public IdPAttributeValue<?> apply(final IdPAttributeValue<?> input) { if (null == input) { return new EmptyAttributeValue(EmptyType.NULL_VALUE); } else { return input; } } };
if (dependencyValue instanceof EmptyAttributeValue) { final EmptyAttributeValue emptyVal = (EmptyAttributeValue) dependencyValue; if (EmptyType.NULL_VALUE == emptyVal.getValue()) { log.debug("{} ignored empty value of type {}", getLogPrefix(), emptyVal.getDisplayValue()); continue;
/** {@inheritDoc} */ @Override @Nonnull protected IdPAttribute doAttributeDefinitionResolve( @Nonnull final AttributeResolutionContext resolutionContext, @Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException { ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this); final IdPAttribute resultantAttribute = new IdPAttribute(getId()); final List<IdPAttributeValue<?>> dependencyValues = PluginDependencySupport.getMergedAttributeValues(workContext, getDependencies(), getId()); final List<StringAttributeValue> valueList = new ArrayList<>(dependencyValues.size()); for (final IdPAttributeValue dependencyValue : dependencyValues) { if (dependencyValue instanceof EmptyAttributeValue) { final EmptyAttributeValue emptyVal = (EmptyAttributeValue) dependencyValue; log.debug("{} ignored empty value of type {}", getLogPrefix(), emptyVal.getDisplayValue()); continue; } if (!(dependencyValue instanceof StringAttributeValue)) { throw new ResolutionException(new UnsupportedAttributeTypeException(getLogPrefix() + "This attribute definition only supports attribute value types of " + StringAttributeValue.class.getName() + " not values of type " + dependencyValue.getClass().getName())); } valueList.add(new ScopedStringAttributeValue((String) dependencyValue.getValue(), scope)); } resultantAttribute.setValues(valueList); return resultantAttribute; }
final String velocityValue; if (value instanceof EmptyAttributeValue) { switch (((EmptyAttributeValue) value).getValue()) { case NULL_VALUE: velocityValue = null;
/** {@inheritDoc} */ @Override @Nullable protected IdPAttribute doAttributeDefinitionResolve( @Nonnull final AttributeResolutionContext resolutionContext, @Nonnull final AttributeResolverWorkContext workContext) throws ResolutionException { Constraint.isNotNull(workContext, getLogPrefix() + " AttributeResolverWorkContext cannot be null"); ComponentSupport.ifDestroyedThrowDestroyedComponentException(this); ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this); final IdPAttribute resultantAttribute = new IdPAttribute(getId()); final List<IdPAttributeValue<?>> dependencyValues = PluginDependencySupport.getMergedAttributeValues(workContext, getDependencies(), getId()); log.debug("{} Dependencies {} provided unmapped values of {}", getLogPrefix(), getDependencies(), dependencyValues); final List<IdPAttributeValue<?>> valueList = new ArrayList<>(dependencyValues.size()); for (final IdPAttributeValue<?> dependencyValue : dependencyValues) { if (dependencyValue instanceof EmptyAttributeValue) { final EmptyAttributeValue emptyVal = (EmptyAttributeValue) dependencyValue; log.debug("{} ignored empty value of type {}", getLogPrefix(), emptyVal.getDisplayValue()); continue; } if (!(dependencyValue instanceof StringAttributeValue)) { throw new ResolutionException(new UnsupportedAttributeTypeException(getLogPrefix() + "This attribute definition only supports attribute value types of " + StringAttributeValue.class.getName() + " not values of type " + dependencyValue.getClass().getName())); } valueList.add(buildScopedStringAttributeValue((StringAttributeValue) dependencyValue)); } resultantAttribute.setValues(valueList); return resultantAttribute; }
/** * Add the provided value to the provided list, converting {@link String} to {@link StringAttributeValue}. * * @param values the list to add to. * @param value the value to add. Known to be a {@link String} or an {@link IdPAttributeValue} */ private void addAsIdPAttributeValue(final List<IdPAttributeValue<?>> values, final Object value) { if (null == value) { values.add(new EmptyAttributeValue(EmptyType.NULL_VALUE)); } else if (value instanceof String) { values.add(StringAttributeValue.valueOf((String) value)); } else { values.add((IdPAttributeValue) value); } }
final EmptyAttributeValue emptyVal = (EmptyAttributeValue) attributeValue; log.warn("{} Source attribute {} value for connector {} was an empty value of type {}", getLogPrefix(), getSourceAttributeInformation(), getId(), emptyVal.getDisplayValue()); return null; } else {
/** * Gets attribute value. * * @param attribute the attribute * @return the attribute value */ protected IdPAttributeValue<?> getAttributeValue(final IdPAttribute attribute) { if (!attribute.getValues().isEmpty()) { return attribute.getValues().get(0); } return new EmptyAttributeValue(EmptyAttributeValue.EmptyType.NULL_VALUE); }