added 'updateNotificationStatus' endpoint and minor formattings to swagger annotations

revert-70aa11f8
madhawap 9 years ago
parent f100853031
commit dbf938416b

@ -91,7 +91,10 @@ public interface ActivityInfoProviderService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching activity data.",
response = ErrorResponse.class)
})
@Permission(scope = "activity-view", permissions = {"/permission/admin/device-mgt/admin/activities/view"})
@Permission(
scope = "activity-view",
permissions = {"/permission/admin/device-mgt/admin/activities/view"}
)
Response getActivity(
@ApiParam(
name = "id",
@ -147,7 +150,10 @@ public interface ActivityInfoProviderService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching activity data.",
response = ErrorResponse.class)
})
@Permission(scope = "activity-view", permissions = {"/permission/admin/device-mgt/admin/activities/view"})
@Permission(
scope = "activity-view",
permissions = {"/permission/admin/device-mgt/admin/activities/view"}
)
Response getActivities(
@ApiParam(
name = "since",

@ -47,7 +47,8 @@ public interface ConfigurationManagementService {
value = "Get the general platform configurations.",
notes = "Get the general platform level configuration details.",
tags = "Configuration Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched general platform configuration.",
@ -65,7 +66,8 @@ public interface ConfigurationManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ -77,15 +79,19 @@ public interface ConfigurationManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the general " +
"platform configuration.",
response = ErrorResponse.class)
})
@Permission(scope = "configuration-view",
permissions = {"/permission/admin/device-mgt/admin/platform-configs/view"})
}
)
@Permission(
scope = "configuration-view",
permissions = {"/permission/admin/device-mgt/admin/platform-configs/view"}
)
Response getConfiguration(
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
@PUT
@ApiOperation(
@ -95,7 +101,8 @@ public interface ConfigurationManagementService {
value = "Update General Platform Configurations.",
notes = "This resource is used to update the general platform configuration.",
tags = "Configuration Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n General platform configuration has been updated successfully",
@ -125,13 +132,17 @@ public interface ConfigurationManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while modifying general platform configuration.",
response = ErrorResponse.class)
})
@Permission(scope = "configuration-modify",
permissions = {"/permission/admin/device-mgt/admin/platform-configs/modify"})
}
)
@Permission(
scope = "configuration-modify",
permissions = {"/permission/admin/device-mgt/admin/platform-configs/modify"}
)
Response updateConfiguration(
@ApiParam(
name = "configuration",
value = "The required properties to be updated in the platform configuration.",
required = true) PlatformConfiguration configuration);
required = true)
PlatformConfiguration configuration);
}

@ -88,13 +88,14 @@ public interface NotificationManagementService {
code = 500,
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the notification list.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "device-notification-view",
permissions = {
"/permission/admin/device-mgt/admin/notifications/view",
"/permission/admin/device-mgt/user/notifications/view"
})
"/permission/admin/device-mgt/user/notifications/view" }
)
Response getNotifications(
@ApiParam(
name = "status",
@ -121,4 +122,15 @@ public interface NotificationManagementService {
required = false)
@QueryParam("limit")
int limit);
@PUT
@Path("{id}/{status}")
@ApiOperation(
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "",
notes = "",
tags = "Device Notification Management")
Response updateNotificationStatus(
@PathParam("id") int id);
}

