Commit eb7c2f1659fea2a1b065c4d8a2eceeb630a16478

Authored by YevhenBondarenko
Committed by Andrew Shvayka
1 parent 872cc5ff

Feature/rest client (#2218)

* added methods from admin-controller, alarm-controller, asset-controller, audit-log-controller

* refactored rest client and added methods from auth controller

* added methods from component-descriptor-controller

* added methods from customer controller

* added methods from dashboard controller

* added methods from device controller

* refactored url pageLink params

* added methods from entity relation controller

* added methods from entity view controller

* refactored

* added methods from event controller

* added methods from rpc controller

* added methods from rule chain controller

* added methods from telemetry controller

* added methods from tenant controller

* added methods from user controller

* added methods from widgets bundle controller

* added methods from widget type controller

* created method refreshToken

* moved classes SecuritySettings, UserPasswordPolicy, ClaimRequest, UpdateMessage, to common module, and added "/api" to urls where this part was missing
@@ -28,12 +28,12 @@ import org.thingsboard.server.common.data.AdminSettings; @@ -28,12 +28,12 @@ import org.thingsboard.server.common.data.AdminSettings;
28 import org.thingsboard.server.common.data.exception.ThingsboardException; 28 import org.thingsboard.server.common.data.exception.ThingsboardException;
29 import org.thingsboard.server.common.data.id.TenantId; 29 import org.thingsboard.server.common.data.id.TenantId;
30 import org.thingsboard.server.dao.settings.AdminSettingsService; 30 import org.thingsboard.server.dao.settings.AdminSettingsService;
31 -import org.thingsboard.server.service.security.model.SecuritySettings; 31 +import org.thingsboard.server.common.data.security.model.SecuritySettings;
32 import org.thingsboard.server.service.security.permission.Operation; 32 import org.thingsboard.server.service.security.permission.Operation;
33 import org.thingsboard.server.service.security.permission.Resource; 33 import org.thingsboard.server.service.security.permission.Resource;
34 import org.thingsboard.server.service.security.system.SystemSecurityService; 34 import org.thingsboard.server.service.security.system.SystemSecurityService;
35 import org.thingsboard.server.service.update.UpdateService; 35 import org.thingsboard.server.service.update.UpdateService;
36 -import org.thingsboard.server.service.update.model.UpdateMessage; 36 +import org.thingsboard.server.common.data.UpdateMessage;
37 37
38 @RestController 38 @RestController
39 @RequestMapping("/api/admin") 39 @RequestMapping("/api/admin")
@@ -24,7 +24,6 @@ import org.springframework.http.HttpHeaders; @@ -24,7 +24,6 @@ import org.springframework.http.HttpHeaders;
24 import org.springframework.http.HttpStatus; 24 import org.springframework.http.HttpStatus;
25 import org.springframework.http.ResponseEntity; 25 import org.springframework.http.ResponseEntity;
26 import org.springframework.security.access.prepost.PreAuthorize; 26 import org.springframework.security.access.prepost.PreAuthorize;
27 -import org.springframework.security.core.Authentication;  
28 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 27 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
29 import org.springframework.web.bind.annotation.RequestBody; 28 import org.springframework.web.bind.annotation.RequestBody;
30 import org.springframework.web.bind.annotation.RequestMapping; 29 import org.springframework.web.bind.annotation.RequestMapping;
@@ -43,14 +42,12 @@ import org.thingsboard.server.common.data.security.UserCredentials; @@ -43,14 +42,12 @@ import org.thingsboard.server.common.data.security.UserCredentials;
43 import org.thingsboard.server.dao.audit.AuditLogService; 42 import org.thingsboard.server.dao.audit.AuditLogService;
44 import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository; 43 import org.thingsboard.server.service.security.auth.jwt.RefreshTokenRepository;
45 import org.thingsboard.server.service.security.auth.rest.RestAuthenticationDetails; 44 import org.thingsboard.server.service.security.auth.rest.RestAuthenticationDetails;
46 -import org.thingsboard.server.service.security.model.SecuritySettings; 45 +import org.thingsboard.server.common.data.security.model.SecuritySettings;
47 import org.thingsboard.server.service.security.model.SecurityUser; 46 import org.thingsboard.server.service.security.model.SecurityUser;
48 -import org.thingsboard.server.service.security.model.UserPasswordPolicy; 47 +import org.thingsboard.server.common.data.security.model.UserPasswordPolicy;
49 import org.thingsboard.server.service.security.model.UserPrincipal; 48 import org.thingsboard.server.service.security.model.UserPrincipal;
50 import org.thingsboard.server.service.security.model.token.JwtToken; 49 import org.thingsboard.server.service.security.model.token.JwtToken;
51 import org.thingsboard.server.service.security.model.token.JwtTokenFactory; 50 import org.thingsboard.server.service.security.model.token.JwtTokenFactory;
52 -import org.thingsboard.server.service.security.permission.Operation;  
53 -import org.thingsboard.server.service.security.permission.Resource;  
54 import org.thingsboard.server.service.security.system.SystemSecurityService; 51 import org.thingsboard.server.service.security.system.SystemSecurityService;
55 import ua_parser.Client; 52 import ua_parser.Client;
56 53
@@ -44,7 +44,7 @@ import org.thingsboard.server.common.data.id.TenantId; @@ -44,7 +44,7 @@ import org.thingsboard.server.common.data.id.TenantId;
44 import org.thingsboard.server.common.data.page.TextPageData; 44 import org.thingsboard.server.common.data.page.TextPageData;
45 import org.thingsboard.server.common.data.page.TextPageLink; 45 import org.thingsboard.server.common.data.page.TextPageLink;
46 import org.thingsboard.server.common.data.security.DeviceCredentials; 46 import org.thingsboard.server.common.data.security.DeviceCredentials;
47 -import org.thingsboard.server.controller.claim.data.ClaimRequest; 47 +import org.thingsboard.server.common.data.ClaimRequest;
48 import org.thingsboard.server.dao.device.claim.ClaimResponse; 48 import org.thingsboard.server.dao.device.claim.ClaimResponse;
49 import org.thingsboard.server.dao.device.claim.ClaimResult; 49 import org.thingsboard.server.dao.device.claim.ClaimResult;
50 import org.thingsboard.server.dao.exception.IncorrectParameterException; 50 import org.thingsboard.server.dao.exception.IncorrectParameterException;
@@ -42,14 +42,13 @@ import org.thingsboard.server.common.data.User; @@ -42,14 +42,13 @@ import org.thingsboard.server.common.data.User;
42 import org.thingsboard.server.common.data.exception.ThingsboardException; 42 import org.thingsboard.server.common.data.exception.ThingsboardException;
43 import org.thingsboard.server.common.data.id.TenantId; 43 import org.thingsboard.server.common.data.id.TenantId;
44 import org.thingsboard.server.common.data.security.UserCredentials; 44 import org.thingsboard.server.common.data.security.UserCredentials;
45 -import org.thingsboard.server.dao.audit.AuditLogService;  
46 import org.thingsboard.server.dao.exception.DataValidationException; 45 import org.thingsboard.server.dao.exception.DataValidationException;
47 import org.thingsboard.server.dao.settings.AdminSettingsService; 46 import org.thingsboard.server.dao.settings.AdminSettingsService;
48 import org.thingsboard.server.dao.user.UserService; 47 import org.thingsboard.server.dao.user.UserService;
49 import org.thingsboard.server.dao.user.UserServiceImpl; 48 import org.thingsboard.server.dao.user.UserServiceImpl;
50 import org.thingsboard.server.service.security.exception.UserPasswordExpiredException; 49 import org.thingsboard.server.service.security.exception.UserPasswordExpiredException;
51 -import org.thingsboard.server.service.security.model.SecuritySettings;  
52 -import org.thingsboard.server.service.security.model.UserPasswordPolicy; 50 +import org.thingsboard.server.common.data.security.model.SecuritySettings;
  51 +import org.thingsboard.server.common.data.security.model.UserPasswordPolicy;
53 52
54 import javax.annotation.Resource; 53 import javax.annotation.Resource;
55 import java.util.ArrayList; 54 import java.util.ArrayList;
@@ -19,7 +19,7 @@ import org.springframework.security.core.AuthenticationException; @@ -19,7 +19,7 @@ import org.springframework.security.core.AuthenticationException;
19 import org.thingsboard.server.common.data.id.TenantId; 19 import org.thingsboard.server.common.data.id.TenantId;
20 import org.thingsboard.server.common.data.security.UserCredentials; 20 import org.thingsboard.server.common.data.security.UserCredentials;
21 import org.thingsboard.server.dao.exception.DataValidationException; 21 import org.thingsboard.server.dao.exception.DataValidationException;
22 -import org.thingsboard.server.service.security.model.SecuritySettings; 22 +import org.thingsboard.server.common.data.security.model.SecuritySettings;
23 23
24 public interface SystemSecurityService { 24 public interface SystemSecurityService {
25 25
@@ -22,7 +22,7 @@ import lombok.extern.slf4j.Slf4j; @@ -22,7 +22,7 @@ import lombok.extern.slf4j.Slf4j;
22 import org.springframework.beans.factory.annotation.Value; 22 import org.springframework.beans.factory.annotation.Value;
23 import org.springframework.stereotype.Service; 23 import org.springframework.stereotype.Service;
24 import org.springframework.web.client.RestTemplate; 24 import org.springframework.web.client.RestTemplate;
25 -import org.thingsboard.server.service.update.model.UpdateMessage; 25 +import org.thingsboard.server.common.data.UpdateMessage;
26 26
27 import javax.annotation.PostConstruct; 27 import javax.annotation.PostConstruct;
28 import javax.annotation.PreDestroy; 28 import javax.annotation.PreDestroy;
@@ -15,7 +15,7 @@ @@ -15,7 +15,7 @@
15 */ 15 */
16 package org.thingsboard.server.service.update; 16 package org.thingsboard.server.service.update;
17 17
18 -import org.thingsboard.server.service.update.model.UpdateMessage; 18 +import org.thingsboard.server.common.data.UpdateMessage;
19 19
20 public interface UpdateService { 20 public interface UpdateService {
21 21
common/data/src/main/java/org/thingsboard/server/common/data/ClaimRequest.java renamed from application/src/main/java/org/thingsboard/server/controller/claim/data/ClaimRequest.java
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.thingsboard.server.controller.claim.data; 16 +package org.thingsboard.server.common.data;
17 17
18 import lombok.Data; 18 import lombok.Data;
19 19
common/data/src/main/java/org/thingsboard/server/common/data/UpdateMessage.java renamed from application/src/main/java/org/thingsboard/server/service/update/model/UpdateMessage.java
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.thingsboard.server.service.update.model; 16 +package org.thingsboard.server.common.data;
17 17
18 import lombok.Data; 18 import lombok.Data;
19 19
common/data/src/main/java/org/thingsboard/server/common/data/security/model/SecuritySettings.java renamed from application/src/main/java/org/thingsboard/server/service/security/model/SecuritySettings.java
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.thingsboard.server.service.security.model; 16 +package org.thingsboard.server.common.data.security.model;
17 17
18 import lombok.Data; 18 import lombok.Data;
19 19
common/data/src/main/java/org/thingsboard/server/common/data/security/model/UserPasswordPolicy.java renamed from application/src/main/java/org/thingsboard/server/service/security/model/UserPasswordPolicy.java
@@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
13 * See the License for the specific language governing permissions and 13 * See the License for the specific language governing permissions and
14 * limitations under the License. 14 * limitations under the License.
15 */ 15 */
16 -package org.thingsboard.server.service.security.model; 16 +package org.thingsboard.server.common.data.security.model;
17 17
18 import lombok.Data; 18 import lombok.Data;
19 19
@@ -31,6 +31,7 @@ import org.springframework.web.client.HttpClientErrorException; @@ -31,6 +31,7 @@ import org.springframework.web.client.HttpClientErrorException;
31 import org.springframework.web.client.RestTemplate; 31 import org.springframework.web.client.RestTemplate;
32 import org.springframework.web.context.request.async.DeferredResult; 32 import org.springframework.web.context.request.async.DeferredResult;
33 import org.thingsboard.server.common.data.AdminSettings; 33 import org.thingsboard.server.common.data.AdminSettings;
  34 +import org.thingsboard.server.common.data.ClaimRequest;
34 import org.thingsboard.server.common.data.Customer; 35 import org.thingsboard.server.common.data.Customer;
35 import org.thingsboard.server.common.data.Dashboard; 36 import org.thingsboard.server.common.data.Dashboard;
36 import org.thingsboard.server.common.data.DashboardInfo; 37 import org.thingsboard.server.common.data.DashboardInfo;
@@ -39,6 +40,7 @@ import org.thingsboard.server.common.data.EntitySubtype; @@ -39,6 +40,7 @@ import org.thingsboard.server.common.data.EntitySubtype;
39 import org.thingsboard.server.common.data.EntityView; 40 import org.thingsboard.server.common.data.EntityView;
40 import org.thingsboard.server.common.data.Event; 41 import org.thingsboard.server.common.data.Event;
41 import org.thingsboard.server.common.data.Tenant; 42 import org.thingsboard.server.common.data.Tenant;
  43 +import org.thingsboard.server.common.data.UpdateMessage;
42 import org.thingsboard.server.common.data.User; 44 import org.thingsboard.server.common.data.User;
43 import org.thingsboard.server.common.data.alarm.Alarm; 45 import org.thingsboard.server.common.data.alarm.Alarm;
44 import org.thingsboard.server.common.data.alarm.AlarmInfo; 46 import org.thingsboard.server.common.data.alarm.AlarmInfo;
@@ -65,6 +67,8 @@ import org.thingsboard.server.common.data.rule.RuleChain; @@ -65,6 +67,8 @@ import org.thingsboard.server.common.data.rule.RuleChain;
65 import org.thingsboard.server.common.data.rule.RuleChainMetaData; 67 import org.thingsboard.server.common.data.rule.RuleChainMetaData;
66 import org.thingsboard.server.common.data.security.DeviceCredentials; 68 import org.thingsboard.server.common.data.security.DeviceCredentials;
67 import org.thingsboard.server.common.data.security.DeviceCredentialsType; 69 import org.thingsboard.server.common.data.security.DeviceCredentialsType;
  70 +import org.thingsboard.server.common.data.security.model.SecuritySettings;
  71 +import org.thingsboard.server.common.data.security.model.UserPasswordPolicy;
68 import org.thingsboard.server.common.data.widget.WidgetType; 72 import org.thingsboard.server.common.data.widget.WidgetType;
69 import org.thingsboard.server.common.data.widget.WidgetsBundle; 73 import org.thingsboard.server.common.data.widget.WidgetsBundle;
70 74
@@ -85,6 +89,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -85,6 +89,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
85 protected final RestTemplate restTemplate = new RestTemplate(); 89 protected final RestTemplate restTemplate = new RestTemplate();
86 protected final String baseURL; 90 protected final String baseURL;
87 private String token; 91 private String token;
  92 + private String refreshToken;
88 93
89 private final static String TIME_PAGE_LINK_URL_PARAMS = "limit={limit}&startTime={startTime}&endTime={endTime}&ascOrder={ascOrder}&offset={offset}"; 94 private final static String TIME_PAGE_LINK_URL_PARAMS = "limit={limit}&startTime={startTime}&endTime={endTime}&ascOrder={ascOrder}&offset={offset}";
90 private final static String TEXT_PAGE_LINK_URL_PARAMS = "limit={limit}&textSearch{textSearch}&idOffset={idOffset}&textOffset{textOffset}"; 95 private final static String TEXT_PAGE_LINK_URL_PARAMS = "limit={limit}&textSearch{textSearch}&idOffset={idOffset}&textOffset{textOffset}";
@@ -93,7 +98,23 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -93,7 +98,23 @@ public class RestClient implements ClientHttpRequestInterceptor {
93 public ClientHttpResponse intercept(HttpRequest request, byte[] bytes, ClientHttpRequestExecution execution) throws IOException { 98 public ClientHttpResponse intercept(HttpRequest request, byte[] bytes, ClientHttpRequestExecution execution) throws IOException {
94 HttpRequest wrapper = new HttpRequestWrapper(request); 99 HttpRequest wrapper = new HttpRequestWrapper(request);
95 wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token); 100 wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
96 - return execution.execute(wrapper, bytes); 101 + ClientHttpResponse response = execution.execute(wrapper, bytes);
  102 + if (response.getStatusCode() == HttpStatus.UNAUTHORIZED) {
  103 + synchronized (this) {
  104 + restTemplate.getInterceptors().remove(this);
  105 + refreshToken();
  106 + wrapper.getHeaders().set(JWT_TOKEN_HEADER_PARAM, "Bearer " + token);
  107 + return execution.execute(wrapper, bytes);
  108 + }
  109 + }
  110 + return response;
  111 + }
  112 +
  113 + public void refreshToken() {
  114 + Map<String, String> refreshTokenRequest = new HashMap<>();
  115 + refreshTokenRequest.put("refreshToken", refreshToken);
  116 + ResponseEntity<JsonNode> tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/token", refreshTokenRequest, JsonNode.class);
  117 + setTokenInfo(tokenInfo.getBody());
97 } 118 }
98 119
99 public void login(String username, String password) { 120 public void login(String username, String password) {
@@ -101,8 +122,13 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -101,8 +122,13 @@ public class RestClient implements ClientHttpRequestInterceptor {
101 loginRequest.put("username", username); 122 loginRequest.put("username", username);
102 loginRequest.put("password", password); 123 loginRequest.put("password", password);
103 ResponseEntity<JsonNode> tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class); 124 ResponseEntity<JsonNode> tokenInfo = restTemplate.postForEntity(baseURL + "/api/auth/login", loginRequest, JsonNode.class);
104 - this.token = tokenInfo.getBody().get("token").asText();  
105 - restTemplate.setInterceptors(Collections.singletonList(this)); 125 + setTokenInfo(tokenInfo.getBody());
  126 + }
  127 +
  128 + private void setTokenInfo(JsonNode tokenInfo) {
  129 + this.token = tokenInfo.get("token").asText();
  130 + this.refreshToken = tokenInfo.get("refreshToken").asText();
  131 + restTemplate.getInterceptors().add(this);
106 } 132 }
107 133
108 public Optional<Device> findDevice(String name) { 134 public Optional<Device> findDevice(String name) {
@@ -289,28 +315,42 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -289,28 +315,42 @@ public class RestClient implements ClientHttpRequestInterceptor {
289 } 315 }
290 316
291 public AdminSettings saveAdminSettings(AdminSettings adminSettings) { 317 public AdminSettings saveAdminSettings(AdminSettings adminSettings) {
292 - return restTemplate.postForEntity(baseURL + "/api/settings", adminSettings, AdminSettings.class).getBody(); 318 + return restTemplate.postForEntity(baseURL + "/api/admin/settings", adminSettings, AdminSettings.class).getBody();
293 } 319 }
294 320
295 public void sendTestMail(AdminSettings adminSettings) { 321 public void sendTestMail(AdminSettings adminSettings) {
296 - restTemplate.postForEntity(baseURL + "/api/settings/testMail", adminSettings, AdminSettings.class);  
297 - }  
298 -  
299 - //TODO:  
300 -// @RequestMapping(value = "/securitySettings", method = RequestMethod.GET)  
301 -// public SecuritySettings getSecuritySettings() {  
302 -//  
303 -// }  
304 - //TODO:  
305 -// @RequestMapping(value = "/securitySettings", method = RequestMethod.POST)  
306 -// public SecuritySettings saveSecuritySettings(SecuritySettings securitySettings) {  
307 -//  
308 -// }  
309 - //TODO:  
310 -// @RequestMapping(value = "/updates", method = RequestMethod.GET)  
311 -// public UpdateMessage checkUpdates() {  
312 -//  
313 -// } 322 + restTemplate.postForEntity(baseURL + "/api/admin/settings/testMail", adminSettings, AdminSettings.class);
  323 + }
  324 +
  325 + public Optional<SecuritySettings> getSecuritySettings() {
  326 + try {
  327 + ResponseEntity<SecuritySettings> securitySettings = restTemplate.getForEntity(baseURL + "/api/admin/securitySettings", SecuritySettings.class);
  328 + return Optional.ofNullable(securitySettings.getBody());
  329 + } catch (HttpClientErrorException exception) {
  330 + if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
  331 + return Optional.empty();
  332 + } else {
  333 + throw exception;
  334 + }
  335 + }
  336 + }
  337 +
  338 + public SecuritySettings saveSecuritySettings(SecuritySettings securitySettings) {
  339 + return restTemplate.postForEntity(baseURL + "/api/admin/securitySettings", securitySettings, SecuritySettings.class).getBody();
  340 + }
  341 +
  342 + public Optional<UpdateMessage> checkUpdates() {
  343 + try {
  344 + ResponseEntity<UpdateMessage> updateMsg = restTemplate.getForEntity(baseURL + "/api/admin/updates", UpdateMessage.class);
  345 + return Optional.ofNullable(updateMsg.getBody());
  346 + } catch (HttpClientErrorException exception) {
  347 + if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
  348 + return Optional.empty();
  349 + } else {
  350 + throw exception;
  351 + }
  352 + }
  353 + }
314 354
315 public Optional<Alarm> getAlarmById(String alarmId) { 355 public Optional<Alarm> getAlarmById(String alarmId) {
316 try { 356 try {
@@ -488,7 +528,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -488,7 +528,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
488 addPageLinkToParam(params, pageLink); 528 addPageLinkToParam(params, pageLink);
489 529
490 ResponseEntity<TextPageData<Asset>> assets = restTemplate.exchange( 530 ResponseEntity<TextPageData<Asset>> assets = restTemplate.exchange(
491 - baseURL + "/customer/{customerId}/assets?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS, 531 + baseURL + "/api/customer/{customerId}/assets?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS,
492 HttpMethod.GET, 532 HttpMethod.GET,
493 HttpEntity.EMPTY, 533 HttpEntity.EMPTY,
494 new ParameterizedTypeReference<TextPageData<Asset>>() { 534 new ParameterizedTypeReference<TextPageData<Asset>>() {
@@ -532,7 +572,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -532,7 +572,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
532 addPageLinkToParam(params, pageLink); 572 addPageLinkToParam(params, pageLink);
533 573
534 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange( 574 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange(
535 - baseURL + "/audit/logs/customer/{customerId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS, 575 + baseURL + "/api/audit/logs/customer/{customerId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS,
536 HttpMethod.GET, 576 HttpMethod.GET,
537 HttpEntity.EMPTY, 577 HttpEntity.EMPTY,
538 new ParameterizedTypeReference<TimePageData<AuditLog>>() { 578 new ParameterizedTypeReference<TimePageData<AuditLog>>() {
@@ -548,7 +588,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -548,7 +588,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
548 addPageLinkToParam(params, pageLink); 588 addPageLinkToParam(params, pageLink);
549 589
550 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange( 590 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange(
551 - baseURL + "/audit/logs/user/{userId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS, 591 + baseURL + "/api/audit/logs/user/{userId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS,
552 HttpMethod.GET, 592 HttpMethod.GET,
553 HttpEntity.EMPTY, 593 HttpEntity.EMPTY,
554 new ParameterizedTypeReference<TimePageData<AuditLog>>() { 594 new ParameterizedTypeReference<TimePageData<AuditLog>>() {
@@ -565,7 +605,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -565,7 +605,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
565 addPageLinkToParam(params, pageLink); 605 addPageLinkToParam(params, pageLink);
566 606
567 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange( 607 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange(
568 - baseURL + "/audit/logs/entity/{entityType}/{entityId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS, 608 + baseURL + "/api/audit/logs/entity/{entityType}/{entityId}?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS,
569 HttpMethod.GET, 609 HttpMethod.GET,
570 HttpEntity.EMPTY, 610 HttpEntity.EMPTY,
571 new ParameterizedTypeReference<TimePageData<AuditLog>>() { 611 new ParameterizedTypeReference<TimePageData<AuditLog>>() {
@@ -580,7 +620,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -580,7 +620,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
580 addPageLinkToParam(params, pageLink); 620 addPageLinkToParam(params, pageLink);
581 621
582 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange( 622 ResponseEntity<TimePageData<AuditLog>> auditLog = restTemplate.exchange(
583 - baseURL + "/audit/logs?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS, 623 + baseURL + "/api/audit/logs?actionTypes={actionTypes}&" + TIME_PAGE_LINK_URL_PARAMS,
584 HttpMethod.GET, 624 HttpMethod.GET,
585 HttpEntity.EMPTY, 625 HttpEntity.EMPTY,
586 new ParameterizedTypeReference<TimePageData<AuditLog>>() { 626 new ParameterizedTypeReference<TimePageData<AuditLog>>() {
@@ -590,40 +630,47 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -590,40 +630,47 @@ public class RestClient implements ClientHttpRequestInterceptor {
590 } 630 }
591 631
592 public Optional<User> getUser() { 632 public Optional<User> getUser() {
593 - ResponseEntity<User> user = restTemplate.getForEntity(baseURL + "/auth/user", User.class); 633 + ResponseEntity<User> user = restTemplate.getForEntity(baseURL + "/api/auth/user", User.class);
594 return Optional.ofNullable(user.getBody()); 634 return Optional.ofNullable(user.getBody());
595 } 635 }
596 636
597 public void logout() { 637 public void logout() {
598 - restTemplate.exchange(URI.create(baseURL + "/auth/logout"), HttpMethod.POST, HttpEntity.EMPTY, Object.class); 638 + restTemplate.exchange(URI.create(baseURL + "/api/auth/logout"), HttpMethod.POST, HttpEntity.EMPTY, Object.class);
599 } 639 }
600 640
601 public void changePassword(JsonNode changePasswordRequest) { 641 public void changePassword(JsonNode changePasswordRequest) {
602 - restTemplate.exchange(URI.create(baseURL + "/auth/changePassword"), HttpMethod.POST, new HttpEntity<>(changePasswordRequest), Object.class); 642 + restTemplate.exchange(URI.create(baseURL + "/api/auth/changePassword"), HttpMethod.POST, new HttpEntity<>(changePasswordRequest), Object.class);
603 } 643 }
604 644
605 - //TODO:  
606 -// @RequestMapping(value = "/noauth/userPasswordPolicy", method = RequestMethod.GET)  
607 -// public UserPasswordPolicy getUserPasswordPolicy() {  
608 -//  
609 -// } 645 + public Optional<UserPasswordPolicy> getUserPasswordPolicy() {
  646 + try {
  647 + ResponseEntity<UserPasswordPolicy> userPasswordPolicy = restTemplate.getForEntity(baseURL + "/api/noauth/userPasswordPolicy", UserPasswordPolicy.class);
  648 + return Optional.ofNullable(userPasswordPolicy.getBody());
  649 + } catch (HttpClientErrorException exception) {
  650 + if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
  651 + return Optional.empty();
  652 + } else {
  653 + throw exception;
  654 + }
  655 + }
  656 + }
610 657
611 658
612 public ResponseEntity<String> checkActivateToken(String activateToken) { 659 public ResponseEntity<String> checkActivateToken(String activateToken) {
613 - return restTemplate.getForEntity(baseURL + "/noauth/activate?activateToken={activateToken}", String.class, activateToken); 660 + return restTemplate.getForEntity(baseURL + "/api/noauth/activate?activateToken={activateToken}", String.class, activateToken);
614 } 661 }
615 662
616 public void requestResetPasswordByEmail(JsonNode resetPasswordByEmailRequest) { 663 public void requestResetPasswordByEmail(JsonNode resetPasswordByEmailRequest) {
617 - restTemplate.exchange(URI.create(baseURL + "/noauth/resetPasswordByEmail"), HttpMethod.POST, new HttpEntity<>(resetPasswordByEmailRequest), Object.class); 664 + restTemplate.exchange(URI.create(baseURL + "/api/noauth/resetPasswordByEmail"), HttpMethod.POST, new HttpEntity<>(resetPasswordByEmailRequest), Object.class);
618 } 665 }
619 666
620 public ResponseEntity<String> checkResetToken(String resetToken) { 667 public ResponseEntity<String> checkResetToken(String resetToken) {
621 - return restTemplate.getForEntity(baseURL + "noauth/resetPassword?resetToken={resetToken}", String.class, resetToken); 668 + return restTemplate.getForEntity(baseURL + "/api/noauth/resetPassword?resetToken={resetToken}", String.class, resetToken);
622 } 669 }
623 670
624 public Optional<JsonNode> activateUser(JsonNode activateRequest) { 671 public Optional<JsonNode> activateUser(JsonNode activateRequest) {
625 try { 672 try {
626 - ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/noauth/activate", activateRequest, JsonNode.class); 673 + ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/api/noauth/activate", activateRequest, JsonNode.class);
627 return Optional.ofNullable(jsonNode.getBody()); 674 return Optional.ofNullable(jsonNode.getBody());
628 } catch (HttpClientErrorException exception) { 675 } catch (HttpClientErrorException exception) {
629 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 676 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -636,7 +683,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -636,7 +683,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
636 683
637 public Optional<JsonNode> resetPassword(JsonNode resetPasswordRequest) { 684 public Optional<JsonNode> resetPassword(JsonNode resetPasswordRequest) {
638 try { 685 try {
639 - ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/noauth/resetPassword", resetPasswordRequest, JsonNode.class); 686 + ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/api/noauth/resetPassword", resetPasswordRequest, JsonNode.class);
640 return Optional.ofNullable(jsonNode.getBody()); 687 return Optional.ofNullable(jsonNode.getBody());
641 } catch (HttpClientErrorException exception) { 688 } catch (HttpClientErrorException exception) {
642 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 689 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -649,7 +696,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -649,7 +696,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
649 696
650 public Optional<ComponentDescriptor> getComponentDescriptorByClazz(String componentDescriptorClazz) { 697 public Optional<ComponentDescriptor> getComponentDescriptorByClazz(String componentDescriptorClazz) {
651 try { 698 try {
652 - ResponseEntity<ComponentDescriptor> componentDescriptor = restTemplate.getForEntity(baseURL + "/component/{componentDescriptorClazz}", ComponentDescriptor.class); 699 + ResponseEntity<ComponentDescriptor> componentDescriptor = restTemplate.getForEntity(baseURL + "/api/component/{componentDescriptorClazz}", ComponentDescriptor.class);
653 return Optional.ofNullable(componentDescriptor.getBody()); 700 return Optional.ofNullable(componentDescriptor.getBody());
654 } catch (HttpClientErrorException exception) { 701 } catch (HttpClientErrorException exception) {
655 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 702 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -662,7 +709,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -662,7 +709,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
662 709
663 public List<ComponentDescriptor> getComponentDescriptorsByType(String componentType) { 710 public List<ComponentDescriptor> getComponentDescriptorsByType(String componentType) {
664 return restTemplate.exchange( 711 return restTemplate.exchange(
665 - baseURL + "/components?componentType={componentType}", 712 + baseURL + "/api/components?componentType={componentType}",
666 HttpMethod.GET, HttpEntity.EMPTY, 713 HttpMethod.GET, HttpEntity.EMPTY,
667 new ParameterizedTypeReference<List<ComponentDescriptor>>() { 714 new ParameterizedTypeReference<List<ComponentDescriptor>>() {
668 }, 715 },
@@ -671,7 +718,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -671,7 +718,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
671 718
672 public List<ComponentDescriptor> getComponentDescriptorsByTypes(String[] componentTypes) { 719 public List<ComponentDescriptor> getComponentDescriptorsByTypes(String[] componentTypes) {
673 return restTemplate.exchange( 720 return restTemplate.exchange(
674 - baseURL + "/components?componentTypes={componentTypes}", 721 + baseURL + "/api/components?componentTypes={componentTypes}",
675 HttpMethod.GET, 722 HttpMethod.GET,
676 HttpEntity.EMPTY, 723 HttpEntity.EMPTY,
677 new ParameterizedTypeReference<List<ComponentDescriptor>>() { 724 new ParameterizedTypeReference<List<ComponentDescriptor>>() {
@@ -681,7 +728,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -681,7 +728,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
681 728
682 public Optional<Customer> getCustomerById(String customerId) { 729 public Optional<Customer> getCustomerById(String customerId) {
683 try { 730 try {
684 - ResponseEntity<Customer> customer = restTemplate.getForEntity(baseURL + "/customer/{customerId}", Customer.class, customerId); 731 + ResponseEntity<Customer> customer = restTemplate.getForEntity(baseURL + "/api/customer/{customerId}", Customer.class, customerId);
685 return Optional.ofNullable(customer.getBody()); 732 return Optional.ofNullable(customer.getBody());
686 } catch (HttpClientErrorException exception) { 733 } catch (HttpClientErrorException exception) {
687 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 734 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -694,7 +741,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -694,7 +741,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
694 741
695 public Optional<JsonNode> getShortCustomerInfoById(String customerId) { 742 public Optional<JsonNode> getShortCustomerInfoById(String customerId) {
696 try { 743 try {
697 - ResponseEntity<JsonNode> customerInfo = restTemplate.getForEntity(baseURL + "/customer/{customerId}/shortInfo", JsonNode.class, customerId); 744 + ResponseEntity<JsonNode> customerInfo = restTemplate.getForEntity(baseURL + "/api/customer/{customerId}/shortInfo", JsonNode.class, customerId);
698 return Optional.ofNullable(customerInfo.getBody()); 745 return Optional.ofNullable(customerInfo.getBody());
699 } catch (HttpClientErrorException exception) { 746 } catch (HttpClientErrorException exception) {
700 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 747 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -706,15 +753,15 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -706,15 +753,15 @@ public class RestClient implements ClientHttpRequestInterceptor {
706 } 753 }
707 754
708 public String getCustomerTitleById(String customerId) { 755 public String getCustomerTitleById(String customerId) {
709 - return restTemplate.getForObject(baseURL + "/customer/{customerId}/title", String.class, customerId); 756 + return restTemplate.getForObject(baseURL + "/api/customer/{customerId}/title", String.class, customerId);
710 } 757 }
711 758
712 public Customer saveCustomer(Customer customer) { 759 public Customer saveCustomer(Customer customer) {
713 - return restTemplate.postForEntity(baseURL + "/customer", customer, Customer.class).getBody(); 760 + return restTemplate.postForEntity(baseURL + "/api/customer", customer, Customer.class).getBody();
714 } 761 }
715 762
716 public void deleteCustomer(String customerId) { 763 public void deleteCustomer(String customerId) {
717 - restTemplate.delete(baseURL + "/customer/{customerId}", customerId); 764 + restTemplate.delete(baseURL + "/api/customer/{customerId}", customerId);
718 } 765 }
719 766
720 public TextPageData<Customer> getCustomers(TextPageLink pageLink) { 767 public TextPageData<Customer> getCustomers(TextPageLink pageLink) {
@@ -722,7 +769,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -722,7 +769,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
722 addPageLinkToParam(params, pageLink); 769 addPageLinkToParam(params, pageLink);
723 770
724 ResponseEntity<TextPageData<Customer>> customer = restTemplate.exchange( 771 ResponseEntity<TextPageData<Customer>> customer = restTemplate.exchange(
725 - baseURL + "/customers?" + TEXT_PAGE_LINK_URL_PARAMS, 772 + baseURL + "/api/customers?" + TEXT_PAGE_LINK_URL_PARAMS,
726 HttpMethod.GET, 773 HttpMethod.GET,
727 HttpEntity.EMPTY, 774 HttpEntity.EMPTY,
728 new ParameterizedTypeReference<TextPageData<Customer>>() { 775 new ParameterizedTypeReference<TextPageData<Customer>>() {
@@ -733,7 +780,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -733,7 +780,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
733 780
734 public Optional<Customer> getTenantCustomer(String customerTitle) { 781 public Optional<Customer> getTenantCustomer(String customerTitle) {
735 try { 782 try {
736 - ResponseEntity<Customer> customer = restTemplate.getForEntity(baseURL + "/tenant/customers?customerTitle={customerTitle}", Customer.class, customerTitle); 783 + ResponseEntity<Customer> customer = restTemplate.getForEntity(baseURL + "/api/tenant/customers?customerTitle={customerTitle}", Customer.class, customerTitle);
737 return Optional.ofNullable(customer.getBody()); 784 return Optional.ofNullable(customer.getBody());
738 } catch (HttpClientErrorException exception) { 785 } catch (HttpClientErrorException exception) {
739 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 786 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -745,16 +792,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -745,16 +792,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
745 } 792 }
746 793
747 public Long getServerTime() { 794 public Long getServerTime() {
748 - return restTemplate.getForObject(baseURL + "/dashboard/serverTime", Long.class); 795 + return restTemplate.getForObject(baseURL + "/api/dashboard/serverTime", Long.class);
749 } 796 }
750 797
751 public Long getMaxDatapointsLimit() { 798 public Long getMaxDatapointsLimit() {
752 - return restTemplate.getForObject(baseURL + "/dashboard/maxDatapointsLimit", Long.class); 799 + return restTemplate.getForObject(baseURL + "/api/dashboard/maxDatapointsLimit", Long.class);
753 } 800 }
754 801
755 public Optional<DashboardInfo> getDashboardInfoById(String dashboardId) { 802 public Optional<DashboardInfo> getDashboardInfoById(String dashboardId) {
756 try { 803 try {
757 - ResponseEntity<DashboardInfo> dashboardInfo = restTemplate.getForEntity(baseURL + "/dashboard/info/{dashboardId}", DashboardInfo.class, dashboardId); 804 + ResponseEntity<DashboardInfo> dashboardInfo = restTemplate.getForEntity(baseURL + "/api/dashboard/info/{dashboardId}", DashboardInfo.class, dashboardId);
758 return Optional.ofNullable(dashboardInfo.getBody()); 805 return Optional.ofNullable(dashboardInfo.getBody());
759 } catch (HttpClientErrorException exception) { 806 } catch (HttpClientErrorException exception) {
760 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 807 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -767,7 +814,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -767,7 +814,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
767 814
768 public Optional<Dashboard> getDashboardById(String dashboardId) { 815 public Optional<Dashboard> getDashboardById(String dashboardId) {
769 try { 816 try {
770 - ResponseEntity<Dashboard> dashboard = restTemplate.getForEntity(baseURL + "/dashboard/{dashboardId}", Dashboard.class, dashboardId); 817 + ResponseEntity<Dashboard> dashboard = restTemplate.getForEntity(baseURL + "/api/dashboard/{dashboardId}", Dashboard.class, dashboardId);
771 return Optional.ofNullable(dashboard.getBody()); 818 return Optional.ofNullable(dashboard.getBody());
772 } catch (HttpClientErrorException exception) { 819 } catch (HttpClientErrorException exception) {
773 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 820 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -779,16 +826,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -779,16 +826,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
779 } 826 }
780 827
781 public Dashboard saveDashboard(Dashboard dashboard) { 828 public Dashboard saveDashboard(Dashboard dashboard) {
782 - return restTemplate.postForEntity(baseURL + "/dashboard", dashboard, Dashboard.class).getBody(); 829 + return restTemplate.postForEntity(baseURL + "/api/dashboard", dashboard, Dashboard.class).getBody();
783 } 830 }
784 831
785 public void deleteDashboard(String dashboardId) { 832 public void deleteDashboard(String dashboardId) {
786 - restTemplate.delete(baseURL + "/dashboard/{dashboardId}", dashboardId); 833 + restTemplate.delete(baseURL + "/api/dashboard/{dashboardId}", dashboardId);
787 } 834 }
788 835
789 public Optional<Dashboard> assignDashboardToCustomer(String customerId, String dashboardId) { 836 public Optional<Dashboard> assignDashboardToCustomer(String customerId, String dashboardId) {
790 try { 837 try {
791 - ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/customer/{customerId}/dashboard/{dashboardId}", null, Dashboard.class, customerId, dashboardId); 838 + ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/api/customer/{customerId}/dashboard/{dashboardId}", null, Dashboard.class, customerId, dashboardId);
792 return Optional.ofNullable(dashboard.getBody()); 839 return Optional.ofNullable(dashboard.getBody());
793 } catch (HttpClientErrorException exception) { 840 } catch (HttpClientErrorException exception) {
794 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 841 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -801,7 +848,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -801,7 +848,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
801 848
802 public Optional<Dashboard> unassignDashboardFromCustomer(String customerId, String dashboardId) { 849 public Optional<Dashboard> unassignDashboardFromCustomer(String customerId, String dashboardId) {
803 try { 850 try {
804 - ResponseEntity<Dashboard> dashboard = restTemplate.exchange(baseURL + "/customer/{customerId}/dashboard/{dashboardId}", HttpMethod.DELETE, HttpEntity.EMPTY, Dashboard.class, customerId, dashboardId); 851 + ResponseEntity<Dashboard> dashboard = restTemplate.exchange(baseURL + "/api/customer/{customerId}/dashboard/{dashboardId}", HttpMethod.DELETE, HttpEntity.EMPTY, Dashboard.class, customerId, dashboardId);
805 return Optional.ofNullable(dashboard.getBody()); 852 return Optional.ofNullable(dashboard.getBody());
806 } catch (HttpClientErrorException exception) { 853 } catch (HttpClientErrorException exception) {
807 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 854 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -814,7 +861,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -814,7 +861,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
814 861
815 public Optional<Dashboard> updateDashboardCustomers(String dashboardId, String[] customerIds) { 862 public Optional<Dashboard> updateDashboardCustomers(String dashboardId, String[] customerIds) {
816 try { 863 try {
817 - ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/dashboard/{dashboardId}/customers", customerIds, Dashboard.class, dashboardId); 864 + ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/api/dashboard/{dashboardId}/customers", customerIds, Dashboard.class, dashboardId);
818 return Optional.ofNullable(dashboard.getBody()); 865 return Optional.ofNullable(dashboard.getBody());
819 } catch (HttpClientErrorException exception) { 866 } catch (HttpClientErrorException exception) {
820 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 867 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -827,7 +874,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -827,7 +874,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
827 874
828 public Optional<Dashboard> addDashboardCustomers(String dashboardId, String[] customerIds) { 875 public Optional<Dashboard> addDashboardCustomers(String dashboardId, String[] customerIds) {
829 try { 876 try {
830 - ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/dashboard/{dashboardId}/customers/add", customerIds, Dashboard.class, dashboardId); 877 + ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/api/dashboard/{dashboardId}/customers/add", customerIds, Dashboard.class, dashboardId);
831 return Optional.ofNullable(dashboard.getBody()); 878 return Optional.ofNullable(dashboard.getBody());
832 } catch (HttpClientErrorException exception) { 879 } catch (HttpClientErrorException exception) {
833 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 880 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -840,7 +887,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -840,7 +887,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
840 887
841 public Optional<Dashboard> removeDashboardCustomers(String dashboardId, String[] customerIds) { 888 public Optional<Dashboard> removeDashboardCustomers(String dashboardId, String[] customerIds) {
842 try { 889 try {
843 - ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/dashboard/{dashboardId}/customers/remove", customerIds, Dashboard.class, dashboardId); 890 + ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/api/dashboard/{dashboardId}/customers/remove", customerIds, Dashboard.class, dashboardId);
844 return Optional.ofNullable(dashboard.getBody()); 891 return Optional.ofNullable(dashboard.getBody());
845 } catch (HttpClientErrorException exception) { 892 } catch (HttpClientErrorException exception) {
846 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 893 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -853,7 +900,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -853,7 +900,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
853 900
854 public Optional<Dashboard> assignDashboardToPublicCustomer(String dashboardId) { 901 public Optional<Dashboard> assignDashboardToPublicCustomer(String dashboardId) {
855 try { 902 try {
856 - ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/customer/public/dashboard/{dashboardId}", null, Dashboard.class, dashboardId); 903 + ResponseEntity<Dashboard> dashboard = restTemplate.postForEntity(baseURL + "/api/customer/public/dashboard/{dashboardId}", null, Dashboard.class, dashboardId);
857 return Optional.ofNullable(dashboard.getBody()); 904 return Optional.ofNullable(dashboard.getBody());
858 } catch (HttpClientErrorException exception) { 905 } catch (HttpClientErrorException exception) {
859 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 906 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -866,7 +913,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -866,7 +913,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
866 913
867 public Optional<Dashboard> unassignDashboardFromPublicCustomer(String dashboardId) { 914 public Optional<Dashboard> unassignDashboardFromPublicCustomer(String dashboardId) {
868 try { 915 try {
869 - ResponseEntity<Dashboard> dashboard = restTemplate.exchange(baseURL + "/customer/public/dashboard/{dashboardId}", HttpMethod.DELETE, HttpEntity.EMPTY, Dashboard.class, dashboardId); 916 + ResponseEntity<Dashboard> dashboard = restTemplate.exchange(baseURL + "/api/customer/public/dashboard/{dashboardId}", HttpMethod.DELETE, HttpEntity.EMPTY, Dashboard.class, dashboardId);
870 return Optional.ofNullable(dashboard.getBody()); 917 return Optional.ofNullable(dashboard.getBody());
871 } catch (HttpClientErrorException exception) { 918 } catch (HttpClientErrorException exception) {
872 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 919 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -882,7 +929,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -882,7 +929,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
882 params.put("tenantId", tenantId); 929 params.put("tenantId", tenantId);
883 addPageLinkToParam(params, pageLink); 930 addPageLinkToParam(params, pageLink);
884 return restTemplate.exchange( 931 return restTemplate.exchange(
885 - baseURL + "/tenant/{tenantId}/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS, 932 + baseURL + "/api/tenant/{tenantId}/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS,
886 HttpMethod.GET, HttpEntity.EMPTY, 933 HttpMethod.GET, HttpEntity.EMPTY,
887 new ParameterizedTypeReference<TextPageData<DashboardInfo>>() { 934 new ParameterizedTypeReference<TextPageData<DashboardInfo>>() {
888 }, 935 },
@@ -894,7 +941,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -894,7 +941,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
894 Map<String, String> params = new HashMap<>(); 941 Map<String, String> params = new HashMap<>();
895 addPageLinkToParam(params, pageLink); 942 addPageLinkToParam(params, pageLink);
896 return restTemplate.exchange( 943 return restTemplate.exchange(
897 - baseURL + "/tenant/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS, 944 + baseURL + "/api/tenant/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS,
898 HttpMethod.GET, HttpEntity.EMPTY, 945 HttpMethod.GET, HttpEntity.EMPTY,
899 new ParameterizedTypeReference<TextPageData<DashboardInfo>>() { 946 new ParameterizedTypeReference<TextPageData<DashboardInfo>>() {
900 }, 947 },
@@ -907,7 +954,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -907,7 +954,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
907 params.put("customerId", customerId); 954 params.put("customerId", customerId);
908 addPageLinkToParam(params, pageLink); 955 addPageLinkToParam(params, pageLink);
909 return restTemplate.exchange( 956 return restTemplate.exchange(
910 - baseURL + "/customer/{customerId}/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS, 957 + baseURL + "/api/customer/{customerId}/dashboards?" + TEXT_PAGE_LINK_URL_PARAMS,
911 HttpMethod.GET, HttpEntity.EMPTY, 958 HttpMethod.GET, HttpEntity.EMPTY,
912 new ParameterizedTypeReference<TimePageData<DashboardInfo>>() { 959 new ParameterizedTypeReference<TimePageData<DashboardInfo>>() {
913 }, 960 },
@@ -917,7 +964,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -917,7 +964,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
917 964
918 public Optional<Device> getDeviceById(String deviceId) { 965 public Optional<Device> getDeviceById(String deviceId) {
919 try { 966 try {
920 - ResponseEntity<Device> device = restTemplate.getForEntity(baseURL + "/device/{deviceId}", Device.class, deviceId); 967 + ResponseEntity<Device> device = restTemplate.getForEntity(baseURL + "/api/device/{deviceId}", Device.class, deviceId);
921 return Optional.ofNullable(device.getBody()); 968 return Optional.ofNullable(device.getBody());
922 } catch (HttpClientErrorException exception) { 969 } catch (HttpClientErrorException exception) {
923 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 970 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -929,16 +976,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -929,16 +976,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
929 } 976 }
930 977
931 public Device saveDevice(Device device) { 978 public Device saveDevice(Device device) {
932 - return restTemplate.postForEntity(baseURL + "/device", device, Device.class).getBody(); 979 + return restTemplate.postForEntity(baseURL + "/api/device", device, Device.class).getBody();
933 } 980 }
934 981
935 public void deleteDevice(String deviceId) { 982 public void deleteDevice(String deviceId) {
936 - restTemplate.delete(baseURL + "/device/{deviceId}", deviceId); 983 + restTemplate.delete(baseURL + "/api/device/{deviceId}", deviceId);
937 } 984 }
938 985
939 public Optional<Device> assignDeviceToCustomer(String customerId, String deviceId) { 986 public Optional<Device> assignDeviceToCustomer(String customerId, String deviceId) {
940 try { 987 try {
941 - ResponseEntity<Device> device = restTemplate.postForEntity(baseURL + "/customer/{customerId}/device/{deviceId}", null, Device.class, customerId, deviceId); 988 + ResponseEntity<Device> device = restTemplate.postForEntity(baseURL + "/api/customer/{customerId}/device/{deviceId}", null, Device.class, customerId, deviceId);
942 return Optional.ofNullable(device.getBody()); 989 return Optional.ofNullable(device.getBody());
943 } catch (HttpClientErrorException exception) { 990 } catch (HttpClientErrorException exception) {
944 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 991 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -951,7 +998,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -951,7 +998,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
951 998
952 public Optional<Device> unassignDeviceFromCustomer(String deviceId) { 999 public Optional<Device> unassignDeviceFromCustomer(String deviceId) {
953 try { 1000 try {
954 - ResponseEntity<Device> device = restTemplate.exchange(baseURL + "/customer/device/{deviceId}", HttpMethod.DELETE, HttpEntity.EMPTY, Device.class, deviceId); 1001 + ResponseEntity<Device> device = restTemplate.exchange(baseURL + "/api/customer/device/{deviceId}", HttpMethod.DELETE, HttpEntity.EMPTY, Device.class, deviceId);
955 return Optional.ofNullable(device.getBody()); 1002 return Optional.ofNullable(device.getBody());
956 } catch (HttpClientErrorException exception) { 1003 } catch (HttpClientErrorException exception) {
957 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1004 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -964,7 +1011,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -964,7 +1011,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
964 1011
965 public Optional<Device> assignDeviceToPublicCustomer(String deviceId) { 1012 public Optional<Device> assignDeviceToPublicCustomer(String deviceId) {
966 try { 1013 try {
967 - ResponseEntity<Device> device = restTemplate.postForEntity(baseURL + "/customer/public/device/{deviceId}", null, Device.class, deviceId); 1014 + ResponseEntity<Device> device = restTemplate.postForEntity(baseURL + "/api/customer/public/device/{deviceId}", null, Device.class, deviceId);
968 return Optional.ofNullable(device.getBody()); 1015 return Optional.ofNullable(device.getBody());
969 } catch (HttpClientErrorException exception) { 1016 } catch (HttpClientErrorException exception) {
970 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1017 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -977,7 +1024,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -977,7 +1024,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
977 1024
978 public Optional<DeviceCredentials> getDeviceCredentialsByDeviceId(String deviceId) { 1025 public Optional<DeviceCredentials> getDeviceCredentialsByDeviceId(String deviceId) {
979 try { 1026 try {
980 - ResponseEntity<DeviceCredentials> deviceCredentials = restTemplate.getForEntity(baseURL + "/device/{deviceId}/credentials", DeviceCredentials.class, deviceId); 1027 + ResponseEntity<DeviceCredentials> deviceCredentials = restTemplate.getForEntity(baseURL + "/api/device/{deviceId}/credentials", DeviceCredentials.class, deviceId);
981 return Optional.ofNullable(deviceCredentials.getBody()); 1028 return Optional.ofNullable(deviceCredentials.getBody());
982 } catch (HttpClientErrorException exception) { 1029 } catch (HttpClientErrorException exception) {
983 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1030 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -997,7 +1044,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -997,7 +1044,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
997 params.put("type", type); 1044 params.put("type", type);
998 addPageLinkToParam(params, pageLink); 1045 addPageLinkToParam(params, pageLink);
999 return restTemplate.exchange( 1046 return restTemplate.exchange(
1000 - baseURL + "/tenant/devices?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS, 1047 + baseURL + "/api/tenant/devices?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS,
1001 HttpMethod.GET, HttpEntity.EMPTY, 1048 HttpMethod.GET, HttpEntity.EMPTY,
1002 new ParameterizedTypeReference<TextPageData<Device>>() { 1049 new ParameterizedTypeReference<TextPageData<Device>>() {
1003 }, 1050 },
@@ -1007,7 +1054,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1007,7 +1054,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1007 1054
1008 public Optional<Device> getTenantDevice(String deviceName) { 1055 public Optional<Device> getTenantDevice(String deviceName) {
1009 try { 1056 try {
1010 - ResponseEntity<Device> device = restTemplate.getForEntity(baseURL + "/tenant/devices?deviceName={deviceName}", Device.class, deviceName); 1057 + ResponseEntity<Device> device = restTemplate.getForEntity(baseURL + "/api/tenant/devices?deviceName={deviceName}", Device.class, deviceName);
1011 return Optional.ofNullable(device.getBody()); 1058 return Optional.ofNullable(device.getBody());
1012 } catch (HttpClientErrorException exception) { 1059 } catch (HttpClientErrorException exception) {
1013 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1060 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1024,7 +1071,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1024,7 +1071,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1024 params.put("type", type); 1071 params.put("type", type);
1025 addPageLinkToParam(params, pageLink); 1072 addPageLinkToParam(params, pageLink);
1026 return restTemplate.exchange( 1073 return restTemplate.exchange(
1027 - baseURL + "/customer/{customerId}/devices?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS, 1074 + baseURL + "/api/customer/{customerId}/devices?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS,
1028 HttpMethod.GET, HttpEntity.EMPTY, 1075 HttpMethod.GET, HttpEntity.EMPTY,
1029 new ParameterizedTypeReference<TextPageData<Device>>() { 1076 new ParameterizedTypeReference<TextPageData<Device>>() {
1030 }, 1077 },
@@ -1033,7 +1080,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1033,7 +1080,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1033 } 1080 }
1034 1081
1035 public List<Device> getDevicesByIds(String[] deviceIds) { 1082 public List<Device> getDevicesByIds(String[] deviceIds) {
1036 - return restTemplate.exchange(baseURL + "/devices?deviceIds={deviceIds}", 1083 + return restTemplate.exchange(baseURL + "/api/devices?deviceIds={deviceIds}",
1037 HttpMethod.GET, 1084 HttpMethod.GET,
1038 HttpEntity.EMPTY, new ParameterizedTypeReference<List<Device>>() { 1085 HttpEntity.EMPTY, new ParameterizedTypeReference<List<Device>>() {
1039 }, 1086 },
@@ -1042,7 +1089,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1042,7 +1089,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1042 1089
1043 public List<Device> findByQuery(DeviceSearchQuery query) { 1090 public List<Device> findByQuery(DeviceSearchQuery query) {
1044 return restTemplate.exchange( 1091 return restTemplate.exchange(
1045 - baseURL + "/devices", 1092 + baseURL + "/api/devices",
1046 HttpMethod.POST, 1093 HttpMethod.POST,
1047 new HttpEntity<>(query), 1094 new HttpEntity<>(query),
1048 new ParameterizedTypeReference<List<Device>>() { 1095 new ParameterizedTypeReference<List<Device>>() {
@@ -1051,23 +1098,26 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1051,23 +1098,26 @@ public class RestClient implements ClientHttpRequestInterceptor {
1051 1098
1052 public List<EntitySubtype> getDeviceTypes() { 1099 public List<EntitySubtype> getDeviceTypes() {
1053 return restTemplate.exchange( 1100 return restTemplate.exchange(
1054 - baseURL + "/devices", 1101 + baseURL + "/api/devices",
1055 HttpMethod.GET, 1102 HttpMethod.GET,
1056 HttpEntity.EMPTY, 1103 HttpEntity.EMPTY,
1057 new ParameterizedTypeReference<List<EntitySubtype>>() { 1104 new ParameterizedTypeReference<List<EntitySubtype>>() {
1058 }).getBody(); 1105 }).getBody();
1059 } 1106 }
1060 1107
1061 - //TODO: ClaimRequest class  
1062 -// @RequestMapping(value = "/customer/device/{deviceName}/claim", method = RequestMethod.POST)  
1063 -// public DeferredResult<ResponseEntity> claimDevice(String deviceName, ClaimRequest claimRequest) {  
1064 -// return restTemplate.exchange(baseURL + "/customer/device/{deviceName}/claim", HttpMethod.POST, new HttpEntity<>(claimRequest), new ParameterizedTypeReference<DeferredResult<ResponseEntity>>() {  
1065 -// }, deviceName).getBody();  
1066 -// } 1108 + public DeferredResult<ResponseEntity> claimDevice(String deviceName, ClaimRequest claimRequest) {
  1109 + return restTemplate.exchange(
  1110 + baseURL + "/api/customer/device/{deviceName}/claim",
  1111 + HttpMethod.POST,
  1112 + new HttpEntity<>(claimRequest),
  1113 + new ParameterizedTypeReference<DeferredResult<ResponseEntity>>() {
  1114 + },
  1115 + deviceName).getBody();
  1116 + }
1067 1117
1068 public DeferredResult<ResponseEntity> reClaimDevice(String deviceName) { 1118 public DeferredResult<ResponseEntity> reClaimDevice(String deviceName) {
1069 return restTemplate.exchange( 1119 return restTemplate.exchange(
1070 - baseURL + "/customer/device/{deviceName}/claim", 1120 + baseURL + "/api/customer/device/{deviceName}/claim",
1071 HttpMethod.DELETE, 1121 HttpMethod.DELETE,
1072 HttpEntity.EMPTY, 1122 HttpEntity.EMPTY,
1073 new ParameterizedTypeReference<DeferredResult<ResponseEntity>>() { 1123 new ParameterizedTypeReference<DeferredResult<ResponseEntity>>() {
@@ -1076,7 +1126,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1076,7 +1126,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1076 } 1126 }
1077 1127
1078 public void saveRelation(EntityRelation relation) { 1128 public void saveRelation(EntityRelation relation) {
1079 - restTemplate.postForEntity(baseURL + "/relation", relation, Object.class); 1129 + restTemplate.postForEntity(baseURL + "/api/relation", relation, Object.class);
1080 } 1130 }
1081 1131
1082 public void deleteRelation(String fromId, String fromType, String relationType, String relationTypeGroup, String toId, String toType) { 1132 public void deleteRelation(String fromId, String fromType, String relationType, String relationTypeGroup, String toId, String toType) {
@@ -1087,11 +1137,11 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1087,11 +1137,11 @@ public class RestClient implements ClientHttpRequestInterceptor {
1087 params.put("relationTypeGroup", relationTypeGroup); 1137 params.put("relationTypeGroup", relationTypeGroup);
1088 params.put("toId", toId); 1138 params.put("toId", toId);
1089 params.put("toType", toType); 1139 params.put("toType", toType);
1090 - restTemplate.delete(baseURL + "/relation?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}&toId={toId}&toType={toType}", params); 1140 + restTemplate.delete(baseURL + "/api/relation?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}&toId={toId}&toType={toType}", params);
1091 } 1141 }
1092 1142
1093 public void deleteRelations(String entityId, String entityType) { 1143 public void deleteRelations(String entityId, String entityType) {
1094 - restTemplate.delete(baseURL + "/relations?entityId={entityId}&entityType={entityType}", entityId, entityType); 1144 + restTemplate.delete(baseURL + "/api/relations?entityId={entityId}&entityType={entityType}", entityId, entityType);
1095 } 1145 }
1096 1146
1097 public Optional<EntityRelation> getRelation(String fromId, String fromType, String relationType, String relationTypeGroup, String toId, String toType) { 1147 public Optional<EntityRelation> getRelation(String fromId, String fromType, String relationType, String relationTypeGroup, String toId, String toType) {
@@ -1105,7 +1155,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1105,7 +1155,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1105 1155
1106 try { 1156 try {
1107 ResponseEntity<EntityRelation> entityRelation = restTemplate.getForEntity( 1157 ResponseEntity<EntityRelation> entityRelation = restTemplate.getForEntity(
1108 - baseURL + "/relation?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}&toId={toId}&toType={toType}", 1158 + baseURL + "/api/relation?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}&toId={toId}&toType={toType}",
1109 EntityRelation.class, 1159 EntityRelation.class,
1110 params); 1160 params);
1111 return Optional.ofNullable(entityRelation.getBody()); 1161 return Optional.ofNullable(entityRelation.getBody());
@@ -1125,7 +1175,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1125,7 +1175,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1125 params.put("relationTypeGroup", relationTypeGroup); 1175 params.put("relationTypeGroup", relationTypeGroup);
1126 1176
1127 return restTemplate.exchange( 1177 return restTemplate.exchange(
1128 - baseURL + "/relations?fromId={fromId}&fromType={fromType}&relationTypeGroup={relationTypeGroup}", 1178 + baseURL + "/api/relations?fromId={fromId}&fromType={fromType}&relationTypeGroup={relationTypeGroup}",
1129 HttpMethod.GET, 1179 HttpMethod.GET,
1130 HttpEntity.EMPTY, 1180 HttpEntity.EMPTY,
1131 new ParameterizedTypeReference<List<EntityRelation>>() { 1181 new ParameterizedTypeReference<List<EntityRelation>>() {
@@ -1134,14 +1184,13 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1134,14 +1184,13 @@ public class RestClient implements ClientHttpRequestInterceptor {
1134 } 1184 }
1135 1185
1136 public List<EntityRelationInfo> findInfoByFrom(String fromId, String fromType, String relationTypeGroup) { 1186 public List<EntityRelationInfo> findInfoByFrom(String fromId, String fromType, String relationTypeGroup) {
1137 -  
1138 Map<String, String> params = new HashMap<>(); 1187 Map<String, String> params = new HashMap<>();
1139 params.put("fromId", fromId); 1188 params.put("fromId", fromId);
1140 params.put("fromType", fromType); 1189 params.put("fromType", fromType);
1141 params.put("relationTypeGroup", relationTypeGroup); 1190 params.put("relationTypeGroup", relationTypeGroup);
1142 1191
1143 return restTemplate.exchange( 1192 return restTemplate.exchange(
1144 - baseURL + "/relations/info?fromId={fromId}&fromType={fromType}&relationTypeGroup={relationTypeGroup}", 1193 + baseURL + "/api/relations/info?fromId={fromId}&fromType={fromType}&relationTypeGroup={relationTypeGroup}",
1145 HttpMethod.GET, 1194 HttpMethod.GET,
1146 HttpEntity.EMPTY, 1195 HttpEntity.EMPTY,
1147 new ParameterizedTypeReference<List<EntityRelationInfo>>() { 1196 new ParameterizedTypeReference<List<EntityRelationInfo>>() {
@@ -1157,7 +1206,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1157,7 +1206,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1157 params.put("relationTypeGroup", relationTypeGroup); 1206 params.put("relationTypeGroup", relationTypeGroup);
1158 1207
1159 return restTemplate.exchange( 1208 return restTemplate.exchange(
1160 - baseURL + "/relations?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}", 1209 + baseURL + "/api/relations?fromId={fromId}&fromType={fromType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}",
1161 HttpMethod.GET, 1210 HttpMethod.GET,
1162 HttpEntity.EMPTY, 1211 HttpEntity.EMPTY,
1163 new ParameterizedTypeReference<List<EntityRelation>>() { 1212 new ParameterizedTypeReference<List<EntityRelation>>() {
@@ -1172,7 +1221,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1172,7 +1221,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1172 params.put("relationTypeGroup", relationTypeGroup); 1221 params.put("relationTypeGroup", relationTypeGroup);
1173 1222
1174 return restTemplate.exchange( 1223 return restTemplate.exchange(
1175 - baseURL + "/relations?toId={toId}&toType={toType}&relationTypeGroup={relationTypeGroup}", 1224 + baseURL + "/api/relations?toId={toId}&toType={toType}&relationTypeGroup={relationTypeGroup}",
1176 HttpMethod.GET, 1225 HttpMethod.GET,
1177 HttpEntity.EMPTY, 1226 HttpEntity.EMPTY,
1178 new ParameterizedTypeReference<List<EntityRelation>>() { 1227 new ParameterizedTypeReference<List<EntityRelation>>() {
@@ -1187,7 +1236,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1187,7 +1236,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1187 params.put("relationTypeGroup", relationTypeGroup); 1236 params.put("relationTypeGroup", relationTypeGroup);
1188 1237
1189 return restTemplate.exchange( 1238 return restTemplate.exchange(
1190 - baseURL + "/relations?toId={toId}&toType={toType}&relationTypeGroup={relationTypeGroup}", 1239 + baseURL + "/api/relations?toId={toId}&toType={toType}&relationTypeGroup={relationTypeGroup}",
1191 HttpMethod.GET, 1240 HttpMethod.GET,
1192 HttpEntity.EMPTY, 1241 HttpEntity.EMPTY,
1193 new ParameterizedTypeReference<List<EntityRelationInfo>>() { 1242 new ParameterizedTypeReference<List<EntityRelationInfo>>() {
@@ -1203,7 +1252,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1203,7 +1252,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1203 params.put("relationTypeGroup", relationTypeGroup); 1252 params.put("relationTypeGroup", relationTypeGroup);
1204 1253
1205 return restTemplate.exchange( 1254 return restTemplate.exchange(
1206 - baseURL + "/relations?toId={toId}&toType={toType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}", 1255 + baseURL + "/api/relations?toId={toId}&toType={toType}&relationType={relationType}&relationTypeGroup={relationTypeGroup}",
1207 HttpMethod.GET, 1256 HttpMethod.GET,
1208 HttpEntity.EMPTY, 1257 HttpEntity.EMPTY,
1209 new ParameterizedTypeReference<List<EntityRelation>>() { 1258 new ParameterizedTypeReference<List<EntityRelation>>() {
@@ -1213,7 +1262,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1213,7 +1262,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1213 1262
1214 public List<EntityRelation> findByQuery(EntityRelationsQuery query) { 1263 public List<EntityRelation> findByQuery(EntityRelationsQuery query) {
1215 return restTemplate.exchange( 1264 return restTemplate.exchange(
1216 - baseURL + "/relations", 1265 + baseURL + "/api/relations",
1217 HttpMethod.POST, 1266 HttpMethod.POST,
1218 new HttpEntity<>(query), 1267 new HttpEntity<>(query),
1219 new ParameterizedTypeReference<List<EntityRelation>>() { 1268 new ParameterizedTypeReference<List<EntityRelation>>() {
@@ -1222,7 +1271,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1222,7 +1271,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1222 1271
1223 public List<EntityRelationInfo> findInfoByQuery(EntityRelationsQuery query) { 1272 public List<EntityRelationInfo> findInfoByQuery(EntityRelationsQuery query) {
1224 return restTemplate.exchange( 1273 return restTemplate.exchange(
1225 - baseURL + "/relations", 1274 + baseURL + "/api/relations",
1226 HttpMethod.POST, 1275 HttpMethod.POST,
1227 new HttpEntity<>(query), 1276 new HttpEntity<>(query),
1228 new ParameterizedTypeReference<List<EntityRelationInfo>>() { 1277 new ParameterizedTypeReference<List<EntityRelationInfo>>() {
@@ -1231,7 +1280,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1231,7 +1280,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1231 1280
1232 public Optional<EntityView> getEntityViewById(String entityViewId) { 1281 public Optional<EntityView> getEntityViewById(String entityViewId) {
1233 try { 1282 try {
1234 - ResponseEntity<EntityView> entityView = restTemplate.getForEntity(baseURL + "/entityView/{entityViewId}", EntityView.class, entityViewId); 1283 + ResponseEntity<EntityView> entityView = restTemplate.getForEntity(baseURL + "/api/entityView/{entityViewId}", EntityView.class, entityViewId);
1235 return Optional.ofNullable(entityView.getBody()); 1284 return Optional.ofNullable(entityView.getBody());
1236 } catch (HttpClientErrorException exception) { 1285 } catch (HttpClientErrorException exception) {
1237 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1286 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1243,16 +1292,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1243,16 +1292,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
1243 } 1292 }
1244 1293
1245 public EntityView saveEntityView(EntityView entityView) { 1294 public EntityView saveEntityView(EntityView entityView) {
1246 - return restTemplate.postForEntity(baseURL + "entityView", entityView, EntityView.class).getBody(); 1295 + return restTemplate.postForEntity(baseURL + "/api/entityView", entityView, EntityView.class).getBody();
1247 } 1296 }
1248 1297
1249 public void deleteEntityView(String entityViewId) { 1298 public void deleteEntityView(String entityViewId) {
1250 - restTemplate.delete(baseURL + "/entityView/{entityViewId}", entityViewId); 1299 + restTemplate.delete(baseURL + "/api/entityView/{entityViewId}", entityViewId);
1251 } 1300 }
1252 1301
1253 public Optional<EntityView> getTenantEntityView(String entityViewName) { 1302 public Optional<EntityView> getTenantEntityView(String entityViewName) {
1254 try { 1303 try {
1255 - ResponseEntity<EntityView> entityView = restTemplate.getForEntity(baseURL + "/tenant/entityViews?entityViewName={entityViewName}", EntityView.class, entityViewName); 1304 + ResponseEntity<EntityView> entityView = restTemplate.getForEntity(baseURL + "/api/tenant/entityViews?entityViewName={entityViewName}", EntityView.class, entityViewName);
1256 return Optional.ofNullable(entityView.getBody()); 1305 return Optional.ofNullable(entityView.getBody());
1257 } catch (HttpClientErrorException exception) { 1306 } catch (HttpClientErrorException exception) {
1258 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1307 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1265,7 +1314,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1265,7 +1314,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1265 1314
1266 public Optional<EntityView> assignEntityViewToCustomer(String customerId, String entityViewId) { 1315 public Optional<EntityView> assignEntityViewToCustomer(String customerId, String entityViewId) {
1267 try { 1316 try {
1268 - ResponseEntity<EntityView> entityView = restTemplate.postForEntity(baseURL + "/customer/{customerId}/entityView/{entityViewId}", null, EntityView.class, customerId, entityViewId); 1317 + ResponseEntity<EntityView> entityView = restTemplate.postForEntity(baseURL + "/api/customer/{customerId}/entityView/{entityViewId}", null, EntityView.class, customerId, entityViewId);
1269 return Optional.ofNullable(entityView.getBody()); 1318 return Optional.ofNullable(entityView.getBody());
1270 } catch (HttpClientErrorException exception) { 1319 } catch (HttpClientErrorException exception) {
1271 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1320 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1279,7 +1328,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1279,7 +1328,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1279 public Optional<EntityView> unassignEntityViewFromCustomer(String entityViewId) { 1328 public Optional<EntityView> unassignEntityViewFromCustomer(String entityViewId) {
1280 try { 1329 try {
1281 ResponseEntity<EntityView> entityView = restTemplate.exchange( 1330 ResponseEntity<EntityView> entityView = restTemplate.exchange(
1282 - baseURL + "/customer/entityView/{entityViewId}", 1331 + baseURL + "/api/customer/entityView/{entityViewId}",
1283 HttpMethod.DELETE, 1332 HttpMethod.DELETE,
1284 HttpEntity.EMPTY, 1333 HttpEntity.EMPTY,
1285 EntityView.class, entityViewId); 1334 EntityView.class, entityViewId);
@@ -1299,7 +1348,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1299,7 +1348,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1299 params.put("type", type); 1348 params.put("type", type);
1300 addPageLinkToParam(params, pageLink); 1349 addPageLinkToParam(params, pageLink);
1301 return restTemplate.exchange( 1350 return restTemplate.exchange(
1302 - baseURL + "/customer/{customerId}/entityViews?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS, 1351 + baseURL + "/api/customer/{customerId}/entityViews?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS,
1303 HttpMethod.GET, 1352 HttpMethod.GET,
1304 HttpEntity.EMPTY, 1353 HttpEntity.EMPTY,
1305 new ParameterizedTypeReference<TextPageData<EntityView>>() { 1354 new ParameterizedTypeReference<TextPageData<EntityView>>() {
@@ -1312,7 +1361,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1312,7 +1361,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1312 params.put("type", type); 1361 params.put("type", type);
1313 addPageLinkToParam(params, pageLink); 1362 addPageLinkToParam(params, pageLink);
1314 return restTemplate.exchange( 1363 return restTemplate.exchange(
1315 - baseURL + "/tenant/entityViews?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS, 1364 + baseURL + "/api/tenant/entityViews?type={type}&" + TEXT_PAGE_LINK_URL_PARAMS,
1316 HttpMethod.GET, 1365 HttpMethod.GET,
1317 HttpEntity.EMPTY, 1366 HttpEntity.EMPTY,
1318 new ParameterizedTypeReference<TextPageData<EntityView>>() { 1367 new ParameterizedTypeReference<TextPageData<EntityView>>() {
@@ -1321,18 +1370,18 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1321,18 +1370,18 @@ public class RestClient implements ClientHttpRequestInterceptor {
1321 } 1370 }
1322 1371
1323 public List<EntityView> findByQuery(EntityViewSearchQuery query) { 1372 public List<EntityView> findByQuery(EntityViewSearchQuery query) {
1324 - return restTemplate.exchange(baseURL + "/entityViews", HttpMethod.POST, new HttpEntity<>(query), new ParameterizedTypeReference<List<EntityView>>() { 1373 + return restTemplate.exchange(baseURL + "/api/entityViews", HttpMethod.POST, new HttpEntity<>(query), new ParameterizedTypeReference<List<EntityView>>() {
1325 }).getBody(); 1374 }).getBody();
1326 } 1375 }
1327 1376
1328 public List<EntitySubtype> getEntityViewTypes() { 1377 public List<EntitySubtype> getEntityViewTypes() {
1329 - return restTemplate.exchange(baseURL + "/entityView/types", HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<List<EntitySubtype>>() { 1378 + return restTemplate.exchange(baseURL + "/api/entityView/types", HttpMethod.GET, HttpEntity.EMPTY, new ParameterizedTypeReference<List<EntitySubtype>>() {
1330 }).getBody(); 1379 }).getBody();
1331 } 1380 }
1332 1381
1333 public Optional<EntityView> assignEntityViewToPublicCustomer(String entityViewId) { 1382 public Optional<EntityView> assignEntityViewToPublicCustomer(String entityViewId) {
1334 try { 1383 try {
1335 - ResponseEntity<EntityView> entityView = restTemplate.postForEntity(baseURL + "customer/public/entityView/{entityViewId}", null, EntityView.class, entityViewId); 1384 + ResponseEntity<EntityView> entityView = restTemplate.postForEntity(baseURL + "/api/customer/public/entityView/{entityViewId}", null, EntityView.class, entityViewId);
1336 return Optional.ofNullable(entityView.getBody()); 1385 return Optional.ofNullable(entityView.getBody());
1337 } catch (HttpClientErrorException exception) { 1386 } catch (HttpClientErrorException exception) {
1338 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1387 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1352,7 +1401,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1352,7 +1401,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1352 addPageLinkToParam(params, pageLink); 1401 addPageLinkToParam(params, pageLink);
1353 1402
1354 return restTemplate.exchange( 1403 return restTemplate.exchange(
1355 - baseURL + "/events/{entityType}/{entityId}/{eventType}?tenantId={tenantId}&" + TIME_PAGE_LINK_URL_PARAMS, 1404 + baseURL + "/api/events/{entityType}/{entityId}/{eventType}?tenantId={tenantId}&" + TIME_PAGE_LINK_URL_PARAMS,
1356 HttpMethod.GET, 1405 HttpMethod.GET,
1357 HttpEntity.EMPTY, 1406 HttpEntity.EMPTY,
1358 new ParameterizedTypeReference<TimePageData<Event>>() { 1407 new ParameterizedTypeReference<TimePageData<Event>>() {
@@ -1368,7 +1417,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1368,7 +1417,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1368 addPageLinkToParam(params, pageLink); 1417 addPageLinkToParam(params, pageLink);
1369 1418
1370 return restTemplate.exchange( 1419 return restTemplate.exchange(
1371 - baseURL + "/events/{entityType}/{entityId}?tenantId={tenantId}&" + TIME_PAGE_LINK_URL_PARAMS, 1420 + baseURL + "/api/events/{entityType}/{entityId}?tenantId={tenantId}&" + TIME_PAGE_LINK_URL_PARAMS,
1372 HttpMethod.GET, 1421 HttpMethod.GET,
1373 HttpEntity.EMPTY, 1422 HttpEntity.EMPTY,
1374 new ParameterizedTypeReference<TimePageData<Event>>() { 1423 new ParameterizedTypeReference<TimePageData<Event>>() {
@@ -1398,7 +1447,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1398,7 +1447,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1398 1447
1399 public Optional<RuleChain> getRuleChainById(String ruleChainId) { 1448 public Optional<RuleChain> getRuleChainById(String ruleChainId) {
1400 try { 1449 try {
1401 - ResponseEntity<RuleChain> ruleChain = restTemplate.getForEntity(baseURL + "/ruleChain/{ruleChainId}", RuleChain.class, ruleChainId); 1450 + ResponseEntity<RuleChain> ruleChain = restTemplate.getForEntity(baseURL + "/api/ruleChain/{ruleChainId}", RuleChain.class, ruleChainId);
1402 return Optional.ofNullable(ruleChain.getBody()); 1451 return Optional.ofNullable(ruleChain.getBody());
1403 } catch (HttpClientErrorException exception) { 1452 } catch (HttpClientErrorException exception) {
1404 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1453 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1411,7 +1460,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1411,7 +1460,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1411 1460
1412 public Optional<RuleChainMetaData> getRuleChainMetaData(String ruleChainId) { 1461 public Optional<RuleChainMetaData> getRuleChainMetaData(String ruleChainId) {
1413 try { 1462 try {
1414 - ResponseEntity<RuleChainMetaData> ruleChainMetaData = restTemplate.getForEntity(baseURL + "/ruleChain/{ruleChainId}/metadata", RuleChainMetaData.class, ruleChainId); 1463 + ResponseEntity<RuleChainMetaData> ruleChainMetaData = restTemplate.getForEntity(baseURL + "/api/ruleChain/{ruleChainId}/metadata", RuleChainMetaData.class, ruleChainId);
1415 return Optional.ofNullable(ruleChainMetaData.getBody()); 1464 return Optional.ofNullable(ruleChainMetaData.getBody());
1416 } catch (HttpClientErrorException exception) { 1465 } catch (HttpClientErrorException exception) {
1417 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1466 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1423,12 +1472,12 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1423,12 +1472,12 @@ public class RestClient implements ClientHttpRequestInterceptor {
1423 } 1472 }
1424 1473
1425 public RuleChain saveRuleChain(RuleChain ruleChain) { 1474 public RuleChain saveRuleChain(RuleChain ruleChain) {
1426 - return restTemplate.postForEntity(baseURL + "/ruleChain", ruleChain, RuleChain.class).getBody(); 1475 + return restTemplate.postForEntity(baseURL + "/api/ruleChain", ruleChain, RuleChain.class).getBody();
1427 } 1476 }
1428 1477
1429 public Optional<RuleChain> setRootRuleChain(String ruleChainId) { 1478 public Optional<RuleChain> setRootRuleChain(String ruleChainId) {
1430 try { 1479 try {
1431 - ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/ruleChain/{ruleChainId}/root", null, RuleChain.class, ruleChainId); 1480 + ResponseEntity<RuleChain> ruleChain = restTemplate.postForEntity(baseURL + "/api/ruleChain/{ruleChainId}/root", null, RuleChain.class, ruleChainId);
1432 return Optional.ofNullable(ruleChain.getBody()); 1481 return Optional.ofNullable(ruleChain.getBody());
1433 } catch (HttpClientErrorException exception) { 1482 } catch (HttpClientErrorException exception) {
1434 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1483 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1440,14 +1489,14 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1440,14 +1489,14 @@ public class RestClient implements ClientHttpRequestInterceptor {
1440 } 1489 }
1441 1490
1442 public RuleChainMetaData saveRuleChainMetaData(RuleChainMetaData ruleChainMetaData) { 1491 public RuleChainMetaData saveRuleChainMetaData(RuleChainMetaData ruleChainMetaData) {
1443 - return restTemplate.postForEntity(baseURL + "/ruleChain/metadata", ruleChainMetaData, RuleChainMetaData.class).getBody(); 1492 + return restTemplate.postForEntity(baseURL + "/api/ruleChain/metadata", ruleChainMetaData, RuleChainMetaData.class).getBody();
1444 } 1493 }
1445 1494
1446 public TextPageData<RuleChain> getRuleChains(TextPageLink pageLink) { 1495 public TextPageData<RuleChain> getRuleChains(TextPageLink pageLink) {
1447 Map<String, String> params = new HashMap<>(); 1496 Map<String, String> params = new HashMap<>();
1448 addPageLinkToParam(params, pageLink); 1497 addPageLinkToParam(params, pageLink);
1449 return restTemplate.exchange( 1498 return restTemplate.exchange(
1450 - baseURL + "/ruleChains" + TEXT_PAGE_LINK_URL_PARAMS, 1499 + baseURL + "/api/ruleChains" + TEXT_PAGE_LINK_URL_PARAMS,
1451 HttpMethod.GET, 1500 HttpMethod.GET,
1452 HttpEntity.EMPTY, 1501 HttpEntity.EMPTY,
1453 new ParameterizedTypeReference<TextPageData<RuleChain>>() { 1502 new ParameterizedTypeReference<TextPageData<RuleChain>>() {
@@ -1456,12 +1505,12 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1456,12 +1505,12 @@ public class RestClient implements ClientHttpRequestInterceptor {
1456 } 1505 }
1457 1506
1458 public void deleteRuleChain(String ruleChainId) { 1507 public void deleteRuleChain(String ruleChainId) {
1459 - restTemplate.delete(baseURL + "/ruleChain/{ruleChainId}", ruleChainId); 1508 + restTemplate.delete(baseURL + "/api/ruleChain/{ruleChainId}", ruleChainId);
1460 } 1509 }
1461 1510
1462 public Optional<JsonNode> getLatestRuleNodeDebugInput(String ruleNodeId) { 1511 public Optional<JsonNode> getLatestRuleNodeDebugInput(String ruleNodeId) {
1463 try { 1512 try {
1464 - ResponseEntity<JsonNode> jsonNode = restTemplate.getForEntity(baseURL + "/ruleNode/{ruleNodeId}/debugIn", JsonNode.class, ruleNodeId); 1513 + ResponseEntity<JsonNode> jsonNode = restTemplate.getForEntity(baseURL + "/api/ruleNode/{ruleNodeId}/debugIn", JsonNode.class, ruleNodeId);
1465 return Optional.ofNullable(jsonNode.getBody()); 1514 return Optional.ofNullable(jsonNode.getBody());
1466 } catch (HttpClientErrorException exception) { 1515 } catch (HttpClientErrorException exception) {
1467 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1516 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1474,7 +1523,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1474,7 +1523,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1474 1523
1475 public Optional<JsonNode> testScript(JsonNode inputParams) { 1524 public Optional<JsonNode> testScript(JsonNode inputParams) {
1476 try { 1525 try {
1477 - ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/ruleChain/testScript", inputParams, JsonNode.class); 1526 + ResponseEntity<JsonNode> jsonNode = restTemplate.postForEntity(baseURL + "/api/ruleChain/testScript", inputParams, JsonNode.class);
1478 return Optional.ofNullable(jsonNode.getBody()); 1527 return Optional.ofNullable(jsonNode.getBody());
1479 } catch (HttpClientErrorException exception) { 1528 } catch (HttpClientErrorException exception) {
1480 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1529 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1689,7 +1738,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1689,7 +1738,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1689 1738
1690 public Optional<Tenant> getTenantById(String tenantId) { 1739 public Optional<Tenant> getTenantById(String tenantId) {
1691 try { 1740 try {
1692 - ResponseEntity<Tenant> tenant = restTemplate.getForEntity(baseURL + "/tenant/{tenantId}", Tenant.class, tenantId); 1741 + ResponseEntity<Tenant> tenant = restTemplate.getForEntity(baseURL + "/api/tenant/{tenantId}", Tenant.class, tenantId);
1693 return Optional.ofNullable(tenant.getBody()); 1742 return Optional.ofNullable(tenant.getBody());
1694 } catch (HttpClientErrorException exception) { 1743 } catch (HttpClientErrorException exception) {
1695 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1744 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1701,11 +1750,11 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1701,11 +1750,11 @@ public class RestClient implements ClientHttpRequestInterceptor {
1701 } 1750 }
1702 1751
1703 public Tenant saveTenant(Tenant tenant) { 1752 public Tenant saveTenant(Tenant tenant) {
1704 - return restTemplate.postForEntity(baseURL + "/tenant", tenant, Tenant.class).getBody(); 1753 + return restTemplate.postForEntity(baseURL + "/api/tenant", tenant, Tenant.class).getBody();
1705 } 1754 }
1706 1755
1707 public void deleteTenant(String tenantId) { 1756 public void deleteTenant(String tenantId) {
1708 - restTemplate.delete(baseURL + "/tenant/{tenantId}", tenantId); 1757 + restTemplate.delete(baseURL + "/api/tenant/{tenantId}", tenantId);
1709 } 1758 }
1710 1759
1711 public TextPageData<Tenant> getTenants(TextPageLink pageLink) { 1760 public TextPageData<Tenant> getTenants(TextPageLink pageLink) {
@@ -1722,7 +1771,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1722,7 +1771,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1722 1771
1723 public Optional<User> getUserById(String userId) { 1772 public Optional<User> getUserById(String userId) {
1724 try { 1773 try {
1725 - ResponseEntity<User> user = restTemplate.getForEntity(baseURL + "/user/{userId}", User.class, userId); 1774 + ResponseEntity<User> user = restTemplate.getForEntity(baseURL + "/api/user/{userId}", User.class, userId);
1726 return Optional.ofNullable(user.getBody()); 1775 return Optional.ofNullable(user.getBody());
1727 } catch (HttpClientErrorException exception) { 1776 } catch (HttpClientErrorException exception) {
1728 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1777 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1734,12 +1783,12 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1734,12 +1783,12 @@ public class RestClient implements ClientHttpRequestInterceptor {
1734 } 1783 }
1735 1784
1736 public Boolean isUserTokenAccessEnabled() { 1785 public Boolean isUserTokenAccessEnabled() {
1737 - return restTemplate.getForEntity(baseURL + "/user/tokenAccessEnabled", Boolean.class).getBody(); 1786 + return restTemplate.getForEntity(baseURL + "/api/user/tokenAccessEnabled", Boolean.class).getBody();
1738 } 1787 }
1739 1788
1740 public Optional<JsonNode> getUserToken(String userId) { 1789 public Optional<JsonNode> getUserToken(String userId) {
1741 try { 1790 try {
1742 - ResponseEntity<JsonNode> userToken = restTemplate.getForEntity(baseURL + "/user/{userId}/token", JsonNode.class, userId); 1791 + ResponseEntity<JsonNode> userToken = restTemplate.getForEntity(baseURL + "/api/user/{userId}/token", JsonNode.class, userId);
1743 return Optional.ofNullable(userToken.getBody()); 1792 return Optional.ofNullable(userToken.getBody());
1744 } catch (HttpClientErrorException exception) { 1793 } catch (HttpClientErrorException exception) {
1745 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1794 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1751,16 +1800,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1751,16 +1800,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
1751 } 1800 }
1752 1801
1753 public User saveUser(User user, boolean sendActivationMail) { 1802 public User saveUser(User user, boolean sendActivationMail) {
1754 - return restTemplate.postForEntity(baseURL + "/user?sendActivationMail={sendActivationMail}", user, User.class, sendActivationMail).getBody(); 1803 + return restTemplate.postForEntity(baseURL + "/api/user?sendActivationMail={sendActivationMail}", user, User.class, sendActivationMail).getBody();
1755 } 1804 }
1756 1805
1757 public void sendActivationEmail(String email) { 1806 public void sendActivationEmail(String email) {
1758 - restTemplate.postForEntity(baseURL + "/user/sendActivationMail?email={email}", null, Object.class, email); 1807 + restTemplate.postForEntity(baseURL + "/api/user/sendActivationMail?email={email}", null, Object.class, email);
1759 } 1808 }
1760 1809
1761 public Optional<String> getActivationLink(String userId) { 1810 public Optional<String> getActivationLink(String userId) {
1762 try { 1811 try {
1763 - ResponseEntity<String> activationLink = restTemplate.getForEntity(baseURL + "/user/{userId}/activationLink", String.class, userId); 1812 + ResponseEntity<String> activationLink = restTemplate.getForEntity(baseURL + "/api/user/{userId}/activationLink", String.class, userId);
1764 return Optional.ofNullable(activationLink.getBody()); 1813 return Optional.ofNullable(activationLink.getBody());
1765 } catch (HttpClientErrorException exception) { 1814 } catch (HttpClientErrorException exception) {
1766 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1815 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1772,7 +1821,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1772,7 +1821,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1772 } 1821 }
1773 1822
1774 public void deleteUser(String userId) { 1823 public void deleteUser(String userId) {
1775 - restTemplate.delete(baseURL + "/user/{userId}", userId); 1824 + restTemplate.delete(baseURL + "/api/user/{userId}", userId);
1776 } 1825 }
1777 1826
1778 // @RequestMapping(value = "/tenant/{tenantId}/users", params = {"limit"}, method = RequestMethod.GET) 1827 // @RequestMapping(value = "/tenant/{tenantId}/users", params = {"limit"}, method = RequestMethod.GET)
@@ -1796,7 +1845,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1796,7 +1845,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1796 addPageLinkToParam(params, pageLink); 1845 addPageLinkToParam(params, pageLink);
1797 1846
1798 return restTemplate.exchange( 1847 return restTemplate.exchange(
1799 - baseURL + "/customer/{customerId}/users?" + TEXT_PAGE_LINK_URL_PARAMS, 1848 + baseURL + "/api/customer/{customerId}/users?" + TEXT_PAGE_LINK_URL_PARAMS,
1800 HttpMethod.GET, 1849 HttpMethod.GET,
1801 HttpEntity.EMPTY, 1850 HttpEntity.EMPTY,
1802 new ParameterizedTypeReference<TextPageData<User>>() { 1851 new ParameterizedTypeReference<TextPageData<User>>() {
@@ -1806,7 +1855,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1806,7 +1855,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1806 1855
1807 public void setUserCredentialsEnabled(String userId, boolean userCredentialsEnabled) { 1856 public void setUserCredentialsEnabled(String userId, boolean userCredentialsEnabled) {
1808 restTemplate.postForEntity( 1857 restTemplate.postForEntity(
1809 - baseURL + "/user/{userId}/userCredentialsEnabled?serCredentialsEnabled={serCredentialsEnabled}", 1858 + baseURL + "/api/user/{userId}/userCredentialsEnabled?serCredentialsEnabled={serCredentialsEnabled}",
1810 null, 1859 null,
1811 Object.class, 1860 Object.class,
1812 userId, 1861 userId,
@@ -1816,7 +1865,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1816,7 +1865,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1816 public Optional<WidgetsBundle> getWidgetsBundleById(String widgetsBundleId) { 1865 public Optional<WidgetsBundle> getWidgetsBundleById(String widgetsBundleId) {
1817 try { 1866 try {
1818 ResponseEntity<WidgetsBundle> widgetsBundle = 1867 ResponseEntity<WidgetsBundle> widgetsBundle =
1819 - restTemplate.getForEntity(baseURL + "/widgetsBundle/{widgetsBundleId}", WidgetsBundle.class, widgetsBundleId); 1868 + restTemplate.getForEntity(baseURL + "/api/widgetsBundle/{widgetsBundleId}", WidgetsBundle.class, widgetsBundleId);
1820 return Optional.ofNullable(widgetsBundle.getBody()); 1869 return Optional.ofNullable(widgetsBundle.getBody());
1821 } catch (HttpClientErrorException exception) { 1870 } catch (HttpClientErrorException exception) {
1822 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1871 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1828,18 +1877,18 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1828,18 +1877,18 @@ public class RestClient implements ClientHttpRequestInterceptor {
1828 } 1877 }
1829 1878
1830 public WidgetsBundle saveWidgetsBundle(WidgetsBundle widgetsBundle) { 1879 public WidgetsBundle saveWidgetsBundle(WidgetsBundle widgetsBundle) {
1831 - return restTemplate.postForEntity(baseURL + "/widgetsBundle", widgetsBundle, WidgetsBundle.class).getBody(); 1880 + return restTemplate.postForEntity(baseURL + "/api/widgetsBundle", widgetsBundle, WidgetsBundle.class).getBody();
1832 } 1881 }
1833 1882
1834 public void deleteWidgetsBundle(String widgetsBundleId) { 1883 public void deleteWidgetsBundle(String widgetsBundleId) {
1835 - restTemplate.delete(baseURL + "/widgetsBundle/{widgetsBundleId}", widgetsBundleId); 1884 + restTemplate.delete(baseURL + "/api/widgetsBundle/{widgetsBundleId}", widgetsBundleId);
1836 } 1885 }
1837 1886
1838 public TextPageData<WidgetsBundle> getWidgetsBundles(TextPageLink pageLink) { 1887 public TextPageData<WidgetsBundle> getWidgetsBundles(TextPageLink pageLink) {
1839 Map<String, String> params = new HashMap<>(); 1888 Map<String, String> params = new HashMap<>();
1840 addPageLinkToParam(params, pageLink); 1889 addPageLinkToParam(params, pageLink);
1841 return restTemplate.exchange( 1890 return restTemplate.exchange(
1842 - baseURL + "/widgetsBundles?" + TEXT_PAGE_LINK_URL_PARAMS, 1891 + baseURL + "/api/widgetsBundles?" + TEXT_PAGE_LINK_URL_PARAMS,
1843 HttpMethod.GET, 1892 HttpMethod.GET,
1844 HttpEntity.EMPTY, 1893 HttpEntity.EMPTY,
1845 new ParameterizedTypeReference<TextPageData<WidgetsBundle>>() { 1894 new ParameterizedTypeReference<TextPageData<WidgetsBundle>>() {
@@ -1848,7 +1897,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1848,7 +1897,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1848 1897
1849 public List<WidgetsBundle> getWidgetsBundles() { 1898 public List<WidgetsBundle> getWidgetsBundles() {
1850 return restTemplate.exchange( 1899 return restTemplate.exchange(
1851 - baseURL + "/widgetsBundles", 1900 + baseURL + "/api/widgetsBundles",
1852 HttpMethod.GET, 1901 HttpMethod.GET,
1853 HttpEntity.EMPTY, 1902 HttpEntity.EMPTY,
1854 new ParameterizedTypeReference<List<WidgetsBundle>>() { 1903 new ParameterizedTypeReference<List<WidgetsBundle>>() {
@@ -1858,7 +1907,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1858,7 +1907,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1858 public Optional<WidgetType> getWidgetTypeById(String widgetTypeId) { 1907 public Optional<WidgetType> getWidgetTypeById(String widgetTypeId) {
1859 try { 1908 try {
1860 ResponseEntity<WidgetType> widgetType = 1909 ResponseEntity<WidgetType> widgetType =
1861 - restTemplate.getForEntity(baseURL + "/widgetType/{widgetTypeId}", WidgetType.class, widgetTypeId); 1910 + restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetType.class, widgetTypeId);
1862 return Optional.ofNullable(widgetType.getBody()); 1911 return Optional.ofNullable(widgetType.getBody());
1863 } catch (HttpClientErrorException exception) { 1912 } catch (HttpClientErrorException exception) {
1864 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { 1913 if (exception.getStatusCode() == HttpStatus.NOT_FOUND) {
@@ -1870,16 +1919,16 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1870,16 +1919,16 @@ public class RestClient implements ClientHttpRequestInterceptor {
1870 } 1919 }
1871 1920
1872 public WidgetType saveWidgetType(WidgetType widgetType) { 1921 public WidgetType saveWidgetType(WidgetType widgetType) {
1873 - return restTemplate.postForEntity(baseURL + "/widgetType", widgetType, WidgetType.class).getBody(); 1922 + return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetType, WidgetType.class).getBody();
1874 } 1923 }
1875 1924
1876 public void deleteWidgetType(String widgetTypeId) { 1925 public void deleteWidgetType(String widgetTypeId) {
1877 - restTemplate.delete(baseURL + "/widgetType/{widgetTypeId}", widgetTypeId); 1926 + restTemplate.delete(baseURL + "/api/widgetType/{widgetTypeId}", widgetTypeId);
1878 } 1927 }
1879 1928
1880 public List<WidgetType> getBundleWidgetTypes(boolean isSystem, String bundleAlias) { 1929 public List<WidgetType> getBundleWidgetTypes(boolean isSystem, String bundleAlias) {
1881 return restTemplate.exchange( 1930 return restTemplate.exchange(
1882 - baseURL + "/widgetTypes?isSystem={isSystem}&bundleAlias={bundleAlias}", 1931 + baseURL + "/api/widgetTypes?isSystem={isSystem}&bundleAlias={bundleAlias}",
1883 HttpMethod.GET, 1932 HttpMethod.GET,
1884 HttpEntity.EMPTY, 1933 HttpEntity.EMPTY,
1885 new ParameterizedTypeReference<List<WidgetType>>() { 1934 new ParameterizedTypeReference<List<WidgetType>>() {
@@ -1892,7 +1941,7 @@ public class RestClient implements ClientHttpRequestInterceptor { @@ -1892,7 +1941,7 @@ public class RestClient implements ClientHttpRequestInterceptor {
1892 try { 1941 try {
1893 ResponseEntity<WidgetType> widgetType = 1942 ResponseEntity<WidgetType> widgetType =
1894 restTemplate.getForEntity( 1943 restTemplate.getForEntity(
1895 - baseURL + "/widgetType?isSystem={isSystem}&bundleAlias={bundleAlias}&alias={alias}", 1944 + baseURL + "/api/widgetType?isSystem={isSystem}&bundleAlias={bundleAlias}&alias={alias}",
1896 WidgetType.class, 1945 WidgetType.class,
1897 isSystem, 1946 isSystem,
1898 bundleAlias, 1947 bundleAlias,