Search in sources :

Example 11 with SubscriptionQuery

use of io.gravitee.rest.api.model.subscription.SubscriptionQuery in project gravitee-management-rest-api by gravitee-io.

the class ApplicationSubscribersResource method getSubscriberApisByApplicationId.

@GET
@Produces({ MediaType.APPLICATION_JSON })
public Response getSubscriberApisByApplicationId(@BeanParam PaginationParam paginationParam, @PathParam("applicationId") String applicationId, @QueryParam("statuses") List<SubscriptionStatus> statuses) {
    String currentUser = getAuthenticatedUserOrNull();
    Collection<ApplicationListItem> userApplications = applicationService.findByUser(currentUser);
    Optional<ApplicationListItem> optionalApplication = userApplications.stream().filter(a -> a.getId().equals(applicationId)).findFirst();
    if (optionalApplication.isPresent()) {
        SubscriptionQuery subscriptionQuery = new SubscriptionQuery();
        subscriptionQuery.setApplication(applicationId);
        subscriptionQuery.setStatuses(statuses);
        ApplicationListItem application = optionalApplication.get();
        if (!application.getPrimaryOwner().getId().equals(currentUser)) {
            Set<ApiEntity> userApis = this.apiService.findPublishedByUser(currentUser);
            if (userApis == null || userApis.isEmpty()) {
                return createListResponse(Collections.emptyList(), paginationParam);
            }
            subscriptionQuery.setApis(userApis.stream().map(ApiEntity::getId).collect(Collectors.toList()));
        }
        Map<String, Long> nbHitsByApp = getNbHitsByApplication(applicationId);
        Collection<SubscriptionEntity> subscriptions = subscriptionService.search(subscriptionQuery);
        List<Api> subscribersApis = subscriptions.stream().map(SubscriptionEntity::getApi).distinct().map(api -> apiService.findById(api)).map(apiMapper::convert).sorted((o1, o2) -> compareApp(nbHitsByApp, o1, o2)).collect(Collectors.toList());
        return createListResponse(subscribersApis, paginationParam);
    }
    throw new ApplicationNotFoundException(applicationId);
}
Also used : ApplicationListItem(io.gravitee.rest.api.model.application.ApplicationListItem) ApiEntity(io.gravitee.rest.api.model.api.ApiEntity) java.util(java.util) ApiMapper(io.gravitee.rest.api.portal.rest.mapper.ApiMapper) Api(io.gravitee.rest.api.portal.rest.model.Api) SubscriptionStatus(io.gravitee.rest.api.model.SubscriptionStatus) SubscriptionEntity(io.gravitee.rest.api.model.SubscriptionEntity) Instant(java.time.Instant) Collectors(java.util.stream.Collectors) GroupByQuery(io.gravitee.rest.api.model.analytics.query.GroupByQuery) Inject(javax.inject.Inject) SubscriptionService(io.gravitee.rest.api.service.SubscriptionService) MediaType(io.gravitee.common.http.MediaType) ChronoUnit(java.time.temporal.ChronoUnit) javax.ws.rs(javax.ws.rs) Response(javax.ws.rs.core.Response) PaginationParam(io.gravitee.rest.api.portal.rest.resource.param.PaginationParam) ApplicationService(io.gravitee.rest.api.service.ApplicationService) TopHitsAnalytics(io.gravitee.rest.api.model.analytics.TopHitsAnalytics) AnalyticsService(io.gravitee.rest.api.service.AnalyticsService) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) ApplicationNotFoundException(io.gravitee.rest.api.service.exceptions.ApplicationNotFoundException) ApiEntity(io.gravitee.rest.api.model.api.ApiEntity) SubscriptionEntity(io.gravitee.rest.api.model.SubscriptionEntity) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) ApplicationListItem(io.gravitee.rest.api.model.application.ApplicationListItem) ApplicationNotFoundException(io.gravitee.rest.api.service.exceptions.ApplicationNotFoundException) Api(io.gravitee.rest.api.portal.rest.model.Api)

Example 12 with SubscriptionQuery

use of io.gravitee.rest.api.model.subscription.SubscriptionQuery in project gravitee-management-rest-api by gravitee-io.

