From a954de26f9d860bf2d5e81e410d5373c9a4b719d Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 16 May 2016 17:04:47 +0530 Subject: [PATCH 1/6] Moved api from device-mgt --- .../jaggeryapps/devicemgt/api/policy-api.jag | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag new file mode 100644 index 000000000..fb9e2215d --- /dev/null +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/api/policy-api.jag @@ -0,0 +1,55 @@ +<% +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * 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 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. + */ + +var uri = request.getRequestURI(); +var uriMatcher = new URIMatcher(String(uri)); + +var log = new Log("api/policy-api.jag"); + +var constants = require("/app/modules/constants.js"); +var policyModule = require("/app/modules/policy.js").policyModule; + +var deviceType, deviceId; + +var user = session.get(constants.USER_SESSION_KEY); + +var responseProcessor = require('utils').response; +response.contentType = 'application/json'; + +if (!user) { + response = responseProcessor.buildErrorResponse(response, 401, "Unauthorized"); +} else { + if (uriMatcher.match("/{context}/api/policies/add")) { + var content = request.getContent(); + var policyName = content.policyName; + var policyDefinition = content.profile.policyDefinition; + var policyDescription = content.profile.policyDescription; + deviceType = content.profile.deviceType.name; + deviceId = content.deviceId; + try { + response.content = policyModule.addPolicy(policyName, deviceType, policyDefinition, + policyDescription, deviceId); + } catch (e) { + log.error("Exception occurred while trying to add new policy under name:" + policyName, e); + // http status code 500 refers to - Internal Server Error. + responseProcessor.buildErrorResponse(response, 500, "Internal server error"); + } + } +} +%> From eb57d385071d7403efb30163729b28df1b51315d Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 16 May 2016 17:51:19 +0530 Subject: [PATCH 2/6] Fix for https://wso2.org/jira/browse/IOTS-152 --- .../configuration.hbs | 492 ---------- .../configuration.json | 4 - .../public/js/platform-configuration.js | 856 ------------------ .../configuration.hbs | 5 - .../configuration.json | 5 - 5 files changed, 1362 deletions(-) delete mode 100644 components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.hbs delete mode 100644 components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.json delete mode 100644 components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/public/js/platform-configuration.js delete mode 100644 components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs delete mode 100644 components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.hbs b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.hbs deleted file mode 100644 index 94522b0bb..000000000 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.hbs +++ /dev/null @@ -1,492 +0,0 @@ -
-
- -
-
-

- Platform Configurations -

-
- General and Platform Specific Server Settings for the Tenant -
-
-
-
- - -
- -
-
- -
- -
- - -
-
- -
-
- - -
-
- - - -
-
-
- - -
- - -
- -
-
- - -
-
- -
-
- - -
- -
- - -
-
-
- - -
-
- -
-
- -
-
-
-
- - - -
-
- - -
- - -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
-
- - - -
- -
- - -
-
- - - -
- -
-
- - -
- -
- - -
- -
- - -
- -
- - -
-
- - - -
- -
-
- - -
- -
- - -
- -
- - -
-
- - -
-
- -
-
- -
-
-
-
- - - -
-
-
- - -
-
- - -
-
-
- - -
-
- -
-
- -
-
-
-
- -
-
-
-
- - - -
-
-{{#zone "bottomJs"}} - {{js "js/platform-configuration.js"}} -{{/zone}} diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.json b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.json deleted file mode 100644 index be0496bf6..000000000 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/configuration.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version" : "1.0.0", - "extends": "cdmf.unit.platform.configuration" -} \ No newline at end of file diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/public/js/platform-configuration.js b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/public/js/platform-configuration.js deleted file mode 100644 index 41123e12a..000000000 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.platform.configuration/public/js/platform-configuration.js +++ /dev/null @@ -1,856 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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. - */ - -/** - * Checks if provided input is valid against RegEx input. - * - * @param regExp Regular expression - * @param inputString Input string to check - * @returns {boolean} Returns true if input matches RegEx - */ -function inputIsValid(regExp, inputString) { - return regExp.test(inputString); -} - -/** - * Checks if an email address has the valid format or not. - * - * @param email Email address - * @returns {boolean} true if email has the valid format, otherwise false. - */ -function emailIsValid(email) { - var regExp = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; - return regExp.test(email); -} - -var notifierTypeConstants = { - "LOCAL": "1", - "GCM": "2" -}; -// Constants to define platform types available -var platformTypeConstants = { - "ANDROID": "android", - "IOS": "ios", - "WINDOWS": "windows" -}; - -var responseCodes = { - "CREATED": "Created", - "SUCCESS": "201", - "INTERNAL_SERVER_ERROR": "Internal Server Error" -}; - -var configParams = { - "NOTIFIER_TYPE": "notifierType", - "NOTIFIER_FREQUENCY": "notifierFrequency", - "GCM_API_KEY": "gcmAPIKey", - "GCM_SENDER_ID": "gcmSenderId", - "ANDROID_EULA": "androidEula", - "IOS_EULA": "iosEula", - "CONFIG_COUNTRY": "configCountry", - "CONFIG_STATE": "configState", - "CONFIG_LOCALITY": "configLocality", - "CONFIG_ORGANIZATION": "configOrganization", - "CONFIG_ORGANIZATION_UNIT": "configOrganizationUnit", - "MDM_CERT_PASSWORD": "MDMCertPassword", - "MDM_CERT_TOPIC_ID": "MDMCertTopicID", - "APNS_CERT_PASSWORD": "APNSCertPassword", - "MDM_CERT": "MDMCert", - "MDM_CERT_NAME": "MDMCertName", - "APNS_CERT": "APNSCert", - "APNS_CERT_NAME": "APNSCertName", - "ORG_DISPLAY_NAME": "organizationDisplayName", - "GENERAL_EMAIL_HOST": "emailHost", - "GENERAL_EMAIL_PORT": "emailPort", - "GENERAL_EMAIL_USERNAME": "emailUsername", - "GENERAL_EMAIL_PASSWORD": "emailPassword", - "GENERAL_EMAIL_SENDER_ADDRESS": "emailSender", - "GENERAL_EMAIL_TEMPLATE": "emailTemplate", - "COMMON_NAME": "commonName", - "KEYSTORE_PASSWORD": "keystorePassword", - "PRIVATE_KEY_PASSWORD": "privateKeyPassword", - "BEFORE_EXPIRE": "beforeExpire", - "AFTER_EXPIRE": "afterExpire", - "WINDOWS_EULA": "windowsLicense" -}; - -$(document).ready(function () { - $("#gcm-inputs").hide(); - tinymce.init({ - selector: "textarea", - theme: "modern", - plugins: [ - "advlist autolink lists link image charmap print preview anchor", - "searchreplace visualblocks code fullscreen", - "insertdatetime image table contextmenu paste" - ], - toolbar: "undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image" - }); - - var getAndroidConfigAPI = "/mdm-android-agent/configuration"; - var getGeneralConfigAPI = "/devicemgt_admin/configuration"; - var getIosConfigAPI = "/ios/configuration"; - var getWindowsConfigAPI = "/mdm-windows-agent/services/configuration"; - - /** - * Following requests would execute - * on page load event of platform configuration page in WSO2 EMM Console. - * Upon receiving the response, the parameters will be set to the fields, - * in case those configurations are already set. - */ - invokerUtil.get( - getAndroidConfigAPI, - - function (data) { - data = JSON.parse(data); - if (data != null && data.configuration != null) { - for (var i = 0; i < data.configuration.length; i++) { - var config = data.configuration[i]; - if(config.name == configParams["NOTIFIER_TYPE"]){ - $("#android-config-notifier").val(config.value); - if(config.value != notifierTypeConstants["GCM"] ) { - $("#gcm-inputs").hide(); - }else{ - $("#gcm-inputs").show(); - } - } else if(config.name == configParams["NOTIFIER_FREQUENCY"]){ - $("input#android-config-notifier-frequency").val(config.value); - } else if(config.name == configParams["GCM_API_KEY"]){ - $("input#android-config-gcm-api-key").val(config.value); - } else if(config.name == configParams["GCM_SENDER_ID"]){ - $("input#android-config-gcm-sender-id").val(config.value); - } else if(config.name == configParams["ANDROID_EULA"]){ - $("#android-eula").val(config.value); - } - } - } - - }, function () { - - } - ); - - invokerUtil.get( - getGeneralConfigAPI, - - function (data) { - data = JSON.parse(data); - if (data != null && data.configuration != null) { - for (var i = 0; i < data.configuration.length; i++) { - var config = data.configuration[i]; - if(config.name == configParams["NOTIFIER_FREQUENCY"]){ - $("input#monitoring-config-frequency").val(config.value); - } - /*if(config.name == configParams["GENERAL_EMAIL_HOST"]){ - $("input#email-config-host").val(config.value); - } else if(config.name == configParams["GENERAL_EMAIL_PORT"]){ - $("input#email-config-port").val(config.value); - } else if(config.name == configParams["GENERAL_EMAIL_USERNAME"]){ - $("input#email-config-username").val(config.value); - } else if(config.name == configParams["GENERAL_EMAIL_PASSWORD"]){ - $("input#email-config-password").val(config.value); - } else if(config.name == configParams["GENERAL_EMAIL_SENDER_ADDRESS"]){ - $("input#email-config-sender-email").val(config.value); - } else if(config.name == configParams["GENERAL_EMAIL_TEMPLATE"]){ - $("input#email-config-template").val(config.value); - }*/ - } - } - - }, function () { - - } - ); - - invokerUtil.get( - getIosConfigAPI, - - function (data) { - data = JSON.parse(data); - if (data != null && data.configuration != null) { - for (var i = 0; i < data.configuration.length; i++) { - var config = data.configuration[i]; - if(config.name == configParams["CONFIG_COUNTRY"]){ - $("input#ios-config-country").val(config.value); - } else if(config.name == configParams["CONFIG_STATE"]){ - $("input#ios-config-state").val(config.value); - } else if(config.name == configParams["CONFIG_LOCALITY"]){ - $("input#ios-config-locality").val(config.value); - } else if(config.name == configParams["CONFIG_ORGANIZATION"]){ - $("input#ios-config-organization").val(config.value); - } else if(config.name == configParams["CONFIG_ORGANIZATION_UNIT"]){ - $("input#ios-config-organization-unit").val(config.value); - } else if(config.name == configParams["MDM_CERT_PASSWORD"]){ - $("input#ios-config-mdm-certificate-password").val(config.value); - } else if(config.name == configParams["MDM_CERT_TOPIC_ID"]){ - $("input#ios-config-mdm-certificate-topic-id").val(config.value); - } else if(config.name == configParams["APNS_CERT_PASSWORD"]){ - $("input#ios-config-apns-certificate-password").val(config.value); - } else if(config.name == configParams["MDM_CERT_NAME"]){ - $("#mdm-cert-file-name").html(config.value); - } else if(config.name == configParams["APNS_CERT_NAME"]){ - $("#apns-cert-file-name").html(config.value); - } else if(config.name == configParams["ORG_DISPLAY_NAME"]){ - $("input#ios-org-display-name").val(config.value); - } else if(config.name == configParams["IOS_EULA"]){ - $("#ios-eula").val(config.value); - } - } - } - - }, function () { - - } - ); - - invokerUtil.get( - getWindowsConfigAPI, - - function (data) { - data = JSON.parse(data); - if (data != null && data.configuration != null) { - for (var i = 0; i < data.configuration.length; i++) { - var config = data.configuration[i]; - if(config.name == configParams["NOTIFIER_FREQUENCY"]) { - $("input#windows-config-notifier-frequency").val(config.value); - } else if(config.name == configParams["WINDOWS_EULA"]) { - $("#windows-eula").val(config.value); - } - } - } - - }, function () { - - } - ); - - - $("select.select2[multiple=multiple]").select2({ - tags : true - }); - - $("#android-config-notifier").change(function() { - var notifierType = $("#android-config-notifier").find("option:selected").attr("value"); - if(notifierType != notifierTypeConstants["GCM"] ) { - $("#gcm-inputs").hide(); - $("#local-inputs").show(); - }else{ - $("#local-inputs").hide(); - $("#gcm-inputs").show(); - } - }); - /** - * Following click function would execute - * when a user clicks on "Save" button - * on Android platform configuration page in WSO2 EMM Console. - */ - $("button#save-android-btn").click(function() { - var notifierType = $("#android-config-notifier").find("option:selected").attr("value"); - var notifierFrequency = $("input#android-config-notifier-frequency").val(); - var gcmAPIKey = $("input#android-config-gcm-api-key").val(); - var gcmSenderId = $("input#android-config-gcm-sender-id").val(); - var androidLicense = tinymce.get('android-eula').getContent(); - - var errorMsgWrapper = "#android-config-error-msg"; - var errorMsg = "#android-config-error-msg span"; - if (!notifierFrequency) { - $(errorMsg).text("Notifier frequency is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!$.isNumeric(notifierFrequency)) { - $(errorMsg).text("Provided notifier frequency is invalid. Please check."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (notifierType == notifierTypeConstants["GCM"] && !gcmAPIKey) { - $(errorMsg).text("GCM API Key is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (notifierType == notifierTypeConstants["GCM"] && !gcmSenderId) { - $(errorMsg).text("GCM Sender ID is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - - var addConfigFormData = {}; - var configList = new Array(); - - var type = { - "name": configParams["NOTIFIER_TYPE"], - "value": notifierType, - "contentType": "text" - }; - - var frequency = { - "name": configParams["NOTIFIER_FREQUENCY"], - "value": notifierFrequency, - "contentType": "text" - }; - - var gcmKey = { - "name": configParams["GCM_API_KEY"], - "value": gcmAPIKey, - "contentType": "text" - }; - - var gcmId = { - "name": configParams["GCM_SENDER_ID"], - "value": gcmSenderId, - "contentType": "text" - }; - - var androidEula = { - "name": configParams["ANDROID_EULA"], - "value": androidLicense, - "contentType": "text" - }; - - configList.push(type); - configList.push(frequency); - configList.push(androidEula); - if (notifierType == notifierTypeConstants["GCM"]) { - configList.push(gcmKey); - configList.push(gcmId); - } - - addConfigFormData.type = platformTypeConstants["ANDROID"]; - addConfigFormData.configuration = configList; - - var addConfigAPI = "/mdm-android-agent/configuration"; - - invokerUtil.post( - addConfigAPI, - addConfigFormData, - function (data) { - data = JSON.parse(data); - if (data.responseCode == responseCodes["CREATED"]) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 403) { - $(errorMsg).text("Action was not permitted."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - - $(errorMsgWrapper).removeClass("hidden"); - }, function () { - $(errorMsg).text("An unexpected error occurred."); - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); - - /** - * Following click function would execute - * when a user clicks on "Save" button - * on General platform configuration page in WSO2 EMM Console. - */ - $("button#save-general-btn").click(function() { - var notifierFrequency = $("input#monitoring-config-frequency").val(); - /*var emailHost = $("input#email-config-host").val(); - var emailPort = $("input#email-config-port").val(); - var emailUsername = $("input#email-config-username").val(); - var emailPassword = $("input#email-config-password").val(); - var emailSenderAddress = $("input#email-config-sender-email").val(); - var emailTemplate = $("input#email-config-template").val();*/ - - var errorMsgWrapper = "#email-config-error-msg"; - var errorMsg = "#email-config-error-msg span"; - - if (!notifierFrequency) { - $(errorMsg).text("Monitoring frequency is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!$.isNumeric(notifierFrequency)) { - $(errorMsg).text("Provided monitoring frequency is invalid. It must be a number."); - $(errorMsgWrapper).removeClass("hidden"); - } else { - - var addConfigFormData = {}; - var configList = new Array(); - - var monitorFrequency = { - "name": configParams["NOTIFIER_FREQUENCY"], - "value": notifierFrequency, - "contentType": "text" - }; - - /*if (!emailHost) { - $(errorMsg).text("Email Host is a required field. It cannot be empty."); - //$(errorMsgWrapper).removeClass("hidden"); - } else if (!notifierFrequency) { - $(errorMsg).text("Monitoring frequency is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!$.isNumeric(notifierFrequency)) { - $(errorMsg).text("Provided monitoring frequency is invalid. It must be a number."); - $(errorMsgWrapper).removeClass("hidden"); - }else if (!emailPort) { - $(errorMsg).text("Email Port is a required field. It cannot be empty."); - //$(errorMsgWrapper).removeClass("hidden"); - } else if (!emailUsername) { - $(errorMsg).text("Username is a required field. It cannot be empty."); - //$(errorMsgWrapper).removeClass("hidden"); - } else if (!emailPassword) { - $(errorMsg).text("Password is a required field. It cannot be empty."); - //$(errorMsgWrapper).removeClass("hidden"); - } else if (!emailSenderAddress) { - $(errorMsg).text("Sender Email Address is a required field. It cannot be empty."); - //$(errorMsgWrapper).removeClass("hidden"); - } else if (!emailIsValid(emailSenderAddress)) { - $(errorMsg).text("Provided sender email is invalid. Please check."); - //$(errorMsgWrapper).removeClass("hidden"); - } */ - - /*var host = { - "name": configParams["GENERAL_EMAIL_HOST"], - "value": emailHost, - "contentType": "text" - }; - - var port = { - "name": configParams["GENERAL_EMAIL_PORT"], - "value": emailPort, - "contentType": "text" - }; - - var username = { - "name": configParams["GENERAL_EMAIL_USERNAME"], - "value": emailUsername, - "contentType": "text" - }; - - var password = { - "name": configParams["GENERAL_EMAIL_PASSWORD"], - "value": emailPassword, - "contentType": "text" - }; - - var sender = { - "name": configParams["GENERAL_EMAIL_SENDER_ADDRESS"], - "value": emailSenderAddress, - "contentType": "text" - }; - - var template = { - "name": configParams["GENERAL_EMAIL_TEMPLATE"], - "value": emailTemplate, - "contentType": "text" - };*/ - - configList.push(monitorFrequency); - /*configList.push(host); - configList.push(port); - configList.push(username); - configList.push(password); - configList.push(sender); - configList.push(template);*/ - - addConfigFormData.configuration = configList; - - var addConfigAPI = "/devicemgt_admin/configuration"; - - invokerUtil.post( - addConfigAPI, - addConfigFormData, - function (data) { - data = JSON.parse(data); - if (data.statusCode == responseCodes["SUCCESS"]) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 403) { - $(errorMsg).text("Action was not permitted."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - - $(errorMsgWrapper).removeClass("hidden"); - }, function () { - $(errorMsg).text("An unexpected error occurred."); - $(errorMsgWrapper).removeClass("hidden"); - } - ); - } - }); - - var errorMsgWrapper = "#ios-config-error-msg"; - var errorMsg = "#ios-config-error-msg span"; - var fileTypes = ['pfx']; - var notSupportedError = false; - - var base64MDMCert = ""; - var fileInputMDMCert = $('#ios-config-mdm-certificate'); - var fileNameMDMCert = ""; - var invalidFormatMDMCert = false; - - var base64APNSCert = ""; - var fileInputAPNSCert = $('#ios-config-apns-certificate'); - var fileNameAPNSCert = ""; - var invalidFormatAPNSCert = false; - - $(fileInputMDMCert).change(function() { - - if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { - $(errorMsg).text("The File APIs are not fully supported in this browser."); - $(errorMsgWrapper).removeClass("hidden"); - notSupportedError = true; - return; - } - - var file = fileInputMDMCert[0].files[0]; - fileNameMDMCert = file.name; - var extension = file.name.split('.').pop().toLowerCase(), - isSuccess = fileTypes.indexOf(extension) > -1; - - if (isSuccess) { - var fileReader = new FileReader(); - fileReader.onload = function(event) { - base64MDMCert = event.target.result; - }; - fileReader.readAsDataURL(file); - invalidFormatMDMCert = false; - } else { - base64MDMCert = ""; - invalidFormatMDMCert = true; - } - }); - - $(fileInputAPNSCert).change(function() { - - if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { - $(errorMsg).text("The File APIs are not fully supported in this browser."); - $(errorMsgWrapper).removeClass("hidden"); - notSupportedError = true; - return; - } - - var file = fileInputAPNSCert[0].files[0]; - fileNameAPNSCert = file.name; - var extension = file.name.split('.').pop().toLowerCase(), - isSuccess = fileTypes.indexOf(extension) > -1; - - if (isSuccess) { - var fileReader = new FileReader(); - fileReader.onload = function(event) { - base64APNSCert = event.target.result; - }; - fileReader.readAsDataURL(file); - invalidFormatAPNSCert = false; - } else { - base64MDMCert = ""; - invalidFormatAPNSCert = true; - } - }); - - $("button#save-ios-btn").click(function() { - - var configCountry = $("#ios-config-country").val(); - var configState = $("#ios-config-state").val(); - var configLocality = $("#ios-config-locality").val(); - var configOrganization = $("#ios-config-organization").val(); - var configOrganizationUnit = $("#ios-config-organization-unit").val(); - var MDMCertPassword = $("#ios-config-mdm-certificate-password").val(); - var MDMCertTopicID = $("#ios-config-mdm-certificate-topic-id").val(); - var APNSCertPassword = $("#ios-config-apns-certificate-password").val(); - var configOrgDisplayName = $("#ios-org-display-name").val(); - var iosLicense = tinymce.get('ios-eula').getContent(); - - if (!configCountry) { - $(errorMsg).text("SCEP country is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!configState) { - $(errorMsg).text("SCEP state is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!configLocality) { - $(errorMsg).text("SCEP locality is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!configOrganization) { - $(errorMsg).text("SCEP organization is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!configOrganizationUnit) { - $(errorMsg).text("SCEP organization unit is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!MDMCertPassword) { - $(errorMsg).text("MDM certificate password is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!MDMCertTopicID) { - $(errorMsg).text("MDM certificate topic ID is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!APNSCertPassword) { - $(errorMsg).text("APNS certificate password is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if(notSupportedError) { - $(errorMsg).text("The File APIs are not fully supported in this browser."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (invalidFormatMDMCert) { - $(errorMsg).text("MDM certificate needs to be in pfx format."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (base64MDMCert == '') { - $(errorMsg).text("MDM certificate is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (invalidFormatAPNSCert) { - $(errorMsg).text("APNS certificate needs to be in pfx format."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (base64APNSCert == '') { - $(errorMsg).text("APNS certificate is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!configOrgDisplayName) { - $(errorMsg).text("Organization display name is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } - - var addConfigFormData = {}; - var configList = new Array(); - - var configCountry = { - "name": configParams["CONFIG_COUNTRY"], - "value": configCountry, - "contentType": "text" - }; - - var configState = { - "name": configParams["CONFIG_STATE"], - "value": configState, - "contentType": "text" - }; - - var configLocality = { - "name": configParams["CONFIG_LOCALITY"], - "value": configLocality, - "contentType": "text" - }; - - var configOrganization = { - "name": configParams["CONFIG_ORGANIZATION"], - "value": configOrganization, - "contentType": "text" - }; - - var configOrganizationUnit = { - "name": configParams["CONFIG_ORGANIZATION_UNIT"], - "value": configOrganizationUnit, - "contentType": "text" - }; - - var MDMCertPassword = { - "name": configParams["MDM_CERT_PASSWORD"], - "value": MDMCertPassword, - "contentType": "text" - }; - - var MDMCertTopicID = { - "name": configParams["MDM_CERT_TOPIC_ID"], - "value": MDMCertTopicID, - "contentType": "text" - }; - - var APNSCertPassword = { - "name": configParams["APNS_CERT_PASSWORD"], - "value": APNSCertPassword, - "contentType": "text" - }; - - var paramBase64MDMCert = { - "name": configParams["MDM_CERT"], - "value": base64MDMCert, - "contentType": "text" - }; - - var MDMCertName = { - "name": configParams["MDM_CERT_NAME"], - "value": fileNameMDMCert, - "contentType": "text" - }; - - var paramBase64APNSCert = { - "name": configParams["APNS_CERT"], - "value": base64APNSCert, - "contentType": "text" - }; - - var APNSCertName = { - "name": configParams["APNS_CERT_NAME"], - "value": fileNameAPNSCert, - "contentType": "text" - }; - - var paramOrganizationDisplayName = { - "name": configParams["ORG_DISPLAY_NAME"], - "value": configOrgDisplayName, - "contentType": "text" - }; - - var iosEula = { - "name": configParams["IOS_EULA"], - "value": iosLicense, - "contentType": "text" - }; - - configList.push(configCountry); - configList.push(configState); - configList.push(configLocality); - configList.push(configOrganization); - configList.push(configOrganizationUnit); - configList.push(MDMCertPassword); - configList.push(MDMCertTopicID); - configList.push(APNSCertPassword); - configList.push(paramBase64MDMCert); - configList.push(MDMCertName); - configList.push(paramBase64APNSCert); - configList.push(APNSCertName); - configList.push(paramOrganizationDisplayName); - configList.push(iosEula); - - addConfigFormData.type = platformTypeConstants["IOS"]; - addConfigFormData.configuration = configList; - - var addConfigAPI = "/ios/configuration"; - - invokerUtil.post( - addConfigAPI, - addConfigFormData, - function (data) { - data = JSON.parse(data); - if (data.responseCode == responseCodes["CREATED"]) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 400) { - $(errorMsg).text("Configurations cannot be empty."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - - $(errorMsgWrapper).removeClass("hidden"); - }, function () { - $(errorMsg).text("An unexpected error occurred."); - $(errorMsgWrapper).removeClass("hidden"); - } - ); - - }); - - var errorMsgWrapper = "#windows-config-error-msg"; - var errorMsg = "#windows-config-error-msg span"; - var fileTypes = ['jks']; - var notSupportedError = false; - - var base64WindowsMDMCert = ""; - var fileInputWindowsMDMCert = $('#windows-config-mdm-certificate'); - var fileNameWindowsMDMCert = ""; - var invalidFormatWindowsMDMCert = false; - - $(fileInputWindowsMDMCert).change(function() { - - if (!window.File || !window.FileReader || !window.FileList || !window.Blob) { - $(errorMsg).text("The File APIs are not fully supported in this browser."); - $(errorMsgWrapper).removeClass("hidden"); - notSupportedError = true; - return; - } - - var file = fileInputWindowsMDMCert[0].files[0]; - fileNameWindowsMDMCert = file.name; - var extension = file.name.split('.').pop().toLowerCase(), - isSuccess = fileTypes.indexOf(extension) > -1; - - if (isSuccess) { - var fileReader = new FileReader(); - fileReader.onload = function(event) { - base64WindowsMDMCert = event.target.result; - }; - fileReader.readAsDataURL(file); - invalidFormatWindowsMDMCert = false; - } else { - base64MDMCert = ""; - invalidFormatWindowsMDMCert = true; - } - }); - - $("button#save-windows-btn").click(function() { - - var notifierFrequency = $("#windows-config-notifier-frequency").val(); - var windowsLicense = tinymce.get('windows-eula').getContent(); - - if (!notifierFrequency) { - $(errorMsg).text("Notifier Frequency is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if (!windowsLicense) { - $(errorMsg).text("License is a required field. It cannot be empty."); - $(errorMsgWrapper).removeClass("hidden"); - } else if(!$.isNumeric(notifierFrequency)){ - $(errorMsg).text("Provided Notifier frequency is invalid. It must be a number."); - $(errorMsgWrapper).removeClass("hidden"); - } - - var addConfigFormData = {}; - var configList = new Array(); - - var paramNotifierFrequency = { - "name": configParams["NOTIFIER_FREQUENCY"], - "value": notifierFrequency, - "contentType": "text" - }; - - var windowsEula = { - "name": configParams["WINDOWS_EULA"], - "value": windowsLicense, - "contentType": "text" - }; - - configList.push(paramNotifierFrequency); - configList.push(windowsEula); - - addConfigFormData.type = platformTypeConstants["WINDOWS"]; - addConfigFormData.configuration = configList; - - var addConfigAPI = "/mdm-windows-agent/services/configuration"; - - invokerUtil.post( - addConfigAPI, - addConfigFormData, - function (data) { - data = JSON.parse(data); - if (data.responseCode == responseCodes["CREATED"]) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsg).text("Exception occurred at backend."); - } else if (data == 400) { - $(errorMsg).text("Configurations cannot be empty."); - } else { - $(errorMsg).text("An unexpected error occurred."); - } - - $(errorMsgWrapper).removeClass("hidden"); - }, function () { - $(errorMsg).text("An unexpected error occurred."); - $(errorMsgWrapper).removeClass("hidden"); - } - ); - - }); -}); - -// Start of HTML embedded invoke methods -var showAdvanceOperation = function (operation, button) { - $(button).addClass('selected'); - $(button).siblings().removeClass('selected'); - var hiddenOperation = ".wr-hidden-operations-content > div"; - $(hiddenOperation + '[data-operation="' + operation + '"]').show(); - $(hiddenOperation + '[data-operation="' + operation + '"]').siblings().hide(); -}; diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs deleted file mode 100644 index 302cc5e9a..000000000 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{unit "cdmf.unit.ui.title" pageTitle="Platform Configuration"}} - -{{#zone "content"}} - {{unit "cdmf.unit.platform.configuration"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json b/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json deleted file mode 100644 index 7316b1146..000000000 --- a/components/mobile-plugins/mobile-base-plugin/org.wso2.carbon.device.mgt.mobile.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.platform.configuration/configuration.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/platform-configuration", - "layout": "cdmf.layout.default" -} \ No newline at end of file From 3e6bde8853a1e1ac0a2afa51c469d403babbbb87 Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 16 May 2016 21:12:01 +0530 Subject: [PATCH 3/6] Add email templates --- .../email/templates/user-enrollment.vm | 71 ++++++++++++++++ .../email/templates/user-registration.vm | 81 ++++++++++++++++++ .../src/main/resources/p2.inf | 3 +- .../email/templates/user-enrollment.vm | 72 ++++++++++++++++ .../email/templates/user-registration.vm | 82 +++++++++++++++++++ .../src/main/resources/p2.inf | 1 + 6 files changed, 309 insertions(+), 1 deletion(-) create mode 100644 features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-enrollment.vm create mode 100644 features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-registration.vm create mode 100644 features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-enrollment.vm create mode 100644 features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-registration.vm diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-enrollment.vm b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-enrollment.vm new file mode 100644 index 000000000..61cc9340d --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-enrollment.vm @@ -0,0 +1,71 @@ +#* + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + 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 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. +*# + + You have been invited to enroll your devices in WSO2 IoT Server + + + + WSO2 IoT Server + + +
+
+
+
+ WSO2 +
+
+
+

+ Hi $first-name, +

+ +

+ You have been invited to enrol devices with WSO2 IoT Server. + Click here to enrol the WSO2 IoT Server devices to begin.

+ +

+ Should you need assistance, please contact your administrator. +

+ +

+ Regards, +

+ +

+ WSO2 IoT Server Administrator +

+
+
+ + + + +
WSO2
+
+
+
+ + + ]]> + +
diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-registration.vm b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-registration.vm new file mode 100644 index 000000000..4d60d15e9 --- /dev/null +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/email/templates/user-registration.vm @@ -0,0 +1,81 @@ +#* + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + 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 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. +*# + + You have successfully been registered in WSO2 IoT Server + + + + WSO2 IoT Server + + +
+
+
+
+ WSO2 +
+
+
+

+ Hi $first-name, +

+ +

+ You have been registered in WSO2 IoT Server and invited to enrol your device. + Click here to enrol the WSO2 IoT Server devices to begin.

+ +

+ Use following credentials to log in to WSO2 IoT Server. +

+ +

+ Username: $username +
+ Password: $password +

+ +

+ Should you need assistance, please contact your administrator. +

+ +

+ Regards, +

+ +

+ WSO2 IoT Server Administrator +

+
+
+ + + + +
WSO2
+
+
+
+ + + ]]> + +
diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf index 0787ff9d7..a52fa1927 100644 --- a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf @@ -3,4 +3,5 @@ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../depl org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/etc/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/mqtt.properties,target:${installFolder}/../../conf/etc/mqtt.properties,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/xmpp.properties,target:${installFolder}/../../conf/etc/xmpp.properties,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/xmpp.properties,target:${installFolder}/../../conf/etc/xmpp.properties,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-enrollment.vm b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-enrollment.vm new file mode 100644 index 000000000..25b3b26a0 --- /dev/null +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-enrollment.vm @@ -0,0 +1,72 @@ +#* + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + 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 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. +*# + + You have been invited to enroll your device in WSO2 EMM + + + + WSO2 Enterprise Mobility Manager + + +
+
+
+
+ WSO2 +
+
+
+

+ Hi $first-name, +

+ +

+ You have been invited to enrol your device in WSO2 Enterprise Mobility Manager. + Click here to download the WSO2 EMM client application to begin device + enrolment.

+ +

+ Should you need assistance, please contact your administrator. +

+ +

+ Regards, +

+ +

+ WSO2 EMM Administrator +

+
+
+ + + + +
WSO2
+
+
+
+ + + ]]> + +
diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-registration.vm b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-registration.vm new file mode 100644 index 000000000..56e95625e --- /dev/null +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/email/templates/user-registration.vm @@ -0,0 +1,82 @@ +#* + Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + + 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 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. +*# + + You have successfully been registered in WSO2 EMM + + + + WSO2 Enterprise Mobility Manager + + +
+
+
+
+ WSO2 +
+
+
+

