Showing
1 changed file
with
9 additions
and
2 deletions
@@ -29,13 +29,12 @@ import org.springframework.web.client.RestTemplate; | @@ -29,13 +29,12 @@ import org.springframework.web.client.RestTemplate; | ||
29 | import org.thingsboard.server.common.data.Customer; | 29 | import org.thingsboard.server.common.data.Customer; |
30 | import org.thingsboard.server.common.data.Device; | 30 | import org.thingsboard.server.common.data.Device; |
31 | import org.thingsboard.server.common.data.alarm.Alarm; | 31 | import org.thingsboard.server.common.data.alarm.Alarm; |
32 | -import org.thingsboard.server.common.data.alarm.AlarmSeverity; | ||
33 | -import org.thingsboard.server.common.data.alarm.AlarmStatus; | ||
34 | import org.thingsboard.server.common.data.asset.Asset; | 32 | import org.thingsboard.server.common.data.asset.Asset; |
35 | import org.thingsboard.server.common.data.id.AssetId; | 33 | import org.thingsboard.server.common.data.id.AssetId; |
36 | import org.thingsboard.server.common.data.id.CustomerId; | 34 | import org.thingsboard.server.common.data.id.CustomerId; |
37 | import org.thingsboard.server.common.data.id.DeviceId; | 35 | import org.thingsboard.server.common.data.id.DeviceId; |
38 | import org.thingsboard.server.common.data.id.EntityId; | 36 | import org.thingsboard.server.common.data.id.EntityId; |
37 | +import org.thingsboard.server.common.data.relation.EntityRelation; | ||
39 | import org.thingsboard.server.common.data.security.DeviceCredentials; | 38 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
40 | 39 | ||
41 | import java.io.IOException; | 40 | import java.io.IOException; |
@@ -112,6 +111,14 @@ public class RestClient implements ClientHttpRequestInterceptor { | @@ -112,6 +111,14 @@ public class RestClient implements ClientHttpRequestInterceptor { | ||
112 | customerId.toString(), assetId.toString()).getBody(); | 111 | customerId.toString(), assetId.toString()).getBody(); |
113 | } | 112 | } |
114 | 113 | ||
114 | + public EntityRelation makeRelation(String relationType, EntityId idFrom, EntityId idTo) { | ||
115 | + EntityRelation relation = new EntityRelation(); | ||
116 | + relation.setFrom(idFrom); | ||
117 | + relation.setTo(idTo); | ||
118 | + relation.setType(relationType); | ||
119 | + return restTemplate.postForEntity(baseURL + "/api/relation", relation, EntityRelation.class).getBody(); | ||
120 | + } | ||
121 | + | ||
115 | public DeviceCredentials getCredentials(DeviceId id) { | 122 | public DeviceCredentials getCredentials(DeviceId id) { |
116 | return restTemplate.getForEntity(baseURL + "/api/device/" + id.getId().toString() + "/credentials", DeviceCredentials.class).getBody(); | 123 | return restTemplate.getForEntity(baseURL + "/api/device/" + id.getId().toString() + "/credentials", DeviceCredentials.class).getBody(); |
117 | } | 124 | } |