Search in sources :

Example 1 with LinkStoreConfigDto

use of org.openkilda.store.model.LinkStoreConfigDto in project open-kilda by telstra.

the class FlowService method getAllStatus.

/**
 * Gets the all status list.
 *
 * @return the all status list
 */
public Set<String> getAllStatus() {
    LinkStoreConfigDto linkStoreConfigDto = storeService.getLinkStoreConfig();
    boolean isLinkStoreConfig = linkStoreConfigDto.getUrls().isEmpty();
    Status status = Status.INSTANCE;
    if (!isLinkStoreConfig) {
        if (CollectionUtil.isEmpty(status.getStatuses())) {
            status.setStatuses(new HashSet<String>(flowStoreService.getAllStatus()));
        }
    } else {
        LOGGER.info("Link store is not configured. ");
    }
    return status.getStatuses() != null ? status.getStatuses() : new HashSet<String>();
}
Also used : Status(org.openkilda.model.Status) FlowStatus(org.openkilda.integration.model.FlowStatus) LinkStoreConfigDto(org.openkilda.store.model.LinkStoreConfigDto)

Example 2 with LinkStoreConfigDto

use of org.openkilda.store.model.LinkStoreConfigDto in project open-kilda by telstra.

the class StoreService method getLinkStoreConfig.

/**
 * Gets the link store config.
 *
 * @return the link store config
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public LinkStoreConfigDto getLinkStoreConfig() {
    LOGGER.info("Get link store configuration");
    LinkStoreConfigDto linkStoreConfigDto = new LinkStoreConfigDto();
    List<LinkStoreRequestUrlsEntity> linkStoreRequestUrlsEntitiesList = linkStoreRequestUrlsRepository.findAll();
    Map<String, UrlDto> urls = new HashMap<String, UrlDto>();
    for (LinkStoreRequestUrlsEntity linkStoreRequestUrlsEntity : linkStoreRequestUrlsEntitiesList) {
        urls.put(linkStoreRequestUrlsEntity.getUrlEntity().getName(), UrlConverter.toUrlDto(linkStoreRequestUrlsEntity.getUrlEntity()));
    }
    linkStoreConfigDto.setUrls(urls);
    return linkStoreConfigDto;
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) HashMap(java.util.HashMap) LinkStoreRequestUrlsEntity(org.openkilda.store.linkstore.dao.entity.LinkStoreRequestUrlsEntity) LinkStoreConfigDto(org.openkilda.store.model.LinkStoreConfigDto) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

LinkStoreConfigDto (org.openkilda.store.model.LinkStoreConfigDto)2 HashMap (java.util.HashMap)1 FlowStatus (org.openkilda.integration.model.FlowStatus)1 Status (org.openkilda.model.Status)1 LinkStoreRequestUrlsEntity (org.openkilda.store.linkstore.dao.entity.LinkStoreRequestUrlsEntity)1 UrlDto (org.openkilda.store.model.UrlDto)1 Transactional (org.springframework.transaction.annotation.Transactional)1