the class ApiSubscribersResource method getApiSubscribers.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "List subscribers for the API", notes = "User must have the MANAGE_SUBSCRIPTIONS permission to use this service")
@ApiResponses({ @ApiResponse(code = 200, message = "Paged result of API subscribers", response = ApplicationEntity.class, responseContainer = "List"), @ApiResponse(code = 500, message = "Internal server error") })
public Collection<ApplicationEntity> getApiSubscribers() {
    if (!hasPermission(RolePermission.API_SUBSCRIPTION, api, RolePermissionAction.READ) && !hasPermission(RolePermission.API_LOG, api, RolePermissionAction.READ)) {
        throw new ForbiddenAccessException();
    }
    SubscriptionQuery subscriptionQuery = new SubscriptionQuery();
    subscriptionQuery.setApi(api);
    Collection<SubscriptionEntity> subscriptions = subscriptionService.search(subscriptionQuery);
    return subscriptions.stream().map(SubscriptionEntity::getApplication).distinct().map(application -> applicationService.findById(application)).sorted((o1, o2) -> String.CASE_INSENSITIVE_ORDER.compare(o1.getName(), o2.getName())).collect(Collectors.toList());
}
Also used : RolePermissionAction(io.gravitee.rest.api.model.permissions.RolePermissionAction) PathParam(javax.ws.rs.PathParam) Context(javax.ws.rs.core.Context) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) Collection(java.util.Collection) ForbiddenAccessException(io.gravitee.rest.api.service.exceptions.ForbiddenAccessException) SubscriptionEntity(io.gravitee.rest.api.model.SubscriptionEntity) Collectors(java.util.stream.Collectors) Inject(javax.inject.Inject) SubscriptionService(io.gravitee.rest.api.service.SubscriptionService) MediaType(io.gravitee.common.http.MediaType) ResourceContext(javax.ws.rs.container.ResourceContext) ApplicationService(io.gravitee.rest.api.service.ApplicationService) io.swagger.annotations(io.swagger.annotations) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) ApplicationEntity(io.gravitee.rest.api.model.ApplicationEntity) RolePermission(io.gravitee.rest.api.model.permissions.RolePermission) SubscriptionEntity(io.gravitee.rest.api.model.SubscriptionEntity) ForbiddenAccessException(io.gravitee.rest.api.service.exceptions.ForbiddenAccessException) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 13 with SubscriptionQuery

use of io.gravitee.rest.api.model.subscription.SubscriptionQuery in project gravitee-management-rest-api by gravitee-io.

the class ApplicationSubscriptionsResource method getApplicationSubscriptions.

@GET
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "List subscriptions for the application", notes = "User must have the READ_SUBSCRIPTION permission to use this service")
@ApiResponses({ @ApiResponse(code = 200, message = "Paged result of application's subscriptions", response = PagedResult.class), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.APPLICATION_SUBSCRIPTION, acls = RolePermissionAction.READ) })
public PagedResult<SubscriptionEntity> getApplicationSubscriptions(@BeanParam SubscriptionParam subscriptionParam, @Valid @BeanParam Pageable pageable, @ApiParam(allowableValues = "keys", value = "Expansion of data to return in subscriptions") @QueryParam("expand") List<String> expand) {
    // Transform query parameters to a subscription query
    SubscriptionQuery subscriptionQuery = subscriptionParam.toQuery();
    subscriptionQuery.setApplication(application);
    Page<SubscriptionEntity> subscriptions = subscriptionService.search(subscriptionQuery, pageable.toPageable());
    if (expand != null && !expand.isEmpty()) {
        for (String e : expand) {
            switch(e) {
                case "keys":
                    subscriptions.getContent().forEach(subscriptionEntity -> {
                        final List<String> keys = apiKeyService.findBySubscription(subscriptionEntity.getId()).stream().filter(apiKeyEntity -> !apiKeyEntity.isExpired() && !apiKeyEntity.isRevoked()).map(ApiKeyEntity::getKey).collect(Collectors.toList());
                        subscriptionEntity.setKeys(keys);
                    });
                    break;
                default:
                    break;
            }
        }
    }
    PagedResult<SubscriptionEntity> result = new PagedResult<>(subscriptions, pageable.getSize());
    result.setMetadata(subscriptionService.getMetadata(subscriptions.getContent()).getMetadata());
    return result;
}
Also used : NewSubscriptionEntity(io.gravitee.rest.api.model.NewSubscriptionEntity) SubscriptionEntity(io.gravitee.rest.api.model.SubscriptionEntity) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) PagedResult(io.gravitee.rest.api.management.rest.model.PagedResult) Permissions(io.gravitee.rest.api.management.rest.security.Permissions)

