Skip to content

Commit

Permalink
KAA-1145: Quick fix for message of logging and name of method 'editNo…
Browse files Browse the repository at this point in the history
…tificationSchema'.
  • Loading branch information
vchizhevsky committed Jul 20, 2016
1 parent a637227 commit 407ef02
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 23 deletions.
Expand Up @@ -252,13 +252,11 @@ public ServerProfileSchemaDto saveServerProfileSchema(ServerProfileSchemaDto ser
}

public NotificationSchemaDto createNotificationSchema(NotificationSchemaDto notificationSchema) throws Exception {
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>();
params.add("notificationSchema", notificationSchema);
return restTemplate.postForObject(restTemplate.getUrl() + "createNotificationSchema", params, NotificationSchemaDto.class);
return restTemplate.postForObject(restTemplate.getUrl() + "createNotificationSchema", notificationSchema, NotificationSchemaDto.class);
}

public NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notificationSchema) throws Exception {
return restTemplate.postForObject(restTemplate.getUrl() + "editNotificationSchema", notificationSchema, NotificationSchemaDto.class);
public NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws Exception {
return restTemplate.postForObject(restTemplate.getUrl() + "saveNotificationSchema", notificationSchema, NotificationSchemaDto.class);
}

public LogSchemaDto createLogSchema(LogSchemaDto logSchema, String schemaResource) throws Exception {
Expand Down
Expand Up @@ -279,7 +279,7 @@ private NotificationSchemaDto createDefaultNotificationSchema(String appId, Stri
notificationSchemaDto.setType(NotificationTypeDto.USER);
notificationSchemaDto = notificationService.saveNotificationSchema(notificationSchemaDto);
if (notificationSchemaDto == null) {
throw new RuntimeException("Can't save default profile schema "); //NOSONAR
throw new RuntimeException("Can't save default notification schema "); //NOSONAR
}
return notificationSchemaDto;
}
Expand Down
Expand Up @@ -1157,10 +1157,10 @@ public NotificationSchemaDto getNotificationSchema(@PathVariable String notifica
* @throws KaaAdminServiceException
* the kaa admin service exception
*/
@RequestMapping(value = "createNotificationSchema", method = RequestMethod.POST, consumes = { "multipart/mixed", "multipart/form-data" })
@RequestMapping(value = "createNotificationSchema", method = RequestMethod.POST)
@ResponseBody
public NotificationSchemaDto createNotificationSchema(@RequestPart("notificationSchema") NotificationSchemaDto notificationSchema) throws KaaAdminServiceException {
return kaaAdminService.editNotificationSchema(notificationSchema);
public NotificationSchemaDto createNotificationSchema(@RequestBody NotificationSchemaDto notificationSchema) throws KaaAdminServiceException {
return kaaAdminService.saveNotificationSchema(notificationSchema);
}

/**
Expand All @@ -1172,11 +1172,11 @@ public NotificationSchemaDto createNotificationSchema(@RequestPart("notification
* @throws KaaAdminServiceException
* the kaa admin service exception
*/
@RequestMapping(value = "editNotificationSchema", method = RequestMethod.POST)
@RequestMapping(value = "saveNotificationSchema", method = RequestMethod.POST)
@ResponseBody
public NotificationSchemaDto editNotificationSchema(@RequestBody NotificationSchemaDto notificationSchema)
public NotificationSchemaDto saveNotificationSchema(@RequestBody NotificationSchemaDto notificationSchema)
throws KaaAdminServiceException {
return kaaAdminService.editNotificationSchema(notificationSchema);
return kaaAdminService.saveNotificationSchema(notificationSchema);
}

/**
Expand Down
Expand Up @@ -1506,12 +1506,11 @@ public List<SchemaInfoDto> getUserNotificationSchemaInfosByApplicationId(String
}
}

@Override
public NotificationSchemaViewDto getNotificationSchemaView(String notificationSchemaId) throws KaaAdminServiceException {
checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
try {
NotificationSchemaDto notificationSchema = controlService.getNotificationSchema(notificationSchemaId);
Utils.checkNotNull(notificationSchema);
checkApplicationId(notificationSchema.getApplicationId());
NotificationSchemaDto notificationSchema = getNotificationSchema(notificationSchemaId);
CTLSchemaDto ctlSchemaDto = controlService.getCTLSchemaById(notificationSchema.getCtlSchemaId());
NotificationSchemaViewDto notificationSchemaViewDto = new NotificationSchemaViewDto(notificationSchema, toCtlSchemaForm(ctlSchemaDto));
return notificationSchemaViewDto;
Expand All @@ -1520,6 +1519,7 @@ public NotificationSchemaViewDto getNotificationSchemaView(String notificationSc
}
}

@Override
public NotificationSchemaDto getNotificationSchema(String notificationSchemaId) throws KaaAdminServiceException {
checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
try {
Expand All @@ -1533,7 +1533,7 @@ public NotificationSchemaDto getNotificationSchema(String notificationSchemaId)
}

@Override
public NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notificationSchema)
public NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema)
throws KaaAdminServiceException {
checkAuthority(KaaAuthorityDto.TENANT_DEVELOPER, KaaAuthorityDto.TENANT_USER);
try {
Expand All @@ -1546,7 +1546,7 @@ public NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notifi
checkApplicationId(storedNotificationSchema.getApplicationId());
}
notificationSchema.setType(NotificationTypeDto.USER);
return controlService.editNotificationSchema(notificationSchema);
return controlService.saveNotificationSchema(notificationSchema);
} catch (Exception e) {
throw Utils.handleException(e);
}
Expand All @@ -1573,7 +1573,7 @@ public NotificationSchemaViewDto saveNotificationSchemaView(NotificationSchemaVi
notificationSchema.setCtlSchemaId(ctlSchemaForm.getId());
}
}
NotificationSchemaDto savedNotificationSchema = editNotificationSchema(notificationSchema);
NotificationSchemaDto savedNotificationSchema = saveNotificationSchema(notificationSchema);
return getNotificationSchemaView(savedNotificationSchema.getId());
} catch (Exception e) {
throw Utils.handleException(e);
Expand All @@ -1592,7 +1592,7 @@ public NotificationSchemaViewDto createNotificationSchemaFormCtlSchema(CtlSchema
notificationSchema.setDescription(ctlSchemaForm.getSchema().getDescriptionFieldValue());
CtlSchemaFormDto savedCtlSchemaForm = saveCTLSchemaForm(ctlSchemaForm);
notificationSchema.setCtlSchemaId(savedCtlSchemaForm.getId());
NotificationSchemaDto savedNotificationSchema = editNotificationSchema(notificationSchema);
NotificationSchemaDto savedNotificationSchema = saveNotificationSchema(notificationSchema);
return getNotificationSchemaView(savedNotificationSchema.getId());
} catch (Exception e) {
throw Utils.handleException(e);
Expand Down
Expand Up @@ -207,7 +207,7 @@ public interface KaaAdminService extends RemoteService {

NotificationSchemaViewDto getNotificationSchemaView(String notificationSchemaId) throws KaaAdminServiceException;

NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notificationSchema) throws KaaAdminServiceException;
NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws KaaAdminServiceException;

NotificationSchemaViewDto saveNotificationSchemaView(NotificationSchemaViewDto notificationSchema) throws KaaAdminServiceException;

Expand Down
Expand Up @@ -728,7 +728,7 @@ void deleteProfileFilterRecord(String endpointProfileSchemaId, String serverProf
* @throws ControlServiceException
* the control service exception
*/
NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException;
NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException;

/**
* Gets the notification schema.
Expand Down
Expand Up @@ -1062,7 +1062,7 @@ public FileData generateSdk(SdkProfileDto sdkProfile, SdkPlatform platform) thro

CTLSchemaDto notificationCtlSchema = ctlService.findCTLSchemaById(notificationSchema.getCtlSchemaId());
if (notificationCtlSchema == null) {
throw new NotFoundException("Profile CTL schema not found!");
throw new NotFoundException("Notification CTL schema not found!");
}
String notificationSchemaBodyString = ctlService.flatExportAsString(notificationCtlSchema);

Expand Down Expand Up @@ -1149,7 +1149,7 @@ public FileData generateRecordStructureLibrary(String applicationId, int logSche
* (org.kaaproject.kaa.common.dto.NotificationSchemaDto)
*/
@Override
public NotificationSchemaDto editNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException {
public NotificationSchemaDto saveNotificationSchema(NotificationSchemaDto notificationSchema) throws ControlServiceException {
return notificationService.saveNotificationSchema(notificationSchema);
}

Expand Down

0 comments on commit 407ef02

Please sign in to comment.