+ Hi $first-name, +

+ +

+ You have been registered in WSO2 Enterprise Mobility Manager and invited to enrol your device. + Click here to download the WSO2 EMM client application to begin device + enrolment.

+ +

+ Use following credentials to log in to WSO2 EMM client application. +

+ +

+ Username: $username +
+ Password: $password +

+ +

+ Should you need assistance, please contact your administrator. +

+ +

+ Regards, +

+ +

+ WSO2 EMM Administrator +

+
+
+ + + + +
WSO2
+
+
+
+ + + ]]> + +
diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf index 8bfeec726..24c6c4a89 100644 --- a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf @@ -3,3 +3,4 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file From 5e87a5f090019a86b99007a724bbf95fa5684f82 Mon Sep 17 00:00:00 2001 From: charitha Date: Mon, 16 May 2016 21:25:51 +0530 Subject: [PATCH 4/6] Fix feature name --- .../src/main/resources/p2.inf | 3 ++- .../src/main/resources/p2.inf | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf index a52fa1927..527c5ff5e 100644 --- a/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf +++ b/features/iot-plugins-feature/iot-base-plugin-feature/org.wso2.carbon.device.mgt.iot.feature/src/main/resources/p2.inf @@ -4,4 +4,5 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/etc/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/mqtt.properties,target:${installFolder}/../../conf/etc/mqtt.properties,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/conf/xmpp.properties,target:${installFolder}/../../conf/etc/xmpp.properties,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/email-templates);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file diff --git a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf index 24c6c4a89..5801bf287 100644 --- a/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf +++ b/features/mobile-plugins-feature/mobile-base-plugin-feature/org.wso2.carbon.device.mgt.mobile.feature/src/main/resources/p2.inf @@ -3,4 +3,5 @@ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../featur org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.server_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file +org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../../repository/resources/email-templates);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/email/templates,target:${installFolder}/../../../repository/resources/email-templates,overwrite:true);\ \ No newline at end of file From b4665f36bf3945ee2bdaa9908e05a0490546a14e Mon Sep 17 00:00:00 2001 From: Shabirmean Date: Tue, 17 May 2016 00:39:26 +0530 Subject: [PATCH 5/6] Fixes to the RaspberryPi DeviceTypes to generate real-tome stats and send operations --- .../raspberrypi_execution/raspberrypi_execution.siddhiql | 5 ++++- .../src/main/webapp/META-INF/permissions.xml | 7 ------- .../device-view.js | 2 +- .../src/main/resources/agent/src/iotUtils.py | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql index 6414e6f07..a6808ef14 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/src/main/resources/carbonapps/raspberrypi/raspberrypi_execution/raspberrypi_execution.siddhiql @@ -13,5 +13,8 @@ define stream raspberrypi (meta_owner string, meta_deviceId string, meta_time lo define stream temperature (meta_owner string, meta_deviceType string, meta_deviceId string, meta_time long, temperature float); from raspberrypi -select meta_owner, 'raspberrypi' as meta_deviceType, meta_deviceId, meta_time, temperature +select meta_owner, 'raspberrypi' as meta_deviceType, meta_deviceId, meta_time * 1000 as meta_time, temperature insert into temperature; + + + diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/META-INF/permissions.xml b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/META-INF/permissions.xml index be74ef64d..44c98dd57 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/META-INF/permissions.xml +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/src/main/webapp/META-INF/permissions.xml @@ -29,13 +29,6 @@ - - Get device - /device-mgt/user/devices/list - /enrollment/devices/* - GET - raspberrypi_user - Download device /device-mgt/user/devices diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.js b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.js index 4dd97dd23..e42064688 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.js +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.raspberrypi.device-view/device-view.js @@ -28,7 +28,7 @@ function onRequest(context) { var deviceModule = require("/app/modules/device.js").deviceModule; var device = deviceModule.viewDevice(deviceType, deviceId); if (device && device.status != "error") { - return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/virtual_firealarm/", "autoCompleteParams" : autoCompleteParams}; + return {"device": device, "backendApiUri" : devicemgtProps["httpsURL"] + "/raspberrypi/", "autoCompleteParams" : autoCompleteParams}; } else { response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!"); exit(); diff --git a/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/iotUtils.py b/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/iotUtils.py index 323cf5ea5..3bf0cd6e0 100644 --- a/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/iotUtils.py +++ b/features/iot-plugins-feature/raspberrypi-plugin-feature/org.wso2.carbon.device.mgt.iot.raspberrypi.feature/src/main/resources/agent/src/iotUtils.py @@ -61,7 +61,7 @@ AUTH_TOKEN = configParser.get('Device-Configurations', 'auth-token') CONTROLLER_CONTEXT = configParser.get('Device-Configurations', 'controller-context') MQTT_SUB_TOPIC = configParser.get('Device-Configurations', 'mqtt-sub-topic').format(owner = DEVICE_OWNER, deviceId = DEVICE_ID) MQTT_PUB_TOPIC = configParser.get('Device-Configurations', 'mqtt-pub-topic').format(owner = DEVICE_OWNER, deviceId = DEVICE_ID) -DEVICE_INFO = '{{"event":{{"metaData":{{"owner":"' + DEVICE_OWNER + '","type":"raspberrypi","deviceId":"' + DEVICE_ID + '","time":{:.2f}}},"payloadData":{{"temperature":{:.2f}}}}}}}' +DEVICE_INFO = '{{"event":{{"metaData":{{"owner":"' + DEVICE_OWNER + '","type":"raspberrypi","deviceId":"' + DEVICE_ID + '","time":{}}},"payloadData":{{"temperature":{:.2f}}}}}}}' # '{"owner":"' + DEVICE_OWNER + '","deviceId":"' + DEVICE_ID + '","temperature":' HTTPS_EP = configParser.get('Device-Configurations', 'https-ep') From 8eb53927a666cf3c0c5e69d2be1d3dc38c60ad80 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Tue, 17 May 2016 10:20:31 +0530 Subject: [PATCH 6/6] add swagger annotations to windows plugin --- .../devicemgt/DeviceManagementService.java | 3 +- .../pom.xml | 5 + .../windows/common/beans/CacheEntry.java | 9 + .../windows/common/beans/Token.java | 7 + .../common/beans/WindowsPluginProperties.java | 11 ++ .../common/util/AuthenticationInfo.java | 10 + .../windows/common/util/DeviceIDHolder.java | 5 + .../windows/operations/AddTag.java | 5 + .../windows/operations/Alert.java | 7 +- .../windows/operations/AtomicTag.java | 6 + .../windows/operations/ChallengeTag.java | 5 + .../windows/operations/Credential.java | 6 + .../windows/operations/DeleteTag.java | 6 + .../windows/operations/ExecuteTag.java | 6 + .../windows/operations/Get.java | 8 +- .../windows/operations/Item.java | 11 +- .../windows/operations/MetaTag.java | 7 +- .../windows/operations/Replace.java | 6 + .../windows/operations/Results.java | 8 + .../windows/operations/SequenceTag.java | 11 +- .../windows/operations/Source.java | 9 +- .../windows/operations/Status.java | 13 +- .../windows/operations/SyncmlBody.java | 11 ++ .../windows/operations/SyncmlDocument.java | 5 + .../windows/operations/SyncmlHeader.java | 11 +- .../windows/operations/Target.java | 8 +- .../services/adminoperations/Operations.java | 56 ++++++ .../adminoperations/beans/Device.java | 6 +- .../adminoperations/beans/Disenrollment.java | 42 ---- .../beans/OperationRequest.java | 49 ----- .../beans/OperationResponse.java | 48 ----- .../beans/StorageEncryption.java | 36 ---- .../wrapper/DisenrollmentBeanWrapper.java | 50 ----- .../beans/wrapper/EncryptBeanWrapper.java | 48 ----- .../adminoperations/util/OperationStore.java | 112 ----------- .../windows/services/authbst/BSTProvider.java | 14 ++ .../services/authbst/beans/Credentials.java | 13 ++ .../ConfigurationMgtService.java | 160 ++++------------ .../impl/ConfigurationMgtServiceImpl.java | 181 ++++++++++++++++++ .../DeviceManagementService.java | 149 ++++++-------- .../impl/DeviceManagementServiceImpl.java | 158 +++++++++++++++ .../services/discovery/DiscoveryService.java | 23 +++ .../discovery/beans/DiscoveryRequest.java | 13 +- .../discovery/beans/DiscoveryResponse.java | 18 +- .../policymgtservice/PolicyMgtService.java | 56 ++---- .../impl/PolicyMgtServiceImpl.java | 72 +++++++ .../services/syncml/SyncmlService.java | 16 ++ .../services/syncml/beans/BasicOperation.java | 7 +- .../services/syncml/beans/PasscodePolicy.java | 19 ++ .../services/syncml/beans/Profile.java | 9 + .../windows/services/syncml/beans/Wifi.java | 14 ++ .../services/syncml/util/PolicyManager.java | 54 ------ .../services/syncml/util/SyncmlUtils.java | 49 ----- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 6 +- 54 files changed, 926 insertions(+), 751 deletions(-) delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Disenrollment.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationRequest.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationResponse.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/StorageEncryption.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/DisenrollmentBeanWrapper.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/EncryptBeanWrapper.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/util/OperationStore.java create mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/impl/ConfigurationMgtServiceImpl.java create mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/impl/DeviceManagementServiceImpl.java create mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/impl/PolicyMgtServiceImpl.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/PolicyManager.java delete mode 100644 components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/SyncmlUtils.java diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/devicemgt/DeviceManagementService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/devicemgt/DeviceManagementService.java index b7036dd08..f1b518c45 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/devicemgt/DeviceManagementService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/devicemgt/DeviceManagementService.java @@ -142,6 +142,7 @@ public interface DeviceManagementService { @ApiResponses(value = { @ApiResponse(code = 200, message = "Licence agreement"), @ApiResponse(code = 500, message = "Error occurred while retrieving the license configured for Android " + - "device enrolment")}) + "device enrolment") + }) String getLicense() throws AndroidAgentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index f5f7dcabd..a6a71d4bc 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -305,5 +305,10 @@ json 2.0.0.wso2v1 + + io.swagger + swagger-annotations + provided + diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/CacheEntry.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/CacheEntry.java index 1cbb8d640..d8ed5d476 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/CacheEntry.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/CacheEntry.java @@ -18,12 +18,21 @@ package org.wso2.carbon.mdm.mobileservices.windows.common.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Class for java CacheEntry */ +@ApiModel(value = "CacheEntry", + description = "This class carries all information related to token cache") public class CacheEntry { + + @ApiModelProperty(name = "deviceID", value = "Windows deviceIdentifier", required = true) private String deviceID; + @ApiModelProperty(name = "username", value = "Enrolled User", required = true) private String username; + @ApiModelProperty(name = "ownership", value = "Enrollment ownership(BYOD/COPE)", required = true) private String ownership; public String getOwnership() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/Token.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/Token.java index 4e941bfa1..f55124e6e 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/Token.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/Token.java @@ -18,10 +18,17 @@ package org.wso2.carbon.mdm.mobileservices.windows.common.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Class for challenge token */ +@ApiModel(value = "Token", description = "Details related device encryption.") public class Token { + + @ApiModelProperty(name = "challengeToken", + value = "Enrollment Binary security token", required = true) private String challengeToken; public String getChallengeToken() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/WindowsPluginProperties.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/WindowsPluginProperties.java index 490670fdc..ba3fac6e3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/WindowsPluginProperties.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/beans/WindowsPluginProperties.java @@ -18,17 +18,28 @@ package org.wso2.carbon.mdm.mobileservices.windows.common.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Bean class for storing Windows plugin properties after reading the property file. */ +@ApiModel(value = "WindowsPluginProperties", description = "Windows plugin related properties.") public class WindowsPluginProperties { + @ApiModelProperty(name = "keyStorePassword", value = "Password of the keyStore.", required = true) private String keyStorePassword; + @ApiModelProperty(name = "privateKeyPassword", value = "password of the privateKey.", required = true) private String privateKeyPassword; + @ApiModelProperty(name = "commonName", value = "Common Name of the certificate.", required = true) private String commonName; + @ApiModelProperty(name = "authPolicy", value = "Windows enrollment authentication policy(Federated/on-premise).", required = true) private String authPolicy; + @ApiModelProperty(name = "domain", value = "Domain of the given Email.", required = true) private String domain; + @ApiModelProperty(name = "notBeforeDays", value = "Number of days to before the certificate expire.", required = true) private int notBeforeDays; + @ApiModelProperty(name = "notAfterDays", value = "Number of days to after the certificate has been expired.", required = true) private int notAfterDays; public String getKeyStorePassword() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/AuthenticationInfo.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/AuthenticationInfo.java index 809cb4be8..91a5ba3b5 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/AuthenticationInfo.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/AuthenticationInfo.java @@ -18,13 +18,23 @@ package org.wso2.carbon.mdm.mobileservices.windows.common.util; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * DTO class to hold the information of authenticated user. */ +@ApiModel(value = "ApplicationInstallation", + description = "This class carries all information related to install application") + public class AuthenticationInfo { + @ApiModelProperty(name = "message", value = "Authentication info message.", required = true) private String message; + @ApiModelProperty(name = "username", value = "Username of the enrolled user.", required = true) private String username; + @ApiModelProperty(name = "tenantDomain", value = "Enrolled user's tenant domain.", required = true) private String tenantDomain; + @ApiModelProperty(name = "tenantId", value = "Enrolled user's tenant ID)", required = true) private int tenantId = -1; public String getUsername() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/DeviceIDHolder.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/DeviceIDHolder.java index 1504a459e..a7e6fa532 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/DeviceIDHolder.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/common/util/DeviceIDHolder.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.common.util; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import java.util.List; @@ -25,9 +27,12 @@ import java.util.List; /** * Class for holding device ids. */ +@ApiModel(value = "DeviceIDHolder", description = "This class carries all information related to DeviceIDs") public class DeviceIDHolder { + @ApiModelProperty(name = "errorDeviceIdList", value = "Error occurred DeviceIds.)", required = true) private List errorDeviceIdList; + @ApiModelProperty(name = "validDeviceIDList", value = "Valid DeviceIDs.)", required = true) private List validDeviceIDList; public List getErrorDeviceIdList() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AddTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AddTag.java index 4ef83469d..a2e45ce3c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AddTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AddTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,8 +30,11 @@ import java.util.List; /** * Configurations that needs to be added on the device. */ +@ApiModel(value = "AddTag", description = "This class carries all information related to Syncml AddTag.") public class AddTag { + @ApiModelProperty(name = "commandId", value = "CommandID of the AddTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "items", value = "List of items of the AddTag.", required = true) List items; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Alert.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Alert.java index c37c74e99..40a9aace1 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Alert.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Alert.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -25,9 +27,12 @@ import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Inform an event occurred from device to server. */ +@ApiModel(value = "Alert", + description = "This class carries all information related to Syncml alert.") public class Alert { - + @ApiModelProperty(name = "commandId", value = "CommandId of The Syncml Alert.", required = true) int commandId = -1; + @ApiModelProperty(name = "data", value = "Data of the AlertTag.", required = true) String data; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AtomicTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AtomicTag.java index e189685d9..29d2d9672 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AtomicTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/AtomicTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,9 +30,13 @@ import java.util.List; /** * Wrapper for other SyncML elements. */ +@ApiModel(value = "AtomicTag", description = "This class carries all information related to syncml Engine Atomic tag") public class AtomicTag { + @ApiModelProperty(name = "commandId", value = "Syncml Atomic tag CommandId", required = true) int commandId = -1; + @ApiModelProperty(name = "adds", value = "List of addtags", required = true) List adds; + @ApiModelProperty(name = "replaces", value = "List of replace tags", required = true) List replaces; public List getReplaces() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ChallengeTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ChallengeTag.java index a7750461b..2985caf84 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ChallengeTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ChallengeTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -25,7 +27,10 @@ import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Challenge data pass through the device and Device Management server for the security purpose. */ +@ApiModel(value = "ChallengeTag", + description = "This class carries all information related to install application") public class ChallengeTag { + @ApiModelProperty(name = "meta", value = "Syncml MetaTag", required = true) MetaTag meta; public MetaTag getMeta() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Credential.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Credential.java index ea1bf35ff..f12dc3111 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Credential.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Credential.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -25,8 +27,12 @@ import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Credentials passed between the device and the server for security purposes. */ +@ApiModel(value = "Credential", + description = "This class carries all information related to syncml credentials") public class Credential { + @ApiModelProperty(name = "meta", value = "Syncml credential's MetaTag reference.)", required = true) MetaTag meta; + @ApiModelProperty(name = "data", value = "Data of the Credential Tag.)", required = true) String data; public MetaTag getMeta() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/DeleteTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/DeleteTag.java index baeeec722..f357d0a3e 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/DeleteTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/DeleteTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,8 +30,12 @@ import java.util.List; /** * Configurations that need to be delete on Device. */ +@ApiModel(value = "DeleteTag", + description = "This class carries all information related to Syncml DeleteTag.") public class DeleteTag { + @ApiModelProperty(name = "commandId", value = "CommandId of the Syncl DeleteTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "items", value = "List of items of the syncml DeleteTag. ", required = true) List items; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ExecuteTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ExecuteTag.java index 11d2e92e8..f8e10e5c8 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ExecuteTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/ExecuteTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,8 +30,12 @@ import java.util.List; /** * Commands that needs to be executed on the device. */ +@ApiModel(value = "ExecuteTag", + description = "This class carries all information related to Syncml ExecuteTag.") public class ExecuteTag { + @ApiModelProperty(name = "type", value = "CommandId of the syncml ExecuteTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "type", value = "List of items of the Syncml ExecuteTag.", required = true) List items; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Get.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Get.java index 9c8f43e05..57389415c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Get.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Get.java @@ -18,9 +18,11 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; import java.util.Iterator; import java.util.List; @@ -28,8 +30,12 @@ import java.util.List; /** * Data that needs to be retrieved from the device. */ +@ApiModel(value = "Get", + description = "This class carries all information related to syncml GetTag.") public class Get { + @ApiModelProperty(name = "commandId", value = "CommandId of the syncml GetTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "items", value = "List of items of the Syncml GetTag.", required = true) List items; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Item.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Item.java index d519850c7..595640332 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Item.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Item.java @@ -18,18 +18,25 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Represents an items that should be retrieved from the device or a command. */ +@ApiModel(value = "Item", + description = "This class carries all information related to Syncml Item.") public class Item { - + @ApiModelProperty(name = "target", value = "Target reference value of the Syncml Message(ex:Device).", required = true) Target target; + @ApiModelProperty(name = "source", value = "Source reference of the syncml message.(Ex:EMM Server).", required = true) Source source; + @ApiModelProperty(name = "data", value = "Content of the syncml message.", required = true) String data; + @ApiModelProperty(name = "meta", value = "Meta data of the syncml messsage.", required = true) MetaTag meta; public MetaTag getMeta() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/MetaTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/MetaTag.java index cd8c2a074..b6b1e145e 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/MetaTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/MetaTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -26,10 +28,13 @@ import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * MetaTag data related to credentials. */ +@ApiModel(value = "MetaTag", description = "This class carries all information related to MetaTag") public class MetaTag { - + @ApiModelProperty(name = "format", value = "MetaTag format.)", required = true) String format; + @ApiModelProperty(name = "type", value = "MetaTag type)", required = true) String type; + @ApiModelProperty(name = "nextNonce", value = "Syncml Nextnonce)", required = true) String nextNonce; public String getNextNonce() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Replace.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Replace.java index a760bbbbc..3469a590c 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Replace.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Replace.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,8 +30,12 @@ import java.util.List; /** * Commands sent from the device. */ +@ApiModel(value = "Replace", + description = "This class carries all information related to Syncml ReplaceTag.") public class Replace { + @ApiModelProperty(name = "commandId", value = "CommandId of the syncml ReplaceTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "items", value = "List of items of the syncml ReplaceTag.", required = true) List items; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Results.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Results.java index ca9175bb7..6c04067c3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Results.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Results.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,10 +30,16 @@ import java.util.List; /** * Results sent for the requests made to the device. */ +@ApiModel(value = "Results", + description = "This class carries all information related to Syncml Item.") public class Results { + @ApiModelProperty(name = "commandId", value = "CommandID of the Syncml Results Tag.", required = true) int commandId = -1; + @ApiModelProperty(name = "messageReference", value = "MessageReference of the Syncml Results Tag.", required = true) int messageReference = -1; + @ApiModelProperty(name = "commandReference", value = "CommandReference of the Syncml Results Tag.", required = true) int commandReference = -1; + @ApiModelProperty(name = "item", value = "List of Items in Syncml ResultTag.", required = true) List item; public int getCommandId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SequenceTag.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SequenceTag.java index 15bfabfb5..47cc6501a 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SequenceTag.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SequenceTag.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,13 +30,20 @@ import java.util.List; /** * Sequence data that use to execute tag list */ +@ApiModel(value = "SequenceTag", + description = "This class carries all information related to Syncml SequenceTag.") public class SequenceTag { - + @ApiModelProperty(name = "commandId", value = "CommandId of the Syncml SequenceTag", required = true) int commandId; + @ApiModelProperty(name = "exec", value = "ExcecuteTag sequence of the Syncml SequenceTag", required = true) ExecuteTag exec; + @ApiModelProperty(name = "get", value = "GetTag of the syncml SequenceTag.", required = true) Get get; + @ApiModelProperty(name = "deleteTag", value = "DeleteTag of the syncml SequenceTag.", required = true) DeleteTag deleteTag; + @ApiModelProperty(name = "atomicTag", value = "AtomicTag sequence of the syncml SequenceTag.", required = true) AtomicTag atomicTag; + @ApiModelProperty(name = "replaces", value = "ReplaceTag of the syncml SequenceTag.", required = true) List replaces; public DeleteTag getDeleteTag() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Source.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Source.java index dd16b157e..b4d866ad1 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Source.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Source.java @@ -18,16 +18,21 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Source details of syncml header's. */ +@ApiModel(value = "Source", + description = "This class carries all information related to Syncml source.") public class Source { - + @ApiModelProperty(name = "LocURI", value = "Location URI.(Source Location:Device)", required = true) private String LocURI; + @ApiModelProperty(name = "LocName", value = "Name of the location", required = true) private String LocName; public String getLocURI() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Status.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Status.java index 44f2bded7..4a595cf0d 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Status.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Status.java @@ -18,20 +18,31 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Status of a previously sent message to device; */ +@ApiModel(value = "Status", + description = "This class carries all information related to Syncml Device statuses.") public class Status { + @ApiModelProperty(name = "commandId", value = "CommandId of the Syncml StatusTag.", required = true) int commandId = -1; + @ApiModelProperty(name = "messageReference", value = "Message referenceId.", required = true) int messageReference = -1; + @ApiModelProperty(name = "commandReference", value = "Command referenceId.", required = true) int commandReference = -1; + @ApiModelProperty(name = "command", value = "Command String.", required = true) String command; + @ApiModelProperty(name = "targetReference", value = "Target reference of the status message.", required = true) String targetReference; + @ApiModelProperty(name = "data", value = "Status data of the message.(ex:200,404,500...)", required = true) String data; + @ApiModelProperty(name = "challenge", value = "Challenge value.", required = true) ChallengeTag challenge; public Status(int commandId, int messageReference, int commandReference, String command, diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlBody.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlBody.java index d11f1ea9c..8710ff743 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlBody.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlBody.java @@ -18,6 +18,8 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; @@ -28,14 +30,23 @@ import java.util.List; /** * Represents the body details of a syncml. */ +@ApiModel(value = "SyncmlBody", description = "This class carries all information related to SyncmlBody.") public class SyncmlBody { + @ApiModelProperty(name = "getCommands", value = "Get value of the syncmlBody.", required = true) Get getCommands; + @ApiModelProperty(name = "exec", value = "List of executeTags in syncmlBody.", required = true) List exec; + @ApiModelProperty(name = "status", value = "List of statusTags in syncmlBody.", required = true) List status; + @ApiModelProperty(name = "alert", value = "Alert tag in syncmlBody.", required = true) Alert alert; + @ApiModelProperty(name = "replace", value = "replace tag in syncmlBody.", required = true) Replace replace; + @ApiModelProperty(name = "results", value = "Results tag in syncmlBody.", required = true) Results results; + @ApiModelProperty(name = "sequence", value = "Sequence tag in syncmlBody.", required = true) SequenceTag sequence; + @ApiModelProperty(name = "atomicTag", value = "Atomic tag in syncmlBody.", required = true) AtomicTag atomicTag; public AtomicTag getAtomicTag() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlDocument.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlDocument.java index 368cd345c..fa63a27a2 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlDocument.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlDocument.java @@ -18,14 +18,19 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; /** * Represents a base format of a syncml document */ +@ApiModel(value = "SyncmlDocument", description = "This class carries all information related to SyncmlDocument.") public class SyncmlDocument { + @ApiModelProperty(name = "header", value = "Header of the syncmlDocument.", required = true) SyncmlHeader header; + @ApiModelProperty(name = "body", value = "Body of the SyncmlDocument.", required = true) SyncmlBody body; public SyncmlHeader getHeader() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlHeader.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlHeader.java index e884b934a..b135837a7 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlHeader.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/SyncmlHeader.java @@ -18,19 +18,28 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Represents the header details of a syncml. */ +@ApiModel(value = "SyncmlHeader", description = "This class carries all information related to SyncmlHeader.") public class SyncmlHeader { + @ApiModelProperty(name = "sessionId", value = "SessionId of the syncml Message.", required = true) private int sessionId = -1; + @ApiModelProperty(name = "MsgID", value = "MessageId of the syncml Session.", required = true) private int MsgID = -1; + @ApiModelProperty(name = "target", value = "Target of the syncml Message.(Ex:Device/Server.)", required = true) private Target target; + @ApiModelProperty(name = "source", value = "Source of the Syncml Message.(Ex:Server/Device.)", required = true) private Source source; + @ApiModelProperty(name = "credential", value = "Credentials of the Syncml header.", required = true) private Credential credential; + @ApiModelProperty(name = "hexadecimalSessionId", value = "HexaDecimal SessionId of the syncmlHeader.", required = true) private String hexadecimalSessionId; public String getHexadecimalSessionId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Target.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Target.java index 2ce40aae9..9cb980be9 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Target.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/operations/Target.java @@ -18,16 +18,20 @@ package org.wso2.carbon.mdm.mobileservices.windows.operations; -import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.wso2.carbon.mdm.mobileservices.windows.operations.util.Constants; /** * Target details of syncml header's. */ +@ApiModel(value = "Target", description = "This class carries all information related to Syncml Target.") public class Target { - + @ApiModelProperty(name = "LocURI", value = "Location URI of the target.", required = true) private String LocURI; + @ApiModelProperty(name = "LocName", value = "Location Name of the target.", required = true) private String LocName; public String getLocURI() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/Operations.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/Operations.java index 61acdeacd..e868265f4 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/Operations.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/Operations.java @@ -18,6 +18,10 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException; import javax.ws.rs.*; @@ -28,6 +32,8 @@ import java.util.List; /** * Interface for Admin operations persisting. This interface accepts operations added via UI. */ + +@Api(value = "Operations", description = "Windows Device Management REST-API implementation.") @Path("/operation") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @@ -36,22 +42,72 @@ public interface Operations { @POST @Path("/devicelock") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Adding a Device Lock on Windows Devices via the REST API", + notes = "Adding a Device lock operation to the windows device" + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response lock(@HeaderParam("Accept") String headerParam, List deviceids) throws WindowsDeviceEnrolmentException; @POST @Path("/devicedisenroll") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Disenrolling Windows Devices via the REST API", + notes = "Enforcing Disenrolling operation to the windows device" + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response disenroll(@HeaderParam("Accept") String headerParam, List deviceids) throws WindowsDeviceEnrolmentException; @POST @Path("/devicewipe") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Wiping Information off Windows Devices via the REST API", + notes = "Enforce wipe operation to the windows device" + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response wipe(@HeaderParam("Accept") String headerParam, List deviceids) throws WindowsDeviceEnrolmentException; @POST @Path("/devicering") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Ringing Windows Devices via the Rest API", + notes = "Adding a Device ring operation to the windows device." + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response ring(@HeaderParam("Accept") String headerParam, List deviceids) throws WindowsDeviceEnrolmentException; @POST @Path("/lockreset") + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Resetting the Lock of Windows Devices via the REST API", + notes = "Adding a Device lock re-test operation to the windows device." + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response lockReset(@HeaderParam("Accept") String acceptHeader, List deviceids) throws WindowsDeviceEnrolmentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Device.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Device.java index be30119a8..e8b347fad 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Device.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Device.java @@ -18,11 +18,15 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Class for get device IDS. */ +@ApiModel(value = "Device", description = "This class carries all information related to Device.") public class Device { - + @ApiModelProperty(name = "id", value = "DeviceIDs.", required = true) private String id; public String getID() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Disenrollment.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Disenrollment.java deleted file mode 100644 index ae6ab54ef..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/Disenrollment.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans; - -import java.io.Serializable; - -/** - * Class for dis-enrollment operation - */ -public class Disenrollment implements Serializable { - - private boolean enabled; - - public boolean isEnabled() { - return enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - private boolean isEnable() { - return enabled; - } - -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationRequest.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationRequest.java deleted file mode 100644 index cffba11a7..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationRequest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans; - -import org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans.BasicOperation; - -import java.util.List; - -/** - * Class for set basic operations. - */ -public class OperationRequest { - - private List deviceList; - private BasicOperation basicOperation; - - public BasicOperation getBasicOperation() { - return basicOperation; - } - - public void setBasicOperation(BasicOperation basicOperation) { - this.basicOperation = basicOperation; - } - - public List getDeviceList() { - return deviceList; - } - - public void setDeviceList(List deviceList) { - this.deviceList = deviceList; - } - -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationResponse.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationResponse.java deleted file mode 100644 index fd5b3dccd..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/OperationResponse.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans; - -/** - * This bean class is for credentials coming from wab page at federated authentication step. - */ -public class OperationResponse { - - private String errorCode; - private String statusCode; - - public OperationResponse() { - - } - - public String getErrorCode() { - return errorCode; - } - - public String getStatusCode() { - return statusCode; - } - - public void setErrorCode(String errorCode) { - this.errorCode = errorCode; - } - - public void setStatusCode(String statusCode) { - this.statusCode = statusCode; - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/StorageEncryption.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/StorageEncryption.java deleted file mode 100644 index 2fec260c1..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/StorageEncryption.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans; - -import java.io.Serializable; - -/** - * This class represents the information of encrypt operation. - */ -public class StorageEncryption implements Serializable { - private boolean encrypted; - - public boolean isEncrypted() { - return encrypted; - } - - public void setEncrypted(boolean encrypted) { - this.encrypted = encrypted; - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/DisenrollmentBeanWrapper.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/DisenrollmentBeanWrapper.java deleted file mode 100644 index 777d642d2..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/DisenrollmentBeanWrapper.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans.wrapper; - -import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.Disenrollment; - -import java.util.List; - -/** - * Class is used to wrap dis-enrollment bean with the device - */ -public class DisenrollmentBeanWrapper { - - private Disenrollment operation; - - private List deviceId; - - public Disenrollment getOperation() { - return operation; - } - - public void setOperation(Disenrollment operation) { - this.operation = operation; - } - - public List getDeviceId() { - return deviceId; - } - - public void setDeviceId(List deviceId) { - this.deviceId = deviceId; - } - -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/EncryptBeanWrapper.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/EncryptBeanWrapper.java deleted file mode 100644 index d6b5299bb..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/beans/wrapper/EncryptBeanWrapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.beans.wrapper; - -import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.StorageEncryption; - -import java.util.List; - -/** - * This class is used to wrap the Encrypt bean with devices. - */ -public class EncryptBeanWrapper { - - private StorageEncryption operation; - private List deviceIDs; - - public StorageEncryption getOperation() { - return operation; - } - - public void setOperation(StorageEncryption operation) { - this.operation = operation; - } - - public List getDeviceIDs() { - return deviceIDs; - } - - public void setDeviceIDs(List deviceIDs) { - this.deviceIDs = deviceIDs; - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/util/OperationStore.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/util/OperationStore.java deleted file mode 100644 index 1fb34c607..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/adminoperations/util/OperationStore.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.adminoperations.util; - -import com.google.gson.Gson; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; -import org.wso2.carbon.device.mgt.core.operation.mgt.ConfigOperation; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.mdm.mobileservices.windows.common.SyncmlCommandType; -import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.Device; -import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.OperationRequest; -import org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans.Wifi; - -import java.util.ArrayList; -import java.util.List; - -public class OperationStore { - - private static Log log = LogFactory.getLog(OperationStore.class); - - public static boolean storeOperation(OperationRequest operationRequest, Operation.Type type, - String commandType) throws - WindowsDeviceEnrolmentException { - - List devices = operationRequest.getDeviceList(); - List deviceIdentifiers = new ArrayList(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - - Operation operation = transformBasicOperation(operationRequest, type, commandType); - - for (int i = 0; i < devices.size(); i++) { - try { - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - deviceIdentifier.setId(devices.get(i).getID()); - deviceIdentifiers.add(deviceIdentifier); - getDeviceManagementServiceProvider().getDevice(deviceIdentifier); - - } catch (DeviceManagementException e) { - log.error("Cannot validate device ID: " + devices.get(i).getID()); - deviceIdentifiers.remove(i); - } - } - try { - getDeviceManagementServiceProvider().addOperation(operation, deviceIdentifiers); - } catch (OperationManagementException e) { - String msg = "Failure occurred while storing command operation."; - log.error(msg); - return false; - } - return true; - } - - private static DeviceManagementProviderService getDeviceManagementServiceProvider() { - DeviceManagementProviderService deviceManager; - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - deviceManager = - (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); - - if (deviceManager == null) { - String msg = "Device management service is not initialized."; - log.error(msg); - } - return deviceManager; - } - - private static Operation transformBasicOperation(OperationRequest operationRequest, Operation.Type type, - String commandType) throws WindowsDeviceEnrolmentException { - - Operation operation = new Operation(); - operation.setCode(commandType); - operation.setType(type); - Gson gson = new Gson(); - - if (commandType == SyncmlCommandType.WIFI.getValue()) { - - operation = new ConfigOperation(); - operation.setCode(commandType); - operation.setType(type); - - Wifi wifiObject = (Wifi) operationRequest.getBasicOperation(); - operation.setPayLoad(gson.toJson(wifiObject)); - } else { - // no operation..... - } - - return operation; - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java index ac6786576..a29170b37 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java @@ -18,6 +18,9 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.authbst; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.mdm.mobileservices.windows.services.authbst.beans.Credentials; @@ -36,5 +39,16 @@ public interface BSTProvider { @POST @Consumes(MediaType.APPLICATION_JSON) @Path("/authentication") + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Getting Binary security token via the Rest API", + notes = "Getting binary security token to call next certificate endpoints.", + response = String.class + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Internal Server error") + }) Response getBST(Credentials credentials) throws WindowsDeviceEnrolmentException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/beans/Credentials.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/beans/Credentials.java index 05a05c9d6..098aef301 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/beans/Credentials.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/beans/Credentials.java @@ -18,6 +18,9 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.authbst.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; @@ -26,18 +29,28 @@ import javax.xml.bind.annotation.XmlRootElement; /** * This bean class is for credentials coming from wab page at federated authentication step. */ +@ApiModel(value = "Credentials", description = "This class carries all information related to Credentials.") @XmlRootElement(name = "credentials") @XmlAccessorType(XmlAccessType.FIELD) public class Credentials { + @ApiModelProperty(name = "username", value = "User name", required = true) @XmlElement(required = true, name = "username") private String username; + + @ApiModelProperty(name = "email", value = "Email Address of the user.", required = true) @XmlElement(required = true, name = "email") private String email; + + @ApiModelProperty(name = "password", value = "password of the user.", required = true) @XmlElement(required = true, name = "password") private String password; + + @ApiModelProperty(name = "ownership", value = "ownership of the user.(BYOD/COPE).", required = true) @XmlElement(required = true, name = "ownership") private String ownership; + + @ApiModelProperty(name = "usertoken", value = "User Token.", required = true) @XmlElement(required = true, name = "token") private String usertoken; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java index 23a093eb9..f943affb0 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java @@ -18,22 +18,16 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; -import org.wso2.carbon.device.mgt.common.license.mgt.License; -import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; -import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import javax.jws.WebService; import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import java.util.List; +import javax.ws.rs.core.MediaType; /** * Windows Platform Configuration REST-API implementation. @@ -42,9 +36,7 @@ import java.util.List; @WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) -public class ConfigurationMgtService { - - private static Log log = LogFactory.getLog(ConfigurationMgtService.class); +public interface ConfigurationMgtService { /** * Save Tenant configurations. @@ -54,50 +46,17 @@ public class ConfigurationMgtService { * @throws WindowsConfigurationException */ @POST - public Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException { - Message responseMsg = new Message(); - ConfigurationEntry licenseEntry = null; - String message; - - try { - configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - if (!configuration.getConfiguration().isEmpty()) { - List configs = configuration.getConfiguration(); - for (ConfigurationEntry entry : configs) { - if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { - License license = new License(); - license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - license.setLanguage(PluginConstants.TenantConfigProperties.LANGUAGE_US); - license.setVersion("1.0.0"); - license.setText(entry.getValue().toString()); - WindowsAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, license); - licenseEntry = entry; - } - } - - if (licenseEntry != null) { - configs.remove(licenseEntry); - } - configuration.setConfiguration(configs); - WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); - Response.status(Response.Status.CREATED); - responseMsg.setResponseMessage("Windows platform configuration saved successfully."); - responseMsg.setResponseCode(Response.Status.CREATED.toString()); - return responseMsg; - } - else { - Response.status(Response.Status.BAD_REQUEST); - responseMsg.setResponseMessage("Windows platform configuration can not be saved."); - responseMsg.setResponseCode(Response.Status.CREATED.toString()); - } - } catch (DeviceManagementException e) { - message = "Error Occurred in while configuring Windows Platform."; - log.error(message, e); - throw new WindowsConfigurationException(message, e); - } - return responseMsg; - } + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "POST", + value = "Configuring Windows Platform Settings", + notes = "Configure the Windows platform settings using this REST API" + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Windows platform configuration saved successfully"), + @ApiResponse(code = 500, message = "Internal Server Error") + }) + Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException; /** * Retrieve Tenant configurations according to the device type. @@ -106,34 +65,17 @@ public class ConfigurationMgtService { * @throws WindowsConfigurationException */ @GET - public TenantConfiguration getConfiguration() throws WindowsConfigurationException { - String msg; - TenantConfiguration tenantConfiguration = null; - try { - if (WindowsAPIUtils.getDeviceManagementService(). - getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS) != null) { - tenantConfiguration = WindowsAPIUtils.getDeviceManagementService(). - getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - List configs = tenantConfiguration.getConfiguration(); - ConfigurationEntry entry = new ConfigurationEntry(); - License license = WindowsAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, PluginConstants. - TenantConfigProperties.LANGUAGE_US); - if(license != null) { - entry.setContentType(PluginConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); - entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); - entry.setValue(license.getText()); - configs.add(entry); - tenantConfiguration.setConfiguration(configs); - } - } - } catch (DeviceManagementException e) { - msg = "Error occurred while retrieving the Windows tenant configuration"; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return tenantConfiguration; - } + @ApiOperation( + httpMethod = "GET", + value = "Getting Windows Platform Configurations", + notes = "Get the Windows platform configuration details using this REST API", + response = TenantConfiguration.class + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Get Windows Configurations"), + @ApiResponse(code = 500, message = "Server Error") + }) + TenantConfiguration getConfiguration() throws WindowsConfigurationException; /** * Update Tenant Configurations for the specific Device type. @@ -143,39 +85,17 @@ public class ConfigurationMgtService { * @throws WindowsConfigurationException */ @PUT - public Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException { - String message; - Message responseMsg = new Message(); - ConfigurationEntry licenseEntry = null; - try { - configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - List configs = configuration.getConfiguration(); - for (ConfigurationEntry entry : configs) { - if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { - License license = new License(); - license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - license.setLanguage(PluginConstants.TenantConfigProperties.LANGUAGE_US); - license.setVersion("1.0.0"); - license.setText(entry.getValue().toString()); - WindowsAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. - MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, license); - licenseEntry = entry; - } - } - - if (licenseEntry != null) { - configs.remove(licenseEntry); - } - configuration.setConfiguration(configs); - WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); - Response.status(Response.Status.CREATED); - responseMsg.setResponseMessage("Windows platform configuration succeeded."); - responseMsg.setResponseCode(Response.Status.CREATED.toString()); - } catch (DeviceManagementException e) { - message = "Error occurred while modifying configuration settings of Windows platform."; - log.error(message, e); - throw new WindowsConfigurationException(message, e); - } - return responseMsg; - } + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + produces = MediaType.APPLICATION_JSON, + httpMethod = "PUT", + value = "Updating Windows Platform Configurations", + notes = "Update the Windows platform configurations using this REST API" + ) + @ApiResponses(value = { + @ApiResponse(code = 201, message = "Created"), + @ApiResponse(code = 500, message = "Error occurred while modifying configuration settings of " + + "windows platform") + }) + Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/impl/ConfigurationMgtServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/impl/ConfigurationMgtServiceImpl.java new file mode 100644 index 000000000..1fd0b2c84 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/impl/ConfigurationMgtServiceImpl.java @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * 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 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.mdm.mobileservices.windows.services.configurationmgtservice.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; +import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfiguration; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; +import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; + +import javax.jws.WebService; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import java.util.List; + +/** + * Windows Platform Configuration REST-API implementation. + * All end points supports JSON, XMl with content negotiation. + */ +@WebService +@Produces({"application/json", "application/xml"}) +@Consumes({"application/json", "application/xml"}) +public class ConfigurationMgtServiceImpl { + + private static Log log = LogFactory.getLog(ConfigurationMgtServiceImpl.class); + + /** + * Save Tenant configurations. + * + * @param configuration Tenant Configurations to be saved. + * @return Message type object for the provide save status. + * @throws WindowsConfigurationException + */ + @POST + public Message ConfigureSettings(TenantConfiguration configuration) throws WindowsConfigurationException { + Message responseMsg = new Message(); + ConfigurationEntry licenseEntry = null; + String message; + + try { + configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + if (!configuration.getConfiguration().isEmpty()) { + List configs = configuration.getConfiguration(); + for (ConfigurationEntry entry : configs) { + if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { + License license = new License(); + license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + license.setLanguage(PluginConstants.TenantConfigProperties.LANGUAGE_US); + license.setVersion("1.0.0"); + license.setText(entry.getValue().toString()); + WindowsAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. + MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, license); + licenseEntry = entry; + } + } + + if (licenseEntry != null) { + configs.remove(licenseEntry); + } + configuration.setConfiguration(configs); + WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); + Response.status(Response.Status.CREATED); + responseMsg.setResponseMessage("Windows platform configuration saved successfully."); + responseMsg.setResponseCode(Response.Status.CREATED.toString()); + return responseMsg; + } + else { + Response.status(Response.Status.BAD_REQUEST); + responseMsg.setResponseMessage("Windows platform configuration can not be saved."); + responseMsg.setResponseCode(Response.Status.CREATED.toString()); + } + } catch (DeviceManagementException e) { + message = "Error Occurred in while configuring Windows Platform."; + log.error(message, e); + throw new WindowsConfigurationException(message, e); + } + return responseMsg; + } + + /** + * Retrieve Tenant configurations according to the device type. + * + * @return Tenant configuration object contains specific tenant configurations. + * @throws WindowsConfigurationException + */ + @GET + public TenantConfiguration getConfiguration() throws WindowsConfigurationException { + String msg; + TenantConfiguration tenantConfiguration = null; + try { + if (WindowsAPIUtils.getDeviceManagementService(). + getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS) != null) { + tenantConfiguration = WindowsAPIUtils.getDeviceManagementService(). + getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + List configs = tenantConfiguration.getConfiguration(); + ConfigurationEntry entry = new ConfigurationEntry(); + License license = WindowsAPIUtils.getDeviceManagementService().getLicense( + DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, PluginConstants. + TenantConfigProperties.LANGUAGE_US); + if(license != null) { + entry.setContentType(PluginConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); + entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); + entry.setValue(license.getText()); + configs.add(entry); + tenantConfiguration.setConfiguration(configs); + } + } + } catch (DeviceManagementException e) { + msg = "Error occurred while retrieving the Windows tenant configuration"; + log.error(msg, e); + throw new WindowsConfigurationException(msg, e); + } + return tenantConfiguration; + } + + /** + * Update Tenant Configurations for the specific Device type. + * + * @param configuration Tenant configurations to be updated. + * @return Response message. + * @throws WindowsConfigurationException + */ + @PUT + public Message updateConfiguration(TenantConfiguration configuration) throws WindowsConfigurationException { + String message; + Message responseMsg = new Message(); + ConfigurationEntry licenseEntry = null; + try { + configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + List configs = configuration.getConfiguration(); + for (ConfigurationEntry entry : configs) { + if (PluginConstants.TenantConfigProperties.LICENSE_KEY.equals(entry.getName())) { + License license = new License(); + license.setName(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + license.setLanguage(PluginConstants.TenantConfigProperties.LANGUAGE_US); + license.setVersion("1.0.0"); + license.setText(entry.getValue().toString()); + WindowsAPIUtils.getDeviceManagementService().addLicense(DeviceManagementConstants. + MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, license); + licenseEntry = entry; + } + } + + if (licenseEntry != null) { + configs.remove(licenseEntry); + } + configuration.setConfiguration(configs); + WindowsAPIUtils.getDeviceManagementService().saveConfiguration(configuration); + Response.status(Response.Status.CREATED); + responseMsg.setResponseMessage("Windows platform configuration succeeded."); + responseMsg.setResponseCode(Response.Status.CREATED.toString()); + } catch (DeviceManagementException e) { + message = "Error occurred while modifying configuration settings of Windows platform."; + log.error(message, e); + throw new WindowsConfigurationException(message, e); + } + return responseMsg; + } +} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java index 3c129303d..34ff654fd 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java @@ -18,32 +18,29 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; -import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; -import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import javax.jws.WebService; import javax.ws.rs.*; -import javax.ws.rs.core.Response; +import javax.ws.rs.core.MediaType; import java.util.List; /** * Windows Device Management REST-API implementation. * All end points supports JSON, XMl with content negotiation. */ +@Api(value = "DeviceManagementService", description = "Windows Device Management REST-API implementation.") @WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) -public class DeviceManagementService { - - private static Log log = LogFactory.getLog(DeviceManagementService.class); +public interface DeviceManagementService { /** * Get all devices.Returns list of Windows devices registered in MDM. @@ -52,21 +49,21 @@ public class DeviceManagementService { * @throws WindowsConfigurationException */ @GET - public List getAllDevices() - throws WindowsConfigurationException { - String msg; - List devices; - - try { - devices = WindowsAPIUtils.getDeviceManagementService(). - getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - } catch (DeviceManagementException e) { - msg = "Error occurred while fetching the device list."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return devices; - } + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Details of All Windows Devices", + notes = "Use this REST API to retrieve the details " + + "(e.g., the Android device type, serial number, International Mobile Station Equipment Identity " + + "(IMEI), owner, version, model etc.) of all Windows devices that are registered with WSO2 EMM.", + response = Device.class, + responseContainer = "List" + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "List of Devices"), + @ApiResponse(code = 500, message = "Error occurred while fetching the device list") + }) + List getAllDevices() throws WindowsConfigurationException; /** * Fetch Windows device details of a given device Id. @@ -77,25 +74,21 @@ public class DeviceManagementService { */ @GET @Path("{id}") - public org.wso2.carbon.device.mgt.common.Device getDevice(@PathParam("id") String id) - throws WindowsConfigurationException { - - String msg; - org.wso2.carbon.device.mgt.common.Device device; - - try { - DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); - device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (device == null) { - Response.status(Response.Status.NOT_FOUND); - } - } catch (DeviceManagementException deviceMgtEx) { - msg = "Error occurred while fetching the device information."; - log.error(msg, deviceMgtEx); - throw new WindowsConfigurationException(msg, deviceMgtEx); - } - return device; - } + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting Details of an Windows Device", + notes = "Use this REST API to retrieve the details " + + "(e.g., the Android device type, serial number, International Mobile Station Equipment Identity " + + "(IMEI), owner, version, model etc.) of a specific Windows device that is registered with WSO2 EMM", + response = Device.class + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Information of the given device"), + @ApiResponse(code = 500, message = "Error occurred while fetching the device information") + }) + org.wso2.carbon.device.mgt.common.Device getDevice(@PathParam("id") String id) + throws WindowsConfigurationException; /** * Update Windows device details of given device id. @@ -106,53 +99,35 @@ public class DeviceManagementService { * @throws WindowsConfigurationException */ @PUT + @ApiOperation( + consumes = MediaType.APPLICATION_JSON, + httpMethod = "PUT", + value = "Updating the Details of an Windows Device", + notes = "Use this REST API to update the details of an Windows device" + ) + @ApiResponses(value = { + @ApiResponse(code = 202, message = "The device enrollment details has been updated successfully"), + @ApiResponse(code = 500, message = "Error occurred while modifying the device information"), + @ApiResponse(code = 304, message = "Device not found for the update") + }) @Path("{id}") - public Message updateDevice(@PathParam("id") String id, Device device) - throws WindowsConfigurationException { - String msg; - Message responseMessage = new Message(); - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(id); - deviceIdentifier - .setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - boolean result; - try { - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - result = WindowsAPIUtils.getDeviceManagementService() - .updateDeviceInfo(deviceIdentifier, device); - if (result) { - Response.status(Response.Status.ACCEPTED); - responseMessage.setResponseMessage("Device information has modified successfully."); - } else { - Response.status(Response.Status.NOT_MODIFIED); - responseMessage.setResponseMessage("Device not found for the update."); - } - } catch (DeviceManagementException e) { - msg = "Error occurred while modifying the device information."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return responseMessage; - } + Message updateDevice(@PathParam("id") String id, Device device) throws WindowsConfigurationException; @GET @Path("license") @Produces("application/json") - public License getLicense() throws WindowsConfigurationException { - License license; - - try { - license = - WindowsAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, - DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); - } catch (DeviceManagementException e) { - String msg = "Error occurred while retrieving the license configured for Windows device enrollment"; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - return license; - } - + @ApiOperation( + produces = MediaType.APPLICATION_JSON, + httpMethod = "GET", + value = "Getting the License Agreement for Windows Device Registration", + notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " + + "registration process", + response = String.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Licence agreement"), + @ApiResponse(code = 500, message = "Error occurred while retrieving the license configured for Windows " + + "device enrolment") + }) + License getLicense() throws WindowsConfigurationException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/impl/DeviceManagementServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/impl/DeviceManagementServiceImpl.java new file mode 100644 index 000000000..7e353f346 --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/impl/DeviceManagementServiceImpl.java @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * 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 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.mdm.mobileservices.windows.services.devicemgtservice.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.license.mgt.License; +import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; + +import javax.jws.WebService; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import java.util.List; + +/** + * Windows Device Management REST-API implementation. + * All end points supports JSON, XMl with content negotiation. + */ +@WebService +@Produces({"application/json", "application/xml"}) +@Consumes({"application/json", "application/xml"}) +public class DeviceManagementServiceImpl { + + private static Log log = LogFactory.getLog(DeviceManagementServiceImpl.class); + + /** + * Get all devices.Returns list of Windows devices registered in MDM. + * + * @return Device List + * @throws WindowsConfigurationException + */ + @GET + public List getAllDevices() + throws WindowsConfigurationException { + String msg; + List devices; + + try { + devices = WindowsAPIUtils.getDeviceManagementService(). + getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + } catch (DeviceManagementException e) { + msg = "Error occurred while fetching the device list."; + log.error(msg, e); + throw new WindowsConfigurationException(msg, e); + } + return devices; + } + + /** + * Fetch Windows device details of a given device Id. + * + * @param id Device Id + * @return Device + * @throws WindowsConfigurationException + */ + @GET + @Path("{id}") + public Device getDevice(@PathParam("id") String id) + throws WindowsConfigurationException { + + String msg; + Device device; + + try { + DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); + device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); + if (device == null) { + Response.status(Response.Status.NOT_FOUND); + } + } catch (DeviceManagementException deviceMgtEx) { + msg = "Error occurred while fetching the device information."; + log.error(msg, deviceMgtEx); + throw new WindowsConfigurationException(msg, deviceMgtEx); + } + return device; + } + + /** + * Update Windows device details of given device id. + * + * @param id Device Id + * @param device Device Details + * @return Message + * @throws WindowsConfigurationException + */ + @PUT + @Path("{id}") + public Message updateDevice(@PathParam("id") String id, Device device) + throws WindowsConfigurationException { + String msg; + Message responseMessage = new Message(); + DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); + deviceIdentifier.setId(id); + deviceIdentifier + .setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + boolean result; + try { + device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); + result = WindowsAPIUtils.getDeviceManagementService() + .updateDeviceInfo(deviceIdentifier, device); + if (result) { + Response.status(Response.Status.ACCEPTED); + responseMessage.setResponseMessage("Device information has modified successfully."); + } else { + Response.status(Response.Status.NOT_MODIFIED); + responseMessage.setResponseMessage("Device not found for the update."); + } + } catch (DeviceManagementException e) { + msg = "Error occurred while modifying the device information."; + log.error(msg, e); + throw new WindowsConfigurationException(msg, e); + } + return responseMessage; + } + + @GET + @Path("license") + @Produces("application/json") + public License getLicense() throws WindowsConfigurationException { + License license; + + try { + license = + WindowsAPIUtils.getDeviceManagementService().getLicense( + DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, + DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US); + } catch (DeviceManagementException e) { + String msg = "Error occurred while retrieving the license configured for Windows device enrollment"; + log.error(msg, e); + throw new WindowsConfigurationException(msg, e); + } + return license; + } + +} + diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java index d389b3d4f..b4a206fce 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java @@ -18,6 +18,9 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.discovery; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; import org.wso2.carbon.mdm.mobileservices.windows.services.discovery.beans.DiscoveryRequest; import org.wso2.carbon.mdm.mobileservices.windows.services.discovery.beans.DiscoveryResponse; @@ -46,6 +49,17 @@ public interface DiscoveryService { @RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) @WebMethod(operationName = "Discover") @ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) + @ApiOperation( + httpMethod = "POST", + value = "Discover the EMM server via REST API.", + notes = "Request the server endpoints.", + response = DiscoveryResponse.class + ) + @ApiResponses(value = { + @ApiResponse(code = 200, + message = "Windows policy, policy endpoints, enrollment endpoints and authentication endpoint."), + @ApiResponse(code = 500, message = "Internal server error") + }) void discover( @WebParam(name = "request", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) DiscoveryRequest request, @@ -57,6 +71,15 @@ public interface DiscoveryService { @GET @WebMethod @WebResult() + @ApiOperation( + httpMethod = "GET", + value = "Discover the EMM server via REST API.", + notes = "Check the server availability." + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Ok."), + @ApiResponse(code = 500, message = "Internal server error.") + }) Response discoverGet(); } \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryRequest.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryRequest.java index de1ccbd13..179e5d379 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryRequest.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryRequest.java @@ -18,21 +18,32 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.discovery.beans; -import javax.xml.bind.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; import java.io.Serializable; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DiscoveryRequest") @SuppressWarnings("unused") +@ApiModel(value = "DiscoveryRequest", + description = "This class carries all information related to Discovery request.") public class DiscoveryRequest implements Serializable { @XmlElement(name = "EmailAddress", required = true) + @ApiModelProperty(name = "emailId", value = "Email ID.", required = true) private String emailId; @XmlElement(name = "RequestVersion") + @ApiModelProperty(name = "version", value = "Request Version.", required = true) private String version; @XmlElement(name = "DeviceType") + @ApiModelProperty(name = "deviceType", value = "Type of the Device.", required = true) private String deviceType; public String getEmailId() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryResponse.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryResponse.java index f65b0e217..6ca3a7a56 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryResponse.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/beans/DiscoveryResponse.java @@ -18,24 +18,40 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.discovery.beans; -import javax.xml.bind.annotation.*; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlType; import java.io.Serializable; @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DiscoveryResponse") @SuppressWarnings("unused") +@ApiModel(value = "DiscoveryResponse", + description = "This class carries all information related to DiscoverResponse.") public class DiscoveryResponse implements Serializable { @XmlElement(name = "AuthPolicy") + @ApiModelProperty(name = "authPolicy", + value = "Authentication policy(On-premise/Federated)", required = true) private String authPolicy; @XmlElement(name = "EnrollmentPolicyServiceUrl") + @ApiModelProperty(name = "enrollmentPolicyServiceUrl", + value = "Enrollment policy(XCEP) endpoint URL.", required = true) private String enrollmentPolicyServiceUrl; @XmlElement(name = "EnrollmentServiceUrl") + @ApiModelProperty(name = "enrollmentServiceUrl", + value = "Enrollment Service(WSTEP) endpoint URL.", required = true) private String enrollmentServiceUrl; @XmlElement(name = "AuthenticationServiceUrl") + @ApiModelProperty(name = "authenticationServiceUrl", + value = "SOAP request authentication service URL", required = true) private String authenticationServiceUrl; public void setAuthenticationServiceUrl(String authenticationServiceUrl) { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java index dd4ab5774..348d3068f 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java @@ -18,54 +18,38 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; + import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; -import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; -import org.wso2.carbon.policy.mgt.common.Policy; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import javax.jws.WebService; import javax.ws.rs.*; -import javax.ws.rs.core.Response; /** * Endpoint for Enforce Effective Policy. */ +@Api(value = "PolicyMgtService", description = "Windows Device Management REST-API implementation.") @WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) -public class PolicyMgtService { - private static Log log = LogFactory.getLog(PolicyMgtService.class); - +public interface PolicyMgtService { @GET @Path("{id}") - public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, - @PathParam("id") String id) throws WindowsConfigurationException { - - DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); - Message responseMessage = new Message(); - Policy policy; - try { - PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); - policy = policyManagerService.getEffectivePolicy(deviceIdentifier); - if (policy == null) { - responseMessage.setResponseCode(Response.Status.NO_CONTENT.toString()); - responseMessage.setResponseMessage("No effective policy found"); - return responseMessage; - } else { - responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage.setResponseMessage("Effective policy added to operation"); - return responseMessage; - } - - } catch (PolicyManagementException e) { - String msg = "Error occurred while getting the policy."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } - } + @ApiOperation( + httpMethod = "GET", + value = "Identifying whether a Policy is Enforced on an Windows Device", + notes = "When a device registers with WSO2 EMM, a policy is enforced on the device based on the policy " + + "enforcement criteria. Using this API you are able to identify if a specific device has a policy " + + "enforced or if no policy is enforced on the device." + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Effective policy added to operation"), + @ApiResponse(code = 204, message = "No effective policy found") + }) + Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, + @PathParam("id") String id) throws WindowsConfigurationException; } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/impl/PolicyMgtServiceImpl.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/impl/PolicyMgtServiceImpl.java new file mode 100644 index 000000000..406d96e8f --- /dev/null +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/impl/PolicyMgtServiceImpl.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * 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 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.mdm.mobileservices.windows.services.policymgtservice.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; +import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; +import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; +import org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice.PolicyMgtService; +import org.wso2.carbon.policy.mgt.common.Policy; +import org.wso2.carbon.policy.mgt.common.PolicyManagementException; +import org.wso2.carbon.policy.mgt.core.PolicyManagerService; + +import javax.jws.WebService; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; + +/** + * Endpoint for Enforce Effective Policy. + */ + +@WebService +@Produces({"application/json", "application/xml"}) +@Consumes({"application/json", "application/xml"}) +public class PolicyMgtServiceImpl implements PolicyMgtService { + private static Log log = LogFactory.getLog(PolicyMgtServiceImpl.class); + + @GET + public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, + @PathParam("id") String id) throws WindowsConfigurationException { + + DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); + Message responseMessage = new Message(); + Policy policy; + try { + PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); + policy = policyManagerService.getEffectivePolicy(deviceIdentifier); + if (policy == null) { + responseMessage.setResponseCode(Response.Status.NO_CONTENT.toString()); + responseMessage.setResponseMessage("No effective policy found"); + return responseMessage; + } else { + responseMessage.setResponseCode(Response.Status.OK.toString()); + responseMessage.setResponseMessage("Effective policy added to operation"); + return responseMessage; + } + + } catch (PolicyManagementException e) { + String msg = "Error occurred while getting the policy."; + log.error(msg, e); + throw new WindowsConfigurationException(msg, e); + } + } +} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/SyncmlService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/SyncmlService.java index 9402dbdff..b51f69644 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/SyncmlService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/SyncmlService.java @@ -18,6 +18,10 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.syncml; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiResponse; +import io.swagger.annotations.ApiResponses; import org.w3c.dom.Document; import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants; @@ -35,6 +39,7 @@ import javax.ws.rs.core.Response; /** * Interface for Syncml message flow. */ +@Api(value = "SyncmlService", description = "Windows Device Management REST-API implementation.") @Path("/devicemanagement") public interface SyncmlService { @@ -42,6 +47,17 @@ public interface SyncmlService { @POST @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) @Produces(PluginConstants.SYNCML_MEDIA_TYPE) + @ApiOperation( + consumes = "application/vnd.syncml.dm+xml;charset=utf-8", + produces = "application/vnd.syncml.dm+xml;charset=utf-8", + httpMethod = "POST", + value = "Windows Device Management service REST API", + notes = "Windows device management session" + ) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Successfully completed syncml session"), + @ApiResponse(code = 500, message = "Internal server error") + }) Response getResponse(Document request) throws WindowsDeviceEnrolmentException, WindowsOperationException, NotificationManagementException, WindowsConfigurationException; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/BasicOperation.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/BasicOperation.java index 5ee38655d..cfa2cfbb9 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/BasicOperation.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/BasicOperation.java @@ -18,11 +18,16 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Bean for get basic operations. */ +@ApiModel(value = "BasicOperation", + description = "This class carries all information related to Basic operation.") public class BasicOperation { - + @ApiModelProperty(name = "name", value = "Name of the basic operation.", required = true) private String name; public String getName() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/PasscodePolicy.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/PasscodePolicy.java index 569ad03e6..a25e19549 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/PasscodePolicy.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/PasscodePolicy.java @@ -18,19 +18,38 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Bean for device lockOperationUpdate screen passcode policy. */ +@ApiModel(value = "PasscodePolicy", + description = "This class carries all information related to Passcode Policy.") public class PasscodePolicy extends BasicOperation { + @ApiModelProperty(name = "maxFailedAttempts", value = "No of Max fail attempts.", required = true) private int maxFailedAttempts; + @ApiModelProperty(name = "minLength", value = "Minimum length of the Passcode.", required = true) private int minLength; + @ApiModelProperty(name = "pinHistory", + value = "The number of passwords Windows 10 Mobile remembers in the password history.", required = true) private int pinHistory; + @ApiModelProperty(name = "minComplexChars", + value = "The number of password element types (in other words, uppercase letters, lowercase letters, " + + "numbers, or punctuation) required to create strong passwords.", required = true) private int minComplexChars; + @ApiModelProperty(name = "maxPINAgeInDays", + value = "Number of Maximum days to expire the passcode.", required = true) private int maxPINAgeInDays; + @ApiModelProperty(name = "requireAlphanumeric", + value = "An integer value that specifies the complexity of the password or PIN allowed.", required = true) private boolean requireAlphanumeric; + @ApiModelProperty(name = "allowSimple", value = "Set boolean value to allow simple password.", required = true) private boolean allowSimple; + @ApiModelProperty(name = "enablePassword", value = "Set boolean value enable password.", required = true) private boolean enablePassword; + @ApiModelProperty(name = "maxInactiveTime", value = "Maximum Inactive time.", required = true) private int maxInactiveTime; public int getMaxInactiveTime() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Profile.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Profile.java index a8aef3349..4b8a361ae 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Profile.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Profile.java @@ -18,14 +18,23 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Class for contains device active policy. */ +@ApiModel(value = "Profile", + description = "This class carries all information related to Profile features.") public class Profile { + @ApiModelProperty(name = "featureCode", value = "Profile type operation feature code.", required = true) String featureCode; + @ApiModelProperty(name = "data", value = "Profile type operation data content..", required = true) String data; + @ApiModelProperty(name = "enable", value = "Status of the Profile operation.", required = true) boolean enable; + @ApiModelProperty(name = "compliance", value = "Status of the operation compliance.", required = true) boolean compliance; public boolean isCompliance() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Wifi.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Wifi.java index 16a5b0aa3..fc713077a 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Wifi.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/beans/Wifi.java @@ -18,19 +18,33 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + /** * Bean for WIFI configurations. */ +@ApiModel(value = "Wifi", + description = "This class carries all information related to Wifi policy.") public class Wifi extends BasicOperation { + @ApiModelProperty(name = "networkName", value = "Name of the Wifi Network.", required = true) private String networkName; + @ApiModelProperty(name = "ssid", value = "SSID.", required = true) private String ssid; + @ApiModelProperty(name = "connectionType", value = "Type of the connection.", required = true) private String connectionType; + @ApiModelProperty(name = "connectionMode", value = "Connection mode.", required = true) private String connectionMode; + @ApiModelProperty(name = "authentication", value = "Authentication type.", required = true) private String authentication; + @ApiModelProperty(name = "encryption", value = "Encryption type.", required = true) private String encryption; + @ApiModelProperty(name = "keyType", value = "Key type.", required = true) private String keyType; + @ApiModelProperty(name = "protection", value = "Protection.", required = true) private String protection; + @ApiModelProperty(name = "keyMaterial", value = "Key Material.", required = true) private String keyMaterial; public String getNetworkName() { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/PolicyManager.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/PolicyManager.java deleted file mode 100644 index 6ac65b273..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/PolicyManager.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.syncml.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; -import org.wso2.carbon.policy.mgt.common.Policy; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; - -/** - * implementation for PolicyManager - */ -public class PolicyManager { - - private static Log log = LogFactory.getLog(PolicyManager.class); - - public Policy getEffectivePolicy(DeviceIdentifier deviceIdentifier) throws WindowsConfigurationException { - Policy policy; - PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); - try { - policy = policyManagerService.getEffectivePolicy(deviceIdentifier); - if (policy != null) { - return policy; - } else { - return null; - } - } catch (PolicyManagementException e) { - String msg = "Error occurred while getting policy."; - log.error(msg, e); - throw new WindowsConfigurationException(); - - } - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/SyncmlUtils.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/SyncmlUtils.java deleted file mode 100644 index e693c6e9d..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/syncml/util/SyncmlUtils.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * 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 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.mdm.mobileservices.windows.services.syncml.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; - -/** - * Class for generate Device object from the received data. - */ -public class SyncmlUtils { - - private static Log log = LogFactory.getLog(SyncmlUtils.class); - - /** - * This method returns Device Management Object for certain tasks such as Device enrollment etc. - * - * @return DeviceManagementServiceObject - */ - public static DeviceManagementProviderService getDeviceManagementService() { - try { - PrivilegedCarbonContext context = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - - return (DeviceManagementProviderService) context.getOSGiService(DeviceManagementProviderService.class, - null); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml index ad2863d95..168cb1c53 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -197,11 +197,11 @@ class="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.util.MessageHandler"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice.ConfigurationMgtServiceImpl"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice.PolicyMgtServiceImpl"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice.DeviceManagementServiceImpl"/>