Search in sources :

Example 6 with MetadataFailure

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

the class MetadataOutputDelegate method resolveOutputAttributesMetadata.

private MetadataResult<MetadataType> resolveOutputAttributesMetadata(MetadataContext context, Object key, Function<MetadataType, Boolean> metadataValidator) {
    try {
        MetadataType metadata = resolverFactory.getOutputAttributesResolver().getAttributesType(context, key);
        if (metadataValidator.apply(metadata)) {
            return success(metadata);
        }
        MetadataFailure failure = newFailure().withMessage("Error resolving Output Attributes metadata").withFailureCode(NO_DYNAMIC_TYPE_AVAILABLE).withReason(NULL_TYPE_ERROR).onOutputAttributes();
        return failure(failure);
    } catch (Exception e) {
        return failure(newFailure(e).onOutputAttributes());
    }
}
Also used : MessageMetadataType(org.mule.metadata.message.api.MessageMetadataType) MetadataType(org.mule.metadata.api.model.MetadataType) MetadataFailure(org.mule.runtime.api.metadata.resolving.MetadataFailure) MetadataResolvingException(org.mule.runtime.api.metadata.MetadataResolvingException)

Aggregations

MetadataFailure (org.mule.runtime.api.metadata.resolving.MetadataFailure)6 MetadataType (org.mule.metadata.api.model.MetadataType)5 MetadataResolvingException (org.mule.runtime.api.metadata.MetadataResolvingException)4 MessageMetadataType (org.mule.metadata.message.api.MessageMetadataType)3 HasOutputModel (org.mule.runtime.api.meta.model.HasOutputModel)2 InputMetadataDescriptor (org.mule.runtime.api.metadata.descriptor.InputMetadataDescriptor)2 OutputMetadataDescriptor (org.mule.runtime.api.metadata.descriptor.OutputMetadataDescriptor)2 TypeMetadataDescriptor (org.mule.runtime.api.metadata.descriptor.TypeMetadataDescriptor)2 String.format (java.lang.String.format)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors.toList (java.util.stream.Collectors.toList)1 MetadataTypeUtils.isCollection (org.mule.metadata.api.utils.MetadataTypeUtils.isCollection)1 MetadataTypeUtils.isNullType (org.mule.metadata.api.utils.MetadataTypeUtils.isNullType)1 ClassInformationAnnotation (org.mule.metadata.java.api.annotation.ClassInformationAnnotation)1 JavaTypeUtils.getType (org.mule.metadata.java.api.utils.JavaTypeUtils.getType)1 ComponentModel (org.mule.runtime.api.meta.model.ComponentModel)1 OutputModel (org.mule.runtime.api.meta.model.OutputModel)1 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)1