Search in sources :

Example 6 with Organization

use of io.gravitee.repository.management.model.Organization in project gravitee-management-rest-api by gravitee-io.

the class OrganizationServiceImpl method findById.

@Override
public OrganizationEntity findById(String organizationId) {
    try {
        LOGGER.debug("Find organization by ID: {}", organizationId);
        Optional<Organization> optOrganization = organizationRepository.findById(organizationId);
        if (!optOrganization.isPresent()) {
            throw new OrganizationNotFoundException(organizationId);
        }
        return convert(optOrganization.get());
    } catch (TechnicalException ex) {
        LOGGER.error("An error occurs while trying to find organization by ID", ex);
        throw new TechnicalManagementException("An error occurs while trying to find organization by ID", ex);
    }
}
Also used : OrganizationNotFoundException(io.gravitee.rest.api.service.exceptions.OrganizationNotFoundException) Organization(io.gravitee.repository.management.model.Organization) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) TechnicalManagementException(io.gravitee.rest.api.service.exceptions.TechnicalManagementException)

Aggregations

Organization (io.gravitee.repository.management.model.Organization)6 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)5 OrganizationEntity (io.gravitee.rest.api.model.OrganizationEntity)3 UpdateOrganizationEntity (io.gravitee.rest.api.model.UpdateOrganizationEntity)3 TechnicalManagementException (io.gravitee.rest.api.service.exceptions.TechnicalManagementException)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Flow (io.gravitee.definition.model.flow.Flow)2 OrganizationRepository (io.gravitee.repository.management.api.OrganizationRepository)2 FlowReferenceType (io.gravitee.repository.management.model.flow.FlowReferenceType)2 FlowService (io.gravitee.rest.api.service.configuration.flow.FlowService)2 OrganizationNotFoundException (io.gravitee.rest.api.service.exceptions.OrganizationNotFoundException)2 OrganizationServiceImpl (io.gravitee.rest.api.service.impl.OrganizationServiceImpl)2 ArrayList (java.util.ArrayList)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Optional (java.util.Optional)2 Assert.assertNotNull (org.junit.Assert.assertNotNull)2 Test (org.junit.Test)2 RunWith (org.junit.runner.RunWith)2 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)2