diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationCode.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationCode.java index 60547fa5e4..2f22c8ae77 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationCode.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationCode.java @@ -114,15 +114,16 @@ public class OperationCode { CAMERA_STATUS("./Vendor/MSFT/PolicyManager/Device/Camera/AllowCamera"), ENCRYPT_STORAGE("./Vendor/MSFT/PolicyManager/My/Security/RequireDeviceEncryption"), ENCRYPT_STORAGE_STATUS("./Vendor/MSFT/PolicyManager/Device/Security/RequireDeviceEncryption"), - PASSWORD_MAX_FAIL_ATTEMPTS("./Vendor/MSFT/PolicyManager/My/DeviceLock/MaxDevicePasswordFailedAttempts"), - DEVICE_PASSWORD_ENABLE("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordEnabled"), - SIMPLE_PASSWORD("./Vendor/MSFT/PolicyManager/My/DeviceLock/AllowSimpleDevicePassword"), - MIN_PASSWORD_LENGTH("./Vendor/MSFT/PolicyManager/My/DeviceLock/MinDevicePasswordLength"), - Alphanumeric_PASSWORD("./Vendor/MSFT/PolicyManager/My/DeviceLock/AlphanumericDevicePasswordRequired"), - PASSWORD_EXPIRE("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordExpiration"), - PASSWORD_HISTORY("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordHistory"), - MAX_PASSWORD_INACTIVE_TIME("./Vendor/MSFT/PolicyManager/My/DeviceLock/MaxInactivityTimeDeviceLock"), - MIN_PASSWORD_COMPLEX_CHARACTERS("./Vendor/MSFT/PolicyManager/My/DeviceLock/MinDevicePasswordComplexCharacters"); + PASSWORD_MAX_FAIL_ATTEMPTS("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MaxDevicePasswordFailedAttempts"), + DEVICE_PASSWORD_ENABLE("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordEnabled"), + SIMPLE_PASSWORD("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/AllowSimpleDevicePassword"), + MIN_PASSWORD_LENGTH("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MinDevicePasswordLength"), + ALPHANUMERIC_PASSWORD("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/AlphanumericDevicePasswordRequired"), + PASSWORD_EXPIRE("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordExpiration"), + PASSWORD_HISTORY("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/DevicePasswordHistory"), + MAX_PASSWORD_INACTIVE_TIME("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MaxInactivityTimeDeviceLock"), + MIN_PASSWORD_COMPLEX_CHARACTERS("./Vendor/MSFT/DeviceLock/Provider/TestMDMServer/MinDevicePasswordComplexCharacters"); + private final String code; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java index 6b8a5feb2e..9fbb4f27d3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/OperationReply.java @@ -316,7 +316,9 @@ public class OperationReply { if (this.syncmlDocument.getBody().getAlert() != null) { if (Constants.INITIAL_ALERT_DATA.equals(this.syncmlDocument.getBody(). - getAlert().getData())) { + getAlert().getData()) || Constants.INITIAL_WIN10_ALERT_DATA. + equals(this.syncmlDocument.getBody() + .getAlert().getData())) { monitorSequence.setCommandId(operation.getId()); DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( @@ -740,45 +742,105 @@ public class OperationReply { } public AddTag generatePasscodeBooleanData(Operation operation, Configure configure) { - TargetTag target = new TargetTag(); - MetaTag meta = new MetaTag(); AddTag addTag = null; PasscodePolicy passcodePolicy = gson.fromJson((String) operation.getPayLoad(), PasscodePolicy.class); if (operation.getCode() != null && (PluginConstants.OperationCodes.DEVICE_PASSWORD_ENABLE. equals(configure.name()))) { if (passcodePolicy.isEnablePassword()) { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); } else { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); } } if (PluginConstants.OperationCodes.ALPHANUMERIC_PASSWORD. equals(configure.name())) { if (passcodePolicy.isRequireAlphanumeric()) { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); } else { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); } } if (PluginConstants.OperationCodes.SIMPLE_PASSWORD. equals(configure.name())) { if (passcodePolicy.isAllowSimple()) { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.POSITIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); + } else { - target.setLocURI(configure.getCode()); - meta.setFormat(Constants.META_FORMAT_INT); - addTag = TagUtil.buildAddTag(operation, Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + addTag = new AddTag(); + List itemList = new ArrayList<>(); + ItemTag item = new ItemTag(); + TargetTag targetTag = new TargetTag(); + targetTag.setLocURI(configure.getCode()); + MetaTag metaag = new MetaTag(); + metaag.setFormat(Constants.META_FORMAT_INT); + item.setTarget(targetTag); + item.setMeta(metaag); + item.setData(Constants.SyncMLResponseCodes.NEGATIVE_CSP_DATA); + itemList.add(item); + addTag.setCommandId(Constants.SyncmlMessageCodes.addCommandId); + addTag.setItems(itemList); + } } return addTag; diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/TagUtil.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/TagUtil.java deleted file mode 100644 index 269f87e631..0000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/device/mgt/mobile/windows/api/operations/util/TagUtil.java +++ /dev/null @@ -1,56 +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.device.mgt.mobile.windows.api.operations.util; - -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.AddTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ItemTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.MetaTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.TargetTag; - -import java.util.ArrayList; -import java.util.List; - -/** - * Contains utility methods which are used while creating Syncml Messages. - */ -public class TagUtil { - /** - * Build syncml AddTag for Device response message. - * - * @param operation Policy operation - * @param data Configuration service provider(CSP) data value 1/0 - * @return Syncml AddTag type object. - */ - public static AddTag buildAddTag(Operation operation, String data) { - TargetTag target = new TargetTag(); - MetaTag meta = new MetaTag(); - AddTag add = new AddTag(); - - List itemTags = new ArrayList<>(); - ItemTag itemTag = new ItemTag(); - itemTag.setTarget(target); - itemTag.setMeta(meta); - itemTag.setData(data); - itemTags.add(itemTag); - add.setCommandId(operation.getId()); - add.setItems(itemTags); - return add; - } -} diff --git a/pom.xml b/pom.xml index f76125a1ea..3ea0cb6cd1 100644 --- a/pom.xml +++ b/pom.xml @@ -1290,7 +1290,7 @@ 5.1.3 [5.1.3,6.0.0) - 1.3.0 + 1.3.3 [1.3.0,2.0.0) 2.1.4