@ -69,7 +69,8 @@ public interface PolicyManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")
}),
}
),
@ApiResponse(
code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.",
@ -93,10 +94,12 @@ public interface PolicyManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while adding a new policy.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-modify",
permissions = {"/permission/admin/device-mgt/admin/policies/add"})
permissions = {"/permission/admin/device-mgt/admin/policies/add"}
)
Response addPolicy(
@ApiParam(
name = "policy",
@ -132,7 +135,8 @@ public interface PolicyManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ -148,10 +152,12 @@ public interface PolicyManagementService {
message = ("Internal Server ErrorResponse. \n Server error occurred while fetching " +
"policies."),
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-view",
permissions = {"/permission/admin/device-mgt/admin/policies/list"})
permissions = {"/permission/admin/device-mgt/admin/policies/list"}
)
Response getPolicies(
@ApiParam(
name = "If-Modified-Since",
@ -199,15 +205,15 @@ public interface PolicyManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n No policy is found with the given id.",
response = ErrorResponse.class
),
response = ErrorResponse.class),
@ApiResponse(
code = 406,
message = "Not Acceptable.\n The requested media type is not supported"),
@ -219,7 +225,8 @@ public interface PolicyManagementService {
})
@Permission(
scope = "policy-view",
permissions = {"/permission/admin/device-mgt/admin/policies/list"})
permissions = {"/permission/admin/device-mgt/admin/policies/list"}
)
Response getPolicy(
@ApiParam(
name = "id",
@ -263,7 +270,9 @@ public interface PolicyManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
@ -280,10 +289,12 @@ public interface PolicyManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while updating the policy.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-modify",
permissions = {"/permission/admin/device-mgt/admin/policies/update"})
permissions = {"/permission/admin/device-mgt/admin/policies/update"}
)
Response updatePolicy(
@ApiParam(
name = "id",
@ -321,16 +332,19 @@ public interface PolicyManagementService {
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
message = "Unsupported media type. \n The entity of the request was in a not "
+ "supported format."),
@ApiResponse(
code = 500,
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while bulk removing policies.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-modify",
permissions = {"/permission/admin/device-mgt/admin/policies/remove"})
permissions = {"/permission/admin/device-mgt/admin/policies/remove"}
)
Response removePolicies(
@ApiParam(
name = "policyIds",
@ -365,11 +379,13 @@ public interface PolicyManagementService {
code = 500,
message = "ErrorResponse in activating policies.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-modify", permissions = {
"/permission/admin/device-mgt/admin/policies/update",
"/permission/admin/device-mgt/admin/policies/add"})
"/permission/admin/device-mgt/admin/policies/add"}
)
Response activatePolicies(
@ApiParam(
name = "policyIds",
@ -384,8 +400,8 @@ public interface PolicyManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "PUT",
value = "Deactivating policies.",
notes = "Using the REST API command you are able to unpublish a policy in order to bring a policy that " +
"is in the active state to the inactive state.",
notes = "Using the REST API command you are able to unpublish a policy in order to bring a "
+ "policy that is in the active state to the inactive state.",
tags = "Device Policy Management")
@ApiResponses(
value = {
@ -404,12 +420,14 @@ public interface PolicyManagementService {
code = 500,
message = "ErrorResponse in deactivating policies.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "policy-modify",
permissions = {
"/permission/admin/device-mgt/admin/policies/update",
"/permission/admin/device-mgt/admin/policies/add"})
"/permission/admin/device-mgt/admin/policies/add"}
)
Response deactivatePolicies(
@ApiParam(
name = "policyIds",
@ -441,8 +459,12 @@ public interface PolicyManagementService {
code = 500,
message = "ErrorResponse in deactivating policies.",
response = ErrorResponse.class)
})
@Permission(scope = "policy-modify", permissions = {"/permission/admin/device-mgt/admin/policies/update"})
}
)
@Permission(
scope = "policy-modify",
permissions = {"/permission/admin/device-mgt/admin/policies/update"}
)
Response applyChanges();
@ -470,7 +492,8 @@ public interface PolicyManagementService {
code = 500,
message = "Exception in updating policy priorities.",
response = ErrorResponse.class)
})
}
)
@Permission(
scope = "",
permissions = {})

