Search in sources :

Example 1 with AppInfoChangedEvent

use of com.ctrip.framework.apollo.portal.listener.AppInfoChangedEvent in project apollo by ctripcorp.

the class AppController method update.

@PreAuthorize(value = "@permissionValidator.isAppAdmin(#appId)")
@PutMapping("/{appId:.+}")
public void update(@PathVariable String appId, @Valid @RequestBody AppModel appModel) {
    if (!Objects.equals(appId, appModel.getAppId())) {
        throw new BadRequestException("The App Id of path variable and request body is different");
    }
    App app = transformToApp(appModel);
    App updatedApp = appService.updateAppInLocal(app);
    publisher.publishEvent(new AppInfoChangedEvent(updatedApp));
}
Also used : App(com.ctrip.framework.apollo.common.entity.App) AppInfoChangedEvent(com.ctrip.framework.apollo.portal.listener.AppInfoChangedEvent) BadRequestException(com.ctrip.framework.apollo.common.exception.BadRequestException) PutMapping(org.springframework.web.bind.annotation.PutMapping) PreAuthorize(org.springframework.security.access.prepost.PreAuthorize)

Aggregations

App (com.ctrip.framework.apollo.common.entity.App)1 BadRequestException (com.ctrip.framework.apollo.common.exception.BadRequestException)1 AppInfoChangedEvent (com.ctrip.framework.apollo.portal.listener.AppInfoChangedEvent)1 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)1 PutMapping (org.springframework.web.bind.annotation.PutMapping)1