mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
created interfaces for the api classes in order add swagger definitions
This commit is contained in:
parent
46e0c4ea8b
commit
f5915cbf5d
@ -2,19 +2,19 @@
|
||||
<!--
|
||||
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~
|
||||
~ WSO2 Inc. licenses this file to you under the Apache LicenseImpl,
|
||||
~ Version 2.0 (the "LicenseImpl"); you may not use this file except
|
||||
~ in compliance with the LicenseImpl.
|
||||
~ You may obtain a copy of the LicenseImpl at
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the LicenseImpl is distributed on an
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the LicenseImpl for the
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the LicenseImpl.
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
|
||||
@ -25,7 +25,7 @@ import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
* AuthenticationImpl related REST-API implementation.
|
||||
* Authentication related REST-API implementation.
|
||||
*/
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
|
||||
@ -40,7 +40,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* General Tenant ConfigurationImpl REST-API implementation.
|
||||
* General Tenant Configuration REST-API implementation.
|
||||
* All end points support JSON, XMl with content negotiation.
|
||||
*/
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
|
||||
@ -43,7 +43,7 @@ import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DeviceImpl related operations
|
||||
* Device related operations
|
||||
*/
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
public class DeviceImpl implements Device{
|
||||
@ -53,7 +53,7 @@ public class DeviceImpl implements Device{
|
||||
* Get all devices. We have to use accept all the necessary query parameters sent by datatable.
|
||||
* Hence had to put lot of query params here.
|
||||
*
|
||||
* @return DeviceImpl List
|
||||
* @return Device List
|
||||
*/
|
||||
@GET
|
||||
public Response getAllDevices(@QueryParam("type") String type, @QueryParam("user") String user,
|
||||
@ -103,7 +103,7 @@ public class DeviceImpl implements Device{
|
||||
/**
|
||||
* Fetch device details for a given device type and device Id.
|
||||
*
|
||||
* @return DeviceImpl wrapped inside Response
|
||||
* @return Device wrapped inside Response
|
||||
*/
|
||||
@GET
|
||||
@Path("view")
|
||||
@ -137,8 +137,8 @@ public class DeviceImpl implements Device{
|
||||
/**
|
||||
* Fetch device details of a given user.
|
||||
*
|
||||
* @param user UserImpl Name
|
||||
* @return DeviceImpl
|
||||
* @param user User Name
|
||||
* @return Device
|
||||
*/
|
||||
@GET
|
||||
@Path("user/{user}")
|
||||
@ -160,8 +160,8 @@ public class DeviceImpl implements Device{
|
||||
/**
|
||||
* Fetch device count of a given user.
|
||||
*
|
||||
* @param user UserImpl Name
|
||||
* @return DeviceImpl
|
||||
* @param user User Name
|
||||
* @return Device
|
||||
*/
|
||||
@GET
|
||||
@Path("user/{user}/count")
|
||||
@ -197,7 +197,7 @@ public class DeviceImpl implements Device{
|
||||
/**
|
||||
* Get the list of devices that matches with the given name.
|
||||
*
|
||||
* @param deviceName DeviceImpl name
|
||||
* @param deviceName Device name
|
||||
* @param tenantDomain Callee tenant domain
|
||||
* @return list of devices.
|
||||
*/
|
||||
|
||||
@ -38,7 +38,7 @@ import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* DeviceNotificationImpl management REST-API implementation.
|
||||
* DeviceNotification management REST-API implementation.
|
||||
* All end points support JSON, XMl with content negotiation.
|
||||
*/
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
|
||||
@ -43,9 +43,9 @@ public class FeatureImpl implements Feature{
|
||||
private static Log log = LogFactory.getLog(FeatureImpl.class);
|
||||
|
||||
/**
|
||||
* Get all features for Mobile DeviceImpl Type
|
||||
* Get all features for Mobile Device Type
|
||||
*
|
||||
* @return FeatureImpl
|
||||
* @return Feature
|
||||
*/
|
||||
@GET
|
||||
@Path("/{type}")
|
||||
|
||||
@ -292,7 +292,7 @@ public class GroupImpl implements Group {
|
||||
if (isShared) {
|
||||
return Response.status(Response.Status.OK).build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("GroupImpl not found").build();
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Group not found").build();
|
||||
}
|
||||
} catch (UserDoesNotExistException e) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
||||
@ -315,7 +315,7 @@ public class GroupImpl implements Group {
|
||||
if (isUnShared) {
|
||||
return Response.status(Response.Status.OK).build();
|
||||
} else {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("GroupImpl not found").build();
|
||||
return Response.status(Response.Status.NOT_FOUND).entity("Group not found").build();
|
||||
}
|
||||
} catch (UserDoesNotExistException e) {
|
||||
return Response.status(Response.Status.NOT_FOUND).entity(e.getMessage()).build();
|
||||
|
||||
@ -45,7 +45,7 @@ public class LicenseImpl implements License {
|
||||
/**
|
||||
* This method returns the license text related to a given device type and language code.
|
||||
*
|
||||
* @param deviceType DeviceImpl type, ex: android, ios
|
||||
* @param deviceType Device type, ex: android, ios
|
||||
* @param languageCode Language code, ex: en_US
|
||||
* @return Returns the license text
|
||||
*/
|
||||
@ -63,7 +63,7 @@ public class LicenseImpl implements License {
|
||||
return Response.status(HttpStatus.SC_NOT_FOUND).build();
|
||||
}
|
||||
responsePayload = ResponsePayload.statusCode(HttpStatus.SC_OK).
|
||||
messageFromServer("LicenseImpl for '" + deviceType + "' was retrieved successfully").
|
||||
messageFromServer("License for '" + deviceType + "' was retrieved successfully").
|
||||
responseContent(license.getText()).
|
||||
build();
|
||||
} catch (DeviceManagementException e) {
|
||||
@ -77,8 +77,8 @@ public class LicenseImpl implements License {
|
||||
/**
|
||||
* This method is used to add license to a specific device type.
|
||||
*
|
||||
* @param deviceType DeviceImpl type, ex: android, ios
|
||||
* @param license LicenseImpl object
|
||||
* @param deviceType Device type, ex: android, ios
|
||||
* @param license License object
|
||||
* @return Returns the acknowledgement for the action
|
||||
*/
|
||||
@POST
|
||||
@ -90,7 +90,7 @@ public class LicenseImpl implements License {
|
||||
try {
|
||||
DeviceMgtAPIUtils.getDeviceManagementService().addLicense(deviceType, license);
|
||||
responsePayload = ResponsePayload.statusCode(HttpStatus.SC_OK).
|
||||
messageFromServer("LicenseImpl added successfully for '" + deviceType + "' device type").
|
||||
messageFromServer("License added successfully for '" + deviceType + "' device type").
|
||||
build();
|
||||
} catch (DeviceManagementException e) {
|
||||
String msg = "Error occurred while adding license for '" + deviceType + "' device type";
|
||||
|
||||
@ -51,7 +51,7 @@ import javax.ws.rs.core.Response;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* OperationImpl related REST-API implementation.
|
||||
* Operation related REST-API implementation.
|
||||
*/
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
@Produces({"application/json", "application/xml"})
|
||||
@ -131,7 +131,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
int operationId = dmService.addOperation(operationContext.getOperation(), operationContext.getDevices());
|
||||
if (operationId > 0) {
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("OperationImpl has added successfully.");
|
||||
responseMsg.setMessageFromServer("Operation has added successfully.");
|
||||
}
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
} catch (OperationManagementException e) {
|
||||
@ -184,7 +184,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
}
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("AuthenticationImpl installation request has been sent to the device.");
|
||||
responseMsg.setMessageFromServer("Authentication installation request has been sent to the device.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
} catch (ApplicationManagementException | MDMAPIException e) {
|
||||
String msg = "Error occurred while saving the operation";
|
||||
@ -216,7 +216,7 @@ public class OperationImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Opera
|
||||
appManagerConnector.installApplicationForDevices(operation, applicationWrapper.getDeviceIdentifiers());
|
||||
}
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("AuthenticationImpl removal request has been sent to the device.");
|
||||
responseMsg.setMessageFromServer("Authentication removal request has been sent to the device.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
} catch (ApplicationManagementException | MDMAPIException e) {
|
||||
String msg = "Error occurred while saving the operation";
|
||||
|
||||
@ -101,10 +101,10 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
PolicyAdministratorPoint pap = policyManagementService.getPAP();
|
||||
pap.addPolicy(policy);
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("PolicyImpl has been added successfully.");
|
||||
responseMsg.setMessageFromServer("Policy has been added successfully.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -120,7 +120,7 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
PolicyAdministratorPoint policyAdministratorPoint = policyManagementService.getPAP();
|
||||
policies = policyAdministratorPoint.getPolicies();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -142,14 +142,14 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
PolicyAdministratorPoint policyAdministratorPoint = policyManagementService.getPAP();
|
||||
policy = policyAdministratorPoint.getPolicy(policyId);
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
if (policy == null){
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
responsePayload.setStatusCode(HttpStatus.SC_NOT_FOUND);
|
||||
responsePayload.setMessageFromServer("PolicyImpl for ID " + policyId + " not found.");
|
||||
responsePayload.setMessageFromServer("Policy for ID " + policyId + " not found.");
|
||||
return Response.status(Response.Status.NOT_FOUND).entity(responsePayload).build();
|
||||
}
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
@ -169,7 +169,7 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
Integer count = policyAdministratorPoint.getPolicyCount();
|
||||
return Response.status(Response.Status.OK).entity(count).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -198,10 +198,10 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
PolicyAdministratorPoint pap = policyManagementService.getPAP();
|
||||
pap.updatePolicy(policy);
|
||||
responseMsg.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responseMsg.setMessageFromServer("PolicyImpl has been updated successfully.");
|
||||
responseMsg.setMessageFromServer("Policy has been updated successfully.");
|
||||
return Response.status(Response.Status.CREATED).entity(responseMsg).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception in policy update.";
|
||||
String msg = "Policy Management related exception in policy update.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -235,11 +235,11 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
if (policiesUpdated) {
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("PolicyImpl Priorities successfully updated.");
|
||||
responsePayload.setMessageFromServer("Policy Priorities successfully updated.");
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
} else {
|
||||
responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
||||
responsePayload.setMessageFromServer("PolicyImpl priorities did not update. Bad Request.");
|
||||
responsePayload.setMessageFromServer("Policy priorities did not update. Bad Request.");
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(responsePayload).build();
|
||||
}
|
||||
}
|
||||
@ -272,7 +272,7 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
} else {
|
||||
responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
||||
responsePayload.setMessageFromServer("PolicyImpl does not exist.");
|
||||
responsePayload.setMessageFromServer("Policy does not exist.");
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(responsePayload).build();
|
||||
}
|
||||
}
|
||||
@ -358,13 +358,13 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
|
||||
|
||||
} catch (PolicyMonitoringTaskException e) {
|
||||
String msg = "PolicyImpl Management related exception.";
|
||||
String msg = "Policy Management related exception.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("PolicyImpl monitoring service started successfully.");
|
||||
responsePayload.setMessageFromServer("Policy monitoring service started successfully.");
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
}
|
||||
|
||||
@ -379,13 +379,13 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
taskScheduleService.updateTask(monitoringFrequency);
|
||||
|
||||
} catch (PolicyMonitoringTaskException e) {
|
||||
String msg = "PolicyImpl Management related exception.";
|
||||
String msg = "Policy Management related exception.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("PolicyImpl monitoring service updated successfully.");
|
||||
responsePayload.setMessageFromServer("Policy monitoring service updated successfully.");
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
}
|
||||
|
||||
@ -400,13 +400,13 @@ public class PolicyImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Policy {
|
||||
taskScheduleService.stopTask();
|
||||
|
||||
} catch (PolicyMonitoringTaskException e) {
|
||||
String msg = "PolicyImpl Management related exception.";
|
||||
String msg = "Policy Management related exception.";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
ResponsePayload responsePayload = new ResponsePayload();
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("PolicyImpl monitoring service stopped successfully.");
|
||||
responsePayload.setMessageFromServer("Policy monitoring service stopped successfully.");
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
}
|
||||
|
||||
|
||||
@ -45,7 +45,7 @@ public class ProfileImpl implements Profile{
|
||||
profile = pap.addProfile(profile);
|
||||
return Response.status(Response.Status.OK).entity(profile).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -59,10 +59,10 @@ public class ProfileImpl implements Profile{
|
||||
try {
|
||||
PolicyAdministratorPoint pap = policyManagementService.getPAP();
|
||||
pap.updateProfile(profile);
|
||||
responseMsg.setMessageFromServer("ProfileImpl has been updated successfully.");
|
||||
responseMsg.setMessageFromServer("Profile has been updated successfully.");
|
||||
return Response.status(Response.Status.OK).entity(responseMsg).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
@ -76,10 +76,10 @@ public class ProfileImpl implements Profile{
|
||||
PolicyAdministratorPoint pap = policyManagementService.getPAP();
|
||||
org.wso2.carbon.policy.mgt.common.Profile profile = pap.getProfile(profileId);
|
||||
pap.deleteProfile(profile);
|
||||
responseMsg.setMessageFromServer("ProfileImpl has been deleted successfully.");
|
||||
responseMsg.setMessageFromServer("Profile has been deleted successfully.");
|
||||
return Response.status(Response.Status.OK).entity(responseMsg).build();
|
||||
} catch (PolicyManagementException e) {
|
||||
String msg = "PolicyImpl Management related exception";
|
||||
String msg = "Policy Management related exception";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
|
||||
@ -107,7 +107,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role {
|
||||
// removing all internal roles and roles created for Service-providers
|
||||
List<String> filteredRoles = new ArrayList<>();
|
||||
for (String role : roles) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("AuthenticationImpl/"))) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("Authentication/"))) {
|
||||
filteredRoles.add(role);
|
||||
}
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role {
|
||||
// removing all internal roles and roles created for Service-providers
|
||||
List<String> filteredRoles = new ArrayList<>();
|
||||
for (String role : roles) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("AuthenticationImpl/"))) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("Authentication/"))) {
|
||||
filteredRoles.add(role);
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role {
|
||||
}
|
||||
|
||||
/**
|
||||
* API is used to persist a new RoleImpl
|
||||
* API is used to persist a new Role
|
||||
*
|
||||
* @param roleWrapper for role
|
||||
* @return response
|
||||
@ -288,7 +288,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role {
|
||||
}
|
||||
|
||||
/**
|
||||
* API is used to update a role RoleImpl
|
||||
* API is used to update a role Role
|
||||
*
|
||||
* @param roleWrapper for role
|
||||
* @return response
|
||||
@ -441,7 +441,7 @@ public class RoleImpl implements org.wso2.carbon.device.mgt.jaxrs.api.Role {
|
||||
// removing all internal roles and roles created for Service-providers
|
||||
List<String> filteredRoles = new ArrayList<>();
|
||||
for (String role : roles) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("AuthenticationImpl/"))) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("Authentication/"))) {
|
||||
filteredRoles.add(role);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ import java.util.Random;
|
||||
import java.util.TreeSet;
|
||||
|
||||
/**
|
||||
* This class represents the JAX-RS services of UserImpl related functionality.
|
||||
* This class represents the JAX-RS services of User related functionality.
|
||||
*/
|
||||
@SuppressWarnings("NonJaxWsWebServices")
|
||||
public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
@ -88,13 +88,13 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
if (userStoreManager.isExistingUser(userWrapper.getUsername())) {
|
||||
// if user already exists
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + userWrapper.getUsername() +
|
||||
log.debug("User by username: " + userWrapper.getUsername() +
|
||||
" already exists. Therefore, request made to add user was refused.");
|
||||
}
|
||||
// returning response with bad request state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_CONFLICT);
|
||||
responsePayload.
|
||||
setMessageFromServer("UserImpl by username: " + userWrapper.getUsername() +
|
||||
setMessageFromServer("User by username: " + userWrapper.getUsername() +
|
||||
" already exists. Therefore, request made to add user was refused.");
|
||||
return Response.status(Response.Status.CONFLICT).entity(responsePayload).build();
|
||||
} else {
|
||||
@ -109,11 +109,11 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
inviteNewlyAddedUserToEnrollDevice(userWrapper.getUsername(), initialUserPassword);
|
||||
// Outputting debug message upon successful addition of user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + userWrapper.getUsername() + " was successfully added.");
|
||||
log.debug("User by username: " + userWrapper.getUsername() + " was successfully added.");
|
||||
}
|
||||
// returning response with success state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responsePayload.setMessageFromServer("UserImpl by username: " + userWrapper.getUsername() +
|
||||
responsePayload.setMessageFromServer("User by username: " + userWrapper.getUsername() +
|
||||
" was successfully added.");
|
||||
return Response.status(Response.Status.CREATED).entity(responsePayload).build();
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
/**
|
||||
* Method to get user information from emm-user-store.
|
||||
*
|
||||
* @param username UserImpl-name of the user
|
||||
* @param username User-name of the user
|
||||
* @return {Response} Status of the request wrapped inside Response object.
|
||||
*/
|
||||
@Override
|
||||
@ -146,21 +146,21 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
user.setLastname(getClaimValue(username, Constants.USER_CLAIM_LAST_NAME));
|
||||
// Outputting debug message upon successful retrieval of user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " was found.");
|
||||
log.debug("User by username: " + username + " was found.");
|
||||
}
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer("UserImpl information was retrieved successfully.");
|
||||
responsePayload.setMessageFromServer("User information was retrieved successfully.");
|
||||
responsePayload.setResponseContent(user);
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
} else {
|
||||
// Outputting debug message upon trying to remove non-existing user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " does not exist.");
|
||||
log.debug("User by username: " + username + " does not exist.");
|
||||
}
|
||||
// returning response with bad request state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
||||
responsePayload.setMessageFromServer(
|
||||
"UserImpl by username: " + username + " does not exist.");
|
||||
"User by username: " + username + " does not exist.");
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(responsePayload).build();
|
||||
}
|
||||
} catch (UserStoreException | MDMAPIException e) {
|
||||
@ -193,7 +193,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
byte[] decodedBytes = Base64.decodeBase64(userWrapper.getPassword());
|
||||
userStoreManager.updateCredentialByAdmin(userWrapper.getUsername(),
|
||||
new String(decodedBytes, "UTF-8"));
|
||||
log.debug("UserImpl credential of username: " + userWrapper.getUsername() + " has been changed");
|
||||
log.debug("User credential of username: " + userWrapper.getUsername() + " has been changed");
|
||||
}
|
||||
List<String> listofFilteredRoles = getFilteredRoles(userStoreManager, userWrapper.getUsername());
|
||||
final String[] existingRoles = listofFilteredRoles.toArray(new String[listofFilteredRoles.size()]);
|
||||
@ -223,22 +223,22 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
userStoreManager.setUserClaimValues(userWrapper.getUsername(), defaultUserClaims, null);
|
||||
// Outputting debug message upon successful addition of user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + userWrapper.getUsername() + " was successfully updated.");
|
||||
log.debug("User by username: " + userWrapper.getUsername() + " was successfully updated.");
|
||||
}
|
||||
// returning response with success state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_CREATED);
|
||||
responsePayload.setMessageFromServer("UserImpl by username: " + userWrapper.getUsername() +
|
||||
responsePayload.setMessageFromServer("User by username: " + userWrapper.getUsername() +
|
||||
" was successfully updated.");
|
||||
return Response.status(Response.Status.CREATED).entity(responsePayload).build();
|
||||
} else {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + userWrapper.getUsername() +
|
||||
log.debug("User by username: " + userWrapper.getUsername() +
|
||||
" doesn't exists. Therefore, request made to update user was refused.");
|
||||
}
|
||||
// returning response with bad request state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_CONFLICT);
|
||||
responsePayload.
|
||||
setMessageFromServer("UserImpl by username: " + userWrapper.getUsername() +
|
||||
setMessageFromServer("User by username: " + userWrapper.getUsername() +
|
||||
" doesn't exists. Therefore, request made to update user was refused.");
|
||||
return Response.status(Response.Status.CONFLICT).entity(responsePayload).build();
|
||||
}
|
||||
@ -254,7 +254,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
* generate an initial user password for a user.
|
||||
* This will be the password used by a user for his initial login to the system.
|
||||
*
|
||||
* @return {string} Initial UserImpl Password
|
||||
* @return {string} Initial User Password
|
||||
*/
|
||||
private String generateInitialUserPassword() {
|
||||
int passwordLength = 6;
|
||||
@ -313,22 +313,22 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
userStoreManager.deleteUser(username);
|
||||
// Outputting debug message upon successful removal of user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " was successfully removed.");
|
||||
log.debug("User by username: " + username + " was successfully removed.");
|
||||
}
|
||||
// returning response with success state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer(
|
||||
"UserImpl by username: " + username + " was successfully removed.");
|
||||
"User by username: " + username + " was successfully removed.");
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
} else {
|
||||
// Outputting debug message upon trying to remove non-existing user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " does not exist for removal.");
|
||||
log.debug("User by username: " + username + " does not exist for removal.");
|
||||
}
|
||||
// returning response with bad request state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
||||
responsePayload.setMessageFromServer(
|
||||
"UserImpl by username: " + username + " does not exist for removal.");
|
||||
"User by username: " + username + " does not exist for removal.");
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(responsePayload).build();
|
||||
}
|
||||
} catch (UserStoreException | MDMAPIException e) {
|
||||
@ -341,7 +341,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
/**
|
||||
* get all the roles except for the internal/xxx and application/xxx
|
||||
*
|
||||
* @param userStoreManager UserImpl Store Manager associated with the currently logged in user
|
||||
* @param userStoreManager User Store Manager associated with the currently logged in user
|
||||
* @param username Username of the currently logged in user
|
||||
* @return the list of filtered roles
|
||||
*/
|
||||
@ -354,7 +354,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
}
|
||||
List<String> filteredRoles = new ArrayList<>();
|
||||
for (String role : roleListOfUser) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("AuthenticationImpl/"))) {
|
||||
if (!(role.startsWith("Internal/") || role.startsWith("Authentication/"))) {
|
||||
filteredRoles.add(role);
|
||||
}
|
||||
}
|
||||
@ -379,22 +379,22 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
responsePayload.setResponseContent(Collections.singletonList(getFilteredRoles(userStoreManager, username)));
|
||||
// Outputting debug message upon successful removal of user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " was successfully removed.");
|
||||
log.debug("User by username: " + username + " was successfully removed.");
|
||||
}
|
||||
// returning response with success state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_OK);
|
||||
responsePayload.setMessageFromServer(
|
||||
"UserImpl roles obtained for user " + username);
|
||||
"User roles obtained for user " + username);
|
||||
return Response.status(Response.Status.OK).entity(responsePayload).build();
|
||||
} else {
|
||||
// Outputting debug message upon trying to remove non-existing user
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("UserImpl by username: " + username + " does not exist for role retrieval.");
|
||||
log.debug("User by username: " + username + " does not exist for role retrieval.");
|
||||
}
|
||||
// returning response with bad request state
|
||||
responsePayload.setStatusCode(HttpStatus.SC_BAD_REQUEST);
|
||||
responsePayload.setMessageFromServer(
|
||||
"UserImpl by username: " + username + " does not exist for role retrieval.");
|
||||
"User by username: " + username + " does not exist for role retrieval.");
|
||||
return Response.status(Response.Status.BAD_REQUEST).entity(responsePayload).build();
|
||||
}
|
||||
} catch (UserStoreException | MDMAPIException e) {
|
||||
@ -673,7 +673,7 @@ public class UserImpl implements org.wso2.carbon.device.mgt.jaxrs.api.User {
|
||||
}
|
||||
return Response.status(Response.Status.OK).entity(dmService.getDevicesOfUser(username)).build();
|
||||
} catch (DeviceManagementException e) {
|
||||
String msg = "DeviceImpl management error";
|
||||
String msg = "Device management error";
|
||||
log.error(msg, e);
|
||||
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class CredentialManagementResponseBuilder {
|
||||
|
||||
/**
|
||||
* Builds the response to change the password of a user
|
||||
* @param credentials - UserImpl credentials
|
||||
* @param credentials - User credentials
|
||||
* @return Response Object
|
||||
*/
|
||||
public static Response buildChangePasswordResponse(UserCredentialWrapper credentials) {
|
||||
@ -73,7 +73,7 @@ public class CredentialManagementResponseBuilder {
|
||||
|
||||
/**
|
||||
* Builds the response to reset the password of a user
|
||||
* @param credentials - UserImpl credentials
|
||||
* @param credentials - User credentials
|
||||
* @return Response Object
|
||||
*/
|
||||
public static Response buildResetPasswordResponse(UserCredentialWrapper credentials) {
|
||||
|
||||
@ -33,7 +33,7 @@ import org.wso2.carbon.device.mgt.jaxrs.beans.android.WebApplication;
|
||||
public class MDMAndroidOperationUtil {
|
||||
|
||||
/**
|
||||
* This method is used to create Install AuthenticationImpl operation.
|
||||
* This method is used to create Install Authentication operation.
|
||||
*
|
||||
* @param application MobileApp application
|
||||
* @return operation
|
||||
@ -76,7 +76,7 @@ public class MDMAndroidOperationUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used to create Uninstall AuthenticationImpl operation.
|
||||
* This method is used to create Uninstall Authentication operation.
|
||||
* @param application MobileApp application
|
||||
* @return operation
|
||||
* @throws MDMAPIException
|
||||
|
||||
@ -35,7 +35,7 @@ import java.util.Properties;
|
||||
public class MDMIOSOperationUtil {
|
||||
|
||||
/**
|
||||
* This method is used to create Install AuthenticationImpl operation.
|
||||
* This method is used to create Install Authentication operation.
|
||||
*
|
||||
* @param application MobileApp application
|
||||
* @return operation
|
||||
|
||||
@ -2,19 +2,19 @@
|
||||
<!--
|
||||
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~
|
||||
~ WSO2 Inc. licenses this file to you under the Apache LicenseImpl,
|
||||
~ Version 2.0 (the "LicenseImpl"); you may not use this file except
|
||||
~ in compliance with the LicenseImpl.
|
||||
~ You may obtain a copy of the LicenseImpl at
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the LicenseImpl is distributed on an
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the LicenseImpl for the
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the LicenseImpl.
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
||||
@ -2,19 +2,19 @@
|
||||
<!--
|
||||
~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~
|
||||
~ WSO2 Inc. licenses this file to you under the Apache LicenseImpl,
|
||||
~ Version 2.0 (the "LicenseImpl"); you may not use this file except
|
||||
~ in compliance with the LicenseImpl.
|
||||
~ You may obtain a copy of the LicenseImpl at
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~
|
||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||
~
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the LicenseImpl is distributed on an
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the LicenseImpl for the
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the LicenseImpl.
|
||||
~ under the License.
|
||||
-->
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
|
||||
<display-name>Admin-Webapp</display-name>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user