@ -45,8 +45,9 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Get the list of roles.",
notes = "If you wish to get the details of all the roles in EMM, you can do so using this REST API. All " +
"internal roles, roles created for Service-providers and application related roles are omitted.",
notes = "If you wish to get the details of all the roles in EMM, you can do so using this REST "
+ "API. All internal roles, roles created for Service-providers and application related "
+ "roles are omitted.",
tags = "Role Management")
@ApiResponses(
value = {
@ -64,12 +65,15 @@ public interface RoleManagementService {
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
description = "Date and time the resource has been modified the"
+ " last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client has already the latest "
+ "version of the requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource does not exist.",
@ -81,38 +85,47 @@ public interface RoleManagementService {
code = 500,
message = "Internal Server ErrorResponse. \n Server error occurred while fetching requested list of roles.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-view", permissions = {
}
)
@Permission(
scope = "roles-view",
permissions = {
"/permission/admin/device-mgt/admin/roles/list",
"/permission/admin/device-mgt/admin/users/view",
"/permission/admin/device-mgt/admin/policies/add",
"/permission/admin/device-mgt/admin/policies/update"})
"/permission/admin/device-mgt/admin/policies/update"}
)
Response getRoles(
@ApiParam(
name = "filter",
value = "Role name or a part of it to search.",
required = false)
@QueryParam("filter") String filter,
@QueryParam("filter")
String filter,
@ApiParam(
name = "user-store",
value = "From which user store the roles must be fetched.",
required = false)
@QueryParam("user-store") String userStoreName,
@QueryParam("user-store")
String userStoreName,
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince,
@HeaderParam("If-Modified-Since")
String ifModifiedSince,
@ApiParam(
name = "offset",
value = "Starting point within the complete list of items qualified.",
required = false)
@QueryParam("offset") int offset,
@QueryParam("offset")
int offset,
@ApiParam(
name = "limit",
value = "Maximum size of resource array to return.",
required = false)
@QueryParam("limit") int limit);
@QueryParam("limit")
int limit);
@GET
@Path("/{roleName}/permissions")
@ -120,9 +133,10 @@ public interface RoleManagementService {
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "Getting permission details of a role.",
notes = "In an organization an individual is associated a with set of responsibilities based on their " +
"role. In EMM you are able to configure permissions based on the responsibilities carried " +
"out by a role. Therefore if you wish to retrieve the permission details of a role, you can do " +
notes = "In an organization an individual is associated a with set of responsibilities based "
+ "on their role. In EMM you are able to configure permissions based on the "
+ "responsibilities carried out by a role. Therefore if you wish to retrieve the "
+ "permission details of a role, you can do " +
"so using this REST API.",
response = UIPermissionNode.class,
responseContainer = "List",
@ -145,12 +159,15 @@ public interface RoleManagementService {
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
description = "Date and time the resource has been modified the "
+ "last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client has already the latest "
+ "version of the requested resource."),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
@ -164,21 +181,28 @@ public interface RoleManagementService {
message = "Not Acceptable.\n The requested media type is not supported"),
@ApiResponse(
code = 500,
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the permission list of the requested role.",
message = "Internal Server ErrorResponse. \n Server error occurred while fetching"
+ " the permission list of the requested role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-view", permissions = {"/permission/admin/device-mgt/admin/roles/list"})
}
)
@Permission(
scope = "roles-view",
permissions = {"/permission/admin/device-mgt/admin/roles/list"}
)
Response getPermissionsOfRole(
@ApiParam(
name = "roleName",
value = "Name of the role.",
required = true)
@PathParam("roleName") String roleName,
@PathParam("roleName")
String roleName,
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
@GET
@Path("/{roleName}")
@ -205,12 +229,15 @@ public interface RoleManagementService {
"Used by caches, or in conditional requests."),
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
description = "Date and time the resource has been modified the "
+ "last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of" +
message = "Not Modified. \n Empty body because the client has already the "
+ "latest version of" +
" the requested resource."),
@ApiResponse(
code = 400,
@ -228,19 +255,25 @@ public interface RoleManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the " +
"requested role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-view", permissions = {"/permission/admin/device-mgt/admin/roles/list"})
}
)
@Permission(
scope = "roles-view",
permissions = {"/permission/admin/device-mgt/admin/roles/list"}
)
Response getRole(
@ApiParam(
name = "roleName",
value = "Name of the role.",
required = true)
@PathParam("roleName") String roleName,
@PathParam("roleName")
String roleName,
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
@POST
@ApiOperation(
@ -250,7 +283,8 @@ public interface RoleManagementService {
value = "Add a role.",
notes = "You are able to add a new role to EMM using the REST API.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 201,
message = "Created. \n Role has successfully been created",
@ -268,33 +302,43 @@ public interface RoleManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.",
responseHeaders = {
@ResponseHeader(
name = "Content-Location",
description = "The Source URL of the document.")}),
description = "The Source URL of the document.")
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
response = ErrorResponse.class),
@ApiResponse(
code = 415,
message = "Unsupported media type. \n The entity of the request was in a not supported format."),
message = "Unsupported media type. \n The entity of the request was in a not "
+ "supported format."),
@ApiResponse(
code = 500,
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while adding a new role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-modify", permissions = {"/permission/admin/device-mgt/admin/roles/add"})
}
)
@Permission(
scope = "roles-modify",
permissions = {"/permission/admin/device-mgt/admin/roles/add"}
)
Response addRole(
@ApiParam(
name = "role",
value = "Details about the role to be added.",
required = true) RoleWrapper role);
required = true)
RoleWrapper role);
@PUT
@Path("/{roleName}")
@ -306,7 +350,8 @@ public interface RoleManagementService {
notes = "There will be situations where you will need to update the role details, such as the permissions" +
" or the role name. In such situation you can update the role details.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Role has been updated successfully",
@ -324,7 +369,9 @@ public interface RoleManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
@ -340,18 +387,24 @@ public interface RoleManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while updating the role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-modify", permissions = {"/permission/admin/device-mgt/admin/roles/update"})
}
)
@Permission(
scope = "roles-modify",
permissions = {"/permission/admin/device-mgt/admin/roles/update"}
)
Response updateRole(
@ApiParam(
name = "roleName",
value = "Name of the role.",
required = true)
@PathParam("roleName") String roleName,
@PathParam("roleName")
String roleName,
@ApiParam(
name = "role",
value = "Details about the role to be added.",
required = true) RoleWrapper role);
required = true)
RoleWrapper role);
@DELETE
@Path("/{roleName}")
@ -361,7 +414,8 @@ public interface RoleManagementService {
notes = "In a situation when your Organization identifies that a specific role is no longer required you " +
"will need to remove the role details from EMM.",
tags = "Role Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Role has successfully been removed"),
@ -377,14 +431,19 @@ public interface RoleManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while removing the role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-modify", permissions = {"/permission/admin/device-mgt/admin/roles/remove"})
}
)
@Permission(
scope = "roles-modify",
permissions = {"/permission/admin/device-mgt/admin/roles/remove"}
)
Response deleteRole(
@ApiParam(
name = "roleName",
value = "Name of the role to de deleted.",
required = true)
@PathParam("roleName") String roleName);
@PathParam("roleName")
String roleName);
@PUT
@Path("/{roleName}/users")
@ -419,7 +478,9 @@ public interface RoleManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error.",
@ -435,17 +496,23 @@ public interface RoleManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while updating the user list of the role.",
response = ErrorResponse.class)
})
@Permission(scope = "roles-modify", permissions = {"/permission/admin/device-mgt/admin/roles/update"})
}
)
@Permission(
scope = "roles-modify",
permissions = {"/permission/admin/device-mgt/admin/roles/update"}
)
Response updateUsersOfRole(
@ApiParam(
name = "roleName",
value = "Name of the role.",
required = true)
@PathParam("roleName") String roleName,
@PathParam("roleName")
String roleName,
@ApiParam(
name = "users",
value = "List of usernames to be added.",
required = true) List<String> users);
required = true)
List<String> users);
}

