Fixed mapping for combo-boxes with multiple=false
This commit is contained in:
parent
5f22835040
commit
40e5c64451
@ -37,7 +37,7 @@ public class RabbitMqPluginAction extends AbstractTemplatePluginAction<RabbitMqP
|
||||
builder.sync(configuration.isSync());
|
||||
builder.exchange(configuration.getExchange());
|
||||
builder.queueName(configuration.getQueueName());
|
||||
builder.messageProperties(configuration.getMessageProperties()[0]);
|
||||
builder.messageProperties(configuration.getMessageProperties());
|
||||
builder.msgType(payload.getMsgType());
|
||||
builder.requestId(payload.getRequestId());
|
||||
builder.payload(getMsgBody(ctx, msg));
|
||||
|
||||
@ -27,6 +27,6 @@ public class RabbitMqPluginActionConfiguration implements TemplateActionConfigur
|
||||
private boolean sync;
|
||||
private String exchange;
|
||||
private String queueName;
|
||||
private String[] messageProperties;
|
||||
private String messageProperties;
|
||||
private String template;
|
||||
}
|
||||
|
||||
@ -18,35 +18,7 @@
|
||||
},
|
||||
"messageProperties": {
|
||||
"title": "Message properties",
|
||||
"type": "array",
|
||||
"minItems" : 1,
|
||||
"items": [
|
||||
{
|
||||
"value": "BASIC",
|
||||
"label": "BASIC"
|
||||
},
|
||||
{
|
||||
"value": "MINIMAL_BASIC",
|
||||
"label": "MINIMAL_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "MINIMAL_PERSISTENT_BASIC",
|
||||
"label": "MINIMAL_PERSISTENT_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "PERSISTENT_BASIC",
|
||||
"label": "PERSISTENT_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "PERSISTENT_TEXT_PLAIN",
|
||||
"label": "PERSISTENT_TEXT_PLAIN"
|
||||
},
|
||||
{
|
||||
"value": "TEXT_PLAIN",
|
||||
"label": "TEXT_PLAIN"
|
||||
}
|
||||
],
|
||||
"uniqueItems": true
|
||||
"type": "string"
|
||||
},
|
||||
"template": {
|
||||
"title": "Body Template",
|
||||
@ -67,8 +39,35 @@
|
||||
{
|
||||
"key": "messageProperties",
|
||||
"type": "rc-select",
|
||||
"multiple": false
|
||||
"multiple": false,
|
||||
"items": [
|
||||
{
|
||||
"value": "BASIC",
|
||||
"label": "BASIC"
|
||||
},
|
||||
{
|
||||
"value": "MINIMAL_BASIC",
|
||||
"label": "MINIMAL_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "MINIMAL_PERSISTENT_BASIC",
|
||||
"label": "MINIMAL_PERSISTENT_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "PERSISTENT_BASIC",
|
||||
"label": "PERSISTENT_BASIC"
|
||||
},
|
||||
{
|
||||
"value": "PERSISTENT_TEXT_PLAIN",
|
||||
"label": "PERSISTENT_TEXT_PLAIN"
|
||||
},
|
||||
{
|
||||
"value": "TEXT_PLAIN",
|
||||
"label": "TEXT_PLAIN"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"key": "template",
|
||||
"type": "textarea",
|
||||
|
||||
@ -22,7 +22,7 @@ import java.io.IOException;
|
||||
/**
|
||||
* @author Andrew Shvayka
|
||||
*/
|
||||
public class DemoClient {
|
||||
public class RabbitMqDemoClient {
|
||||
|
||||
private static final String HOST = "localhost";
|
||||
private static final String USERNAME = "guest";
|
||||
@ -16,23 +16,14 @@
|
||||
package org.thingsboard.server.extensions.rest.action;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.velocity.Template;
|
||||
import org.apache.velocity.VelocityContext;
|
||||
import org.apache.velocity.runtime.parser.ParseException;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.thingsboard.server.common.msg.device.ToDeviceActorMsg;
|
||||
import org.thingsboard.server.common.msg.session.FromDeviceRequestMsg;
|
||||
import org.thingsboard.server.common.msg.session.ToDeviceMsg;
|
||||
import org.thingsboard.server.extensions.api.component.Action;
|
||||
import org.thingsboard.server.extensions.api.plugins.PluginAction;
|
||||
import org.thingsboard.server.extensions.api.plugins.msg.PluginToRuleMsg;
|
||||
import org.thingsboard.server.extensions.api.plugins.msg.ResponsePluginToRuleMsg;
|
||||
import org.thingsboard.server.extensions.api.plugins.msg.RuleToPluginMsg;
|
||||
import org.thingsboard.server.extensions.api.rules.RuleContext;
|
||||
import org.thingsboard.server.extensions.api.rules.RuleProcessingMetaData;
|
||||
import org.thingsboard.server.extensions.core.action.template.AbstractTemplatePluginAction;
|
||||
import org.thingsboard.server.extensions.core.utils.VelocityUtils;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -48,7 +39,7 @@ public class RestApiCallPluginAction extends AbstractTemplatePluginAction<RestAp
|
||||
builder.requestId(payload.getRequestId());
|
||||
builder.sync(configuration.isSync());
|
||||
builder.actionPath(configuration.getActionPath());
|
||||
builder.httpMethod(HttpMethod.valueOf(configuration.getRequestMethod()[0]));
|
||||
builder.httpMethod(HttpMethod.valueOf(configuration.getRequestMethod()));
|
||||
builder.expectedResultCode(HttpStatus.valueOf(configuration.getExpectedResultCode()));
|
||||
builder.msgBody(getMsgBody(ctx, msg));
|
||||
return Optional.of(new RestApiCallActionMsg(msg.getTenantId(),
|
||||
|
||||
@ -24,5 +24,5 @@ public class RestApiCallPluginActionConfiguration implements TemplateActionConfi
|
||||
private String template;
|
||||
private String actionPath;
|
||||
private int expectedResultCode;
|
||||
private String[] requestMethod;
|
||||
private String requestMethod;
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ public class RestApiCallPlugin extends AbstractPlugin<RestApiCallPluginConfigura
|
||||
configuration.getPort(),
|
||||
configuration.getBasePath());
|
||||
|
||||
if (configuration.getAuthMethod()[0].equals(BASIC_AUTH_METHOD)) {
|
||||
if (configuration.getAuthMethod().equals(BASIC_AUTH_METHOD)) {
|
||||
String userName = configuration.getUserName();
|
||||
String password = configuration.getPassword();
|
||||
String credentials = String.format(CREDENTIALS_TEMPLATE, userName, password);
|
||||
|
||||
@ -23,7 +23,7 @@ public class RestApiCallPluginConfiguration {
|
||||
private int port;
|
||||
private String basePath;
|
||||
|
||||
private String[] authMethod;
|
||||
private String authMethod;
|
||||
|
||||
private String userName;
|
||||
private String password;
|
||||
|
||||
@ -18,19 +18,7 @@
|
||||
},
|
||||
"requestMethod": {
|
||||
"title": "Request method",
|
||||
"type": "array",
|
||||
"minItems" : 1,
|
||||
"items": [
|
||||
{
|
||||
"value": "POST",
|
||||
"label": "POST"
|
||||
},
|
||||
{
|
||||
"value": "PUT",
|
||||
"label": "PUT"
|
||||
}
|
||||
],
|
||||
"uniqueItems": true
|
||||
"type": "string"
|
||||
},
|
||||
"expectedResultCode": {
|
||||
"title": "Expected Result Code",
|
||||
@ -56,7 +44,17 @@
|
||||
{
|
||||
"key": "requestMethod",
|
||||
"type": "rc-select",
|
||||
"multiple": false
|
||||
"multiple": false,
|
||||
"items": [
|
||||
{
|
||||
"value": "POST",
|
||||
"label": "POST"
|
||||
},
|
||||
{
|
||||
"value": "PUT",
|
||||
"label": "PUT"
|
||||
}
|
||||
]
|
||||
},
|
||||
"expectedResultCode"
|
||||
]
|
||||
|
||||
@ -21,19 +21,7 @@
|
||||
},
|
||||
"authMethod": {
|
||||
"title": "Authentication method",
|
||||
"type": "array",
|
||||
"minItems" : 1,
|
||||
"items": [
|
||||
{
|
||||
"value": "NO_AUTH",
|
||||
"label": "No authentication"
|
||||
},
|
||||
{
|
||||
"value": "BASIC_AUTH",
|
||||
"label": "Basic authentication"
|
||||
}
|
||||
],
|
||||
"uniqueItems": true
|
||||
"type": "string"
|
||||
},
|
||||
"userName": {
|
||||
"title": "Username",
|
||||
@ -58,7 +46,17 @@
|
||||
{
|
||||
"key": "authMethod",
|
||||
"type": "rc-select",
|
||||
"multiple": false
|
||||
"multiple": false,
|
||||
"items": [
|
||||
{
|
||||
"value": "NO_AUTH",
|
||||
"label": "No authentication"
|
||||
},
|
||||
{
|
||||
"value": "BASIC_AUTH",
|
||||
"label": "Basic authentication"
|
||||
}
|
||||
]
|
||||
},
|
||||
"userName",
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user