diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java index 14e0e1ded1..2cf90d4659 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/DeviceManagementConfigService.java @@ -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(); } diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java index 6fac3b8d8d..11fc0a2677 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/java/io/entgra/carbon/device/mgt/config/jaxrs/service/impl/DeviceManagementConfigServiceImpl.java @@ -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("&", "\",\""); diff --git a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml index 0c2afe4a6f..6b397c9fbe 100644 --- a/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/io.entgra.carbon.device.mgt.config.api/src/main/webapp/WEB-INF/web.xml @@ -48,7 +48,8 @@ nonSecuredEndPoints - /api/device-mgt-config/v1.0/configurations + /api/device-mgt-config/v1.0/configurations, + /api/device-mgt-config/v1.0/configurations/ui-config diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java index 868ae6f169..ce744e42bb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/ConfigurationManagementService.java @@ -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(); - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java index 8da23eba10..3953c53514 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/ConfigurationServiceImpl.java @@ -23,8 +23,8 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationManagementException; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.core.ui.config.UIConfiguration; -import org.wso2.carbon.device.mgt.core.ui.config.UIConfigurationManager; +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.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.service.api.ConfigurationManagementService; import org.wso2.carbon.device.mgt.jaxrs.service.impl.util.RequestValidationUtil; @@ -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(); - } } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml index 4c08378ea6..fffbfbdb24 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -48,8 +48,7 @@ nonSecuredEndPoints - /api/device-mgt/v1.0/users/validate, - /api/device-mgt/v1.0/configuration/ui-config + /api/device-mgt/v1.0/users/validate diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Checkbox.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Checkbox.java new file mode 100644 index 0000000000..fb40a4ad8f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Checkbox.java @@ -0,0 +1,24 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Checkbox") +public class Checkbox { +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Column.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Column.java new file mode 100644 index 0000000000..9c81780e6c --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Column.java @@ -0,0 +1,38 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Column") +public class Column { + + private String name; + private String valueType; + + @XmlAttribute(name = "name", required = true) + public String getName() { return name; } + + public void setName(String name) { this.name = name; } + + @XmlAttribute(name = "valueType", required = true) + public String getValueType() { return valueType; } + + public void setValueType(String valueType) { this.valueType = valueType; } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/ConditionList.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/ConditionList.java new file mode 100644 index 0000000000..31015d0c3f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/ConditionList.java @@ -0,0 +1,37 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "ConditionList") +public class ConditionList { + + List conditions; + + @XmlElement(name = "Key") + public List getConditions() { + return conditions; + } + + public void setConditions(List conditions) { + this.conditions = conditions; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Content.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Content.java new file mode 100644 index 0000000000..77de28d8f2 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Content.java @@ -0,0 +1,67 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Content") +public class Content { + + private String key; + private List items; + private List subContents; + private ConditionList conditionList; + + @XmlAttribute(name = "key", required = true) + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @XmlElementWrapper(name = "Items") + @XmlElement(name = "Item") + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + @XmlElementWrapper(name = "SubContents") + @XmlElement(name = "SubContent") + public List getSubContents() { return subContents; } + + public void setSubContents(List subContents) { this.subContents = subContents; } + + @XmlElement(name = "ConditionList") + public ConditionList getConditionList() { + return conditionList; + } + + public void setConditionList(ConditionList conditionList) { + this.conditionList = conditionList; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java new file mode 100644 index 0000000000..897abc67de --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Feature.java @@ -0,0 +1,50 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Feature") +public class Feature { + + private String featureCode; + private List contents; + + @XmlAttribute(name = "code", required = true) + public String getFeatureCode() { + return featureCode; + } + + public void setFeatureCode(String featureCode) { + this.featureCode = featureCode; + } + + @XmlElementWrapper(name = "Contents") + @XmlElement(name = "Content") + public List getContents() { + return contents; + } + + public void setContents(List contents) { + this.contents = contents; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Input.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Input.java new file mode 100644 index 0000000000..664a5299b2 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Input.java @@ -0,0 +1,66 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Input") +public class Input { + + private String type; + private String placeholderValue; + private String regEx; + private String validationMessage; + + @XmlElement(name = "Type") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @XmlElement(name = "Placeholder") + public String getPlaceholderValue() { + return placeholderValue; + } + + public void setPlaceholderValue(String placeholderValue) { + this.placeholderValue = placeholderValue; + } + + @XmlElement(name = "Regex") + public String getRegEx() { + return regEx; + } + + public void setRegEx(String regEx) { + this.regEx = regEx; + } + + @XmlElement(name = "ValidationMsg") + public String getValidationMessage() { + return validationMessage; + } + + public void setValidationMessage(String validationMessage) { + this.validationMessage = validationMessage; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Item.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Item.java new file mode 100644 index 0000000000..eccd9717cf --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Item.java @@ -0,0 +1,136 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Item") +public class Item { + + private String label; + private String tooltip; + private String key; + private String value; + private boolean isRequired; + private String subTitle; + private ConditionList conditionList; + private Notification notification; + private Checkbox checkbox; + private Select select; + private Input input; + private TimeSelector timeSelector; + private Table table; + + @XmlElement(name = "Label") + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + @XmlElement(name = "Tooltip") + public String getTooltip() { + return tooltip; + } + + public void setTooltip(String tooltip) { + this.tooltip = tooltip; + } + + @XmlElement(name = "Key") + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + @XmlElement(name = "Value") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + @XmlElement(name = "RequiredItem") + public boolean isRequired() { + return isRequired; + } + + public void setRequired(boolean required) { + isRequired = required; + } + + @XmlElement(name = "SubTitle") + public String getSubTitle() { return subTitle; } + + public void setSubTitle(String subTitle) { this.subTitle = subTitle; } + + @XmlElement(name = "ConditionList") + public ConditionList getConditionList() { return conditionList; } + + public void setConditionList(ConditionList conditionList) { this.conditionList = conditionList; } + + @XmlElement(name = "Notification") + public Notification getNotification() { return notification; } + + public void setNotification(Notification notification) { this.notification = notification; } + + @XmlElement(name = "Checkbox") + public Checkbox getCheckbox() { + return checkbox; + } + + public void setCheckbox(Checkbox checkbox) { + this.checkbox = checkbox; + } + + @XmlElement(name = "Select") + public Select getSelect() { + return select; + } + + public void setSelect(Select select) { + this.select = select; + } + + @XmlElement(name = "Input") + public Input getInput() { + return input; + } + + public void setInput(Input input) { + this.input = input; + } + + @XmlElement(name = "TimeSelector") + public TimeSelector getTimeSelector() { return timeSelector; } + + public void setTimeSelector(TimeSelector timeSelector) { this.timeSelector = timeSelector; } + + @XmlElement(name = "Table") + public Table getTable() { return table; } + + public void setTable(Table table) { this.table = table; } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Key.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Key.java new file mode 100644 index 0000000000..303d634d26 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Key.java @@ -0,0 +1,46 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Key") +public class Key { + + private String name; + private String value; + + @XmlAttribute(name = "name") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlAttribute(name = "value") + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Notification.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Notification.java new file mode 100644 index 0000000000..31560dd931 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Notification.java @@ -0,0 +1,38 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Notification") +public class Notification { + + private String type; + private String value; + + @XmlElement(name = "Type") + public String getType() { return type; } + + public void setType(String type) { this.type = type; } + + @XmlElement(name = "Value") + public String getValue() { return value; } + + public void setValue(String value) { this.value = value; } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Option.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Option.java new file mode 100644 index 0000000000..f0b54250d6 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Option.java @@ -0,0 +1,46 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "Option") +public class Option { + + private String definedValue; + private String displayingValue; + + @XmlAttribute(name = "value", required = true) + public String getDefinedValue() { + return definedValue; + } + + public void setDefinedValue(String definedValue) { + this.definedValue = definedValue; + } + + @XmlAttribute(name = "display", required = true) + public String getDisplayingValue() { + return displayingValue; + } + + public void setDisplayingValue(String displayingValue) { + this.displayingValue = displayingValue; + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Policy.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Policy.java new file mode 100644 index 0000000000..c2ffe0fbab --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Policy.java @@ -0,0 +1,60 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Policy") +public class Policy { + + private String description; + private String name; + private List features; + + @XmlElement(name = "Description", required = true) + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @XmlAttribute(name = "name", required = true) + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @XmlElementWrapper(name = "Features") + @XmlElement(name = "Feature") + public List getFeatures() { + return features; + } + + public void setFeatures(List features) { + this.features = features; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/config/AppRegistration.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/PolicyUIConfiguration.java similarity index 52% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/config/AppRegistration.java rename to components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/PolicyUIConfiguration.java index 4d764745c1..b051e6ba79 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/config/AppRegistration.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/PolicyUIConfiguration.java @@ -1,4 +1,4 @@ -/* Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. * * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -14,34 +14,26 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.common.config; + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; import java.util.List; -public class AppRegistration { - - private List tags; - private boolean isAllowToAllDomains; - - @XmlElementWrapper(name = "Tags") - @XmlElement(name = "Tag") - public List getTags() { - return tags; - } +@XmlRootElement(name = "PolicyUIConfiguration") +public class PolicyUIConfiguration { - public void setTags(List tags) { - this.tags = tags; - } + private List policies; - @XmlElement(name = "AllowToAllDomains") - public boolean isAllowToAllDomains() { - return isAllowToAllDomains; + @XmlElementWrapper(name = "Policies") + @XmlElement(name = "Policy") + public List getPolicies() { + return policies; } - public void setAllowToAllDomains(boolean allowToAllDomains) { - isAllowToAllDomains = allowToAllDomains; + public void setPolicies(List policies) { + this.policies = policies; } - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Select.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Select.java new file mode 100644 index 0000000000..b8d8c07618 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/policy/mgt/ui/Select.java @@ -0,0 +1,49 @@ +/* Copyright (c) 2020, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. 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 License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.wso2.carbon.device.mgt.common.policy.mgt.ui; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; + +@XmlRootElement(name = "Select") +public class Select { + + private String valueType; + private List