Move device-mgt UI config retrieving API into config-mgt API

reporting
tcdlpds@gmail.com 5 years ago
parent dc4bebde4e
commit 1dcc907ec6

@ -194,4 +194,30 @@ public interface DeviceManagementConfigService {
value = "The device transfer request",
required = true)
DeviceTransferRequest deviceTransferRequest);
@GET
@Path("/ui-config")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "get application management UI configuration",
notes = "This will get all UI configuration of application management"
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully got UI config."),
@ApiResponse(
code = 404,
message = "Not Found. There doesn't have an defined UI config." +
"query."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while getting the UI config.",
response = ErrorResponse.class)
})
Response getUiConfig();
}

@ -38,6 +38,8 @@ import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.config.keymanager.KeyManagerConfigurations;
import org.wso2.carbon.device.mgt.core.config.ui.UIConfiguration;
import org.wso2.carbon.device.mgt.core.config.ui.UIConfigurationManager;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo;
@ -157,6 +159,26 @@ public class DeviceManagementConfigServiceImpl implements DeviceManagementConfig
}
}
@GET
@Override
@Consumes("application/json")
@Path("/ui-config")
public Response getUiConfig() {
UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance();
if (uiConfigurationManager == null) {
String msg = "IoTS UI configuration manager is not initialized.";
log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig();
if (uiConfiguration == null) {
String msg = "IoTS UI configuration is not defined.";
log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
return Response.status(Response.Status.OK).entity(uiConfiguration).build();
}
private String parseUriParamsToJSON(String uriParams) {
uriParams = uriParams.replaceAll("=", "\":\"");
uriParams = uriParams.replaceAll("&", "\",\"");

@ -48,7 +48,8 @@
<context-param>
<param-name>nonSecuredEndPoints</param-name>
<param-value>
/api/device-mgt-config/v1.0/configurations
/api/device-mgt-config/v1.0/configurations,
/api/device-mgt-config/v1.0/configurations/ui-config
</param-value>
</context-param>

@ -191,31 +191,4 @@ public interface ConfigurationManagementService {
value = "The properties required to update the platform configurations.",
required = true)
PlatformConfiguration configuration);
@GET
@Path("/ui-config")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(
consumes = MediaType.APPLICATION_JSON,
produces = MediaType.APPLICATION_JSON,
httpMethod = "GET",
value = "get application management UI configuration",
notes = "This will get all UI configuration of application management"
)
@ApiResponses(
value = {
@ApiResponse(
code = 200,
message = "OK. \n Successfully got UI config."),
@ApiResponse(
code = 404,
message = "Not Found. There doesn't have an defined UI config." +
"query."),
@ApiResponse(
code = 500,
message = "Internal Server Error. \n Error occurred while getting the UI config.",
response = ErrorResponse.class)
})
Response getUiConfig();
}

@ -93,24 +93,4 @@ public class ConfigurationServiceImpl implements ConfigurationManagementService
new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build();
}
}
@GET
@Override
@Consumes("application/json")
@Path("/ui-config")
public Response getUiConfig() {
UIConfigurationManager uiConfigurationManager = UIConfigurationManager.getInstance();
if (uiConfigurationManager == null) {
String msg = "IoTS UI configuration manager is not initialized.";
log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
UIConfiguration uiConfiguration = uiConfigurationManager.getUIConfig();
if (uiConfiguration == null) {
String msg = "IoTS UI configuration is not defined.";
log.error(msg);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
}
return Response.status(Response.Status.OK).entity(uiConfiguration).build();
}
}

@ -48,8 +48,7 @@
<context-param>
<param-name>nonSecuredEndPoints</param-name>
<param-value>
/api/device-mgt/v1.0/users/validate,
/api/device-mgt/v1.0/configuration/ui-config
/api/device-mgt/v1.0/users/validate
</param-value>
</context-param>

@ -21,7 +21,7 @@ package io.entgra.ui.request.interceptor.util;
public class HandlerConstants {
public static final String PUBLISHER_APPLICATION_NAME = "application-mgt-publisher";
public static final String APP_REG_ENDPOINT = "/api-application-registration/register";
public static final String UI_CONFIG_ENDPOINT = "/api/device-mgt/v1.0/configuration/ui-config";
public static final String UI_CONFIG_ENDPOINT = "/api/device-mgt-config/v1.0/configurations/ui-config";
public static final String TOKEN_ENDPOINT = "/token";
public static final String INTROSPECT_ENDPOINT = "/oauth2/introspect";
public static final String LOGIN_PAGE = "/login";

Loading…
Cancel
Save