|
|
|
@ -134,6 +134,8 @@ import org.thingsboard.server.common.data.security.model.SecuritySettings; |
|
|
|
import org.thingsboard.server.common.data.security.model.UserPasswordPolicy; |
|
|
|
import org.thingsboard.server.common.data.sms.config.TestSmsRequest; |
|
|
|
import org.thingsboard.server.common.data.widget.WidgetType; |
|
|
|
import org.thingsboard.server.common.data.widget.WidgetTypeDetails; |
|
|
|
import org.thingsboard.server.common.data.widget.WidgetTypeInfo; |
|
|
|
import org.thingsboard.server.common.data.widget.WidgetsBundle; |
|
|
|
|
|
|
|
import java.io.Closeable; |
|
|
|
@ -2423,11 +2425,11 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
|
|
|
}).getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
public Optional<WidgetType> getWidgetTypeById(WidgetTypeId widgetTypeId) { |
|
|
|
public Optional<WidgetTypeDetails> getWidgetTypeById(WidgetTypeId widgetTypeId) { |
|
|
|
try { |
|
|
|
ResponseEntity<WidgetType> widgetType = |
|
|
|
restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetType.class, widgetTypeId.getId()); |
|
|
|
return Optional.ofNullable(widgetType.getBody()); |
|
|
|
ResponseEntity<WidgetTypeDetails> widgetTypeDetails = |
|
|
|
restTemplate.getForEntity(baseURL + "/api/widgetType/{widgetTypeId}", WidgetTypeDetails.class, widgetTypeId.getId()); |
|
|
|
return Optional.ofNullable(widgetTypeDetails.getBody()); |
|
|
|
} catch (HttpClientErrorException exception) { |
|
|
|
if (exception.getStatusCode() == HttpStatus.NOT_FOUND) { |
|
|
|
return Optional.empty(); |
|
|
|
@ -2437,8 +2439,8 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public WidgetType saveWidgetType(WidgetType widgetType) { |
|
|
|
return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetType, WidgetType.class).getBody(); |
|
|
|
public WidgetTypeDetails saveWidgetType(WidgetTypeDetails widgetTypeDetails) { |
|
|
|
return restTemplate.postForEntity(baseURL + "/api/widgetType", widgetTypeDetails, WidgetTypeDetails.class).getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
public void deleteWidgetType(WidgetTypeId widgetTypeId) { |
|
|
|
@ -2456,6 +2458,28 @@ public class RestClient implements ClientHttpRequestInterceptor, Closeable { |
|
|
|
bundleAlias).getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<WidgetTypeDetails> getBundleWidgetTypesDetails(boolean isSystem, String bundleAlias) { |
|
|
|
return restTemplate.exchange( |
|
|
|
baseURL + "/api/widgetTypesDetails?isSystem={isSystem}&bundleAlias={bundleAlias}", |
|
|
|
HttpMethod.GET, |
|
|
|
HttpEntity.EMPTY, |
|
|
|
new ParameterizedTypeReference<List<WidgetTypeDetails>>() { |
|
|
|
}, |
|
|
|
isSystem, |
|
|
|
bundleAlias).getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<WidgetTypeInfo> getBundleWidgetTypesInfos(boolean isSystem, String bundleAlias) { |
|
|
|
return restTemplate.exchange( |
|
|
|
baseURL + "/api/widgetTypesInfos?isSystem={isSystem}&bundleAlias={bundleAlias}", |
|
|
|
HttpMethod.GET, |
|
|
|
HttpEntity.EMPTY, |
|
|
|
new ParameterizedTypeReference<List<WidgetTypeInfo>>() { |
|
|
|
}, |
|
|
|
isSystem, |
|
|
|
bundleAlias).getBody(); |
|
|
|
} |
|
|
|
|
|
|
|
public Optional<WidgetType> getWidgetType(boolean isSystem, String bundleAlias, String alias) { |
|
|
|
try { |
|
|
|
ResponseEntity<WidgetType> widgetType = |
|
|
|
|