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;
}
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");
}
}
}
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");
}
}
}
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");
}
}
}
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;
}
Aggregations