Showing
1 changed file
with
9 additions
and
2 deletions
... | ... | @@ -29,13 +29,12 @@ import org.springframework.web.client.RestTemplate; |
29 | 29 | import org.thingsboard.server.common.data.Customer; |
30 | 30 | import org.thingsboard.server.common.data.Device; |
31 | 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 | 32 | import org.thingsboard.server.common.data.asset.Asset; |
35 | 33 | import org.thingsboard.server.common.data.id.AssetId; |
36 | 34 | import org.thingsboard.server.common.data.id.CustomerId; |
37 | 35 | import org.thingsboard.server.common.data.id.DeviceId; |
38 | 36 | import org.thingsboard.server.common.data.id.EntityId; |
37 | +import org.thingsboard.server.common.data.relation.EntityRelation; | |
39 | 38 | import org.thingsboard.server.common.data.security.DeviceCredentials; |
40 | 39 | |
41 | 40 | import java.io.IOException; |
... | ... | @@ -112,6 +111,14 @@ public class RestClient implements ClientHttpRequestInterceptor { |
112 | 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 | 122 | public DeviceCredentials getCredentials(DeviceId id) { |
116 | 123 | return restTemplate.getForEntity(baseURL + "/api/device/" + id.getId().toString() + "/credentials", DeviceCredentials.class).getBody(); |
117 | 124 | } | ... | ... |