Search in sources :

Example 1 with MetadataAttributes

use of org.mule.runtime.api.metadata.MetadataAttributes in project mule by mulesoft.

the class MetadataMediator method getMetadata.

/**
 * Resolves the {@link ComponentMetadataDescriptor} for the associated {@code context} using static and dynamic resolving of the
 * Component parameters, attributes and output.
 *
 * @param context current {@link MetadataContext} that will be used by the {@link InputTypeResolver} and
 *        {@link OutputTypeResolver}
 * @param keyValue {@link Object} resolved {@link MetadataKey} object
 * @return Successful {@link MetadataResult} if the MetadataTypes are resolved without errors Failure {@link MetadataResult}
 *         when the Metadata retrieval of any element fails for any reason
 */
private MetadataResult<ComponentMetadataDescriptor<T>> getMetadata(MetadataContext context, Object keyValue, MetadataAttributes.MetadataAttributesBuilder attributesBuilder) {
    MetadataResult<OutputMetadataDescriptor> output = outputDelegate.getOutputMetadataDescriptor(context, keyValue);
    MetadataResult<InputMetadataDescriptor> input = inputDelegate.getInputMetadataDescriptors(context, keyValue);
    if (output.isSuccess() && input.isSuccess()) {
        MetadataAttributes metadataAttributes = getMetadataAttributes(attributesBuilder, outputDelegate, input.get());
        T model = getTypedModel(input.get(), output.get());
        return success(ComponentMetadataDescriptor.builder(model).withAttributes(metadataAttributes).build());
    }
    List<MetadataFailure> failures = ImmutableList.<MetadataFailure>builder().addAll(output.getFailures()).addAll(input.getFailures()).build();
    return failure(ComponentMetadataDescriptor.builder(component).build(), failures);
}
Also used : InputMetadataDescriptor(org.mule.runtime.api.metadata.descriptor.InputMetadataDescriptor) OutputMetadataDescriptor(org.mule.runtime.api.metadata.descriptor.OutputMetadataDescriptor) MetadataAttributes(org.mule.runtime.api.metadata.MetadataAttributes) MetadataFailure(org.mule.runtime.api.metadata.resolving.MetadataFailure)

Aggregations

MetadataAttributes (org.mule.runtime.api.metadata.MetadataAttributes)1 InputMetadataDescriptor (org.mule.runtime.api.metadata.descriptor.InputMetadataDescriptor)1 OutputMetadataDescriptor (org.mule.runtime.api.metadata.descriptor.OutputMetadataDescriptor)1 MetadataFailure (org.mule.runtime.api.metadata.resolving.MetadataFailure)1