diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/DataSource.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/DataSource.java index d55db0e6cb..f416facc4a 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/DataSource.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/DataSource.java @@ -34,8 +34,8 @@ import javax.xml.bind.annotation.XmlType; * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> - * <element name="jndiConfig" type="{}jndiConfig"/> - * <element name="tableConfig" type="{}tableConfig"/> + * <element name="JndiConfig" type="{}JndiConfig"/> + * <element name="TableConfig" type="{}TableConfig"/> * </sequence> * </restriction> * </complexContent> @@ -51,9 +51,10 @@ import javax.xml.bind.annotation.XmlType; }) public class DataSource { - @XmlElement(required = true) + @XmlElement(name = "JndiConfig", required = true) protected JndiConfig jndiConfig; - @XmlElement(required = true) + + @XmlElement(name = "TableConfig", required = true) protected TableConfig tableConfig; /** diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/JndiConfig.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/JndiConfig.java index a43dc26b9c..d28201d8a0 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/JndiConfig.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/JndiConfig.java @@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlType; *
The following schema fragment specifies the expected content contained within this class. * *
- * <complexType name="jndiConfig"> + * <complexType name="JndiConfig"> * <complexContent> * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * <sequence> @@ -44,12 +44,12 @@ import javax.xml.bind.annotation.XmlType; * */ @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "jndiConfig", propOrder = { +@XmlType(name = "JndiConfig", propOrder = { "name" }) public class JndiConfig { - @XmlElement(required = true) + @XmlElement(name = "Name", required = true) protected String name; /** diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/TableConfig.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/TableConfig.java index c587844033..4d912e2dd1 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/TableConfig.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/config/TableConfig.java @@ -46,7 +46,7 @@ import javax.xml.bind.annotation.XmlType; * */ @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "tableConfig", propOrder = { +@XmlType(name = "TableConfig", propOrder = { "table" }) public class TableConfig { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js index d52d8e7df4..d7d7b99f14 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js @@ -125,6 +125,11 @@ $("#policy-name-input").focus(function(){ validateInline["policy-name"](); }); +/** + * Forward action of device type selection step. Loads relevant policy profile configurations. + * + * @param actionButton + */ stepForwardFrom["policy-platform"] = function (actionButton) { $("#device-type-policy-operations").html("").addClass("hidden"); $("#generic-policy-operations").addClass("hidden"); @@ -175,17 +180,26 @@ stepForwardFrom["policy-platform"] = function (actionButton) { }); }; +/** + * Forward action of policy profile page. Generates policy profile payload. + */ stepForwardFrom["policy-profile"] = function () { policy["profile"] = operationModule.generateProfile(policy["platform"], configuredOperations); // updating next-page wizard title with selected platform $("#policy-criteria-page-wizard-title").text("ADD " + policy["platform"] + " POLICY"); }; +/** + * Backward action of policy profile page. Moves back to platform selection step. + */ stepBackFrom["policy-profile"] = function () { // reinitialize configuredOperations configuredOperations = []; }; +/** + * Forward action of policy criteria page. + */ stepForwardFrom["policy-criteria"] = function () { $("input[type='radio'].select-users-radio").each(function () { if ($(this).is(':radio')) { @@ -223,6 +237,11 @@ var inputIsValidAgainstLength = function (input, minLength, maxLength) { return (length == minLength || (length > minLength && length < maxLength) || length == maxLength); }; +/** + * Validates policy criteria inputs. + * + * @returns {boolean} whether the validation is successful. + */ validateStep["policy-criteria"] = function () { var validationStatus = {}; var selectedAssignees; @@ -261,6 +280,11 @@ validateStep["policy-criteria"] = function () { return wizardIsToBeContinued; }; +/** + * Validating policy naming. + * + * @returns {boolean} whether the validation is successful. + */ validateStep["policy-naming"] = function () { var validationStatus = {}; @@ -390,7 +414,7 @@ var savePolicy = function (policy, isActive, serviceURL) { payload["roles"] = []; } - if(policy["selectedGroups"]) { + if(policy["selectedGroups"] && policy["selectedGroups"][0] !== "NONE") { payload["deviceGroups"] = policy["selectedGroups"]; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index fc69aa53e4..ce37d8d6a9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -65,7 +65,7 @@ var disableInlineError = function (inputField, errorMsg, errorSign) { /** * Load all device groups. - * + * * @param callback function to call on loading completion. */ function loadGroups(callback) { @@ -79,7 +79,7 @@ function loadGroups(callback) { /** * Creates DeviceGroupWrapper object from selected groups. - * + * * @param selectedGroups * @returns {Array} DeviceGroupWrapper list. */ @@ -200,7 +200,7 @@ skipStep["policy-platform"] = function (policyPayloadObj) { script.type = 'text/javascript'; script.src = policyOperationsScriptSrc; $(".wr-advance-operations").prepend(script); - var configuredOperations = operationModule.populateProfile(policy["platform"], + var configuredOperations = operationModule.populateProfile(policy["platform"], policyPayloadObj["profile"]["profileFeaturesList"]); polulateProfileOperations(configuredOperations); } @@ -223,12 +223,18 @@ skipStep["policy-platform"] = function (policyPayloadObj) { }); }; +/** + * Forward action of policy profile page. Generates policy profile payload. + */ stepForwardFrom["policy-profile"] = function () { policy["profile"] = operationModule.generateProfile(policy["platform"], configuredOperations); // updating next-page wizard title with selected platform $("#policy-criteria-page-wizard-title").text("EDIT " + policy["platform"] + " POLICY - " + policy["name"]); }; +/** + * Forward action of policy criteria page. + */ stepForwardFrom["policy-criteria"] = function () { $("input[type='radio'].select-users-radio").each(function () { if ($(this).is(':radio')) { @@ -267,6 +273,11 @@ var inputIsValidAgainstLength = function (input, minLength, maxLength) { return (length == minLength || (length > minLength && length < maxLength) || length == maxLength); }; +/** + * Validates policy criteria inputs. + * + * @returns {boolean} whether the validation is successful. + */ validateStep["policy-criteria"] = function () { var validationStatus = {}; var selectedAssignees; @@ -305,6 +316,11 @@ validateStep["policy-criteria"] = function () { return wizardIsToBeContinued; }; +/** + * Validating policy naming. + * + * @returns {boolean} whether the validation is successful. + */ validateStep["policy-naming"] = function () { var validationStatus = {}; @@ -444,7 +460,7 @@ var updatePolicy = function (policy, state) { payload["roles"] = []; } - if (policy["selectedGroups"]) { + if (policy["selectedGroups"] && policy["selectedGroups"][0] !== "NONE") { payload["deviceGroups"] = policy["selectedGroups"]; }