Skip to content

Commit

Permalink
Fixed about 350 warns.
Browse files Browse the repository at this point in the history
  • Loading branch information
Acarus committed Oct 1, 2016
1 parent f688c74 commit 383663f
Show file tree
Hide file tree
Showing 11 changed files with 859 additions and 422 deletions.
Expand Up @@ -36,6 +36,11 @@ public EcfVersionsDataProvider(AbstractGrid<EventClassFamilyVersionDto, Integer>
super(dataGrid, hasErrorMessage);
}

/**
* Sets the event class family version list.
*
* @param schemas schema list
*/
public void setSchemas(List<EventClassFamilyVersionDto> schemas) {
this.schemas.clear();
if (schemas != null) {
Expand Down
Expand Up @@ -67,7 +67,7 @@ public abstract class AbstractAdminController {
* The kaa admin UI service.
*/
@Autowired
AdminUiService adminUIService;
AdminUiService adminUiService;

/**
* The kaa application service.
Expand Down Expand Up @@ -184,12 +184,14 @@ protected byte[] getFileContent(MultipartFile file) throws KaaAdminServiceExcept
LOG.debug("Uploading file with name '{}'", file.getOriginalFilename());
try {
return file.getBytes();
} catch (IOException e) {
throw Utils.handleException(e);
} catch (IOException ex) {
throw Utils.handleException(ex);
}
} else {
LOG.error("No file found in post request!");
throw new KaaAdminServiceException("No file found in post request!", ServiceErrorCode.FILE_NOT_FOUND);
throw new KaaAdminServiceException(
"No file found in post request!",
ServiceErrorCode.FILE_NOT_FOUND);
}
}

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Expand Up @@ -44,7 +44,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Api(value = "SDK profiles", description = "Provides function for manage SDK profiles", basePath = "/kaaAdmin/rest")
@Api(value = "SDK profiles",
description = "Provides function for manage SDK profiles",
basePath = "/kaaAdmin/rest")
@Controller
public class SdkController extends AbstractAdminController {

Expand All @@ -61,17 +63,24 @@ public class SdkController extends AbstractAdminController {
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Create SDK profile",
notes = "Creates an SDK profile for further endpoint SDK generation. (Requires TENANT_DEVELOPER or TENANT_USER to perform this operation).")
notes = "Creates an SDK profile for further endpoint SDK generation. "
+ "(Requires TENANT_DEVELOPER or TENANT_USER to perform this operation).")
@ApiResponses(value = {
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the required role "
+ "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID "
+ "of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "createSdkProfile", method = RequestMethod.POST)
@ResponseBody
public SdkProfileDto createSdkProfile(
@ApiParam(name = "sdkProfile", value = "SdkProfileDto body. Mandatory fields: applicationId, configurationSchemaVersion, logSchemaVersion, " +
"notificationSchemaVersion, profileSchemaVersion, name", required = true)
@ApiParam(name = "sdkProfile",
value = "SdkProfileDto body. Mandatory fields: applicationId, "
+ "configurationSchemaVersion, logSchemaVersion, "
+ "notificationSchemaVersion, profileSchemaVersion, name",
required = true)
@RequestBody SdkProfileDto sdkProfile) throws KaaAdminServiceException {
return sdkService.createSdkProfile(sdkProfile);
}
Expand All @@ -83,18 +92,25 @@ public SdkProfileDto createSdkProfile(
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Delete SDK profile",
notes = "Deletes an SDK profile from the database. (Requires TENANT_DEVELOPER or TENANT_USER to perform this operation).")
notes = "Deletes an SDK profile from the database. "
+ "(Requires TENANT_DEVELOPER or TENANT_USER to perform this operation).")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid sdkProfileId supplied"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "The SDK profile with the specified sdkProfileId does not exist"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the required role "
+ "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID "
+ "of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404,
message = "The SDK profile with the specified sdkProfileId does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "deleteSdkProfile", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void deleteSdkProfile(
@ApiParam(name = "sdkProfileId", value = "A unique SDK profile identifier", required = true)
@ApiParam(name = "sdkProfileId",
value = "A unique SDK profile identifier",
required = true)
@RequestParam(value = "sdkProfileId") String sdkProfileId) throws KaaAdminServiceException {
sdkService.deleteSdkProfile(sdkProfileId);
}
Expand All @@ -107,17 +123,23 @@ public void deleteSdkProfile(
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Get SDK profiles for application",
notes = "Returns a list of SDK profiles for the given application. (Requires TENANT_DEVELOPER or TENANT_USER to request this information).")
notes = "Returns a list of SDK profiles for the given application. "
+ "(Requires TENANT_DEVELOPER or TENANT_USER to request this information).")
@ApiResponses(value = {
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the required role "
+ "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID "
+ "of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "The application with the specified ID does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "sdkProfiles/{applicationToken}")
@ResponseBody
public List<SdkProfileDto> getSdkProfilesByApplicationToken(
@ApiParam(name = "applicationToken", value = "A unique auto-generated application identifier", required = true)
@ApiParam(name = "applicationToken",
value = "A unique auto-generated application identifier",
required = true)
@PathVariable String applicationToken) throws KaaAdminServiceException {
return sdkService.getSdkProfilesByApplicationToken(applicationToken);
}
Expand All @@ -130,12 +152,16 @@ public List<SdkProfileDto> getSdkProfilesByApplicationToken(
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Get specific SDK profile",
notes = "Returns the SDK profile by its identifier. (Requires TENANT_DEVELOPER or TENANT_USER to request this information).")
notes = "Returns the SDK profile by its identifier. (Requires TENANT_DEVELOPER or "
+ "TENANT_USER to request this information).")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid sdkProfileId supplied"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the required role "
+ "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID "
+ "of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "The SDK profile with the specified ID does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "sdkProfile/{sdkProfileId}")
Expand All @@ -156,34 +182,44 @@ public SdkProfileDto getSdkProfile(
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Generate endpoint SDK",
notes = "Generates the endpoint SDK based on the SDK profile. (Requires TENANT_DEVELOPER or TENANT_USER to perform this operation). For android " +
"or java client file extension must be .jar, for other platforms extension must be .tar.gz.")
notes = "Generates the endpoint SDK based on the SDK profile. "
+ "(Requires TENANT_DEVELOPER or TENANT_USER to perform this operation). For android "
+ "or java client file extension must be .jar, for other platforms "
+ "extension must be .tar.gz.")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "An unknown target platform was specified"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the required role (TENANT_DEVELOPER or TENANT_USER) or the Tenant ID " +
"of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the required role "
+ "(TENANT_DEVELOPER or TENANT_USER) or the Tenant ID "
+ "of the application does not match the Tenant ID of the authenticated user"),
@ApiResponse(code = 404, message = "The SDK profile with the given ID does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "sdk", method = RequestMethod.POST)
@ResponseStatus(value = HttpStatus.OK)
public void getSdk(
@ApiParam(name = "sdkProfileId", value = "A unique SDK profile identifier", required = true)
@RequestParam(value = "sdkProfileId") String sdkProfileId,
@ApiParam(name = "targetPlatform", value = "The target platform's name (either JAVA, ANDROID, CPP, C or OBJC)", required = true)
@RequestParam(value = "targetPlatform") String targetPlatform, HttpServletRequest request, HttpServletResponse response)
@ApiParam(name = "targetPlatform",
value = "The target platform's name (either JAVA, ANDROID, CPP, C or OBJC)",
required = true)
@RequestParam(value = "targetPlatform") String targetPlatform,
HttpServletRequest request,
HttpServletResponse response)
throws KaaAdminServiceException {
try {
SdkProfileDto sdkProfile = sdkService.getSdkProfile(sdkProfileId);
FileData sdkData = sdkService.getSdk(sdkProfile, SdkPlatform.valueOf(targetPlatform.toUpperCase()));
FileData sdkData = sdkService.getSdk(
sdkProfile, SdkPlatform.valueOf(targetPlatform.toUpperCase()));
response.setContentType(sdkData.getContentType());
ServletUtils.prepareDisposition(request, response, sdkData.getFileName());
response.setContentLength(sdkData.getFileData().length);
response.setBufferSize(BUFFER);
response.getOutputStream().write(sdkData.getFileData());
response.flushBuffer();
} catch (Exception e) {
throw Utils.handleException(e);
} catch (Exception ex) {
throw Utils.handleException(ex);
}
}

Expand All @@ -197,8 +233,8 @@ public void getSdk(
public void flushSdkCache() throws KaaAdminServiceException {
try {
sdkService.flushSdkCache();
} catch (Exception e) {
throw Utils.handleException(e);
} catch (Exception ex) {
throw Utils.handleException(ex);
}
}

Expand All @@ -211,7 +247,8 @@ public void flushSdkCache() throws KaaAdminServiceException {
*/
@RequestMapping(value = "schemaVersions/{applicationToken}", method = RequestMethod.GET)
@ResponseBody
public SchemaVersions getSchemaVersionsByApplicationToken(@PathVariable String applicationToken) throws KaaAdminServiceException {
public SchemaVersions getSchemaVersionsByApplicationToken(@PathVariable String applicationToken)
throws KaaAdminServiceException {
return sdkService.getSchemaVersionsByApplicationToken(applicationToken);
}

Expand Down
Expand Up @@ -36,7 +36,9 @@

import javax.validation.Valid;

@Api(value = "Tenant", description = "Provides function for manage tenants", basePath = "/kaaAdmin/rest")
@Api(value = "Tenant",
description = "Provides function for manage tenants",
basePath = "/kaaAdmin/rest")
@Controller
public class TenantController extends AbstractAdminController {

Expand All @@ -47,10 +49,13 @@ public class TenantController extends AbstractAdminController {
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Get all tenants",
notes = "Returns all tenants existing in the system. Only users with the KAA_ADMIN role are allowed to submit this request.")
notes = "Returns all tenants existing in the system. Only users with "
+ "the KAA_ADMIN role are allowed to submit this request.")
@ApiResponses(value = {
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "tenants", method = RequestMethod.GET)
@ResponseBody
Expand All @@ -66,11 +71,14 @@ public List<TenantDto> getTenants() throws KaaAdminServiceException {
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Get tenant",
notes = "Returns tenant by associated userId. Only users with the KAA_ADMIN role are allowed to submit this request.")
notes = "Returns tenant by associated userId. Only users with the "
+ "KAA_ADMIN role are allowed to submit this request.")
@ApiResponses(value = {
@ApiResponse(code = 400, message = "Invalid userId supplied"),
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 404, message = "A tenant with the specified userId does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "tenant/{userId}", method = RequestMethod.GET)
Expand All @@ -89,21 +97,26 @@ public TenantDto getTenant(
* @throws KaaAdminServiceException the kaa admin service exception
*/
@ApiOperation(value = "Create/Edit tenant",
notes = "Creates or edits a tenant. If a tenant with the specified ID does not exist, it will be created. If a tenant with the specified ID " +
"exists, it will be updated. Only users with the KAA_ADMIN role are allowed to submit this request.")
notes = "Creates or edits a tenant. If a tenant with the specified ID does not exist, "
+ "it will be created. If a tenant with the specified ID "
+ "exists, it will be updated. Only users with the KAA_ADMIN "
+ "role are allowed to submit this request.")
@ApiResponses(value = {
@ApiResponse(code = 401, message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403, message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 401,
message = "The user is not authenticated or invalid credentials were provided"),
@ApiResponse(code = 403,
message = "The authenticated user does not have the KAA_ADMIN role"),
@ApiResponse(code = 404, message = "A tenant with the specified user ID does not exist"),
@ApiResponse(code = 500, message = "An unexpected error occurred on the server side")})
@RequestMapping(value = "tenant", method = RequestMethod.POST)
@ResponseBody
public TenantDto editTenant(@Valid @RequestBody TenantDto tenantUser) throws KaaAdminServiceException {
public TenantDto editTenant(@Valid @RequestBody TenantDto tenantUser)
throws KaaAdminServiceException {
try {
TenantDto tenant = tenantService.editTenant(tenantUser);
return tenant;
} catch (Exception e) {
throw Utils.handleException(e);
} catch (Exception ex) {
throw Utils.handleException(ex);
}
}
}

0 comments on commit 383663f

Please sign in to comment.