private MetadataType wrapInMessageType(MetadataType type, Object key, MetadataContext context, Optional<MetadataType> staticAttributes) throws MetadataResolvingException { MessageMetadataTypeBuilder message = new MessageMetadataTypeBuilder().payload(type); staticAttributes.ifPresent(message::attributes); if (((HasOutputModel) component).getOutputAttributes().hasDynamicType()) { MetadataResult<MetadataType> attributes = resolveOutputAttributesMetadata(context, key, Objects::nonNull); if (!attributes.isSuccess()) { throw new MetadataResolvingException("Could not resolve attributes of List<Message> output", attributes.getFailures().stream() .map(MetadataFailure::getFailureCode) .findFirst() .orElse(UNKNOWN)); } message.attributes(attributes.get()); } return message.build(); }
/** * Given a {@link MetadataKey} of a type and a {@link MetadataContext}, resolves the {@link MetadataType} of the Components's * output {@link Message#getAttributes()} using the {@link OutputTypeResolver} associated to the current component. * * @param context {@link MetadataContext} of the Metadata resolution * @param key {@link MetadataKey} of the type which's structure has to be resolved * @return a {@link MetadataResult} with the {@link MetadataType} of the components output {@link Message#getAttributes()} */ private MetadataResult<MetadataType> getOutputAttributesMetadata(final MetadataContext context, Object key) { OutputModel attributes = ((HasOutputModel) component).getOutputAttributes(); if (isVoid(attributes.getType()) || !attributes.hasDynamicType()) { return success(attributes.getType()); } return resolveOutputAttributesMetadata(context, key, (metadata) -> isMetadataResolvedCorrectly(metadata, true)); }
output); MetadataResult<TypeMetadataDescriptor> attributesDescriptor = toMetadataDescriptorResult(componentWithOutput.getOutputAttributes().getType(), false, attributes);
private MetadataType wrapInMessageType(MetadataType type, Object key, MetadataContext context, Optional<MetadataType> staticAttributes) throws MetadataResolvingException { MessageMetadataTypeBuilder message = new MessageMetadataTypeBuilder().payload(type); staticAttributes.ifPresent(message::attributes); if (((HasOutputModel) component).getOutputAttributes().hasDynamicType()) { MetadataResult<MetadataType> attributes = resolveOutputAttributesMetadata(context, key, Objects::nonNull); if (!attributes.isSuccess()) { throw new MetadataResolvingException("Could not resolve attributes of List<Message> output", attributes.getFailures().stream() .map(MetadataFailure::getFailureCode) .findFirst() .orElse(UNKNOWN)); } message.attributes(attributes.get()); } return message.build(); }
/** * Given a {@link MetadataKey} of a type and a {@link MetadataContext}, resolves the {@link MetadataType} of the Components's * output {@link Message#getAttributes()} using the {@link OutputTypeResolver} associated to the current component. * * @param context {@link MetadataContext} of the Metadata resolution * @param key {@link MetadataKey} of the type which's structure has to be resolved * @return a {@link MetadataResult} with the {@link MetadataType} of the components output {@link Message#getAttributes()} */ private MetadataResult<MetadataType> getOutputAttributesMetadata(final MetadataContext context, Object key) { OutputModel attributes = ((HasOutputModel) component).getOutputAttributes(); if (isVoid(attributes.getType()) || !attributes.hasDynamicType()) { return success(attributes.getType()); } return resolveOutputAttributesMetadata(context, key, (metadata) -> isMetadataResolvedCorrectly(metadata, true)); }
output); MetadataResult<TypeMetadataDescriptor> attributesDescriptor = toMetadataDescriptorResult(componentWithOutput.getOutputAttributes().getType(), false, attributes);