@ -63,7 +63,9 @@ public interface UserManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 303,
message = "See Other. \n Source can be retrieved from the URL specified at the Location header.",
@ -86,13 +88,18 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while adding a new user.",
response = ErrorResponse.class)
})
@Permission(scope = "user-modify", permissions = {"/permission/admin/device-mgt/admin/user/add"})
}
)
@Permission(
scope = "user-modify",
permissions = {"/permission/admin/device-mgt/admin/user/add"}
)
Response addUser(
@ApiParam(
name = "user",
value = "User related details.",
required = true) UserInfo user);
required = true)
UserInfo user);
@GET
@Path("/{username}")
@ -104,7 +111,8 @@ public interface UserManagementService {
+ " you can do so using the REST API.",
response = BasicUserInfo.class,
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the requested role.",
@ -121,10 +129,12 @@ public interface UserManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
message = "Not Modified. \n Empty body because the client has already the latest "
+ "version of the requested resource."),
@ApiResponse(
code = 404,
message = "Not Found. \n Resource does not exist.",
@ -137,19 +147,25 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while" +
" fetching the requested user.",
response = ErrorResponse.class)
})
@Permission(scope = "user-view", permissions = {"/permission/admin/device-mgt/admin/user/view"})
}
)
@Permission(
scope = "user-view",
permissions = {"/permission/admin/device-mgt/admin/user/view"}
)
Response getUser(
@ApiParam(
name = "username",
value = "Username of the user to be fetched.",
required = true)
@PathParam("username") String username,
@PathParam("username")
String username,
@ApiParam(
name = "If-Modified-Since",
value = "Validates if the requested variant has not been modified since the time specified",
required = false)
@HeaderParam("If-Modified-Since") String ifModifiedSince);
@HeaderParam("If-Modified-Since")
String ifModifiedSince);
@PUT
@Path("/{username}")
@ -161,7 +177,8 @@ public interface UserManagementService {
notes = "There will be situations where you will want to update the user details. In such "
+ "situation you can update the user details using this REST API.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n User has been updated successfully",
@ -179,7 +196,9 @@ public interface UserManagementService {
@ResponseHeader(
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests.")}),
"Used by caches, or in conditional requests.")
}
),
@ApiResponse(
code = 400,
message = "Bad Request. \n Invalid request or validation error."),
@ -195,18 +214,24 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while updating the user.",
response = ErrorResponse.class)
})
@Permission(scope = "user-modify", permissions = {"/permission/admin/device-mgt/admin/user/update"})
}
)
@Permission(
scope = "user-modify",
permissions = {"/permission/admin/device-mgt/admin/user/update"}
)
Response updateUser(
@ApiParam(
name = "username",
value = "Username of the user to be updated.",
required = true)
@PathParam("username") String username,
@PathParam("username")
String username,
@ApiParam(
name = "userData",
value = "User related details.",
required = true) UserInfo userData);
required = true)
UserInfo userData);
@DELETE
@Path("/{username}")
@ -216,7 +241,8 @@ public interface UserManagementService {
notes = "In a situation where an employee leaves the organization you will need to remove the"
+ " user details from EMM. In such situations you can use this REST API to remove a user.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n User has successfully been removed"),
@ -228,13 +254,20 @@ public interface UserManagementService {
code = 500,
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while removing the user.",
response = ErrorResponse.class
)
})
@Permission(scope = "user-modify", permissions = {"/permission/admin/device-mgt/admin/user/remove"})
response = ErrorResponse.class)
}
)
@Permission(
scope = "user-modify",
permissions = {"/permission/admin/device-mgt/admin/user/remove"}
)
Response removeUser(
@ApiParam(name = "username", value = "Username of the user to be deleted.", required = true)
@PathParam("username") String username);
@ApiParam(
name = "username",
value = "Username of the user to be deleted.",
required = true)
@PathParam("username")
String username);
@GET
@Path("/{username}/roles")
@ -245,7 +278,8 @@ public interface UserManagementService {
notes = "A user can be assigned to one or more role in EMM. Using this REST API you are "
+ "able to get the role/roles a user is assigned to.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the role list assigned to the user.",
@ -262,7 +296,8 @@ public interface UserManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ -278,11 +313,19 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the role list" +
" assigned to the user.",
response = ErrorResponse.class)
})
@Permission(scope = "user-view", permissions = {"/permission/admin/device-mgt/admin/user/view"})
}
)
@Permission(
scope = "user-view",
permissions = {"/permission/admin/device-mgt/admin/user/view"}
)
Response getRolesOfUser(
@ApiParam(name = "username", value = "Username of the user.", required = true)
@PathParam("username") String username);
@ApiParam(
name = "username",
value = "Username of the user.",
required = true)
@PathParam("username")
String username);
@GET
@ApiOperation(
@ -292,7 +335,8 @@ public interface UserManagementService {
notes = "If you wish to get the details of all the users registered with EMM, you can do so "
+ "using the REST API",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the requested role.",
@ -309,7 +353,8 @@ public interface UserManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."),
@ -320,29 +365,37 @@ public interface UserManagementService {
code = 500,
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the user list.",
response = ErrorResponse.class)
})
@Permission(scope = "user-view", permissions = {"/permission/admin/device-mgt/admin/user/list"})
}
)
@Permission(
scope = "user-view",
permissions = {"/permission/admin/device-mgt/admin/user/list"}
)
Response getUsers(
@ApiParam(
name = "filter",
value = "Username of the user details to be fetched.",
required = false)
@QueryParam("filter") String filter,
@QueryParam("filter")
String filter,
@ApiParam(
name = "If-Modified-Since",
value = "Timestamp of the last modified date",
required = false)
@HeaderParam("If-Modified-Since") String timestamp,
@HeaderParam("If-Modified-Since")
String timestamp,
@ApiParam(
name = "offset",
value = "Starting point within the complete list of items qualified.",
required = false)
@QueryParam("offset") int offset,
@QueryParam("offset")
int offset,
@ApiParam(
name = "limit",
value = "Maximum size of resource array to return.",
required = false)
@QueryParam("limit") int limit);
@QueryParam("limit")
int limit);
@GET
@Path("/search/usernames")
@ -356,7 +409,8 @@ public interface UserManagementService {
+ "You will be given a list of users having the user name with the exact order of the "
+ "characters you provided.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully fetched the username list that matches the given filter.",
@ -374,7 +428,8 @@ public interface UserManagementService {
name = "Last-Modified",
description = "Date and time the resource has been modified the last time.\n" +
"Used by caches, or in conditional requests."),
}),
}
),
@ApiResponse(
code = 304,
message = "Not Modified. \n Empty body because the client has already the latest version of the requested resource."),
@ -386,29 +441,37 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n Server error occurred while fetching the username " +
"list that matches the given filter.",
response = ErrorResponse.class)
})
@Permission(scope = "user-view", permissions = {"/permission/admin/device-mgt/admin/user/list"})
}
)
@Permission(
scope = "user-view",
permissions = {"/permission/admin/device-mgt/admin/user/list"}
)
Response getUserNames(
@ApiParam(
name = "filter",
value = "Username/part of the user name to search.",
required = true)
@QueryParam("filter") String filter,
@QueryParam("filter")
String filter,
@ApiParam(
name = "If-Modified-Since",
value = "Timestamp of the last modified date",
required = false)
@HeaderParam("If-Modified-Since") String timestamp,
@HeaderParam("If-Modified-Since")
String timestamp,
@ApiParam(
name = "offset",
value = "Starting point within the complete list of items qualified.",
required = false)
@QueryParam("offset") int offset,
@QueryParam("offset")
int offset,
@ApiParam(
name = "limit",
value = "Maximum size of resource array to return.",
required = false)
@QueryParam("limit") int limit);
@QueryParam("limit")
int limit);
@PUT
@Path("/{username}/credentials")
@ -419,7 +482,8 @@ public interface UserManagementService {
value = "Changing the user password.",
notes = "A user is able to change the password to secure their EMM profile via this REST API.",
tags = "User Management")
@ApiResponses(value = {
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Credentials of the user have been updated successfully"),
@ -438,17 +502,23 @@ public interface UserManagementService {
message = "Internal Server ErrorResponse. \n " +
"Server error occurred while updating credentials of the user.",
response = ErrorResponse.class)
})
@Permission(scope = "user-modify", permissions = {"/permission/admin/login"})
}
)
@Permission(
scope = "user-modify",
permissions = {"/permission/admin/login"}
)
Response resetPassword(
@ApiParam(
name = "username",
value = "Username of the user.",
required = true)
@PathParam("username") String username,
@PathParam("username")
String username,
@ApiParam(
name = "credentials",
value = "Credential.",
required = true) OldPasswordResetWrapper credentials);
required = true)
OldPasswordResetWrapper credentials);
}

