Search in sources :

Example 16 with UrlDto

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

the class StoreService method getUrl.

/**
 * Gets the url.
 *
 * @param storeType the store type
 *
 * @param url the url
 *
 * @return the url
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public UrlDto getUrl(final StoreType storeType, final Url url) {
    LOGGER.info("Get urls for store type");
    UrlDto urlDto = null;
    if (storeType == StoreType.LINK_STORE) {
        LinkStoreRequestUrlsEntity urlsEntity = linkStoreRequestUrlsRepository.findByUrlEntity_name(url.getName());
        urlDto = UrlConverter.toUrlDto(urlsEntity.getUrlEntity());
    }
    if (storeType == StoreType.SWITCH_STORE) {
        SwitchStoreRequestUrlsEntity urlsEntity = switchStoreRequestUrlsRepository.findByUrlEntity_name(url.getName());
        urlDto = UrlConverter.toUrlDto(urlsEntity.getUrlEntity());
    }
    return urlDto;
}
Also used : UrlDto(org.openkilda.store.model.UrlDto) LinkStoreRequestUrlsEntity(org.openkilda.store.linkstore.dao.entity.LinkStoreRequestUrlsEntity) SwitchStoreRequestUrlsEntity(org.openkilda.store.switchstore.dao.entity.SwitchStoreRequestUrlsEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Example 17 with UrlDto

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

the class StoreService method getSwitchStoreConfig.

/**
 * Gets the switch store config.
 *
 * @return the switch store config
 */
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public SwitchStoreConfigDto getSwitchStoreConfig() {
    LOGGER.info("Get switch store configuration");
    SwitchStoreConfigDto switchStoreConfigDto = new SwitchStoreConfigDto();
    List<SwitchStoreRequestUrlsEntity> switchStoreRequestUrlsEntitiesList = switchStoreRequestUrlsRepository.findAll();
    Map<String, UrlDto> urls = new HashMap<String, UrlDto>();
    for (SwitchStoreRequestUrlsEntity switchStoreRequestUrlsEntity : switchStoreRequestUrlsEntitiesList) {
        urls.put(switchStoreRequestUrlsEntity.getUrlEntity().getName(), UrlConverter.toUrlDto(switchStoreRequestUrlsEntity.getUrlEntity()));
    }
    switchStoreConfigDto.setUrls(urls);
    return switchStoreConfigDto;
}
Also used : SwitchStoreConfigDto(org.openkilda.store.model.SwitchStoreConfigDto) UrlDto(org.openkilda.store.model.UrlDto) HashMap(java.util.HashMap) SwitchStoreRequestUrlsEntity(org.openkilda.store.switchstore.dao.entity.SwitchStoreRequestUrlsEntity) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

UrlDto (org.openkilda.store.model.UrlDto)17 HashMap (java.util.HashMap)11 IAuthService (org.openkilda.integration.auth.service.IAuthService)9 StoreIntegrationException (org.openkilda.integration.exception.StoreIntegrationException)9 AuthConfigDto (org.openkilda.store.model.AuthConfigDto)9 Transactional (org.springframework.transaction.annotation.Transactional)5 LinkStoreRequestUrlsEntity (org.openkilda.store.linkstore.dao.entity.LinkStoreRequestUrlsEntity)3 SwitchStoreRequestUrlsEntity (org.openkilda.store.switchstore.dao.entity.SwitchStoreRequestUrlsEntity)3 ArrayList (java.util.ArrayList)2 OauthConfigEntity (org.openkilda.store.auth.dao.entity.OauthConfigEntity)2 RequestValidationException (org.usermanagement.exception.RequestValidationException)2 LinkStoreConfigDto (org.openkilda.store.model.LinkStoreConfigDto)1 SwitchStoreConfigDto (org.openkilda.store.model.SwitchStoreConfigDto)1