Search in sources :

Example 1 with VIEW_NAME

use of com.epam.ta.reportportal.core.widget.content.loader.materialized.handler.MaterializedWidgetStateHandler.VIEW_NAME in project service-api by reportportal.

the class HealthCheckTableReadyContentLoader method getParams.

private HealthCheckTableGetParams getParams(WidgetOptions widgetOptions, List<String> attributeValues) {
    List<String> attributeKeys = WidgetOptionUtil.getListByKey(ATTRIBUTE_KEYS, widgetOptions);
    int currentLevel = attributeValues.size();
    BusinessRule.expect(attributeKeys, keys -> keys.size() > currentLevel).verify(ErrorType.UNABLE_LOAD_WIDGET_CONTENT, "Incorrect level definition");
    String viewName = ofNullable(WidgetOptionUtil.getValueByKey(VIEW_NAME, widgetOptions)).orElseThrow(() -> new ReportPortalException(ErrorType.UNABLE_LOAD_WIDGET_CONTENT, "Widget view name not provided"));
    String currentLevelKey = attributeKeys.get(currentLevel);
    boolean includeCustomColumn = ofNullable(WidgetOptionUtil.getValueByKey(CUSTOM_COLUMN, widgetOptions)).isPresent();
    return HealthCheckTableGetParams.of(viewName, currentLevelKey, resolveSort(widgetOptions), includeCustomColumn, getLevelEntries(attributeKeys, attributeValues));
}
Also used : IntStream(java.util.stream.IntStream) WidgetOptions(com.epam.ta.reportportal.entity.widget.WidgetOptions) ContentLoaderConstants(com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) Autowired(org.springframework.beans.factory.annotation.Autowired) ErrorType(com.epam.ta.reportportal.ws.model.ErrorType) EXECUTIONS_PASSED(com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.EXECUTIONS_PASSED) StringUtils(org.apache.commons.lang3.StringUtils) BigDecimal(java.math.BigDecimal) CollectionUtils(org.apache.commons.collections.CollectionUtils) HealthCheckTableGetParams(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableGetParams) Service(org.springframework.stereotype.Service) Map(java.util.Map) LevelEntry(com.epam.ta.reportportal.entity.widget.content.healthcheck.LevelEntry) Sort(org.springframework.data.domain.Sort) RoundingMode(java.math.RoundingMode) BusinessRule(com.epam.ta.reportportal.commons.validation.BusinessRule) Collections.emptyMap(java.util.Collections.emptyMap) SortEntry(com.epam.ta.reportportal.ws.model.widget.SortEntry) ImmutableMap(com.google.common.collect.ImmutableMap) VIEW_NAME(com.epam.ta.reportportal.core.widget.content.loader.materialized.handler.MaterializedWidgetStateHandler.VIEW_NAME) Optional.ofNullable(java.util.Optional.ofNullable) Collection(java.util.Collection) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) WidgetOptionUtil(com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException) MultiValueMap(org.springframework.util.MultiValueMap) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) WidgetContentRepository(com.epam.ta.reportportal.dao.WidgetContentRepository) Collectors(java.util.stream.Collectors) List(java.util.List) HealthCheckTableContent(com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent) Widget(com.epam.ta.reportportal.entity.widget.Widget) EXECUTIONS_TOTAL(com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.EXECUTIONS_TOTAL) Collections(java.util.Collections) ReportPortalException(com.epam.ta.reportportal.exception.ReportPortalException)

Aggregations

BusinessRule (com.epam.ta.reportportal.commons.validation.BusinessRule)1 ContentLoaderConstants (com.epam.ta.reportportal.core.widget.content.constant.ContentLoaderConstants)1 VIEW_NAME (com.epam.ta.reportportal.core.widget.content.loader.materialized.handler.MaterializedWidgetStateHandler.VIEW_NAME)1 WidgetOptionUtil (com.epam.ta.reportportal.core.widget.util.WidgetOptionUtil)1 WidgetContentRepository (com.epam.ta.reportportal.dao.WidgetContentRepository)1 EXECUTIONS_PASSED (com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.EXECUTIONS_PASSED)1 EXECUTIONS_TOTAL (com.epam.ta.reportportal.dao.constant.WidgetContentRepositoryConstants.EXECUTIONS_TOTAL)1 Widget (com.epam.ta.reportportal.entity.widget.Widget)1 WidgetOptions (com.epam.ta.reportportal.entity.widget.WidgetOptions)1 HealthCheckTableContent (com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableContent)1 HealthCheckTableGetParams (com.epam.ta.reportportal.entity.widget.content.healthcheck.HealthCheckTableGetParams)1 LevelEntry (com.epam.ta.reportportal.entity.widget.content.healthcheck.LevelEntry)1 ReportPortalException (com.epam.ta.reportportal.exception.ReportPortalException)1 ErrorType (com.epam.ta.reportportal.ws.model.ErrorType)1 SortEntry (com.epam.ta.reportportal.ws.model.widget.SortEntry)1 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 BigDecimal (java.math.BigDecimal)1 RoundingMode (java.math.RoundingMode)1