private void extractParameter(ParameterizedDeclarer parameterizedDeclarer, ComponentModel param, ParameterRole role) { Map<String, String> parameters = param.getParameters(); String receivedInputType = parameters.get(TYPE_ATTRIBUTE); final LayoutModel.LayoutModelBuilder layoutModelBuilder = builder(); if (parseBoolean(parameters.get(PASSWORD))) { layoutModelBuilder.asPassword(); } layoutModelBuilder.order(getOrder(parameters.get(ORDER_ATTRIBUTE))); layoutModelBuilder.tabName(getTab(parameters.get(TAB_ATTRIBUTE))); final DisplayModel displayModel = getDisplayModel(param); MetadataType parameterType = extractType(receivedInputType); ParameterDeclarer parameterDeclarer = getParameterDeclarer(parameterizedDeclarer, parameters); parameterDeclarer.describedAs(getDescription(param)) .withLayout(layoutModelBuilder.build()) .withDisplayModel(displayModel) .withRole(role) .ofType(parameterType); }
/** * Given the Invoke Operation Declarer declares all the parameters that the operation has. * * @param operation the invoke operation declarer. */ private void declareMetadataKeyParameters(OperationDeclarer operation, ClassTypeLoader loader, ReflectionCache reflectionCache) { TypeWrapper keyType = new TypeWrapper(WebServiceTypeKey.class, loader); ParameterGroupDeclarer group = operation .onParameterGroup(KEYS_GROUP) .withModelProperty( new ParameterGroupModelProperty(new ParameterGroupDescriptor(KEYS_GROUP, keyType))); StringType stringType = TYPE_BUILDER.stringType().build(); group.withRequiredParameter(SERVICE_PARAM) .withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, SERVICE_PARAM, reflectionCache) .get())) .ofType(stringType) .withModelProperty(new MetadataKeyPartModelProperty(1)) .withLayout(getLayout(1)); group.withRequiredParameter(OPERATION_PARAM) .ofType(stringType) .withModelProperty(new DeclaringMemberModelProperty(getField(WebServiceTypeKey.class, OPERATION_PARAM, reflectionCache) .get())) .withModelProperty(new MetadataKeyPartModelProperty(2)) .withLayout(getLayout(2)); }
/** * Declares a new connection provider for a configuration given a {@link SoapServiceProviderWrapper} declaration. * * @param configDeclarer the configuration declarer that will own the provider * @param provider a {@link SoapServiceProviderWrapper} that describes the {@link SoapServiceProvider} Type. * @param hasCustomTransports if declares custom transport or not. */ public void declare(ConfigurationDeclarer configDeclarer, SoapServiceProviderWrapper provider, boolean hasCustomTransports) { String description = provider.getDescription(); // Declares the Service Provider as a Connection Provider. ConnectionProviderDeclarer providerDeclarer = configDeclarer.withConnectionProvider(provider.getAlias()) .describedAs(description) .withModelProperty(new ConnectionTypeModelProperty(ForwardingSoapClient.class)) //TODO - MULE-14311 - Make loader work in compile time .withModelProperty(new ImplementingTypeModelProperty(provider.getDeclaringClass().get())) .withConnectionManagementType(POOLING) .supportsConnectivityTesting(provider.supportsConnectivityTesting()); ParameterDeclarationContext context = new ParameterDeclarationContext("Service Provider", providerDeclarer.getDeclaration()); parametersLoader.declare(providerDeclarer, provider.getParameters(), context); if (hasCustomTransports) { providerDeclarer.onParameterGroup(TRANSPORT_GROUP) .withRequiredParameter(TRANSPORT_PARAM) .withDisplayModel(DisplayModel.builder().displayName(TRANSPORT_GROUP).build()) .ofType(typeLoader.load(MessageDispatcherProvider.class)) .withLayout(LayoutModel.builder().order(1).tabName(TRANSPORT).build()) .withExpressionSupport(NOT_SUPPORTED); } }