use of com.ctrip.framework.apollo.common.dto.AppDTO in project apollo by ctripcorp.
the class CreationListener method onAppCreationEvent.
@EventListener
public void onAppCreationEvent(AppCreationEvent event) {
AppDTO appDTO = BeanUtils.transform(AppDTO.class, event.getApp());
List<Env> envs = portalSettings.getActiveEnvs();
for (Env env : envs) {
try {
appAPI.createApp(env, appDTO);
} catch (Throwable e) {
LOGGER.error("Create app failed. appId = {}, env = {})", appDTO.getAppId(), env, e);
Tracer.logError(String.format("Create app failed. appId = %s, env = %s", appDTO.getAppId(), env), e);
}
}
}
use of com.ctrip.framework.apollo.common.dto.AppDTO in project apollo by ctripcorp.
the class AppService method createAppInRemote.
public void createAppInRemote(Env env, App app) {
if (StringUtils.isBlank(app.getDataChangeCreatedBy())) {
String username = userInfoHolder.getUser().getUserId();
app.setDataChangeCreatedBy(username);
app.setDataChangeLastModifiedBy(username);
}
AppDTO appDTO = BeanUtils.transform(AppDTO.class, app);
appAPI.createApp(env, appDTO);
}
use of com.ctrip.framework.apollo.common.dto.AppDTO in project apollo by ctripcorp.
the class AppInfoChangedListener method onAppInfoChange.
@EventListener
public void onAppInfoChange(AppInfoChangedEvent event) {
AppDTO appDTO = BeanUtils.transform(AppDTO.class, event.getApp());
String appId = appDTO.getAppId();
List<Env> envs = portalSettings.getActiveEnvs();
for (Env env : envs) {
try {
appAPI.updateApp(env, appDTO);
} catch (Throwable e) {
logger.error("Update app's info failed. Env = {}, AppId = {}", env, appId, e);
Tracer.logError(String.format("Update app's info failed. Env = %s, AppId = %s", env, appId), e);
}
}
}
use of com.ctrip.framework.apollo.common.dto.AppDTO in project apollo by ctripcorp.
the class DeletionListener method onAppDeletionEvent.
@EventListener
public void onAppDeletionEvent(AppDeletionEvent event) {
AppDTO appDTO = BeanUtils.transform(AppDTO.class, event.getApp());
String appId = appDTO.getAppId();
String operator = appDTO.getDataChangeLastModifiedBy();
List<Env> envs = portalSettings.getActiveEnvs();
for (Env env : envs) {
try {
appAPI.deleteApp(env, appId, operator);
} catch (Throwable e) {
logger.error("Delete app failed. Env = {}, AppId = {}", env, appId, e);
Tracer.logError(String.format("Delete app failed. Env = %s, AppId = %s", env, appId), e);
}
}
}
use of com.ctrip.framework.apollo.common.dto.AppDTO in project apollo by ctripcorp.
the class ControllerIntegrationExceptionTest method generateSampleDTOData.
private AppDTO generateSampleDTOData() {
AppDTO dto = new AppDTO();
dto.setAppId("someAppId");
dto.setName("someName");
dto.setOwnerName("someOwner");
dto.setOwnerEmail("someOwner@ctrip.com");
return dto;
}
Aggregations