Commit 247a0841 authored by Labros Papadopoulos's avatar Labros Papadopoulos
Browse files

Merge branch 'develop' into alarm-fixes

parents 93145e3f 16b57db2
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -196,7 +196,7 @@
    <dependency>
      <groupId>org.etsi.osl.hypo.api</groupId>
      <artifactId>tmf.schema</artifactId>
      <version>2.5.2</version>
      <version>2.6.1</version>
    </dependency>

    <dependency>
+8 −8
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Strings;
import org.etsi.osl.hypo.api.tmf.common.api.model.RelatedPartyDTO;
import org.etsi.osl.hypo.api.tmf.common.api.services.RelatedPartyService;
import org.etsi.osl.hypo.api.tmf.common.schema.RelatedPartyEntity;
import org.etsi.osl.hypo.api.tmf.party.api.services.OrganizationService;
import org.etsi.osl.hypo.api.tmf.party.organization.schema.Organization;
@@ -26,7 +27,6 @@ import org.etsi.osl.hypo.api.tmf.services.catalog.schema.ServiceCategoryEntity;
import org.etsi.osl.hypo.api.tmf.services.catalog.schema.ServiceSpecificationEntity;
import org.etsi.osl.hypo.api.tmf.services.common.model.ServiceRefOrValue;
import org.etsi.osl.hypo.api.tmf.services.common.schema.ServiceSpecificationRef;
import org.etsi.osl.hypo.api.tmf.services.common.service.RelatedPartyHelper;
import org.etsi.osl.hypo.api.tmf.services.inventory.api.mappers.ServiceMapper;
import org.etsi.osl.hypo.api.tmf.services.inventory.schema.Service;
import org.etsi.osl.hypo.api.tmf.services.model.ServiceWithPeeredOrganization;
@@ -40,7 +40,7 @@ public class ServiceCatalogHelper {
    private final ServiceSpecificationService serviceSpecificationService;
    private final ServiceSpecificationRepository serviceSpecificationRepository;
    private final OrganizationService organizationService;
    private final RelatedPartyHelper relatedPartyHelper;
    private final RelatedPartyService relatedPartyService;
    private final ServiceMapper serviceMapper;

    @Inject
@@ -49,13 +49,13 @@ public class ServiceCatalogHelper {
            ServiceSpecificationService serviceInventoryService,
            ServiceSpecificationRepository serviceSpecificationRepository,
            OrganizationService organizationService,
            RelatedPartyHelper relatedPartyHelper,
            RelatedPartyService relatedPartyService,
            ServiceMapper serviceMapper) {
        this.serviceCategoryService = serviceCategoryService;
        this.serviceSpecificationService = serviceInventoryService;
        this.serviceSpecificationRepository = serviceSpecificationRepository;
        this.organizationService = organizationService;
        this.relatedPartyHelper = relatedPartyHelper;
        this.relatedPartyService = relatedPartyService;
        this.serviceMapper = serviceMapper;
    }

@@ -303,11 +303,11 @@ public class ServiceCatalogHelper {
                            : null;

            if (Objects.nonNull(relatedPartyId)) {
                relatedPartyHelper
                organizationService
                        .getOptionalOrganizationById(relatedPartyId)
                        .ifPresent(
                                organization -> {
                                    if (relatedPartyHelper.isPeeredOrganization(organization)) {
                                    if (organizationService.isPeeredOrganization(organization)) {
                                        serviceWithPeeredOrganization.setOrganizationProvider(organization.getName());
                                    }
                                });
@@ -346,10 +346,10 @@ public class ServiceCatalogHelper {
    }

    public List<RelatedPartyEntity> findAllRelatedPartyListByIds(List<String> relatedPartyIds) {
        return relatedPartyHelper.getRelatedPartiesByIds(relatedPartyIds);
        return relatedPartyService.findAllRelatedPartiesByIds(relatedPartyIds);
    }

    public Set<RelatedPartyEntity> findAllRelatedPartySetByIds(Set<String> relatedPartyIds) {
        return relatedPartyHelper.getRelatedPartySetByIds(relatedPartyIds);
        return relatedPartyService.findAllRelatedPartiesByIds(relatedPartyIds);
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import io.micrometer.common.util.StringUtils;
import jakarta.ws.rs.core.MultivaluedMap;
import jakarta.ws.rs.core.UriInfo;
import java.net.URI;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
@@ -264,4 +265,8 @@ public class UtilService {
        String whereClause = String.format(whereClauseFormat, queryQualifier);
        queryBuilder.append(whereClause);
    }

    public static URI getUri(String href, UriInfo uriInfo) {
        return StringUtils.isNotBlank(href) ? URI.create(href) : uriInfo.getAbsolutePath();
    }
}
+0 −31
Original line number Diff line number Diff line
package org.etsi.osl.hypo.api.tmf.product.catalog.mapper;

import java.util.UUID;
import org.etsi.osl.hypo.api.tmf.product.catalog.model.ProductCatalogResponseDTO;
import org.etsi.osl.hypo.api.tmf.product.catalog.schema.Catalog;
import org.mapstruct.BeanMapping;
import org.mapstruct.InjectionStrategy;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.SubclassExhaustiveStrategy;

@Mapper(
        componentModel = "cdi",
        injectionStrategy = InjectionStrategy.CONSTRUCTOR,
        subclassExhaustiveStrategy = SubclassExhaustiveStrategy.RUNTIME_EXCEPTION)
public interface ProductCatalogEntityToResponseMapper {

    String STRING_TO_UUID = "stringToUuid";
    String ID = "id";

    @Mapping(target = ID, source = ID, qualifiedByName = STRING_TO_UUID)
    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    ProductCatalogResponseDTO productCatalogEntityToResponseDTO(Catalog createdCatalogEntity);

    @Named(STRING_TO_UUID)
    default UUID stringToUuid(String stringInput) {
        return UUID.fromString(stringInput);
    }
}
+0 −31
Original line number Diff line number Diff line
package org.etsi.osl.hypo.api.tmf.product.catalog.mapper;

import java.util.UUID;
import org.etsi.osl.hypo.api.tmf.product.catalog.model.ProductCategoryResponseDTO;
import org.etsi.osl.hypo.api.tmf.product.catalog.schema.Category;
import org.mapstruct.BeanMapping;
import org.mapstruct.InjectionStrategy;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
import org.mapstruct.NullValuePropertyMappingStrategy;
import org.mapstruct.SubclassExhaustiveStrategy;

@Mapper(
        componentModel = "cdi",
        injectionStrategy = InjectionStrategy.CONSTRUCTOR,
        subclassExhaustiveStrategy = SubclassExhaustiveStrategy.RUNTIME_EXCEPTION)
public interface ProductCategoryEntityToResponseMapper {

    String STRING_TO_UUID = "stringToUuid";
    String ID = "id";

    @Mapping(target = ID, source = ID, qualifiedByName = STRING_TO_UUID)
    @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
    ProductCategoryResponseDTO productCategoryEntityToResponseDTO(Category createdCatalogEntity);

    @Named(STRING_TO_UUID)
    default UUID stringToUuid(String stringInput) {
        return UUID.fromString(stringInput);
    }
}
Loading