Example 14 with SubscriptionQuery

use of io.gravitee.rest.api.model.subscription.SubscriptionQuery in project gravitee-management-rest-api by gravitee-io.

the class ApiServiceImpl method findApisByUser.

private List<Api> findApisByUser(String userId, ApiQuery apiQuery, boolean portal) {
    // get all public apis
    List<Api> publicApis;
    if (portal) {
        publicApis = apiRepository.search(queryToCriteria(apiQuery).visibility(PUBLIC).build());
    } else {
        publicApis = emptyList();
    }
    List<Api> userApis = emptyList();
    List<Api> groupApis = emptyList();
    List<Api> subscribedApis = emptyList();
    // for others API, user must be authenticated
    if (userId != null) {
        // get user apis
        final String[] userApiIds = membershipService.getMembershipsByMemberAndReference(MembershipMemberType.USER, userId, MembershipReferenceType.API).stream().map(MembershipEntity::getReferenceId).filter(apiId -> {
            if (apiQuery != null && !CollectionUtils.isEmpty(apiQuery.getIds())) {
                // We already have api ids to focus on.
                return apiQuery.getIds().contains(apiId);
            } else {
                return true;
            }
        }).toArray(String[]::new);
        if (userApiIds.length > 0) {
            userApis = apiRepository.search(queryToCriteria(apiQuery).ids(userApiIds).build());
        }
        // get user groups apis
        final String[] groupIds = membershipService.getMembershipsByMemberAndReference(MembershipMemberType.USER, userId, MembershipReferenceType.GROUP).stream().filter(m -> {
            final RoleEntity roleInGroup = roleService.findById(m.getRoleId());
            if (!portal) {
                return (m.getRoleId() != null && roleInGroup.getScope().equals(RoleScope.API) && canManageApi(roleInGroup.getPermissions()));
            }
            return m.getRoleId() != null && roleInGroup.getScope().equals(RoleScope.API);
        }).map(MembershipEntity::getReferenceId).toArray(String[]::new);
        if (groupIds.length > 0 && groupIds[0] != null) {
            groupApis = apiRepository.search(queryToCriteria(apiQuery).groups(groupIds).build());
        }
        // get user subscribed apis, useful when an API becomes private and an app owner is not anymore in members.
        if (portal) {
            final Set<String> applications = applicationService.findByUser(userId).stream().map(ApplicationListItem::getId).collect(toSet());
            if (!applications.isEmpty()) {
                final SubscriptionQuery query = new SubscriptionQuery();
                query.setApplications(applications);
                final Collection<SubscriptionEntity> subscriptions = subscriptionService.search(query);
                if (subscriptions != null && !subscriptions.isEmpty()) {
                    subscribedApis = apiRepository.search(queryToCriteria(apiQuery).ids(subscriptions.stream().map(SubscriptionEntity::getApi).distinct().toArray(String[]::new)).build());
                }
            }
        }
    }
    List<Api> allApis = new ArrayList<>();
    allApis.addAll(publicApis);
    allApis.addAll(userApis);
    allApis.addAll(groupApis);
    allApis.addAll(subscribedApis);
    return allApis.stream().distinct().collect(toList());
}
Also used : ApiHook(io.gravitee.rest.api.service.notification.ApiHook) EndpointDiscoveryService(io.gravitee.definition.model.services.discovery.EndpointDiscoveryService) Optional.of(java.util.Optional.of) Page(io.gravitee.common.data.domain.Page) Sortable(io.gravitee.rest.api.model.common.Sortable) HookScope(io.gravitee.rest.api.service.notification.HookScope) Autowired(org.springframework.beans.factory.annotation.Autowired) RoleScope(io.gravitee.rest.api.model.permissions.RoleScope) StringUtils(org.apache.commons.lang3.StringUtils) ApiCriteria(io.gravitee.repository.management.api.search.ApiCriteria) Matcher(java.util.regex.Matcher) AuditEvent(io.gravitee.repository.management.model.Api.AuditEvent) PageQuery(io.gravitee.rest.api.model.documentation.PageQuery) JsonNode(com.fasterxml.jackson.databind.JsonNode) EntrypointReferenceType(io.gravitee.rest.api.model.EntrypointReferenceType) ApplicationListItem(io.gravitee.rest.api.model.application.ApplicationListItem) RolePermissionAction(io.gravitee.rest.api.model.permissions.RolePermissionAction) IOUtils(org.apache.commons.io.IOUtils) Stream(java.util.stream.Stream) CollectionUtils(org.springframework.util.CollectionUtils) HealthCheckService(io.gravitee.definition.model.services.healthcheck.HealthCheckService) DatatypeConverter(javax.xml.bind.DatatypeConverter) java.util(java.util) GraviteeContext(io.gravitee.rest.api.service.common.GraviteeContext) Value(org.springframework.beans.factory.annotation.Value) Strings(com.google.common.base.Strings) ApiPrimaryOwnerMode(io.gravitee.rest.api.model.settings.ApiPrimaryOwnerMode) DRAFT(io.gravitee.rest.api.model.WorkflowState.DRAFT) NotificationTemplateService(io.gravitee.rest.api.service.notification.NotificationTemplateService) DefaultMetadataUpgrader(io.gravitee.rest.api.service.impl.upgrade.DefaultMetadataUpgrader) SWAGGER(io.gravitee.rest.api.model.PageType.SWAGGER) HttpEndpoint(io.gravitee.definition.model.endpoint.HttpEndpoint) MembershipMemberType(io.gravitee.rest.api.model.MembershipMemberType) PUBLIC(io.gravitee.repository.management.model.Visibility.PUBLIC) PageableImpl(io.gravitee.rest.api.model.common.PageableImpl) Query(io.gravitee.rest.api.service.search.query.Query) UuidString(io.gravitee.rest.api.service.common.UuidString) IOException(java.io.IOException) io.gravitee.definition.model(io.gravitee.definition.model) io.gravitee.rest.api.model.api(io.gravitee.rest.api.model.api) CronTrigger(org.springframework.scheduling.support.CronTrigger) MembershipReferenceType(io.gravitee.rest.api.model.MembershipReferenceType) GenericNotificationConfigEntity(io.gravitee.rest.api.model.notification.GenericNotificationConfigEntity) io.gravitee.repository.management.model(io.gravitee.repository.management.model) StringReader(java.io.StringReader) io.gravitee.rest.api.service.exceptions(io.gravitee.rest.api.service.exceptions) SearchResult(io.gravitee.rest.api.service.impl.search.SearchResult) REVIEW(io.gravitee.rest.api.model.WorkflowType.REVIEW) Plan(io.gravitee.definition.model.Plan) API(io.gravitee.rest.api.model.WorkflowReferenceType.API) Properties(io.gravitee.definition.model.Properties) URL(java.net.URL) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) LoggerFactory(org.slf4j.LoggerFactory) DeserializationFeature(com.fasterxml.jackson.databind.DeserializationFeature) ApiRepository(io.gravitee.repository.management.api.ApiRepository) Lifecycle(io.gravitee.common.component.Lifecycle) PatternSyntaxException(java.util.regex.PatternSyntaxException) ApiQualityRuleRepository(io.gravitee.repository.management.api.ApiQualityRuleRepository) Predicate(java.util.function.Predicate) ApiLifecycleState(io.gravitee.repository.management.model.ApiLifecycleState) MetadataFormat(io.gravitee.rest.api.model.MetadataFormat) Collectors(java.util.stream.Collectors) ApiFieldExclusionFilter(io.gravitee.repository.management.api.search.ApiFieldExclusionFilter) Key(io.gravitee.rest.api.model.parameters.Key) Api(io.gravitee.repository.management.model.Api) NotificationParamsBuilder(io.gravitee.rest.api.service.notification.NotificationParamsBuilder) EmailNotificationBuilder(io.gravitee.rest.api.service.builder.EmailNotificationBuilder) APIV1toAPIV2Converter(io.gravitee.rest.api.service.migration.APIV1toAPIV2Converter) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) Pattern(java.util.regex.Pattern) ApiHeaderEntity(io.gravitee.rest.api.model.api.header.ApiHeaderEntity) NotNull(org.jetbrains.annotations.NotNull) SystemRole(io.gravitee.rest.api.model.permissions.SystemRole) SearchEngineService(io.gravitee.rest.api.service.search.SearchEngineService) io.gravitee.rest.api.service(io.gravitee.rest.api.service) TagReferenceType(io.gravitee.rest.api.model.TagReferenceType) Pageable(io.gravitee.rest.api.model.common.Pageable) ImportConfiguration(io.gravitee.rest.api.service.spring.ImportConfiguration) ApiPermission(io.gravitee.rest.api.model.permissions.ApiPermission) Visibility(io.gravitee.repository.management.model.Visibility) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) EventType(io.gravitee.rest.api.model.EventType) io.gravitee.rest.api.model(io.gravitee.rest.api.model) Comparator.comparing(java.util.Comparator.comparing) PUBLISH_API(io.gravitee.rest.api.model.EventType.PUBLISH_API) ApiSynchronizationProcessor(io.gravitee.rest.api.service.processor.ApiSynchronizationProcessor) Step(io.gravitee.definition.model.flow.Step) AlertReferenceType(io.gravitee.rest.api.model.alert.AlertReferenceType) Logger(org.slf4j.Logger) ParameterReferenceType(io.gravitee.rest.api.model.parameters.ParameterReferenceType) MalformedURLException(java.net.MalformedURLException) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) FileInputStream(java.io.FileInputStream) AlertTriggerEntity(io.gravitee.rest.api.model.alert.AlertTriggerEntity) Component(org.springframework.stereotype.Component) INLINE(io.gravitee.rest.api.model.ImportSwaggerDescriptorEntity.Type.INLINE) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) AuditEvent(io.gravitee.repository.management.model.Workflow.AuditEvent) QueryBuilder(io.gravitee.rest.api.service.search.query.QueryBuilder) Collections(java.util.Collections) Api(io.gravitee.repository.management.model.Api) UuidString(io.gravitee.rest.api.service.common.UuidString) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery)

