Search in sources :

Example 1 with TypedValueTypeAnnotation

use of org.mule.runtime.extension.api.declaration.type.annotation.TypedValueTypeAnnotation in project mule by mulesoft.

the class SoapInvokeOperationDeclarer method declareRequestParameters.

/**
 * Given the Invoke Operation Declarer declares the parameters for the soap request.
 *
 * @param operation the invoke operation declarer.
 * @param loader    a {@link ClassTypeLoader} to load some parameters types.
 */
private void declareRequestParameters(OperationDeclarer operation, ClassTypeLoader loader) {
    ParameterGroupDeclarer message = operation.onParameterGroup(MESSAGE_GROUP).withDslInlineRepresentation(true).withLayout(getLayout(1));
    MetadataType binaryType = loader.load(InputStream.class);
    ObjectType attachments = TYPE_BUILDER.objectType().openWith(TYPE_BUILDER.binaryType().id(InputStream.class.getName()).with(new TypedValueTypeAnnotation())).with(new TypeIdAnnotation(Map.class.getName())).build();
    message.withOptionalParameter(BODY_PARAM).ofDynamicType(binaryType).withRole(PRIMARY_CONTENT).defaultingTo(PAYLOAD).withLayout(getLayout(3)).withDisplayModel(DisplayModel.builder().summary("The XML body to include in the SOAP message, with all the required parameters.").build());
    message.withOptionalParameter(HEADERS_PARAM).ofDynamicType(binaryType).withRole(CONTENT).withLayout(getLayout(4)).withDisplayModel(DisplayModel.builder().displayName(HEADERS_DISPLAY_NAME).summary("The XML headers to include in the SOAP message.").build());
    message.withOptionalParameter(ATTACHMENTS_PARAM).ofDynamicType(attachments).withRole(CONTENT).withLayout(getLayout(5)).withDisplayModel(DisplayModel.builder().summary("The attachments to include in the SOAP request.").build());
    operation.onParameterGroup(TRANSPORT_GROUP).withLayout(getLayout(2)).withOptionalParameter(TRANSPORT_HEADERS_PARAM).ofType(TYPE_BUILDER.objectType().openWith(loader.load(String.class)).with(new TypeIdAnnotation(Map.class.getName())).build()).withDsl(ParameterDslConfiguration.getDefaultInstance()).withLayout(LayoutModel.builder().order(2).tabName(TRANSPORT).build()).withDisplayModel(DisplayModel.builder().displayName(HEADERS_DISPLAY_NAME).summary("The headers to set in the transport configuration.").build());
}
Also used : ObjectType(org.mule.metadata.api.model.ObjectType) InputStream(java.io.InputStream) TypedValueTypeAnnotation(org.mule.runtime.extension.api.declaration.type.annotation.TypedValueTypeAnnotation) MetadataType(org.mule.metadata.api.model.MetadataType) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) ParameterGroupDeclarer(org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer) TypeIdAnnotation(org.mule.metadata.api.annotation.TypeIdAnnotation)

Aggregations

ImmutableMap (com.google.common.collect.ImmutableMap)1 InputStream (java.io.InputStream)1 Map (java.util.Map)1 TypeIdAnnotation (org.mule.metadata.api.annotation.TypeIdAnnotation)1 MetadataType (org.mule.metadata.api.model.MetadataType)1 ObjectType (org.mule.metadata.api.model.ObjectType)1 ParameterGroupDeclarer (org.mule.runtime.api.meta.model.declaration.fluent.ParameterGroupDeclarer)1 TypedValueTypeAnnotation (org.mule.runtime.extension.api.declaration.type.annotation.TypedValueTypeAnnotation)1