committed by
GitHub
48 changed files with 567 additions and 422 deletions
@ -0,0 +1,31 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.data.exception; |
||||
|
|
||||
|
import lombok.Getter; |
||||
|
import org.thingsboard.server.common.data.id.TenantId; |
||||
|
|
||||
|
public class TenantNotFoundException extends RuntimeException { |
||||
|
|
||||
|
@Getter |
||||
|
private final TenantId tenantId; |
||||
|
|
||||
|
public TenantNotFoundException(TenantId tenantId) { |
||||
|
super("Tenant with id " + tenantId + " not found"); |
||||
|
this.tenantId = tenantId; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright © 2016-2023 The Thingsboard Authors |
||||
|
* |
||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||
|
* you may not use this file except in compliance with the License. |
||||
|
* You may obtain a copy of the License at |
||||
|
* |
||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
* |
||||
|
* Unless required by applicable law or agreed to in writing, software |
||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
|
* See the License for the specific language governing permissions and |
||||
|
* limitations under the License. |
||||
|
*/ |
||||
|
package org.thingsboard.server.common.msg.notification.trigger; |
||||
|
|
||||
|
import lombok.Builder; |
||||
|
import lombok.Data; |
||||
|
import org.thingsboard.server.common.data.HasName; |
||||
|
import org.thingsboard.server.common.data.User; |
||||
|
import org.thingsboard.server.common.data.audit.ActionType; |
||||
|
import org.thingsboard.server.common.data.id.EntityId; |
||||
|
import org.thingsboard.server.common.data.id.TenantId; |
||||
|
import org.thingsboard.server.common.data.notification.rule.trigger.NotificationRuleTriggerType; |
||||
|
|
||||
|
@Data |
||||
|
@Builder |
||||
|
public class EntityActionTrigger implements NotificationRuleTrigger { |
||||
|
|
||||
|
private final TenantId tenantId; |
||||
|
private final EntityId entityId; |
||||
|
private final HasName entity; |
||||
|
private final ActionType actionType; |
||||
|
private final User user; |
||||
|
|
||||
|
@Override |
||||
|
public NotificationRuleTriggerType getType() { |
||||
|
return NotificationRuleTriggerType.ENTITY_ACTION; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public EntityId getOriginatorEntityId() { |
||||
|
return entityId; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -1,54 +0,0 @@ |
|||||
#### Rule engine notification templatization |
|
||||
|
|
||||
<div class="divider"></div> |
|
||||
<br/> |
|
||||
|
|
||||
Notification subject and message fields support templatization. The list of available templatization parameters depends on the template type. |
|
||||
See the available types and parameters below: |
|
||||
|
|
||||
Available template parameters: |
|
||||
|
|
||||
* values from the incoming message metadata referenced using the metadata key name; |
|
||||
* values from the incoming message data referenced using the data key name; |
|
||||
* *originatorType* - type of the originator, e.g. 'Device'; |
|
||||
* *originatorId* - id of the originator |
|
||||
* *msgType* - type of the message |
|
||||
* *recipientEmail* - email of the recipient; |
|
||||
* *recipientFirstName* - first name of the recipient; |
|
||||
* *recipientLastName* - last name of the recipient; |
|
||||
|
|
||||
Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. |
|
||||
You may also modify the value of the parameter with one of the suffixes: |
|
||||
|
|
||||
* `upperCase`, for example - `${recipientFirstName:upperCase}` |
|
||||
* `lowerCase`, for example - `${recipientFirstName:lowerCase}` |
|
||||
* `capitalize`, for example - `${recipientFirstName:capitalize}` |
|
||||
|
|
||||
<div class="divider"></div> |
|
||||
|
|
||||
##### Examples |
|
||||
|
|
||||
Let's assume the incoming message to Rule node has the following data: |
|
||||
```json |
|
||||
{ |
|
||||
"building_1": { |
|
||||
"temperature": 24 |
|
||||
} |
|
||||
} |
|
||||
``` |
|
||||
|
|
||||
The following template: |
|
||||
|
|
||||
```text |
|
||||
Building 1: temperature is ${building_1.temperature} |
|
||||
{:copy-code} |
|
||||
``` |
|
||||
|
|
||||
will be transformed to: |
|
||||
|
|
||||
```text |
|
||||
Building 1: temperature is 24 |
|
||||
``` |
|
||||
|
|
||||
<br> |
|
||||
<br> |
|
||||
@ -0,0 +1,57 @@ |
|||||
|
#### Rule engine notification templatization |
||||
|
|
||||
|
<div class="divider"></div> |
||||
|
<br/> |
||||
|
|
||||
|
Notification subject and message fields support templatization. |
||||
|
The list of available templatization parameters depends on the template type. |
||||
|
See the available types and parameters below: |
||||
|
|
||||
|
Available template parameters: |
||||
|
|
||||
|
* values from the incoming message metadata referenced using the metadata key name; |
||||
|
* values from the incoming message data referenced using the data key name; |
||||
|
* `originatorType` - type of the originator, e.g. 'Device'; |
||||
|
* `originatorId` - id of the originator |
||||
|
* `msgType` - type of the message |
||||
|
* `recipientTitle` - title of the recipient (first and last name if specified, email otherwise); |
||||
|
* `recipientEmail` - email of the recipient; |
||||
|
* `recipientFirstName` - first name of the recipient; |
||||
|
* `recipientLastName` - last name of the recipient; |
||||
|
|
||||
|
Parameter names must be wrapped using `${...}`. For example: `${recipientFirstName}`. |
||||
|
You may also modify the value of the parameter with one of the suffixes: |
||||
|
|
||||
|
* `upperCase`, for example - `${recipientFirstName:upperCase}` |
||||
|
* `lowerCase`, for example - `${recipientFirstName:lowerCase}` |
||||
|
* `capitalize`, for example - `${recipientFirstName:capitalize}` |
||||
|
|
||||
|
<div class="divider"></div> |
||||
|
|
||||
|
##### Examples |
||||
|
|
||||
|
Let's assume the incoming message to Rule node has the following data: |
||||
|
|
||||
|
```json |
||||
|
{ |
||||
|
"building_1": { |
||||
|
"temperature": 24 |
||||
|
} |
||||
|
} |
||||
|
``` |
||||
|
|
||||
|
The following template: |
||||
|
|
||||
|
```text |
||||
|
Building 1: temperature is ${building_1.temperature} |
||||
|
{:copy-code} |
||||
|
``` |
||||
|
|
||||
|
will be transformed to: |
||||
|
|
||||
|
```text |
||||
|
Building 1: temperature is 24 |
||||
|
``` |
||||
|
|
||||
|
<br> |
||||
|
<br> |
||||
Loading…
Reference in new issue