@ -88,4 +88,29 @@ public class NotificationManagementServiceImpl implements NotificationManagement
}
}
@PUT
@Path("{id}/mark-checked")
public Response updateNotificationStatus(
@PathParam("id") int id) {
String msg;
Notification.Status status = Notification.Status.CHECKED;
Notification notification;
try {
DeviceMgtAPIUtils.getNotificationManagementService().updateNotificationStatus(id, status);
} catch (NotificationManagementException e) {
msg = "Error occurred while updating notification status.";
log.error(msg, e);
throw new UnexpectedServerErrorException(
new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build());
}
try {
notification = DeviceMgtAPIUtils.getNotificationManagementService().getNotification(id);
return Response.status(Response.Status.OK).entity(notification).build();
} catch (NotificationManagementException e) {
msg = "Notification updated successfully. But the retrial of the updated notification failed";
log.error(msg, e);
return Response.status(Response.Status.OK).build();
}
}
}

@ -71,6 +71,8 @@ public interface NotificationManagementService {
*/
List<Notification> getAllNotifications() throws NotificationManagementException;
Notification getNotification(int notificationId) throws NotificationManagementException;
PaginationResult getAllNotifications(PaginationRequest request) throws NotificationManagementException;
/**

@ -160,6 +160,19 @@ public class NotificationManagementServiceImpl implements NotificationManagement
}
}
@Override
public Notification getNotification(int notificationId) throws NotificationManagementException {
try {
NotificationManagementDAOFactory.openConnection();
return notificationDAO.getNotification(NotificationDAOUtil.getTenantId(), notificationId);
} catch (SQLException e) {
throw new NotificationManagementException("Error occurred while opening a connection to" +
" the data source", e);
} finally {
NotificationManagementDAOFactory.closeConnection();
}
}
@Override
public PaginationResult getAllNotifications(PaginationRequest request) throws NotificationManagementException {
PaginationResult paginationResult = new PaginationResult();

@ -71,6 +71,8 @@ public interface NotificationDAO {
*/
List<Notification> getAllNotifications(int tenantId) throws NotificationManagementException;
Notification getNotification(int tenantId, int notificationId) throws NotificationManagementException;
List<Notification> getAllNotifications(PaginationRequest request, int tenantId) throws NotificationManagementException;
int getNotificationCount(int tenantId) throws NotificationManagementException;

@ -70,6 +70,35 @@ public class NotificationDAOImpl implements NotificationDAO {
return notificationId;
}
@Override
public Notification getNotification(int tenantId, int notificationId) throws NotificationManagementException {
Connection conn;
PreparedStatement stmt = null;
ResultSet rs = null;
Notification notification = null;
try {
conn = NotificationManagementDAOFactory.getConnection();
String sql =
"SELECT NOTIFICATION_ID, OPERATION_ID, DESCRIPTION, STATUS FROM DM_NOTIFICATION WHERE " +
"TENANT_ID = ? AND NOTIFICATION_ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, tenantId);
stmt.setInt(2, notificationId);
rs = stmt.executeQuery();
while (rs.next()) {
notification = this.getNotification(rs);
}
} catch (SQLException e) {
throw new NotificationManagementException(
"Error occurred while retrieving information of all notifications", e);
} finally {
NotificationDAOUtil.cleanupResources(stmt, rs);
}
return notification;
}
@Override
public int updateNotification(Notification notification)
throws NotificationManagementException {

Loading…
Cancel
Save