Search in sources :

Example 1 with ApplicationEvent

use of org.wso2.carbon.apimgt.core.models.events.ApplicationEvent in project carbon-apimgt by wso2.

the class MappingUtil method convertToApplicationDtoList.

/**
 * convert {@link ApplicationDTO} to {@link Application}
 *
 * @param applicationList List of {@link Application}
 * @return ApplicationEvent list
 */
public static List<ApplicationDTO> convertToApplicationDtoList(List<Application> applicationList) {
    List<ApplicationDTO> applicationDTOList = new ArrayList<>();
    for (Application application : applicationList) {
        ApplicationDTO applicationDTO = new ApplicationDTO();
        applicationDTO.setName(application.getName());
        applicationDTO.setApplicationId(application.getId());
        applicationDTO.setThrottlingTier(application.getPolicy().getUuid());
        applicationDTO.setSubscriber(application.getCreatedUser());
        applicationDTOList.add(applicationDTO);
    }
    return applicationDTOList;
}
Also used : ApplicationDTO(org.wso2.carbon.apimgt.rest.api.core.dto.ApplicationDTO) ArrayList(java.util.ArrayList) Application(org.wso2.carbon.apimgt.core.models.Application)

Example 2 with ApplicationEvent

use of org.wso2.carbon.apimgt.core.models.events.ApplicationEvent in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method deleteApplication.

@Override
public void deleteApplication(String applicationId) throws GatewayException {
    if (applicationId != null) {
        ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_DELETE);
        applicationEvent.setApplicationId(applicationId);
        publishToStoreTopic(applicationEvent);
        if (log.isDebugEnabled()) {
            log.debug("Application : " + applicationId + " deleted event has been successfully published " + "to broker");
        }
    }
}
Also used : ApplicationEvent(org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)

Example 3 with ApplicationEvent

use of org.wso2.carbon.apimgt.core.models.events.ApplicationEvent in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method updateApplication.

@Override
public void updateApplication(Application application) throws GatewayException {
    if (application != null) {
        ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_UPDATE);
        applicationEvent.setApplicationId(application.getId());
        applicationEvent.setName(application.getName());
        applicationEvent.setThrottlingTier(application.getPolicy().getUuid());
        applicationEvent.setSubscriber(application.getCreatedUser());
        publishToStoreTopic(applicationEvent);
        if (log.isDebugEnabled()) {
            log.debug("Application : " + application.getName() + " updated event has been successfully published " + "to broker");
        }
    }
}
Also used : ApplicationEvent(org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)

Example 4 with ApplicationEvent

use of org.wso2.carbon.apimgt.core.models.events.ApplicationEvent in project carbon-apimgt by wso2.

the class APIGatewayPublisherImpl method addApplication.

@Override
public void addApplication(Application application) throws GatewayException {
    if (application != null) {
        ApplicationEvent applicationEvent = new ApplicationEvent(APIMgtConstants.GatewayEventTypes.APPLICATION_CREATE);
        applicationEvent.setApplicationId(application.getId());
        applicationEvent.setName(application.getName());
        applicationEvent.setThrottlingTier(application.getPolicy().getUuid());
        applicationEvent.setSubscriber(application.getCreatedUser());
        publishToStoreTopic(applicationEvent);
        if (log.isDebugEnabled()) {
            log.debug("Application : " + application.getName() + " created event has been successfully published " + "to broker");
        }
    }
}
Also used : ApplicationEvent(org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)

Example 5 with ApplicationEvent

use of org.wso2.carbon.apimgt.core.models.events.ApplicationEvent in project carbon-apimgt by wso2.

the class MappingUtil method toApplicationDto.

/**
 * This method convert Application model to ApplicationEvent
 * @param application Contains application data
 * @return DTO containing application data
 */
public static ApplicationDTO toApplicationDto(Application application) {
    ApplicationDTO applicationDTO = new ApplicationDTO();
    applicationDTO.setApplicationId(application.getId());
    applicationDTO.setDescription(application.getDescription());
    applicationDTO.setName(application.getName());
    applicationDTO.setSubscriber(application.getCreatedUser());
    if (application.getPolicy() != null) {
        applicationDTO.setThrottlingTier(application.getPolicy().getPolicyName());
    }
    return applicationDTO;
}
Also used : ApplicationDTO(org.wso2.carbon.apimgt.rest.api.publisher.dto.ApplicationDTO)

Aggregations

ApplicationEvent (org.wso2.carbon.apimgt.core.models.events.ApplicationEvent)3 ArrayList (java.util.ArrayList)1 Application (org.wso2.carbon.apimgt.core.models.Application)1 ApplicationDTO (org.wso2.carbon.apimgt.rest.api.core.dto.ApplicationDTO)1 ApplicationDTO (org.wso2.carbon.apimgt.rest.api.publisher.dto.ApplicationDTO)1