Example 15 with SubscriptionQuery

use of io.gravitee.rest.api.model.subscription.SubscriptionQuery in project gravitee-management-rest-api by gravitee-io.

the class ApplicationServiceImpl method update.

@Override
public ApplicationEntity update(String applicationId, UpdateApplicationEntity updateApplicationEntity) {
    try {
        LOGGER.debug("Update application {}", applicationId);
        if (updateApplicationEntity.getGroups() != null && !updateApplicationEntity.getGroups().isEmpty()) {
            // throw a NotFoundException if the group doesn't exist
            groupService.findByIds(updateApplicationEntity.getGroups());
        }
        Optional<Application> optApplicationToUpdate = applicationRepository.findById(applicationId);
        if (!optApplicationToUpdate.isPresent()) {
            throw new ApplicationNotFoundException(applicationId);
        }
        if (ApplicationStatus.ARCHIVED.equals(optApplicationToUpdate.get().getStatus())) {
            throw new ApplicationArchivedException(optApplicationToUpdate.get().getName());
        }
        // Check that only one settings is defined
        if (updateApplicationEntity.getSettings().getApp() != null && updateApplicationEntity.getSettings().getoAuthClient() != null) {
            throw new InvalidApplicationTypeException();
        }
        // Check that a type is defined
        if (updateApplicationEntity.getSettings().getApp() == null && updateApplicationEntity.getSettings().getoAuthClient() == null) {
            throw new InvalidApplicationTypeException();
        }
        // Update application metadata
        Map<String, String> metadata = new HashMap<>();
        // Update a simple application
        if (optApplicationToUpdate.get().getType() == ApplicationType.SIMPLE && updateApplicationEntity.getSettings().getApp() != null) {
            // If clientId is set, check for uniqueness
            String clientId = updateApplicationEntity.getSettings().getApp().getClientId();
            if (clientId != null && !clientId.trim().isEmpty()) {
                LOGGER.debug("Check that client_id is unique among all applications");
                final Set<Application> applications = applicationRepository.findAllByEnvironment(GraviteeContext.getCurrentEnvironment(), ApplicationStatus.ACTIVE);
                final Optional<Application> byClientId = applications.stream().filter(app -> app.getMetadata() != null && clientId.equals(app.getMetadata().get("client_id"))).findAny();
                if (byClientId.isPresent() && !byClientId.get().getId().equals(optApplicationToUpdate.get().getId())) {
                    LOGGER.error("An application already exists with the same client_id");
                    throw new ClientIdAlreadyExistsException(clientId);
                }
            }
        } else {
            // Check that client registration is enabled
            checkClientRegistrationEnabled();
            checkClientSettings(updateApplicationEntity.getSettings().getoAuthClient());
            // Update an OAuth client
            final String registrationPayload = optApplicationToUpdate.get().getMetadata().get("registration_payload");
            if (registrationPayload != null) {
                ClientRegistrationResponse registrationResponse = clientRegistrationService.update(registrationPayload, updateApplicationEntity);
                if (registrationResponse != null) {
                    try {
                        metadata.put("client_id", registrationResponse.getClientId());
                        metadata.put("registration_payload", mapper.writeValueAsString(registrationResponse));
                    } catch (JsonProcessingException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        Application application = convert(updateApplicationEntity);
        application.setId(applicationId);
        application.setEnvironmentId(optApplicationToUpdate.get().getEnvironmentId());
        application.setStatus(ApplicationStatus.ACTIVE);
        application.setType(optApplicationToUpdate.get().getType());
        application.setCreatedAt(optApplicationToUpdate.get().getCreatedAt());
        application.setUpdatedAt(new Date());
        metadata.forEach((key, value) -> application.getMetadata().put(key, value));
        Application updatedApplication = applicationRepository.update(application);
        // Audit
        auditService.createApplicationAuditLog(updatedApplication.getId(), Collections.emptyMap(), APPLICATION_UPDATED, updatedApplication.getUpdatedAt(), optApplicationToUpdate.get(), updatedApplication);
        // Set correct client_id for all subscriptions
        SubscriptionQuery subQuery = new SubscriptionQuery();
        subQuery.setApplication(applicationId);
        subQuery.setStatuses(Collections.singleton(SubscriptionStatus.ACCEPTED));
        subscriptionService.search(subQuery).forEach(new Consumer<SubscriptionEntity>() {

            @Override
            public void accept(SubscriptionEntity subscriptionEntity) {
                UpdateSubscriptionEntity updateSubscriptionEntity = new UpdateSubscriptionEntity();
                updateSubscriptionEntity.setId(subscriptionEntity.getId());
                updateSubscriptionEntity.setStartingAt(subscriptionEntity.getStartingAt());
                updateSubscriptionEntity.setEndingAt(subscriptionEntity.getEndingAt());
                subscriptionService.update(updateSubscriptionEntity, application.getMetadata().get("client_id"));
            }
        });
        return convert(Collections.singleton(updatedApplication)).iterator().next();
    } catch (TechnicalException ex) {
        LOGGER.error("An error occurs while trying to update application {}", applicationId, ex);
        throw new TechnicalManagementException(String.format("An error occurs while trying to update application %s", applicationId), ex);
    }
}
Also used : io.gravitee.rest.api.service(io.gravitee.rest.api.service) java.util(java.util) AuditEvent(io.gravitee.repository.management.model.Application.AuditEvent) Page(io.gravitee.common.data.domain.Page) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) ApplicationTypeService(io.gravitee.rest.api.service.configuration.application.ApplicationTypeService) LoggerFactory(org.slf4j.LoggerFactory) MembershipRepository(io.gravitee.repository.management.api.MembershipRepository) HookScope(io.gravitee.rest.api.service.notification.HookScope) Autowired(org.springframework.beans.factory.annotation.Autowired) GraviteeContext(io.gravitee.rest.api.service.common.GraviteeContext) RoleScope(io.gravitee.rest.api.model.permissions.RoleScope) Collections.singletonList(java.util.Collections.singletonList) ClientRegistrationService(io.gravitee.rest.api.service.configuration.application.ClientRegistrationService) io.gravitee.rest.api.model(io.gravitee.rest.api.model) ApplicationRepository(io.gravitee.repository.management.api.ApplicationRepository) Collectors.toSet(java.util.stream.Collectors.toSet) MembershipMemberType(io.gravitee.rest.api.model.MembershipMemberType) ApplicationHook(io.gravitee.rest.api.service.notification.ApplicationHook) ApplicationSettings(io.gravitee.rest.api.model.application.ApplicationSettings) OAuthClientSettings(io.gravitee.rest.api.model.application.OAuthClientSettings) ApplicationListItem(io.gravitee.rest.api.model.application.ApplicationListItem) UuidString(io.gravitee.rest.api.service.common.UuidString) Logger(org.slf4j.Logger) Collections.emptySet(java.util.Collections.emptySet) ParameterReferenceType(io.gravitee.rest.api.model.parameters.ParameterReferenceType) ApplicationTypeEntity(io.gravitee.rest.api.model.configuration.application.ApplicationTypeEntity) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) IOException(java.io.IOException) ClientRegistrationResponse(io.gravitee.rest.api.service.impl.configuration.application.registration.client.register.ClientRegistrationResponse) SimpleApplicationSettings(io.gravitee.rest.api.model.application.SimpleApplicationSettings) Key(io.gravitee.rest.api.model.parameters.Key) Consumer(java.util.function.Consumer) MembershipReferenceType(io.gravitee.rest.api.model.MembershipReferenceType) Collectors.toList(java.util.stream.Collectors.toList) ApplicationCriteria(io.gravitee.repository.management.api.search.ApplicationCriteria) GenericNotificationConfigEntity(io.gravitee.rest.api.model.notification.GenericNotificationConfigEntity) Component(org.springframework.stereotype.Component) io.gravitee.repository.management.model(io.gravitee.repository.management.model) io.gravitee.rest.api.service.exceptions(io.gravitee.rest.api.service.exceptions) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) NotNull(org.jetbrains.annotations.NotNull) DatatypeConverter(javax.xml.bind.DatatypeConverter) ClientRegistrationProviderEntity(io.gravitee.rest.api.model.configuration.application.registration.ClientRegistrationProviderEntity) SystemRole(io.gravitee.rest.api.model.permissions.SystemRole) TechnicalException(io.gravitee.repository.exceptions.TechnicalException) ClientRegistrationResponse(io.gravitee.rest.api.service.impl.configuration.application.registration.client.register.ClientRegistrationResponse) UuidString(io.gravitee.rest.api.service.common.UuidString) SubscriptionQuery(io.gravitee.rest.api.model.subscription.SubscriptionQuery) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

SubscriptionQuery (io.gravitee.rest.api.model.subscription.SubscriptionQuery)20 SubscriptionEntity (io.gravitee.rest.api.model.SubscriptionEntity)9 ApplicationListItem (io.gravitee.rest.api.model.application.ApplicationListItem)8 ApiEntity (io.gravitee.rest.api.model.api.ApiEntity)7 java.util (java.util)7 Collectors (java.util.stream.Collectors)7 SubscriptionService (io.gravitee.rest.api.service.SubscriptionService)5 MediaType (io.gravitee.common.http.MediaType)4 ApplicationService (io.gravitee.rest.api.service.ApplicationService)4 Inject (javax.inject.Inject)4 TechnicalException (io.gravitee.repository.exceptions.TechnicalException)3 io.gravitee.rest.api.model (io.gravitee.rest.api.model)3 PageableImpl (io.gravitee.rest.api.model.common.PageableImpl)3 RolePermissionAction (io.gravitee.rest.api.model.permissions.RolePermissionAction)3 io.gravitee.rest.api.service (io.gravitee.rest.api.service)3 GraviteeContext (io.gravitee.rest.api.service.common.GraviteeContext)3 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Page (io.gravitee.common.data.domain.Page)2 io.gravitee.repository.management.model (io.gravitee.repository.management.model)2