diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml index 5b616be0f..8a21d08d0 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.cdmf.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml index 401202687..4c76328e8 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.device.mgt.iot.analytics/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml index b31d89f2b..ef478efe4 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.device.statistics.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml index 4489beec5..1cc958bcf 100644 --- a/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml +++ b/components/analytics/iot-analytics/org.wso2.carbon.iot.geo.dashboard/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins iot-analytics - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/analytics/iot-analytics/pom.xml b/components/analytics/iot-analytics/pom.xml index c63fc5d23..f47f2c5a9 100644 --- a/components/analytics/iot-analytics/pom.xml +++ b/components/analytics/iot-analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins analytics - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/analytics/pom.xml b/components/analytics/pom.xml index 54ee35916..97a4847eb 100644 --- a/components/analytics/pom.xml +++ b/components/analytics/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml index 06038edec..c7c5a980e 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.analytics/pom.xml @@ -21,7 +21,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml index 7bfd1988e..366c5b365 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/pom.xml @@ -3,7 +3,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml index 35896f2eb..3681c0906 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/pom.xml @@ -22,7 +22,7 @@ androidsense-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/androidsense-plugin/pom.xml b/components/device-types/androidsense-plugin/pom.xml index 99a5e4ccb..7523eb435 100644 --- a/components/device-types/androidsense-plugin/pom.xml +++ b/components/device-types/androidsense-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml index b9f1d9fe3..ec49ebe0a 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.analytics/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml index 03ab960d4..8e1d73a38 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.api/pom.xml @@ -21,7 +21,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml index f9c7b5651..a680bfe3e 100644 --- a/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml +++ b/components/device-types/arduino-plugin/org.wso2.carbon.device.mgt.iot.arduino.ui/pom.xml @@ -23,7 +23,7 @@ arduino-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/arduino-plugin/pom.xml b/components/device-types/arduino-plugin/pom.xml index 8d1714139..7542551f1 100644 --- a/components/device-types/arduino-plugin/pom.xml +++ b/components/device-types/arduino-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/pom.xml b/components/device-types/pom.xml index 1e03380f7..edbc387ec 100644 --- a/components/device-types/pom.xml +++ b/components/device-types/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml index 60bba3a40..cf3252970 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.analytics/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml index cb880e23e..3cb028ced 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.api/pom.xml @@ -21,7 +21,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml index a8329d6f3..d12123be7 100644 --- a/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml +++ b/components/device-types/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.ui/pom.xml @@ -23,7 +23,7 @@ raspberrypi-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/raspberrypi-plugin/pom.xml b/components/device-types/raspberrypi-plugin/pom.xml index 4e99a7405..8e40cc23a 100644 --- a/components/device-types/raspberrypi-plugin/pom.xml +++ b/components/device-types/raspberrypi-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml index 1df8d968f..129639450 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.agent.impl/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml index a0a23989c..c23c1eb4b 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.analytics/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml index 96b3fabbd..621275141 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/pom.xml @@ -21,7 +21,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml index 5cb6b3402..4eb87b968 100644 --- a/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.ui/pom.xml @@ -23,7 +23,7 @@ virtual-fire-alarm-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/device-types/virtual-fire-alarm-plugin/pom.xml b/components/device-types/virtual-fire-alarm-plugin/pom.xml index 5af071695..1d42604b8 100644 --- a/components/device-types/virtual-fire-alarm-plugin/pom.xml +++ b/components/device-types/virtual-fire-alarm-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins device-types - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml index 001ee4ee6..2bd619b10 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.extension/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml index 8e428b04d..4f2c05a01 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml index 1d6dc6577..4d85e1977 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml index b00f49aef..6265abd20 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.thrift/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml index 6f66ff9c7..37d8eced6 100644 --- a/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/input/org.wso2.carbon.device.mgt.input.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml index 72427aa6b..30a8e4fd2 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.http/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml index 9213a8435..195a2dcf5 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.mqtt/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml index b452ba199..99e9420a8 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml index 060e80d4d..a08fbe920 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.websocket/pom.xml @@ -21,7 +21,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml index c4f6380f3..39c1bcbfa 100644 --- a/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml +++ b/components/extensions/cdmf-transport-adapters/output/org.wso2.carbon.device.mgt.output.adapter.xmpp/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins cdmf-transport-adapters - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/cdmf-transport-adapters/pom.xml b/components/extensions/cdmf-transport-adapters/pom.xml index a115a177a..c8b681d58 100644 --- a/components/extensions/cdmf-transport-adapters/pom.xml +++ b/components/extensions/cdmf-transport-adapters/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml index 50a10d99e..dab4239f8 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml index 2441b407c..3cf442f7b 100644 --- a/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml +++ b/components/extensions/mb-extensions/org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mb-extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/mb-extensions/pom.xml b/components/extensions/mb-extensions/pom.xml index 65a64dbfd..9467c2261 100644 --- a/components/extensions/mb-extensions/pom.xml +++ b/components/extensions/mb-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/pom.xml b/components/extensions/pom.xml index d90303e14..1827a6b60 100644 --- a/components/extensions/pom.xml +++ b/components/extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml diff --git a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml index a3cea526a..0a278b41c 100644 --- a/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml +++ b/components/extensions/pull-notification-listeners/org.wso2.carbon.device.mgt.mqtt.notification.listener/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins pull-notification-listeners - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/pull-notification-listeners/pom.xml b/components/extensions/pull-notification-listeners/pom.xml index 1b5c5186b..5569d1995 100644 --- a/components/extensions/pull-notification-listeners/pom.xml +++ b/components/extensions/pull-notification-listeners/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml index 774f4f402..4c660d35a 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session.endpoint/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml index 55b171d01..eabc142e0 100644 --- a/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml +++ b/components/extensions/remote-session-extension/org.wso2.carbon.device.mgt.extensions.remote.session/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins remote-session-extension - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/remote-session-extension/pom.xml b/components/extensions/remote-session-extension/pom.xml index ebed1a789..4b81ca0db 100644 --- a/components/extensions/remote-session-extension/pom.xml +++ b/components/extensions/remote-session-extension/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml index e0757b485..564cf6290 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java index 44b06a441..1c2393a1a 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.device/src/test/java/org/wso2/extension/siddhi/device/test/util/TestDeviceManager.java @@ -63,6 +63,11 @@ public class TestDeviceManager implements DeviceManager { return true; } + @Override + public boolean deleteDevice(DeviceIdentifier deviceId, Device device) throws DeviceManagementException { + return true; + } + @Override public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { return true; diff --git a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml index b64972ab1..9843121fb 100644 --- a/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.extension.siddhi.execution.json/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml index 3cb63c856..e031a2255 100644 --- a/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml +++ b/components/extensions/siddhi-extensions/org.wso2.gpl.siddhi.extension.geo.script/pom.xml @@ -20,7 +20,7 @@ org.wso2.carbon.devicemgt-plugins siddhi-extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/extensions/siddhi-extensions/pom.xml b/components/extensions/siddhi-extensions/pom.xml index a257654bc..257e7c70a 100644 --- a/components/extensions/siddhi-extensions/pom.xml +++ b/components/extensions/siddhi-extensions/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins extensions - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml index 7f434c94b..9a09656a2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml 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/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/DeviceManagementService.java index bb172a619..59898ff89 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/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/DeviceManagementService.java @@ -15,6 +15,22 @@ * specific language governing permissions and limitations * under the License. * + * + * Copyright (c) 2019, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved. + * + * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. */ package org.wso2.carbon.mdm.services.android.services; @@ -40,6 +56,7 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.List; @@ -406,6 +423,10 @@ public interface DeviceManagementService { @ApiParam( name = "id", value = "The unique device identifier.") - @PathParam("id") String id); + @PathParam("id") String id, + @ApiParam( + name = "permanentDelete", + value = "Boolean flag indicating whether to permanently delete the device.") + @QueryParam("permanentDelete") boolean permanentDelete); } 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/impl/DeviceManagementServiceImpl.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/impl/DeviceManagementServiceImpl.java index c1350eb25..839c86463 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/impl/DeviceManagementServiceImpl.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/impl/DeviceManagementServiceImpl.java @@ -78,6 +78,7 @@ import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.ArrayList; @@ -446,26 +447,40 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @DELETE @Path("/{id}") @Override - public Response disEnrollDevice(@PathParam("id") String id) { + public Response disEnrollDevice(@PathParam("id") String id, + @QueryParam("permanentDelete") boolean permanentDelete) { boolean result; DeviceIdentifier deviceIdentifier = AndroidDeviceUtils.convertToDeviceIdentifierObject(id); try { - result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + if (permanentDelete) { + result = AndroidAPIUtils.getDeviceManagementService().deleteDevice(deviceIdentifier); + } else { + AndroidDeviceUtils.updateDisEnrollOperationStatus(deviceIdentifier); + result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + } if (result) { + String msg = "Android device that carries id '" + id + "' is successfully "; Message responseMessage = new Message(); responseMessage.setResponseCode(Response.Status.OK.toString()); - responseMessage.setResponseMessage("Android device that carries id '" + id + - "' has successfully dis-enrolled"); + if (permanentDelete) { + responseMessage.setResponseMessage(msg + "deleted"); + } else { + responseMessage.setResponseMessage(msg + "dis-enrolled"); + } return Response.status(Response.Status.OK).entity(responseMessage).build(); } else { Message responseMessage = new Message(); responseMessage.setResponseCode(Response.Status.NOT_FOUND.toString()); - responseMessage.setResponseMessage("Android device that carries id '" + id + - "' has not been dis-enrolled"); + responseMessage.setResponseMessage("Android device that carries id '" + id + "' is not available"); return Response.status(Response.Status.NOT_FOUND).entity(responseMessage).build(); } } catch (DeviceManagementException e) { - String msg = "Error occurred while dis-enrolling the Android device that carries the id '" + id + "'"; + String msg = "Error occurred while %s the Android device that carries the id '" + id + "'"; + if (permanentDelete) { + msg = String.format(msg, "deleting"); + } else { + msg = String.format(msg, "dis-enrolling"); + } log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); 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/util/AndroidDeviceUtils.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java index 590bf0e55..8240ce764 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/util/AndroidDeviceUtils.java @@ -595,4 +595,27 @@ public class AndroidDeviceUtils { } } + /** + * Update status of pending operations to error when a dis-enroll operation is triggered. + * + * @param deviceIdentifier Identifier of the device + * @throws DeviceManagementException + */ + public static void updateDisEnrollOperationStatus(DeviceIdentifier deviceIdentifier) + throws DeviceManagementException { + try { + List pendingOperations = getPendingOperations(deviceIdentifier); + if (pendingOperations != null && !pendingOperations.isEmpty()) { + for (Operation operation : pendingOperations) { + operation.setStatus(Operation.Status.ERROR); + AndroidAPIUtils.getDeviceManagementService().updateOperation(deviceIdentifier, operation); + } + } + } catch (OperationManagementException e) { + String msg = "Error occurred while retrieving pending operations to update operation statuses of " + + "device to be dis-enrolled"; + log.error(msg); + throw new DeviceManagementException(msg, e); + } + } } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java index 8c6e0afd1..05a25cb61 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/DeviceManagementServiceTests.java @@ -300,7 +300,7 @@ public class DeviceManagementServiceTests { public void testDisEnrollDeviceSuccess() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { mockDeviceManagementService(); - Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId()); + Response response = deviceManagementService.disEnrollDevice(TestUtils.getDeviceId(), false); Assert.assertNotNull(response); Assert.assertEquals(response.getStatus(), Response.Status.OK.getStatusCode()); } @@ -309,7 +309,7 @@ public class DeviceManagementServiceTests { public void testDisenrollUnSuccess() throws DeviceManagementException, OperationManagementException, InvalidDeviceException { mockDeviceManagementService(); - Response response = deviceManagementService.disEnrollDevice("1234"); + Response response = deviceManagementService.disEnrollDevice("1234", false); Assert.assertNotNull(response); Assert.assertEquals(response.getStatus(), Response.Status.NOT_FOUND.getStatusCode()); } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java index 255a25d45..9962991d2 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/test/java/org/wso2/carbon/mdm/services/android/mocks/DeviceManagementProviderServiceMock.java @@ -51,6 +51,7 @@ import org.wso2.carbon.mdm.services.android.utils.TestUtils; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.Map; public class DeviceManagementProviderServiceMock implements DeviceManagementProviderService { @Override @@ -152,6 +153,11 @@ public class DeviceManagementProviderServiceMock implements DeviceManagementProv return null; } + @Override + public List getDevicesBasedOnProperties(Map map) throws DeviceManagementException { + return null; + } + @Override public Device getDevice(String s, Date date, boolean b) throws DeviceManagementException { if (TestUtils.getDeviceId().equals(s)) { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml index 97ad9fb66..d86cd5d16 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/pom.xml @@ -21,7 +21,7 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml index 521e395b4..712e6622b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/pom.xml @@ -23,13 +23,13 @@ android-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.device.mgt.mobile.android.ui - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT WSO2 Carbon - Mobile Android UI pom diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs index 09c6fe7e4..b814fc2a7 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.device-view/device-view.hbs @@ -16,7 +16,7 @@ data-type="{{device.type}}" data-ownership="{{device.ownership}}" data-owner="{{device.owner}}" - data-status="{{devicamera-enabledce.status}}" + data-status="{{device.status}}" data-deviceinfoservice="{{device.deviceInfoServiceAPI}}" data-devicelocationservice="{{device.deviceLocationServiceAPI}}"> {{device.owner}}'s {{device.name}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/operation-bar.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/operation-bar.hbs index df84b7e50..c41797a2c 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/operation-bar.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/operation-bar.hbs @@ -120,7 +120,9 @@ + data-param-type="form" + data-toggle="tooltip" + title="{{this.helper}}"/> {{this.label}}
{{/equal}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js index 3482f2da5..3aa3e7d42 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/js/operation-bar.js @@ -323,6 +323,7 @@ var generatePayload = function (operationCode, operationData, deviceList) { payload = { "operation": { "CAMERA": operationData["cameraEnabled"], + "BACKUP_SERVICE": operationData["enableBackupService"], "DISALLOW_ADJUST_VOLUME": operationData["disallowAdjustVolumeEnabled"], "DISALLOW_CONFIG_BLUETOOTH": operationData["disallowConfigBluetooth"], "DISALLOW_CONFIG_CELL_BROADCASTS": operationData["disallowConfigCellBroadcasts"], @@ -546,6 +547,7 @@ var androidOperationConstants = { "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", "VPN_OPERATION_CODE": "VPN", "CAMERA_OPERATION_CODE": "CAMERA", + "BACKUP_SERVICE_CODE": "BACKUP_SERVICE", "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", "WIFI_OPERATION_CODE": "WIFI", "WIPE_OPERATION_CODE": "WIPE_DATA", diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/templates/operation-bar.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/templates/operation-bar.hbs index 2fd7b7990..c76e48859 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/templates/operation-bar.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-bar/public/templates/operation-bar.hbs @@ -120,7 +120,9 @@ + data-param-type="form" + data-toggle="tooltip" + title="{{this.helper}}"/> {{this.label}}
{{/equal}} diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js index 81fa182a8..5243b2fdb 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.operation-mod/public/js/operation-mod.js @@ -50,6 +50,7 @@ var androidOperationModule = function () { "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", "VPN_OPERATION_CODE": "VPN", "CAMERA_OPERATION_CODE": "CAMERA", + "BACKUP_SERVICE_CODE": "BACKUP_SERVICE", "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", "WIFI_OPERATION_CODE": "WIFI", "GLOBAL_PROXY_OPERATION_CODE": "GLOBAL_PROXY", @@ -333,6 +334,7 @@ var androidOperationModule = function () { payload = { "operation": { "CAMERA": operationData["cameraEnabled"], + "BACKUP_SERVICE": operationData["enableBackupService"], "DISALLOW_ADJUST_VOLUME": operationData["disallowAdjustVolumeEnabled"], "DISALLOW_CONFIG_BLUETOOTH": operationData["disallowConfigBluetooth"], "DISALLOW_CONFIG_CELL_BROADCASTS": operationData["disallowConfigCellBroadcasts"], @@ -707,6 +709,7 @@ var androidOperationModule = function () { "WIFI": "configure-wifi", "GLOBAL_PROXY": "configure-global-proxy", "CAMERA": "control-camera", + "BACKUP_SERVICE": "enable-backup", "VPN": "configure-vpn", "DEVICE_LOCK": "lock-devices", "DEVICE_UNLOCK": "unlock-devices", @@ -1141,6 +1144,9 @@ var androidOperationModule = function () { } else if (featureCode == androidOperationConstants["DISALLOW_ADJUST_VOLUME"]) { restrictions["disallowAdjustVolumeEnabled"] = restriction["enabled"]; continue; + } else if (featureCode == androidOperationConstants["BACKUP_SERVICE_CODE"]) { + restrictions["enableBackupService"] = restriction["enabled"]; + continue; } else if (featureCode == androidOperationConstants["DISALLOW_CONFIG_BLUETOOTH"]) { restrictions["disallowConfigBluetooth"] = restriction["enabled"]; continue; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js index f8e7c65fa..c34646467 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/js/android-policy-edit.js @@ -174,14 +174,14 @@ var ovpnConfigUploaded = function () { }; var certConfigUploaded = function (val) { - var certFileInput = document.getElementById("cert-file-field"); - if ('files' in certFileInput) { - if (certFileInput.files.length === 1) { + var certFileInput = $(val); + if (certFileInput[0].files) { + if (certFileInput[0].files.length === 1) { var reader = new FileReader(); - reader.onload = function (progressEvent) { + reader.onload = function(progressEvent){ var txt = ""; var lines = this.result.split('\n'); - for (var line = 0; line < lines.length; line++) { + for(var line = 0; line < lines.length; line++){ console.log(lines[line]); if (lines[line].charAt(0) !== '#') { txt += lines[line] + '\n'; @@ -191,7 +191,7 @@ var certConfigUploaded = function (val) { //console.log(document.getElementById ("cert-config").value); $(val).next().val(txt); }; - reader.readAsText(certFileInput.files[0]); + reader.readAsText(certFileInput[0].files[0]); } } }; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs index faeb8bcb6..319f06510 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android.policy-edit/public/templates/android-policy-edit.hbs @@ -78,9 +78,9 @@ - + - Secure Certificates + Certificates Install @@ -508,9 +508,8 @@

@@ -863,6 +862,17 @@
+
+ +
+
{{/unless}} @@ -1432,7 +1442,7 @@ data-operation-code="INSTALL_CERT">
- + - Secure Certificate + Certificate Install @@ -756,8 +756,14 @@
-
- +
+ +
+
+ +
+ +
+
{{/unless}} @@ -2321,7 +2339,7 @@ data-operation-code="INSTALL_CERT">
- + - Secure Certificate + Certificate Install @@ -518,8 +518,8 @@

@@ -880,6 +880,17 @@

+
+ +
+
{{/unless}} @@ -2346,7 +2357,7 @@ data-operation-code="INSTALL_CERT">
android-plugin org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManager.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManager.java index c3d0ac41d..5024dc799 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManager.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidDeviceManager.java @@ -220,6 +220,12 @@ public class AndroidDeviceManager implements DeviceManager { return true; } + @Override + public boolean deleteDevice(DeviceIdentifier deviceId, Device device) throws DeviceManagementException { + //Returning false since AndroidDeviceManager is not used instead DeviceTypeManager is used. + return false; + } + @Override public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException { boolean isEnrolled = false; diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java index 2494d1cd3..71ac1c031 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android/src/main/java/org/wso2/carbon/device/mgt/mobile/android/impl/AndroidFeatureManager.java @@ -209,11 +209,19 @@ public class AndroidFeatureManager implements FeatureManager { feature.setName("wifi"); feature.setDescription("Setting up wifi configuration"); supportedFeatures.add(feature); + feature = new Feature(); feature.setCode("CAMERA"); feature.setName("camera"); feature.setDescription("Enable or disable camera"); supportedFeatures.add(feature); + + feature = new Feature(); + feature.setCode("BACKUP_SERVICE"); + feature.setName("Set Backup Service"); + feature.setDescription("set backup service"); + supportedFeatures.add(feature); + feature = new Feature(); feature.setCode("EMAIL"); feature.setName("Email"); diff --git a/components/mobile-plugins/android-plugin/pom.xml b/components/mobile-plugins/android-plugin/pom.xml index 47f0b2874..28acee1f9 100644 --- a/components/mobile-plugins/android-plugin/pom.xml +++ b/components/mobile-plugins/android-plugin/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins mobile-plugins - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../pom.xml diff --git a/components/mobile-plugins/pom.xml b/components/mobile-plugins/pom.xml index ac7d0ba7d..9f5890fde 100644 --- a/components/mobile-plugins/pom.xml +++ b/components/mobile-plugins/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt-plugins carbon-device-mgt-plugins-parent - 4.2.7-SNAPSHOT + 4.2.9-SNAPSHOT ../../pom.xml @@ -34,7 +34,6 @@ android-plugin - windows-plugin 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 deleted file mode 100644 index 9fa78dec0..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ /dev/null @@ -1,407 +0,0 @@ - - - - - - windows-plugin - org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.mobile.windows.api - WSO2 Carbon - Windows JAX-RS API - Windows JAX-RS API - war - - - - - maven-compiler-plugin - - 1.8 - 1.8 - - 2.3.2 - - - maven-war-plugin - 2.2 - - - api#device-mgt#windows#v1.0 - - - - org.jacoco - jacoco-maven-plugin - - ${basedir}/target/coverage-reports/jacoco-unit.exec - - - - jacoco-initialize - - prepare-agent - - - - jacoco-site - test - - report - - - ${basedir}/target/coverage-reports/jacoco-unit.exec - ${basedir}/target/coverage-reports/site - - - - - - - - - - deploy - - compile - - - org.apache.maven.plugins - maven-antrun-plugin - 1.7 - - - compile - - run - - - - - - - - - - - - - - - - - - - client - - test - - - org.codehaus.mojo - exec-maven-plugin - 1.2.1 - - - test - - java - - - - - - - - - - - - - org.apache.cxf - cxf-rt-frontend-jaxws - - - org.apache.cxf - cxf-rt-frontend-jaxrs - - - org.apache.cxf - cxf-rt-transports-http - - - org.apache.cxf - cxf-rt-bindings-soap - compile - - - org.apache.cxf - cxf-rt-bindings-http - - - org.slf4j - slf4j-api - - - - - org.apache.ws.security - wss4j - - - org.slf4j - slf4j-api - - - compile - - - org.apache.cxf - cxf-rt-rs-extension-providers - compile - - - org.apache.cxf - cxf-rt-ws-security - - - org.slf4j - slf4j-api - - - - - org.apache.wss4j - wss4j-ws-security-common - - - org.slf4j - slf4j-api - - - - - org.apache.ws.commons.axiom.wso2 - axiom - provided - - - - log4j - log4j - provided - - - org.springframework - spring-web - - - - com.sun.xml.ws - jaxws-rt - provided - - - com.sun.xml.messaging.saaj - saaj-impl - - - org.wso2.orbit.org.bouncycastle - bcpkix-jdk15on - provided - - - org.wso2.orbit.org.bouncycastle - bcprov-jdk15on - provided - - - org.codehaus.plexus - plexus-utils - - - com.madgag.spongycastle - pkix - - - com.madgag.spongycastle - prov - - - com.madgag.spongycastle - core - - - commons-codec - commons-codec - - - joda-time - joda-time - - - commons-io - commons-io - provided - - - javax.ws.rs - jsr311-api - - - org.testng - testng - - - org.wso2.carbon - org.wso2.carbon.logging - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt-plugins - org.wso2.carbon.device.mgt.mobile.windows - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.webapp.authenticator.framework - provided - - - org.wso2.carbon.identity - org.wso2.carbon.identity.base - - - org.slf4j - slf4j-api - - - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth.stub - provided - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth - provided - - - org.slf4j - slf4j-api - - - - - javax.cache - cache-api - 0.5 - provided - - - org.slf4j - slf4j-api - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.wso2.tomcat - tomcat-servlet-api - provided - - - com.google.code.gson - gson - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.core - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.apimgt.annotations - provided - - - org.codehaus.jettison.wso2 - jettison - 1.1.wso2v1 - - - org.json.wso2 - json - 2.0.0.wso2v1 - - - io.swagger - swagger-annotations - - - io.swagger - swagger-core - - - org.slf4j - slf4j-api - - - - - io.swagger - swagger-jaxrs - - - org.slf4j - slf4j-api - - - - - 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/bean/EnterpriseApplication.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/bean/EnterpriseApplication.java deleted file mode 100644 index 2d3a45b90..000000000 --- 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/bean/EnterpriseApplication.java +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.bean; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.apache.juli.logging.Log; -import org.apache.juli.logging.LogFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.ProfileConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationCode; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlGenerator; - -import java.util.ArrayList; -import java.util.List; - -@ApiModel(value = "EnterpriseApplication", description = "Information related to Enterprise Application.") -public class EnterpriseApplication extends WindowsOperation { - - private static Log log = LogFactory.getLog(EnterpriseApplication.class); - - @ApiModelProperty(name = "packageURL", value = "Package URL.") - private HostedAppxApplication hostedAppxApplication; - @ApiModelProperty(name = "packageFamilyName", value = "Package family name.") - private HostedMSIApplication hostedMSIApplication; - - public HostedAppxApplication getHostedAppxApplication() { - return hostedAppxApplication; - } - - public void setHostedAppxApplication(HostedAppxApplication hostedAppxApplication) { - this.hostedAppxApplication = hostedAppxApplication; - } - - public HostedMSIApplication getHostedMSIApplication() { - return hostedMSIApplication; - } - - public void setHostedMSIApplication(HostedMSIApplication hostedMSIApplication) { - this.hostedMSIApplication = hostedMSIApplication; - } - - public void validateRequest() throws ProfileConfigurationException { - if (getHostedAppxApplication() != null) { - if (isNullOrEmpty(getHostedAppxApplication().getpackageUri())) { - throw new ProfileConfigurationException( - "Appx package URL is not found for enterprise app installation"); - } - if (isNullOrEmpty(getHostedAppxApplication().getpackageFamilyName())) { - throw new ProfileConfigurationException( - "Appx package Family Name is not found for enterprise app installation"); - } - } else if (getHostedMSIApplication() != null) { - if (isNullOrEmpty(getHostedMSIApplication().getProductId())) { - throw new ProfileConfigurationException( - "MSI product ID is not found for enterprise app installation"); - } - if (isNullOrEmpty(getHostedMSIApplication().getContentUrl())) { - throw new ProfileConfigurationException( - "MSI product content download URL is not found for enterprise app installation"); - } - if (isNullOrEmpty(getHostedMSIApplication().getFileHash())) { - throw new ProfileConfigurationException( - "MSI product file hash is not found for enterprise app installation"); - } - } else { - throw new ProfileConfigurationException("MSI or APPX payload is not found for enterprise app installation"); - } - } - - @Override - public List createOperationContent(Operation operation) throws WindowsOperationException { - List enterpriseApplicationContent = new ArrayList<>(); - if (getHostedAppxApplication() != null) { - enterpriseApplicationContent.addAll(createAddTag(operation.getId(), - OperationCode.Command.INSTALL_ENTERPRISE_APPX_APPLICATION.getCode(), - PluginConstants.ApplicationInstallProperties.PACKAGE_FAMILY_NAME, - getHostedAppxApplication().getpackageFamilyName(), - PluginConstants.ApplicationInstallProperties.TYPE_APPX)); - enterpriseApplicationContent.addAll(createExecuteTag(operation.getId(), - OperationCode.Command.INSTALL_ENTERPRISE_APPX_APPLICATION.getCode(), - PluginConstants.ApplicationInstallProperties.PACKAGE_FAMILY_NAME, - getHostedAppxApplication().getpackageFamilyName() - + PluginConstants.ApplicationInstallProperties.HOSTED_INSTALL, - PluginConstants.ApplicationInstallProperties.TYPE_APPX)); - } else if (getHostedMSIApplication() != null) { - enterpriseApplicationContent.addAll(createAddTag(operation.getId(), - OperationCode.Command.INSTALL_ENTERPRISE_MSI_APPLICATION.getCode(), - PluginConstants.ApplicationInstallProperties.PRODUCT_ID, getHostedMSIApplication().getProductId(), - PluginConstants.ApplicationInstallProperties.TYPE_MSI)); - enterpriseApplicationContent.addAll(createExecuteTag(operation.getId(), - OperationCode.Command.INSTALL_ENTERPRISE_MSI_APPLICATION.getCode(), - PluginConstants.ApplicationInstallProperties.PRODUCT_ID, getHostedMSIApplication().getProductId(), - PluginConstants.ApplicationInstallProperties.TYPE_MSI)); - } - return enterpriseApplicationContent; - } - - /*** - * Create add objects required for APPX or MSI application installation which then will be converted as AddTag - * elements to add in SyncML XML. - * - * @param operationId used to set as command ID - * @param operationCode is the LocURI - * @param replaceOld operation code placeholder - * @param replaceNew replace value of operation code placeholder - * @param appType APPX or MSI - * @return list of AddTag objects - */ - private List createAddTag(int operationId, String operationCode, String replaceOld, String replaceNew, - String appType) { - List addTagList = new ArrayList<>(); - List itemTagList = new ArrayList<>(); - AddTag addTag = new AddTag(); - ItemTag itemTag = new ItemTag(); - TargetTag targetTag = new TargetTag(); - String locUri = operationCode.replace(replaceOld, replaceNew); - targetTag.setLocURI(locUri); - itemTag.setTarget(targetTag); - itemTagList.add(itemTag); - addTag.setCommandId(operationId); - addTag.setItems(itemTagList); - addTagList.add(addTag); - if (PluginConstants.ApplicationInstallProperties.TYPE_APPX.equals(appType)) { - if (!isNullOrEmpty(getHostedAppxApplication().getCertificateHash()) && !isNullOrEmpty( - getHostedAppxApplication().getEncodedCertificate())) { - List certItemTagList = new ArrayList<>(); - AddTag certAddTag = new AddTag(); - ItemTag certItemTag = new ItemTag(); - MetaTag certMetaTag = new MetaTag(); - TargetTag certTargetTag = new TargetTag(); - certTargetTag.setLocURI(OperationCode.Command.INSTALL_ENTERPRISE_APPX_CERTIFICATE.getCode() - .replace(PluginConstants.ApplicationInstallProperties.CERT_HASH, - getHostedAppxApplication().getCertificateHash())); - certMetaTag.setFormat(Constants.META_FORMAT_B64); - certItemTag.setTarget(certTargetTag); - certItemTag.setMeta(certMetaTag); - certItemTag.setData(getHostedAppxApplication().getEncodedCertificate()); - certItemTagList.add(certItemTag); - certAddTag.setCommandId(operationId); - certAddTag.setItems(certItemTagList); - addTagList.add(certAddTag); - } - } - return addTagList; - } - - /*** - * Create execute objects required for APPX or MSI application installation which then will be converted as - * ExecuteTag elements to add in SyncML XML. - * - * @param operationId used to set as command ID - * @param operationCode is the LocURI - * @param replaceOld operation code placeholder - * @param replaceNew replace value of operation code placeholder - * @param appType APPX or MSI - * @return list of ExecuteTag objects - * @throws WindowsOperationException - */ - private List createExecuteTag(int operationId, String operationCode, String replaceOld, - String replaceNew, String appType) throws WindowsOperationException { - List executeTagList = new ArrayList<>(); - List itemTagList = new ArrayList<>(); - ExecuteTag executeTag = new ExecuteTag(); - ItemTag itemTag = new ItemTag(); - MetaTag metaTag = new MetaTag(); - TargetTag targetTag = new TargetTag(); - Document document; - Element dependencyElement; - targetTag.setLocURI(operationCode.replace(replaceOld, replaceNew)); - metaTag.setFormat(Constants.META_FORMAT_XML); - try { - if (PluginConstants.ApplicationInstallProperties.TYPE_APPX.equals(appType)) { - document = SyncmlGenerator.generateDocument(); - Element applicationElement = document - .createElement(PluginConstants.ApplicationInstallProperties.APPLICATION); - applicationElement.setAttribute(PluginConstants.ApplicationInstallProperties.PACKAGE_URI, - getHostedAppxApplication().getpackageUri()); - if (!isNullOrEmpty(getHostedAppxApplication().getDependencyPackageUri())) { - Element dependenciesElement = document - .createElement(PluginConstants.ApplicationInstallProperties.DEPENDENCIES); - for (String dependency : getHostedAppxApplication().getDependencyPackageUri()) { - dependencyElement = document - .createElement(PluginConstants.ApplicationInstallProperties.DEPENDENCY); - dependencyElement - .setAttribute(PluginConstants.ApplicationInstallProperties.PACKAGE_URI, dependency); - dependenciesElement.appendChild(dependencyElement); - } - applicationElement.appendChild(dependenciesElement); - } - itemTag.setElementData(applicationElement); - } else if (PluginConstants.ApplicationInstallProperties.TYPE_MSI.equals(appType)) { - metaTag.setType(Constants.META_TYPE_TEXT_PLAIN); - document = SyncmlGenerator.generateDocument(); - Element contentURLElement = document - .createElement(PluginConstants.ApplicationInstallProperties.CONTENT_URL); - contentURLElement.setTextContent(getHostedMSIApplication().getContentUrl()); - Element contentURLListElement = document - .createElement(PluginConstants.ApplicationInstallProperties.CONTENT_URL_LIST); - contentURLListElement.appendChild(contentURLElement); - Element downloadElement = document.createElement(PluginConstants.ApplicationInstallProperties.DOWNLOAD); - downloadElement.appendChild(contentURLListElement); - Element fileHashElement = document - .createElement(PluginConstants.ApplicationInstallProperties.FILE_HASH); - fileHashElement.setTextContent(getHostedMSIApplication().getFileHash()); - Element validationElement = document - .createElement(PluginConstants.ApplicationInstallProperties.VALIDATION); - validationElement.appendChild(fileHashElement); - Element enforcementElement = document - .createElement(PluginConstants.ApplicationInstallProperties.ENFORCEMENT); - Element commandLineElement = document - .createElement(PluginConstants.ApplicationInstallProperties.COMMAND_LINE); - commandLineElement.setTextContent(PluginConstants.ApplicationInstallProperties.COMMAND_LINE_VALUE); - enforcementElement.appendChild(commandLineElement); - Element timeOutElement = document.createElement(PluginConstants.ApplicationInstallProperties.TIMEOUT); - timeOutElement.setTextContent(PluginConstants.ApplicationInstallProperties.TIMEOUT_VALUE); - enforcementElement.appendChild(timeOutElement); - Element retryCountElement = document - .createElement(PluginConstants.ApplicationInstallProperties.RETRY_COUNT); - retryCountElement.setTextContent(PluginConstants.ApplicationInstallProperties.RETRY_COUNT_VALUE); - enforcementElement.appendChild(retryCountElement); - Element retryIntervalElement = document - .createElement(PluginConstants.ApplicationInstallProperties.RETRY_INTERVAL); - retryIntervalElement.setTextContent(PluginConstants.ApplicationInstallProperties.RETRY_INTERVAL_VALUE); - enforcementElement.appendChild(retryIntervalElement); - Element productElement = document.createElement(PluginConstants.ApplicationInstallProperties.PRODUCT); - productElement.setAttribute(PluginConstants.ApplicationInstallProperties.VERSION, - PluginConstants.ApplicationInstallProperties.VERSION_VALUE); - productElement.appendChild(downloadElement); - productElement.appendChild(validationElement); - productElement.appendChild(enforcementElement); - Element msiInstallJobElement = document - .createElement(PluginConstants.ApplicationInstallProperties.MSI_INSTALL_JOB); - msiInstallJobElement.setAttribute(PluginConstants.ApplicationInstallProperties.ID, - PluginConstants.ApplicationInstallProperties.URL_ESCAPED_OPEN_CURLY + getHostedMSIApplication() - .getProductId() + PluginConstants.ApplicationInstallProperties.URL_ESCAPED_CLOSE_CURLY); - msiInstallJobElement.appendChild(productElement); - itemTag.setElementData(msiInstallJobElement); - } - } catch (SyncmlOperationException e) { - String errorMsg = "Error occurred while generating a document to add as a node to Data element of Execute " - + "command which is required to Install " + appType + " application."; - log.error(errorMsg); - throw new WindowsOperationException(errorMsg, e); - } - itemTag.setTarget(targetTag); - itemTag.setMeta(metaTag); - itemTagList.add(itemTag); - executeTag.setCommandId(operationId); - executeTag.setItems(itemTagList); - executeTagList.add(executeTag); - return executeTagList; - } - -} 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/bean/HostedAppxApplication.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/bean/HostedAppxApplication.java deleted file mode 100644 index 61220059d..000000000 --- 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/bean/HostedAppxApplication.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.bean; - -import io.swagger.annotations.ApiModelProperty; - -import java.util.List; - -public class HostedAppxApplication { - - @ApiModelProperty(name = "packageUri", value = "Package URL.", required = true) - private String packageUri; - @ApiModelProperty(name = "packageFamilyName", value = "Package family name.", required = true) - private String packageFamilyName; - @ApiModelProperty(name = "dependencyPackageURLs", value = "Dependency Package URLs.") - private List dependencyPackageUri; - @ApiModelProperty(name = "certificateHash", value = "Application signed SHA1 certificate hash.") - private String certificateHash; - @ApiModelProperty(name = "encodedCertificate", value = "Application signed Base64 encoded certificate.") - private String encodedCertificate; - - public String getpackageUri() { - return packageUri; - } - - public void setpackageUri (String packageUri) { - this.packageUri = packageUri; - } - - public String getpackageFamilyName() { - return packageFamilyName; - } - - public void setpackageFamilyName(String packageFamilyName) { - this.packageFamilyName = packageFamilyName; - } - - public List getDependencyPackageUri() { - return dependencyPackageUri; - } - - public void setDependencyPackageUri(List dependencyPackageUri) { - this.dependencyPackageUri = dependencyPackageUri; - } - - public String getCertificateHash() { - return certificateHash; - } - - public void setCertificateHash(String certificateHash) { - this.certificateHash = certificateHash; - } - - public String getEncodedCertificate() { - return encodedCertificate; - } - - public void setEncodedCertificate(String encodedCertificate) { - this.encodedCertificate = encodedCertificate; - } -} 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/bean/HostedMSIApplication.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/bean/HostedMSIApplication.java deleted file mode 100644 index 75e80f581..000000000 --- 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/bean/HostedMSIApplication.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.bean; - -import io.swagger.annotations.ApiModelProperty; - -public class HostedMSIApplication { - - @ApiModelProperty(name = "productId", value = "Product ID.", required = true) - private String productId; - @ApiModelProperty(name = "contentUrl", value = "Content URL.", required = true) - private String contentUrl; - @ApiModelProperty(name = "fileHash", value = "File Hash.", required = true) - private String fileHash; - - public String getProductId() { - return productId; - } - - public void setProductId(String productId) { - this.productId = productId; - } - - public String getContentUrl() { - return contentUrl; - } - - public void setContentUrl(String contentUrl) { - this.contentUrl = contentUrl; - } - - public String getFileHash() { - return fileHash; - } - - public void setFileHash(String fileHash) { - this.fileHash = fileHash; - } -} 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/bean/WindowsOperation.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/bean/WindowsOperation.java deleted file mode 100644 index 0466f818c..000000000 --- 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/bean/WindowsOperation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.bean; - -import com.google.gson.Gson; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; - -import java.util.List; - -/*** - * This abstract class is used for extending generic functions with regard to operation. - */ -public abstract class WindowsOperation { - - public abstract List createOperationContent(Operation operation) throws WindowsOperationException; - - /*** - * Converts operation object to a json format. - * - * @return JSON formatted String - */ - public String toJSON() { - Gson gson = new Gson(); - return gson.toJson(this); - } - - /** - * Checks if the given string is null or empty - * - * @param value string value to check - * @return boolean value of null or empty - */ - public boolean isNullOrEmpty(String value) { - return value == null || value.trim().isEmpty(); - } - - /*** - * Checks if the given list is null or empty - * - * @param value string list value to check - * @return boolean value of null or empty - */ - public boolean isNullOrEmpty(List value) { - return value == null || value.isEmpty(); - } -} 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/bean/wrapper/EnterpriseApplicationBeanWrapper.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/bean/wrapper/EnterpriseApplicationBeanWrapper.java deleted file mode 100644 index cd3983083..000000000 --- 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/bean/wrapper/EnterpriseApplicationBeanWrapper.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.bean.wrapper; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.EnterpriseApplication; - -import java.util.List; - -@ApiModel(value = "EnterpriseApplicationBeanWrapper", - description = "Information related to Enterprise Application.") -public class EnterpriseApplicationBeanWrapper { - - @ApiModelProperty(name = "deviceIDs", - value = "List of device Ids to be need to execute operation.", required = true) - private List deviceIDs; - @ApiModelProperty(name = "operation", - value = "Enterprise Application.", required = true) - private EnterpriseApplication operation; - - public List getDeviceIDs() { - return deviceIDs; - } - - public void setDeviceIDs(List deviceIDs) { - this.deviceIDs = deviceIDs; - } - - public EnterpriseApplication getOperation() { - return operation; - } - - public void setOperation(EnterpriseApplication operation) { - this.operation = operation; - } -} 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/common/PluginConstants.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/common/PluginConstants.java deleted file mode 100644 index bbe2c7f54..000000000 --- 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/common/PluginConstants.java +++ /dev/null @@ -1,422 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.common; - -/** - * PluginConstants class for Windows plugin. This class has inner classes for containing constants for - * each service. - */ -public final class PluginConstants { - - //Service endpoints - public static final String DISCOVERY_SERVICE_ENDPOINT = - "org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.DiscoveryService"; - public static final String CERTIFICATE_ENROLLMENT_SERVICE_ENDPOINT = - "org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.CertificateEnrollmentService"; - public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_ENDPOINT = - "org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.CertificateEnrollmentPolicyService"; - public static final String ENROLLMENT_SERVICE_ENDPOINT = - "org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.EnrollmentService"; - - //Services' target namespaces - public static final String DISCOVERY_SERVICE_TARGET_NAMESPACE = - "http://schemas.microsoft.com/windows/management/2012/01/enrollment"; - public static final String DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE = - "http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC"; - public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE = - "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy"; - - //Certificate enrollment service urls and namespaces - public static final String WS_TRUST_TARGET_NAMESPACE = - "http://docs.oasis-open.org/ws-sx/ws-trust/200512"; - public static final String WS_SECURITY_TARGET_NAMESPACE = - "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; - public static final String SOAP_AUTHORIZATION_TARGET_NAMESPACE = - "http://schemas.xmlsoap.org/ws/2006/12/authorization"; - - //Certificate enrollment policy service urls and namespaces - public static final String ENROLLMENT_POLICY_TARGET_NAMESPACE = - "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy"; - public static final String REQUEST_WRAPPER_CLASS_NAME = - "com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPolicies"; - public static final String RESPONSE_WRAPPER_CLASS_NAME = - "com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy.GetPoliciesResponse"; - - //Servlet Context attributes names - public static final String CONTEXT_WAP_PROVISIONING_FILE = "WAP_PROVISIONING_FILE"; - - //Message handler constants - public static final String CONTENT_LENGTH = "Content-Length"; - public static final String SECURITY = "Security"; - public static final String TO = "To"; - public static final String CXF_REQUEST_URI = "org.apache.cxf.request.uri"; - - //Web services media types - public static final String SYNCML_MEDIA_TYPE = "application/vnd.syncml.dm+xml"; - - /** - * Discovery service related other constants - */ - public final class Discovery { - private Discovery() { - throw new AssertionError(); - } - - public static final String DEVICE_ENROLLMENT_SUBDOMAIN = "https://EnterpriseEnrollment."; - public static final String CERTIFICATE_ENROLLMENT_POLICY_SERVICE_URL = - "/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc"; - public static final String CERTIFICATE_ENROLLMENT_SERVICE_URL = - "/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc"; - public static final String ENROLLMENT_SERVICE_URL = - "/ENROLLMENTSERVER/Win10DeviceEnrollmentWebservice.svc"; - public static final String WAB_URL = "/windows-web-agent/enrollments/windows/login-agent"; - } - - /** - * Certificate enrolment policy service related constants - */ - public final class CertificateEnrolmentPolicy { - private CertificateEnrolmentPolicy() { - throw new AssertionError(); - } - - public static final int MINIMAL_KEY_LENGTH = 2048; - public static final int POLICY_SCHEMA = 3; - public static final int HASH_ALGORITHM_OID_REFERENCE = 0; - public static final int OID_REFERENCE = 0; - public static final String OID = "1.3.14.3.2.29"; - public static final String OID_DEFAULT_NAME = "szOID_OIWSEC_sha1RSASign"; - public static final int OID_GROUP = 1; - public static final int OID_REFERENCE_ID = 0; - } - - /** - * Certificate enrollment Service related constants. - */ - public final class CertificateEnrolment { - private CertificateEnrolment() { - throw new AssertionError(); - } - - public static final String TOKEN_TYPE = - "http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken"; - public static final String PARM = "parm"; - public static final String TYPE = "type"; - public static final String VALUE = "value"; - public static final String VALUE_TYPE = - "http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentProvisionDoc"; - public static final String ENCODING_TYPE = - "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd#base64binary"; - public static final String CA_CERT = "cacert"; - public static final String X_509 = "X.509"; - public static final String WAP_PROVISIONING_XML = "wap-provisioning.xml"; - public static final String PROVIDER = "BC"; - public static final String ALGORITHM = "SHA1withRSA"; - public static final String JKS = "JKS"; - public static final String SECURITY = "Security"; - public static final String WSS_SECURITY_UTILITY = - "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"; - public static final String TIMESTAMP_ID = "Id"; - public static final String TIMESTAMP_U = "u"; - public static final String TIMESTAMP = "Timestamp"; - public static final String TIMESTAMP_0 = "_0"; - public static final String CREATED = "Created"; - public static final String EXPIRES = "Expires"; - public static final String UTF_8 = "utf-8"; - - public static final int DOMAIN_SEGMENT = 1; - public static final int EMAIL_SEGMENT = 0; - public static final int REQUEST_ID = 0; - public static final int CA_CERTIFICATE_POSITION = 0; - public static final int SIGNED_CERTIFICATE_POSITION = 1; - public static final int APPAUTH_USERNAME_POSITION = 21; - public static final int APPAUTH_PASSWORD_POSITION = 22; - public static final int POLLING_FREQUENCY_POSITION = 24; - public static final int SYNCML_PROVISIONING_ADDR_POSITION = 8; - public static final int DOMAIN_POSITION = 7; - public static final String ENROLL_SUBDOMAIN = "https://EnterpriseEnrollment."; - public static final String SYNCML_PROVISIONING_SERVICE_URL = "/Syncml/initialquery"; - public static final String SYNCML_PROVISIONING_WIN10_SERVICE_URL = "/devicemgt"; - public static final String ENROLLMENT_DISPOSITION_MESSAGE = "http://schemas.microsoft.com/windows/pki/" + - "2009/01/enrollment"; - } - - /** - * SynclML service related constants. - */ - public final class SyncML { - private SyncML() { - throw new AssertionError(); - } - - public static final String SYNCML_SOURCE = "Source"; - public static final String SYNCML_DATA = "Data"; - public static final String SYNCML_META = "Meta"; - public static final String SYNCML_CMD = "Cmd"; - public static final String SYNCML_CHAL = "ChallengeTag"; - public static final String SYNCML_CMD_ID = "CmdID"; - public static final String SYNCML_CMD_REF = "CmdRef"; - public static final String SYNCML_MESSAGE_REF = "MsgRef"; - public static final String SYNCML_LOCATION_URI = "LocURI"; - public static final String SYNCML_TARGET_REF = "TargetRef"; - - public static final int SYNCML_FIRST_MESSAGE_ID = 1; - public static final int SYNCML_SECOND_MESSAGE_ID = 2; - public static final int SYNCML_FIRST_SESSION_ID = 1; - public static final int SYNCML_SECOND_SESSION_ID = 2; - public static final int OSVERSION_POSITION = 0; - public static final int DEVICE_ID_POSITION = 0; - public static final int DEVICE_MODEL_POSITION = 2; - public static final int DEVICE_MAN_POSITION = 1; - public static final int DEVICE_MOD_VER_POSITION = 3; - public static final int DEVICE_LANG_POSITION = 4; - public static final int IMSI_POSITION = 1; - public static final int IMEI_POSITION = 2; - public static final int VENDOR_POSITION = 4; - public static final int MODEL_POSITION = 5; - public static final int MAC_ADDRESS_POSITION = 7; - public static final int RESOLUTION_POSITION = 8; - public static final int DEVICE_NAME_POSITION = 10; - public static final String SYNCML_DATA_ONE = "1"; - public static final String SYNCML_DATA_ZERO = "0"; - public static final String OS_VERSION = "OS_VERSION"; - public static final String IMSI = "IMSI"; - public static final String IMEI = "IMEI"; - public static final String VENDOR = "VENDOR"; - public static final String MODEL = "DEVICE_MODEL"; - public static final String MAC_ADDRESS = "MAC_ADDRESS"; - public static final String DEVICE_INFO = "DEVICE_INFO"; - public static final String DEVICE_NAME = "DEVICE_NAME"; - public static final String SOFTWARE_VERSION = "SOFTWARE_VERSION"; - public static final String DEV_ID = "DEV_ID"; - public static final String MANUFACTURER = "MANUFACTURER"; - public static final String LANGUAGE = "LANGUAGE"; - public static final String RESOLUTION = "RESOLUTION"; - - // windows 10 codes - public static final String TOTAL_RAM = "TOTAL_RAM";// available ram in MB - public static final String TOTAL_STORAGE = "TOTAL_STORAGE"; - public static final String OS_PLATFORM = "OS_PLATFORM"; - public static final String DEVICE_TYPE = "DEVICE_TYPE"; - public static final String BATTERY_QUERY = "BATTERY_QUERY"; - public static final String BATTERY_STATUS = "BATTERY_STATUS"; - public static final String BATTERY_CHARGE_REMAINING = "BATTERY_CHARGE_REMAINING"; - public static final String BATTERY_ESTIMATED_RUNTIME = "BATTERY_ESTIMATED_RUNTIME"; - public static final String MOBILE_ID = "MOBILE_ID"; - public static final String LONGITUDE = "LONGITUDE"; - public static final String LATITUDE = "LATITUDE"; - - public static final String DEVICE_UNENROLL_META_TYPE = "com.microsoft:mdm.unenrollment.userrequest"; - } - - /** - * Windows device constants. - */ - public final class DeviceConstants { - private DeviceConstants() { - throw new AssertionError(); - } - - public static final String DEVICE_ID_NOT_FOUND = "Device Id not found for device found at %s"; - public static final String DEVICE_ID_SERVICE_NOT_FOUND = - "Issue in retrieving device management service instance for device found at %s"; - } - - /** - * Device Operation codes. - */ - public final class OperationCodes { - private OperationCodes() { - throw new AssertionError(); - } - - public static final String DEVICE_LOCK = "DEVICE_LOCK"; - public static final String DISENROLL = "DISENROLL"; - public static final String DEVICE_RING = "DEVICE_RING"; - public static final String WIPE_DATA = "WIPE_DATA"; - public static final String ENCRYPT_STORAGE = "ENCRYPT_STORAGE"; - public static final String LOCK_RESET = "LOCK_RESET"; - public static final String PIN_CODE = "LOCK_PIN"; - public static final String CAMERA = "CAMERA"; - public static final String PASSCODE_POLICY = "PASSCODE_POLICY"; - public static final String PASSWORD_EXPIRE = "PASSWORD_EXPIRE"; - public static final String PASSWORD_HISTORY = "PASSWORD_HISTORY"; - public static final String MAX_PASSWORD_INACTIVE_TIME = "MAX_PASSWORD_INACTIVE_TIME"; - public static final String MIN_PASSWORD_COMPLEX_CHARACTERS = "MIN_PASSWORD_COMPLEX_CHARACTERS"; - public static final String ALPHANUMERIC_PASSWORD = "ALPHANUMERIC_PASSWORD"; - public static final String SIMPLE_PASSWORD = "SIMPLE_PASSWORD"; - public static final String MIN_PASSWORD_LENGTH = "MIN_PASSWORD_LENGTH"; - public static final String DEVICE_PASSWORD_ENABLE = "DEVICE_PASSWORD_ENABLE"; - public static final String PASSWORD_MAX_FAIL_ATTEMPTS = "PASSWORD_MAX_FAIL_ATTEMPTS"; - public static final String MONITOR = "MONITOR"; - public static final String CAMERA_STATUS = "CAMERA_STATUS"; - public static final String POLICY_BUNDLE = "POLICY_BUNDLE"; - public static final String ENCRYPT_STORAGE_STATUS = "ENCRYPT_STORAGE_STATUS"; - public static final String DEVICE_PASSWORD_STATUS = "DEVICE_PASSWORD_STATUS"; - public static final String DEVICE_PASSCODE_DELETE = "DEVICE_PASSCODE_DELETE"; - public static final String DEVICE_INFO = "DEVICE_INFO"; - public static final String POLICY_REVOKE = "POLICY_REVOKE"; - public static final String DEVICE_LOCATION = "DEVICE_LOCATION"; - public static final String LONGITUDE = "LONGITUDE"; - public static final String LATITUDE = "LATITUDE"; - public static final String DEVICE_REBOOT = "DEVICE_REBOOT"; - public static final String INSTALL_ENTERPRISE_APPLICATION = "INSTALL_ENTERPRISE_APPLICATION"; - } - - /** - * Plugin response status code constants. - */ - public final class StatusCodes { - private StatusCodes() { - throw new AssertionError(); - } - - public static final int MULTI_STATUS_HTTP_CODE = 207; - - } - - public final class WindowsConstant { - public static final String DEVICE_TYPE_WINDOWS = "windows"; - public static final String HEADER_CONTENT_TYPE = "Content-Type"; - public static final String APPLICATION_JSON = "application/json"; - } - - /** - * Tenant Configuration related constants. - */ - public final class TenantConfigProperties { - private TenantConfigProperties() { - throw new AssertionError(); - } - - public static final String LICENSE_KEY = "windowsLicense"; - public static final String LANGUAGE_US = "en_US"; - public static final String CONTENT_TYPE_TEXT = "text"; - public static final String NOTIFIER_FREQUENCY = "notifierFrequency"; - public static final String DEFAULT_FREQUENCY = "8"; - public static final String AUTH_POLICY = "authPolicy"; - public static final String DEFAULT_AUTH_POLICY = "Federated"; - } - - /** - * Policy Configuration related constants. - */ - public final class PolicyConfigProperties { - private PolicyConfigProperties() { - throw new AssertionError(); - } - - public static final String POLICY_ENABLE = "enabled"; - public static final String ENCRYPTED_ENABLE = "encrypted"; - public static final String ENABLE_PASSWORD = "enablePassword"; - } - - /** - * Authentication related constants. - */ - public final class AuthenticatorProperties { - private AuthenticatorProperties() { throw new AssertionError(); } - public static final String MAX_CONNECTION_PER_HOST = "MaxConnectionsPerHost"; - public static final String MAX_TOTAL_CONNECTIONS = "MaxTotalConnections"; - } - - /** - * Windows version(8.1/10) related constants. - */ - public final class WindowsVersionProperties { - private WindowsVersionProperties() { - throw new AssertionError(); - } - public static final String REQUESTED_WIN10_VERSION = "3.0"; - public static final String REQUESTED_WIN81_VERSION = "2.0"; - } - - /** - * Windows10 enrollment property constants. - */ - - public final class WindowsEnrollmentProperties { - private WindowsEnrollmentProperties() { - throw new AssertionError(); - } - public static final String DEVICE_NAME = "DeviceName"; - public static final String DEVICE_VERSION = "OSVersion"; - public static final String DEVICE_ID = "DeviceID"; - public static final String IMEI = "MobileEquipmentId"; - public static final String TYPE = "DeviceType"; - } - - public final class ApplicationInstallProperties { - private ApplicationInstallProperties() { - throw new AssertionError(); - } - public static final String APPLICATION = "Application"; - public static final String TYPE_APPX = "APPX"; - public static final String TYPE_MSI = "MSI"; - public static final String PACKAGE_FAMILY_NAME = "{PackageFamilyName}"; - public static final String PRODUCT_ID = "{ProductId}"; - public static final String CERT_HASH = "{CertHash}"; - public static final String HOSTED_INSTALL = "/HostedInstall"; - - //XML Related Constants - public static final String ID = "id"; - public static final String PACKAGE_URI = "PackageUri"; - public static final String DEPENDENCIES = "Dependencies"; - public static final String DEPENDENCY = "Dependency"; - public static final String CONTENT_URL = "ContentURL"; - public static final String CONTENT_URL_LIST = "ContentURLList"; - public static final String DOWNLOAD = "Download"; - public static final String COMMAND_LINE = "CommandLine"; - public static final String COMMAND_LINE_VALUE = "/quiet"; - public static final String FILE_HASH = "FileHash"; - public static final String VALIDATION = "Validation"; - public static final String ENFORCEMENT = "Enforcement"; - public static final String TIMEOUT = "TimeOut"; - public static final String RETRY_COUNT = "RetryCount"; - public static final String RETRY_INTERVAL = "RetryInterval"; - public static final String PRODUCT = "Product"; - public static final String MSI_INSTALL_JOB = "MsiInstallJob"; - public static final String VERSION = "version"; - public static final String VERSION_VALUE = "1.0.0"; - public static final String TIMEOUT_VALUE = "5"; - public static final String RETRY_COUNT_VALUE = "3"; - public static final String RETRY_INTERVAL_VALUE = "5"; - public static final String LICENSE = "License"; - public static final String CONTENT = "Content"; - public static final String URL_ESCAPED_OPEN_CURLY = "%7B"; - public static final String URL_ESCAPED_CLOSE_CURLY = "%7D"; - } -} 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/common/SyncmlCommandType.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/common/SyncmlCommandType.java deleted file mode 100644 index 9da5a68af..000000000 --- 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/common/SyncmlCommandType.java +++ /dev/null @@ -1,34 +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.common; - -public enum SyncmlCommandType { - - WIFI("WIFI"); - - private final String commandType; - - SyncmlCommandType(final String commandType) { - this.commandType = commandType; - } - - public String getValue() { - return this.commandType; - } -} 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/common/authenticator/OAuth2TokenValidator.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/common/authenticator/OAuth2TokenValidator.java deleted file mode 100644 index ceef5c154..000000000 --- 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/common/authenticator/OAuth2TokenValidator.java +++ /dev/null @@ -1,37 +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.common.authenticator; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse; - -/** - * Declares the contract for OAuth2TokenValidator implementations. - */ -public interface OAuth2TokenValidator { - /** - * This method gets a string accessToken and validates it and generate the OAuthValidationResponse - * containing the validity and user details if valid. - * - * @param accessToken which need to be validated. - * @param resource which need to be validated. - * @return OAuthValidationResponse with the validated results. - */ - OAuthValidationResponse validateToken(String accessToken, String resource) throws OAuthTokenValidationException; -} 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/common/authenticator/OAuthConstants.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/common/authenticator/OAuthConstants.java deleted file mode 100644 index 28e7cb637..000000000 --- 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/common/authenticator/OAuthConstants.java +++ /dev/null @@ -1,40 +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.common.authenticator; - -import org.wso2.carbon.utils.CarbonUtils; - -import java.io.File; - -/** - * Defines constants to be used inside oauth validators. - */ -public class OAuthConstants { - - public static final String AUTHORIZATION_HEADER_PREFIX_BEARER = "Bearer"; - public static final String AUTHORIZATION_HEADER_PREFIX_BASIC = "Basic"; - public static final String BEARER_TOKEN_TYPE = "bearer"; - public static final String BEARER_TOKEN_IDENTIFIER = "token"; - public static final String AUTHENTICATOR_NAME = "OAuthAuthenticator"; - public static final String RESOURCE_KEY = "resource"; - public static final String AUTHENTICATOR_CONFIG_PATH = CarbonUtils.getEtcCarbonConfigDirPath() + - File.separator + "webapp-authenticator-config.xml"; - private static final String AUTHENTICATOR_CONFIG_SCHEMA_PATH = - "resources/config/schema/webapp-authenticator-config-schema.xsd"; -} 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/common/authenticator/OAuthTokenValidationStubFactory.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/common/authenticator/OAuthTokenValidationStubFactory.java deleted file mode 100644 index 521a9d7a8..000000000 --- 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/common/authenticator/OAuthTokenValidationStubFactory.java +++ /dev/null @@ -1,215 +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.common.authenticator; - -import org.apache.axis2.AxisFault; -import org.apache.axis2.client.Options; -import org.apache.axis2.client.ServiceClient; -import org.apache.axis2.transport.http.HTTPConstants; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.HttpConnectionManager; -import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; -import org.apache.commons.httpclient.params.HttpConnectionManagerParams; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.pool.PoolableObjectFactory; -import org.apache.http.conn.HttpClientConnectionManager; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException; -import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -public class OAuthTokenValidationStubFactory implements PoolableObjectFactory { - private String url; - private String basicAuthHeader; - private HttpClient httpClient; - - private static final Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthTokenValidationStubFactory.class); - - public OAuthTokenValidationStubFactory(String url, String adminUsername, String adminPassword, - Properties properties) { - this.validateUrl(url); - this.url = url; - - this.validateCredentials(adminUsername, adminPassword); - this.basicAuthHeader = new String(Base64.encodeBase64((adminUsername + ":" + adminPassword).getBytes())); - - HttpConnectionManager connectionManager = this.createConnectionManager(properties); - this.httpClient = new HttpClient(connectionManager); - } - - /** - * Creates an instance of MultiThreadedHttpConnectionManager using HttpClient 3.x APIs - * - * @param properties Properties to configure MultiThreadedHttpConnectionManager - * @return An instance of properly configured MultiThreadedHttpConnectionManager - */ - private HttpConnectionManager createConnectionManager(Properties properties) { - HttpConnectionManagerParams params = new HttpConnectionManagerParams(); - if (properties == null || properties.isEmpty()) { - throw new IllegalArgumentException("Parameters required to initialize HttpClient instances " + - "associated with OAuth token validation service stub are not provided"); - } - String maxConnectionsPerHostParam = properties.getProperty(PluginConstants. - AuthenticatorProperties.MAX_CONNECTION_PER_HOST); - if (maxConnectionsPerHostParam == null || maxConnectionsPerHostParam.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("MaxConnectionsPerHost parameter is not explicitly defined. Therefore, the default, " + - "which is 2, will be used"); - } - } else { - params.setDefaultMaxConnectionsPerHost(Integer.parseInt(maxConnectionsPerHostParam)); - } - - String maxTotalConnectionsParam = properties.getProperty(PluginConstants. - AuthenticatorProperties.MAX_TOTAL_CONNECTIONS); - if (maxTotalConnectionsParam == null || maxTotalConnectionsParam.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("MaxTotalConnections parameter is not explicitly defined. Therefore, the default, " + - "which is 10, will be used"); - } - } else { - params.setMaxTotalConnections(Integer.parseInt(maxTotalConnectionsParam)); - } - HttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager(); - connectionManager.setParams(params); - return connectionManager; - } - - /** - * Creates an instance of PoolingHttpClientConnectionManager using HttpClient 4.x APIs - * - * @param properties Properties to configure PoolingHttpClientConnectionManager - * @return An instance of properly configured PoolingHttpClientConnectionManager - */ - private HttpClientConnectionManager createClientConnectionManager(Properties properties) { - PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(); - if (properties != null) { - String maxConnectionsPerHostParam = properties.getProperty(PluginConstants. - AuthenticatorProperties.MAX_CONNECTION_PER_HOST); - if (maxConnectionsPerHostParam == null || maxConnectionsPerHostParam.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("MaxConnectionsPerHost parameter is not explicitly defined. Therefore, the default, " + - "which is 2, will be used"); - } - } else { - connectionManager.setDefaultMaxPerRoute(Integer.parseInt(maxConnectionsPerHostParam)); - } - - String maxTotalConnectionsParam = properties.getProperty(PluginConstants. - AuthenticatorProperties.MAX_TOTAL_CONNECTIONS); - if (maxTotalConnectionsParam == null || maxTotalConnectionsParam.isEmpty()) { - if (log.isDebugEnabled()) { - log.debug("MaxTotalConnections parameter is not explicitly defined. Therefore, the default, " + - "which is 10, will be used"); - } - } else { - connectionManager.setMaxTotal(Integer.parseInt(maxTotalConnectionsParam)); - } - } else { - if (log.isDebugEnabled()) { - log.debug("Properties, i.e. MaxTotalConnections/MaxConnectionsPerHost, required to tune the " + - "HttpClient used in OAuth token validation service stub instances are not provided. " + - "Therefore, the defaults, 2/10 respectively, will be used"); - } - } - return connectionManager; - } - - @Override - public Object makeObject() throws Exception { - return this.createStub(); - } - - @Override - public void destroyObject(Object o) throws Exception { - - } - - @Override - public boolean validateObject(Object o) { - return true; - } - - @Override - public void activateObject(Object o) throws Exception { - if (log.isDebugEnabled()) { - log.debug("OAuth token validate stub instance is activated"); - } - } - - @Override - public void passivateObject(Object o) throws Exception { - if (o instanceof OAuth2TokenValidationServiceStub) { - OAuth2TokenValidationServiceStub stub = (OAuth2TokenValidationServiceStub) o; - stub._getServiceClient().cleanupTransport(); - } - } - - private OAuth2TokenValidationServiceStub createStub() throws OAuthTokenValidationException { - OAuth2TokenValidationServiceStub stub; - try { - stub = new OAuth2TokenValidationServiceStub(url); - ServiceClient client = stub._getServiceClient(); - client.getServiceContext().getConfigurationContext().setProperty( - HTTPConstants.CACHED_HTTP_CLIENT, httpClient); - - List
headerList = new ArrayList<>(); - Header header = new Header(); - header.setName(HTTPConstants.HEADER_AUTHORIZATION); - header.setValue(OAuthConstants.AUTHORIZATION_HEADER_PREFIX_BASIC + " " + basicAuthHeader); - headerList.add(header); - - Options options = client.getOptions(); - options.setProperty(HTTPConstants.HTTP_HEADERS, headerList); - options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, "true"); - client.setOptions(options); - } catch (AxisFault axisFault) { - throw new OAuthTokenValidationException("Error occurred while creating the " + - "OAuth2TokenValidationServiceStub.", axisFault); - } - return stub; - } - - private void validateUrl(String url) { - if (url == null || url.isEmpty()) { - throw new IllegalArgumentException("Url provided as the endpoint of the OAuth token validation service " + - "is null"); - } - } - - private void validateCredentials(String adminUsername, String adminPassword) { - if (adminUsername == null || adminUsername.isEmpty()) { - throw new IllegalArgumentException("An appropriate username required to initialize OAuth token " + - "validation service stub factory hasn't been provided"); - } - if (adminPassword == null || adminPassword.isEmpty()) { - throw new IllegalArgumentException("An appropriate password required to initialize OAuth token " + - "validation service stub factory hasn't been provided"); - } - } - -} 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/common/authenticator/OAuthValidatorFactory.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/common/authenticator/OAuthValidatorFactory.java deleted file mode 100644 index ff7b03549..000000000 --- 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/common/authenticator/OAuthValidatorFactory.java +++ /dev/null @@ -1,81 +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.common.authenticator; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.LocalOAuthValidator; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.RemoteOAuthValidator; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig; - -import java.util.Properties; - -/** - * The class validate the configurations and provide the most suitable implementation according to the configuration. - * Factory class for OAuthValidator. - */ -public class OAuthValidatorFactory { - - private static Properties authenticatorProperties; - - public static OAuth2TokenValidator getValidator() { - Properties authenticatorProperties = getAuthenticatorProperties(); - boolean isRemote = Boolean.parseBoolean(authenticatorProperties.getProperty("IsRemote")); - if (isRemote) { - String url = authenticatorProperties.getProperty("TokenValidationEndpointUrl"); - if ((url == null) || (url.isEmpty())) { - throw new IllegalStateException("OAuth token validation endpoint url is not provided"); - } - String adminUsername = authenticatorProperties.getProperty("Username"); - if (adminUsername == null) { - throw new IllegalStateException("Username to connect to the OAuth token validation endpoint " + - "is not provided"); - } - - String adminPassword = authenticatorProperties.getProperty("Password"); - if (adminPassword == null) { - throw new IllegalStateException("Password to connect to the OAuth token validation endpoint " + - "is not provided"); - } - - Properties validatorProperties = new Properties(); - validatorProperties.setProperty("MaxTotalConnections", authenticatorProperties.getProperty("MaxTotalConnections")); - validatorProperties.setProperty("MaxConnectionsPerHost", authenticatorProperties.getProperty("MaxConnectionsPerHost")); - if ((url != null) && (!url.trim().isEmpty())) { - url = url + "/services/OAuth2TokenValidationService.OAuth2TokenValidationServiceHttpsSoap12Endpoint/"; - return new RemoteOAuthValidator(url, adminUsername, adminPassword, validatorProperties); - } - throw new IllegalStateException("Remote server host can't be empty in OAuthAuthenticator configuration."); - } - return new LocalOAuthValidator(); - } - - private static Properties getAuthenticatorProperties() { - if (authenticatorProperties == null) { - AuthenticatorConfig config = WindowsAPIUtils.getBSTAuthenticatorConfig(); - if ((config.getParams() != null) && (!config.getParams().isEmpty())) { - Properties properties = new Properties(); - for (AuthenticatorConfig.Parameter param : config.getParams()) { - properties.setProperty(param.getName(), param.getValue()); - } - authenticatorProperties = properties; - } - } - return authenticatorProperties; - } -} 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/common/authenticator/impl/LocalOAuthValidator.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/common/authenticator/impl/LocalOAuthValidator.java deleted file mode 100644 index f627ad7f6..000000000 --- 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/common/authenticator/impl/LocalOAuthValidator.java +++ /dev/null @@ -1,74 +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.common.authenticator.impl; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuth2TokenValidator; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationRequestDTO; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - -/** - * Handles the OAuth2 token validation from the same server using OSGi services. - */ -public class LocalOAuthValidator implements OAuth2TokenValidator { - @Override - public OAuthValidationResponse validateToken(String accessToken, String resource) - throws OAuthTokenValidationException { - - OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO(); - OAuth2TokenValidationRequestDTO.OAuth2AccessToken oauthToken = - validationRequest.new OAuth2AccessToken(); - oauthToken.setTokenType(OAuthConstants.BEARER_TOKEN_TYPE); - oauthToken.setIdentifier(accessToken); - validationRequest.setAccessToken(oauthToken); - - //Set the resource context param. This will be used in scope validation. - OAuth2TokenValidationRequestDTO.TokenValidationContextParam - resourceContextParam = validationRequest.new TokenValidationContextParam(); - resourceContextParam.setKey(OAuthConstants.RESOURCE_KEY); - resourceContextParam.setValue(resource); - - OAuth2TokenValidationRequestDTO.TokenValidationContextParam[] - tokenValidationContextParams = - new OAuth2TokenValidationRequestDTO.TokenValidationContextParam[1]; - tokenValidationContextParams[0] = resourceContextParam; - validationRequest.setContext(tokenValidationContextParams); - - org.wso2.carbon.identity.oauth2.dto.OAuth2TokenValidationResponseDTO tokenValidationResponse = - WindowsAPIUtils.getOAuth2TokenValidationService().findOAuthConsumerIfTokenIsValid( - validationRequest).getAccessTokenValidationResponse(); - boolean isValid = tokenValidationResponse.isValid(); - String username; - String tenantDomain; - if (isValid) { - username = MultitenantUtils.getTenantAwareUsername( - tokenValidationResponse.getAuthorizedUser()); - tenantDomain = - MultitenantUtils.getTenantDomain(tokenValidationResponse.getAuthorizedUser()); - } else { - OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse(); - oAuthValidationResponse.setErrorMsg(tokenValidationResponse.getErrorMsg()); - return oAuthValidationResponse; - } - return new OAuthValidationResponse(username, tenantDomain, isValid); - } -} 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/common/authenticator/impl/RemoteOAuthValidator.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/common/authenticator/impl/RemoteOAuthValidator.java deleted file mode 100644 index 48c3e2175..000000000 --- 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/common/authenticator/impl/RemoteOAuthValidator.java +++ /dev/null @@ -1,122 +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.common.authenticator.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.commons.pool.impl.GenericObjectPool; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuth2TokenValidator; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthTokenValidationStubFactory; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.OAuthValidationResponse; -import org.wso2.carbon.identity.oauth2.stub.OAuth2TokenValidationServiceStub; -import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO; -import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_OAuth2AccessToken; -import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationRequestDTO_TokenValidationContextParam; -import org.wso2.carbon.identity.oauth2.stub.dto.OAuth2TokenValidationResponseDTO; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; - -import java.rmi.RemoteException; -import java.util.Properties; - -/** - * Handles the OAuth2 token validation from remote IS servers using remote OAuthValidation service-stub. - */ -public class RemoteOAuthValidator implements OAuth2TokenValidator { - - private GenericObjectPool stubs; - private static final Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.impl.RemoteOAuthValidator.class); - - public RemoteOAuthValidator(String hostURL, String adminUsername, String adminPassword, Properties properties) { - this.stubs = - new GenericObjectPool(new OAuthTokenValidationStubFactory( - hostURL, adminUsername, adminPassword, properties)); - } - - public OAuthValidationResponse validateToken(String accessToken, - String resource) throws OAuthTokenValidationException { - OAuth2TokenValidationServiceStub stub = null; - OAuth2TokenValidationResponseDTO validationResponse; - try { - OAuth2TokenValidationRequestDTO validationRequest = createValidationRequest(accessToken, resource); - stub = (OAuth2TokenValidationServiceStub) this.stubs.borrowObject(); - validationResponse = - stub.findOAuthConsumerIfTokenIsValid(validationRequest).getAccessTokenValidationResponse(); - } catch (RemoteException e) { - throw new OAuthTokenValidationException("Remote Exception occurred while invoking the Remote " + - "IS server for OAuth2 token validation.", e); - } catch (Exception e) { - throw new OAuthTokenValidationException("Error occurred while borrowing an oauth token validation " + - "service stub from the pool", e); - } finally { - try { - this.stubs.returnObject(stub); - } catch (Exception e) { - log.warn("Error occurred while returning the object back to the oauth token validation service " + - "stub pool", e); - } - } - - if (validationResponse == null) { - if (log.isDebugEnabled()) { - log.debug("Response returned by the OAuth token validation service is null"); - } - return null; - } - - boolean isValid = validationResponse.getValid(); - String tenantDomain; - String username; - if (isValid) { - username = MultitenantUtils.getTenantAwareUsername(validationResponse.getAuthorizedUser()); - tenantDomain = MultitenantUtils.getTenantDomain(validationResponse.getAuthorizedUser()); - } else { - OAuthValidationResponse oAuthValidationResponse = new OAuthValidationResponse(); - oAuthValidationResponse.setErrorMsg(validationResponse.getErrorMsg()); - return oAuthValidationResponse; - } - return new OAuthValidationResponse(username, tenantDomain, isValid); - } - - private OAuth2TokenValidationRequestDTO createValidationRequest(String accessToken, String resource) { - OAuth2TokenValidationRequestDTO validationRequest = new OAuth2TokenValidationRequestDTO(); - OAuth2TokenValidationRequestDTO_OAuth2AccessToken oauthToken = - new OAuth2TokenValidationRequestDTO_OAuth2AccessToken(); - - oauthToken.setTokenType("bearer"); - oauthToken.setIdentifier(accessToken); - validationRequest.setAccessToken(oauthToken); - - OAuth2TokenValidationRequestDTO_TokenValidationContextParam resourceContextParam = - new OAuth2TokenValidationRequestDTO_TokenValidationContextParam(); - - resourceContextParam.setKey("resource"); - resourceContextParam.setValue(resource); - - OAuth2TokenValidationRequestDTO_TokenValidationContextParam[] tokenValidationContextParams = - new OAuth2TokenValidationRequestDTO_TokenValidationContextParam[1]; - - tokenValidationContextParams[0] = resourceContextParam; - validationRequest.setContext(tokenValidationContextParams); - - return validationRequest; - } - -} 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/common/beans/CacheEntry.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/common/beans/CacheEntry.java deleted file mode 100644 index f0a69851c..000000000 --- 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/common/beans/CacheEntry.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.common.beans; - -import java.io.Serializable; - -/** - * Class for java CacheEntry - */ -public class CacheEntry implements Serializable { - private String deviceID; - private String username; - private String ownership; - - private static final long serialVersionUID = 19981017L; - - public String getOwnership() { - return ownership; - } - - public void setOwnership(String ownership) { - this.ownership = ownership; - } - - public String getDeviceID() { - return deviceID; - } - - public void setDeviceID(String deviceID) { - this.deviceID = deviceID; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } -} 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/common/beans/Device.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/common/beans/Device.java deleted file mode 100644 index 60b810007..000000000 --- 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/common/beans/Device.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.device.mgt.mobile.windows.api.common.beans; - -/** - * Class for get device IDS. - */ -public class Device { - - private String id; - - public String getID() { - return id; - } - - public void setID(String id) { - this.id = id; - } - -} 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/common/beans/ErrorDTO.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/common/beans/ErrorDTO.java deleted file mode 100644 index 84fe7ea49..000000000 --- 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/common/beans/ErrorDTO.java +++ /dev/null @@ -1,86 +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.common.beans; - -import java.util.ArrayList; -import java.util.List; - -public class ErrorDTO { - - private Long code = null; - private String message = null; - private String description = null; - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void setCode(Long code) { - this.code = code; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setDescription(String description) { - this.description = description; - } - - public void setError(List error) { - this.error = error; - } - - private String moreInfo = null; - - public String getMessage() { - return message; - } - - public Long getCode() { - return code; - } - - public String getDescription() { - return description; - } - - public String getMoreInfo() { - return moreInfo; - } - - public List getError() { - return error; - } - - public String toString() { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("class ErrorDTO {\n"); - stringBuilder.append(" code: ").append(code).append("\n"); - stringBuilder.append(" message: ").append(message).append("\n"); - stringBuilder.append(" description: ").append(description).append("\n"); - stringBuilder.append(" moreInfo: ").append(moreInfo).append("\n"); - stringBuilder.append(" error: ").append(error).append("\n"); - stringBuilder.append("}\n"); - return stringBuilder.toString(); - } - - private List error = new ArrayList<>(); - -} 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/common/beans/ErrorListItem.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/common/beans/ErrorListItem.java deleted file mode 100644 index 45571ced4..000000000 --- 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/common/beans/ErrorListItem.java +++ /dev/null @@ -1,77 +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.common.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -import javax.validation.constraints.NotNull; - -@ApiModel(description = "") -public class ErrorListItem { - - @NotNull - private String code = null; - @NotNull - private String message = null; - - @ApiModelProperty(required = true, value = "") - @JsonProperty("code") - public String getCode() { - return code; - } - public void setCode(String code) { - this.code = code; - } - - public ErrorListItem() {} - - public ErrorListItem(String code, String msg) { - this.code = code; - this.message = msg; - } - - - /** - * Description about individual errors occurred - **/ - @ApiModelProperty(required = true, value = "Description about individual errors occurred") - @JsonProperty("message") - public String getMessage() { - return message; - } - public void setMessage(String message) { - this.message = message; - } - - - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("errorItem {\n"); - - sb.append(" code: ").append(code).append("\n"); - sb.append(" message: ").append(message).append("\n"); - sb.append("}\n"); - return sb.toString(); - } - -} 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/common/beans/ErrorResponse.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/common/beans/ErrorResponse.java deleted file mode 100644 index e983abd64..000000000 --- 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/common/beans/ErrorResponse.java +++ /dev/null @@ -1,167 +0,0 @@ -package org.wso2.carbon.device.mgt.mobile.windows.api.common.beans; - -import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModelProperty; - -import java.util.ArrayList; -import java.util.List; - -public class ErrorResponse { - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List errorItems = new ArrayList<>(); - - @JsonProperty(value = "code") - @ApiModelProperty(required = true, value = "") - public Long getCode() { - return code; - } - - public void setCode(Long code) { - this.code = code; - } - - @JsonProperty(value = "message") - @ApiModelProperty(required = true, value = "ErrorResponse message.") - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - @JsonProperty(value = "description") - @ApiModelProperty(value = "A detail description about the error message.") - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - @JsonProperty(value = "moreInfo") - @ApiModelProperty(value = "Preferably an url with more details about the error.") - public String getMoreInfo() { - return moreInfo; - } - - public void setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - } - - public void addErrorListItem(ErrorListItem item) { - this.errorItems.add(item); - } - - /** - * If there are more than one error list them out. \nFor example, list out validation errors by each field. - */ - @JsonProperty(value = "errorItems") - @ApiModelProperty(value = "If there are more than one error list them out. \n" + - "For example, list out validation errors by each field.") - public List getErrorItems() { - return errorItems; - } - - public void setErrorItems(List error) { - this.errorItems = error; - } - - @Override - public String toString() { -// StringBuilder sb = new StringBuilder(); -// sb.append("{"); -// boolean cont = false; -// if (code != null) { -// cont = true; -// sb.append(" \"code\": ").append(code); -// } -// if (message != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"message\": \"").append(message).append("\""); -// } -// if (description != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"description\": ").append(description).append("\""); -// } -// if (moreInfo != null) { -// if (cont) { -// sb.append(","); -// } -// cont = true; -// sb.append(" \"moreInfo\": \"").append(moreInfo).append("\""); -// } -// if (error != null && error.size() > 0) { -// if (cont) { -// sb.append(","); -// } -// sb.append(" \"errorItems\": ").append(error); -// } -// sb.append("}"); -// return sb.toString(); - return null; - } - - public static class ErrorResponseBuilder { - - private Long code = null; - private String message = null; - private String description = null; - private String moreInfo = null; - private List error; - - - public ErrorResponseBuilder() { - this.error = new ArrayList<>(); - } - - public ErrorResponseBuilder setCode(long code) { - this.code = code; - return this; - } - - public ErrorResponseBuilder setMessage(String message) { - this.message = message; - return this; - } - - public ErrorResponseBuilder setDescription(String description) { - this.description = description; - return this; - } - - public ErrorResponseBuilder setMoreInfo(String moreInfo) { - this.moreInfo = moreInfo; - return this; - } - - public ErrorResponseBuilder addErrorItem(String code, String msg) { - ErrorListItem item = new ErrorListItem(); - item.setCode(code); - item.setMessage(msg); - this.error.add(item); - return this; - } - - public ErrorResponse build() { - ErrorResponse errorResponse = new ErrorResponse(); - errorResponse.setCode(code); - errorResponse.setMessage(message); - errorResponse.setErrorItems(error); - errorResponse.setDescription(description); - errorResponse.setMoreInfo(moreInfo); - return errorResponse; - } - } - -} 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/common/beans/OperationRequest.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/common/beans/OperationRequest.java deleted file mode 100644 index 431ccaf49..000000000 --- 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/common/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.device.mgt.mobile.windows.api.common.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.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/device/mgt/mobile/windows/api/common/beans/Token.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/common/beans/Token.java deleted file mode 100644 index 619f82378..000000000 --- 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/common/beans/Token.java +++ /dev/null @@ -1,35 +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.common.beans; - -/** - * Class for challenge token - */ -public class Token { - private String challengeToken; - - public String getChallengeToken() { - return challengeToken; - } - - public void setChallengeToken(String challengeToken) { - this.challengeToken = challengeToken; - } -} - 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/common/exceptions/AuthenticationException.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/common/exceptions/AuthenticationException.java deleted file mode 100644 index 52a0f1ca6..000000000 --- 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/common/exceptions/AuthenticationException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for authentication failures in windows device enrollment. - */ -public class AuthenticationException extends Exception { - - private String errorMessage; - - public AuthenticationException(String message) { - super(message); - setErrorMessage(message); - } - - public AuthenticationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public AuthenticationException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public AuthenticationException(Throwable cause) { - super(cause); - } - - public AuthenticationException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/BadRequestException.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/common/exceptions/BadRequestException.java deleted file mode 100644 index c0f933892..000000000 --- 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/common/exceptions/BadRequestException.java +++ /dev/null @@ -1,34 +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.common.exceptions; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -/** - * Exception class for bad request failures - */ -public class BadRequestException extends WebApplicationException { - - public BadRequestException(ErrorResponse error) { - super(Response.status(Response.Status.BAD_REQUEST).entity(error).build()); - } -} \ 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/device/mgt/mobile/windows/api/common/exceptions/CertificateGenerationException.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/common/exceptions/CertificateGenerationException.java deleted file mode 100644 index ea1916521..000000000 --- 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/common/exceptions/CertificateGenerationException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for Certificate generation failures in WSTEP stage. - */ -public class CertificateGenerationException extends Exception { - - private String errorMessage; - - public CertificateGenerationException(String message) { - super(message); - setErrorMessage(message); - } - - public CertificateGenerationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public CertificateGenerationException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public CertificateGenerationException(Throwable cause) { - super(cause); - } - - public CertificateGenerationException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/FileOperationException.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/common/exceptions/FileOperationException.java deleted file mode 100644 index 1cfe6d5c7..000000000 --- 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/common/exceptions/FileOperationException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for file reading/writing failures. - */ -public class FileOperationException extends Exception { - - private String errorMessage; - - public FileOperationException(String message) { - super(message); - setErrorMessage(message); - } - - public FileOperationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public FileOperationException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public FileOperationException(Throwable cause) { - super(cause); - } - - public FileOperationException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/KeyStoreGenerationException.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/common/exceptions/KeyStoreGenerationException.java deleted file mode 100644 index 8d8727128..000000000 --- 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/common/exceptions/KeyStoreGenerationException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for Keystore generation failures. - */ -public class KeyStoreGenerationException extends Exception { - - private String errorMessage; - - public KeyStoreGenerationException(String message) { - super(message); - setErrorMessage(message); - } - - public KeyStoreGenerationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public KeyStoreGenerationException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public KeyStoreGenerationException(Throwable cause) { - super(cause); - } - - public KeyStoreGenerationException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/MDMAPIException.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/common/exceptions/MDMAPIException.java deleted file mode 100644 index a09915772..000000000 --- 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/common/exceptions/MDMAPIException.java +++ /dev/null @@ -1,60 +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.common.exceptions; - -/** - * MDMAPIUtils class provides utility function which are used by CDM REST-API classes. - */ -public class MDMAPIException extends Exception { - - private static final long serialVersionUID = 7950151650447893900L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public MDMAPIException(String msg, Exception e) { - super(msg, e); - setErrorMessage(msg); - } - - public MDMAPIException(String msg, Throwable cause) { - super(msg, cause); - setErrorMessage(msg); - } - - public MDMAPIException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public MDMAPIException() { - super(); - } - - public MDMAPIException(Throwable cause) { - super(cause); - } - -} 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/common/exceptions/OAuthTokenValidationException.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/common/exceptions/OAuthTokenValidationException.java deleted file mode 100644 index 13044275a..000000000 --- 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/common/exceptions/OAuthTokenValidationException.java +++ /dev/null @@ -1,59 +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.common.exceptions; - -/** - * Custom exception to be thrown inside OAuthTokenValidation related functionality. - */ -public class OAuthTokenValidationException extends Exception { - private static final long serialVersionUID = -3151279311929070297L; - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public OAuthTokenValidationException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public OAuthTokenValidationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public OAuthTokenValidationException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public OAuthTokenValidationException() { - super(); - } - - public OAuthTokenValidationException(Throwable cause) { - super(cause); - } -} 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/common/exceptions/ProfileConfigurationException.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/common/exceptions/ProfileConfigurationException.java deleted file mode 100644 index 62dcc0ae0..000000000 --- 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/common/exceptions/ProfileConfigurationException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions; - -public class ProfileConfigurationException extends Exception { - - private static final long serialVersionUID = 8025559931927889261L; - - public ProfileConfigurationException(String errorMsg) { - super(errorMsg); - } - - public ProfileConfigurationException(String errorMsg, Throwable throwable) { - super(errorMsg, throwable); - } -} 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/common/exceptions/SyncmlMessageFormatException.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/common/exceptions/SyncmlMessageFormatException.java deleted file mode 100644 index 356fbdc1c..000000000 --- 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/common/exceptions/SyncmlMessageFormatException.java +++ /dev/null @@ -1,57 +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.common.exceptions; - -/** - * Exception class for bad format syncml message exceptions. - */ -public class SyncmlMessageFormatException extends Exception { - private String errorMessage; - - public SyncmlMessageFormatException(String message) { - super(message); - setErrorMessage(message); - } - - public SyncmlMessageFormatException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public SyncmlMessageFormatException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public SyncmlMessageFormatException(Throwable cause) { - super(cause); - } - - public SyncmlMessageFormatException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/SyncmlOperationException.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/common/exceptions/SyncmlOperationException.java deleted file mode 100644 index 433ef7af0..000000000 --- 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/common/exceptions/SyncmlOperationException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for syncml Operation and policy related errors. - */ -public class SyncmlOperationException extends Exception { - - private String errorMessage; - - public SyncmlOperationException(String message) { - super(message); - setErrorMessage(message); - } - - public SyncmlOperationException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public SyncmlOperationException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public SyncmlOperationException(Throwable cause) { - super(cause); - } - - public SyncmlOperationException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/UnexpectedServerErrorException.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/common/exceptions/UnexpectedServerErrorException.java deleted file mode 100644 index 6643f01d0..000000000 --- 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/common/exceptions/UnexpectedServerErrorException.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.device.mgt.mobile.windows.api.common.exceptions; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorDTO; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.Response; - -public class UnexpectedServerErrorException extends WebApplicationException { - private String message; - private static final long serialVersionUID = 147943579458906890L; - - public UnexpectedServerErrorException(ErrorResponse error) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(error).build()); - } - public UnexpectedServerErrorException(ErrorDTO errorDTO) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR) - .entity(errorDTO) - .header(PluginConstants.WindowsConstant.HEADER_CONTENT_TYPE, PluginConstants.WindowsConstant.APPLICATION_JSON) - .build()); - message = errorDTO.getDescription(); - } - - @Override - public String getMessage() { - return message; - } - - -} 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/common/exceptions/WAPProvisioningException.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/common/exceptions/WAPProvisioningException.java deleted file mode 100644 index 855b7735d..000000000 --- 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/common/exceptions/WAPProvisioningException.java +++ /dev/null @@ -1,58 +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.common.exceptions; - -/** - * Exception class for property/provisioning XML file reading failures. - */ -public class WAPProvisioningException extends Exception { - - private String errorMessage; - - public WAPProvisioningException(String message) { - super(message); - setErrorMessage(message); - } - - public WAPProvisioningException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public WAPProvisioningException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public WAPProvisioningException(Throwable cause) { - super(cause); - } - - public WAPProvisioningException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } -} 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/common/exceptions/WindowsConfigurationException.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/common/exceptions/WindowsConfigurationException.java deleted file mode 100644 index e41e1af8a..000000000 --- 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/common/exceptions/WindowsConfigurationException.java +++ /dev/null @@ -1,61 +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.common.exceptions; - -/** - * Custom class for windows device configurations. - */ -public class WindowsConfigurationException extends Exception { - - private String errorMessage; - - private static final long serialVersionUID = 7950151650447893900L; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public WindowsConfigurationException(Throwable cause) { - super(cause); - } - - public WindowsConfigurationException() { - super(); - } - - public WindowsConfigurationException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public WindowsConfigurationException(String msg, Throwable cause) { - super(msg, cause); - setErrorMessage(msg); - } - - public WindowsConfigurationException(String msg, Exception exception) { - super(msg, exception); - setErrorMessage(msg); - } - -} 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/common/exceptions/WindowsDeviceEnrolmentException.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/common/exceptions/WindowsDeviceEnrolmentException.java deleted file mode 100644 index af2447378..000000000 --- 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/common/exceptions/WindowsDeviceEnrolmentException.java +++ /dev/null @@ -1,59 +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.common.exceptions; - -/** - * Exception class for general WSTEP messaging/message generation failures. - */ -public class WindowsDeviceEnrolmentException extends Exception { - - private String errorMessage; - - public WindowsDeviceEnrolmentException(String message) { - super(message); - setErrorMessage(message); - } - - public WindowsDeviceEnrolmentException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public WindowsDeviceEnrolmentException(String message, Exception nestedEx) { - super(message, nestedEx); - setErrorMessage(message); - } - - public WindowsDeviceEnrolmentException(Throwable cause) { - super(cause); - } - - public WindowsDeviceEnrolmentException() { - super(); - } - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - -} 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/common/exceptions/WindowsEnrollmentTokenException.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/common/exceptions/WindowsEnrollmentTokenException.java deleted file mode 100644 index 96fdda817..000000000 --- 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/common/exceptions/WindowsEnrollmentTokenException.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions; - - -public class WindowsEnrollmentTokenException extends Exception { - private static final long serialVersionUID = -2297311387874900305L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public WindowsEnrollmentTokenException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public WindowsEnrollmentTokenException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public WindowsEnrollmentTokenException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public WindowsEnrollmentTokenException() { - super(); - } - - public WindowsEnrollmentTokenException(Throwable cause) { - super(cause); - } -} 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/common/exceptions/WindowsOperationsException.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/common/exceptions/WindowsOperationsException.java deleted file mode 100644 index 2cb855406..000000000 --- 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/common/exceptions/WindowsOperationsException.java +++ /dev/null @@ -1,37 +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.common.exceptions; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; - -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Exception Class for windows operations related exceptions - */ -public class WindowsOperationsException extends WebApplicationException { - - public WindowsOperationsException(Message message, MediaType mediaType) { - super(Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(message). - type(mediaType).build()); - } - -} \ 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/device/mgt/mobile/windows/api/common/util/AuthenticationInfo.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/common/util/AuthenticationInfo.java deleted file mode 100644 index d7b3f3e98..000000000 --- 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/common/util/AuthenticationInfo.java +++ /dev/null @@ -1,62 +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.common.util; - -/** - * DTO class to hold the information of authenticated user. - */ -public class AuthenticationInfo { - private String message; - private String username; - private String tenantDomain; - private int tenantId = -1; - - public String getUsername() { - return username; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getTenantDomain() { - return tenantDomain; - } - - public void setTenantDomain(String tenantDomain) { - this.tenantDomain = tenantDomain; - } - - public int getTenantId() { - return tenantId; - } - - public void setTenantId(int tenantId) { - this.tenantId = tenantId; - } - -} 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/common/util/BSTValidator.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/common/util/BSTValidator.java deleted file mode 100644 index 3597abcf9..000000000 --- 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/common/util/BSTValidator.java +++ /dev/null @@ -1,143 +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.common.util; - -import org.apache.commons.codec.binary.Base64; -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.handler.RequestData; -import org.apache.ws.security.message.token.BinarySecurity; -import org.apache.ws.security.validate.Credential; -import org.apache.ws.security.validate.Validator; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.authenticator.OAuthValidatorFactory; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.AuthenticationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.OAuthTokenValidationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; - -import java.util.HashMap; - -/** - * Validator class for user authentication checking the default carbon user store. - */ -public class BSTValidator implements Validator { - - /** - * This method validates the binary security token in SOAP message coming from the device. - * - * @param credential - binary security token credential object. - * @param requestData - Request data associated with the request. - * @return - Credential object if authentication is success, or null if not success. - * @throws WSSecurityException - */ - @Override - public Credential validate(Credential credential, RequestData requestData) throws WSSecurityException { - String bearerToken; - String requestedUri; - Credential userCredentials; - - HashMap msgContext = (HashMap) requestData.getMsgContext(); - requestedUri = msgContext.get(PluginConstants.CXF_REQUEST_URI).toString(); - BinarySecurity binarySecurityTokenObject = credential.getBinarySecurityToken(); - String binarySecurityToken = binarySecurityTokenObject.getElement().getFirstChild().getTextContent(); - Base64 base64 = new Base64(); - bearerToken = new String(base64.decode(binarySecurityToken)); - AuthenticationInfo authenticationInfo; - try { - authenticationInfo = validateRequest(requestedUri, bearerToken); - WindowsAPIUtils.startTenantFlow(authenticationInfo); - - if (authenticate(binarySecurityToken, authenticationInfo)) { - userCredentials = credential; - } else { - throw new WindowsDeviceEnrolmentException( - "Authentication failure due to invalid binary security token."); - } - } catch (AuthenticationException e) { - throw new WSSecurityException("Failure occurred in the BST validator.", e); - } catch (WindowsDeviceEnrolmentException e) { - throw new WSSecurityException("Authentication failure occurred due to binary security token.", e); - } catch (OAuthTokenValidationException e) { - throw new WSSecurityException( - "Failed to authenticate the incoming request due to oauth token validation error.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return userCredentials; - } - - /** - * This method authenticates the client who comes with binary security token. - * - * @param binarySecurityToken - Binary security token received in the SOAP message header. - * @return - Authentication status. - * @throws AuthenticationException - */ - private boolean authenticate(String binarySecurityToken, AuthenticationInfo authenticationInfo) throws - AuthenticationException { - WindowsAPIUtils.startTenantFlow(authenticationInfo); - MobileCacheEntry cacheEntry; - try { - cacheEntry = DeviceUtil.getTokenEntry(binarySecurityToken); - if (cacheEntry != null) { - String username = cacheEntry.getUsername(); - return username != null; - } else { - return false; - } - } catch (WindowsDeviceEnrolmentException e) { - throw new AuthenticationException("Authentication failure when fetching token entry", e); - } - } - - /** - * Validate SOAP request token. - * - * @param requestedUri -Requested endpoint URI. - * @param binarySecurityToken -Binary security token comes from the soap request message. - * @return returns authorized user information. - * @throws WindowsDeviceEnrolmentException - */ - private AuthenticationInfo validateRequest(String requestedUri, String binarySecurityToken) - throws WindowsDeviceEnrolmentException, OAuthTokenValidationException { - - AuthenticationInfo authenticationInfo = new AuthenticationInfo(); - String resource = requestedUri + ":POST"; - OAuthValidationResponse oAuthValidationResponse = OAuthValidatorFactory.getValidator(). - validateToken(binarySecurityToken, resource); - try { - if (oAuthValidationResponse.isValid()) { - String username = oAuthValidationResponse.getUserName(); - String tenantDomain = oAuthValidationResponse.getTenantDomain(); - - authenticationInfo.setUsername(username); - authenticationInfo.setTenantDomain(tenantDomain); - authenticationInfo.setTenantId(WindowsAPIUtils.getTenantIdOFUser(username + "@" + tenantDomain)); - } else { - authenticationInfo.setMessage(oAuthValidationResponse.getErrorMsg()); - } - } catch (DeviceManagementException e) { - throw new WindowsDeviceEnrolmentException( - "Authentication failure due to invalid binary security token.", e); - } - return authenticationInfo; - } -} 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/common/util/ContextInitializer.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/common/util/ContextInitializer.java deleted file mode 100644 index 694533882..000000000 --- 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/common/util/ContextInitializer.java +++ /dev/null @@ -1,51 +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.common.util; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.servlet.ServletContext; -import javax.servlet.ServletContextEvent; -import javax.servlet.ServletContextListener; -import java.io.File; - -/** - * This class performs one time operations. - */ -public class ContextInitializer implements ServletContextListener { - - /** - * This method loads wap-provisioning file and sets wap-provisioning file as attribute in servlet context. - * - * @param servletContextEvent - Uses when servlet communicating with servlet container. - */ - @Override - public void contextInitialized(ServletContextEvent servletContextEvent) { - ServletContext servletContext = servletContextEvent.getServletContext(); - - File wapProvisioningFile = new File(getClass().getClassLoader().getResource( - PluginConstants.CertificateEnrolment.WAP_PROVISIONING_XML).getFile()); - servletContext.setAttribute(PluginConstants.CONTEXT_WAP_PROVISIONING_FILE, wapProvisioningFile); - } - - @Override - public void contextDestroyed(ServletContextEvent servletContextEvent) { - } - -} 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/common/util/DeviceIDHolder.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/common/util/DeviceIDHolder.java deleted file mode 100644 index 64136db79..000000000 --- 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/common/util/DeviceIDHolder.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.device.mgt.mobile.windows.api.common.util; - -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; - -import java.util.List; - -/** - * Class for holding valid and invalid devices. - */ -public class DeviceIDHolder { - - private List invalidDeviceIdList; - private List validDeviceIDList; - - public List getInvalidDeviceIdList() { - return invalidDeviceIdList; - } - - public void setInvalidDeviceIdList(List invalidDeviceIdList) { - this.invalidDeviceIdList = invalidDeviceIdList; - } - - public List getValidDeviceIDList() { - return validDeviceIDList; - } - - public void setValidDeviceIDList(List validDeviceIDList) { - this.validDeviceIDList = validDeviceIDList; - } -} 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/common/util/DeviceUtil.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/common/util/DeviceUtil.java deleted file mode 100644 index ac659f2ee..000000000 --- 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/common/util/DeviceUtil.java +++ /dev/null @@ -1,117 +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.common.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.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsTokenService; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dao.MobileDeviceManagementDAOException; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; - -import java.util.UUID; - -/** - * Class for generate random token for XCEP and WSTEP. - */ -public class DeviceUtil { - - private static WindowsTokenService tokenService; - - private static final Log log = LogFactory.getLog(DeviceUtil.class); - - static { - tokenService = WindowsAPIUtils.getEnrollmentTokenService(); - } - - public static String generateRandomToken() { - return String.valueOf(UUID.randomUUID()); - } - - public static void persistChallengeToken(String token, String deviceID, String username) - throws WindowsDeviceEnrolmentException { - try { - if(tokenService == null) { - tokenService = WindowsAPIUtils.getEnrollmentTokenService(); - } - MobileCacheEntry existingCacheEntry = tokenService.getCacheToken(token); - PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - if (existingCacheEntry == null) { - MobileCacheEntry newCacheEntry = new MobileCacheEntry(); - newCacheEntry.setDeviceID(deviceID); - newCacheEntry.setUsername(username); - newCacheEntry.setCacheToken(token); - newCacheEntry.setTenantDomain(carbonCtx.getTenantDomain()); - newCacheEntry.setTenanatID(carbonCtx.getTenantId()); - tokenService.saveCacheToken(newCacheEntry); - } else { - existingCacheEntry.setDeviceID(deviceID); - existingCacheEntry.setCacheToken(token); - tokenService.updateCacheToken(existingCacheEntry); - } - } catch (MobileDeviceManagementDAOException e) { - String msg = "Error occurred when saving cache token for device: " + deviceID; - throw new WindowsDeviceEnrolmentException(msg, e); - } - } - - public static MobileCacheEntry getTokenEntry(String token) - throws WindowsDeviceEnrolmentException { - MobileCacheEntry tokenEntry; - try { - if (tokenService == null) { - tokenService = WindowsAPIUtils.getEnrollmentTokenService(); - } - tokenEntry = tokenService.getCacheToken(token); - } catch (MobileDeviceManagementDAOException e) { - String msg = "Error occurred when retrieving enrollment token."; - throw new WindowsDeviceEnrolmentException(msg, e); - } - return tokenEntry; - } - - public static MobileCacheEntry getTokenEntryFromDeviceId(String deviceId) - throws WindowsDeviceEnrolmentException { - MobileCacheEntry tokenEntry; - try { - if (tokenService == null) { - tokenService = WindowsAPIUtils.getEnrollmentTokenService(); - } - tokenEntry = tokenService.getCacheTokenFromDeviceId(deviceId); - - } catch (MobileDeviceManagementDAOException e) { - String msg = "Error occurred when retrieving enrollment token."; - throw new WindowsDeviceEnrolmentException(msg, e); - } - return tokenEntry; - } - - public static void removeTokenEntry(String token) { - try { - if (tokenService == null) { - tokenService = WindowsAPIUtils.getEnrollmentTokenService(); - } - tokenService.removeCacheToken(token); - } catch (MobileDeviceManagementDAOException e) { - String msg = "Error occurred when removing enrollment token."; - log.error(msg); - } - } -} 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/common/util/ErrorHandler.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/common/util/ErrorHandler.java deleted file mode 100644 index 3c3ee547f..000000000 --- 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/common/util/ErrorHandler.java +++ /dev/null @@ -1,38 +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.common.util; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; - -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; - -/** - * Class for handle response exceptions. - */ -@Produces({"application/json", "application/xml"}) -public class ErrorHandler implements ExceptionMapper { - - public Response toResponse(WindowsConfigurationException exception) { - ErrorMessage errorMessage = new ErrorMessage(); - errorMessage.setErrorMessage(exception.getErrorMessage()); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); - } -} 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/common/util/ErrorMessage.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/common/util/ErrorMessage.java deleted file mode 100644 index 8895fe2d3..000000000 --- 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/common/util/ErrorMessage.java +++ /dev/null @@ -1,37 +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. - */ - -/** - * Generate Error Messages for responses. - */ -package org.wso2.carbon.device.mgt.mobile.windows.api.common.util; - -public class ErrorMessage { - - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - -} 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/common/util/GsonMessageBodyHandler.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/common/util/GsonMessageBodyHandler.java deleted file mode 100644 index 683d747cd..000000000 --- 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/common/util/GsonMessageBodyHandler.java +++ /dev/null @@ -1,90 +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.common.util; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; - -import javax.ws.rs.Consumes; -import javax.ws.rs.Produces; -import javax.ws.rs.WebApplicationException; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.ext.MessageBodyReader; -import javax.ws.rs.ext.MessageBodyWriter; -import javax.ws.rs.ext.Provider; -import java.io.*; -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; - -import static javax.ws.rs.core.MediaType.APPLICATION_JSON; - -/** - * Class for parse Gson Messages. - */ -@Provider -@Produces(APPLICATION_JSON) -@Consumes(APPLICATION_JSON) -public class GsonMessageBodyHandler implements MessageBodyWriter, MessageBodyReader { - private Gson gson; - private static final String UTF_8 = "UTF-8"; - - public boolean isReadable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - private Gson getGson() { - if (gson == null) { - final GsonBuilder gsonBuilder = new GsonBuilder(); - gson = gsonBuilder.create(); - } - return gson; - } - - public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) - throws IOException, WebApplicationException { - InputStreamReader reader = new InputStreamReader(entityStream, UTF_8); - try { - return getGson().fromJson(reader, type); - } finally { - reader.close(); - } - } - - public boolean isWriteable(Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return true; - } - - public long getSize(Object o, Class aClass, Type type, Annotation[] annotations, MediaType mediaType) { - return -1; - } - - public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, - MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) - throws IOException, WebApplicationException { - - OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8); - try { - getGson().toJson(object, type, writer); - } finally { - writer.close(); - } - } -} 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/common/util/Message.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/common/util/Message.java deleted file mode 100644 index a9e8d131e..000000000 --- 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/common/util/Message.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.device.mgt.mobile.windows.api.common.util; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Class for generate response Messages. - */ -@XmlRootElement -public class Message { - private String responseCode; - private String responseMessage; - - @XmlElement - public String getResponseMessage() { - return responseMessage; - } - - public void setResponseMessage(String responseMessage) { - this.responseMessage = responseMessage; - } - - @XmlElement - public String getResponseCode() { - return responseCode; - } - - public void setResponseCode(String responseCode) { - this.responseCode = responseCode; - } -} \ 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/device/mgt/mobile/windows/api/common/util/OAuthValidationResponse.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/common/util/OAuthValidationResponse.java deleted file mode 100644 index eb962e7e1..000000000 --- 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/common/util/OAuthValidationResponse.java +++ /dev/null @@ -1,71 +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.common.util; - -/** - * Class for OAuthValidation Response. - */ -public class OAuthValidationResponse { - - private String userName; - private String tenantDomain; - private boolean isValid; - private String errorMsg; - - public OAuthValidationResponse() { - } - - public OAuthValidationResponse(String userName, String tenantDomain, boolean isValid) { - this.userName = userName; - this.tenantDomain = tenantDomain; - this.isValid = isValid; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - public String getTenantDomain() { - return tenantDomain; - } - - public void setTenantDomain(String tenantDomain) { - this.tenantDomain = tenantDomain; - } - - public boolean isValid() { - return isValid; - } - - public void setIsValid(boolean isValid) { - this.isValid = isValid; - } - - public String getErrorMsg() { - return errorMsg; - } - - public void setErrorMsg(String errorMsg) { - this.errorMsg = errorMsg; - } -} 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/common/util/SOAPSecurityHandler.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/common/util/SOAPSecurityHandler.java deleted file mode 100644 index d3fc5722a..000000000 --- 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/common/util/SOAPSecurityHandler.java +++ /dev/null @@ -1,62 +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.common.util; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.namespace.QName; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPHandler; -import javax.xml.ws.handler.soap.SOAPMessageContext; -import java.util.HashSet; -import java.util.Set; - -/** - * Class for handle SOAP message security. - */ -public class SOAPSecurityHandler implements SOAPHandler { - - /** - * This method resolves the security header coming in the SOAP message. - * - * @return - Security Header - */ - @Override - public Set getHeaders() { - QName securityHeader = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, PluginConstants.SECURITY); - HashSet headers = new HashSet(); - headers.add(securityHeader); - return headers; - } - - @Override - public boolean handleMessage(SOAPMessageContext context) { - return true; - } - - @Override - public boolean handleFault(SOAPMessageContext context) { - return true; - } - - @Override - public void close(MessageContext context) { - - } -} 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/common/util/UsernameTokenValidator.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/common/util/UsernameTokenValidator.java deleted file mode 100644 index 9a243c852..000000000 --- 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/common/util/UsernameTokenValidator.java +++ /dev/null @@ -1,114 +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.common.util; - -import org.apache.ws.security.WSSecurityException; -import org.apache.ws.security.handler.RequestData; -import org.apache.ws.security.validate.Credential; -import org.apache.ws.security.validate.Validator; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.AuthenticationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -/** - * Validator class for user authentication checking the default carbon user store. - */ -public class UsernameTokenValidator implements Validator { - - private static final int USER_SEGMENT = 0; - private static final int DOMAIN_SEGMENT = 1; - private static final String DELIMITER = "@"; - - /** - * This method validates the username token in SOAP message coming from the device. - * - * @param credential - Username token credentials coming from device - * @param requestData - Request data associated with the request - * @return - Credential object if authentication is success, or null if not success - * @throws WSSecurityException - */ - @Override - public Credential validate(Credential credential, RequestData requestData) throws - WSSecurityException { - - String domainUser = credential.getUsernametoken().getName(); - String[] domainUserArray = domainUser.split(DELIMITER); - Credential returnCredentials; - String user = domainUserArray[USER_SEGMENT]; - String domain = domainUserArray[DOMAIN_SEGMENT]; - String password = credential.getUsernametoken().getPassword(); - - try { - if (authenticate(user, password, domain)) { - returnCredentials = credential; - } else { - throw new WindowsDeviceEnrolmentException("Authentication failure due to incorrect credentials."); - } - } catch (AuthenticationException e) { - throw new WSSecurityException("Failure occurred in the BST validator.", e); - } catch (WindowsDeviceEnrolmentException e) { - throw new WSSecurityException("Authentication Failure occurred due to binary security token.", e); - } - return returnCredentials; - } - - /** - * This method authenticate the user checking the carbon default user store. - * - * @param username - Username in username token - * @param password - Password in username token - * @param tenantDomain - Tenant domain is extracted from the username - * @return - Returns boolean representing authentication result - * @throws AuthenticationException - */ - public boolean authenticate(String username, String password, String tenantDomain) throws - AuthenticationException { - - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID); - RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); - - if (realmService == null) { - throw new AuthenticationException("RealmService not initialized."); - } - int tenantId; - if (tenantDomain == null || tenantDomain.trim().isEmpty()) { - tenantId = MultitenantConstants.SUPER_TENANT_ID; - } else { - tenantId = realmService.getTenantManager().getTenantId(tenantDomain); - } - if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { - throw new AuthenticationException("Invalid tenant domain " + tenantDomain); - } - UserRealm userRealm = realmService.getTenantUserRealm(tenantId); - return userRealm.getUserStoreManager().authenticate(username, password); - } catch (UserStoreException e) { - throw new AuthenticationException("User store is not initialized.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } -} 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/common/util/WindowsAPIUtils.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/common/util/WindowsAPIUtils.java deleted file mode 100644 index 19f3814e6..000000000 --- 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/common/util/WindowsAPIUtils.java +++ /dev/null @@ -1,268 +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.common.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.base.MultitenantConstants; -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.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; -import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; -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.device.details.mgt.DeviceDetailsMgtException; -import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceInformationManager; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.windows.impl.WindowsTokenService; -import org.wso2.carbon.identity.core.util.IdentityTenantUtil; -import org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; -import org.wso2.carbon.user.api.TenantManager; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfig; -import org.wso2.carbon.webapp.authenticator.framework.config.AuthenticatorConfigService; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -/** - * Class for get Windows API utilities. - */ -public class WindowsAPIUtils { - - private static Log log = LogFactory.getLog(WindowsAPIUtils.class); - - public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) { - DeviceIdentifier identifier = new DeviceIdentifier(); - identifier.setId(deviceId); - identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - return identifier; - } - - public static DeviceManagementProviderService getDeviceManagementService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - DeviceManagementProviderService deviceManagementProviderService = - (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null); - if (deviceManagementProviderService == null) { - throw new IllegalStateException("Device Management service has not initialized."); - } - return deviceManagementProviderService; - } - - public static NotificationManagementService getNotificationManagementService() { - NotificationManagementService notificationManagementService; - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - notificationManagementService = - (NotificationManagementService) ctx.getOSGiService(NotificationManagementService.class, null); - if (notificationManagementService == null) { - throw new IllegalStateException("Notification Management service not initialized."); - } - return notificationManagementService; - } - - public static WindowsTokenService getEnrollmentTokenService() { - WindowsTokenService tokenService; - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - tokenService = (WindowsTokenService) - ctx.getOSGiService(WindowsTokenService.class, null); - - if(tokenService == null) { - throw new IllegalStateException("WindowsTokenService is not initialized"); - } - return tokenService; - } - - public static MediaType getResponseMediaType(String acceptHeader) { - MediaType responseMediaType; - if (MediaType.WILDCARD.equals(acceptHeader)) { - responseMediaType = MediaType.APPLICATION_JSON_TYPE; - } else { - responseMediaType = MediaType.valueOf(acceptHeader); - } - return responseMediaType; - } - - public static Response getOperationResponse(List deviceIDs, Operation operation) - throws DeviceManagementException, OperationManagementException, InvalidDeviceException { - if (deviceIDs == null || deviceIDs.size() == 0) { - String errorMessage = "Device identifier list is empty"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - DeviceIdentifier deviceIdentifier; - List deviceIdentifiers = new ArrayList<>(); - for (String deviceId : deviceIDs) { - deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(deviceId); - deviceIdentifier.setType(PluginConstants.WindowsConstant.DEVICE_TYPE_WINDOWS); - deviceIdentifiers.add(deviceIdentifier); - } - Activity activity = getDeviceManagementService().addOperation( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, operation, deviceIdentifiers); - return Response.status(Response.Status.CREATED).entity(activity).build(); - } - - public static PolicyManagerService getPolicyManagerService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - PolicyManagerService policyManagerService = - (PolicyManagerService) ctx.getOSGiService(PolicyManagerService.class, null); - if (policyManagerService == null) { - throw new IllegalStateException("Policy Manager service has not initialized"); - } - return policyManagerService; - } - - public static void updateOperation(String deviceId, Operation operation) - throws OperationManagementException { - DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); - deviceIdentifier.setId(deviceId); - deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - getDeviceManagementService().updateOperation(deviceIdentifier, operation); - } - - public static List getPendingOperations(DeviceIdentifier deviceIdentifier) - throws OperationManagementException, DeviceManagementException { - List pendingDataOperations; - pendingDataOperations = org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils. - getDeviceManagementService().getOperationsByDeviceAndStatus( - deviceIdentifier, Operation.Status.PENDING); - return pendingDataOperations; - } - - public static PlatformConfiguration getTenantConfiguration() throws DeviceManagementException { - return getDeviceManagementService().getConfiguration( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - } - - public static int getTenantIdOFUser(String username) throws DeviceManagementException { - int tenantId = 0; - RealmService realmService; - String domainName = MultitenantUtils.getTenantDomain(username); - if (domainName != null) { - try { - if ((realmService = IdentityTenantUtil.getRealmService()) != null) { - TenantManager tenantManager = realmService.getTenantManager(); - tenantId = tenantManager.getTenantId(domainName); - } - if (realmService == null) { - throw new IllegalStateException("Realm service has not initialized."); - } - } catch (UserStoreException e) { - throw new DeviceManagementException("Error when getting the tenant id from the tenant domain : " - + domainName, e); - } - } - return tenantId; - } - - public static OAuth2TokenValidationService getOAuth2TokenValidationService() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - OAuth2TokenValidationService oAuth2TokenValidationService = - (OAuth2TokenValidationService) ctx.getOSGiService(OAuth2TokenValidationService.class, null); - if (oAuth2TokenValidationService == null) { - throw new IllegalStateException("OAuth2TokenValidation service has not initialized."); - } - return oAuth2TokenValidationService; - } - - public static AuthenticatorConfig getBSTAuthenticatorConfig() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - AuthenticatorConfigService authenticatorConfigService = - (AuthenticatorConfigService) ctx.getOSGiService(AuthenticatorConfigService.class, null); - if (authenticatorConfigService == null) { - throw new IllegalStateException("AuthenticatorConfiguration service has not initialized."); - } - AuthenticatorConfig authenticatorConfig = authenticatorConfigService.getAuthenticatorConfig("BST"); - if (authenticatorConfig == null) { - throw new IllegalStateException("BST authenticatorConfig has not initialized."); - } - return authenticatorConfig; - } - - public static void startTenantFlow(AuthenticationInfo authenticationInfo) { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext privilegedCarbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - if (authenticationInfo.getTenantDomain() == null) { - privilegedCarbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID); - privilegedCarbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - } else { - privilegedCarbonContext.setTenantId(authenticationInfo.getTenantId()); - privilegedCarbonContext.setTenantDomain(authenticationInfo.getTenantDomain()); - } - privilegedCarbonContext.setUsername(authenticationInfo.getUsername()); - } - - /** - * This method is used to get tenant configurations. - * - * @return List of Configurations entries. - * @throws DeviceManagementException - */ - public static List getTenantConfigurationData() throws DeviceManagementException { - PlatformConfiguration tenantConfiguration; - if ((tenantConfiguration = org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils - .getTenantConfiguration()) != null) { - return tenantConfiguration.getConfiguration(); - } else { - return null; - } - } - - /** - * This method is used to update Device Information. - * @param deviceId DeviceID to need to update. - * @param deviceInfo Device Info to be update/ - * @throws DeviceDetailsMgtException Error occurs while updating Device Info. - */ - public static void updateDeviceInfo(DeviceIdentifier deviceId, DeviceInfo deviceInfo) - throws DeviceDetailsMgtException { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - DeviceInformationManager informationManager = - (DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null); - informationManager.addDeviceInfo(deviceId, deviceInfo); - } - - /** - * This method is used to update device location. - * @param deviceLocation Device coordination related information. - * @throws DeviceDetailsMgtException Error occurs while updating Device location. - */ - public static void updateDeviceLocation(DeviceLocation deviceLocation) throws DeviceDetailsMgtException { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - DeviceInformationManager informationManager = - (DeviceInformationManager) ctx.getOSGiService(DeviceInformationManager.class, null); - informationManager.addDeviceLocation(deviceLocation); - } -} 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/AddTag.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/AddTag.java deleted file mode 100644 index a35bf8afa..000000000 --- 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/AddTag.java +++ /dev/null @@ -1,68 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Configurations that needs to be added on the device. - */ -public class AddTag { - int commandId = -1; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildAddElement(Document doc, Element rootElement) { - if (getItems() != null) { - Element add = doc.createElement(Constants.ADD); - rootElement.appendChild(add); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - add.appendChild(commandId); - } - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext();) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, add); - } - } - } - } -} 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/AlertTag.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/AlertTag.java deleted file mode 100644 index 26b4140a5..000000000 --- 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/AlertTag.java +++ /dev/null @@ -1,100 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Inform an event occurred from device to server. - */ -public class AlertTag { - - int commandId = -1; - String data; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildAlertElement(Document doc, Element rootElement) { - Element alert = doc.createElement(Constants.ALERT); - rootElement.appendChild(alert); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - alert.appendChild(commandId); - } - if (getData() != null) { - Element data = doc.createElement(Constants.DATA); - data.appendChild(doc.createTextNode(getData())); - alert.appendChild(data); - } - if (getItems() != null) { - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext();) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, alert); - } - } - } - } -} 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/AtomicTag.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/AtomicTag.java deleted file mode 100644 index 6933a3638..000000000 --- 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/AtomicTag.java +++ /dev/null @@ -1,85 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Wrapper for other SyncML elements. - */ -public class AtomicTag { - int commandId = -1; - List adds; - List replaces; - - public List getReplaces() { - return replaces; - } - - public void setReplaces(List replaces) { - this.replaces = replaces; - } - - public List getAdds() { - return adds; - } - - public void setAdds(List adds) { - this.adds = adds; - } - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public void buildAtomicElement(Document doc, Element rootElement) { - Element atomic = doc.createElement(Constants.ATOMIC); - if (getAdds() != null) { - rootElement.appendChild(atomic); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - atomic.appendChild(commandId); - } - for (Iterator addIterator = getAdds().iterator(); addIterator.hasNext(); ) { - AddTag add = addIterator.next(); - if (add != null) { - add.buildAddElement(doc, atomic); - } - } - } - if (getReplaces() != null) { - for (Iterator replaceIterator = getReplaces().iterator(); replaceIterator.hasNext(); ) { - ReplaceTag add = replaceIterator.next(); - if (add != null) { - add.buildReplaceElement(doc, atomic); - } - } - } - } -} 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/ChallengeTag.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/ChallengeTag.java deleted file mode 100644 index c47649ce2..000000000 --- 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/ChallengeTag.java +++ /dev/null @@ -1,46 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Challenge data pass through the device and Device Management server for the security purpose. - */ -public class ChallengeTag { - MetaTag meta; - - public MetaTag getMeta() { - return meta; - } - - public void setMeta(MetaTag meta) { - this.meta = meta; - } - - public void buildChallengeElement(Document doc, Element rootElement) { - Element challenge = doc.createElement(Constants.CHALLENGE); - if (getMeta() != null) { - getMeta().buildMetaElement(doc, challenge); - } - rootElement.appendChild(challenge); - } -} 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/CredentialTag.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/CredentialTag.java deleted file mode 100644 index 9d8069f27..000000000 --- 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/CredentialTag.java +++ /dev/null @@ -1,60 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Credentials passed between the device and the server for security purposes. - */ -public class CredentialTag { - MetaTag meta; - String data; - - public MetaTag getMeta() { - return meta; - } - - public void setMeta(MetaTag meta) { - this.meta = meta; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public void buildCredentialElement(Document doc, Element rootElement) { - Element credentials = doc.createElement(Constants.CREDENTIAL); - rootElement.appendChild(credentials); - if (getMeta() != null) { - getMeta().buildMetaElement(doc, credentials); - } - if (getData() != null) { - Element data = doc.createElement(Constants.DATA); - data.appendChild(doc.createTextNode(getData())); - credentials.appendChild(data); - } - } -} 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/DeleteTag.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/DeleteTag.java deleted file mode 100644 index a0ce43236..000000000 --- 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/DeleteTag.java +++ /dev/null @@ -1,68 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Configurations that need to be delete on Device. - */ -public class DeleteTag { - int commandId = -1; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildDeleteElement(Document doc, Element rootElement) { - if (getItems() != null) { - Element delete = doc.createElement(Constants.DELETE); - rootElement.appendChild(delete); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - delete.appendChild(commandId); - } - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext(); ) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, delete); - } - } - } - } -} 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/ExecuteTag.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/ExecuteTag.java deleted file mode 100644 index 3312e8a91..000000000 --- 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/ExecuteTag.java +++ /dev/null @@ -1,69 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Commands that needs to be executed on the device. - */ -public class ExecuteTag { - int commandId = -1; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildExecElement(Document doc, Element rootElement) { - if (getItems() != null) { - Element exec = doc.createElement(Constants.EXECUTE); - rootElement.appendChild(exec); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - exec.appendChild(commandId); - } - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext(); ) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, exec); - } - } - } - } - -} 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/GetTag.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/GetTag.java deleted file mode 100644 index 00a8858a2..000000000 --- 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/GetTag.java +++ /dev/null @@ -1,71 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Data that needs to be retrieved from the device. - */ -public class GetTag { - int commandId = -1; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildGetElement(Document doc, Element rootElement) { - if (getItems() != null) { - Element get = doc.createElement(Constants.GET); - rootElement.appendChild(get); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - get.appendChild(commandId); - } - if (getItems() != null) { - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext(); ) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, get); - } - } - } - } - } - -} 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/ItemTag.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/ItemTag.java deleted file mode 100644 index 571d62c97..000000000 --- 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/ItemTag.java +++ /dev/null @@ -1,122 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Represents an items that should be retrieved from the device or a command. - */ -public class ItemTag { - - TargetTag target; - SourceTag source; - String data; - MetaTag meta; - Element elementData; - - public MetaTag getMeta() { - return meta; - } - - public void setMeta(MetaTag meta) { - this.meta = meta; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public SourceTag getSource() { - return source; - } - - public void setSource(SourceTag source) { - this.source = source; - } - - public TargetTag getTarget() { - return target; - } - - public void setTarget(TargetTag target) { - this.target = target; - } - - public Element getElementData() { - return elementData; - } - - public void setElementData(Element elementData) { - this.elementData = elementData; - } - - public void buildItemElement(Document doc, Element rootElement) { - Element item = doc.createElement(Constants.ITEM); - rootElement.appendChild(item); - - if (getTarget() != null || getSource() != null) { - - if (getTarget() != null) { - getTarget().buildTargetElement(doc, item); - } - if (getSource() != null) { - getSource().buildSourceElement(doc, item); - } - } - if (getMeta() != null) { - getMeta().buildMetaElement(doc, item); - } - if (getData() != null || getElementData()!= null) { - Element data = doc.createElement(Constants.DATA); - if (getData() != null) { - data.appendChild(doc.createTextNode(getData())); - } - if (getElementData() != null) { - Node node = doc.importNode(getElementData(), true); - data.appendChild(node); - } - item.appendChild(data); - } - } -} 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/MetaTag.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/MetaTag.java deleted file mode 100644 index 16f63c31f..000000000 --- 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/MetaTag.java +++ /dev/null @@ -1,88 +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; - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * MetaTag data related to credentials. - */ -public class MetaTag { - - String format; - String type; - String nextNonce; - - public String getNextNonce() { - return nextNonce; - } - - public void setNextNonce(String nextNonce) { - this.nextNonce = nextNonce; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public void buildMetaElement(Document doc, Element rootElement) { - Element meta = doc.createElement(Constants.META); - rootElement.appendChild(meta); - if (getFormat() != null) { - Element format = doc.createElement(Constants.FORMAT); - format.appendChild(doc.createTextNode(getFormat())); - Attr attr = doc.createAttribute(Constants.XMLNS); - attr.setValue(Constants.META_NAMESPACE); - format.setAttributeNode(attr); - meta.appendChild(format); - } - if (getType() != null) { - Element type = doc.createElement(Constants.TYPE); - type.appendChild(doc.createTextNode(getType())); - Attr attr = doc.createAttribute(Constants.XMLNS); - attr.setValue(Constants.META_NAMESPACE); - type.setAttributeNode(attr); - meta.appendChild(type); - } - if (getNextNonce() != null) { - Element nextNonce = doc.createElement(Constants.NEXTNONCE); - nextNonce.appendChild(doc.createTextNode(getNextNonce())); - Attr attr = doc.createAttribute(Constants.XMLNS); - attr.setValue(Constants.META_NAMESPACE); - nextNonce.setAttributeNode(attr); - meta.appendChild(nextNonce); - } - - } -} 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/ReplaceTag.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/ReplaceTag.java deleted file mode 100644 index 6f340b13e..000000000 --- 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/ReplaceTag.java +++ /dev/null @@ -1,70 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Commands sent from the device. - */ -public class ReplaceTag { - int commandId = -1; - List items; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public List getItems() { - return items; - } - - public void setItems(List items) { - this.items = items; - } - - public void buildReplaceElement(Document doc, Element rootElement) { - if (getItems() != null) { - Element replace = doc.createElement(Constants.REPLACE); - rootElement.appendChild(replace); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - replace.appendChild(commandId); - } - if (getItems() != null) { - for (Iterator itemIterator = getItems().iterator(); itemIterator.hasNext(); ) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, replace); - } - } - } - } - } -} 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/ResultsTag.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/ResultsTag.java deleted file mode 100644 index a166f8d22..000000000 --- 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/ResultsTag.java +++ /dev/null @@ -1,96 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Results sent for the requests made to the device. - */ -public class ResultsTag { - int commandId = -1; - int messageReference = -1; - int commandReference = -1; - List item; - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public int getMessageReference() { - return messageReference; - } - - public void setMessageReference(int messageReference) { - this.messageReference = messageReference; - } - - public int getCommandReference() { - return commandReference; - } - - public void setCommandReference(int commandReference) { - this.commandReference = commandReference; - } - - public List getItem() { - return item; - } - - public void setItem(List item) { - this.item = item; - } - - public void buildResultElement(Document doc, Element rootElement) { - Element results = doc.createElement(Constants.RESULTS); - rootElement.appendChild(results); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - results.appendChild(commandId); - } - if (getMessageReference() != -1) { - Element messageReference = doc.createElement(Constants.MESSAGE_REFERENCE); - messageReference.appendChild(doc.createTextNode(String.valueOf(getMessageReference()))); - results.appendChild(messageReference); - } - if (getCommandReference() != -1) { - Element messageReference = doc.createElement(Constants.COMMAND_REFERENCE); - messageReference.appendChild(doc.createTextNode(String.valueOf(getCommandReference()))); - results.appendChild(messageReference); - } - if (getItem() != null) { - for (Iterator itemIterator = getItem().iterator(); itemIterator.hasNext(); ) { - ItemTag item = itemIterator.next(); - if (item != null) { - item.buildItemElement(doc, results); - } - } - } - } -} 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/SequenceTag.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/SequenceTag.java deleted file mode 100644 index 74e74b2eb..000000000 --- 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/SequenceTag.java +++ /dev/null @@ -1,118 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Class used to build syncml SequenceTag. - */ -public class SequenceTag { - - int commandId; - ExecuteTag exec; - GetTag get; - DeleteTag deleteTag; - AtomicTag atomicTag; - List replaces; - - public DeleteTag getDeleteTag() { - return deleteTag; - } - - public void setDeleteTag(DeleteTag deleteTag) { - this.deleteTag = deleteTag; - } - - public List getReplaces() { - return replaces; - } - - public void setReplaces(List replaces) { - this.replaces = replaces; - } - - public AtomicTag getAtomicTag() { - return atomicTag; - } - - public void setAtomicTag(AtomicTag atomicTag) { - this.atomicTag = atomicTag; - } - - public ExecuteTag getExec() { - return exec; - } - - public void setExec(ExecuteTag exec) { - this.exec = exec; - } - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public GetTag getGet() { - return get; - } - - public void setGet(GetTag get) { - this.get = get; - } - - public void buildSequenceElement(Document doc, Element rootElement) { - Element sequence = doc.createElement(Constants.SEQUENCE); - rootElement.appendChild(sequence); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - sequence.appendChild(commandId); - } - if (getExec() != null) { - getExec().buildExecElement(doc, sequence); - } - if (getGet() != null) { - getGet().buildGetElement(doc, sequence); - } - if (getReplaces() != null) { - for (Iterator replaceIterator = getReplaces().iterator(); replaceIterator.hasNext(); ) { - ReplaceTag replace = replaceIterator.next(); - if (replace != null) { - replace.buildReplaceElement(doc, sequence); - } - } - } - if (getDeleteTag() != null) { - getDeleteTag().buildDeleteElement(doc, sequence); - } - if (getAtomicTag() != null) { - getAtomicTag().buildAtomicElement(doc, sequence); - } - - } -} 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/SourceTag.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/SourceTag.java deleted file mode 100644 index 3debdaf9e..000000000 --- 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/SourceTag.java +++ /dev/null @@ -1,63 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Source details of syncml header's. - */ -public class SourceTag { - - private String locURI; - private String locName; - - public String getLocURI() { - return locURI; - } - - public void setLocURI(String locURI) { - this.locURI = locURI; - } - - public String getLocName() { - return locName; - } - - public void setLocName(String locName) { - this.locName = locName; - } - - public void buildSourceElement(Document doc, Element rootElement) { - Element target = doc.createElement(Constants.SOURCE); - rootElement.appendChild(target); - if (getLocURI() != null) { - Element locURI = doc.createElement(Constants.LOC_URI); - locURI.appendChild(doc.createTextNode(getLocURI())); - target.appendChild(locURI); - } - if (getLocName() != null) { - Element locName = doc.createElement(Constants.LOC_NAME); - locName.appendChild(doc.createTextNode(getLocName())); - target.appendChild(locName); - } - } -} 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/StatusTag.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/StatusTag.java deleted file mode 100644 index 4c82b8a56..000000000 --- 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/StatusTag.java +++ /dev/null @@ -1,154 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Status of a previously sent message to device; - */ -public class StatusTag { - int commandId = -1; - int messageReference = -1; - int commandReference = -1; - String command; - String targetReference; - String data; - ChallengeTag challenge; - - public StatusTag(int commandId, int messageReference, int commandReference, String command, - String targetReference, String data) { - this.commandId = commandId; - this.messageReference = messageReference; - this.commandReference = commandReference; - this.command = command; - this.targetReference = targetReference; - this.data = data; - } - - public StatusTag(int commandId, int messageReference, int commandReference, String command, - ChallengeTag challengeTag, String targetReference, String data) { - this.commandId = commandId; - this.messageReference = messageReference; - this.commandReference = commandReference; - this.command = command; - this.challenge = challengeTag; - this.targetReference = targetReference; - this.data = data; - } - - public StatusTag() { - } - - public ChallengeTag getChallenge() { - return challenge; - } - - public void setChallenge(ChallengeTag challenge) { - this.challenge = challenge; - } - - public String getTargetReference() { - return targetReference; - } - - public void setTargetReference(String targetReference) { - this.targetReference = targetReference; - } - - public int getCommandId() { - return commandId; - } - - public void setCommandId(int commandId) { - this.commandId = commandId; - } - - public int getMessageReference() { - return messageReference; - } - - public void setMessageReference(int messageReference) { - this.messageReference = messageReference; - } - - public int getCommandReference() { - return commandReference; - } - - public void setCommandReference(int commandReference) { - this.commandReference = commandReference; - } - - public String getCommand() { - return command; - } - - public void setCommand(String command) { - this.command = command; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } - - public void buildStatusElement(Document doc, Element rootElement) { - Element status = doc.createElement(Constants.STATUS); - rootElement.appendChild(status); - if (getCommandId() != -1) { - Element commandId = doc.createElement(Constants.COMMAND_ID); - commandId.appendChild(doc.createTextNode(String.valueOf(getCommandId()))); - status.appendChild(commandId); - } - if (getMessageReference() != -1) { - Element msgReference = doc.createElement(Constants.MESSAGE_REFERENCE); - msgReference.appendChild(doc.createTextNode(String.valueOf(getMessageReference()))); - status.appendChild(msgReference); - } - if (getCommandReference() != -1) { - Element commandReference = doc.createElement(Constants.COMMAND_REFERENCE); - commandReference.appendChild(doc.createTextNode(String.valueOf(getCommandReference()))); - status.appendChild(commandReference); - } - if (getCommand() != null) { - Element command = doc.createElement(Constants.COMMAND); - command.appendChild(doc.createTextNode(getCommand())); - status.appendChild(command); - } - if (getTargetReference() != null) { - Element targetReference = doc.createElement(Constants.TARGET_REFERENCE); - targetReference.appendChild(doc.createTextNode(getTargetReference())); - status.appendChild(targetReference); - } - if (getChallenge() != null) { - getChallenge().buildChallengeElement(doc, status); - } - if (getData() != null) { - Element data = doc.createElement(Constants.DATA); - data.appendChild(doc.createTextNode(getData())); - status.appendChild(data); - } - } -} 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/SyncmlBody.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/SyncmlBody.java deleted file mode 100644 index 5aec836fd..000000000 --- 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/SyncmlBody.java +++ /dev/null @@ -1,144 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import java.util.Iterator; -import java.util.List; - -/** - * Represents the body details of a syncml. - */ -public class SyncmlBody { - GetTag getCommands; - List exec; - List status; - AlertTag alert; - ReplaceTag replace; - ResultsTag results; - SequenceTag sequence; - AtomicTag atomicTag; - - public AtomicTag getAtomicTag() { - return atomicTag; - } - - public void setAtomicTag(AtomicTag atomicTag) { - this.atomicTag = atomicTag; - } - - public SequenceTag getSequence() { - return sequence; - } - - public void setSequence(SequenceTag sequence) { - this.sequence = sequence; - } - - public List getExec() { - return exec; - } - - public void setExec(List exec) { - this.exec = exec; - } - - public ResultsTag getResults() { - return results; - } - - public void setResults(ResultsTag results) { - this.results = results; - } - - public ReplaceTag getReplace() { - return replace; - } - - public void setReplace(ReplaceTag replace) { - this.replace = replace; - } - - public List getStatus() { - return status; - } - - public void setStatus(List status) { - this.status = status; - } - - public AlertTag getAlert() { - return alert; - } - - public void setAlert(AlertTag alert) { - this.alert = alert; - } - - public GetTag getGet() { - return getCommands; - } - - public void setGet(GetTag get) { - this.getCommands = get; - } - - public void buildBodyElement(Document doc, Element rootElement) { - - Element syncBody = doc.createElement(Constants.SYNC_BODY); - rootElement.appendChild(syncBody); - if (getStatus() != null) { - for (int x = 0; x < getStatus().size(); x++) { - if (getStatus().get(x) != null) { - getStatus().get(x).buildStatusElement(doc, syncBody); - } - } - } - if (getAlert() != null) { - getAlert().buildAlertElement(doc, syncBody); - } - if (getResults() != null) { - getResults().buildResultElement(doc, syncBody); - } - if (getGet() != null) { - getGet().buildGetElement(doc, syncBody); - } - if (getReplace() != null) { - getReplace().buildReplaceElement(doc, syncBody); - } - if (getExec() != null) { - for (Iterator execIterator = getExec().iterator(); execIterator.hasNext(); ) { - ExecuteTag exec = execIterator.next(); - if (exec != null) { - exec.buildExecElement(doc, syncBody); - } - } - } - if (getSequence() != null) { - getSequence().buildSequenceElement(doc, syncBody); - } - if (getAtomicTag() != null) { - getAtomicTag().buildAtomicElement(doc, syncBody); - } - syncBody.appendChild(doc.createElement(Constants.FINAL)); - } -} 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/SyncmlDocument.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/SyncmlDocument.java deleted file mode 100644 index 7fbd481bc..000000000 --- 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/SyncmlDocument.java +++ /dev/null @@ -1,55 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * Represents a base format of a syncml document - */ -public class SyncmlDocument { - SyncmlHeader header; - SyncmlBody body; - - public SyncmlHeader getHeader() { - return header; - } - - public void setHeader(SyncmlHeader header) { - this.header = header; - } - - public SyncmlBody getBody() { - return body; - } - - public void setBody(SyncmlBody body) { - this.body = body; - } - - public void buildDocument(Document doc, Element rootElement) { - if (getHeader() != null) { - getHeader().buildSyncmlHeaderElement(doc, rootElement); - } - if (getBody() != null) { - getBody().buildBodyElement(doc, rootElement); - } - } -} 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/SyncmlHeader.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/SyncmlHeader.java deleted file mode 100644 index 281fc847d..000000000 --- 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/SyncmlHeader.java +++ /dev/null @@ -1,114 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Represents the header details of a syncml. - */ -public class SyncmlHeader { - private int sessionId = -1; - private int MsgID = -1; - private TargetTag target; - private SourceTag source; - private CredentialTag credential; - private String hexadecimalSessionId; - - public String getHexadecimalSessionId() { - return hexadecimalSessionId; - } - - public void setHexadecimalSessionId(String hexSessionId) { - this.hexadecimalSessionId = hexSessionId; - } - - public CredentialTag getCredential() { - return credential; - } - - public void setCredential(CredentialTag credential) { - this.credential = credential; - } - - public int getSessionId() { - return sessionId; - } - - public void setSessionId(int sessionId) { - this.sessionId = sessionId; - } - - public int getMsgID() { - return MsgID; - } - - public void setMsgID(int msgID) { - this.MsgID = msgID; - } - - public TargetTag getTarget() { - return target; - } - - public void setTarget(TargetTag target) { - this.target = target; - } - - public SourceTag getSource() { - return source; - } - - public void setSource(SourceTag source) { - this.source = source; - } - - public void buildSyncmlHeaderElement(Document doc, Element rootElement) { - Element syncHdr = doc.createElement(Constants.SYNC_HDR); - rootElement.appendChild(syncHdr); - Element verDTD = doc.createElement(Constants.VER_DTD); - verDTD.appendChild(doc.createTextNode(Constants.VER_DTD_VALUE)); - syncHdr.appendChild(verDTD); - - Element verProtocol = doc.createElement(Constants.VER_PROTOCOL); - verProtocol.appendChild(doc.createTextNode(Constants.VER_PROTOCOL_VALUE)); - syncHdr.appendChild(verProtocol); - if (getHexadecimalSessionId() != null) { - Element sessionId = doc.createElement(Constants.SESSION_ID); - sessionId.appendChild(doc.createTextNode(getHexadecimalSessionId())); - syncHdr.appendChild(sessionId); - } - if (getMsgID() != -1) { - Element msgId = doc.createElement(Constants.MESSAGE_ID); - msgId.appendChild(doc.createTextNode(String.valueOf(getMsgID()))); - syncHdr.appendChild(msgId); - } - if (getTarget() != null) { - getTarget().buildTargetElement(doc, syncHdr); - } - if (getSource() != null) { - getSource().buildSourceElement(doc, syncHdr); - } - if (getCredential() != null) { - getCredential().buildCredentialElement(doc, syncHdr); - } - } -} 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/TargetTag.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/TargetTag.java deleted file mode 100644 index e69add6e2..000000000 --- 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/TargetTag.java +++ /dev/null @@ -1,63 +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; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -/** - * Target details of syncml header's. - */ -public class TargetTag { - - private String LocURI; - private String LocName; - - public String getLocURI() { - return LocURI; - } - - public void setLocURI(String locURI) { - LocURI = locURI; - } - - public String getLocName() { - return LocName; - } - - public void setLocName(String locName) { - LocName = locName; - } - - public void buildTargetElement(Document doc, Element rootElement) { - Element target = doc.createElement(Constants.TARGET); - rootElement.appendChild(target); - if (getLocURI() != null) { - Element locURI = doc.createElement(Constants.LOC_URI); - locURI.appendChild(doc.createTextNode(getLocURI())); - target.appendChild(locURI); - } - if (getLocName() != null) { - Element locName = doc.createElement(Constants.LOC_NAME); - locName.appendChild(doc.createTextNode(getLocName())); - target.appendChild(locName); - } - } -} 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/WindowsOperationException.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/WindowsOperationException.java deleted file mode 100644 index 95f2d225f..000000000 --- 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/WindowsOperationException.java +++ /dev/null @@ -1,58 +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; - -/** - * Exceptions related to operation retrieval and syncml generation - */ -public class WindowsOperationException extends Exception { - - private static final long serialVersionUID = 5435636243242623629L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public WindowsOperationException(String errorMessage) { - super(errorMessage); - } - - public WindowsOperationException(String errorMessage, Throwable throwable) { - super(errorMessage, throwable); - setErrorMessage(errorMessage); - } - - public WindowsOperationException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public WindowsOperationException() { - super(); - } - - public WindowsOperationException(Throwable throwable) { - super(throwable); - } -} 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/Constants.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/Constants.java deleted file mode 100644 index 78a7c5dee..000000000 --- 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/Constants.java +++ /dev/null @@ -1,130 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util; - -/** - * Constant values used in syncml generator. - */ -public class Constants { - public static final String PROVIDER_ID = "MobiCDMServer"; - public static final String SERVER_SECRET = "dummy"; - public static final String INITIAL_NONCE = "ZHVtbXk="; - public static final String DISENROLL_ALERT_DATA = "1226"; - public static final String INITIAL_ALERT_DATA = "1201"; - public static final String INITIAL_WIN10_ALERT_DATA = "1224"; - public static final int EMPTY = 0; - - public static final String SYNCML_ROOT_ELEMENT_NAME = "SyncML"; - public static final String XMLNS_SYNCML = "SYNCML:SYNCML1.2"; - public static final String UTF_8 = "UTF-8"; - public static final String MD5 = "MD5"; - public static final String YES = "yes"; - - public static final String EXECUTE = "Exec"; - public static final String ATOMIC = "Atomic"; - public static final String ADD = "Add"; - public static final String COMMAND_ID = "CmdID"; - public static final String GET = "Get"; - public static final String DELETE = "Delete"; - public static final String ITEM = "Item"; - public static final String SOURCE = "Source"; - public static final String LOC_URI = "LocURI"; - public static final String LOC_NAME = "LocName"; - public static final String MESSAGE_REFERENCE = "MsgRef"; - public static final String COMMAND_REFERENCE = "CmdRef"; - public static final String COMMAND = "Cmd"; - public static final String TARGET_REFERENCE = "TargetRef"; - public static final String DATA = "Data"; - public static final String STATUS = "Status"; - public static final String SYNC_BODY = "SyncBody"; - public static final String SYNC_HDR = "SyncHdr"; - public static final String VER_DTD = "VerDTD"; - public static final String VER_PROTOCOL = "VerProto"; - public static final String SESSION_ID = "SessionID"; - public static final String MESSAGE_ID = "MsgID"; - public static final String TARGET = "Target"; - public static final String VER_DTD_VALUE = "1.2"; - public static final String VER_PROTOCOL_VALUE = "DM/1.2"; - public static final String ALERT = "Alert"; - public static final String FINAL = "Final"; - public static final String REPLACE = "Replace"; - public static final String META = "Meta"; - public static final String CREDENTIAL = "Cred"; - public static final String FORMAT = "Format"; - public static final String TYPE = "Type"; - public static final String NEXTNONCE = "NextNonce"; - public static final String CHALLENGE = "chal"; - public static final String META_NAMESPACE = "syncml:metinf"; - public static final String XMLNS = "xmlns"; - public static final String RESULTS = "Results"; - public static final String CRED_FORMAT = "b64"; - public static final String CRED_TYPE = "syncml:auth-md5"; - public static final String SEQUENCE = "Sequence"; - public static final String META_FORMAT_INT = "int"; - public static final String META_FORMAT_CHARACTER = "chr"; - public static final String META_FORMAT_XML = "xml"; - public static final String META_FORMAT_B64 = "b64"; - public static final String META_TYPE_TEXT_PLAIN = "text/plain"; - - public static final String SCOPE = "scope"; - - public static final String FORWARD_SLASH = "/"; - - /** - * SynclML service related constants. - */ - public final class SyncMLResponseCodes { - public static final String AUTHENTICATION_ACCEPTED = "212"; - public static final String ACCEPTED = "200"; - public static final String UNAUTHORIZED = "401"; - public static final String ACCEPTED_FOR_PROCESSING = "202"; - public static final String PIN_NOTFOUND = "405"; - public static final String LOCK_RESET_NOTIFICATION = "Error occurred in Device Lock Operation. " + - "Please trigger lock-reset operation."; - public static final String POSITIVE_CSP_DATA = "1"; - public static final String NEGATIVE_CSP_DATA = "0"; - } - - /** - * SyncmML message related constants. - */ - public final class SyncmlMessageCodes { - public static final int replaceCommandId = 300; - public static final int elementCommandId = 75; - public static final int atomicCommandId = 400; - public static final int addCommandId = 90; - } -} 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/DeviceInfo.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/DeviceInfo.java deleted file mode 100644 index f9d65c7d7..000000000 --- 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/DeviceInfo.java +++ /dev/null @@ -1,92 +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.common.PluginConstants; - -import java.util.ArrayList; -import java.util.List; - -/** - * Class generate Info type operation list. - */ -public class DeviceInfo { - public List getDeviceInfo() { - - List deviceInfoOperations = new ArrayList<>(); - - Operation osVersion = new Operation(); - osVersion.setCode(PluginConstants.SyncML.SOFTWARE_VERSION); - osVersion.setType(Operation.Type.INFO); - deviceInfoOperations.add(osVersion); - - Operation imsi = new Operation(); - imsi.setCode(PluginConstants.SyncML.IMSI); - imsi.setType(Operation.Type.INFO); - deviceInfoOperations.add(imsi); - - Operation imei = new Operation(); - imei.setCode(PluginConstants.SyncML.IMEI); - imei.setType(Operation.Type.INFO); - deviceInfoOperations.add(imei); - - Operation deviceID = new Operation(); - deviceID.setCode(PluginConstants.SyncML.DEV_ID); - deviceID.setType(Operation.Type.INFO); - deviceInfoOperations.add(deviceID); - - Operation manufacturer = new Operation(); - manufacturer.setCode(PluginConstants.SyncML.MANUFACTURER); - manufacturer.setType(Operation.Type.INFO); - deviceInfoOperations.add(manufacturer); - - Operation model = new Operation(); - model.setCode(PluginConstants.SyncML.MODEL); - model.setType(Operation.Type.INFO); - deviceInfoOperations.add(model); - - Operation language = new Operation(); - language.setCode(PluginConstants.SyncML.LANGUAGE); - language.setType(Operation.Type.INFO); - deviceInfoOperations.add(language); - - Operation vendor = new Operation(); - vendor.setCode(PluginConstants.SyncML.VENDOR); - vendor.setType(Operation.Type.INFO); - deviceInfoOperations.add(vendor); - - Operation macaddress = new Operation(); - macaddress.setCode(PluginConstants.SyncML.MAC_ADDRESS); - macaddress.setType(Operation.Type.INFO); - deviceInfoOperations.add(macaddress); - - Operation resolution = new Operation(); - resolution.setCode(PluginConstants.SyncML.RESOLUTION); - resolution.setType(Operation.Type.INFO); - deviceInfoOperations.add(resolution); - - Operation deviceName = new Operation(); - deviceName.setCode(PluginConstants.SyncML.DEVICE_NAME); - deviceName.setType(Operation.Type.INFO); - deviceInfoOperations.add(deviceName); - - return deviceInfoOperations; - } -} 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/HeartBeatDeviceInfo.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/HeartBeatDeviceInfo.java deleted file mode 100644 index 2bbf1c08d..000000000 --- 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/HeartBeatDeviceInfo.java +++ /dev/null @@ -1,90 +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.common.PluginConstants; - -import java.util.ArrayList; -import java.util.List; - -public class HeartBeatDeviceInfo { - public List getDeviceInfo() { - - List deviceInfoOperations = new ArrayList<>(); - - Operation osVersion = new Operation(); - osVersion.setCode(PluginConstants.SyncML.SOFTWARE_VERSION); - deviceInfoOperations.add(osVersion); - - Operation imsi = new Operation(); - imsi.setCode(PluginConstants.SyncML.IMSI); - deviceInfoOperations.add(imsi); - - Operation imei = new Operation(); - imei.setCode(PluginConstants.SyncML.IMEI); - deviceInfoOperations.add(imei); - - Operation deviceID = new Operation(); - deviceID.setCode(PluginConstants.SyncML.DEV_ID); - deviceInfoOperations.add(deviceID); - - Operation manufacturer = new Operation(); - manufacturer.setCode(PluginConstants.SyncML.MANUFACTURER); - deviceInfoOperations.add(manufacturer); - - Operation model = new Operation(); - model.setCode(PluginConstants.SyncML.MODEL); - deviceInfoOperations.add(model); - - Operation language = new Operation(); - language.setCode(PluginConstants.SyncML.LANGUAGE); - deviceInfoOperations.add(language); - - Operation vendor = new Operation(); - vendor.setCode(PluginConstants.SyncML.VENDOR); - deviceInfoOperations.add(vendor); - - Operation macaddress = new Operation(); - macaddress.setCode(PluginConstants.SyncML.MAC_ADDRESS); - deviceInfoOperations.add(macaddress); - - Operation resolution = new Operation(); - resolution.setCode(PluginConstants.SyncML.RESOLUTION); - deviceInfoOperations.add(resolution); - - Operation deviceName = new Operation(); - deviceName.setCode(PluginConstants.SyncML.DEVICE_NAME); - deviceInfoOperations.add(deviceName); - - Operation totalRam = new Operation(); - totalRam.setCode(PluginConstants.SyncML.TOTAL_RAM); - deviceInfoOperations.add(totalRam); - - Operation availableStorage = new Operation(); - availableStorage.setCode(PluginConstants.SyncML.TOTAL_STORAGE); - deviceInfoOperations.add(availableStorage); - - Operation remainingBattery = new Operation(); - remainingBattery.setCode(PluginConstants.SyncML.BATTERY_CHARGE_REMAINING); - deviceInfoOperations.add(remainingBattery); - - return deviceInfoOperations; - } -} 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 deleted file mode 100644 index 448375a7e..000000000 --- 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 +++ /dev/null @@ -1,159 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util; - -/** - * Maps operation codes to device specific format. - */ -public class OperationCode { - public static enum Info { - DEV_ID("./DevInfo/DevId"), - MANUFACTURER("./DevInfo/Man"), - DEVICE_MODEL("./DevInfo/Mod"), - DM_VERSION("./DevInfo/DmV"), - LANGUAGE("./DevInfo/Lang"), - IMSI("./Vendor/MSFT/DeviceInstanceService/Identity/Identity1/IMSI"), - IMEI("./Vendor/MSFT/DeviceInstanceService/Identity/Identity1/IMEI"), - SOFTWARE_VERSION("./DevDetail/SwV"), - VENDOR("./DevDetail/OEM"), - MAC_ADDRESS("./DevDetail/Ext/WLANMACAddress"), - RESOLUTION("./DevDetail/Ext/Microsoft/Resolution"), - DEVICE_NAME("./DevDetail/Ext/Microsoft/DeviceName"), - CHANNEL_URI("./Vendor/MSFT/DMClient/Provider/MobiCDMServer/Push/ChannelURI"), - LOCK_PIN("./Vendor/MSFT/RemoteLock/NewPINValue"), - LOCK_RESET("./Vendor/MSFT/RemoteLock/LockAndResetPIN"), - CAMERA("./Vendor/MSFT/PolicyManager/My/Camera/AllowCamera"), - CAMERA_STATUS("./Vendor/MSFT/PolicyManager/Device/Camera/AllowCamera"), - ENCRYPT_STORAGE_STATUS("./Vendor/MSFT/PolicyManager/Device/Security/RequireDeviceEncryption"), - DEVICE_PASSWORD_STATUS("./Vendor/MSFT/PolicyManager/Device/DeviceLock/DevicePasswordEnabled"), - DEVICE_PASSCODE_DELETE("./Vendor/MSFT/PolicyManager/My/DeviceLock"), - - // Windows10 operation codes - TOTAL_RAM("./DevDetail/Ext/Microsoft/TotalRAM"), - TOTAL_STORAGE("./DevDetail/Ext/Microsoft/TotalStorage"), - OS_PLATFORM("./DevDetail/Ext/Microsoft/OSPlatform"), - MOBILE_ID("./DevDetail/Ext/Microsoft/MobileID"), - DEVICE_TYPE("./DevDetail/DevTyp"), - BATTERY_QUERY("./Vendor/MSFT/DeviceStatus/Battery"), - BATTERY_STATUS("./Vendor/MSFT/DeviceStatus/Battery/Status"), - BATTERY_CHARGE_REMAINING("./Vendor/MSFT/DeviceStatus/Battery/EstimatedChargeRemaining"), - BATTERY_ESTIMATED_RUNTIME("./Vendor/MSFT/DeviceStatus/Battery/EstimatedRuntime"), - LONGITUDE("./Vendor/MSFT/RemoteFind/Location/Longitude"), - LATITUDE("./Vendor/MSFT/RemoteFind/Location/Latitude"), - TEST("./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors"); - private final String code; - - Info(String code) { - this.code = code; - } - - public String getCode() { - return this.code; - } - - } - - public static enum Command { - DEVICE_RING("./Vendor/MSFT/RemoteRing/Ring"), - DEVICE_LOCK("./Vendor/MSFT/RemoteLock/Lock"), - WIPE_DATA("./Vendor/MSFT/RemoteWipe/doWipe"), - DISENROLL("./Vendor/MSFT/DMClient/Unenroll"), - LOCK_RESET("./Vendor/MSFT/RemoteLock/LockAndResetPIN"), - CAMERA("./Vendor/MSFT/PolicyManager/My/Camera/AllowCamera"), - ENCRYPT_STORAGE("./Vendor/MSFT/PolicyManager/My/Security/RequireDeviceEncryption"), - CAMERA_STATUS("./Vendor/MSFT/PolicyManager/Device/Camera/AllowCamera"), - ENCRYPT_STORAGE_STATUS("./Vendor/MSFT/PolicyManager/Device/Security/RequireDeviceEncryption"), - DEVICE_PASSWORD_ENABLE("./Vendor/MSFT/PolicyManager/My/DeviceLock/DevicePasswordEnabled"), - DEVICE_PASSCODE_DELETE("./Vendor/MSFT/PolicyManager/My/DeviceLock"), - // Windows10 operation codes - TOTAL_RAM("./DevDetail/Ext/Microsoft/TotalRAM"), - TOTAL_STORAGE("./DevDetail/Ext/Microsoft/TotalStorage"), - OS_PLATFORM("./DevDetail/Ext/Microsoft/OSPlatform"), - MOBILE_ID("./DevDetail/Ext/Microsoft/MobileID"), - DEVICE_TYPE("./DevDetail/DevTyp"), - BATTERY_QUERY("./Vendor/MSFT/DeviceStatus/Battery"), - BATTERY_STATUS("./Vendor/MSFT/DeviceStatus/Battery/Status"), - BATTERY_CHARGE_REMAINING("./Vendor/MSFT/DeviceStatus/Battery/EstimatedChargeRemaining"), - BATTERY_ESTIMATED_RUNTIME("./Vendor/MSFT/DeviceStatus/Battery/EstimatedRuntime"), - LONGITUDE("./Vendor/MSFT/RemoteFind/Location/Longitude"), - LATITUDE("./Vendor/MSFT/RemoteFind/Location/Latitude"), - TEST("./Vendor/MSFT/DiagnosticLog/EtwLog/Collectors"), - DEVICE_REBOOT("./Vendor/MSFT/Reboot/RebootNow"), - INSTALL_ENTERPRISE_APPX_APPLICATION("./Device/Vendor/MSFT/EnterpriseModernAppManagement/AppInstallation/{PackageFamilyName}"), - INSTALL_ENTERPRISE_APPX_CERTIFICATE("./Device/Vendor/MSFT/RootCATrustedCertificates/Root/{CertHash}/EncodedCertificate"), - INSTALL_ENTERPRISE_MSI_APPLICATION("./Device/Vendor/MSFT/EnterpriseDesktopAppManagement/MSI/%7B{ProductId}%7D/DownloadInstall"); - - private final String code; - - Command(String code) { - this.code = code; - } - - public String getCode() { - return this.code; - } - - } - - public static enum Configure { - WIFI("./Vendor/MSFT/WiFi/Profile/MyNetwork/WlanXml"), - CAMERA("./Vendor/MSFT/PolicyManager/My/Camera/AllowCamera"), - 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/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; - - Configure(String code) { - this.code = code; - } - - public String getCode() { - return this.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/OperationHandler.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/OperationHandler.java deleted file mode 100644 index 12a37d967..000000000 --- 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/OperationHandler.java +++ /dev/null @@ -1,678 +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.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.json.JSONException; -import org.json.JSONObject; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.device.details.DeviceInfo; -import org.wso2.carbon.device.mgt.common.device.details.DeviceLocation; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.notification.mgt.Notification; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService; -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.common.policy.mgt.ProfileFeature; -import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.ComplianceFeature; -import org.wso2.carbon.device.mgt.common.policy.mgt.monitor.PolicyComplianceException; -import org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.StatusTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlDocument; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlHeader; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ItemTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ResultsTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlBody; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Profile; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; - -import java.util.ArrayList; -import java.util.List; - -import static org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils.convertToDeviceIdentifierObject; - -/** - * This class is used to handle pending operations of the device. - */ -public class OperationHandler { - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationHandler.class); - - - /** - * Update the operations using device status payload. - * - * @param status Client side status for the specific operations. - * @param syncmlDocument syncml payload for operation status which parse through the syncml engine. - * @param deviceIdentifier specific device identifier for each device. - * @throws OperationManagementException - */ - public void updateDeviceOperations(StatusTag status, SyncmlDocument syncmlDocument, - DeviceIdentifier deviceIdentifier) throws OperationManagementException { - List pendingDataOperations; - try { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - - if (Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()) || - (Constants.SyncMLResponseCodes.ACCEPTED_FOR_PROCESSING.equals(status.getData()))) { - for (Operation operation : pendingDataOperations) { - if (operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.COMPLETED); - } - } - if (syncmlDocument.getHeader().getSource().getLocURI() != null) { - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); - } - } else if (Constants.SyncMLResponseCodes.PIN_NOTFOUND.equals(status.getData())) { - for (Operation operation : pendingDataOperations) { - if (operation.getId() == status.getCommandReference() && - (PluginConstants.OperationCodes.DEVICE_LOCK.equals(operation.getCode()))) { - operation.setStatus(Operation.Status.ERROR); - if (syncmlDocument.getHeader().getSource().getLocURI() != null) { - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); - } - NotificationManagementService nmService = WindowsAPIUtils.getNotificationManagementService(); - Notification lockResetNotification = new Notification(); - lockResetNotification.setOperationId(status.getCommandReference()); - lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW)); - - lockResetNotification.setDescription( - Constants.SyncMLResponseCodes.LOCK_RESET_NOTIFICATION); - nmService.addNotification(deviceIdentifier, lockResetNotification); - } - } - } - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operations."); - } catch (NotificationManagementException e) { - throw new OperationManagementException("Error occurred while adding notification", e); - } - } - - /** - * Update operation statuses. - * - * @param deviceId specific device Id. - * @param operations operation list to be update. - * @throws OperationManagementException - */ - public static void updateStatus(String deviceId, List operations) - throws OperationManagementException { - for (Operation operation : operations) { - WindowsAPIUtils.updateOperation(deviceId, operation); - if (log.isDebugEnabled()) { - log.debug("Updating operation '" + operation.toString() + "'"); - } - } - } - - /** - * Update Status of the lock operation. - * - * @param status Status of the operation. - * @param syncmlDocument parsed syncml payload. - * @param deviceIdentifier Device Id. - * @throws OperationManagementException - */ - public void updateLockOperation(StatusTag status, SyncmlDocument syncmlDocument, DeviceIdentifier deviceIdentifier) - throws OperationManagementException { - List pendingDataOperations; - try { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - if (Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData())) { - for (Operation operation : pendingDataOperations) { - if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(operation.getCode())) - && operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); - } - } - } - if (Constants.SyncMLResponseCodes.PIN_NOTFOUND.equals(status.getData())) { - for (Operation operation : pendingDataOperations) { - - if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(operation.getCode()) && - operation.getId() == status.getCommandReference())) { - operation.setStatus(Operation.Status.ERROR); - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), pendingDataOperations); - - NotificationManagementService nmService = WindowsAPIUtils.getNotificationManagementService(); - Notification lockResetNotification = new Notification(); - lockResetNotification.setOperationId(status.getCommandReference()); - lockResetNotification.setStatus(String.valueOf(Notification.Status.NEW)); - lockResetNotification.setDescription(Constants.SyncMLResponseCodes.LOCK_RESET_NOTIFICATION); - - nmService.addNotification(deviceIdentifier, lockResetNotification); - } - } - } - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operations."); - } catch (NotificationManagementException e) { - throw new OperationManagementException("Error occurred in adding notifications."); - } - } - - /** - * Update status of the ring operation. - * - * @param status Ring status of the device. - * @param syncmlDocument Parsed syncml payload from the syncml engine. - * @param deviceIdentifier specific device id to be update. - * @throws OperationManagementException - */ - public void ring(StatusTag status, SyncmlDocument syncmlDocument, DeviceIdentifier deviceIdentifier) - throws OperationManagementException { - List pendingDataOperations; - try { - if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - for (Operation operation : pendingDataOperations) { - if ((OperationCode.Command.DEVICE_RING.getCode().equals(operation.getCode())) && - (operation.getId() == status.getCommandReference())) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), - pendingDataOperations); - } - } - } - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operation."); - } - } - - /** - * Update the status of the DataWipe operation. - * - * @param status Status of the data wipe. - * @param syncmlDocument Parsed syncml payload from the syncml engine. - * @param deviceIdentifier specific device id to be wiped. - * @throws OperationManagementException - */ - public void dataWipe(StatusTag status, SyncmlDocument syncmlDocument, DeviceIdentifier deviceIdentifier) - throws OperationManagementException { - List pendingDataOperations; - if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { - try { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operation."); - } - for (Operation operation : pendingDataOperations) { - - if ((OperationCode.Command.WIPE_DATA.getCode().equals(operation.getCode())) && - (operation.getId() == status.getCommandReference())) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), - pendingDataOperations); - } - } - } - } - - public void updateDisenrollOperationStatus(DeviceIdentifier deviceIdentifier) throws OperationManagementException { - List pendingDeviceInfoOperations; - try { - pendingDeviceInfoOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred while getting pending operations."); - } - for (Operation operation : pendingDeviceInfoOperations) { - if (PluginConstants.OperationCodes.DISENROLL.equals(operation.getCode())) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations); - } - } - } - - public void updateDeviceInfoStatus(DeviceIdentifier deviceIdentifier) throws OperationManagementException { - List pendingDeviceInfoOperations; - try { - pendingDeviceInfoOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred while getting pending operations."); - } - for (Operation operation : pendingDeviceInfoOperations) { - if (PluginConstants.OperationCodes.DEVICE_INFO.equals(operation.getCode())) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations); - } - } - } - - public void updateDeviceLocationStatus(SyncmlDocument syncmlDocument) throws OperationManagementException { - List pendingDataOperations; - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - try { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operation."); - } - for (Operation operation : pendingDataOperations) { - if (PluginConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) { - if (syncmlDocument.getBody().getResults() != null) { - List items = syncmlDocument.getBody().getResults().getItem(); - for (ItemTag itemTag : items) { - if (OperationCode.Command.LATITUDE.getCode().equals(itemTag.getSource().getLocURI())) { - // at this moment we can't get accepted value 200 from the device. - if (itemTag.getData() != null) { - operation.setStatus(Operation.Status.COMPLETED); - } else { - operation.setStatus(Operation.Status.ERROR); - } - } - } - } - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), - pendingDataOperations); - } - } - } - - /** - * Get pending operations. - * - * @param syncmlDocument SyncmlDocument object which creates from the syncml engine using syncml payload - * @return Return list of pending operations. - * @throws OperationManagementException - */ - public List getPendingOperations(SyncmlDocument syncmlDocument) - throws OperationManagementException, WindowsOperationException { - SyncmlHeader syncmlHeader = syncmlDocument.getHeader(); - SyncmlBody syncmlBody = syncmlDocument.getBody(); - List pendingOperations; - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlHeader.getSource().getLocURI()); - if (syncmlBody.getResults() != null) { - List items = syncmlBody.getResults().getItem(); - for (ItemTag itemTag : items) { - if (OperationCode.Command.LATITUDE.getCode().equals(itemTag.getSource().getLocURI())) { - updateLocation(syncmlDocument); - } - if (OperationCode.Command.TOTAL_RAM.getCode().equals(itemTag.getSource().getLocURI())) { - updateDeviceInfo(syncmlDocument); - } - if (OperationCode.Command.BATTERY_CHARGE_REMAINING.equals(itemTag.getSource().getLocURI())) { - updateDeviceInfo(syncmlDocument); - } - } - } - UpdateUriOperations(syncmlDocument); - generateComplianceFeatureStatus(syncmlDocument); - pendingOperations = WindowsAPIUtils.getDeviceManagementService().getPendingOperations(deviceIdentifier); - return pendingOperations; - } - - /** - * Set compliance of the feature according to the device status for the specific feature. - * - * @param activeFeature Features to be applied on the device. - * @param deviceFeature Actual features applied on the device. - * @return Returns setting up compliance feature. - */ - public ComplianceFeature setComplianceFeatures(ProfileFeature activeFeature, Profile deviceFeature) { - ComplianceFeature complianceFeature = new ComplianceFeature(); - complianceFeature.setFeature(activeFeature); - complianceFeature.setFeatureCode(activeFeature.getFeatureCode()); - complianceFeature.setCompliance(deviceFeature.isCompliance()); - return complianceFeature; - } - - /** - * Update the completed/Error status of the operation which have the URI of the operation code in the syncml payload. - * - * @param syncmlDocument SyncmlDocument object generated from the the syncml engine. - * @throws OperationManagementException - */ - public void UpdateUriOperations(SyncmlDocument syncmlDocument) throws OperationManagementException, - WindowsOperationException { - List pendingDataOperations; - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - - List statuses = syncmlDocument.getBody().getStatus(); - try { - pendingDataOperations = WindowsAPIUtils.getPendingOperations(deviceIdentifier); - } catch (DeviceManagementException e) { - throw new OperationManagementException("Error occurred in getting pending operation."); - } - for (StatusTag status : statuses) { - - if ((Constants.EXECUTE.equals(status.getCommand()))) { - if (status.getTargetReference() == null) { - updateDeviceOperations(status, syncmlDocument, deviceIdentifier); - } else { - if ((OperationCode.Command.DEVICE_LOCK.getCode().equals(status.getTargetReference()))) { - updateLockOperation(status, syncmlDocument, deviceIdentifier); - } - if ((OperationCode.Command.DEVICE_RING.getCode().equals(status.getTargetReference()))) { - ring(status, syncmlDocument, deviceIdentifier); - } - if ((OperationCode.Command.WIPE_DATA.getCode().equals(status.getTargetReference()))) { - dataWipe(status, syncmlDocument, deviceIdentifier); - } - } - } - if ((Constants.SEQUENCE.equals(status.getCommand()))) { - if ((Constants.SyncMLResponseCodes.ACCEPTED.equals(status.getData()))) { - for (Operation operation : pendingDataOperations) { - if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode())) && - operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.COMPLETED); - } - if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode())) && - operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.COMPLETED); - } - if (PluginConstants.OperationCodes.POLICY_REVOKE.equals(operation.getCode())) { - operation.setStatus(Operation.Status.COMPLETED); - } - } - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), - pendingDataOperations); - } else { - for (Operation operation : pendingDataOperations) { - - if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode())) && - operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.ERROR); - } - if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode())) && - operation.getId() == status.getCommandReference()) { - operation.setStatus(Operation.Status.ERROR); - } - if (PluginConstants.OperationCodes.POLICY_REVOKE.equals(operation.getCode())) { - operation.setStatus(Operation.Status.COMPLETED); - } - } - updateStatus(syncmlDocument.getHeader().getSource().getLocURI(), - pendingDataOperations); - } - } - } - } - - /** - * Generate status of the features that have been activated on the device. - * - * @param syncmlDocument syncmlDocument object pasrsed from the syncml engine. - * @return device statuses for the activated features - * @throws WindowsOperationException - */ - public List generateDeviceOperationStatusObject(SyncmlDocument syncmlDocument) throws - WindowsOperationException { - - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - String lockUri = null; - ResultsTag result = syncmlDocument.getBody().getResults(); - - List profiles = new ArrayList<>(); - if (result != null) { - List results = result.getItem(); - for (OperationCode.Info info : OperationCode.Info.values()) { - if (PluginConstants.OperationCodes.PIN_CODE.equals(info - .name())) { - lockUri = info.getCode(); - } - } - for (ItemTag item : results) { - for (OperationCode.Info info : OperationCode.Info.values()) { - if (item.getSource().getLocURI().equals(info.getCode()) && - PluginConstants.OperationCodes.CAMERA_STATUS.equals(info.name())) { - Profile cameraProfile = new Profile(); - cameraProfile.setFeatureCode(PluginConstants.OperationCodes.CAMERA); - cameraProfile.setData(item.getData()); - if ((PluginConstants.SyncML.SYNCML_DATA_ONE.equals(item.getData()))) { - cameraProfile.setEnable(true); - } else { - cameraProfile.setEnable(false); - } - profiles.add(cameraProfile); - } - if (item.getSource().getLocURI().equals(info.getCode()) && - PluginConstants.OperationCodes.ENCRYPT_STORAGE_STATUS.equals(info.name())) { - Profile encryptStorage = new Profile(); - encryptStorage.setFeatureCode(PluginConstants.OperationCodes.ENCRYPT_STORAGE); - encryptStorage.setData(item.getData()); - if ((PluginConstants.SyncML.SYNCML_DATA_ONE.equals(item.getData()))) { - encryptStorage.setEnable(true); - } else { - encryptStorage.setEnable(false); - } - profiles.add(encryptStorage); - } - if (item.getSource().getLocURI().equals(info.getCode()) && - PluginConstants.OperationCodes.DEVICE_PASSWORD_STATUS.equals(info.name())) { - Profile encryptStorage = new Profile(); - encryptStorage.setFeatureCode(PluginConstants.OperationCodes.PASSCODE_POLICY); - encryptStorage.setData(item.getData()); - if ((PluginConstants.SyncML.SYNCML_DATA_ZERO.equals(item.getData()))) { - encryptStorage.setEnable(true); - } else { - encryptStorage.setEnable(false); - } - profiles.add(encryptStorage); - } - if (!item.getData().isEmpty() && item.getSource().getLocURI().equals(lockUri)) { - String pinValue = item.getData(); - NotificationManagementService nmService = WindowsAPIUtils.getNotificationManagementService(); - Notification notification = new Notification(); - notification.setDescription("Auto generated DevicePin : " + pinValue); - notification.setOperationId(result.getCommandReference()); - notification.setStatus(String.valueOf(Notification.Status.NEW)); - try { - nmService.addNotification(deviceIdentifier, notification); - } catch (NotificationManagementException e) { - throw new WindowsOperationException("Failure Occurred while getting notification" + - " service.", e); - } - break; - } - } - } - } - return profiles; - } - - /** - * Generate Compliance Features. - * - * @param syncmlDocument syncmlDocument object parsed from the syncml engine. - * @throws WindowsOperationException - */ - public void generateComplianceFeatureStatus(SyncmlDocument syncmlDocument) throws WindowsOperationException { - List profiles = generateDeviceOperationStatusObject(syncmlDocument); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - boolean isCompliance = false; - if (profiles.size() != Constants.EMPTY) { - try { - if (WindowsAPIUtils.getPolicyManagerService().getAppliedPolicyToDevice(deviceIdentifier).getProfile(). - getProfileFeaturesList() != null) { - List profileFeatures = WindowsAPIUtils.getPolicyManagerService(). - getAppliedPolicyToDevice(deviceIdentifier).getProfile().getProfileFeaturesList(); - List complianceFeatures = new ArrayList<>(); - for (ProfileFeature activeFeature : profileFeatures) { - JSONObject policyContent = new JSONObject(activeFeature.getContent().toString()); - - for (Profile deviceFeature : profiles) { - if (deviceFeature.getFeatureCode().equals(activeFeature.getFeatureCode()) && - (PluginConstants.OperationCodes.CAMERA.equals(deviceFeature.getFeatureCode()))) { - if (policyContent.getBoolean(PluginConstants.PolicyConfigProperties. - POLICY_ENABLE) == (deviceFeature.isEnable())) { - isCompliance = true; - deviceFeature.setCompliance(isCompliance); - } else { - deviceFeature.setCompliance(isCompliance); - } - ComplianceFeature complianceFeature = setComplianceFeatures(activeFeature, - deviceFeature); - complianceFeatures.add(complianceFeature); - } - if (deviceFeature.getFeatureCode().equals(activeFeature.getFeatureCode()) && - (PluginConstants.OperationCodes. - ENCRYPT_STORAGE.equals(deviceFeature.getFeatureCode()))) { - if (policyContent.getBoolean(PluginConstants.PolicyConfigProperties. - ENCRYPTED_ENABLE) == (deviceFeature.isEnable())) { - isCompliance = true; - deviceFeature.setCompliance(isCompliance); - } else { - deviceFeature.setCompliance(isCompliance); - } - ComplianceFeature complianceFeature = setComplianceFeatures(activeFeature, - deviceFeature); - complianceFeatures.add(complianceFeature); - } - if (deviceFeature.getFeatureCode().equals(activeFeature.getFeatureCode()) && - (PluginConstants.OperationCodes. - PASSCODE_POLICY.equals(deviceFeature.getFeatureCode()))) { - if (policyContent.getBoolean(PluginConstants.PolicyConfigProperties. - ENABLE_PASSWORD) == (deviceFeature.isEnable())) { - isCompliance = true; - deviceFeature.setCompliance(isCompliance); - } else { - deviceFeature.setCompliance(isCompliance); - } - ComplianceFeature complianceFeature = setComplianceFeatures(activeFeature, - deviceFeature); - complianceFeatures.add(complianceFeature); - } - } - } - WindowsAPIUtils.getPolicyManagerService().checkPolicyCompliance(deviceIdentifier, - complianceFeatures); - } - } catch (JSONException e) { - throw new WindowsOperationException("Error occurred while parsing json object.", e); - } catch (PolicyComplianceException e) { - throw new WindowsOperationException("Error occurred while setting up policy compliance.", e); - } catch (PolicyManagementException e) { - throw new WindowsOperationException("Error occurred while getting effective policy.", e); - } - } - - } - - public void updateDeviceInfo(SyncmlDocument syncmlDocument) throws WindowsOperationException { - String softwareVersion; - String imsi; - String imei; - String model; - String vendor; - String totalRAM; - String deviceID = null; - String totalStorage; - Double battery; - - List deviceInformations = syncmlDocument.getBody().getResults().getItem(); - DeviceInfo deviceInfo = new DeviceInfo(); - for (ItemTag item : deviceInformations) { - String source = item.getSource().getLocURI(); - if (OperationCode.Info.SOFTWARE_VERSION.getCode().equals(source)) { - softwareVersion = item.getData(); - deviceInfo.setOsVersion(softwareVersion); - } - if (OperationCode.Info.IMSI.getCode().equals(source)) { - imsi = item.getData(); - deviceInfo.getDeviceDetailsMap().put("IMSI", imsi); - } - if (OperationCode.Info.IMEI.getCode().equals(source)) { - imei = item.getData(); - deviceInfo.getDeviceDetailsMap().put("IMEI", imei); - } - if (OperationCode.Info.DEVICE_MODEL.getCode().equals(source)) { - model = item.getData(); - deviceInfo.setDeviceModel(model); - } - if (OperationCode.Info.VENDOR.getCode().equals(source)) { - vendor = item.getData(); - deviceInfo.setVendor(vendor); - } - if (OperationCode.Info.TOTAL_RAM.getCode().equals(source)) { - totalRAM = item.getData(); - deviceInfo.setAvailableRAMMemory(Double.parseDouble(totalRAM)); - } - if (OperationCode.Info.TOTAL_STORAGE.getCode().equals(source)) { - totalStorage = item.getData(); - deviceInfo.setInternalAvailableMemory(Double.parseDouble(totalStorage)); - } - if (OperationCode.Info.DEV_ID.getCode().equals(source)) { - deviceID = item.getData(); - } - if (OperationCode.Info.BATTERY_CHARGE_REMAINING.getCode().equals(source)) { - battery = Double.valueOf(item.getData()); - deviceInfo.setBatteryLevel(battery); - } - } - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(deviceID); - try { - WindowsAPIUtils.updateDeviceInfo(deviceIdentifier, deviceInfo); - updateDeviceInfoStatus(deviceIdentifier); - } catch (org.wso2.carbon.device.mgt.core.device.details.mgt.DeviceDetailsMgtException e) { - throw new WindowsOperationException("Error occurred while adding Device info."); - } catch (OperationManagementException e) { - throw new WindowsOperationException("Error occurred while updating Device info operation status."); - } - } - - private void updateLocation(SyncmlDocument syncmlDocument) throws WindowsOperationException { - List deviceInformations = syncmlDocument.getBody().getResults().getItem(); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - - DeviceLocation deviceLocation = new DeviceLocation(); - deviceLocation.setDeviceIdentifier(deviceIdentifier); - for (ItemTag item : deviceInformations) { - String source = item.getSource().getLocURI(); - if (OperationCode.Info.LONGITUDE.getCode().equals(source)) { - String longitude = item.getData(); - deviceLocation.setLongitude(Double.parseDouble(longitude)); - } - if (OperationCode.Info.LATITUDE.getCode().equals(source)) { - Double latitude = Double.parseDouble(item.getData()); - deviceLocation.setLatitude(latitude); - } - } - try { - WindowsAPIUtils.updateDeviceLocation(deviceLocation); - updateDeviceLocationStatus(syncmlDocument); - } catch (DeviceDetailsMgtException e) { - throw new WindowsOperationException("Error occurred while updating Device Location."); - } catch (OperationManagementException e) { - throw new WindowsOperationException("Error occurred while updating Device Location operation status."); - } - } - - public void checkForDeviceWipe(List pendingDeviceInfoOperations - , DeviceIdentifier deviceIdentifier) throws OperationManagementException { - for (Operation operation : pendingDeviceInfoOperations) { - if (PluginConstants.OperationCodes.WIPE_DATA.equals(operation.getCode())) { - operation.setStatus(Operation.Status.COMPLETED); - updateStatus(deviceIdentifier.getId(), pendingDeviceInfoOperations); - } - } - } -} - 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 deleted file mode 100644 index 8d9a7cb4d..000000000 --- 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 +++ /dev/null @@ -1,884 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util; - -import com.google.gson.Gson; -import org.json.JSONException; -import org.json.JSONObject; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.EnterpriseApplication; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.SyncmlCommandType; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.PasscodePolicy; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.Wifi; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*; -import org.wso2.carbon.policy.mgt.common.FeatureManagementException; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.device.mgt.common.policy.mgt.ProfileFeature; - -import java.util.ArrayList; -import java.util.List; - -import static org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils.convertToDeviceIdentifierObject; -import static org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationCode.*; - -/** - * Used to generate a reply to a receiving syncml from a device. - */ -public class OperationReply { - - private SyncmlDocument syncmlDocument; - private SyncmlDocument replySyncmlDocument; - private int headerCommandId = 1; - private static final int HEADER_STATUS_ID = 0; - private static final String RESULTS_COMMAND_TEXT = "Results"; - private static final String HEADER_COMMAND_TEXT = "SyncHdr"; - private static final String ALERT_COMMAND_TEXT = "Alert"; - private static final String REPLACE_COMMAND_TEXT = "Replace"; - private static final String GET_COMMAND_TEXT = "Get"; - private static final String EXEC_COMMAND_TEXT = "Exec"; - private List operations; - Gson gson = new Gson(); - - public OperationReply(SyncmlDocument syncmlDocument, List operations) { - this.syncmlDocument = syncmlDocument; - replySyncmlDocument = new SyncmlDocument(); - this.operations = operations; - } - - public OperationReply(SyncmlDocument syncmlDocument) { - this.syncmlDocument = syncmlDocument; - replySyncmlDocument = new SyncmlDocument(); - } - - public OperationReply() { - - } - - /** - * Generate Device payloads. - * - * @param syncmlDocument Parsed syncml payload from the syncml engine. - * @param operations Operations for generate payload. - * @return String type syncml payload. - * @throws WindowsOperationException - * @throws PolicyManagementException - * @throws org.wso2.carbon.policy.mgt.common.FeatureManagementException - */ - public String generateReply(SyncmlDocument syncmlDocument, List operations) - throws SyncmlMessageFormatException, SyncmlOperationException, WindowsOperationException { - - OperationReply operationReply; - SyncmlGenerator generator; - SyncmlDocument syncmlResponse; - if (operations == null) { - operationReply = new OperationReply(syncmlDocument); - } else { - operationReply = new OperationReply(syncmlDocument, operations); - } - syncmlResponse = operationReply.generateReply(); - generator = new SyncmlGenerator(); - return generator.generatePayload(syncmlResponse); - } - - public SyncmlDocument generateReply() - throws SyncmlMessageFormatException, SyncmlOperationException, WindowsOperationException { - generateHeader(); - generateBody(); - return replySyncmlDocument; - } - - private void generateHeader() throws SyncmlMessageFormatException { - String nextNonceValue = Constants.INITIAL_NONCE; - SyncmlHeader sourceHeader = syncmlDocument.getHeader(); - SyncmlHeader header = new SyncmlHeader(); - header.setMsgID(sourceHeader.getMsgID()); - header.setHexadecimalSessionId(Integer.toHexString(sourceHeader.getSessionId())); - TargetTag target = new TargetTag(); - target.setLocURI(sourceHeader.getSource().getLocURI()); - header.setTarget(target); - - SourceTag source = new SourceTag(); - source.setLocURI(sourceHeader.getTarget().getLocURI()); - header.setSource(source); - - CredentialTag cred = new CredentialTag(); - if (sourceHeader.getCredential() == null) { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.CRED_FORMAT); - meta.setType(Constants.CRED_TYPE); - cred.setMeta(meta); - } else { - cred.setMeta(sourceHeader.getCredential().getMeta()); - } - SyncmlBody sourcebody = syncmlDocument.getBody(); - List statuses = sourcebody.getStatus(); - - for (StatusTag status : statuses) { - if (HEADER_COMMAND_TEXT.equals(status.getCommand()) && - status.getChallenge() != null) { - nextNonceValue = status.getChallenge().getMeta().getNextNonce(); - } - } - cred.setData(SyncmlCredentialUtil.generateCredData(nextNonceValue)); - header.setCredential(cred); - - replySyncmlDocument.setHeader(header); - } - - private void generateBody() - throws SyncmlMessageFormatException, SyncmlOperationException, WindowsOperationException { - SyncmlBody syncmlBody = generateStatuses(); - try { - appendOperations(syncmlBody); - } catch (JSONException e) { - throw new SyncmlMessageFormatException("Error Occurred while parsing operation object.", e); - } - replySyncmlDocument.setBody(syncmlBody); - } - - private SyncmlBody generateStatuses() { - SyncmlBody sourceSyncmlBody = syncmlDocument.getBody(); - SyncmlHeader sourceHeader = syncmlDocument.getHeader(); - StatusTag headerStatus; - ChallengeTag challengeTag = new ChallengeTag(); - MetaTag metaTag = new MetaTag(); - metaTag.setFormat(Constants.CRED_FORMAT); - metaTag.setType(Constants.CRED_TYPE); - metaTag.setNextNonce(Constants.INITIAL_NONCE); - challengeTag.setMeta(metaTag); - SyncmlBody syncmlBodyReply = new SyncmlBody(); - List statuses = new ArrayList<>(); - List sourceStatuses = sourceSyncmlBody.getStatus(); - if (sourceStatuses.isEmpty()) { - headerStatus = - new StatusTag(headerCommandId, sourceHeader.getMsgID(), HEADER_STATUS_ID, - HEADER_COMMAND_TEXT, challengeTag,sourceHeader.getSource().getLocURI(), - String.valueOf(Constants.SyncMLResponseCodes.UNAUTHORIZED)); - statuses.add(headerStatus); - } else { - for (StatusTag sourceStatus : sourceStatuses) { - if (sourceStatus.getChallenge() != null && HEADER_COMMAND_TEXT.equals(sourceStatus.getCommand())) { - headerStatus = - new StatusTag(headerCommandId, sourceHeader.getMsgID(), HEADER_STATUS_ID, - HEADER_COMMAND_TEXT, challengeTag, sourceHeader.getSource().getLocURI(), - String.valueOf(Constants.SyncMLResponseCodes.AUTHENTICATION_ACCEPTED)); - statuses.add(headerStatus); - } - } - } - if (sourceSyncmlBody.getResults() != null) { - int ResultCommandId = ++headerCommandId; - StatusTag resultStatus = new StatusTag(ResultCommandId, sourceHeader.getMsgID(), - sourceSyncmlBody.getResults().getCommandId(), RESULTS_COMMAND_TEXT, null, - String.valueOf(Constants.SyncMLResponseCodes.ACCEPTED)); - statuses.add(resultStatus); - } - if (sourceSyncmlBody.getAlert() != null) { - int alertCommandId = ++headerCommandId; - StatusTag alertStatus = new StatusTag(alertCommandId, - sourceHeader.getMsgID(), - sourceSyncmlBody.getAlert().getCommandId(), - ALERT_COMMAND_TEXT, null, - String.valueOf(Constants.SyncMLResponseCodes.ACCEPTED)); - statuses.add(alertStatus); - } - if (sourceSyncmlBody.getReplace() != null) { - int replaceCommandId = ++headerCommandId; - StatusTag replaceStatus = new StatusTag(replaceCommandId, sourceHeader.getMsgID(), - sourceSyncmlBody.getReplace().getCommandId(), REPLACE_COMMAND_TEXT, null, - String.valueOf(Constants.SyncMLResponseCodes.ACCEPTED) - ); - statuses.add(replaceStatus); - } - if (sourceSyncmlBody.getExec() != null) { - List Executes = sourceSyncmlBody.getExec(); - for (ExecuteTag exec : Executes) { - int execCommandId = ++headerCommandId; - StatusTag execStatus = new StatusTag(execCommandId, sourceHeader.getMsgID(), - exec.getCommandId(), EXEC_COMMAND_TEXT, null, String.valueOf( - Constants.SyncMLResponseCodes.ACCEPTED)); - statuses.add(execStatus); - } - } - if (sourceSyncmlBody.getGet() != null) { - int getCommandId = ++headerCommandId; - StatusTag execStatus = new StatusTag(getCommandId, sourceHeader.getMsgID(), sourceSyncmlBody - .getGet().getCommandId(), GET_COMMAND_TEXT, null, String.valueOf( - Constants.SyncMLResponseCodes.ACCEPTED)); - statuses.add(execStatus); - } - syncmlBodyReply.setStatus(statuses); - return syncmlBodyReply; - } - - private void appendOperations(SyncmlBody syncmlBody) - throws JSONException, SyncmlOperationException, WindowsOperationException { - GetTag getElement = new GetTag(); - List getElements = new ArrayList<>(); - List executeElements = new ArrayList<>(); - AtomicTag atomicTagElement = new AtomicTag(); - List addElements = new ArrayList<>(); - ReplaceTag replaceElement = new ReplaceTag(); - List replaceItems = new ArrayList<>(); - SequenceTag monitorSequence = new SequenceTag(); - List deviceInfoOperations; - if (operations != null) { - for (Operation operation : operations) { - Operation.Type type = operation.getType(); - switch (type) { - case POLICY: - if (this.syncmlDocument.getBody().getAlert() != null) { - if ((Constants.INITIAL_ALERT_DATA.equals(this.syncmlDocument.getBody().getAlert() - .getData())) || Constants.INITIAL_WIN10_ALERT_DATA. - equals(this.syncmlDocument.getBody() - .getAlert().getData())) { - SequenceTag policySequence = new SequenceTag(); - policySequence = buildSequence(operation, policySequence); - syncmlBody.setSequence(policySequence); - } - } - break; - case CONFIG: - List addConfigurations = appendAddConfiguration(operation); - for (AddTag addConfiguration : addConfigurations) { - addElements.add(addConfiguration); - } - break; - case MESSAGE: - - break; - case INFO: - ItemTag itemGet = appendGetInfo(operation); - getElements.add(itemGet); - break; - case COMMAND: - ExecuteTag execElement; - if ((PluginConstants.OperationCodes.DEVICE_LOCK.equals(operation.getCode()))) { - execElement = executeCommand(operation); - executeElements.add(execElement); - } - if ((PluginConstants.OperationCodes.DEVICE_RING.equals(operation.getCode()))) { - execElement = executeCommand(operation); - executeElements.add(execElement); - } - if ((PluginConstants.OperationCodes.DISENROLL.equals(operation.getCode()))) { - execElement = executeCommand(operation); - executeElements.add(execElement); - } - if ((PluginConstants.OperationCodes.WIPE_DATA.equals(operation.getCode()))) { - execElement = executeCommand(operation); - executeElements.add(execElement); - } - if ((PluginConstants.OperationCodes.LOCK_RESET.equals(operation.getCode()))) { - SequenceTag sequenceElement = new SequenceTag(); - SequenceTag sequence = buildSequence(operation, sequenceElement); - syncmlBody.setSequence(sequence); - } - if (PluginConstants.OperationCodes.DEVICE_LOCATION.equals(operation.getCode())) { - Operation longitudeOperation = new Operation(); - Operation latitudeOperation = new Operation(); - longitudeOperation.setCode(PluginConstants.OperationCodes.LONGITUDE); - latitudeOperation.setCode(PluginConstants.OperationCodes.LATITUDE); - List deviceLocationOperations = new ArrayList<>(); - deviceLocationOperations.add(latitudeOperation); - deviceLocationOperations.add(longitudeOperation); - for (Operation infoOperation : deviceLocationOperations) { - ItemTag deviceInfo = appendGetInfo(infoOperation); - getElements.add(deviceInfo); - } - } - if (PluginConstants.OperationCodes.DEVICE_REBOOT.equals(operation.getCode())) { - execElement = executeCommand(operation); - executeElements.add(execElement); - } - if ((PluginConstants.OperationCodes.MONITOR.equals(operation.getCode()))) { - GetTag monitorGetElement = new GetTag(); - List monitorItems; - List profileFeatures; - - if (this.syncmlDocument.getBody().getAlert() != null) { - if (Constants.INITIAL_ALERT_DATA.equals(this.syncmlDocument.getBody(). - getAlert().getData()) || Constants.INITIAL_WIN10_ALERT_DATA. - equals(this.syncmlDocument.getBody() - .getAlert().getData())) { - - monitorSequence.setCommandId(operation.getId()); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject( - syncmlDocument.getHeader().getSource().getLocURI()); - try { - profileFeatures = WindowsAPIUtils.getPolicyManagerService(). - getEffectiveFeatures(deviceIdentifier); - } catch (FeatureManagementException e) { - throw new SyncmlOperationException("Error in getting effective policy.", e); - } - monitorItems = buildMonitorOperation(profileFeatures); - if (!monitorItems.isEmpty()) { - monitorGetElement.setCommandId(operation.getId()); - monitorGetElement.setItems(monitorItems); - } - monitorSequence.setGet(monitorGetElement); - syncmlBody.setSequence(monitorSequence); - } - } - } - if (PluginConstants.OperationCodes.DEVICE_INFO.equals(operation.getCode())) { - if (this.syncmlDocument.getBody().getAlert() != null) { - if ((Constants.INITIAL_ALERT_DATA.equals(this.syncmlDocument.getBody().getAlert() - .getData())) || Constants.INITIAL_WIN10_ALERT_DATA. - equals(this.syncmlDocument.getBody() - .getAlert().getData())) { - HeartBeatDeviceInfo heartBeatDeviceInfo = new HeartBeatDeviceInfo(); - deviceInfoOperations = heartBeatDeviceInfo.getDeviceInfo(); - for (Operation infoOperation : deviceInfoOperations) { - ItemTag deviceInfo = appendGetInfo(infoOperation); - getElements.add(deviceInfo); - } - } - } - } - break; - case PROFILE: - if (PluginConstants.OperationCodes.INSTALL_ENTERPRISE_APPLICATION.equals(operation.getCode())) { - EnterpriseApplication enterpriseApplication = gson - .fromJson((String) operation.getPayLoad(), EnterpriseApplication.class); - List enterpriseApplicationContent = enterpriseApplication - .createOperationContent(operation); - for (Object object : enterpriseApplicationContent) { - if (object instanceof AddTag) { - addElements.add((AddTag) object); - } else if (object instanceof ExecuteTag) { - executeElements.add((ExecuteTag) object); - } - } - } - break; - } - } - if (!replaceItems.isEmpty()) { - replaceElement.setCommandId(Constants.SyncmlMessageCodes.replaceCommandId); - replaceElement.setItems(replaceItems); - } - if (!getElements.isEmpty()) { - getElement.setCommandId(Constants.SyncmlMessageCodes.elementCommandId); - getElement.setItems(getElements); - } - if (!addElements.isEmpty()) { - atomicTagElement.setCommandId(Constants.SyncmlMessageCodes.atomicCommandId); - atomicTagElement.setAdds(addElements); - } - syncmlBody.setGet(getElement); - syncmlBody.setExec(executeElements); - syncmlBody.setAtomicTag(atomicTagElement); - syncmlBody.setReplace(replaceElement); - } - } - - private ItemTag appendExecInfo(Operation operation) { - ItemTag item = new ItemTag(); - String operationCode = operation.getCode(); - for (Command command : Command.values()) { - if (operationCode != null && operationCode.equals(command.name())) { - TargetTag target = new TargetTag(); - target.setLocURI(command.getCode()); - if ((PluginConstants - .OperationCodes.DISENROLL.equals(operation.getCode()))) { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_CHARACTER); - item.setMeta(meta); - item.setData(Constants.PROVIDER_ID); - } - item.setTarget(target); - } - } - return item; - } - - private ItemTag appendGetInfo(Operation operation) { - ItemTag item = new ItemTag(); - String operationCode = operation.getCode(); - for (Info info : Info.values()) { - if (operationCode != null && operationCode.equals(info.name())) { - TargetTag target = new TargetTag(); - target.setLocURI(info.getCode()); - item.setTarget(target); - } - } - if ((operationCode != null) && - PluginConstants.OperationCodes.LOCK_RESET.equals(operationCode)) { - operation.setCode(PluginConstants.OperationCodes.PIN_CODE); - for (Info getInfo : Info.values()) { - if (operation.getCode().equals(getInfo.name())) { - TargetTag target = new TargetTag(); - target.setLocURI(getInfo.getCode()); - item.setTarget(target); - } - } - } - return item; - } - - private ItemTag appendReplaceInfo(Operation operation) throws JSONException { - String policyAllowData = "1"; - String policyDisallowData = "0"; - ItemTag item = new ItemTag(); - TargetTag target = new TargetTag(); - String operationCode = operation.getCode(); - JSONObject payload = new JSONObject(operation.getPayLoad().toString()); - for (Command command : Command.values()) { - - if (operationCode != null && operationCode.equals(command.name())) { - target.setLocURI(command.getCode()); - - if ((PluginConstants.OperationCodes.CAMERA.equals(operation.getCode()))) { - - if (payload.getBoolean("enabled")) { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_INT); - item.setTarget(target); - item.setMeta(meta); - item.setData(policyAllowData); - } else { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_INT); - item.setTarget(target); - item.setMeta(meta); - item.setData(policyDisallowData); - } - } - if ((PluginConstants.OperationCodes.ENCRYPT_STORAGE. - equals(operation.getCode()))) { - - if (payload.getBoolean("encrypted")) { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_INT); - item.setTarget(target); - item.setMeta(meta); - item.setData(policyAllowData); - } else { - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_INT); - item.setTarget(target); - item.setMeta(meta); - item.setData(policyDisallowData); - } - } - } - } - return item; - } - - private List appendAddInfo(Operation operation) throws WindowsOperationException { - - List addList = new ArrayList<>(); - Gson gson = new Gson(); - - if ((PluginConstants.OperationCodes.PASSCODE_POLICY.equals(operation.getCode()))) { - - PasscodePolicy passcodeObject = gson.fromJson((String) operation.getPayLoad(), PasscodePolicy.class); - - for (Configure configure : Configure.values()) { - - if (operation.getCode() != null && PluginConstants.OperationCodes.PASSWORD_MAX_FAIL_ATTEMPTS. - equals(configure.name())) { - AddTag add = generatePasscodePolicyData(configure, passcodeObject.getMaxFailedAttempts()); - addList.add(add); - } - if (operation.getCode() != null && (PluginConstants.OperationCodes.DEVICE_PASSWORD_ENABLE. - equals(configure.name()) || PluginConstants.OperationCodes.SIMPLE_PASSWORD. - equals(configure.name()) || PluginConstants.OperationCodes.ALPHANUMERIC_PASSWORD. - equals(configure.name()))) { - AddTag add = generatePasscodeBooleanData(operation, configure); - addList.add(add); - } - if (operation.getCode() != null && PluginConstants.OperationCodes.MIN_PASSWORD_LENGTH. - equals(configure.name())) { - AddTag add = generatePasscodePolicyData(configure, passcodeObject.getMinLength()); - addList.add(add); - } - if (operation.getCode() != null && PluginConstants.OperationCodes.PASSWORD_EXPIRE. - equals(configure.name())) { - AddTag add = generatePasscodePolicyData(configure, passcodeObject.getMaxPINAgeInDays()); - addList.add(add); - } - if (operation.getCode() != null && PluginConstants.OperationCodes.PASSWORD_HISTORY. - equals(configure.name())) { - int pinHistory = passcodeObject.getPinHistory(); - AddTag add = generatePasscodePolicyData(configure, pinHistory); - addList.add(add); - } - if (operation.getCode() != null && PluginConstants.OperationCodes.MAX_PASSWORD_INACTIVE_TIME. - equals(configure.name())) { - AddTag add = generatePasscodePolicyData(configure, passcodeObject.getMaxInactiveTime()); - addList.add(add); - } - if (operation.getCode() != null && PluginConstants.OperationCodes.MIN_PASSWORD_COMPLEX_CHARACTERS. - equals(configure.name())) { - int complexChars = passcodeObject.getMinComplexChars(); - AddTag add = generatePasscodePolicyData(configure, complexChars); - addList.add(add); - } - } - } - return addList; - } - - private List appendAddConfiguration(Operation operation) { - - List addList = new ArrayList<>(); - Gson gson = new Gson(); - - if (SyncmlCommandType.WIFI.getValue().equals(operation.getCode())) { - AddTag add = new AddTag(); - String operationCode = operation.getCode(); - Wifi wifiObject = gson.fromJson((String) operation.getPayLoad(), Wifi.class); - String data = "<?xml version="1.0"?><WLANProfile" + - "xmlns="http://www.microsoft.com/networking/WLAN/profile/v1"><name>" + - wifiObject.getNetworkName() + "</name><SSIDConfig><SSID><name>" + - wifiObject.getSsid() + "</name></SSID></SSIDConfig><connectionType>" + - wifiObject.getConnectionType() + "</connectionType><connectionMode>" + - wifiObject.getConnectionMode() + "</connectionMode><MSM><security><" + - "authEncryption><authentication>" + wifiObject.getAuthentication() + - "</authentication><encryption>" + wifiObject.getEncryption() + - "</encryption></authEncryption><sharedKey><keyType>" + - wifiObject.getKeyType() + "</keyType><protected>" + wifiObject.getProtection() + - "</protected><keyMaterial>" + wifiObject.getKeyMaterial() + - "</keyMaterial></sharedKey></security></MSM></WLANProfile>"; - - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_CHARACTER); - List items = new ArrayList<>(); - - for (Configure configure : Configure.values()) { - if (operationCode != null && operationCode.equals(configure.name())) { - TargetTag target = new TargetTag(); - target.setLocURI(configure.getCode()); - items.get(0).setTarget(target); - } - } - items.get(0).setMeta(meta); - items.get(0).setData(data); - - add.setCommandId(301); - add.setItems(items); - addList.add(add); - return addList; - } - return null; - } - - public ExecuteTag executeCommand(Operation operation) { - ExecuteTag execElement = new ExecuteTag(); - execElement.setCommandId(operation.getId()); - List itemsExec = new ArrayList<>(); - ItemTag itemExec = appendExecInfo(operation); - itemsExec.add(itemExec); - execElement.setItems(itemsExec); - return execElement; - } - - public SequenceTag buildSequence(Operation operation, SequenceTag sequenceElement) throws JSONException, - SyncmlOperationException { - - sequenceElement.setCommandId(operation.getId()); - List replaceItems = new ArrayList<>(); - - if ((PluginConstants.OperationCodes.LOCK_RESET.equals(operation.getCode()))) { - ExecuteTag execElement = executeCommand(operation); - GetTag getElements = new GetTag(); - getElements.setCommandId(operation.getId()); - List getItems = new ArrayList<>(); - ItemTag itemGets = appendGetInfo(operation); - getItems.add(itemGets); - getElements.setItems(getItems); - - sequenceElement.setExec(execElement); - sequenceElement.setGet(getElements); - return sequenceElement; - } else if ((PluginConstants.OperationCodes.POLICY_BUNDLE.equals(operation.getCode()))) { - List policyOperations; - try { - policyOperations = (List) operation.getPayLoad(); - } catch (ClassCastException e) { - throw new ClassCastException(); - } - for (Operation policy : policyOperations) { - - if (PluginConstants.OperationCodes.CAMERA.equals(policy.getCode())) { - ReplaceTag replaceCameraConfig = new ReplaceTag(); - ItemTag cameraItem; - List cameraItems = new ArrayList<>(); - - try { - cameraItem = appendReplaceInfo(policy); - cameraItems.add(cameraItem); - } catch (JSONException e) { - throw new SyncmlOperationException("Error occurred while parsing payload object to json.", e); - } - replaceCameraConfig.setCommandId(operation.getId()); - replaceCameraConfig.setItems(cameraItems); - replaceItems.add(replaceCameraConfig); - } - if ((PluginConstants.OperationCodes.ENCRYPT_STORAGE.equals(policy.getCode()))) { - - ReplaceTag replaceStorageConfig = new ReplaceTag(); - ItemTag storageItem; - List storageItems = new ArrayList<>(); - try { - storageItem = appendReplaceInfo(policy); - storageItems.add(storageItem); - } catch (JSONException e) { - throw new SyncmlOperationException("Error occurred while parsing payload object to json.", e); - } - replaceStorageConfig.setCommandId(operation.getId()); - replaceStorageConfig.setItems(storageItems); - replaceItems.add(replaceStorageConfig); - - } - if ((PluginConstants.OperationCodes.PASSCODE_POLICY.equals(policy.getCode()))) { - AtomicTag atomicTagElement = new AtomicTag(); - List addConfig; - DeleteTag deleteTag = new DeleteTag(); - try { - addConfig = appendAddInfo(policy); - atomicTagElement.setAdds(addConfig); - atomicTagElement.setCommandId(operation.getId()); - List deleteTagItems = buildDeletePasscodeData(policy); - deleteTag.setCommandId(operation.getId()); - deleteTag.setItems(deleteTagItems); - sequenceElement.setDeleteTag(deleteTag); - sequenceElement.setAtomicTag(atomicTagElement); - } catch (WindowsOperationException e) { - throw new SyncmlOperationException("Error occurred while generating operation payload.", e); - } - } - } - if (!replaceItems.isEmpty()) { - sequenceElement.setReplaces(replaceItems); - } - return sequenceElement; - - } else { - return null; - } - } - - public List buildMonitorOperation(List effectiveMonitoringFeature) { - List monitorItems = new ArrayList<>(); - Operation monitorOperation; - for (ProfileFeature profileFeature : effectiveMonitoringFeature) { - - if ((PluginConstants.OperationCodes.CAMERA.equals - (profileFeature.getFeatureCode()))) { - String cameraStatus = PluginConstants - .OperationCodes.CAMERA_STATUS; - - monitorOperation = new Operation(); - monitorOperation.setCode(cameraStatus); - ItemTag item = appendGetInfo(monitorOperation); - monitorItems.add(item); - } - if (PluginConstants.OperationCodes.ENCRYPT_STORAGE.equals - (profileFeature.getFeatureCode())) { - String encryptStorageStatus = PluginConstants - .OperationCodes.ENCRYPT_STORAGE_STATUS; - - monitorOperation = new Operation(); - monitorOperation.setCode(encryptStorageStatus); - ItemTag item = appendGetInfo(monitorOperation); - monitorItems.add(item); - } - if ((PluginConstants.OperationCodes.PASSCODE_POLICY.equals - (profileFeature.getFeatureCode()))) { - String passcodeStatus = PluginConstants - .OperationCodes.DEVICE_PASSWORD_STATUS; - - monitorOperation = new Operation(); - monitorOperation.setCode(passcodeStatus); - ItemTag item = appendGetInfo(monitorOperation); - monitorItems.add(item); - } - } - return monitorItems; - } - - - public List buildDeletePasscodeData(Operation operation) { - List deleteTagItems = new ArrayList<>(); - ItemTag itemTag = new ItemTag(); - TargetTag target = new TargetTag(); - if ((PluginConstants.OperationCodes.PASSCODE_POLICY.equals(operation.getCode()))) { - operation.setCode(PluginConstants.OperationCodes.DEVICE_PASSCODE_DELETE); - for (Command command : Command.values()) { - if (operation.getCode() != null && operation.getCode().equals(command.name())) { - target.setLocURI(command.getCode()); - itemTag.setTarget(target); - deleteTagItems.add(itemTag); - } - - } - } - return deleteTagItems; - } - - public AddTag generatePasscodePolicyData(Configure configure, int policyData) { - String attempt = String.valueOf(policyData); - AddTag add = new AddTag(); - List itemList = new ArrayList<>(); - ItemTag item = new ItemTag(); - TargetTag target = new TargetTag(); - target.setLocURI(configure.getCode()); - MetaTag meta = new MetaTag(); - meta.setFormat(Constants.META_FORMAT_INT); - item.setTarget(target); - item.setMeta(meta); - item.setData(attempt); - itemList.add(item); - add.setCommandId(Constants.SyncmlMessageCodes.addCommandId); - add.setItems(itemList); - return add; - } - - public AddTag generatePasscodeBooleanData(Operation operation, Configure configure) { - 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()) { - 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 { - 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()) { - 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 { - 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()) { - 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 { - 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/SyncmlCredentialUtil.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/SyncmlCredentialUtil.java deleted file mode 100644 index 39ca0f657..000000000 --- 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/SyncmlCredentialUtil.java +++ /dev/null @@ -1,72 +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.apache.commons.codec.binary.Base64; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; - -import java.io.UnsupportedEncodingException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; - -/** - * Generate security token to client and server. - */ -public class SyncmlCredentialUtil { - - public static String generateCredData(String nextNonce) throws SyncmlMessageFormatException { - MessageDigest digest; - String usrPwdNonceHash; - String nonce; - try { - nonce = new String(Base64.decodeBase64(nextNonce), Constants.UTF_8); - digest = MessageDigest.getInstance(Constants.MD5); - String usrPwd = Constants.PROVIDER_ID + ":" + Constants.SERVER_SECRET; - String usrPwdHash = Base64.encodeBase64String(digest.digest(usrPwd.getBytes(Constants.UTF_8))); - String usrPwdNonce = usrPwdHash + ":" + nonce; - usrPwdNonceHash = Base64.encodeBase64String(digest.digest(usrPwdNonce.getBytes(Constants.UTF_8))); - } catch (UnsupportedEncodingException e) { - throw new SyncmlMessageFormatException("Problem occurred while decoding credentials data.", e); - } catch (NoSuchAlgorithmException e) { - throw new SyncmlMessageFormatException("Application environment does not have an implementation " + - "available/configured for the requested algorithm", e); - } - return usrPwdNonceHash; - } - - public static String generateRST(String username, String password) throws SyncmlMessageFormatException { - MessageDigest digest; - String usrPwdNonceHash; - String nonce; - try { - nonce = new String(Base64.decodeBase64(Constants.INITIAL_NONCE), Constants.UTF_8); - digest = MessageDigest.getInstance(Constants.MD5); - String usrPwd = username + ":" + password; - String usrPwdHash = Base64.encodeBase64String(digest.digest(usrPwd.getBytes(Constants.UTF_8))); - String usrPwdNonce = usrPwdHash + ":" + nonce; - usrPwdNonceHash = Base64.encodeBase64String(digest.digest(usrPwdNonce.getBytes(Constants.UTF_8))); - } catch (UnsupportedEncodingException e) { - throw new SyncmlMessageFormatException("Problem occurred while decoding credentials data.", e); - } catch (NoSuchAlgorithmException e) { - throw new SyncmlMessageFormatException("Application environment does not have an implementation " + - "available/configured for the requested algorithm", e); - } - return usrPwdNonceHash; - } -} 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/SyncmlGenerator.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/SyncmlGenerator.java deleted file mode 100644 index 926ef528b..000000000 --- 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/SyncmlGenerator.java +++ /dev/null @@ -1,107 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlDocument; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlHeader; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlBody; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.*; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.StringWriter; - -/** - * Generates the response syncml xml file that should be sent to the Device. - */ -public class SyncmlGenerator { - - public static String generatePayload(SyncmlDocument syncmlDocument) throws SyncmlOperationException { - Document doc = generateDocument(); - Element rootElement = createRootElement(doc); - SyncmlHeader header = syncmlDocument.getHeader(); - header.buildSyncmlHeaderElement(doc, rootElement); - SyncmlBody body = syncmlDocument.getBody(); - body.buildBodyElement(doc, rootElement); - return transformDocument(doc); - } - - public static Document generateDocument() throws SyncmlOperationException { - DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); - DocumentBuilder docBuilder; - try { - docBuilder = documentFactory.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - throw new SyncmlOperationException("Error occurred while generating a new document of syncml", e); - } - return docBuilder.newDocument(); - } - - private static Element createRootElement(Document document) { - Element rootElement = document.createElementNS(Constants.XMLNS_SYNCML, - Constants.SYNCML_ROOT_ELEMENT_NAME); - document.appendChild(rootElement); - return rootElement; - } - - private static String transformDocument(Document document) throws SyncmlOperationException { - DOMSource domSource = new DOMSource(document); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer; - try { - transformer = transformerFactory.newTransformer(); - } catch (TransformerConfigurationException e) { - throw new SyncmlOperationException("Error occurred while retrieving a new transformer", e); - } - transformer.setOutputProperty(OutputKeys.ENCODING, Constants.UTF_8); - transformer.setOutputProperty(OutputKeys.INDENT, Constants.YES); - - StringWriter stringWriter = new StringWriter(); - StreamResult streamResult = new StreamResult(stringWriter); - try { - transformer.transform(domSource, streamResult); - } catch (TransformerException e) { - throw new SyncmlOperationException("Error occurred while transforming document to a string", e); - } - return stringWriter.toString(); - } -} 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/SyncmlParser.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/SyncmlParser.java deleted file mode 100644 index af5b33977..000000000 --- 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/SyncmlParser.java +++ /dev/null @@ -1,496 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.operations.util; - -import org.apache.juli.logging.Log; -import org.apache.juli.logging.LogFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.EnterpriseApplication; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.*; - -import java.util.ArrayList; -import java.util.List; - -/** - * Parses the receiving SyncML payload and generates the SyncML document object from it. - */ -public class SyncmlParser { - - private static String commandId; - private static String messageReference; - private static String commandReference; - private static final String SYNC_HEADER = "SyncHdr"; - private static final String SYNC_BODY = "SyncBody"; - - private enum SyncMLHeaderParameter { - MSG_ID("MsgID"), - SESSION_ID("SessionID"), - TARGET("Target"), - SOURCE("Source"), - CRED("Cred"); - private final String parameterName; - - SyncMLHeaderParameter(final String parameterName) { - this.parameterName = parameterName; - } - - public String getValue() { - return this.parameterName; - } - } - - private enum SycMLCommandType { - ALERT("Alert"), - REPLACE("Replace"), - STATUS("Status"), - RESULTS("Results"); - private final String commandName; - - SycMLCommandType(final String commandName) { - this.commandName = commandName; - } - - public String getValue() { - return this.commandName; - } - } - - - /** - * Parses the raw SyncML payload and generates a SyncmlDocument object using the parsed XML contents. - * - * @param syncmlPayload - Received SyncML XML payload - * @return - SyncmlDocument object generated from the received payload - */ - public static SyncmlDocument parseSyncmlPayload(Document syncmlPayload) { - SyncmlDocument syncmlDocument = new SyncmlDocument(); - if (syncmlPayload.getElementsByTagName(SYNC_HEADER) == null) { - throw new IllegalStateException(); - } - NodeList syncHeaderList = syncmlPayload.getElementsByTagName(SYNC_HEADER); - Node syncHeader = syncHeaderList.item(0); - SyncmlHeader header = generateSyncmlHeader(syncHeader); - if (syncmlPayload.getElementsByTagName(SYNC_BODY) == null) { - throw new IllegalStateException(); - } - NodeList syncBodyList = syncmlPayload.getElementsByTagName(SYNC_BODY); - Node syncBody = syncBodyList.item(0); - SyncmlBody body = generateSyncmlBody(syncBody); - - syncmlDocument.setHeader(header); - syncmlDocument.setBody(body); - return syncmlDocument; - } - - /** - * Generates SyncmlHeader object by extracting properties of passed XML node. - * - * @param syncHeader - XML node which represents SyncML header - * @return - SyncmlHeader object - */ - private static SyncmlHeader generateSyncmlHeader(Node syncHeader) { - - String sessionID = null; - String messageID = null; - TargetTag target = null; - SourceTag source = null; - CredentialTag credential = null; - SyncmlHeader header = new SyncmlHeader(); - - NodeList headerElements = syncHeader.getChildNodes(); - for (int i = 0; i < headerElements.getLength(); i++) { - Node node = headerElements.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - String nodeName = node.getNodeName(); - - if (SyncMLHeaderParameter.MSG_ID.getValue().equals(nodeName)) { - if (node.getTextContent().trim() == null) { - throw new IllegalStateException(); - } else { - messageID = node.getTextContent().trim(); - } - } else if (SyncMLHeaderParameter.SESSION_ID.getValue().equals(nodeName)) { - if (node.getTextContent().trim() == null) { - throw new IllegalStateException(); - } else { - sessionID = node.getTextContent().trim(); - } - } else if (SyncMLHeaderParameter.TARGET.getValue().equals(nodeName)) { - if (node.getTextContent().trim() == null) { - throw new IllegalStateException(); - } else { - target = generateTarget(node); - } - } else if (SyncMLHeaderParameter.SOURCE.getValue().equals(nodeName)) { - if (node.getTextContent().trim() == null) { - throw new IllegalStateException(); - } else { - source = generateSource(node); - } - } else if (SyncMLHeaderParameter.CRED.getValue().equals(nodeName)) { - if (node.getTextContent().trim() == null) { - throw new IllegalStateException(); - } else { - credential = generateCredential(node); - } - } - } - } - header.setMsgID(Integer.valueOf(messageID)); - // Syncml message contains a sessionID which is Hexadecimal value.Hexadecimal sessionID parse as a integer value. - header.setSessionId(Integer.valueOf(sessionID, 16)); - header.setTarget(target); - header.setSource(source); - header.setCredential(credential); - return header; - } - - /** - * Generates SyncmlBody object by extracting properties of passed XML node. - * - * @param syncBody - XML node which represents SyncML body - * @return - SyncmlBody object - */ - private static SyncmlBody generateSyncmlBody(Node syncBody) { - - AlertTag alert = null; - ReplaceTag replace = null; - ResultsTag results = null; - List status = new ArrayList<>(); - NodeList bodyElements = syncBody.getChildNodes(); - - for (int i = 0; i < bodyElements.getLength(); i++) { - Node node = bodyElements.item(i); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - String nodeName = node.getNodeName(); - - if (SycMLCommandType.ALERT.getValue().equals(nodeName)) { - alert = generateAlert(node); - } else if (SycMLCommandType.REPLACE.getValue().equals(nodeName)) { - replace = generateReplace(node); - } else if (SycMLCommandType.STATUS.getValue().equals(nodeName)) { - status.add(generateStatus(node)); - } else if (SycMLCommandType.RESULTS.getValue().equals(nodeName)) { - results = generateResults(node); - } - } - } - SyncmlBody body = new SyncmlBody(); - body.setAlert(alert); - body.setReplace(replace); - body.setStatus(status); - body.setResults(results); - return body; - } - - /** - * Generates Source object by extracting properties of passed XML node. - * - * @param node - XML node which represents Source - * @return - Source object - */ - private static SourceTag generateSource(Node node) { - - SourceTag source = new SourceTag(); - Node sourceURIItem = node.getChildNodes().item(0); - Node sourceNameItem = node.getChildNodes().item(1); - String sourceURI = null; - String sourceName = null; - - if (sourceURIItem != null) { - sourceURI = sourceURIItem.getTextContent().trim(); - } - if (sourceNameItem != null) { - sourceName = sourceNameItem.getTextContent().trim(); - } - source.setLocURI(sourceURI); - source.setLocName(sourceName); - return source; - } - - /** - * Generates Target object by extracting properties of passed XML node. - * - * @param node - XML node which represents Target - * @return - Target object - */ - private static TargetTag generateTarget(Node node) { - - TargetTag target = new TargetTag(); - Node targetURIItem = node.getChildNodes().item(0); - Node targetNameItem = node.getChildNodes().item(1); - String targetURI = null; - String targetName = null; - - if (targetURIItem != null) { - targetURI = targetURIItem.getTextContent().trim(); - } - if (targetNameItem != null) { - targetName = targetNameItem.getTextContent().trim(); - } - target.setLocURI(targetURI); - target.setLocName(targetName); - return target; - } - - /** - * Generates Results object by extracting properties of passed XML node. - * - * @param node - XML node which represents Results - * @return - Results object - */ - private static ResultsTag generateResults(Node node) { - - ResultsTag results = new ResultsTag(); - List item = new ArrayList<>(); - - if (node.getNodeType() == Node.ELEMENT_NODE) { - - NodeList nodelist = node.getChildNodes(); - - for (int i = 0; i < nodelist.getLength(); i++) { - String nodeName = nodelist.item(i).getNodeName(); - - switch (nodeName) { - case Constants.COMMAND_ID: - commandId = node.getChildNodes().item(i).getTextContent().trim(); - break; - case Constants.MESSAGE_REFERENCE: - messageReference = node.getChildNodes().item(i).getTextContent().trim(); - break; - case Constants.COMMAND_REFERENCE: - commandReference = node.getChildNodes().item(i).getTextContent().trim(); - break; - case Constants.ITEM: - item.add(generateItem(node.getChildNodes().item(i))); - break; - } - } - results.setCommandId(Integer.valueOf(commandId)); - results.setMessageReference(Integer.valueOf(messageReference)); - results.setCommandReference(Integer.valueOf(commandReference)); - results.setItem(item); - } - return results; - } - - /** - * Generates Status object by extracting properties of passed XML node. - * - * @param node - XML node which represents Status - * @return - Status object - */ - private static StatusTag generateStatus(Node node) { - - StatusTag status = new StatusTag(); - for (int x = 0; x < node.getChildNodes().getLength(); x++) { - String nodeName = node.getChildNodes().item(x).getNodeName(); - switch (nodeName) { - case PluginConstants.SyncML.SYNCML_CMD_ID: - String commandId = node.getChildNodes().item(x).getTextContent().trim(); - status.setCommandId(Integer.valueOf(commandId)); - break; - case PluginConstants.SyncML.SYNCML_MESSAGE_REF: - String messageReference = node.getChildNodes().item(x).getTextContent().trim(); - status.setMessageReference(Integer.valueOf(messageReference)); - break; - case PluginConstants.SyncML.SYNCML_CMD_REF: - String commandReference = node.getChildNodes().item(x).getTextContent().trim(); - status.setCommandReference(Integer.valueOf(commandReference)); - break; - case PluginConstants.SyncML.SYNCML_CMD: - String command = node.getChildNodes().item(x).getTextContent().trim(); - status.setCommand(command); - break; - case PluginConstants.SyncML.SYNCML_CHAL: - NodeList childNodes = node.getChildNodes().item(x).getChildNodes(); - MetaTag meta = new MetaTag(); - ChallengeTag challengeTag = new ChallengeTag(); - String format = childNodes.item(0).getFirstChild().getTextContent(); - meta.setFormat(format); - String type = childNodes.item(0).getFirstChild().getNextSibling().getTextContent(); - meta.setType(type); - String nonce = childNodes.item(0).getFirstChild().getNextSibling().getNextSibling().getTextContent(); - meta.setNextNonce(nonce); - challengeTag.setMeta(meta); - status.setChallenge(challengeTag); - break; - case PluginConstants.SyncML.SYNCML_DATA: - String data = node.getChildNodes().item(x).getTextContent().trim(); - status.setData(data); - break; - case PluginConstants.SyncML.SYNCML_TARGET_REF: - String targetReference = node.getChildNodes().item(x).getTextContent().trim(); - status.setTargetReference(targetReference); - break; - } - } - return status; - } - - /** - * Generates Replace object by extracting properties of passed XML node. - * - * @param node - XML node which represents Replace - * @return - Replace object - */ - private static ReplaceTag generateReplace(Node node) { - - ReplaceTag replace = new ReplaceTag(); - String commandId = node.getChildNodes().item(0).getTextContent().trim(); - List items = new ArrayList<>(); - for (int i = 0; i < node.getChildNodes().getLength() - 1; i++) { - items.add(generateItem(node.getChildNodes().item(i + 1))); - } - replace.setCommandId(Integer.valueOf(commandId)); - replace.setItems(items); - return replace; - } - - /** - * Generates Alert object by extracting properties of passed XML node. - * - * @param node - XML node which represents Alert - * @return - Alert object - */ - private static AlertTag generateAlert(Node node) { - AlertTag alert = new AlertTag(); - String commandID = node.getChildNodes().item(0).getTextContent().trim(); - String data = node.getChildNodes().item(1).getTextContent().trim(); - List items = new ArrayList<>(); - for (int i = 1; i < node.getChildNodes().getLength() - 1; i++) { - items.add(generateItem(node.getChildNodes().item(i + 1))); - } - alert.setCommandId(Integer.valueOf(commandID)); - alert.setData(data); - if (!items.isEmpty()) { - alert.setItems(items); - } - return alert; - } - - /** - * Generates Item object by extracting properties of passed XML node. - * - * @param node - XML node which represents Item - * @return - Item object - */ - private static ItemTag generateItem(Node node) { - ItemTag item = new ItemTag(); - SourceTag source = new SourceTag(); - String data; - String nodeName; - String childNodeName; - String locUri; - for (int x = 0; x < node.getChildNodes().getLength(); x++) { - Node itemNode; - itemNode = node.getChildNodes().item(x); - if (itemNode.getNodeName() != null) { - nodeName = node.getChildNodes().item(x).getNodeName(); - } else { - throw new IllegalStateException(); - } - if (PluginConstants.SyncML.SYNCML_SOURCE.equals(nodeName)) { - if (itemNode.getChildNodes().item(x).getNodeName() != null) { - childNodeName = itemNode.getChildNodes().item(x).getNodeName(); - } else { - throw new IllegalStateException(); - } - if ((PluginConstants.SyncML.SYNCML_LOCATION_URI.equals(childNodeName))) { - if (itemNode.getChildNodes().item(x).getTextContent().trim() != null) { - locUri = itemNode.getChildNodes().item(x).getTextContent().trim(); - } else { - throw new IllegalStateException(); - } - source.setLocURI(locUri); - item.setSource(source); - } - } else if (PluginConstants.SyncML.SYNCML_DATA.equals(nodeName)) { - if (itemNode.getTextContent().trim() != null) { - data = itemNode.getTextContent().trim(); - } else { - throw new IllegalStateException(); - } - item.setData(data); - } else if (PluginConstants.SyncML.SYNCML_META.equals(nodeName)) { - MetaTag metaTag = new MetaTag(); - if (itemNode.getChildNodes().item(0) != null) { - metaTag.setType(itemNode.getChildNodes().item(0).getTextContent().trim()); - } - if (itemNode.getChildNodes().item(1) != null) { - metaTag.setFormat(itemNode.getChildNodes().item(1).getTextContent().trim()); - } - item.setMeta(metaTag); - } - } - return item; - } - - /** - * Generates Credential object by extracting properties of passed XML node. - * - * @param node - XML node which represents Credential - * @return - Credential object - */ - private static CredentialTag generateCredential(Node node) { - CredentialTag credential = new CredentialTag(); - MetaTag meta = generateMeta(node.getChildNodes().item(0)); - String data = node.getChildNodes().item(1).getTextContent().trim(); - credential.setMeta(meta); - credential.setData(data); - return credential; - } - - /** - * Generates MetaTag object by extracting properties of passed XML node. - * - * @param node - XML node which represents MetaTag - * @return - MetaTag object - */ - private static MetaTag generateMeta(Node node) { - MetaTag meta = new MetaTag(); - String format = node.getChildNodes().item(0).getTextContent().trim(); - String type = node.getChildNodes().item(1).getTextContent().trim(); - meta.setFormat(format); - meta.setType(type); - return meta; - } -} 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/services/ConfigurationMgtService.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/services/ConfigurationMgtService.java deleted file mode 100644 index 4872e8ba4..000000000 --- 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/services/ConfigurationMgtService.java +++ /dev/null @@ -1,267 +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.services; - -import io.swagger.annotations.SwaggerDefinition; -import io.swagger.annotations.Info; -import io.swagger.annotations.ExtensionProperty; -import io.swagger.annotations.Extension; -import io.swagger.annotations.Tag; -import io.swagger.annotations.Api; -import io.swagger.annotations.AuthorizationScope; -import io.swagger.annotations.Authorization; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; -import io.swagger.annotations.ApiResponse; -import io.swagger.annotations.ApiResponses; -import io.swagger.annotations.ResponseHeader; - -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import javax.jws.WebService; -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Windows Platform Configuration REST-API implementation. - * All end points supports JSON, XMl with content negotiation. - */ - -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "Windows Configuration Management"), - @ExtensionProperty(name = "context", - value = "/api/device-mgt/windows/v1.0/configuration"), - }) - } - ), - tags = { - @Tag(name = "windows,device_management", description = "") - } -) -@Api(value = "Windows Configuration Management", - description = "This carries all the resources related to Windows configurations management functionality") -@WebService -@Path("/configuration") -@Produces({"application/json", "application/xml"}) -@Consumes({"application/json", "application/xml"}) -@Scopes( - scopes = { - @Scope( - name = "Enroll Device", - description = "Register an Windows device", - key = "perm:windows:enroll", - permissions = {"/device-mgt/devices/enroll/windows"} - ), - @Scope( - name = "View Configurations", - description = "Getting Windows Platform Configurations", - key = "perm:windows:view-configuration", - permissions = {"/device-mgt/platform-configurations/view"} - ), - @Scope( - name = "Manage Configurations", - description = "Updating Windows Platform Configurations", - key = "perm:windows:manage-configuration", - permissions = {"/device-mgt/platform-configurations/manage"} - ) - } -) -public interface ConfigurationMgtService { - - @GET - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - httpMethod = "GET", - value = "Getting Windows Platform Configurations", - notes = "Get the Windows platform configuration details using this REST API.", - response = PlatformConfiguration.class, - tags = "Windows Configuration Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:view-configuration") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched Windows platform configuration.", - response = PlatformConfiguration.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource has been modified the last time.\n" + - "Used by caches, or in conditional requests."), - }), - @ApiResponse( - code = 304, - message = "Not Modified. \n Applications can be blacklisted via the application restriction policy too.."), - @ApiResponse( - code = 404, - message = "Not Found. \n Th resource to be deleted does not exist."), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the Windows platform configuration.") - }) - Response getConfiguration(@ApiParam( - name = "If-Modified-Since", - value = "Checks if the requested variant was modified, since the specified date-time.\n" + - "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200", - required = false) @HeaderParam("If-Modified-Since") String ifModifiedSince); - - /** - * Update Tenant Configurations for the specific Device type. - * - * @param configuration Tenant configurations to be updated. - * @return Response message. - * @throws WindowsConfigurationException - */ - @PUT - @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.", - tags = "Windows Configuration Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:manage-configuration") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully updated the Windows platform configurations.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the updated Windows platform configuration."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 404, - message = "Not Found. \n The specified resource does not exist."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while modifying the Windows platform configurations.") - }) - Response updateConfiguration - (@ApiParam( - name = "configuration", - value = "The properties to update the Windows platform configurations.") - PlatformConfiguration configuration) throws WindowsConfigurationException; - - @GET - @Path("license") - @Produces(MediaType.TEXT_PLAIN) - @ApiOperation( - produces = MediaType.TEXT_PLAIN, - httpMethod = "GET", - value = "Getting the License Agreement to Register a Windows Device", - notes = "Use this REST API to retrieve the license agreement that is used for the Windows device " + - "registration process.", - response = String.class, - tags = "Windows Configuration Management", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 200, - message = "OK. \n Successfully fetched Windows license configuration.", - response = String.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests."), - }), - @ApiResponse( - code = 304, - message = "Not Modified. \n Empty body because the client already has the latest version of the requested resource."), - @ApiResponse( - code = 404, - message = "Not Found. \n The specified resource does not exist."), - @ApiResponse( - code = 406, - message = "Not Acceptable.\n The requested media type is not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n Server error occurred while fetching the Windows license configuration.") - }) - Response getLicense( - @ApiParam( - name = "If-Modified-Since", - value = "Checks if the requested variant was modified, since the specified date-time.\n" + - "Provide the value in the following format: EEE, d MMM yyyy HH:mm:ss Z.\n" + - "Example: Mon, 05 Jan 2014 15:10:00 +0200.", - required = false) - @HeaderParam("If-Modified-Since") String ifModifiedSince) throws WindowsConfigurationException; - -} 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/services/DeviceManagementAdminService.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/services/DeviceManagementAdminService.java deleted file mode 100644 index 4d9f40e0d..000000000 --- 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/services/DeviceManagementAdminService.java +++ /dev/null @@ -1,624 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services; - -import io.swagger.annotations.*; - -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.wrapper.EnterpriseApplicationBeanWrapper; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; - -import javax.jws.WebService; -import javax.ws.rs.Consumes; -import javax.ws.rs.HeaderParam; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; - -/** - * Interface for Admin operations persisting. This interface accepts operations added via UI. - */ - - -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", - value = "Windows Device Management Administrative Service"), - @ExtensionProperty(name = "context", - value = "/api/device-mgt/windows/v1.0/admin/devices"), - }) - } - ), - tags = { - @Tag(name = "windows,device_management", description = "") - } -) -@Api(value = "Windows Device Management Administrative Service", - description = "Device management related admin APIs.") -@WebService -@Path("/admin/devices") -@Consumes(MediaType.APPLICATION_JSON) -@Produces(MediaType.APPLICATION_JSON) -@Scopes( - scopes = { - @Scope( - name = "Lock Device", - description = "Adding a Device Lock on Windows devices.", - key = "perm:windows:lock-devices", - permissions = {"/device-mgt/devices/owning-device/operations/windows/lock"} - ), - @Scope( - name = "Un-enroll Device", - description = "Unregister an Windows device", - key = "perm:windows:disenroll", - permissions = {"/device-mgt/devices/owning-device/operations/windows/disenroll"} - ), - @Scope( - name = "Factory Reset", - description = "Factory Resetting Windows Devices", - key = "perm:windows:wipe", - permissions = {"/device-mgt/devices/owning-device/operations/windows/wipe"} - ), - @Scope( - name = "Ring Device", - description = "Ring Windows devices", - key = "perm:windows:ring", - permissions = {"/device-mgt/devices/owning-device/operations/windows/ring"} - ), - @Scope( - name = "Lock Reset", - description = "Lock reset on Windows devices", - key = "perm:windows:lock-reset", - permissions = {"/device-mgt/devices/owning-device/operations/windows/lock-reset"} - ), - @Scope( - name = "Reboot", - description = "Lock reset on Windows devices", - key = "perm:windows:reboot", - permissions = {"/device-mgt/devices/owning-device/operations/windows/reboot"} - ), - @Scope( - name = "Device Location", - description = "Lock reset on Windows devices", - key = "perm:windows:location", - permissions = {"/device-mgt/devices/owning-device/operations/windows/location"} - ), - @Scope( - name = "Install Enterprise Application", - description = "Installing an Enterprise Application", - key = "perm:windows:enterprise-app", - permissions = {"/device-mgt/devices/owning-device/operations/windows/enterprise-application"} - ) - } -) -public interface DeviceManagementAdminService { - - @POST - @Path("/lock-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Adding a Device Lock on Windows devices.", - notes = "Using this API you have the option of Device Windows device.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-devices") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the device lock operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified. \n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while locking the device.") - }) - Response lock(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the AWindows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/disenroll-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Dis-enrol the windows Devices", - notes = "Dis-enroll on Android devices", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:disenroll") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the Dis-enroll operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified the last time.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a Dis-enroll operation.") - }) - Response disenroll(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/wipe-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - produces = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Factory Resetting an Windows Device", - notes = "Factory rest or erase all the data stored on the Windows devices" + - "to restore them back to the original system.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:wipe") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the Data wipe operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified." + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding the Data wipe operation.")}) - Response wipe(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/ring-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Ringing Windows Devices", - notes = "Ring Windows devices.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:ring") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the device ring operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a new device ring operation.") - }) - Response ring(@HeaderParam("Accept") String headerParam, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/lock-reset-devices") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Lock reset on Windows devices", - notes = "Lock reset on Windows devices.Its use to reset the device pass code", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:lock-reset") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the lock-reset operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding adding a lock-reset operation.") - }) - Response lockReset(@HeaderParam("Accept") String acceptHeader, @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the A Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIds) throws WindowsDeviceEnrolmentException; - - @POST - @Path("/location") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Requesting Location Coordinates", - responseContainer = "List", - notes = "Request location coordinates of Windows devices. \n" + - "Example: In situations where you have lost your device and need to find out where it is, " + - "you can use this REST API to get the location of the device.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:location") - }) - - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Get-location operation has successfully been scheduled", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the " + - "scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the" + - " location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding a new get-location operation.")}) - Response getDeviceLocation( - @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) - List deviceIDs); - - @POST - @Path("/reboot") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Rebooting Windows Devices", - notes = "Reboot or restart your Windows devices.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:reboot") - }) - - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully scheduled the device reboot operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding the new device reboot operation.") - }) - Response rebootDevice( - @ApiParam( - name = "deviceIDs", - value = "Provide the ID of the Android device. Multiple device IDs can be added using comma separated values. ", - required = true) - List deviceIDs); - - - @POST - @Path("/enterprise-application") - @ApiOperation( - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Installing an Enterprise Application", - notes = "Install an enterprise application on Windows devices.", - response = Activity.class, - tags = "Windows Device Management Administrative Service", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enterprise-app") - }) - } - ) - @ApiResponses(value = { - @ApiResponse( - code = 201, - message = "Created. \n Successfully added Enterprise application operation.", - response = Activity.class, - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "URL of the activity instance that refers to the scheduled operation."), - @ResponseHeader( - name = "Content-Type", - description = "Content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.")}), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.\n", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported.\n"), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while adding the enterprise application operation.") - }) - Response installEnterpriseApplication( - @ApiParam( - name = "enterpriseApplicationBeanWrapper", - value = "Enterprise application configuration and Device IDs", - required = true) - EnterpriseApplicationBeanWrapper enterpriseApplicationBeanWrapper); -} - 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/services/DeviceManagementService.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/services/DeviceManagementService.java deleted file mode 100644 index 73cc46b88..000000000 --- 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/services/DeviceManagementService.java +++ /dev/null @@ -1,61 +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.services; - -import org.w3c.dom.Document; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - - -/** - * Interface for Windows 10 Device management phase. - */ -@Path("/devicemgt") -@Scopes( - scopes = { - @Scope( - name = "Pending operations", - description = "Register an Windows device", - key = "perm:windows:enroll", - permissions = {"/device-mgt/devices/enroll/windows"} - ) - } -) -public interface DeviceManagementService { - @Path("/pending-operations") - @POST - @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) - @Produces(PluginConstants.SYNCML_MEDIA_TYPE) - 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/device/mgt/mobile/windows/api/services/authbst/BSTProvider.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/services/authbst/BSTProvider.java deleted file mode 100644 index 0fbb93df0..000000000 --- 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/services/authbst/BSTProvider.java +++ /dev/null @@ -1,130 +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.services.authbst; - -import io.swagger.annotations.*; - -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; - -import javax.jws.WebService; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Interface for handling authentication request comes via MDM login page. - */ - -@SwaggerDefinition( - info = @Info( - version = "1.0.0", - title = "", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = "name", value = "Windows Binary Security Token Service"), - @ExtensionProperty(name = "context", - value = "/api/device-mgt/windows/v1.0/federated"), - }) - } - ), - tags = { - @Tag(name = "windows,device_management", description = "") - } -) -@Api(value = "Windows Binary Security Token Service", - description = "This carries all the resources related to Windows Binary security token management.") -@WebService -@Path("/bst") -@Produces({"application/json", "application/xml"}) -@Consumes({"application/json", "application/xml"}) -@Scopes( - scopes = { - @Scope( - name = "Enroll Device", - description = "Register Windows device", - key = "perm:windows:enroll", - permissions = {"/device-mgt/devices/enroll/windows"} - ) - } -) -public interface BSTProvider { - - @POST - @Consumes(MediaType.APPLICATION_JSON) - @Path("/authentication") - @ApiOperation( - produces = MediaType.APPLICATION_JSON, - consumes = MediaType.APPLICATION_JSON, - httpMethod = "POST", - value = "Getting Binary security token.", - notes = "Using this API to fetch Binary security token to call window enrollment and policy endpoints.", - tags = "BST Provider", - extensions = { - @Extension(properties = { - @ExtensionProperty(name = Constants.SCOPE, value = "perm:windows:enroll") - }) - } - ) - @ApiResponses( - value = { - @ApiResponse(code = 200, message = "Ok. \n Successfully fetching the binary security token.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The URL of the added policy."), - @ResponseHeader( - name = "Content-Type", - description = "The content type of the body"), - @ResponseHeader( - name = "ETag", - description = "Entity Tag of the response resource.\n" + - "Used by caches, or in conditional requests."), - @ResponseHeader( - name = "Last-Modified", - description = "Date and time the resource was last modified.\n" + - "Used by caches, or in conditional requests.") - }), - @ApiResponse( - code = 303, - message = "See Other. \n The source can be retrieved from the URL specified in the location header.", - responseHeaders = { - @ResponseHeader( - name = "Content-Location", - description = "The Source URL of the document.")}), - @ApiResponse( - code = 400, - message = "Bad Request. \n Invalid request or validation error."), - @ApiResponse( - code = 415, - message = "Unsupported media type. \n The format of the requested entity was not supported."), - @ApiResponse( - code = 500, - message = "Internal Server Error. \n " + - "Server error occurred while fetching Binary security token.") - }) - 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/device/mgt/mobile/windows/api/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/device/mgt/mobile/windows/api/services/authbst/beans/Credentials.java deleted file mode 100644 index 3444b141c..000000000 --- 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/services/authbst/beans/Credentials.java +++ /dev/null @@ -1,90 +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.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; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * This bean class is for credentials coming from wab page at federated authentication step. - */ -@XmlRootElement(name = "credentials") -@XmlAccessorType(XmlAccessType.FIELD) -public class Credentials { - - @XmlElement(required = true, name = "username") - private String username; - @XmlElement(required = true, name = "email") - private String email; - @XmlElement(required = true, name = "password") - private String password; - @XmlElement(required = true, name = "ownership") - private String ownership; - @XmlElement(required = true, name = "token") - private String usertoken; - - public Credentials() { - - } - - public String getUsertoken() { - return usertoken; - } - - public void setUsertoken(String usertoken) { - this.usertoken = usertoken; - } - - public String getOwnership() { - return ownership; - } - - public void setOwnership(String ownership) { - this.ownership = ownership; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public void setUsername(String username) { - this.username = username; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getUsername() { - return username; - } - - public String getPassword() { - return password; - } -} 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/services/authbst/impl/BSTProviderImpl.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/services/authbst/impl/BSTProviderImpl.java deleted file mode 100644 index 2961acadb..000000000 --- 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/services/authbst/impl/BSTProviderImpl.java +++ /dev/null @@ -1,114 +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.services.authbst.impl; - -import org.apache.commons.codec.binary.Base64; -import org.json.JSONException; -import org.json.JSONObject; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.Token; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.AuthenticationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.BSTProvider; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.authbst.beans.Credentials; -import org.wso2.carbon.user.api.UserRealm; -import org.wso2.carbon.user.api.UserStoreException; -import org.wso2.carbon.user.core.service.RealmService; -import org.wso2.carbon.utils.multitenancy.MultitenantConstants; - -import javax.ws.rs.core.Response; - -/** - * Implementation class of BSTProvider interface which authenticates the credentials comes via MDM login page. - */ -public class BSTProviderImpl implements BSTProvider { - - /** - * This method validates the device user, checking passed credentials and returns the corresponding - * binary security token which is used in XCEP and WSTEP stages for authentication. - * - * @param credentials - Credential object passes from the wab page. - * @return - Response with binary security token. - */ - @Override - public Response getBST(Credentials credentials) throws WindowsDeviceEnrolmentException { - - String domainUser = credentials.getUsername(); - String userToken = credentials.getUsertoken(); - String encodedToken; - try { - Token tokenBean = new Token(); - tokenBean.setChallengeToken(userToken); - Base64 base64 = new Base64(); - encodedToken = base64.encodeToString(userToken.getBytes()); - DeviceUtil.persistChallengeToken(encodedToken, null, domainUser); - JSONObject tokenContent = new JSONObject(); - tokenContent.put("UserToken", userToken); - return Response.ok().entity(tokenContent.toString()).build(); - } catch (JSONException e) { - throw new WindowsDeviceEnrolmentException( - "Failure occurred in generating Json payload for challenge token.", e); - } - } - - /** - * This method authenticate the user checking the carbon default user store. - * - * @param username - Username in username token - * @param password - Password in username token - * @param tenantDomain - Tenant domain is extracted from the username - * @return - Returns boolean representing authentication result - * @throws AuthenticationException - */ - private boolean authenticate(String username, String password, String tenantDomain) throws - AuthenticationException { - - try { - PrivilegedCarbonContext.startTenantFlow(); - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME); - ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID); - RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null); - - if (realmService == null) { - throw new AuthenticationException("RealmService not initialized."); - } - - int tenantId; - if (tenantDomain == null || tenantDomain.trim().isEmpty()) { - tenantId = MultitenantConstants.SUPER_TENANT_ID; - } else { - tenantId = realmService.getTenantManager().getTenantId(tenantDomain); - } - - if (tenantId == MultitenantConstants.INVALID_TENANT_ID) { - throw new AuthenticationException("Invalid tenant domain " + tenantDomain); - } - UserRealm userRealm = realmService.getTenantUserRealm(tenantId); - - return userRealm.getUserStoreManager().authenticate(username, password); - } catch (UserStoreException e) { - throw new AuthenticationException("User store is not initialized.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - -} 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/services/discovery/DiscoveryService.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/services/discovery/DiscoveryService.java deleted file mode 100644 index d271d9892..000000000 --- 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/services/discovery/DiscoveryService.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.services.discovery; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryRequest; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryResponse; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.ws.rs.POST; -import javax.xml.ws.BindingType; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.soap.SOAPBinding; - -/** - * Interface for Discovery service related operations. - */ - -@WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE, - name = "IDiscoveryService") -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public interface DiscoveryService { - @POST - - @RequestWrapper(localName = "Discover", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - @WebMethod(operationName = "Discover") - @ResponseWrapper(localName = "DiscoverResponse", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - void discover( - @WebParam(name = "request", targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - DiscoveryRequest request, - @WebParam(mode = WebParam.Mode.OUT, name = "DiscoverResult", - targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE) - javax.xml.ws.Holder response - ) throws WindowsDeviceEnrolmentException; - -} \ 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/device/mgt/mobile/windows/api/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/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryRequest.java deleted file mode 100644 index d6e3a185e..000000000 --- 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/services/discovery/beans/DiscoveryRequest.java +++ /dev/null @@ -1,98 +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.services.discovery.beans; - -import javax.xml.bind.annotation.*; -import java.io.Serializable; -import java.util.List; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "DiscoveryRequest", namespace = "http://schemas.microsoft.com/windows/management/2012/01/enrollment") -@SuppressWarnings("unused") -public class DiscoveryRequest implements Serializable { - - @XmlElement(name = "EmailAddress", required = true) - private String emailId; - - @XmlElement(name = "RequestVersion") - private String version; - - @XmlElement(name = "DeviceType") - private String deviceType; - - @XmlElement(name = "OSEdition") - private String osEdition; - - @XmlElement(name = "ApplicationVersion") - private String applicationVersion; - - @XmlElementWrapper(name = "AuthPolicies") - @XmlElement(name = "AuthPolicy", required = true) - private List authenticationPolicies; - - public String getEmailId() { - return emailId; - } - - public void setEmailId(String emailId) { - this.emailId = emailId; - } - - public String getVersion() { - return version; - } - - public void setVersion(String version) { - this.version = version; - } - - public String getDeviceType() { - return deviceType; - } - - public void setDeviceType(String deviceType) { - this.deviceType = deviceType; - } - - public List getAuthenticationPolicies() { - return authenticationPolicies; - } - - public void setAuthenticationPolicies(List authenticationPolicies) { - this.authenticationPolicies = authenticationPolicies; - } - - public String getOsEdition() { - return osEdition; - } - - public void setOsEdition(String osEdition) { - this.osEdition = osEdition; - } - - public String getApplicationVersion() { - return applicationVersion; - } - - public void setApplicationVersion(String applicationVersion) { - this.applicationVersion = applicationVersion; - } - - -} 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/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/device/mgt/mobile/windows/api/services/discovery/beans/DiscoveryResponse.java deleted file mode 100644 index 10a124b06..000000000 --- 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/services/discovery/beans/DiscoveryResponse.java +++ /dev/null @@ -1,87 +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.services.discovery.beans; - -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") -public class DiscoveryResponse implements Serializable { - - @XmlElement(name = "AuthPolicy") - private String authPolicy; - - @XmlElement(name = "EnrollmentPolicyServiceUrl") - private String enrollmentPolicyServiceUrl; - - @XmlElement(name = "EnrollmentServiceUrl") - private String enrollmentServiceUrl; - - @XmlElement(name = "AuthenticationServiceUrl") - private String authenticationServiceUrl; - - @XmlElement(name = "EnrollmentVersion") - private String enrollmentVersion; - - public void setAuthenticationServiceUrl(String authenticationServiceUrl) { - this.authenticationServiceUrl = authenticationServiceUrl; - } - - public String getAuthenticationServiceUrl() { - return authenticationServiceUrl; - } - - public String getAuthPolicy() { - return authPolicy; - } - - public String getEnrollmentPolicyServiceUrl() { - return enrollmentPolicyServiceUrl; - } - - public String getEnrollmentServiceUrl() { - return enrollmentServiceUrl; - } - - public void setAuthPolicy(String authPolicy) { - this.authPolicy = authPolicy; - } - - public void setEnrollmentPolicyServiceUrl(String enrollmentPolicyServiceUrl) { - this.enrollmentPolicyServiceUrl = enrollmentPolicyServiceUrl; - } - - public void setEnrollmentServiceUrl(String enrollmentServiceUrl) { - this.enrollmentServiceUrl = enrollmentServiceUrl; - } - - public String getEnrollmentVersion() { - return enrollmentVersion; - } - - public void setEnrollmentVersion(String enrollmentVersion) { - this.enrollmentVersion = enrollmentVersion; - } - -} \ 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/device/mgt/mobile/windows/api/services/discovery/beans/package-info.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/services/discovery/beans/package-info.java deleted file mode 100644 index 2403a0ab5..000000000 --- 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/services/discovery/beans/package-info.java +++ /dev/null @@ -1,22 +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. - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = - "http://schemas.microsoft.com/windows/management/2012/01/enrollment", - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans; 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/services/discovery/impl/DiscoveryServiceImpl.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/services/discovery/impl/DiscoveryServiceImpl.java deleted file mode 100644 index 57ee7a6f7..000000000 --- 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/services/discovery/impl/DiscoveryServiceImpl.java +++ /dev/null @@ -1,134 +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.services.discovery.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.DiscoveryService; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryRequest; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.beans.DiscoveryResponse; - -import javax.jws.WebService; -import javax.xml.ws.BindingType; -import javax.xml.ws.Holder; -import javax.xml.ws.soap.Addressing; -import javax.xml.ws.soap.SOAPBinding; -import java.util.List; - -/** - * Implementation class of Discovery Request. This class implements the first two services - * of device enrolment stage. - */ -@WebService(endpointInterface = PluginConstants.DISCOVERY_SERVICE_ENDPOINT, targetNamespace = PluginConstants - .DISCOVERY_SERVICE_TARGET_NAMESPACE) -@Addressing(enabled = true, required = true) -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public class DiscoveryServiceImpl implements DiscoveryService { - - public static final String FEDERATED = "Federated"; - private static final String DELIMITER = "@"; - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.discovery.impl.DiscoveryServiceImpl.class); - - /** - * This method returns the OnPremise AuthPolicy and next two endpoint the mobile device should - * call if this response to received successfully at the device end. This method is called by - * device immediately after the first GET method calling for the same endpoint. - * - * @param discoveryRequest - Request bean comes via mobile phone - * @param response - DiscoveryResponse bean for response - */ - @Override - public void discover(DiscoveryRequest discoveryRequest, Holder response) - throws WindowsDeviceEnrolmentException { - - String emailId = discoveryRequest.getEmailId(); - String[] userDomains = emailId.split(DELIMITER); - String domain = userDomains[(userDomains.length)-1]; - DiscoveryResponse discoveryResponse; - - if (!PluginConstants.WindowsVersionProperties.REQUESTED_WIN81_VERSION.equals(discoveryRequest.getVersion()) - && FEDERATED.equals(getAuthPolicy())) { - discoveryResponse = new DiscoveryResponse(); - discoveryResponse.setAuthPolicy(FEDERATED); - discoveryResponse.setEnrollmentVersion(PluginConstants.WindowsVersionProperties.REQUESTED_WIN10_VERSION); - discoveryResponse.setEnrollmentPolicyServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery. - CERTIFICATE_ENROLLMENT_POLICY_SERVICE_URL); - discoveryResponse.setEnrollmentServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery. - ENROLLMENT_SERVICE_URL); - discoveryResponse.setAuthenticationServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery.WAB_URL); - } else { - discoveryResponse = new DiscoveryResponse(); - discoveryResponse.setAuthPolicy(FEDERATED); - discoveryResponse.setEnrollmentPolicyServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery. - CERTIFICATE_ENROLLMENT_POLICY_SERVICE_URL); - discoveryResponse.setEnrollmentServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery. - CERTIFICATE_ENROLLMENT_SERVICE_URL); - discoveryResponse.setAuthenticationServiceUrl(PluginConstants.Discovery.DEVICE_ENROLLMENT_SUBDOMAIN + - domain + PluginConstants.Discovery.WAB_URL); - } - response.value = discoveryResponse; - if (log.isDebugEnabled()) { - log.debug("Discovery service end point was triggered via POST method"); - } - } - - /** - * Get authentication policy from the tenant configuration, otherwise set default value as Federated. - * - * @return Authentication policy. - * @throws WindowsDeviceEnrolmentException - */ - public String getAuthPolicy() throws WindowsDeviceEnrolmentException { - String authPolicy = null; - List tenantConfigurations; - try { - if (WindowsAPIUtils.getTenantConfigurationData() != null) { - tenantConfigurations = WindowsAPIUtils.getTenantConfigurationData(); - - for (ConfigurationEntry configurationEntry : tenantConfigurations) { - if (PluginConstants.TenantConfigProperties.AUTH_POLICY.equals(configurationEntry.getName())) { - authPolicy = configurationEntry.getValue().toString(); - } else { - authPolicy = PluginConstants.TenantConfigProperties.DEFAULT_AUTH_POLICY; - } - } - } else { - authPolicy = PluginConstants.TenantConfigProperties.DEFAULT_AUTH_POLICY; - String msg = "Tenant configurations are not initialized yet."; - log.error(msg); - } - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting tenant configurations."; - log.error(msg); - throw new WindowsDeviceEnrolmentException(msg, e); - } - return authPolicy; - } -} 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/services/enrollment/EnrollmentService.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/services/enrollment/EnrollmentService.java deleted file mode 100644 index 5f4f14573..000000000 --- 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/services/enrollment/EnrollmentService.java +++ /dev/null @@ -1,63 +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.services.enrollment; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.AdditionalContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.RequestSecurityTokenResponse; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.ws.rs.POST; -import javax.xml.ws.BindingType; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.soap.SOAPBinding; -import java.io.UnsupportedEncodingException; - -@WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "enrollment") -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public interface EnrollmentService { - - @RequestWrapper(localName = "RequestSecurityToken", targetNamespace = PluginConstants - .WS_TRUST_TARGET_NAMESPACE) - @WebMethod(operationName = "RequestSecurityToken") - @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = - PluginConstants.WS_TRUST_TARGET_NAMESPACE) - @POST - void requestSecurityToken( - @WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String tokenType, - @WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String requestType, - @WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants - .WS_SECURITY_TARGET_NAMESPACE) - String binarySecurityToken, - @WebParam(name = "AdditionalContext", targetNamespace = PluginConstants - .SOAP_AUTHORIZATION_TARGET_NAMESPACE) - AdditionalContext additionalContext, - @WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse", - targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - javax.xml.ws.Holder response) throws - WindowsDeviceEnrolmentException, UnsupportedEncodingException, - WAPProvisioningException; -} 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/services/enrollment/beans/AdditionalContext.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/services/enrollment/beans/AdditionalContext.java deleted file mode 100644 index fd62ef2ca..000000000 --- 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/services/enrollment/beans/AdditionalContext.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.device.mgt.mobile.windows.api.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -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.util.ArrayList; -import java.util.List; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OIDCollection", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE, - propOrder = {"contextitem"}) -@SuppressWarnings("unused") -public class AdditionalContext { - - @XmlElement(name = "ContextItem", required = true, - namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE) - - protected List contextitem; - - public List getcontextitem() { - if (contextitem == null) { - contextitem = new ArrayList(); - } - return this.contextitem; - } -} - 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/services/enrollment/beans/BinarySecurityToken.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/services/enrollment/beans/BinarySecurityToken.java deleted file mode 100644 index cf3d3bd5f..000000000 --- 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/services/enrollment/beans/BinarySecurityToken.java +++ /dev/null @@ -1,63 +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.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.*; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "BinarySecurityToken", namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE, - propOrder = {"ValueType", "EncodingType"}) -@SuppressWarnings("unused") -public class BinarySecurityToken { - - @XmlAttribute(name = "ValueType") - protected String ValueType; - @XmlAttribute(name = "EncodingType") - protected String EncodingType; - @XmlValue - protected String Token; - - public void setValueType(String valuetype) { - this.ValueType = valuetype; - } - - public String getValueType() { - return this.ValueType; - } - - public void setEncodingType(String encodingtype) { - this.EncodingType = encodingtype; - } - - public String getEncodingType() { - return this.EncodingType; - } - - public void setToken(String token) { - this.Token = token; - } - - public String getToken() { - return this.Token; - } - -} - 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/services/enrollment/beans/ContextItem.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/services/enrollment/beans/ContextItem.java deleted file mode 100644 index 8c5cfd482..000000000 --- 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/services/enrollment/beans/ContextItem.java +++ /dev/null @@ -1,53 +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.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.*; - -@XmlRootElement -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ContextItem", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE, - propOrder = {"Value"}) -public class ContextItem { - - @XmlAttribute(name = "Name") - protected String Name; - @XmlElement(name = "Value", required = true, - namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE) - protected String Value; - - public String getValue() { - return Value; - } - - public void setValue(String value) { - Value = value; - } - - public String getName() { - return Name; - } - - public void setName(String name) { - Name = name; - } - -} 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/services/enrollment/beans/RequestSecurityToken.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/services/enrollment/beans/RequestSecurityToken.java deleted file mode 100644 index ebd90792d..000000000 --- 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/services/enrollment/beans/RequestSecurityToken.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.device.mgt.mobile.windows.api.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RequestedSecurityToken", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"binarySecurityToken"}) -@SuppressWarnings("unused") -public class RequestSecurityToken { - - @XmlElement(name = "BinarySecurityToken", required = true, - namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE) - - protected BinarySecurityToken binarySecurityToken; - - public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { - this.binarySecurityToken = binarysecuritytoken; - } -} \ 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/device/mgt/mobile/windows/api/services/enrollment/beans/RequestSecurityTokenResponse.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/services/enrollment/beans/RequestSecurityTokenResponse.java deleted file mode 100644 index 9f1b0c3c8..000000000 --- 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/services/enrollment/beans/RequestSecurityTokenResponse.java +++ /dev/null @@ -1,82 +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.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -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 = "RequestSecurityTokenResponse", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"TokenType", "DispositionMessage", "RequestedSecurityToken", "RequestID"}) -@SuppressWarnings("unused") -public class RequestSecurityTokenResponse implements Serializable { - - @XmlElement(name = "TokenType", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - private String TokenType; - - // Windows 10 property - @XmlElement(name = "DispositionMessage", namespace = PluginConstants.ENROLLMENT_POLICY_TARGET_NAMESPACE) - private String DispositionMessage; - - @XmlElement(name = "RequestedSecurityToken", required = true, - namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - private org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.RequestedSecurityToken RequestedSecurityToken; - - @XmlElement(name = "RequestID", namespace = PluginConstants.ENROLLMENT_POLICY_TARGET_NAMESPACE) - private int RequestID; - - public String getTokenType() { - return TokenType; - } - - public void setTokenType(String tokenType) { - TokenType = tokenType; - } - - public org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.RequestedSecurityToken getRequestedSecurityToken() { - return RequestedSecurityToken; - } - - public void setRequestedSecurityToken(org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.RequestedSecurityToken - requestedSecurityToken) { - RequestedSecurityToken = requestedSecurityToken; - } - - public int getRequestID() { - return RequestID; - } - - public void setRequestID(int requestID) { - RequestID = requestID; - } - - public String getDispositionMessage() { - return DispositionMessage; - } - - public void setDispositionMessage(String dispositionMessage) { - DispositionMessage = dispositionMessage; - } - -} \ 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/device/mgt/mobile/windows/api/services/enrollment/beans/RequestedSecurityToken.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/services/enrollment/beans/RequestedSecurityToken.java deleted file mode 100644 index 56f1ec571..000000000 --- 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/services/enrollment/beans/RequestedSecurityToken.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.device.mgt.mobile.windows.api.services.enrollment.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RequestedSecurityToken", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"binarySecurityToken"}) -public class RequestedSecurityToken { - - @XmlElement(name = "BinarySecurityToken", required = true, - namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE) - - protected BinarySecurityToken binarySecurityToken; - - public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { - this.binarySecurityToken = binarysecuritytoken; - } -} - 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/services/enrollment/beans/package-info.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/services/enrollment/beans/package-info.java deleted file mode 100644 index 3ad6ec1b2..000000000 --- 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/services/enrollment/beans/package-info.java +++ /dev/null @@ -1,27 +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. - */ - -@XmlSchema(namespace = "http://www.w3.org/2003/05/soap-envelope", - xmlns = { - @XmlNs(prefix = "", namespaceURI = "http://www.w3.org/2003/05/soap-envelope") - }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans; - -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlSchema; \ 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/device/mgt/mobile/windows/api/services/enrollment/impl/EnrollmentServiceImpl.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/services/enrollment/impl/EnrollmentServiceImpl.java deleted file mode 100644 index 0ddb484c7..000000000 --- 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/services/enrollment/impl/EnrollmentServiceImpl.java +++ /dev/null @@ -1,451 +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.services.enrollment.impl; - -import com.google.gson.Gson; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.cxf.headers.Header; -import org.apache.cxf.helpers.CastUtils; -import org.apache.cxf.jaxws.context.WrappedMessageContext; -import org.apache.cxf.message.Message; -import org.w3c.dom.*; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementServiceImpl; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.*; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.CertificateGenerationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlCredentialUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.EnrollmentService; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.enrollment.beans.*; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.WindowsDevice; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; -import org.xml.sax.SAXException; - -import javax.annotation.Resource; -import javax.jws.WebService; -import javax.servlet.ServletContext; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.ws.BindingType; -import javax.xml.ws.Holder; -import javax.xml.ws.WebServiceContext; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.soap.Addressing; -import javax.xml.ws.soap.SOAPBinding; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.io.UnsupportedEncodingException; -import java.security.cert.CertificateEncodingException; -import java.security.cert.X509Certificate; -import java.util.ArrayList; -import java.util.List; - - -/** - * Implementation class of Windows10 Enrollment process. - */ -@WebService(endpointInterface = PluginConstants.ENROLLMENT_SERVICE_ENDPOINT, - targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE) -@Addressing(enabled = true, required = true) -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public class EnrollmentServiceImpl implements EnrollmentService { - private static Log log = LogFactory.getLog(EnrollmentServiceImpl.class); - private String pollingFrequency; - private String provisioningURL; - private String domain; - - @Resource - private WebServiceContext context; - - @Override - public void requestSecurityToken(String tokenType, String requestType, String binarySecurityToken, - AdditionalContext additionalContext, - Holder response) - throws WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException { - String headerBinarySecurityToken = null; - String headerTo = null; - String encodedWap; - List
headers = getHeaders(); - for (Header headerElement : headers) { - String nodeName = headerElement.getName().getLocalPart(); - if (PluginConstants.SECURITY.equals(nodeName)) { - Element element = (Element) headerElement.getObject(); - headerBinarySecurityToken = element.getFirstChild().getFirstChild().getTextContent(); - } - if (PluginConstants.TO.equals(nodeName)) { - Element toElement = (Element) headerElement.getObject(); - headerTo = toElement.getFirstChild().getTextContent(); - } - } - try { - enrollDevice(additionalContext, headerBinarySecurityToken); - } catch (DeviceManagementException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while enrolling the device."); - } catch (PolicyManagementException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while enforcing windows policies."); - } - String[] splitEmail = headerTo.split("(/ENROLLMENTSERVER)"); - String email = splitEmail[PluginConstants.CertificateEnrolment.EMAIL_SEGMENT]; - - String[] splitDomain = email.split("(EnterpriseEnrollment.)"); - domain = splitDomain[PluginConstants.CertificateEnrolment.DOMAIN_SEGMENT]; - provisioningURL = PluginConstants.CertificateEnrolment.ENROLL_SUBDOMAIN + domain + - PluginConstants.CertificateEnrolment.SYNCML_PROVISIONING_WIN10_SERVICE_URL; - - List tenantConfigurations; - try { - if ((tenantConfigurations = WindowsAPIUtils.getTenantConfigurationData()) != null) { - for (ConfigurationEntry configurationEntry : tenantConfigurations) { - if ((PluginConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals( - configurationEntry.getName()))) { - pollingFrequency = configurationEntry.getValue().toString(); - } else { - pollingFrequency = PluginConstants.TenantConfigProperties.DEFAULT_FREQUENCY; - } - } - } else { - pollingFrequency = PluginConstants.TenantConfigProperties.DEFAULT_FREQUENCY; - String msg = "Tenant configurations are not initialized yet."; - log.error(msg); - } - ServletContext ctx = (ServletContext) context.getMessageContext(). - get(MessageContext.SERVLET_CONTEXT); - File wapProvisioningFile = (File) ctx.getAttribute(PluginConstants.CONTEXT_WAP_PROVISIONING_FILE); - if (log.isDebugEnabled()) { - log.debug("Received CSR from Device:" + binarySecurityToken); - } - - String wapProvisioningFilePath = wapProvisioningFile.getPath(); - RequestSecurityTokenResponse requestSecurityTokenResponse = new RequestSecurityTokenResponse(); - requestSecurityTokenResponse.setTokenType(PluginConstants.CertificateEnrolment.TOKEN_TYPE); - - encodedWap = prepareWapProvisioningXML(binarySecurityToken, wapProvisioningFilePath, - headerBinarySecurityToken); - RequestedSecurityToken requestedSecurityToken = new RequestedSecurityToken(); - BinarySecurityToken binarySecToken = new BinarySecurityToken(); - binarySecToken.setValueType(PluginConstants.CertificateEnrolment.VALUE_TYPE); - binarySecToken.setEncodingType(PluginConstants.CertificateEnrolment.ENCODING_TYPE); - binarySecToken.setToken(encodedWap); - requestedSecurityToken.setBinarySecurityToken(binarySecToken); - requestSecurityTokenResponse.setRequestedSecurityToken(requestedSecurityToken); - requestSecurityTokenResponse.setRequestID(PluginConstants.CertificateEnrolment.REQUEST_ID); - response.value = requestSecurityTokenResponse; - } catch (CertificateGenerationException e) { - String msg = "Problem occurred while generating certificate."; - log.error(msg, e); - throw new WindowsDeviceEnrolmentException(msg, e); - } catch (WAPProvisioningException e) { - String msg = "Problem occurred while generating wap-provisioning file."; - log.error(msg, e); - throw new WindowsDeviceEnrolmentException(msg, e); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting tenant configurations."; - log.error(msg); - throw new WindowsDeviceEnrolmentException(msg, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - - } - } - - /** - * Method used to Convert the Document object into a String. - * - * @param document - Wap provisioning XML document - * @return - String representation of wap provisioning XML document - * @throws TransformerException - */ - private String convertDocumentToString(Document document) throws TransformerException { - DOMSource DOMSource = new DOMSource(document); - StringWriter stringWriter = new StringWriter(); - StreamResult streamResult = new StreamResult(stringWriter); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - transformer.transform(DOMSource, streamResult); - return stringWriter.toString(); - } - - /** - * This method prepares the wap-provisioning file by including relevant certificates etc. - * - * @param binarySecurityToken - CSR from device - * @param wapProvisioningFilePath - File path of wap-provisioning file - * @return - base64 encoded final wap-provisioning file as a String - * @throws CertificateGenerationException - * @throws org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException - */ - private String prepareWapProvisioningXML(String binarySecurityToken, String wapProvisioningFilePath, - String headerBst) throws CertificateGenerationException, - WAPProvisioningException, - WindowsDeviceEnrolmentException { - String rootCertEncodedString; - String signedCertEncodedString; - X509Certificate signedCertificate; - String provisioningXmlString; - CertificateManagementServiceImpl certMgtServiceImpl = CertificateManagementServiceImpl.getInstance(); - Base64 base64Encoder = new Base64(); - try { - X509Certificate rootCACertificate = (X509Certificate) certMgtServiceImpl.getCACertificate(); - rootCertEncodedString = base64Encoder.encodeAsString(rootCACertificate.getEncoded()); - - signedCertificate = certMgtServiceImpl.getSignedCertificateFromCSR(binarySecurityToken); - signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); - - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - domFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - DocumentBuilder builder; - - builder = domFactory.newDocumentBuilder(); - Document document = builder.parse(wapProvisioningFilePath); - NodeList wapParm = document.getElementsByTagName(PluginConstants.CertificateEnrolment.PARM); - Node caCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment.CA_CERTIFICATE_POSITION); - - //Adding SHA1 CA certificate finger print to wap-provisioning xml. - caCertificatePosition.getParentNode().getAttributes().getNamedItem(PluginConstants. - CertificateEnrolment.TYPE).setTextContent(String.valueOf( - DigestUtils.sha1Hex(rootCACertificate.getEncoded())).toUpperCase()); - //Adding encoded CA certificate to wap-provisioning file after removing new line - // characters. - NamedNodeMap rootCertAttributes = caCertificatePosition.getAttributes(); - Node rootCertNode = - rootCertAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - rootCertEncodedString = rootCertEncodedString.replaceAll("\n", ""); - rootCertNode.setTextContent(rootCertEncodedString); - - if (log.isDebugEnabled()) { - log.debug("Root certificate: " + rootCertEncodedString); - } - - Node signedCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment. - SIGNED_CERTIFICATE_POSITION); - - //Adding SHA1 signed certificate finger print to wap-provisioning xml. - signedCertificatePosition.getParentNode().getAttributes().getNamedItem(PluginConstants. - CertificateEnrolment.TYPE).setTextContent(String.valueOf( - DigestUtils.sha1Hex(signedCertificate.getEncoded())).toUpperCase()); - - //Adding encoded signed certificate to wap-provisioning file after removing new line - // characters. - NamedNodeMap clientCertAttributes = signedCertificatePosition.getAttributes(); - Node clientEncodedNode = - clientCertAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - signedCertEncodedString = signedCertEncodedString.replaceAll("\n", ""); - - clientEncodedNode.setTextContent(signedCertEncodedString); - if (log.isDebugEnabled()) { - log.debug("Signed certificate: " + signedCertEncodedString); - } - - //Adding domainName to wap-provisioning xml. - Node domainPosition = wapParm.item(PluginConstants.CertificateEnrolment.DOMAIN_POSITION); - NamedNodeMap domainAttribute = domainPosition.getAttributes(); - Node domainNode = domainAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - domainNode.setTextContent(domain); - - //Adding Next provisioning service URL to wap-provisioning xml. - Node syncmlServicePosition = wapParm.item(PluginConstants.CertificateEnrolment. - SYNCML_PROVISIONING_ADDR_POSITION); - NamedNodeMap syncmlServiceAttribute = syncmlServicePosition.getAttributes(); - Node syncmlServiceNode = syncmlServiceAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - syncmlServiceNode.setTextContent(provisioningURL); - - // Adding user name auth token to wap-provisioning xml. - Node userNameAuthPosition = wapParm.item(PluginConstants.CertificateEnrolment.APPAUTH_USERNAME_POSITION); - NamedNodeMap appServerAttribute = userNameAuthPosition.getAttributes(); - Node authNameNode = appServerAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - String userName = getRequestedUser(headerBst); - //CacheEntry cacheEntry = (CacheEntry) DeviceUtil.getCacheEntry(headerBst); - // String userName = cacheEntry.getUsername(); - authNameNode.setTextContent(userName); - DeviceUtil.removeTokenEntry(headerBst); - String password = DeviceUtil.generateRandomToken(); - Node passwordAuthPosition = wapParm.item(PluginConstants.CertificateEnrolment.APPAUTH_PASSWORD_POSITION); - NamedNodeMap appSrvPasswordAttribute = passwordAuthPosition.getAttributes(); - Node authPasswordNode = appSrvPasswordAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - authPasswordNode.setTextContent(password); - String requestSecurityTokenResponse = SyncmlCredentialUtil.generateRST(userName, password); - DeviceUtil.persistChallengeToken(requestSecurityTokenResponse, null, userName); - - // Get device polling frequency from the tenant Configurations. - Node numberOfFirstRetries = wapParm.item(PluginConstants.CertificateEnrolment.POLLING_FREQUENCY_POSITION); - NamedNodeMap pollingAttributes = numberOfFirstRetries.getAttributes(); - Node pollValue = pollingAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - pollValue.setTextContent(pollingFrequency); - provisioningXmlString = convertDocumentToString(document); - } catch (ParserConfigurationException e) { - throw new WAPProvisioningException("Problem occurred while creating configuration request", e); - } catch (CertificateEncodingException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while encoding certificates.", e); - } catch (SAXException e) { - throw new WAPProvisioningException("Error occurred while parsing wap-provisioning.xml file.", e); - } catch (TransformerException e) { - throw new WAPProvisioningException("Error occurred while transforming wap-provisioning.xml file.", e); - } catch (IOException e) { - throw new WAPProvisioningException("Error occurred while getting wap-provisioning.xml file.", e); - } catch (SyncmlMessageFormatException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while generating password hash value.", e); - } catch (KeystoreException e) { - throw new CertificateGenerationException("CA certificate cannot be generated.", e); - } - return base64Encoder.encodeAsString(provisioningXmlString.getBytes()); - } - - /** - * This method get the soap request header contents. - * - * @return List of SOAP headers. - */ - private List
getHeaders() { - MessageContext messageContext = context.getMessageContext(); - if (messageContext == null || !(messageContext instanceof WrappedMessageContext)) { - return null; - } - Message message = ((WrappedMessageContext) messageContext).getWrappedMessage(); - return CastUtils.cast((List) message.get(Header.HEADER_LIST)); - } - - /** - * This method to getting RSTR requested user from the Cache. - * - * @param bst Binary Security token which has given from BST Endpoint. - * @return User for given token. - */ - private String getRequestedUser(String bst) { - MobileCacheEntry cacheEntry = null; - try { - cacheEntry = DeviceUtil.getTokenEntry(bst); - } catch (WindowsDeviceEnrolmentException e) { - - } - return cacheEntry.getUsername(); - } - - /** - * This Method to generate windows device. - * - * @param windowsDevice Requested Device with properties. - * @return Value added Device. - */ - private Device generateDevice(WindowsDevice windowsDevice) { - Gson gson = new Gson(); - Device generatedDevice = new Device(); - - Device.Property OSVersionProperty = new Device.Property(); - OSVersionProperty.setName(PluginConstants.SyncML.OS_VERSION); - OSVersionProperty.setValue(windowsDevice.getOsVersion()); - - Device.Property IMSEIProperty = new Device.Property(); - IMSEIProperty.setName(PluginConstants.SyncML.IMSI); - IMSEIProperty.setValue(windowsDevice.getImsi()); - - Device.Property IMEIProperty = new Device.Property(); - IMEIProperty.setName(PluginConstants.SyncML.IMEI); - IMEIProperty.setValue(windowsDevice.getImei()); - - Device.Property deviceInfoProperties = new Device.Property(); - deviceInfoProperties.setName(PluginConstants.WindowsEnrollmentProperties.TYPE); - deviceInfoProperties.setValue(windowsDevice.getWindowsType()); - String deviceInfo = gson.toJson(deviceInfoProperties); - - Device.Property winDeviceType = new Device.Property(); - winDeviceType.setName(PluginConstants.SyncML.DEVICE_INFO); - winDeviceType.setValue(deviceInfo); - - List propertyList = new ArrayList<>(); - propertyList.add(OSVersionProperty); - propertyList.add(IMSEIProperty); - propertyList.add(IMEIProperty); - propertyList.add(winDeviceType); - - EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); - enrolmentInfo.setOwner(windowsDevice.getUser()); - enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE); - - generatedDevice.setEnrolmentInfo(enrolmentInfo); - generatedDevice.setDeviceIdentifier(windowsDevice.getDeviceId()); - generatedDevice.setProperties(propertyList); - generatedDevice.setType(windowsDevice.getDeviceType()); - generatedDevice.setName(windowsDevice.getDeviceName()); - - return generatedDevice; - } - - /** - * This method to enroll windows10 Device. - * - * @param requestContextItems Context values to enroll the device. - * @param headerBinarySecurityToken SOAP request header value to identify the user. - * @throws DeviceManagementException Exception occurs while enrolling the Device. - * @throws PolicyManagementException Exception occurs while getting effective policies. - */ - private void enrollDevice(AdditionalContext requestContextItems, String headerBinarySecurityToken) - throws DeviceManagementException, PolicyManagementException { - WindowsDevice windowsDevice = new WindowsDevice(); - windowsDevice.setDeviceType(DeviceManagementConstants.MobileDeviceTypes. - MOBILE_DEVICE_TYPE_WINDOWS); - windowsDevice.setUser(getRequestedUser(headerBinarySecurityToken)); - List contextItems = requestContextItems.getcontextitem(); - for(ContextItem contextItem : contextItems) { - if (PluginConstants.WindowsEnrollmentProperties.DEVICE_ID.equals(contextItem.getName())) { - windowsDevice.setDeviceId(contextItem.getValue()); - } - if (PluginConstants.WindowsEnrollmentProperties.DEVICE_NAME.equals(contextItem.getName())) { - windowsDevice.setDeviceName(contextItem.getValue()); - } - if (PluginConstants.WindowsEnrollmentProperties.IMEI.equals(contextItem.getName())) { - windowsDevice.setImei(contextItem.getValue()); - } - if (PluginConstants.WindowsEnrollmentProperties.DEVICE_VERSION.equals(contextItem.getName())) { - windowsDevice.setOsVersion(contextItem.getValue()); - } - if (PluginConstants.WindowsEnrollmentProperties.TYPE.equals(contextItem.getName())) { - windowsDevice.setWindowsType(contextItem.getValue()); - } - } - Device device = generateDevice(windowsDevice); - WindowsAPIUtils.getDeviceManagementService().enrollDevice(device); - PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); - policyManagerService.getEffectivePolicy(new DeviceIdentifier(windowsDevice.getDeviceId(), device.getType())); - - } -} - 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/services/enrollment/util/CertificateSigningService.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/services/enrollment/util/CertificateSigningService.java deleted file mode 100644 index e4eeaf665..000000000 --- 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/services/enrollment/util/CertificateSigningService.java +++ /dev/null @@ -1,141 +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.services.enrollment.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.bouncycastle.asn1.x509.*; -import org.bouncycastle.cert.CertIOException; -import org.bouncycastle.cert.X509v3CertificateBuilder; -import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; -import org.bouncycastle.operator.ContentSigner; -import org.bouncycastle.operator.OperatorCreationException; -import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; -import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.CertificateGenerationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; - -import javax.security.auth.x500.X500Principal; -import java.math.BigInteger; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; - -/** - * Class for generating signed certificate for CSR form device. - */ -public class CertificateSigningService { - - private static final long MILLI_SECONDS = 1000L * 60 * 60 * 24; - - private enum PropertyIndex { - COMMON_NAME_INDEX(0), - NOT_BEFORE_DAYS_INDEX(1), - NOT_AFTER_DAYS_INDEX(2); - - private final int itemPosition; - private PropertyIndex(final int itemPosition) { - this.itemPosition = itemPosition; - } - public int getValue() { - return this.itemPosition; - } - } - - private static Log log = LogFactory.getLog( - CertificateSigningService.class); - - /** - * Implement certificate signing task using CSR received from the device and the MDM server key - * store. - * @param jcaRequest - CSR from the device - * @param privateKey - Private key of CA certificate in MDM server - * @param caCert - CA certificate in MDM server - * @param certParameterList - Parameter list for Signed certificate generation - * @return - Signed certificate for CSR from device - * @throws CertificateGenerationException - * @throws WAPProvisioningException - */ - public static X509Certificate signCSR(JcaPKCS10CertificationRequest jcaRequest, - PrivateKey privateKey, X509Certificate caCert, - List certParameterList) throws - CertificateGenerationException, - WAPProvisioningException { - - String commonName = - (String) certParameterList.get(PropertyIndex.COMMON_NAME_INDEX.getValue()); - int notBeforeDays = - (Integer) certParameterList.get(PropertyIndex.NOT_BEFORE_DAYS_INDEX.getValue()); - int notAfterDays = - (Integer) certParameterList.get(PropertyIndex.NOT_AFTER_DAYS_INDEX.getValue()); - X509v3CertificateBuilder certificateBuilder; - X509Certificate signedCertificate; - - try { - ContentSigner signer; - BigInteger serialNumber = BigInteger.valueOf(new SecureRandom(). - nextInt(Integer.MAX_VALUE)); - Date notBeforeDate = new Date(System.currentTimeMillis() - - (MILLI_SECONDS * notBeforeDays)); - Date notAfterDate = new Date(System.currentTimeMillis() + - (MILLI_SECONDS * notAfterDays)); - certificateBuilder = - new JcaX509v3CertificateBuilder(caCert, serialNumber, notBeforeDate, notAfterDate, - new X500Principal(commonName), - jcaRequest.getPublicKey()); - - //Adding extensions to the signed certificate. - certificateBuilder.addExtension(Extension.keyUsage, true, - new KeyUsage(KeyUsage.digitalSignature)); - certificateBuilder.addExtension(Extension.extendedKeyUsage, false, - new ExtendedKeyUsage(KeyPurposeId.id_kp_clientAuth)); - certificateBuilder.addExtension(Extension.basicConstraints, true, - new BasicConstraints(false)); - - signer = new JcaContentSignerBuilder(PluginConstants.CertificateEnrolment.ALGORITHM). - setProvider(PluginConstants.CertificateEnrolment.PROVIDER).build(privateKey); - - signedCertificate = new JcaX509CertificateConverter().setProvider( - PluginConstants.CertificateEnrolment.PROVIDER).getCertificate( - certificateBuilder.build(signer)); - } catch (InvalidKeyException e) { - throw new CertificateGenerationException("CSR's public key is invalid", e); - } catch (NoSuchAlgorithmException e) { - throw new CertificateGenerationException("Certificate cannot be generated", e); - } - catch (CertIOException e) { - throw new CertificateGenerationException( - "Cannot add extension(s) to signed certificate", e); - } - catch (OperatorCreationException e) { - throw new CertificateGenerationException("Content signer cannot be created", e); - } - catch (CertificateException e) { - throw new CertificateGenerationException("Signed certificate cannot be generated", e); - } - return signedCertificate; - } -} 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/services/enrollment/util/KeyStoreGenerator.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/services/enrollment/util/KeyStoreGenerator.java deleted file mode 100644 index ba966f80e..000000000 --- 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/services/enrollment/util/KeyStoreGenerator.java +++ /dev/null @@ -1,94 +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.services.enrollment.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.KeyStoreGenerationException; - -import java.io.FileInputStream; -import java.io.IOException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; - -/** - * Class for MDM Keystore operations. - */ -public class KeyStoreGenerator { - - private static final Log log = LogFactory.getLog( - KeyStoreGenerator.class); - - /** - * This method loads the MDM keystore. - * @param keyStore - MDM Keystore - * @param keyStorePassword - Keystore Password - * @param keyStorePath - Keystore path - * @throws KeyStoreGenerationException - */ - public static void loadToStore(KeyStore keyStore, - char[] keyStorePassword, - String keyStorePath) throws KeyStoreGenerationException { - - FileInputStream fileInputStream = null; - - try { - if (keyStorePath != null) { - fileInputStream = new FileInputStream(keyStorePath); - keyStore.load(fileInputStream, keyStorePassword); - } - } catch (NoSuchAlgorithmException e) { - throw new KeyStoreGenerationException( - "Requested cryptographic algorithm is not available in the environment.", e); - } catch (CertificateException e) { - throw new KeyStoreGenerationException("Error working with certificate related to, " + - keyStorePath, e); - } catch (IOException e) { - throw new KeyStoreGenerationException("File error while working with file, " + - keyStorePath, e); - } finally { - try { - if (fileInputStream != null) { - fileInputStream.close(); - } - } catch (IOException e) { - throw new KeyStoreGenerationException("File error while closing the file, " + - keyStorePath, e); - } - } - } - - /** - * This method is for retrieving instance of Key Store. - * @return Keystore object - * @throws KeyStoreGenerationException - */ - public static KeyStore getKeyStore() throws KeyStoreGenerationException { - try { - return KeyStore.getInstance(PluginConstants.CertificateEnrolment.JKS); - } catch (KeyStoreException e) { - String msg = "KeyStore error while creating new JKS."; - log.error(msg, e); - throw new KeyStoreGenerationException(msg, e); - } - } -} 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/services/enrollment/util/MessageHandler.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/services/enrollment/util/MessageHandler.java deleted file mode 100644 index 616e3db08..000000000 --- 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/services/enrollment/util/MessageHandler.java +++ /dev/null @@ -1,200 +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.services.enrollment.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.joda.time.DateTime; -import org.joda.time.format.ISODateTimeFormat; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.ws.rs.core.Response; -import javax.xml.namespace.QName; -import javax.xml.soap.*; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPHandler; -import javax.xml.ws.handler.soap.SOAPMessageContext; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.*; - -/** - * Class responsible for adding Timestamp security header in SOAP message and adding Content-length - * in the HTTP header for avoiding HTTP chunking. - */ -public class MessageHandler implements SOAPHandler { - - public static final String TIME_ZONE = "Z"; - public static final int VALIDITY_TIME = 5; - public static final int TIMESTAMP_END_INDEX = 6; - public static final int TIMESTAMP_BEGIN_INDEX = 0; - private static Log log = LogFactory.getLog( - MessageHandler.class); - - /** - * This method resolves the security header coming in the SOAP message. - * @return - Security Header - */ - @Override - public Set getHeaders() { - QName securityHeader = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, PluginConstants.SECURITY); - HashSet headers = new HashSet(); - headers.add(securityHeader); - return headers; - } - - /** - * This method adds Timestamp for SOAP header, and adds Content-length for HTTP header for - * avoiding HTTP chunking. - * - * @param context - Context of the SOAP Message - */ - @Override - public boolean handleMessage(SOAPMessageContext context) { - - Boolean outBoundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); - - if (outBoundProperty) { - SOAPMessage message = context.getMessage(); - SOAPHeader header = null; - SOAPEnvelope envelope = null; - try { - header = message.getSOAPHeader(); - envelope = message.getSOAPPart().getEnvelope(); - } catch (SOAPException e) { - Response.serverError().entity("SOAP message content cannot be read.").build(); - } - try { - if ((header == null) && (envelope != null)) { - header = envelope.addHeader(); - } - } catch (SOAPException e) { - Response.serverError().entity("SOAP header cannot be added.").build(); - } - - SOAPFactory soapFactory = null; - try { - soapFactory = SOAPFactory.newInstance(); - } catch (SOAPException e) { - Response.serverError().entity("Cannot get an instance of SOAP factory.").build(); - } - - QName qNamesSecurity = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, - PluginConstants.CertificateEnrolment.SECURITY); - SOAPHeaderElement Security = null; - Name attributeName = null; - try { - if (header != null) { - Security = header.addHeaderElement(qNamesSecurity); - } - if (soapFactory != null) { - attributeName = - soapFactory.createName(PluginConstants.CertificateEnrolment.TIMESTAMP_ID, - PluginConstants.CertificateEnrolment.TIMESTAMP_U, - PluginConstants.CertificateEnrolment - .WSS_SECURITY_UTILITY); - } - } catch (SOAPException e) { - Response.serverError().entity("Security header cannot be added.").build(); - } - - QName qNameTimestamp = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.TIMESTAMP); - SOAPHeaderElement timestamp = null; - try { - if (header != null) { - timestamp = header.addHeaderElement(qNameTimestamp); - timestamp.addAttribute(attributeName, - PluginConstants.CertificateEnrolment.TIMESTAMP_0); - } - } catch (SOAPException e) { - Response.serverError().entity("Exception while adding timestamp header.").build(); - } - DateTime dateTime = new DateTime(); - DateTime expiredDateTime = dateTime.plusMinutes(VALIDITY_TIME); - String createdISOTime = dateTime.toString(ISODateTimeFormat.dateTime()); - String expiredISOTime = expiredDateTime.toString(ISODateTimeFormat.dateTime()); - createdISOTime = createdISOTime.substring(TIMESTAMP_BEGIN_INDEX, - createdISOTime.length() - - TIMESTAMP_END_INDEX); - createdISOTime = createdISOTime + TIME_ZONE; - expiredISOTime = expiredISOTime.substring(TIMESTAMP_BEGIN_INDEX, - expiredISOTime.length() - - TIMESTAMP_END_INDEX); - expiredISOTime = expiredISOTime + TIME_ZONE; - QName qNameCreated = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.CREATED); - SOAPHeaderElement SOAPHeaderCreated = null; - - try { - if (header != null) { - SOAPHeaderCreated = header.addHeaderElement(qNameCreated); - SOAPHeaderCreated.addTextNode(createdISOTime); - } - } catch (SOAPException e) { - Response.serverError().entity("Exception while creating SOAP header.").build(); - } - QName qNameExpires = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.EXPIRES); - SOAPHeaderElement SOAPHeaderExpires = null; - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - String messageString = null; - try { - if (header != null) { - SOAPHeaderExpires = header.addHeaderElement(qNameExpires); - SOAPHeaderExpires.addTextNode(expiredISOTime); - } - if ((timestamp != null) && (Security != null)) { - timestamp.addChildElement(SOAPHeaderCreated); - timestamp.addChildElement(SOAPHeaderExpires); - Security.addChildElement(timestamp); - } - message.saveChanges(); - message.writeTo(outputStream); - messageString = new String(outputStream.toByteArray(), - PluginConstants.CertificateEnrolment.UTF_8); - } catch (SOAPException e) { - Response.serverError().entity("Exception while creating timestamp SOAP header.") - .build(); - } catch (IOException e) { - Response.serverError().entity("Exception while writing message to output stream.") - .build(); - } - - Map> headers = - (Map>) context.get(MessageContext.HTTP_REQUEST_HEADERS); - headers = new HashMap>(); - if (messageString != null) { - headers.put(PluginConstants.CONTENT_LENGTH, Arrays.asList(String.valueOf( - messageString.length()))); - } - context.put(MessageContext.HTTP_REQUEST_HEADERS, headers); - } - return true; - } - - @Override - public boolean handleFault(SOAPMessageContext context) { - return true; - } - - @Override - public void close(MessageContext context) { - } -} 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/services/impl/ConfigurationMgtServiceImpl.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/services/impl/ConfigurationMgtServiceImpl.java deleted file mode 100644 index f450141a5..000000000 --- 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/services/impl/ConfigurationMgtServiceImpl.java +++ /dev/null @@ -1,158 +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.services.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.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.license.mgt.License; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.ConfigurationMgtService; -import javax.ws.rs.core.MediaType; - -import javax.jws.WebService; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -@WebService -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Path("/configuration") -public class ConfigurationMgtServiceImpl implements ConfigurationMgtService { - - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.ConfigurationMgtServiceImpl.class); - - /** - * Retrieve Tenant configurations according to the device type. - * - * @return Tenant configuration object contains specific tenant configurations. - * @throws WindowsConfigurationException - */ - @GET - public Response getConfiguration(@HeaderParam("If-Modified-Since") String ifModifiedSince) { - String msg; - PlatformConfiguration platformConfiguration; - List configs; - try { - platformConfiguration = WindowsAPIUtils.getDeviceManagementService(). - getConfiguration(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - if (platformConfiguration != null) { - configs = platformConfiguration.getConfiguration(); - } else { - platformConfiguration = new PlatformConfiguration(); - configs = new ArrayList<>(); - } - - ConfigurationEntry entry = new ConfigurationEntry(); - License license = WindowsAPIUtils.getDeviceManagementService().getLicense( - DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS, - PluginConstants.TenantConfigProperties.LANGUAGE_US); - - if (license != null && configs != null) { - entry.setContentType(PluginConstants.TenantConfigProperties.CONTENT_TYPE_TEXT); - entry.setName(PluginConstants.TenantConfigProperties.LICENSE_KEY); - entry.setValue(license.getText()); - configs.add(entry); - platformConfiguration.setConfiguration(configs); - } - } catch (DeviceManagementException e) { - msg = "Error occurred while retrieving the Windows tenant configuration"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - return Response.status(Response.Status.OK).entity(platformConfiguration).build(); - } - - /** - * Update Tenant Configurations for the specific Device type. - * - * @param configurations to be updated. - * @return Response message. - * @throws WindowsConfigurationException - */ - @PUT - public Response updateConfiguration(PlatformConfiguration windowsPlatformConfiguration) throws WindowsConfigurationException { - String message; - ConfigurationEntry licenseEntry = null; - PlatformConfiguration configuration = new PlatformConfiguration(); - configuration.setConfiguration(windowsPlatformConfiguration.getConfiguration()); - try { - configuration.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - List configs = windowsPlatformConfiguration.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); - } catch (DeviceManagementException e) { - message = "Error occurred while modifying configuration settings of Windows platform."; - log.error(message, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(message).build()); - } - return Response.status(Response.Status.OK). - entity("Windows platform configuration has been updated successfully.").build(); - - } - - @GET - @Path("/license") - public Response getLicense( - @HeaderParam("If-Modified-Since") String ifModifiedSince) { - 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 enrolment"; - log.error(msg, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); - } - return Response.status(Response.Status.OK).entity(license).build(); - } -} - 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/services/impl/DeviceManagementAdminServiceImpl.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/services/impl/DeviceManagementAdminServiceImpl.java deleted file mode 100644 index bb760b2bf..000000000 --- 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/services/impl/DeviceManagementAdminServiceImpl.java +++ /dev/null @@ -1,414 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl; - -import io.swagger.annotations.ApiParam; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.http.HttpStatus; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.exceptions.InvalidDeviceException; -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.CommandOperation; -import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.EnterpriseApplication; -import org.wso2.carbon.device.mgt.mobile.windows.api.bean.wrapper.EnterpriseApplicationBeanWrapper; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.beans.ErrorResponse; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.BadRequestException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.UnexpectedServerErrorException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsOperationsException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.ProfileConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementAdminService; - -import javax.ws.rs.*; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import java.util.List; - -/** - * Implementation class of operations interface. Each method in this class receives the operations comes via UI - * and persists those in the correct format. - */ -@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) -@Path("/admin/devices") -public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService { - - private static Log log = LogFactory.getLog(DeviceManagementAdminServiceImpl.class); - - /** - * REST endpoint for the Device Lock operation - * - * @param acceptHeader header value of the request POST message. - * @param deviceIDs list of device ids to be add device updateLockOperation operation. - * @return Response object for client. - * @throws WindowsDeviceEnrolmentException - */ - @POST - @Path("/lock-devices") - public Response lock(@HeaderParam("Accept") String acceptHeader, List deviceIDs) - throws WindowsDeviceEnrolmentException { - if (log.isDebugEnabled()) { - log.debug("Invoking windows device updateLockOperation operation"); - } - MediaType responseMediaType = WindowsAPIUtils.getResponseMediaType(acceptHeader); - Message message = new Message(); - try { - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.DEVICE_LOCK); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(true); - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - /** - * REST end point for device dis-enrollment. - * - * @param acceptHeader POST message header value. - * @param deviceIDs device ids to be dis-enrolled. - * @return Response object to the client. - * @throws WindowsDeviceEnrolmentException - */ - @POST - @Path("/disenroll-devices") - public Response disenroll(@HeaderParam("Accept") String acceptHeader, List deviceIDs) - throws WindowsDeviceEnrolmentException { - - MediaType responseMediaType = WindowsAPIUtils.getResponseMediaType(acceptHeader); - Message message = new Message(); - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.DISENROLL); - operation.setType(Operation.Type.COMMAND); - operation.setEnabled(true); - try { - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - /** - * REST Endpoint for the Device wipe. - * - * @param acceptHeader POST message header value. - * @param deviceids device ids to be wiped. - * @return Response object for the client. - * @throws WindowsDeviceEnrolmentException - */ - @POST - @Path("/wipe-devices") - public Response wipe(@HeaderParam("Accept") String acceptHeader, List deviceids) - throws WindowsDeviceEnrolmentException { - - if (log.isDebugEnabled()) { - log.debug("Invoking windows wipe-data device operation"); - } - MediaType responseMediaType = WindowsAPIUtils.getResponseMediaType(acceptHeader); - Message message = new Message(); - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.WIPE_DATA); - operation.setType(Operation.Type.COMMAND); - try { - return WindowsAPIUtils.getOperationResponse(deviceids, operation); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - /** - * REST end point for the device ring. - * - * @param acceptHeader post message header value. - * @param deviceIDs device ids to be ring. - * @return Response object for the client. - * @throws WindowsDeviceEnrolmentException - */ - @POST - @Path("/ring-devices") - public Response ring(@HeaderParam("Accept") String acceptHeader, List deviceIDs) - throws WindowsDeviceEnrolmentException { - - if (log.isDebugEnabled()) { - log.debug("Invoking Windows ring-device device operation"); - } - MediaType responseMediaType = WindowsAPIUtils.getResponseMediaType(acceptHeader); - Message message = new Message(); - try { - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.DEVICE_RING); - operation.setType(Operation.Type.COMMAND); - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - /** - * REST endpoint for the device updateLockOperation reset. - * Lock reset have to be done, when device user does not set PIN for the updateLockOperation screen. - * Admin set updateLockOperation operation for the specific device,If the device is in above scenario, - * admin will be notified.since - * admin have to set updateLockOperation reset operation to the device so that automatically generate PIN value for the - * updateLockOperation screen. - * - * @param acceptHeader POST message header value. - * @param deviceIDs Device ids to be updateLockOperation reset. - * @return Response object for the client. - * @throws WindowsDeviceEnrolmentException - */ - @POST - @Path("/lock-reset-devices") - public Response lockReset(@HeaderParam("Accept") String acceptHeader, List deviceIDs) - throws WindowsDeviceEnrolmentException { - - if (log.isDebugEnabled()) { - log.debug("Invoking windows device lockReset storage operation"); - } - MediaType responseMediaType = WindowsAPIUtils.getResponseMediaType(acceptHeader); - Message message = new Message(); - try { - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.LOCK_RESET); - operation.setType(Operation.Type.COMMAND); - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - message.setResponseMessage(errorMessage); - message.setResponseCode(Response.Status.INTERNAL_SERVER_ERROR.toString()); - log.error(errorMessage, e); - throw new WindowsOperationsException(message, responseMediaType); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } - } - - @POST - @Path("/location") - public Response getDeviceLocation(@ApiParam( - name = "deviceIDs", - value = "Provide the ID of the Windows device. Multiple device IDs can be added by " + - "using comma separated values. ", - required = true) List deviceIDs) { - if (log.isDebugEnabled()) { - log.debug("Invoking Windows device location operation."); - } - try { - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.DEVICE_LOCATION); - operation.setType(Operation.Type.COMMAND); - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } - } - - @POST - @Path("/reboot") - public Response rebootDevice(@ApiParam( - name = "deviceIDs", - value = "Provide the ID of the Windows device. Multiple device IDs can be " + - "added using comma separated values.", - required = true) List deviceIDs) { - if (log.isDebugEnabled()) { - log.debug("Invoking Windows reboot-device device operation"); - } - try { - CommandOperation operation = new CommandOperation(); - operation.setCode(PluginConstants.OperationCodes.DEVICE_REBOOT); - operation.setType(Operation.Type.COMMAND); - return WindowsAPIUtils.getOperationResponse(deviceIDs, operation); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(400l).setMessage(errorMessage).build()); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(errorMessage).build()); - } - } - - /** - * Rest endpoint for Enterprise Application (MSI or APPX) installation - * - * @param enterpriseApplicationBeanWrapper Enterprise application installation payload object - * @return Response object for client. - */ - @POST - @Path("/enterprise-application") - public Response installEnterpriseApplication(@ApiParam( - name = "enterpriseApplicationBeanWrapper", - value = "Enterprise application configuration and Device IDs", - required = true) EnterpriseApplicationBeanWrapper enterpriseApplicationBeanWrapper) { - if (log.isDebugEnabled()) { - log.debug("Invoking Windows install enterprise application device operation"); - } - if (enterpriseApplicationBeanWrapper == null || enterpriseApplicationBeanWrapper.getOperation() == null) { - String errorMessage = "The payload of the application installing operation is incorrect"; - log.error(errorMessage); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST).setMessage(errorMessage) - .build()); - } - try { - EnterpriseApplication enterpriseApplication = enterpriseApplicationBeanWrapper.getOperation(); - enterpriseApplication.validateRequest(); - ProfileOperation operation = new ProfileOperation(); - operation.setCode(PluginConstants.OperationCodes.INSTALL_ENTERPRISE_APPLICATION); - operation.setType(Operation.Type.PROFILE); - operation.setPayLoad(enterpriseApplication.toJSON()); - return WindowsAPIUtils.getOperationResponse(enterpriseApplicationBeanWrapper.getDeviceIDs(), operation); - } catch (ProfileConfigurationException e) { - throw new BadRequestException(new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST) - .setMessage(e.getMessage()).build()); - } catch (OperationManagementException e) { - String errorMessage = "Issue in retrieving operation management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .setMessage(errorMessage).build()); - } catch (DeviceManagementException e) { - String errorMessage = "Issue in retrieving device management service instance"; - log.error(errorMessage, e); - throw new UnexpectedServerErrorException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_INTERNAL_SERVER_ERROR) - .setMessage(errorMessage).build()); - } catch (InvalidDeviceException e) { - String errorMessage = "Invalid Device Identifiers found."; - log.error(errorMessage, e); - throw new BadRequestException( - new ErrorResponse.ErrorResponseBuilder().setCode(HttpStatus.SC_BAD_REQUEST).setMessage(errorMessage) - .build()); - } - } -} 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/services/impl/DeviceManagementServiceImpl.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/services/impl/DeviceManagementServiceImpl.java deleted file mode 100644 index a8de6e7b8..000000000 --- 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/services/impl/DeviceManagementServiceImpl.java +++ /dev/null @@ -1,263 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -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.exceptions.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.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.AuthenticationInfo; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -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.ReplaceTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlDocument; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlHeader; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationCode; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationHandler; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationReply; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlParser; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; - -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -import static org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils.convertToDeviceIdentifierObject; - - -public class DeviceManagementServiceImpl implements DeviceManagementService { - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl.SyncmlServiceImpl.class); - - @Override public Response getResponse(Document request) - throws WindowsDeviceEnrolmentException, WindowsOperationException, WindowsConfigurationException { - int msgId; - int sessionId; - String user; - String token; - String response; - SyncmlDocument syncmlDocument; - List pendingOperations; - OperationHandler operationHandler = new OperationHandler(); - OperationReply operationReply = new OperationReply(); - - try { - if (SyncmlParser.parseSyncmlPayload(request) != null) { - syncmlDocument = SyncmlParser.parseSyncmlPayload(request); - SyncmlHeader syncmlHeader = syncmlDocument.getHeader(); - sessionId = syncmlHeader.getSessionId(); - user = syncmlHeader.getSource().getLocName(); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlHeader.getSource(). - getLocURI()); - msgId = syncmlHeader.getMsgID(); - - if ((PluginConstants.SyncML.SYNCML_FIRST_MESSAGE_ID == msgId) && - (PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) { - if (syncmlHeader.getCredential() != null) { - token = syncmlHeader.getCredential().getData(); - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token); - DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user); - PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - carbonCtx.setTenantId(cacheToken.getTenanatID(), true); - if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) { - if (modifyEnrollWithMoreDetail(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) { - pendingOperations = operationHandler.getPendingOperations(syncmlDocument); - operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier); - response = operationReply.generateReply(syncmlDocument, pendingOperations); - return Response.status(Response.Status.OK).entity(response).build(); - } else { - String msg = "Error occurred in while modify the enrollment."; - log.error(msg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - } else { - String msg = "Authentication failure due to incorrect credentials."; - log.error(msg); - return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); - } - } else { - return Response.ok().entity(operationReply.generateReply(syncmlDocument, null)).build(); - } - } else { - if (DeviceUtil.getTokenEntryFromDeviceId(deviceIdentifier.getId()) == null) { - if (syncmlHeader.getCredential() != null) { - token = syncmlHeader.getCredential().getData(); - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token); - DeviceUtil.persistChallengeToken(token, deviceIdentifier.getId(), user); - PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - carbonCtx.setTenantId(cacheToken.getTenanatID(), true); - } - } else { - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntryFromDeviceId(deviceIdentifier.getId()); - PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - carbonCtx.setTenantId(cacheToken.getTenanatID()); - } - if ((syncmlDocument.getBody().getAlert() != null)) { - List disEnrollItemList = syncmlDocument.getBody().getAlert().getItems(); - String disEnrollMetaType = null; - if (disEnrollItemList != null && !disEnrollItemList.isEmpty()) { - MetaTag disEnrollMetaTag = disEnrollItemList.get(0).getMeta(); - if (disEnrollMetaTag != null) { - disEnrollMetaType = disEnrollMetaTag.getType(); - } - } - if (syncmlDocument.getBody().getAlert().getData().equals(Constants.DISENROLL_ALERT_DATA) - && disEnrollMetaType != null && PluginConstants.SyncML.DEVICE_UNENROLL_META_TYPE - .equals(disEnrollMetaType.trim())) { - if (WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false) != null) { - operationHandler.updateDisenrollOperationStatus(deviceIdentifier); - WindowsAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); - return Response.ok().entity(operationReply.generateReply(syncmlDocument, null)).build(); - } else { - String msg = "Enrolled device can not be found in the server."; - log.error(msg); - return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); - } - } else { - pendingOperations = operationHandler.getPendingOperations(syncmlDocument); - operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier); - return Response.ok().entity(operationReply.generateReply(syncmlDocument, pendingOperations)) - .build(); - } - } else { - pendingOperations = operationHandler.getPendingOperations(syncmlDocument); - operationHandler.checkForDeviceWipe(pendingOperations, deviceIdentifier); - return Response.ok().entity(operationReply.generateReply(syncmlDocument, pendingOperations)) - .build(); - } - } - } - } catch (SyncmlMessageFormatException e) { - String msg = "Error occurred while parsing syncml request."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } catch (OperationManagementException e) { - String msg = "Cannot access operation management service."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } catch (SyncmlOperationException e) { - String msg = "Error occurred while getting effective feature."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } catch (DeviceManagementException e) { - String msg = "Failure occurred in dis-enrollment flow."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } - return null; - } - - /** - * Enroll phone device - * - * @param request Device syncml request for the server side. - * @return enroll state - * @throws WindowsDeviceEnrolmentException - * @throws WindowsOperationException - */ - private boolean modifyEnrollWithMoreDetail(Document request, String tenantDomain, int tenantId) throws WindowsDeviceEnrolmentException, - WindowsOperationException { - - String devMan = null; - String devMod = null; - boolean status = false; - String user; - SyncmlDocument syncmlDocument; - try { - syncmlDocument = SyncmlParser.parseSyncmlPayload(request); - ReplaceTag replace = syncmlDocument.getBody().getReplace(); - List itemList = replace.getItems(); - for (ItemTag itemTag : itemList) { - String locURI = itemTag.getSource().getLocURI(); - if (OperationCode.Info.MANUFACTURER.getCode().equals(locURI)) { - devMan = itemTag.getData(); - } - if (OperationCode.Info.DEVICE_MODEL.getCode().equals(locURI)) { - devMod = itemTag.getData(); - } - } - user = syncmlDocument.getHeader().getSource().getLocName(); - AuthenticationInfo authenticationInfo = new AuthenticationInfo(); - authenticationInfo.setUsername(user); - authenticationInfo.setTenantId(tenantId); - authenticationInfo.setTenantDomain(tenantDomain); - WindowsAPIUtils.startTenantFlow(authenticationInfo); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument. - getHeader().getSource().getLocURI()); - Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (!existingDevice.getProperties().isEmpty()) { - List existingProperties = new ArrayList<>(); - - Device.Property vendorProperty = new Device.Property(); - vendorProperty.setName(PluginConstants.SyncML.VENDOR); - vendorProperty.setValue(devMan); - existingProperties.add(vendorProperty); - - Device.Property deviceModelProperty = new Device.Property(); - deviceModelProperty.setName(PluginConstants.SyncML.MODEL); - deviceModelProperty.setValue(devMod); - existingProperties.add(deviceModelProperty); - - existingDevice.setProperties(existingProperties); - existingDevice.setDeviceIdentifier(syncmlDocument.getHeader().getSource().getLocURI()); - existingDevice.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - status = WindowsAPIUtils.getDeviceManagementService().modifyEnrollment(existingDevice); - return status; - } - } catch (DeviceManagementException e) { - throw new WindowsDeviceEnrolmentException("Failure occurred while enrolling device.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return status; - } -} 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/services/syncml/SyncmlService.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/services/syncml/SyncmlService.java deleted file mode 100644 index b666e3f22..000000000 --- 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/services/syncml/SyncmlService.java +++ /dev/null @@ -1,61 +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.services.syncml; - -import org.w3c.dom.Document; -import org.wso2.carbon.apimgt.annotations.api.Scope; -import org.wso2.carbon.apimgt.annotations.api.Scopes; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; - -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; - -/** - * Interface for Windows 8.1 enrollment flow. - */ - -@Path("/devicemanagement") -@Scopes( - scopes = { - @Scope( - name = "Pending operations", - description = "Register an Windows device", - key = "perm:windows:enroll", - permissions = {"/device-mgt/devices/enroll/windows"} - ) - } -) -public interface SyncmlService { - - @Path("/request") - @POST - @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) - @Produces(PluginConstants.SYNCML_MEDIA_TYPE) - 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/device/mgt/mobile/windows/api/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/device/mgt/mobile/windows/api/services/syncml/beans/BasicOperation.java deleted file mode 100644 index 0b5be3f45..000000000 --- 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/services/syncml/beans/BasicOperation.java +++ /dev/null @@ -1,35 +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.services.syncml.beans; - -/** - * Bean for get basic operations. - */ -public class BasicOperation { - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} 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/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/device/mgt/mobile/windows/api/services/syncml/beans/PasscodePolicy.java deleted file mode 100644 index 567c2c252..000000000 --- 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/services/syncml/beans/PasscodePolicy.java +++ /dev/null @@ -1,107 +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.services.syncml.beans; - -/** - * Bean for device updateLockOperation screen passcode policy. - */ -public class PasscodePolicy extends BasicOperation { - - private int maxFailedAttempts; - private int minLength; - private int pinHistory; - private int minComplexChars; - private int maxPINAgeInDays; - private boolean requireAlphanumeric; - private boolean allowSimple; - private boolean enablePassword; - private int maxInactiveTime; - - public int getMaxInactiveTime() { - return maxInactiveTime; - } - - public void setMaxInactiveTime(int maxInactiveTime) { - this.maxInactiveTime = maxInactiveTime; - } - - public boolean isEnablePassword() { - return enablePassword; - } - - public void setEnablePassword(boolean enablePassword) { - this.enablePassword = enablePassword; - } - - public int getMaxFailedAttempts() { - return maxFailedAttempts; - } - - public void setMaxFailedAttempts(int maxFailedAttempts) { - this.maxFailedAttempts = maxFailedAttempts; - } - - public int getMinLength() { - return minLength; - } - - public void setMinLength(int minLength) { - this.minLength = minLength; - } - - public int getPinHistory() { - return pinHistory; - } - - public void setPinHistory(int pinHistory) { - this.pinHistory = pinHistory; - } - - public int getMinComplexChars() { - return minComplexChars; - } - - public void setMinComplexChars(int minComplexChars) { - this.minComplexChars = minComplexChars; - } - - public int getMaxPINAgeInDays() { - return maxPINAgeInDays; - } - - public void setMaxPINAgeInDays(int maxPINAgeInDays) { - this.maxPINAgeInDays = maxPINAgeInDays; - } - - public boolean isRequireAlphanumeric() { - return requireAlphanumeric; - } - - public void setRequireAlphanumeric(boolean requireAlphanumeric) { - this.requireAlphanumeric = requireAlphanumeric; - } - - public boolean isAllowSimple() { - return allowSimple; - } - - public void setAllowSimple(boolean allowSimple) { - this.allowSimple = allowSimple; - } -} 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/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/device/mgt/mobile/windows/api/services/syncml/beans/Profile.java deleted file mode 100644 index 63ac61f45..000000000 --- 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/services/syncml/beans/Profile.java +++ /dev/null @@ -1,62 +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.services.syncml.beans; - -/** - * Class for contains device active policy. - */ -public class Profile { - - String featureCode; - String data; - boolean enable; - boolean compliance; - - public boolean isCompliance() { - return compliance; - } - - public void setCompliance(boolean compliance) { - this.compliance = compliance; - } - - public boolean isEnable() { - return enable; - } - - public void setEnable(boolean enable) { - this.enable = enable; - } - - public String getFeatureCode() { - return featureCode; - } - - public void setFeatureCode(String featureCode) { - this.featureCode = featureCode; - } - - public String getData() { - return data; - } - - public void setData(String data) { - this.data = data; - } -} 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/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/device/mgt/mobile/windows/api/services/syncml/beans/Wifi.java deleted file mode 100644 index d545f096d..000000000 --- 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/services/syncml/beans/Wifi.java +++ /dev/null @@ -1,107 +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.services.syncml.beans; - -/** - * Bean for WIFI configurations. - */ -public class Wifi extends BasicOperation { - - private String networkName; - private String ssid; - private String connectionType; - private String connectionMode; - private String authentication; - private String encryption; - private String keyType; - private String protection; - private String keyMaterial; - - public String getNetworkName() { - return networkName; - } - - public void setNetworkName(String networkName) { - this.networkName = networkName; - } - - public String getSsid() { - return ssid; - } - - public void setSsid(String ssid) { - this.ssid = ssid; - } - - public String getConnectionType() { - return connectionType; - } - - public void setConnectionType(String connectionType) { - this.connectionType = connectionType; - } - - public String getConnectionMode() { - return connectionMode; - } - - public void setConnectionMode(String connectionMode) { - this.connectionMode = connectionMode; - } - - public String getAuthentication() { - return authentication; - } - - public void setAuthentication(String authentication) { - this.authentication = authentication; - } - - public String getEncryption() { - return encryption; - } - - public void setEncryption(String encryption) { - this.encryption = encryption; - } - - public String getKeyType() { - return keyType; - } - - public void setKeyType(String keyType) { - this.keyType = keyType; - } - - public String getProtection() { - return protection; - } - - public void setProtection(String protection) { - this.protection = protection; - } - - public String getKeyMaterial() { - return keyMaterial; - } - - public void setKeyMaterial(String keyMaterial) { - this.keyMaterial = keyMaterial; - } -} 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/services/syncml/beans/WindowsDevice.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/services/syncml/beans/WindowsDevice.java deleted file mode 100644 index 4bafbf22c..000000000 --- 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/services/syncml/beans/WindowsDevice.java +++ /dev/null @@ -1,118 +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.services.syncml.beans; - -/** - * Class for get windows device properties. - */ -public class WindowsDevice { - - private String deviceType; - private String deviceId; - private String osVersion; - private String imsi; - private String imei; - private String manufacturer; - private String model; - private String user; - private String deviceName; - private String windowsType; - - public String getWindowsType() { - return windowsType; - } - - public void setWindowsType(String windowsType) { - this.windowsType = windowsType; - } - - public String getImei() { - return imei; - } - - public void setImei(String imei) { - this.imei = imei; - } - - public String getDeviceType() { - return deviceType; - } - - public void setDeviceType(String deviceType) { - this.deviceType = deviceType; - } - - public String getDeviceId() { - return deviceId; - } - - public void setDeviceId(String deviceId) { - this.deviceId = deviceId; - } - - public String getOsVersion() { - return osVersion; - } - - public void setOsVersion(String osVersion) { - this.osVersion = osVersion; - } - - public String getImsi() { - return imsi; - } - - public void setImsi(String imsi) { - this.imsi = imsi; - } - - public String getManufacturer() { - return manufacturer; - } - - public void setManufacturer(String manufacturer) { - this.manufacturer = manufacturer; - } - - public String getModel() { - return model; - } - - public void setModel(String model) { - this.model = model; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getDeviceName() { - return deviceName; - } - - public void setDeviceName(String deviceName) { - this.deviceName = deviceName; - } - - -} 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/services/syncml/impl/SyncmlServiceImpl.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/services/syncml/impl/SyncmlServiceImpl.java deleted file mode 100644 index 98723fb2e..000000000 --- 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/services/syncml/impl/SyncmlServiceImpl.java +++ /dev/null @@ -1,404 +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. - * - * - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language go - */ - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -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.EnrolmentInfo; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementException; -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.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.AuthenticationInfo; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ItemTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.ReplaceTag; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlDocument; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.SyncmlHeader; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.WindowsOperationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.Constants; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.DeviceInfo; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationHandler; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.OperationReply; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlGenerator; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlParser; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.SyncmlService; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.beans.WindowsDevice; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; -import org.wso2.carbon.policy.mgt.common.PolicyManagementException; -import org.wso2.carbon.policy.mgt.core.PolicyManagerService; - -import javax.ws.rs.core.Response; -import java.util.ArrayList; -import java.util.List; - -import static org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils.convertToDeviceIdentifierObject; - -/** - * Implementing class of SyncmlImpl interface. - */ -public class SyncmlServiceImpl implements SyncmlService { - - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.syncml.impl.SyncmlServiceImpl.class); - - /** - * This method is used to generate and return Device object from the received information at - * the Syncml step. - * - * @param windowsDevice Windows specific property object. - * @return - Generated device object. - */ - private Device generateDevice(WindowsDevice windowsDevice) { - - Device generatedDevice = new Device(); - - Device.Property OSVersionProperty = new Device.Property(); - OSVersionProperty.setName(PluginConstants.SyncML.OS_VERSION); - OSVersionProperty.setValue(windowsDevice.getOsVersion()); - - Device.Property IMSEIProperty = new Device.Property(); - IMSEIProperty.setName(PluginConstants.SyncML.IMSI); - IMSEIProperty.setValue(windowsDevice.getImsi()); - - Device.Property IMEIProperty = new Device.Property(); - IMEIProperty.setName(PluginConstants.SyncML.IMEI); - IMEIProperty.setValue(windowsDevice.getImei()); - - Device.Property DevManProperty = new Device.Property(); - DevManProperty.setName(PluginConstants.SyncML.VENDOR); - DevManProperty.setValue(windowsDevice.getManufacturer()); - - Device.Property DevModProperty = new Device.Property(); - DevModProperty.setName(PluginConstants.SyncML.MODEL); - DevModProperty.setValue(windowsDevice.getModel()); - - List propertyList = new ArrayList<>(); - propertyList.add(OSVersionProperty); - propertyList.add(IMSEIProperty); - propertyList.add(IMEIProperty); - propertyList.add(DevManProperty); - propertyList.add(DevModProperty); - - EnrolmentInfo enrolmentInfo = new EnrolmentInfo(); - enrolmentInfo.setOwner(windowsDevice.getUser()); - enrolmentInfo.setOwnership(EnrolmentInfo.OwnerShip.BYOD); - enrolmentInfo.setStatus(EnrolmentInfo.Status.ACTIVE); - - generatedDevice.setEnrolmentInfo(enrolmentInfo); - generatedDevice.setDeviceIdentifier(windowsDevice.getDeviceId()); - generatedDevice.setProperties(propertyList); - generatedDevice.setType(windowsDevice.getDeviceType()); - - return generatedDevice; - } - - /** - * Method for calling SyncML engine for producing the Syncml response. For the first SyncML message comes from - * the device, this method produces a response to retrieve device information for enrolling the device. - * - * @param request - SyncML request - * @return - SyncML response - * @throws WindowsOperationException - * @throws WindowsDeviceEnrolmentException - */ - @Override - public Response getResponse(Document request) - throws WindowsDeviceEnrolmentException, WindowsOperationException, NotificationManagementException, - WindowsConfigurationException { - int msgId; - int sessionId; - String user; - String token; - String response; - SyncmlDocument syncmlDocument; - List deviceInfoOperations; - List pendingOperations; - OperationHandler operationHandler = new OperationHandler(); - DeviceInfo deviceInfo = new DeviceInfo(); - - try { - if (SyncmlParser.parseSyncmlPayload(request) != null) { - syncmlDocument = SyncmlParser.parseSyncmlPayload(request); - SyncmlHeader syncmlHeader = syncmlDocument.getHeader(); - sessionId = syncmlHeader.getSessionId(); - user = syncmlHeader.getSource().getLocName(); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlHeader.getSource(). - getLocURI()); - msgId = syncmlHeader.getMsgID(); - if ((PluginConstants.SyncML.SYNCML_FIRST_MESSAGE_ID == msgId) && - (PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId)) { - token = syncmlHeader.getCredential().getData(); - MobileCacheEntry cacheToken = DeviceUtil.getTokenEntry(token); - - if ((cacheToken.getUsername() != null) && (cacheToken.getUsername().equals(user))) { - - if (enrollDevice(request, cacheToken.getTenantDomain(), cacheToken.getTenanatID())) { - deviceInfoOperations = deviceInfo.getDeviceInfo(); - response = generateReply(syncmlDocument, deviceInfoOperations); - return Response.status(Response.Status.OK).entity(response).build(); - } else { - String msg = "Error occurred in device enrollment."; - log.error(msg); - return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); - } - } else { - String msg = "Authentication failure due to incorrect credentials."; - log.error(msg); - return Response.status(Response.Status.UNAUTHORIZED).entity(msg).build(); - } - } else if (PluginConstants.SyncML.SYNCML_SECOND_MESSAGE_ID == msgId && - PluginConstants.SyncML.SYNCML_FIRST_SESSION_ID == sessionId) { - PrivilegedCarbonContext carbonCtx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - if (enrollDevice(request, carbonCtx.getTenantDomain(), carbonCtx.getTenantId())) { - return Response.ok().entity(generateReply(syncmlDocument, null)).build(); - } else { - String msg = "Error occurred in modify enrollment."; - log.error(msg); - return Response.status(Response.Status.NOT_MODIFIED).entity(msg).build(); - } - } else if (sessionId >= PluginConstants.SyncML.SYNCML_SECOND_SESSION_ID) { - if ((syncmlDocument.getBody().getAlert() != null)) { - if (!syncmlDocument.getBody().getAlert().getData().equals(Constants.DISENROLL_ALERT_DATA)) { - pendingOperations = operationHandler.getPendingOperations(syncmlDocument); - return Response.ok().entity(generateReply(syncmlDocument, pendingOperations)).build(); - } else { - if (WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier, false) != null) { - WindowsAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); - return Response.ok().entity(generateReply(syncmlDocument, null)).build(); - } else { - String msg = "Enrolled device can not be found in the server."; - log.error(msg); - return Response.status(Response.Status.NOT_FOUND).entity(msg).build(); - } - } - } else { - pendingOperations = operationHandler.getPendingOperations(syncmlDocument); - return Response.ok().entity(generateReply(syncmlDocument, pendingOperations)).build(); - } - } else { - String msg = "Failure occurred in Device request message."; - log.error(msg); - return Response.status(Response.Status.BAD_REQUEST).entity(msg).build(); - } - } - } catch (SyncmlMessageFormatException e) { - String msg = "Error occurred while parsing syncml request."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } catch (OperationManagementException e) { - String msg = "Cannot access operation management service."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } catch (SyncmlOperationException e) { - String msg = "Error occurred while getting effective feature."; - log.error(msg, e); - throw new WindowsConfigurationException(msg, e); - } catch (DeviceManagementException e) { - String msg = "Failure occurred in dis-enrollment flow."; - log.error(msg, e); - throw new WindowsOperationException(msg, e); - } - return null; - } - - /** - * Enroll phone device - * - * @param request Device syncml request for the server side. - * @return enroll state - * @throws WindowsDeviceEnrolmentException - * @throws WindowsOperationException - */ - private boolean enrollDevice(Document request, String tenantDomain, int tenantId) throws WindowsDeviceEnrolmentException, - WindowsOperationException { - - String osVersion; - String imsi = null; - String imei = null; - String devID; - String devMan; - String devMod; - String devLang; - String vendor; - String macAddress; - String modVersion; - boolean status = false; - String user; - String deviceName; - int msgID; - SyncmlDocument syncmlDocument; - - try { - syncmlDocument = SyncmlParser.parseSyncmlPayload(request); - msgID = syncmlDocument.getHeader().getMsgID(); - if (msgID == PluginConstants.SyncML.SYNCML_FIRST_MESSAGE_ID) { - ReplaceTag replace = syncmlDocument.getBody().getReplace(); - List itemList = replace.getItems(); - devID = itemList.get(PluginConstants.SyncML.DEVICE_ID_POSITION).getData(); - devMan = itemList.get(PluginConstants.SyncML.DEVICE_MAN_POSITION).getData(); - devMod = itemList.get(PluginConstants.SyncML.DEVICE_MODEL_POSITION).getData(); - modVersion = itemList.get(PluginConstants.SyncML.DEVICE_MOD_VER_POSITION).getData(); - devLang = itemList.get(PluginConstants.SyncML.DEVICE_LANG_POSITION).getData(); - user = syncmlDocument.getHeader().getSource().getLocName(); - AuthenticationInfo authenticationInfo = new AuthenticationInfo(); - authenticationInfo.setUsername(user); - authenticationInfo.setTenantDomain(tenantDomain); - authenticationInfo.setTenantId(tenantId); - WindowsAPIUtils.startTenantFlow(authenticationInfo); - - if (log.isDebugEnabled()) { - log.debug( - "OS Version:" + modVersion + ", DevID: " + devID + ", DevMan: " + devMan + - ", DevMod: " + devMod + ", DevLang: " + devLang); - } - WindowsDevice windowsDevice = new WindowsDevice(); - windowsDevice.setDeviceType(DeviceManagementConstants.MobileDeviceTypes. - MOBILE_DEVICE_TYPE_WINDOWS); - windowsDevice.setDeviceId(devID); - windowsDevice.setImei(imei); - windowsDevice.setImsi(imsi); - windowsDevice.setManufacturer(devMan); - windowsDevice.setOsVersion(modVersion); - windowsDevice.setModel(devMod); - windowsDevice.setUser(user); - Device device = generateDevice(windowsDevice); - status = WindowsAPIUtils.getDeviceManagementService().enrollDevice(device); - return status; - - } else if (msgID == PluginConstants.SyncML.SYNCML_SECOND_MESSAGE_ID) { - - List itemList = syncmlDocument.getBody().getResults().getItem(); - osVersion = itemList.get(PluginConstants.SyncML.OSVERSION_POSITION).getData(); - imsi = itemList.get(PluginConstants.SyncML.IMSI_POSITION).getData(); - imei = itemList.get(PluginConstants.SyncML.IMEI_POSITION).getData(); - vendor = itemList.get(PluginConstants.SyncML.VENDOR_POSITION).getData(); - devMod = itemList.get(PluginConstants.SyncML.MODEL_POSITION).getData(); - macAddress = itemList.get(PluginConstants.SyncML.MAC_ADDRESS_POSITION).getData(); - deviceName = itemList.get(PluginConstants.SyncML.DEVICE_NAME_POSITION).getData(); - DeviceIdentifier deviceIdentifier = convertToDeviceIdentifierObject(syncmlDocument. - getHeader().getSource().getLocURI()); - Device existingDevice = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); - if (!existingDevice.getProperties().isEmpty()) { - List existingProperties = new ArrayList<>(); - - Device.Property imeiProperty = new Device.Property(); - imeiProperty.setName(PluginConstants.SyncML.IMEI); - imeiProperty.setValue(imei); - existingProperties.add(imeiProperty); - - Device.Property osVersionProperty = new Device.Property(); - osVersionProperty.setName(PluginConstants.SyncML.OS_VERSION); - osVersionProperty.setValue(osVersion); - existingProperties.add(osVersionProperty); - - Device.Property imsiProperty = new Device.Property(); - imsiProperty.setName(PluginConstants.SyncML.IMSI); - imsiProperty.setValue(imsi); - existingProperties.add(imsiProperty); - - Device.Property vendorProperty = new Device.Property(); - vendorProperty.setName(PluginConstants.SyncML.VENDOR); - vendorProperty.setValue(vendor); - existingProperties.add(vendorProperty); - - Device.Property macAddressProperty = new Device.Property(); - macAddressProperty.setName(PluginConstants.SyncML.MAC_ADDRESS); - macAddressProperty.setValue(macAddress); - existingProperties.add(macAddressProperty); - - Device.Property deviceModelProperty = new Device.Property(); - deviceModelProperty.setName(PluginConstants.SyncML.MODEL); - deviceModelProperty.setValue(devMod); - existingProperties.add(deviceModelProperty); - - existingDevice.setProperties(existingProperties); - existingDevice.setName(deviceName); - existingDevice.setDeviceIdentifier(syncmlDocument.getHeader().getSource().getLocURI()); - existingDevice.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); - status = WindowsAPIUtils.getDeviceManagementService().modifyEnrollment(existingDevice); - // call effective policy for the enrolling device. - PolicyManagerService policyManagerService = WindowsAPIUtils.getPolicyManagerService(); - policyManagerService.getEffectivePolicy(deviceIdentifier); - return status; - } - } - } catch (DeviceManagementException e) { - throw new WindowsDeviceEnrolmentException("Failure occurred while enrolling device.", e); - } catch (PolicyManagementException e) { - throw new WindowsOperationException("Error occurred while getting effective policy.", e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - return status; - } - - /** - * Generate Device payloads. - * - * @param syncmlDocument Parsed syncml payload from the syncml engine. - * @param operations Operations for generate payload. - * @return String type syncml payload. - * @throws WindowsOperationException - * @throws PolicyManagementException - * @throws org.wso2.carbon.policy.mgt.common.FeatureManagementException - */ - public String generateReply(SyncmlDocument syncmlDocument, List operations) - throws SyncmlMessageFormatException, SyncmlOperationException, WindowsOperationException { - - OperationReply operationReply; - SyncmlGenerator generator; - SyncmlDocument syncmlResponse; - if (operations == null) { - operationReply = new OperationReply(syncmlDocument); - } else { - operationReply = new OperationReply(syncmlDocument, operations); - } - syncmlResponse = operationReply.generateReply(); - generator = new SyncmlGenerator(); - return generator.generatePayload(syncmlResponse); - } -} 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/services/wstep/CertificateEnrollmentService.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/services/wstep/CertificateEnrollmentService.java deleted file mode 100644 index 8c6569861..000000000 --- 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/services/wstep/CertificateEnrollmentService.java +++ /dev/null @@ -1,70 +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.services.wstep; - -import io.swagger.annotations.*; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.AdditionalContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestSecurityTokenResponse; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.xml.ws.BindingType; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.soap.SOAPBinding; -import java.io.UnsupportedEncodingException; - -/** - * Interface of WSTEP implementation. - */ - -@WebService(targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE, name = "wstep") -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public interface CertificateEnrollmentService { - - @RequestWrapper(localName = "RequestSecurityToken", targetNamespace = PluginConstants - .WS_TRUST_TARGET_NAMESPACE) - @WebMethod(operationName = "RequestSecurityToken") - @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = - PluginConstants.WS_TRUST_TARGET_NAMESPACE) - @POST - void requestSecurityToken( - @WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String tokenType, - @WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - String requestType, - @WebParam(name = "BinarySecurityToken", targetNamespace = PluginConstants - .WS_SECURITY_TARGET_NAMESPACE) - String binarySecurityToken, - @WebParam(name = "AdditionalContext", targetNamespace = PluginConstants - .SOAP_AUTHORIZATION_TARGET_NAMESPACE) - AdditionalContext additionalContext, - @WebParam(mode = WebParam.Mode.OUT, name = "RequestSecurityTokenResponse", - targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - javax.xml.ws.Holder response) throws - WindowsDeviceEnrolmentException, UnsupportedEncodingException, WAPProvisioningException; -} 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/services/wstep/beans/AdditionalContext.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/services/wstep/beans/AdditionalContext.java deleted file mode 100644 index b6ec47a08..000000000 --- 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/services/wstep/beans/AdditionalContext.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.device.mgt.mobile.windows.api.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -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.util.ArrayList; -import java.util.List; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OIDCollection", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE, - propOrder = {"contextitem"}) -@SuppressWarnings("unused") -public class AdditionalContext { - - @XmlElement(name = "ContextItem", required = true, - namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE) - - protected List contextitem; - - public List getcontextitem() { - if (contextitem == null) { - contextitem = new ArrayList(); - } - return this.contextitem; - } -} - 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/services/wstep/beans/BinarySecurityToken.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/services/wstep/beans/BinarySecurityToken.java deleted file mode 100644 index 1678e8476..000000000 --- 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/services/wstep/beans/BinarySecurityToken.java +++ /dev/null @@ -1,63 +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.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.*; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "BinarySecurityToken", namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE, - propOrder = {"ValueType", "EncodingType"}) -@SuppressWarnings("unused") -public class BinarySecurityToken { - - @XmlAttribute(name = "ValueType") - protected String ValueType; - @XmlAttribute(name = "EncodingType") - protected String EncodingType; - @XmlValue - protected String Token; - - public void setValueType(String valuetype) { - this.ValueType = valuetype; - } - - public String getValueType() { - return this.ValueType; - } - - public void setEncodingType(String encodingtype) { - this.EncodingType = encodingtype; - } - - public String getEncodingType() { - return this.EncodingType; - } - - public void setToken(String token) { - this.Token = token; - } - - public String getToken() { - return this.Token; - } - -} - 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/services/wstep/beans/ContextItem.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/services/wstep/beans/ContextItem.java deleted file mode 100644 index beac6159a..000000000 --- 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/services/wstep/beans/ContextItem.java +++ /dev/null @@ -1,44 +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.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ContextItem", namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE, - propOrder = {"Value"}) -public class ContextItem { - - @XmlElement(required = true, namespace = PluginConstants.SOAP_AUTHORIZATION_TARGET_NAMESPACE) - protected String Value; - - public String getValue() { - return Value; - } - - public void setValue(String value) { - Value = value; - } - -} 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/services/wstep/beans/RequestSecurityToken.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/services/wstep/beans/RequestSecurityToken.java deleted file mode 100644 index 419c83cf0..000000000 --- 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/services/wstep/beans/RequestSecurityToken.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.device.mgt.mobile.windows.api.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RequestedSecurityToken", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"binarySecurityToken"}) -@SuppressWarnings("unused") -public class RequestSecurityToken { - - @XmlElement(name = "BinarySecurityToken", required = true, - namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE) - - protected BinarySecurityToken binarySecurityToken; - - public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { - this.binarySecurityToken = binarysecuritytoken; - } -} \ 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/device/mgt/mobile/windows/api/services/wstep/beans/RequestSecurityTokenResponse.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/services/wstep/beans/RequestSecurityTokenResponse.java deleted file mode 100644 index 86035a509..000000000 --- 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/services/wstep/beans/RequestSecurityTokenResponse.java +++ /dev/null @@ -1,69 +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.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -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 = "RequestSecurityTokenResponse", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"TokenType", "RequestedSecurityToken", "RequestID"}) -@SuppressWarnings("unused") -public class RequestSecurityTokenResponse implements Serializable { - - @XmlElement(name = "TokenType", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - private String TokenType; - - @XmlElement(name = "RequestedSecurityToken", required = true, - namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) - private org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestedSecurityToken RequestedSecurityToken; - - @XmlElement(name = "RequestID", namespace = PluginConstants.ENROLLMENT_POLICY_TARGET_NAMESPACE) - private int RequestID; - - public String getTokenType() { - return TokenType; - } - - public void setTokenType(String tokenType) { - TokenType = tokenType; - } - - public org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestedSecurityToken getRequestedSecurityToken() { - return RequestedSecurityToken; - } - - public void setRequestedSecurityToken(org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestedSecurityToken - requestedSecurityToken) { - RequestedSecurityToken = requestedSecurityToken; - } - - public int getRequestID() { - return RequestID; - } - - public void setRequestID(int requestID) { - RequestID = requestID; - } -} \ 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/device/mgt/mobile/windows/api/services/wstep/beans/RequestedSecurityToken.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/services/wstep/beans/RequestedSecurityToken.java deleted file mode 100644 index d2d549994..000000000 --- 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/services/wstep/beans/RequestedSecurityToken.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.device.mgt.mobile.windows.api.services.wstep.beans; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RequestedSecurityToken", namespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE, - propOrder = {"binarySecurityToken"}) -public class RequestedSecurityToken { - - @XmlElement(name = "BinarySecurityToken", required = true, - namespace = PluginConstants.WS_SECURITY_TARGET_NAMESPACE) - - protected BinarySecurityToken binarySecurityToken; - - public void setBinarySecurityToken(BinarySecurityToken binarysecuritytoken) { - this.binarySecurityToken = binarysecuritytoken; - } -} - 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/services/wstep/beans/package-info.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/services/wstep/beans/package-info.java deleted file mode 100644 index d8ddcf60e..000000000 --- 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/services/wstep/beans/package-info.java +++ /dev/null @@ -1,27 +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. - */ - -@XmlSchema(namespace = "http://www.w3.org/2003/05/soap-envelope", - xmlns = { - @XmlNs(prefix = "", namespaceURI = "http://www.w3.org/2003/05/soap-envelope") - }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans; - -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlSchema; \ 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/device/mgt/mobile/windows/api/services/wstep/impl/CertificateEnrollmentServiceImpl.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/services/wstep/impl/CertificateEnrollmentServiceImpl.java deleted file mode 100644 index 08026a03c..000000000 --- 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/services/wstep/impl/CertificateEnrollmentServiceImpl.java +++ /dev/null @@ -1,352 +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.services.wstep.impl; - -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.digest.DigestUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.cxf.headers.Header; -import org.apache.cxf.helpers.CastUtils; -import org.apache.cxf.jaxws.context.WrappedMessageContext; -import org.apache.cxf.message.Message; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.wso2.carbon.certificate.mgt.core.exception.KeystoreException; -import org.wso2.carbon.certificate.mgt.core.service.CertificateManagementServiceImpl; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; -import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.CertificateGenerationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.SyncmlMessageFormatException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.DeviceUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils; -import org.wso2.carbon.device.mgt.mobile.windows.api.operations.util.SyncmlCredentialUtil; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.CertificateEnrollmentService; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.AdditionalContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.BinarySecurityToken; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestSecurityTokenResponse; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.beans.RequestedSecurityToken; -import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileCacheEntry; -import org.xml.sax.SAXException; - -import javax.annotation.Resource; -import javax.jws.WebService; -import javax.servlet.ServletContext; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.ws.BindingType; -import javax.xml.ws.Holder; -import javax.xml.ws.WebServiceContext; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.soap.Addressing; -import javax.xml.ws.soap.SOAPBinding; -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.security.cert.CertificateEncodingException; -import java.security.cert.X509Certificate; -import java.util.List; - -/** - * Implementation class of CertificateEnrollmentService interface. This class implements MS-WSTEP - * protocol. - */ -@WebService(endpointInterface = PluginConstants.CERTIFICATE_ENROLLMENT_SERVICE_ENDPOINT, - targetNamespace = PluginConstants.DEVICE_ENROLLMENT_SERVICE_TARGET_NAMESPACE) -@Addressing(enabled = true, required = true) -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public class CertificateEnrollmentServiceImpl implements CertificateEnrollmentService { - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.impl.CertificateEnrollmentServiceImpl.class); - private X509Certificate rootCACertificate; - private String pollingFrequency; - private String provisioningURL; - private String domain; - - @Resource - private WebServiceContext context; - - /** - * This method implements MS-WSTEP for Certificate Enrollment Service. - * - * @param tokenType - Device Enrolment Token type is received via device - * @param requestType - WS-Trust request type - * @param binarySecurityToken - CSR from device - * @param additionalContext - Device type and OS version is received - * @param response - Response will include wap-provisioning xml - * @WindowsDeviceEnrolmentException - - */ - @Override - public void requestSecurityToken(String tokenType, String requestType, String binarySecurityToken, - AdditionalContext additionalContext, - Holder response) throws - WindowsDeviceEnrolmentException { - - String headerBinarySecurityToken = null; - String headerTo = null; - String encodedWap; - List
headers = getHeaders(); - for (Header headerElement : headers) { - String nodeName = headerElement.getName().getLocalPart(); - if (PluginConstants.SECURITY.equals(nodeName)) { - Element element = (Element) headerElement.getObject(); - headerBinarySecurityToken = element.getFirstChild().getNextSibling().getFirstChild().getTextContent(); - } - if (PluginConstants.TO.equals(nodeName)) { - Element toElement = (Element) headerElement.getObject(); - headerTo = toElement.getFirstChild().getTextContent(); - } - } - - String[] splitEmail = headerTo.split("(/ENROLLMENTSERVER)"); - String email = splitEmail[PluginConstants.CertificateEnrolment.EMAIL_SEGMENT]; - - String[] splitDomain = email.split("(EnterpriseEnrollment.)"); - domain = splitDomain[PluginConstants.CertificateEnrolment.DOMAIN_SEGMENT]; - provisioningURL = PluginConstants.CertificateEnrolment.ENROLL_SUBDOMAIN + domain + - PluginConstants.CertificateEnrolment.SYNCML_PROVISIONING_SERVICE_URL; - - List tenantConfigurations; - try { - if ((tenantConfigurations = WindowsAPIUtils.getTenantConfigurationData()) != null) { - for (ConfigurationEntry configurationEntry : tenantConfigurations) { - if ((PluginConstants.TenantConfigProperties.NOTIFIER_FREQUENCY.equals( - configurationEntry.getName()))) { - pollingFrequency = configurationEntry.getValue().toString(); - } else { - pollingFrequency = PluginConstants.TenantConfigProperties.DEFAULT_FREQUENCY; - } - } - } else { - pollingFrequency = PluginConstants.TenantConfigProperties.DEFAULT_FREQUENCY; - String msg = "Tenant configurations are not initialized yet."; - log.error(msg); - } - ServletContext ctx = (ServletContext) context.getMessageContext(). - get(MessageContext.SERVLET_CONTEXT); - File wapProvisioningFile = (File) ctx.getAttribute(PluginConstants.CONTEXT_WAP_PROVISIONING_FILE); - if (log.isDebugEnabled()) { - log.debug("Received CSR from Device:" + binarySecurityToken); - } - - String wapProvisioningFilePath = wapProvisioningFile.getPath(); - RequestSecurityTokenResponse requestSecurityTokenResponse = new RequestSecurityTokenResponse(); - requestSecurityTokenResponse.setTokenType(PluginConstants.CertificateEnrolment.TOKEN_TYPE); - - encodedWap = prepareWapProvisioningXML(binarySecurityToken, wapProvisioningFilePath, - headerBinarySecurityToken); - RequestedSecurityToken requestedSecurityToken = new RequestedSecurityToken(); - BinarySecurityToken binarySecToken = new BinarySecurityToken(); - binarySecToken.setValueType(PluginConstants.CertificateEnrolment.VALUE_TYPE); - binarySecToken.setEncodingType(PluginConstants.CertificateEnrolment.ENCODING_TYPE); - binarySecToken.setToken(encodedWap); - requestedSecurityToken.setBinarySecurityToken(binarySecToken); - requestSecurityTokenResponse.setRequestedSecurityToken(requestedSecurityToken); - requestSecurityTokenResponse.setRequestID(PluginConstants.CertificateEnrolment.REQUEST_ID); - response.value = requestSecurityTokenResponse; - } catch (CertificateGenerationException e) { - String msg = "Problem occurred while generating certificate."; - log.error(msg, e); - throw new WindowsDeviceEnrolmentException(msg, e); - } catch (WAPProvisioningException e) { - String msg = "Problem occurred while generating wap-provisioning file."; - log.error(msg, e); - throw new WindowsDeviceEnrolmentException(msg, e); - } catch (DeviceManagementException e) { - String msg = "Error occurred while getting tenant configurations."; - log.error(msg); - throw new WindowsDeviceEnrolmentException(msg, e); - } finally { - PrivilegedCarbonContext.endTenantFlow(); - } - } - - /** - * Method used to Convert the Document object into a String. - * - * @param document - Wap provisioning XML document - * @return - String representation of wap provisioning XML document - * @throws TransformerException - */ - private String convertDocumentToString(Document document) throws TransformerException { - DOMSource DOMSource = new DOMSource(document); - StringWriter stringWriter = new StringWriter(); - StreamResult streamResult = new StreamResult(stringWriter); - TransformerFactory transformerFactory = TransformerFactory.newInstance(); - Transformer transformer = transformerFactory.newTransformer(); - transformer.transform(DOMSource, streamResult); - - return stringWriter.toString(); - } - - /** - * This method prepares the wap-provisioning file by including relevant certificates etc. - * - * @param binarySecurityToken - CSR from device - * @param wapProvisioningFilePath - File path of wap-provisioning file - * @return - base64 encoded final wap-provisioning file as a String - * @throws CertificateGenerationException - * @throws org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException - */ - private String prepareWapProvisioningXML(String binarySecurityToken, String wapProvisioningFilePath, - String headerBst) throws CertificateGenerationException, - WAPProvisioningException, - WindowsDeviceEnrolmentException { - String rootCertEncodedString; - String signedCertEncodedString; - X509Certificate signedCertificate; - String provisioningXmlString; - - CertificateManagementServiceImpl certMgtServiceImpl = CertificateManagementServiceImpl.getInstance(); - Base64 base64Encoder = new Base64(); - try { - rootCACertificate = (X509Certificate) certMgtServiceImpl.getCACertificate(); - rootCertEncodedString = base64Encoder.encodeAsString(rootCACertificate.getEncoded()); - - - signedCertificate = certMgtServiceImpl.getSignedCertificateFromCSR(binarySecurityToken); - signedCertEncodedString = base64Encoder.encodeAsString(signedCertificate.getEncoded()); - - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - domFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - domFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - - DocumentBuilder builder = domFactory.newDocumentBuilder(); - Document document = builder.parse(wapProvisioningFilePath); - NodeList wapParm = document.getElementsByTagName(PluginConstants.CertificateEnrolment.PARM); - Node caCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment.CA_CERTIFICATE_POSITION); - - //Adding SHA1 CA certificate finger print to wap-provisioning xml. - caCertificatePosition.getParentNode().getAttributes().getNamedItem(PluginConstants. - CertificateEnrolment.TYPE).setTextContent(String.valueOf( - DigestUtils.sha1Hex(rootCACertificate.getEncoded())).toUpperCase()); - //Adding encoded CA certificate to wap-provisioning file after removing new line - // characters. - NamedNodeMap rootCertAttributes = caCertificatePosition.getAttributes(); - Node rootCertNode = - rootCertAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - rootCertEncodedString = rootCertEncodedString.replaceAll("\n", ""); - rootCertNode.setTextContent(rootCertEncodedString); - - if (log.isDebugEnabled()) { - log.debug("Root certificate: " + rootCertEncodedString); - } - - Node signedCertificatePosition = wapParm.item(PluginConstants.CertificateEnrolment. - SIGNED_CERTIFICATE_POSITION); - - //Adding SHA1 signed certificate finger print to wap-provisioning xml. - signedCertificatePosition.getParentNode().getAttributes().getNamedItem(PluginConstants. - CertificateEnrolment.TYPE).setTextContent(String.valueOf( - DigestUtils.sha1Hex(signedCertificate.getEncoded())).toUpperCase()); - - //Adding encoded signed certificate to wap-provisioning file after removing new line - // characters. - NamedNodeMap clientCertAttributes = signedCertificatePosition.getAttributes(); - Node clientEncodedNode = - clientCertAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - signedCertEncodedString = signedCertEncodedString.replaceAll("\n", ""); - - clientEncodedNode.setTextContent(signedCertEncodedString); - if (log.isDebugEnabled()) { - log.debug("Signed certificate: " + signedCertEncodedString); - } - - //Adding domainName to wap-provisioning xml. - Node domainPosition = wapParm.item(PluginConstants.CertificateEnrolment.DOMAIN_POSITION); - NamedNodeMap domainAttribute = domainPosition.getAttributes(); - Node domainNode = domainAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - domainNode.setTextContent(domain); - - //Adding Next provisioning service URL to wap-provisioning xml. - Node syncmlServicePosition = wapParm.item(PluginConstants.CertificateEnrolment. - SYNCML_PROVISIONING_ADDR_POSITION); - NamedNodeMap syncmlServiceAttribute = syncmlServicePosition.getAttributes(); - Node syncmlServiceNode = syncmlServiceAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - syncmlServiceNode.setTextContent(provisioningURL); - - // Adding user name auth token to wap-provisioning xml. - Node userNameAuthPosition = wapParm.item(PluginConstants.CertificateEnrolment.APPAUTH_USERNAME_POSITION); - NamedNodeMap appServerAttribute = userNameAuthPosition.getAttributes(); - Node authNameNode = appServerAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - MobileCacheEntry cacheEntry = DeviceUtil.getTokenEntry(headerBst); - String userName = cacheEntry.getUsername(); - authNameNode.setTextContent(cacheEntry.getUsername()); - DeviceUtil.removeTokenEntry(headerBst); - String password = DeviceUtil.generateRandomToken(); - Node passwordAuthPosition = wapParm.item(PluginConstants.CertificateEnrolment.APPAUTH_PASSWORD_POSITION); - NamedNodeMap appSrvPasswordAttribute = passwordAuthPosition.getAttributes(); - Node authPasswordNode = appSrvPasswordAttribute.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - authPasswordNode.setTextContent(password); - String requestSecurityTokenResponse = SyncmlCredentialUtil.generateRST(userName, password); - DeviceUtil.persistChallengeToken(requestSecurityTokenResponse, null, userName); - - // Get device polling frequency from the tenant Configurations. - Node numberOfFirstRetries = wapParm.item(PluginConstants.CertificateEnrolment.POLLING_FREQUENCY_POSITION); - NamedNodeMap pollingAttributes = numberOfFirstRetries.getAttributes(); - Node pollValue = pollingAttributes.getNamedItem(PluginConstants.CertificateEnrolment.VALUE); - pollValue.setTextContent(pollingFrequency); - provisioningXmlString = convertDocumentToString(document); - - } catch (ParserConfigurationException e) { - throw new WAPProvisioningException("Problem occurred while creating configuration request", e); - } catch (CertificateEncodingException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while encoding certificates.", e); - } catch (SAXException e) { - throw new WAPProvisioningException("Error occurred while parsing wap-provisioning.xml file.", e); - } catch (TransformerException e) { - throw new WAPProvisioningException("Error occurred while transforming wap-provisioning.xml file.", e); - } catch (IOException e) { - throw new WAPProvisioningException("Error occurred while getting wap-provisioning.xml file.", e); - } catch (SyncmlMessageFormatException e) { - throw new WindowsDeviceEnrolmentException("Error occurred while generating password hash value.", e); - } catch (KeystoreException e) { - throw new CertificateGenerationException("CA certificate cannot be generated.", e); - } - return base64Encoder.encodeAsString(provisioningXmlString.getBytes()); - } - - /** - * This method get the soap request header contents. - * - * @return List of SOAP headers. - */ - private List
getHeaders() { - MessageContext messageContext = context.getMessageContext(); - if (messageContext == null || !(messageContext instanceof WrappedMessageContext)) { - return null; - } - Message message = ((WrappedMessageContext) messageContext).getWrappedMessage(); - return CastUtils.cast((List) message.get(Header.HEADER_LIST)); - } -} 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/services/wstep/util/CertificateSigningService.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/services/wstep/util/CertificateSigningService.java deleted file mode 100644 index db6f96ec1..000000000 --- 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/services/wstep/util/CertificateSigningService.java +++ /dev/null @@ -1,141 +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.services.wstep.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.bouncycastle.asn1.x509.*; -import org.bouncycastle.cert.CertIOException; -import org.bouncycastle.cert.X509v3CertificateBuilder; -import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; -import org.bouncycastle.operator.ContentSigner; -import org.bouncycastle.operator.OperatorCreationException; -import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; -import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.CertificateGenerationException; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException; - -import javax.security.auth.x500.X500Principal; -import java.math.BigInteger; -import java.security.InvalidKeyException; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.SecureRandom; -import java.security.cert.CertificateException; -import java.security.cert.X509Certificate; -import java.util.Date; -import java.util.List; - -/** - * Class for generating signed certificate for CSR form device. - */ -public class CertificateSigningService { - - private static final long MILLI_SECONDS = 1000L * 60 * 60 * 24; - - private enum PropertyIndex { - COMMON_NAME_INDEX(0), - NOT_BEFORE_DAYS_INDEX(1), - NOT_AFTER_DAYS_INDEX(2); - - private final int itemPosition; - private PropertyIndex(final int itemPosition) { - this.itemPosition = itemPosition; - } - public int getValue() { - return this.itemPosition; - } - } - - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.util.CertificateSigningService.class); - - /** - * Implement certificate signing task using CSR received from the device and the MDM server key - * store. - * @param jcaRequest - CSR from the device - * @param privateKey - Private key of CA certificate in MDM server - * @param caCert - CA certificate in MDM server - * @param certParameterList - Parameter list for Signed certificate generation - * @return - Signed certificate for CSR from device - * @throws CertificateGenerationException - * @throws org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WAPProvisioningException - */ - public static X509Certificate signCSR(JcaPKCS10CertificationRequest jcaRequest, - PrivateKey privateKey, X509Certificate caCert, - List certParameterList) throws - CertificateGenerationException, - WAPProvisioningException { - - String commonName = - (String) certParameterList.get(PropertyIndex.COMMON_NAME_INDEX.getValue()); - int notBeforeDays = - (Integer) certParameterList.get(PropertyIndex.NOT_BEFORE_DAYS_INDEX.getValue()); - int notAfterDays = - (Integer) certParameterList.get(PropertyIndex.NOT_AFTER_DAYS_INDEX.getValue()); - X509v3CertificateBuilder certificateBuilder; - X509Certificate signedCertificate; - - try { - ContentSigner signer; - BigInteger serialNumber = BigInteger.valueOf(new SecureRandom(). - nextInt(Integer.MAX_VALUE)); - Date notBeforeDate = new Date(System.currentTimeMillis() - - (MILLI_SECONDS * notBeforeDays)); - Date notAfterDate = new Date(System.currentTimeMillis() + - (MILLI_SECONDS * notAfterDays)); - certificateBuilder = - new JcaX509v3CertificateBuilder(caCert, serialNumber, notBeforeDate, notAfterDate, - new X500Principal(commonName), - jcaRequest.getPublicKey()); - - //Adding extensions to the signed certificate. - certificateBuilder.addExtension(Extension.keyUsage, true, - new KeyUsage(KeyUsage.digitalSignature)); - certificateBuilder.addExtension(Extension.extendedKeyUsage, false, - new ExtendedKeyUsage(KeyPurposeId.id_kp_clientAuth)); - certificateBuilder.addExtension(Extension.basicConstraints, true, - new BasicConstraints(false)); - - signer = new JcaContentSignerBuilder(PluginConstants.CertificateEnrolment.ALGORITHM). - setProvider(PluginConstants.CertificateEnrolment.PROVIDER).build(privateKey); - - signedCertificate = new JcaX509CertificateConverter().setProvider( - PluginConstants.CertificateEnrolment.PROVIDER).getCertificate( - certificateBuilder.build(signer)); - } catch (InvalidKeyException e) { - throw new CertificateGenerationException("CSR's public key is invalid", e); - } catch (NoSuchAlgorithmException e) { - throw new CertificateGenerationException("Certificate cannot be generated", e); - } - catch (CertIOException e) { - throw new CertificateGenerationException( - "Cannot add extension(s) to signed certificate", e); - } - catch (OperatorCreationException e) { - throw new CertificateGenerationException("Content signer cannot be created", e); - } - catch (CertificateException e) { - throw new CertificateGenerationException("Signed certificate cannot be generated", e); - } - return signedCertificate; - } -} 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/services/wstep/util/KeyStoreGenerator.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/services/wstep/util/KeyStoreGenerator.java deleted file mode 100644 index f123afeab..000000000 --- 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/services/wstep/util/KeyStoreGenerator.java +++ /dev/null @@ -1,94 +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.services.wstep.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.KeyStoreGenerationException; - -import java.io.FileInputStream; -import java.io.IOException; -import java.security.KeyStore; -import java.security.KeyStoreException; -import java.security.NoSuchAlgorithmException; -import java.security.cert.CertificateException; - -/** - * Class for MDM Keystore operations. - */ -public class KeyStoreGenerator { - - private static final Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.util.KeyStoreGenerator.class); - - /** - * This method loads the MDM keystore. - * @param keyStore - MDM Keystore - * @param keyStorePassword - Keystore Password - * @param keyStorePath - Keystore path - * @throws KeyStoreGenerationException - */ - public static void loadToStore(KeyStore keyStore, - char[] keyStorePassword, - String keyStorePath) throws KeyStoreGenerationException { - - FileInputStream fileInputStream = null; - - try { - if (keyStorePath != null) { - fileInputStream = new FileInputStream(keyStorePath); - keyStore.load(fileInputStream, keyStorePassword); - } - } catch (NoSuchAlgorithmException e) { - throw new KeyStoreGenerationException( - "Requested cryptographic algorithm is not available in the environment.", e); - } catch (CertificateException e) { - throw new KeyStoreGenerationException("Error working with certificate related to, " + - keyStorePath, e); - } catch (IOException e) { - throw new KeyStoreGenerationException("File error while working with file, " + - keyStorePath, e); - } finally { - try { - if (fileInputStream != null) { - fileInputStream.close(); - } - } catch (IOException e) { - throw new KeyStoreGenerationException("File error while closing the file, " + - keyStorePath, e); - } - } - } - - /** - * This method is for retrieving instance of Key Store. - * @return Keystore object - * @throws KeyStoreGenerationException - */ - public static KeyStore getKeyStore() throws KeyStoreGenerationException { - try { - return KeyStore.getInstance(PluginConstants.CertificateEnrolment.JKS); - } catch (KeyStoreException e) { - String msg = "KeyStore error while creating new JKS."; - log.error(msg, e); - throw new KeyStoreGenerationException(msg, e); - } - } -} 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/services/wstep/util/MessageHandler.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/services/wstep/util/MessageHandler.java deleted file mode 100644 index b5296f1c5..000000000 --- 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/services/wstep/util/MessageHandler.java +++ /dev/null @@ -1,200 +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.services.wstep.util; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.joda.time.DateTime; -import org.joda.time.format.ISODateTimeFormat; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; - -import javax.ws.rs.core.Response; -import javax.xml.namespace.QName; -import javax.xml.soap.*; -import javax.xml.ws.handler.MessageContext; -import javax.xml.ws.handler.soap.SOAPHandler; -import javax.xml.ws.handler.soap.SOAPMessageContext; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.*; - -/** - * Class responsible for adding Timestamp security header in SOAP message and adding Content-length - * in the HTTP header for avoiding HTTP chunking. - */ -public class MessageHandler implements SOAPHandler { - - public static final String TIME_ZONE = "Z"; - public static final int VALIDITY_TIME = 5; - public static final int TIMESTAMP_END_INDEX = 6; - public static final int TIMESTAMP_BEGIN_INDEX = 0; - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.wstep.util.MessageHandler.class); - - /** - * This method resolves the security header coming in the SOAP message. - * @return - Security Header - */ - @Override - public Set getHeaders() { - QName securityHeader = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, PluginConstants.SECURITY); - HashSet headers = new HashSet(); - headers.add(securityHeader); - return headers; - } - - /** - * This method adds Timestamp for SOAP header, and adds Content-length for HTTP header for - * avoiding HTTP chunking. - * - * @param context - Context of the SOAP Message - */ - @Override - public boolean handleMessage(SOAPMessageContext context) { - - Boolean outBoundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY); - - if (outBoundProperty) { - SOAPMessage message = context.getMessage(); - SOAPHeader header = null; - SOAPEnvelope envelope = null; - try { - header = message.getSOAPHeader(); - envelope = message.getSOAPPart().getEnvelope(); - } catch (SOAPException e) { - Response.serverError().entity("SOAP message content cannot be read.").build(); - } - try { - if ((header == null) && (envelope != null)) { - header = envelope.addHeader(); - } - } catch (SOAPException e) { - Response.serverError().entity("SOAP header cannot be added.").build(); - } - - SOAPFactory soapFactory = null; - try { - soapFactory = SOAPFactory.newInstance(); - } catch (SOAPException e) { - Response.serverError().entity("Cannot get an instance of SOAP factory.").build(); - } - - QName qNamesSecurity = new QName(PluginConstants.WS_SECURITY_TARGET_NAMESPACE, - PluginConstants.CertificateEnrolment.SECURITY); - SOAPHeaderElement Security = null; - Name attributeName = null; - try { - if (header != null) { - Security = header.addHeaderElement(qNamesSecurity); - } - if (soapFactory != null) { - attributeName = - soapFactory.createName(PluginConstants.CertificateEnrolment.TIMESTAMP_ID, - PluginConstants.CertificateEnrolment.TIMESTAMP_U, - PluginConstants.CertificateEnrolment - .WSS_SECURITY_UTILITY); - } - } catch (SOAPException e) { - Response.serverError().entity("Security header cannot be added.").build(); - } - - QName qNameTimestamp = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.TIMESTAMP); - SOAPHeaderElement timestamp = null; - try { - if (header != null) { - timestamp = header.addHeaderElement(qNameTimestamp); - timestamp.addAttribute(attributeName, - PluginConstants.CertificateEnrolment.TIMESTAMP_0); - } - } catch (SOAPException e) { - Response.serverError().entity("Exception while adding timestamp header.").build(); - } - DateTime dateTime = new DateTime(); - DateTime expiredDateTime = dateTime.plusMinutes(VALIDITY_TIME); - String createdISOTime = dateTime.toString(ISODateTimeFormat.dateTime()); - String expiredISOTime = expiredDateTime.toString(ISODateTimeFormat.dateTime()); - createdISOTime = createdISOTime.substring(TIMESTAMP_BEGIN_INDEX, - createdISOTime.length() - - TIMESTAMP_END_INDEX); - createdISOTime = createdISOTime + TIME_ZONE; - expiredISOTime = expiredISOTime.substring(TIMESTAMP_BEGIN_INDEX, - expiredISOTime.length() - - TIMESTAMP_END_INDEX); - expiredISOTime = expiredISOTime + TIME_ZONE; - QName qNameCreated = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.CREATED); - SOAPHeaderElement SOAPHeaderCreated = null; - - try { - if (header != null) { - SOAPHeaderCreated = header.addHeaderElement(qNameCreated); - SOAPHeaderCreated.addTextNode(createdISOTime); - } - } catch (SOAPException e) { - Response.serverError().entity("Exception while creating SOAP header.").build(); - } - QName qNameExpires = new QName(PluginConstants.CertificateEnrolment.WSS_SECURITY_UTILITY, - PluginConstants.CertificateEnrolment.EXPIRES); - SOAPHeaderElement SOAPHeaderExpires = null; - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - String messageString = null; - try { - if (header != null) { - SOAPHeaderExpires = header.addHeaderElement(qNameExpires); - SOAPHeaderExpires.addTextNode(expiredISOTime); - } - if ((timestamp != null) && (Security != null)) { - timestamp.addChildElement(SOAPHeaderCreated); - timestamp.addChildElement(SOAPHeaderExpires); - Security.addChildElement(timestamp); - } - message.saveChanges(); - message.writeTo(outputStream); - messageString = new String(outputStream.toByteArray(), - PluginConstants.CertificateEnrolment.UTF_8); - } catch (SOAPException e) { - Response.serverError().entity("Exception while creating timestamp SOAP header.") - .build(); - } catch (IOException e) { - Response.serverError().entity("Exception while writing message to output stream.") - .build(); - } - - Map> headers = - (Map>) context.get(MessageContext.HTTP_REQUEST_HEADERS); - headers = new HashMap>(); - if (messageString != null) { - headers.put(PluginConstants.CONTENT_LENGTH, Arrays.asList(String.valueOf( - messageString.length()))); - } - context.put(MessageContext.HTTP_REQUEST_HEADERS, headers); - } - return true; - } - - @Override - public boolean handleFault(SOAPMessageContext context) { - return true; - } - - @Override - public void close(MessageContext context) { - } -} 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/services/xcep/CertificateEnrollmentPolicyService.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/services/xcep/CertificateEnrollmentPolicyService.java deleted file mode 100644 index 9b91ef75d..000000000 --- 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/services/xcep/CertificateEnrollmentPolicyService.java +++ /dev/null @@ -1,74 +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.services.xcep; - -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*; - -import javax.jws.WebMethod; -import javax.jws.WebParam; -import javax.jws.WebService; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Produces; -import javax.ws.rs.core.MediaType; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.ws.BindingType; -import javax.xml.ws.Holder; -import javax.xml.ws.RequestWrapper; -import javax.xml.ws.ResponseWrapper; -import javax.xml.ws.soap.SOAPBinding; - -/** - * Interface for MS-XCEP implementation. - */ - -@WebService(targetNamespace = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE, - name = "IPolicy") -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -@XmlSeeAlso({ ObjectFactory.class }) -public interface CertificateEnrollmentPolicyService { - - @RequestWrapper(localName = "GetPolicies", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE, className = PluginConstants.REQUEST_WRAPPER_CLASS_NAME) - @WebMethod(operationName = "GetPolicies") - @ResponseWrapper(localName = "GetPoliciesResponse", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE, className = PluginConstants. - RESPONSE_WRAPPER_CLASS_NAME) - @POST - @Consumes({PluginConstants.SYNCML_MEDIA_TYPE, MediaType.APPLICATION_XML}) - @Produces(PluginConstants.SYNCML_MEDIA_TYPE) - void getPolicies( - @WebParam(name = "client", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE) - Client client, - @WebParam(name = "requestFilter", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE) - RequestFilter requestFilter, - @WebParam(mode = WebParam.Mode.OUT, name = "response", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE) - Holder response, - @WebParam(mode = WebParam.Mode.OUT, name = "cAs", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE) - Holder caCollection, - @WebParam(mode = WebParam.Mode.OUT, name = "oIDs", targetNamespace = PluginConstants. - ENROLLMENT_POLICY_TARGET_NAMESPACE) - Holder oidCollection - ); -} 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/services/xcep/beans/Attributes.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/services/xcep/beans/Attributes.java deleted file mode 100644 index 574003541..000000000 --- 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/services/xcep/beans/Attributes.java +++ /dev/null @@ -1,451 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for Attributes complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="Attributes">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}commonName"/>
- *         <element name="policySchema" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="certificateValidity" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CertificateValidity"/>
- *         <element name="permission" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}EnrollmentPermission"/>
- *         <element name="privateKeyAttributes" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}PrivateKeyAttributes"/>
- *         <element name="revision" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}Revision"/>
- *         <element name="supersededPolicies" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}SupersededPolicies"/>
- *         <element name="privateKeyFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="subjectNameFlags" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedInt"/>
- *         <element name="enrollmentFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="generalFlags" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="hashAlgorithmOIDReference" type="{http://www.w3
- *         .org/2001/XMLSchema}int"/>
- *         <element name="rARequirements" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}RARequirements"/>
- *         <element name="keyArchivalAttributes" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}KeyArchivalAttributes"/>
- *         <element name="extensions" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}ExtensionCollection"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Attributes", propOrder = { - "commonName", - "policySchema", - "certificateValidity", - "permission", - "privateKeyAttributes", - "revision", - "supersededPolicies", - "privateKeyFlags", - "subjectNameFlags", - "enrollmentFlags", - "generalFlags", - "hashAlgorithmOIDReference", - "raRequirements", - "keyArchivalAttributes", - "extensions", - "any" -}) -@SuppressWarnings("unused") -public class Attributes { - - @XmlElement(required = true) - protected String commonName; - @XmlSchemaType(name = "unsignedInt") - protected long policySchema; - @XmlElement(required = true) - protected CertificateValidity certificateValidity; - @XmlElement(required = true) - protected EnrollmentPermission permission; - @XmlElement(required = true) - protected PrivateKeyAttributes privateKeyAttributes; - @XmlElement(required = true) - protected Revision revision; - @XmlElement(required = true, nillable = true) - protected SupersededPolicies supersededPolicies; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long privateKeyFlags; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long subjectNameFlags; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long enrollmentFlags; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long generalFlags; - @XmlElement(required = true, type = Integer.class, nillable = true) - protected Integer hashAlgorithmOIDReference; - @XmlElement(name = "rARequirements", required = true, nillable = true) - protected RARequirements raRequirements; - @XmlElement(required = true, nillable = true) - protected KeyArchivalAttributes keyArchivalAttributes; - @XmlElement(required = true, nillable = true) - protected ExtensionCollection extensions; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the commonName property. - * - * @return possible object is - * {@link String } - */ - public String getCommonName() { - return commonName; - } - - /** - * Sets the value of the commonName property. - * - * @param value allowed object is - * {@link String } - */ - public void setCommonName(String value) { - this.commonName = value; - } - - /** - * Gets the value of the policySchema property. - */ - public long getPolicySchema() { - return policySchema; - } - - /** - * Sets the value of the policySchema property. - */ - public void setPolicySchema(long value) { - this.policySchema = value; - } - - /** - * Gets the value of the certificateValidity property. - * - * @return possible object is - * {@link CertificateValidity } - */ - public CertificateValidity getCertificateValidity() { - return certificateValidity; - } - - /** - * Sets the value of the certificateValidity property. - * - * @param value allowed object is - * {@link CertificateValidity } - */ - public void setCertificateValidity(CertificateValidity value) { - this.certificateValidity = value; - } - - /** - * Gets the value of the permission property. - * - * @return possible object is - * {@link EnrollmentPermission } - */ - public EnrollmentPermission getPermission() { - return permission; - } - - /** - * Sets the value of the permission property. - * - * @param value allowed object is - * {@link EnrollmentPermission } - */ - public void setPermission(EnrollmentPermission value) { - this.permission = value; - } - - /** - * Gets the value of the privateKeyAttributes property. - * - * @return possible object is - * {@link PrivateKeyAttributes } - */ - public PrivateKeyAttributes getPrivateKeyAttributes() { - return privateKeyAttributes; - } - - /** - * Sets the value of the privateKeyAttributes property. - * - * @param value allowed object is - * {@link PrivateKeyAttributes } - */ - public void setPrivateKeyAttributes(PrivateKeyAttributes value) { - this.privateKeyAttributes = value; - } - - /** - * Gets the value of the revision property. - * - * @return possible object is - * {@link Revision } - */ - public Revision getRevision() { - return revision; - } - - /** - * Sets the value of the revision property. - * - * @param value allowed object is - * {@link Revision } - */ - public void setRevision(Revision value) { - this.revision = value; - } - - /** - * Gets the value of the supersededPolicies property. - * - * @return possible object is - * {@link SupersededPolicies } - */ - public SupersededPolicies getSupersededPolicies() { - return supersededPolicies; - } - - /** - * Sets the value of the supersededPolicies property. - * - * @param value allowed object is - * {@link SupersededPolicies } - */ - public void setSupersededPolicies(SupersededPolicies value) { - this.supersededPolicies = value; - } - - /** - * Gets the value of the privateKeyFlags property. - * - * @return possible object is - * {@link Long } - */ - public Long getPrivateKeyFlags() { - return privateKeyFlags; - } - - /** - * Sets the value of the privateKeyFlags property. - * - * @param value allowed object is - * {@link Long } - */ - public void setPrivateKeyFlags(Long value) { - this.privateKeyFlags = value; - } - - /** - * Gets the value of the subjectNameFlags property. - * - * @return possible object is - * {@link Long } - */ - public Long getSubjectNameFlags() { - return subjectNameFlags; - } - - /** - * Sets the value of the subjectNameFlags property. - * - * @param value allowed object is - * {@link Long } - */ - public void setSubjectNameFlags(Long value) { - this.subjectNameFlags = value; - } - - /** - * Gets the value of the enrollmentFlags property. - * - * @return possible object is - * {@link Long } - */ - public Long getEnrollmentFlags() { - return enrollmentFlags; - } - - /** - * Sets the value of the enrollmentFlags property. - * - * @param value allowed object is - * {@link Long } - */ - public void setEnrollmentFlags(Long value) { - this.enrollmentFlags = value; - } - - /** - * Gets the value of the generalFlags property. - * - * @return possible object is - * {@link Long } - */ - public Long getGeneralFlags() { - return generalFlags; - } - - /** - * Sets the value of the generalFlags property. - * - * @param value allowed object is - * {@link Long } - */ - public void setGeneralFlags(Long value) { - this.generalFlags = value; - } - - /** - * Gets the value of the hashAlgorithmOIDReference property. - * - * @return possible object is - * {@link Integer } - */ - public Integer getHashAlgorithmOIDReference() { - return hashAlgorithmOIDReference; - } - - /** - * Sets the value of the hashAlgorithmOIDReference property. - * - * @param value allowed object is - * {@link Integer } - */ - public void setHashAlgorithmOIDReference(Integer value) { - this.hashAlgorithmOIDReference = value; - } - - /** - * Gets the value of the raRequirements property. - * - * @return possible object is - * {@link RARequirements } - */ - public RARequirements getRARequirements() { - return raRequirements; - } - - /** - * Sets the value of the raRequirements property. - * - * @param value allowed object is - * {@link RARequirements } - */ - public void setRARequirements(RARequirements value) { - this.raRequirements = value; - } - - /** - * Gets the value of the keyArchivalAttributes property. - * - * @return possible object is - * {@link KeyArchivalAttributes } - */ - public KeyArchivalAttributes getKeyArchivalAttributes() { - return keyArchivalAttributes; - } - - /** - * Sets the value of the keyArchivalAttributes property. - * - * @param value allowed object is - * {@link KeyArchivalAttributes } - */ - public void setKeyArchivalAttributes(KeyArchivalAttributes value) { - this.keyArchivalAttributes = value; - } - - /** - * Gets the value of the extensions property. - * - * @return possible object is - * {@link ExtensionCollection } - */ - public ExtensionCollection getExtensions() { - return extensions; - } - - /** - * Sets the value of the extensions property. - * - * @param value allowed object is - * {@link ExtensionCollection } - */ - public void setExtensions(ExtensionCollection value) { - this.extensions = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/CA.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/services/xcep/beans/CA.java deleted file mode 100644 index 35a2c7906..000000000 --- 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/services/xcep/beans/CA.java +++ /dev/null @@ -1,166 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for CA complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CA">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="uris" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CAURICollection"/>
- *         <element name="certificate" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
- *         <element name="enrollPermission" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="cAReferenceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CA", propOrder = { - "uris", - "certificate", - "enrollPermission", - "caReferenceID", - "any" -}) -@SuppressWarnings("unused") -public class CA { - - @XmlElement(required = true) - protected CAURICollection uris; - @XmlElement(required = true) - protected byte[] certificate; - protected boolean enrollPermission; - @XmlElement(name = "cAReferenceID") - protected int caReferenceID; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the uris property. - * - * @return possible object is - * {@link CAURICollection } - */ - public CAURICollection getUris() { - return uris; - } - - /** - * Sets the value of the uris property. - * - * @param value allowed object is - * {@link CAURICollection } - */ - public void setUris(CAURICollection value) { - this.uris = value; - } - - /** - * Gets the value of the certificate property. - * - * @return possible object is - * byte[] - */ - public byte[] getCertificate() { - return certificate; - } - - /** - * Sets the value of the certificate property. - * - * @param value allowed object is - * byte[] - */ - public void setCertificate(byte[] value) { - this.certificate = value; - } - - /** - * Gets the value of the enrollPermission property. - */ - public boolean isEnrollPermission() { - return enrollPermission; - } - - /** - * Sets the value of the enrollPermission property. - */ - public void setEnrollPermission(boolean value) { - this.enrollPermission = value; - } - - /** - * Gets the value of the caReferenceID property. - */ - public int getCAReferenceID() { - return caReferenceID; - } - - /** - * Sets the value of the caReferenceID property. - */ - public void setCAReferenceID(int value) { - this.caReferenceID = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/CACollection.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/services/xcep/beans/CACollection.java deleted file mode 100644 index c9b25be1e..000000000 --- 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/services/xcep/beans/CACollection.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for CACollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CACollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="cA" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CA" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CACollection", propOrder = { - "ca" -}) -@SuppressWarnings("unused") -public class CACollection { - - @XmlElement(name = "cA", required = true) - protected List ca; - - /** - * Gets the value of the ca property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the ca property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getCA().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link CA } - */ - public List getCA() { - if (ca == null) { - ca = new ArrayList(); - } - return this.ca; - } - -} 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/services/xcep/beans/CAReferenceCollection.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/services/xcep/beans/CAReferenceCollection.java deleted file mode 100644 index 17b1f2b18..000000000 --- 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/services/xcep/beans/CAReferenceCollection.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for CAReferenceCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CAReferenceCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="cAReference" type="{http://www.w3.org/2001/XMLSchema}int"
- *         maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CAReferenceCollection", propOrder = { - "caReference" -}) -@SuppressWarnings("unused") -public class CAReferenceCollection { - - @XmlElement(name = "cAReference", type = Integer.class) - protected List caReference; - - /** - * Gets the value of the caReference property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the caReference property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getCAReference().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Integer } - */ - public List getCAReference() { - if (caReference == null) { - caReference = new ArrayList(); - } - return this.caReference; - } - -} 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/services/xcep/beans/CAURI.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/services/xcep/beans/CAURI.java deleted file mode 100644 index 0cbca953d..000000000 --- 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/services/xcep/beans/CAURI.java +++ /dev/null @@ -1,168 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for CAURI complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CAURI">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="clientAuthentication" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedInt"/>
- *         <element name="uri" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
- *         <element name="priority" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="renewalOnly" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CAURI", propOrder = { - "clientAuthentication", - "uri", - "priority", - "renewalOnly", - "any" -}) -@SuppressWarnings("unused") -public class CAURI { - - @XmlSchemaType(name = "unsignedInt") - protected long clientAuthentication; - @XmlElement(required = true) - @XmlSchemaType(name = "anyURI") - protected String uri; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long priority; - protected boolean renewalOnly; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the clientAuthentication property. - */ - public long getClientAuthentication() { - return clientAuthentication; - } - - /** - * Sets the value of the clientAuthentication property. - */ - public void setClientAuthentication(long value) { - this.clientAuthentication = value; - } - - /** - * Gets the value of the uri property. - * - * @return possible object is - * {@link String } - */ - public String getUri() { - return uri; - } - - /** - * Sets the value of the uri property. - * - * @param value allowed object is - * {@link String } - */ - public void setUri(String value) { - this.uri = value; - } - - /** - * Gets the value of the priority property. - * - * @return possible object is - * {@link Long } - */ - public Long getPriority() { - return priority; - } - - /** - * Sets the value of the priority property. - * - * @param value allowed object is - * {@link Long } - */ - public void setPriority(Long value) { - this.priority = value; - } - - /** - * Gets the value of the renewalOnly property. - */ - public boolean isRenewalOnly() { - return renewalOnly; - } - - /** - * Sets the value of the renewalOnly property. - */ - public void setRenewalOnly(boolean value) { - this.renewalOnly = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/CAURICollection.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/services/xcep/beans/CAURICollection.java deleted file mode 100644 index 1067c06f9..000000000 --- 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/services/xcep/beans/CAURICollection.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for CAURICollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CAURICollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="cAURI" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CAURI" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CAURICollection", propOrder = { - "cauri" -}) -@SuppressWarnings("unused") -public class CAURICollection { - - @XmlElement(name = "cAURI", required = true) - protected List cauri; - - /** - * Gets the value of the cauri property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the cauri property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getCAURI().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link CAURI } - */ - public List getCAURI() { - if (cauri == null) { - cauri = new ArrayList(); - } - return this.cauri; - } - -} 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/services/xcep/beans/CertificateEnrollmentPolicy.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/services/xcep/beans/CertificateEnrollmentPolicy.java deleted file mode 100644 index a55456f66..000000000 --- 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/services/xcep/beans/CertificateEnrollmentPolicy.java +++ /dev/null @@ -1,149 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for CertificateEnrollmentPolicy complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CertificateEnrollmentPolicy">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="policyOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="cAs" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CAReferenceCollection"/>
- *         <element name="attributes" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}Attributes"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CertificateEnrollmentPolicy", propOrder = { - "policyOIDReference", - "cAs", - "attributes", - "any" -}) -@SuppressWarnings("unused") -public class CertificateEnrollmentPolicy { - - protected int policyOIDReference; - @XmlElement(required = true, nillable = true) - protected CAReferenceCollection cAs; - @XmlElement(required = true) - protected Attributes attributes; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the policyOIDReference property. - */ - public int getPolicyOIDReference() { - return policyOIDReference; - } - - /** - * Sets the value of the policyOIDReference property. - */ - public void setPolicyOIDReference(int value) { - this.policyOIDReference = value; - } - - /** - * Gets the value of the cAs property. - * - * @return possible object is - * {@link CAReferenceCollection } - */ - public CAReferenceCollection getCAs() { - return cAs; - } - - /** - * Sets the value of the cAs property. - * - * @param value allowed object is - * {@link CAReferenceCollection } - */ - public void setCAs(CAReferenceCollection value) { - this.cAs = value; - } - - /** - * Gets the value of the attributes property. - * - * @return possible object is - * {@link Attributes } - */ - public Attributes getAttributes() { - return attributes; - } - - /** - * Sets the value of the attributes property. - * - * @param value allowed object is - * {@link Attributes } - */ - public void setAttributes(Attributes value) { - this.attributes = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/CertificateValidity.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/services/xcep/beans/CertificateValidity.java deleted file mode 100644 index 85fba4b88..000000000 --- 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/services/xcep/beans/CertificateValidity.java +++ /dev/null @@ -1,99 +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.services.xcep.beans; - -import javax.xml.bind.annotation.*; -import java.math.BigInteger; - -/** - *

Java class for CertificateValidity complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CertificateValidity">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="validityPeriodSeconds" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedLong"/>
- *         <element name="renewalPeriodSeconds" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedLong"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CertificateValidity", propOrder = { - "validityPeriodSeconds", - "renewalPeriodSeconds" -}) -@SuppressWarnings("unused") -public class CertificateValidity { - - @XmlElement(required = true) - @XmlSchemaType(name = "unsignedLong") - protected BigInteger validityPeriodSeconds; - @XmlElement(required = true) - @XmlSchemaType(name = "unsignedLong") - protected BigInteger renewalPeriodSeconds; - - /** - * Gets the value of the validityPeriodSeconds property. - * - * @return possible object is - * {@link BigInteger } - */ - public BigInteger getValidityPeriodSeconds() { - return validityPeriodSeconds; - } - - /** - * Sets the value of the validityPeriodSeconds property. - * - * @param value allowed object is - * {@link BigInteger } - */ - public void setValidityPeriodSeconds(BigInteger value) { - this.validityPeriodSeconds = value; - } - - /** - * Gets the value of the renewalPeriodSeconds property. - * - * @return possible object is - * {@link BigInteger } - */ - public BigInteger getRenewalPeriodSeconds() { - return renewalPeriodSeconds; - } - - /** - * Sets the value of the renewalPeriodSeconds property. - * - * @param value allowed object is - * {@link BigInteger } - */ - public void setRenewalPeriodSeconds(BigInteger value) { - this.renewalPeriodSeconds = value; - } - -} 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/services/xcep/beans/Client.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/services/xcep/beans/Client.java deleted file mode 100644 index dfb7bde93..000000000 --- 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/services/xcep/beans/Client.java +++ /dev/null @@ -1,136 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import javax.xml.bind.annotation.adapters.CollapsedStringAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.datatype.XMLGregorianCalendar; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for Client complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="Client">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="lastUpdate" type="{http://www.w3.org/2001/XMLSchema}dateTime"/>
- *         <element name="preferredLanguage" type="{http://www.w3.org/2001/XMLSchema}language"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Client", propOrder = { - "lastUpdate", - "preferredLanguage", - "any" -}) -@SuppressWarnings("unused") -public class Client { - - @XmlElement(required = true, nillable = true) - @XmlSchemaType(name = "dateTime") - protected XMLGregorianCalendar lastUpdate; - @XmlElement(required = true, nillable = true) - @XmlJavaTypeAdapter(CollapsedStringAdapter.class) - @XmlSchemaType(name = "language") - protected String preferredLanguage; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the lastUpdate property. - * - * @return possible object is - * {@link XMLGregorianCalendar } - */ - public XMLGregorianCalendar getLastUpdate() { - return lastUpdate; - } - - /** - * Sets the value of the lastUpdate property. - * - * @param value allowed object is - * {@link XMLGregorianCalendar } - */ - public void setLastUpdate(XMLGregorianCalendar value) { - this.lastUpdate = value; - } - - /** - * Gets the value of the preferredLanguage property. - * - * @return possible object is - * {@link String } - */ - public String getPreferredLanguage() { - return preferredLanguage; - } - - /** - * Sets the value of the preferredLanguage property. - * - * @param value allowed object is - * {@link String } - */ - public void setPreferredLanguage(String value) { - this.preferredLanguage = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/CryptoProviders.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/services/xcep/beans/CryptoProviders.java deleted file mode 100644 index 4f0258ac5..000000000 --- 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/services/xcep/beans/CryptoProviders.java +++ /dev/null @@ -1,87 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for CryptoProviders complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="CryptoProviders">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="provider" type="{http://www.w3.org/2001/XMLSchema}string"
- *         maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "CryptoProviders", propOrder = { - "provider" -}) -@SuppressWarnings("unused") -public class CryptoProviders { - - @XmlElement(required = true) - protected List provider; - - /** - * Instantiate provider list in the constructor - */ - public CryptoProviders() { - this.provider = new ArrayList(); - } - - /** - * Gets the value of the provider property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the provider property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getProvider().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link String } - */ - public List getProvider() { - return this.provider; - } - -} 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/services/xcep/beans/EnrollmentPermission.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/services/xcep/beans/EnrollmentPermission.java deleted file mode 100644 index d2b5670f6..000000000 --- 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/services/xcep/beans/EnrollmentPermission.java +++ /dev/null @@ -1,82 +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.services.xcep.beans; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; - -/** - *

Java class for EnrollmentPermission complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="EnrollmentPermission">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="enroll" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="autoEnroll" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "EnrollmentPermission", propOrder = { - "enroll", - "autoEnroll" -}) -@SuppressWarnings("unused") -public class EnrollmentPermission { - - protected boolean enroll; - protected boolean autoEnroll; - - /** - * Gets the value of the enroll property. - */ - public boolean isEnroll() { - return enroll; - } - - /** - * Sets the value of the enroll property. - */ - public void setEnroll(boolean value) { - this.enroll = value; - } - - /** - * Gets the value of the autoEnroll property. - */ - public boolean isAutoEnroll() { - return autoEnroll; - } - - /** - * Sets the value of the autoEnroll property. - */ - public void setAutoEnroll(boolean value) { - this.autoEnroll = value; - } - -} 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/services/xcep/beans/Extension.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/services/xcep/beans/Extension.java deleted file mode 100644 index 8f165ee5b..000000000 --- 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/services/xcep/beans/Extension.java +++ /dev/null @@ -1,108 +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.services.xcep.beans; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlType; - -/** - *

Java class for Extension complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="Extension">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="critical" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Extension", propOrder = { - "oidReference", - "critical", - "value" -}) -@SuppressWarnings("unused") -public class Extension { - - @XmlElement(name = "oIDReference") - protected int oidReference; - protected boolean critical; - @XmlElement(required = true, nillable = true) - protected byte[] value; - - /** - * Gets the value of the oidReference property. - */ - public int getOIDReference() { - return oidReference; - } - - /** - * Sets the value of the oidReference property. - */ - public void setOIDReference(int value) { - this.oidReference = value; - } - - /** - * Gets the value of the critical property. - */ - public boolean isCritical() { - return critical; - } - - /** - * Sets the value of the critical property. - */ - public void setCritical(boolean value) { - this.critical = value; - } - - /** - * Gets the value of the value property. - * - * @return possible object is - * byte[] - */ - public byte[] getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value allowed object is - * byte[] - */ - public void setValue(byte[] value) { - this.value = value; - } - -} 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/services/xcep/beans/ExtensionCollection.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/services/xcep/beans/ExtensionCollection.java deleted file mode 100644 index 3c4b0e7ed..000000000 --- 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/services/xcep/beans/ExtensionCollection.java +++ /dev/null @@ -1,87 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for ExtensionCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="ExtensionCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="extension" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}Extension" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "ExtensionCollection", propOrder = { - "extension" -}) -@SuppressWarnings("unused") -public class ExtensionCollection { - - @XmlElement(required = true) - protected List extension; - - /** - * Instantiate extension list in the constructor - */ - public ExtensionCollection() { - this.extension = new ArrayList(); - } - - /** - * Gets the value of the extension property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the extension property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getExtension().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Extension } - */ - public List getExtension() { - return this.extension; - } - -} 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/services/xcep/beans/FilterOIDCollection.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/services/xcep/beans/FilterOIDCollection.java deleted file mode 100644 index b1f20d9b4..000000000 --- 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/services/xcep/beans/FilterOIDCollection.java +++ /dev/null @@ -1,87 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for FilterOIDCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="FilterOIDCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oid" type="{http://www.w3.org/2001/XMLSchema}string"
- *         maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "FilterOIDCollection", propOrder = { - "oid" -}) -@SuppressWarnings("unused") -public class FilterOIDCollection { - - @XmlElement(required = true) - protected List oid; - - /** - * Instantiate oid list in the constructor - */ - public FilterOIDCollection() { - this.oid = new ArrayList(); - } - - /** - * Gets the value of the oid property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the oid property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getOid().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link String } - */ - public List getOid() { - return this.oid; - } - -} 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/services/xcep/beans/GetPolicies.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/services/xcep/beans/GetPolicies.java deleted file mode 100644 index 0cf2535b9..000000000 --- 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/services/xcep/beans/GetPolicies.java +++ /dev/null @@ -1,97 +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.services.xcep.beans; - -import javax.xml.bind.annotation.*; - -/** - *

Java class for anonymous complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="client" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}Client"/>
- *         <element name="requestFilter" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}RequestFilter"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "client", - "requestFilter" -}) -@XmlRootElement(name = "GetPolicies") -@SuppressWarnings("unused") -public class GetPolicies { - - @XmlElement(required = true) - protected Client client; - @XmlElement(required = true, nillable = true) - protected RequestFilter requestFilter; - - /** - * Gets the value of the client property. - * - * @return possible object is - * {@link Client } - */ - public Client getClient() { - return client; - } - - /** - * Sets the value of the client property. - * - * @param value allowed object is - * {@link Client } - */ - public void setClient(Client value) { - this.client = value; - } - - /** - * Gets the value of the requestFilter property. - * - * @return possible object is - * {@link RequestFilter } - */ - public RequestFilter getRequestFilter() { - return requestFilter; - } - - /** - * Sets the value of the requestFilter property. - * - * @param value allowed object is - * {@link RequestFilter } - */ - public void setRequestFilter(RequestFilter value) { - this.requestFilter = value; - } - -} 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/services/xcep/beans/GetPoliciesResponse.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/services/xcep/beans/GetPoliciesResponse.java deleted file mode 100644 index fe824d8c6..000000000 --- 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/services/xcep/beans/GetPoliciesResponse.java +++ /dev/null @@ -1,122 +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.services.xcep.beans; - -import javax.xml.bind.annotation.*; - -/** - *

Java class for anonymous complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="response" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}Response"/>
- *         <element name="cAs" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CACollection"/>
- *         <element name="oIDs" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}OIDCollection"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "response", - "cAs", - "oiDs" -}) -@XmlRootElement(name = "GetPoliciesResponse") -@SuppressWarnings("unused") -public class GetPoliciesResponse { - - @XmlElement(required = true, nillable = true) - protected Response response; - @XmlElement(required = true, nillable = true) - protected CACollection cAs; - @XmlElement(name = "oIDs", required = true, nillable = true) - protected OIDCollection oiDs; - - /** - * Gets the value of the response property. - * - * @return possible object is - * {@link Response } - */ - public Response getResponse() { - return response; - } - - /** - * Sets the value of the response property. - * - * @param value allowed object is - * {@link Response } - */ - public void setResponse(Response value) { - this.response = value; - } - - /** - * Gets the value of the cAs property. - * - * @return possible object is - * {@link CACollection } - */ - public CACollection getCAs() { - return cAs; - } - - /** - * Sets the value of the cAs property. - * - * @param value allowed object is - * {@link CACollection } - */ - public void setCAs(CACollection value) { - this.cAs = value; - } - - /** - * Gets the value of the oiDs property. - * - * @return possible object is - * {@link OIDCollection } - */ - public OIDCollection getOIDs() { - return oiDs; - } - - /** - * Sets the value of the oiDs property. - * - * @param value allowed object is - * {@link OIDCollection } - */ - public void setOIDs(OIDCollection value) { - this.oiDs = value; - } - -} 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/services/xcep/beans/KeyArchivalAttributes.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/services/xcep/beans/KeyArchivalAttributes.java deleted file mode 100644 index c9d955d97..000000000 --- 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/services/xcep/beans/KeyArchivalAttributes.java +++ /dev/null @@ -1,86 +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.services.xcep.beans; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; - -/** - *

Java class for KeyArchivalAttributes complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="KeyArchivalAttributes">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="symmetricAlgorithmOIDReference" type="{http://www.w3
- *         .org/2001/XMLSchema}int"/>
- *         <element name="symmetricAlgorithmKeyLength" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedInt"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "KeyArchivalAttributes", propOrder = { - "symmetricAlgorithmOIDReference", - "symmetricAlgorithmKeyLength" -}) -@SuppressWarnings("unused") -public class KeyArchivalAttributes { - - protected int symmetricAlgorithmOIDReference; - @XmlSchemaType(name = "unsignedInt") - protected long symmetricAlgorithmKeyLength; - - /** - * Gets the value of the symmetricAlgorithmOIDReference property. - */ - public int getSymmetricAlgorithmOIDReference() { - return symmetricAlgorithmOIDReference; - } - - /** - * Sets the value of the symmetricAlgorithmOIDReference property. - */ - public void setSymmetricAlgorithmOIDReference(int value) { - this.symmetricAlgorithmOIDReference = value; - } - - /** - * Gets the value of the symmetricAlgorithmKeyLength property. - */ - public long getSymmetricAlgorithmKeyLength() { - return symmetricAlgorithmKeyLength; - } - - /** - * Sets the value of the symmetricAlgorithmKeyLength property. - */ - public void setSymmetricAlgorithmKeyLength(long value) { - this.symmetricAlgorithmKeyLength = value; - } - -} 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/services/xcep/beans/OID.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/services/xcep/beans/OID.java deleted file mode 100644 index 1638fd872..000000000 --- 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/services/xcep/beans/OID.java +++ /dev/null @@ -1,166 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for OID complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="OID">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="value" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="group" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="oIDReferenceID" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="defaultName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OID", propOrder = { - "value", - "group", - "oidReferenceID", - "defaultName", - "any" -}) -@SuppressWarnings("unused") -public class OID { - - @XmlElement(required = true) - protected String value; - @XmlSchemaType(name = "unsignedInt") - protected long group; - @XmlElement(name = "oIDReferenceID") - protected int oidReferenceID; - @XmlElement(required = true, nillable = true) - protected String defaultName; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the value property. - * - * @return possible object is - * {@link String } - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value allowed object is - * {@link String } - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the group property. - */ - public long getGroup() { - return group; - } - - /** - * Sets the value of the group property. - */ - public void setGroup(long value) { - this.group = value; - } - - /** - * Gets the value of the oidReferenceID property. - */ - public int getOIDReferenceID() { - return oidReferenceID; - } - - /** - * Sets the value of the oidReferenceID property. - */ - public void setOIDReferenceID(int value) { - this.oidReferenceID = value; - } - - /** - * Gets the value of the defaultName property. - * - * @return possible object is - * {@link String } - */ - public String getDefaultName() { - return defaultName; - } - - /** - * Sets the value of the defaultName property. - * - * @param value allowed object is - * {@link String } - */ - public void setDefaultName(String value) { - this.defaultName = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/OIDCollection.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/services/xcep/beans/OIDCollection.java deleted file mode 100644 index c0945f833..000000000 --- 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/services/xcep/beans/OIDCollection.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for OIDCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="OIDCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oID" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}OID" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OIDCollection", propOrder = { - "oid" -}) -@SuppressWarnings("unused") -public class OIDCollection { - - @XmlElement(name = "oID", required = true) - protected List oid; - - /** - * Gets the value of the oid property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the oid property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getOID().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link OID } - */ - public List getOID() { - if (oid == null) { - oid = new ArrayList(); - } - return this.oid; - } - -} 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/services/xcep/beans/OIDReferenceCollection.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/services/xcep/beans/OIDReferenceCollection.java deleted file mode 100644 index 36c28baea..000000000 --- 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/services/xcep/beans/OIDReferenceCollection.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for OIDReferenceCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="OIDReferenceCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="oIDReference" type="{http://www.w3.org/2001/XMLSchema}int"
- *         maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "OIDReferenceCollection", propOrder = { - "oidReference" -}) -@SuppressWarnings("unused") -public class OIDReferenceCollection { - - @XmlElement(name = "oIDReference", type = Integer.class) - protected List oidReference; - - /** - * Gets the value of the oidReference property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the oidReference property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getOIDReference().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Integer } - */ - public List getOIDReference() { - if (oidReference == null) { - oidReference = new ArrayList(); - } - return this.oidReference; - } - -} 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/services/xcep/beans/ObjectFactory.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/services/xcep/beans/ObjectFactory.java deleted file mode 100644 index e95b4240d..000000000 --- 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/services/xcep/beans/ObjectFactory.java +++ /dev/null @@ -1,253 +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.services.xcep.beans; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - */ -@XmlRegistry -@SuppressWarnings("unused") -public class ObjectFactory { - - private final static QName _CommonName_QNAME = - new QName("http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy", - "commonName"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived - * classes for package: com.microsoft.schemas.windows.pki._2009._01.enrollmentpolicy - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link GetPolicies } - */ - public GetPolicies createGetPolicies() { - return new GetPolicies(); - } - - /** - * Create an instance of {@link Client } - */ - public Client createClient() { - return new Client(); - } - - /** - * Create an instance of {@link RequestFilter } - */ - public RequestFilter createRequestFilter() { - return new RequestFilter(); - } - - /** - * Create an instance of {@link GetPoliciesResponse } - */ - public GetPoliciesResponse createGetPoliciesResponse() { - return new GetPoliciesResponse(); - } - - /** - * Create an instance of {@link Response } - */ - public Response createResponse() { - return new Response(); - } - - /** - * Create an instance of {@link CACollection } - */ - public CACollection createCACollection() { - return new CACollection(); - } - - /** - * Create an instance of {@link OIDCollection } - */ - public OIDCollection createOIDCollection() { - return new OIDCollection(); - } - - /** - * Create an instance of {@link SupersededPolicies } - */ - public SupersededPolicies createSupersededPolicies() { - return new SupersededPolicies(); - } - - /** - * Create an instance of {@link OID } - */ - public OID createOID() { - return new OID(); - } - - /** - * Create an instance of {@link ExtensionCollection } - */ - public ExtensionCollection createExtensionCollection() { - return new ExtensionCollection(); - } - - /** - * Create an instance of {@link Attributes } - */ - public Attributes createAttributes() { - return new Attributes(); - } - - /** - * Create an instance of {@link EnrollmentPermission } - */ - public EnrollmentPermission createEnrollmentPermission() { - return new EnrollmentPermission(); - } - - /** - * Create an instance of {@link CAReferenceCollection } - */ - public CAReferenceCollection createCAReferenceCollection() { - return new CAReferenceCollection(); - } - - /** - * Create an instance of {@link CertificateValidity } - */ - public CertificateValidity createCertificateValidity() { - return new CertificateValidity(); - } - - /** - * Create an instance of {@link CAURICollection } - */ - public CAURICollection createCAURICollection() { - return new CAURICollection(); - } - - /** - * Create an instance of {@link PolicyCollection } - */ - public PolicyCollection createPolicyCollection() { - return new PolicyCollection(); - } - - /** - * Create an instance of {@link Revision } - */ - public Revision createRevision() { - return new Revision(); - } - - /** - * Create an instance of {@link OIDReferenceCollection } - */ - public OIDReferenceCollection createOIDReferenceCollection() { - return new OIDReferenceCollection(); - } - - /** - * Create an instance of {@link CA } - */ - public CA createCA() { - return new CA(); - } - - /** - * Create an instance of {@link CertificateEnrollmentPolicy } - */ - public CertificateEnrollmentPolicy createCertificateEnrollmentPolicy() { - return new CertificateEnrollmentPolicy(); - } - - /** - * Create an instance of {@link CryptoProviders } - */ - public CryptoProviders createCryptoProviders() { - return new CryptoProviders(); - } - - /** - * Create an instance of {@link Extension } - */ - public Extension createExtension() { - return new Extension(); - } - - /** - * Create an instance of {@link FilterOIDCollection } - */ - public FilterOIDCollection createFilterOIDCollection() { - return new FilterOIDCollection(); - } - - /** - * Create an instance of {@link CAURI } - */ - public CAURI createCAURI() { - return new CAURI(); - } - - /** - * Create an instance of {@link RARequirements } - */ - public RARequirements createRARequirements() { - return new RARequirements(); - } - - /** - * Create an instance of {@link PrivateKeyAttributes } - */ - public PrivateKeyAttributes createPrivateKeyAttributes() { - return new PrivateKeyAttributes(); - } - - /** - * Create an instance of {@link KeyArchivalAttributes } - */ - public KeyArchivalAttributes createKeyArchivalAttributes() { - return new KeyArchivalAttributes(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} - */ - @XmlElementDecl(namespace = - "http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy" + - "", name = "commonName") - public JAXBElement createCommonName(String value) { - return new JAXBElement(_CommonName_QNAME, String.class, null, value); - } - -} 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/services/xcep/beans/PolicyCollection.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/services/xcep/beans/PolicyCollection.java deleted file mode 100644 index ed79e0f2c..000000000 --- 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/services/xcep/beans/PolicyCollection.java +++ /dev/null @@ -1,84 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for PolicyCollection complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="PolicyCollection">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="policy" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CertificateEnrollmentPolicy"
- *         maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PolicyCollection", propOrder = { - "policy" -}) -@SuppressWarnings("unused") -public class PolicyCollection { - - @XmlElement(required = true) - protected List policy; - - /** - * Gets the value of the policy property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the policy property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getPolicy().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link CertificateEnrollmentPolicy } - */ - public List getPolicy() { - if (policy == null) { - policy = new ArrayList(); - } - return this.policy; - } - -} 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/services/xcep/beans/PrivateKeyAttributes.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/services/xcep/beans/PrivateKeyAttributes.java deleted file mode 100644 index c908fbab7..000000000 --- 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/services/xcep/beans/PrivateKeyAttributes.java +++ /dev/null @@ -1,189 +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.services.xcep.beans; - -import javax.xml.bind.annotation.*; - -/** - *

Java class for PrivateKeyAttributes complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="PrivateKeyAttributes">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="minimalKeyLength" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedInt"/>
- *         <element name="keySpec" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="keyUsageProperty" type="{http://www.w3
- *         .org/2001/XMLSchema}unsignedInt"/>
- *         <element name="permissions" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="algorithmOIDReference" type="{http://www.w3.org/2001/XMLSchema}int"/>
- *         <element name="cryptoProviders" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}CryptoProviders"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "PrivateKeyAttributes", propOrder = { - "minimalKeyLength", - "keySpec", - "keyUsageProperty", - "permissions", - "algorithmOIDReference", - "cryptoProviders" -}) -@SuppressWarnings("unused") -public class PrivateKeyAttributes { - - @XmlSchemaType(name = "unsignedInt") - protected long minimalKeyLength; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long keySpec; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long keyUsageProperty; - @XmlElement(required = true, nillable = true) - protected String permissions; - @XmlElement(required = true, type = Integer.class, nillable = true) - protected Integer algorithmOIDReference; - @XmlElement(required = true, nillable = true) - protected CryptoProviders cryptoProviders; - - /** - * Gets the value of the minimalKeyLength property. - */ - public long getMinimalKeyLength() { - return minimalKeyLength; - } - - /** - * Sets the value of the minimalKeyLength property. - */ - public void setMinimalKeyLength(long value) { - this.minimalKeyLength = value; - } - - /** - * Gets the value of the keySpec property. - * - * @return possible object is - * {@link Long } - */ - public Long getKeySpec() { - return keySpec; - } - - /** - * Sets the value of the keySpec property. - * - * @param value allowed object is - * {@link Long } - */ - public void setKeySpec(Long value) { - this.keySpec = value; - } - - /** - * Gets the value of the keyUsageProperty property. - * - * @return possible object is - * {@link Long } - */ - public Long getKeyUsageProperty() { - return keyUsageProperty; - } - - /** - * Sets the value of the keyUsageProperty property. - * - * @param value allowed object is - * {@link Long } - */ - public void setKeyUsageProperty(Long value) { - this.keyUsageProperty = value; - } - - /** - * Gets the value of the permissions property. - * - * @return possible object is - * {@link String } - */ - public String getPermissions() { - return permissions; - } - - /** - * Sets the value of the permissions property. - * - * @param value allowed object is - * {@link String } - */ - public void setPermissions(String value) { - this.permissions = value; - } - - /** - * Gets the value of the algorithmOIDReference property. - * - * @return possible object is - * {@link Integer } - */ - public Integer getAlgorithmOIDReference() { - return algorithmOIDReference; - } - - /** - * Sets the value of the algorithmOIDReference property. - * - * @param value allowed object is - * {@link Integer } - */ - public void setAlgorithmOIDReference(Integer value) { - this.algorithmOIDReference = value; - } - - /** - * Gets the value of the cryptoProviders property. - * - * @return possible object is - * {@link CryptoProviders } - */ - public CryptoProviders getCryptoProviders() { - return cryptoProviders; - } - - /** - * Sets the value of the cryptoProviders property. - * - * @param value allowed object is - * {@link CryptoProviders } - */ - public void setCryptoProviders(CryptoProviders value) { - this.cryptoProviders = value; - } - -} 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/services/xcep/beans/RARequirements.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/services/xcep/beans/RARequirements.java deleted file mode 100644 index 73c393504..000000000 --- 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/services/xcep/beans/RARequirements.java +++ /dev/null @@ -1,115 +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.services.xcep.beans; - -import javax.xml.bind.annotation.*; - -/** - *

Java class for RARequirements complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="RARequirements">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="rASignatures" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="rAEKUs" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}OIDReferenceCollection"/>
- *         <element name="rAPolicies" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}OIDReferenceCollection"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RARequirements", propOrder = { - "raSignatures", - "raekUs", - "raPolicies" -}) -@SuppressWarnings("unused") -public class RARequirements { - - @XmlElement(name = "rASignatures") - @XmlSchemaType(name = "unsignedInt") - protected long raSignatures; - @XmlElement(name = "rAEKUs", required = true, nillable = true) - protected OIDReferenceCollection raekUs; - @XmlElement(name = "rAPolicies", required = true, nillable = true) - protected OIDReferenceCollection raPolicies; - - /** - * Gets the value of the raSignatures property. - */ - public long getRASignatures() { - return raSignatures; - } - - /** - * Sets the value of the raSignatures property. - */ - public void setRASignatures(long value) { - this.raSignatures = value; - } - - /** - * Gets the value of the raekUs property. - * - * @return possible object is - * {@link OIDReferenceCollection } - */ - public OIDReferenceCollection getRAEKUs() { - return raekUs; - } - - /** - * Sets the value of the raekUs property. - * - * @param value allowed object is - * {@link OIDReferenceCollection } - */ - public void setRAEKUs(OIDReferenceCollection value) { - this.raekUs = value; - } - - /** - * Gets the value of the raPolicies property. - * - * @return possible object is - * {@link OIDReferenceCollection } - */ - public OIDReferenceCollection getRAPolicies() { - return raPolicies; - } - - /** - * Sets the value of the raPolicies property. - * - * @param value allowed object is - * {@link OIDReferenceCollection } - */ - public void setRAPolicies(OIDReferenceCollection value) { - this.raPolicies = value; - } - -} 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/services/xcep/beans/RequestFilter.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/services/xcep/beans/RequestFilter.java deleted file mode 100644 index 272f6c713..000000000 --- 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/services/xcep/beans/RequestFilter.java +++ /dev/null @@ -1,107 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for RequestFilter complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="RequestFilter">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="policyOIDs" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}FilterOIDCollection"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "RequestFilter", propOrder = { - "policyOIDs", - "any" -}) -@SuppressWarnings("unused") -public class RequestFilter { - - @XmlElement(required = true, nillable = true) - protected FilterOIDCollection policyOIDs; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the policyOIDs property. - * - * @return possible object is - * {@link FilterOIDCollection } - */ - public FilterOIDCollection getPolicyOIDs() { - return policyOIDs; - } - - /** - * Sets the value of the policyOIDs property. - * - * @param value allowed object is - * {@link FilterOIDCollection } - */ - public void setPolicyOIDs(FilterOIDCollection value) { - this.policyOIDs = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/Response.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/services/xcep/beans/Response.java deleted file mode 100644 index fdde436a7..000000000 --- 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/services/xcep/beans/Response.java +++ /dev/null @@ -1,204 +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.services.xcep.beans; - -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.*; -import java.util.ArrayList; -import java.util.List; - -/** - *

Java class for Response complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="Response">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="policyID" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="policyFriendlyName" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         <element name="nextUpdateHours" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="policiesNotChanged" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
- *         <element name="policies" type="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}PolicyCollection"/>
- *         <any processContents='lax' maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Response", propOrder = { - "policyID", - "policyFriendlyName", - "nextUpdateHours", - "policiesNotChanged", - "policies", - "any" -}) -@SuppressWarnings("unused") -public class Response { - - @XmlElement(required = true) - protected String policyID; - @XmlElement(required = true, nillable = true) - protected String policyFriendlyName; - @XmlElement(required = true, type = Long.class, nillable = true) - @XmlSchemaType(name = "unsignedInt") - protected Long nextUpdateHours; - @XmlElement(required = true, type = Boolean.class, nillable = true) - protected Boolean policiesNotChanged; - @XmlElement(required = true, nillable = true) - protected PolicyCollection policies; - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the policyID property. - * - * @return possible object is - * {@link String } - */ - public String getPolicyID() { - return policyID; - } - - /** - * Sets the value of the policyID property. - * - * @param value allowed object is - * {@link String } - */ - public void setPolicyID(String value) { - this.policyID = value; - } - - /** - * Gets the value of the policyFriendlyName property. - * - * @return possible object is - * {@link String } - */ - public String getPolicyFriendlyName() { - return policyFriendlyName; - } - - /** - * Sets the value of the policyFriendlyName property. - * - * @param value allowed object is - * {@link String } - */ - public void setPolicyFriendlyName(String value) { - this.policyFriendlyName = value; - } - - /** - * Gets the value of the nextUpdateHours property. - * - * @return possible object is - * {@link Long } - */ - public Long getNextUpdateHours() { - return nextUpdateHours; - } - - /** - * Sets the value of the nextUpdateHours property. - * - * @param value allowed object is - * {@link Long } - */ - public void setNextUpdateHours(Long value) { - this.nextUpdateHours = value; - } - - /** - * Gets the value of the policiesNotChanged property. - * - * @return possible object is - * {@link Boolean } - */ - public Boolean isPoliciesNotChanged() { - return policiesNotChanged; - } - - /** - * Sets the value of the policiesNotChanged property. - * - * @param value allowed object is - * {@link Boolean } - */ - public void setPoliciesNotChanged(Boolean value) { - this.policiesNotChanged = value; - } - - /** - * Gets the value of the policies property. - * - * @return possible object is - * {@link PolicyCollection } - */ - public PolicyCollection getPolicies() { - return policies; - } - - /** - * Sets the value of the policies property. - * - * @param value allowed object is - * {@link PolicyCollection } - */ - public void setPolicies(PolicyCollection value) { - this.policies = value; - } - - /** - * Gets the value of the any property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getAny().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * {@link Element } - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - -} 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/services/xcep/beans/Revision.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/services/xcep/beans/Revision.java deleted file mode 100644 index 3ede23b0e..000000000 --- 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/services/xcep/beans/Revision.java +++ /dev/null @@ -1,85 +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.services.xcep.beans; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlType; - -/** - *

Java class for Revision complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="Revision">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="majorRevision" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *         <element name="minorRevision" type="{http://www.w3.org/2001/XMLSchema}unsignedInt"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "Revision", propOrder = { - "majorRevision", - "minorRevision" -}) -@SuppressWarnings("unused") -public class Revision { - - @XmlSchemaType(name = "unsignedInt") - protected long majorRevision; - @XmlSchemaType(name = "unsignedInt") - protected long minorRevision; - - /** - * Gets the value of the majorRevision property. - */ - public long getMajorRevision() { - return majorRevision; - } - - /** - * Sets the value of the majorRevision property. - */ - public void setMajorRevision(long value) { - this.majorRevision = value; - } - - /** - * Gets the value of the minorRevision property. - */ - public long getMinorRevision() { - return minorRevision; - } - - /** - * Sets the value of the minorRevision property. - */ - public void setMinorRevision(long value) { - this.minorRevision = value; - } - -} 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/services/xcep/beans/SupersededPolicies.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/services/xcep/beans/SupersededPolicies.java deleted file mode 100644 index 949495095..000000000 --- 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/services/xcep/beans/SupersededPolicies.java +++ /dev/null @@ -1,83 +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.services.xcep.beans; - -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.util.ArrayList; -import java.util.List; - -/** - *

Java class for SupersededPolicies complex type. - *

- *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <complexType name="SupersededPolicies">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://schemas.microsoft
- *         .com/windows/pki/2009/01/enrollmentpolicy}commonName" maxOccurs="unbounded"/>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "SupersededPolicies", propOrder = { - "commonName" -}) -@SuppressWarnings("unused") -public class SupersededPolicies { - - @XmlElement(required = true) - protected List commonName; - - /** - * Gets the value of the commonName property. - *

- *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the commonName property. - *

- *

- * For example, to add a new item, do as follows: - *

-	 *    getCommonName().add(newItem);
-	 * 
- *

- *

- *

- * Objects of the following type(s) are allowed in the list - * {@link String } - */ - public List getCommonName() { - if (commonName == null) { - commonName = new ArrayList(); - } - return this.commonName; - } - -} 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/services/xcep/beans/package-info.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/services/xcep/beans/package-info.java deleted file mode 100644 index 3560db69b..000000000 --- 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/services/xcep/beans/package-info.java +++ /dev/null @@ -1,23 +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. - */ - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://schemas.microsoft" + - ".com/windows/pki/2009/01/enrollmentpolicy", - elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) - -package org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans; 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/services/xcep/impl/CertificateEnrollmentPolicyServiceImpl.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/services/xcep/impl/CertificateEnrollmentPolicyServiceImpl.java deleted file mode 100644 index 467d1a771..000000000 --- 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/services/xcep/impl/CertificateEnrollmentPolicyServiceImpl.java +++ /dev/null @@ -1,100 +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.services.xcep.impl; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.mgt.mobile.windows.api.common.PluginConstants; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.CertificateEnrollmentPolicyService; -import org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.beans.*; - -import javax.jws.WebService; -import javax.xml.ws.BindingType; -import javax.xml.ws.Holder; -import javax.xml.ws.soap.Addressing; -import javax.xml.ws.soap.SOAPBinding; - -/** - * Implementation class for CertificateEnrollmentPolicyService. - */ -@WebService(endpointInterface = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_ENDPOINT, - targetNamespace = PluginConstants.CERTIFICATE_ENROLLMENT_POLICY_SERVICE_TARGET_NAMESPACE) -@Addressing(enabled = true, required = true) -@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) -public class CertificateEnrollmentPolicyServiceImpl implements CertificateEnrollmentPolicyService { - - private static Log log = LogFactory.getLog( - org.wso2.carbon.device.mgt.mobile.windows.api.services.xcep.impl.CertificateEnrollmentPolicyServiceImpl.class); - - /** - * This method implements the MS-XCEP protocol for certificate enrollment policy service. - * - * @param client - Included lastUpdate and preferredLanguage tags - * @param requestFilter - Policy constrain tag - * @param response - Response which includes minimal key length, hash algorithm, policy - * schema, policy OID reference - * @param caCollection - Contains the issuers for the certificate enrollment policies - * @param oidCollection - Contains the collection of OIDs for the response - */ - @Override - public void getPolicies(Client client, RequestFilter requestFilter, - Holder response, Holder caCollection, - Holder oidCollection) { - - if (log.isDebugEnabled()) { - log.debug("Enrolment certificate policy end point was triggered by device."); - } - - Response responseElement = new Response(); - OIDCollection oidCollectionElement = new OIDCollection(); - CACollection caCollectionElement = new CACollection(); - - PolicyCollection policyCollectionElement = new PolicyCollection(); - CertificateEnrollmentPolicy certEnrollmentPolicyElement = new CertificateEnrollmentPolicy(); - Attributes attributeElement = new Attributes(); - PrivateKeyAttributes privateKeyAttributeElement = new PrivateKeyAttributes(); - - privateKeyAttributeElement. - setMinimalKeyLength(PluginConstants.CertificateEnrolmentPolicy.MINIMAL_KEY_LENGTH); - - attributeElement.setPolicySchema(PluginConstants.CertificateEnrolmentPolicy.POLICY_SCHEMA); - attributeElement.setPrivateKeyAttributes(privateKeyAttributeElement); - attributeElement.setHashAlgorithmOIDReference(PluginConstants.CertificateEnrolmentPolicy. - HASH_ALGORITHM_OID_REFERENCE); - certEnrollmentPolicyElement.setPolicyOIDReference(PluginConstants.CertificateEnrolmentPolicy. - OID_REFERENCE); - certEnrollmentPolicyElement.setAttributes(attributeElement); - policyCollectionElement.getPolicy().add(certEnrollmentPolicyElement); - responseElement.setPolicies(policyCollectionElement); - response.value = responseElement; - - OID oidElement = new OID(); - oidElement.setValue(PluginConstants.CertificateEnrolmentPolicy.OID); - oidElement.setGroup(PluginConstants.CertificateEnrolmentPolicy.OID_GROUP); - oidElement.setOIDReferenceID(PluginConstants.CertificateEnrolmentPolicy.OID_REFERENCE_ID); - oidElement.setDefaultName(PluginConstants.CertificateEnrolmentPolicy.OID_DEFAULT_NAME); - - oidCollectionElement.getOID().add(oidElement); - caCollection.value = caCollectionElement; - oidCollection.value = oidCollectionElement; - PrivilegedCarbonContext.endTenantFlow(); - - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml deleted file mode 100644 index 9a6561b45..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/wap-provisioning.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/win10-wap-provisioning.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/win10-wap-provisioning.xml deleted file mode 100644 index fdbd89938..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/resources/win10-wap-provisioning.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml deleted file mode 100644 index 1a69d570d..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/permissions.xml +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - - - Lock - /device-mgt/windows/operation/lock - /services/windows/operation/lock - POST - emm_admin,emm_user - - - - Enterprise Wipe - /device-mgt/windows/operation/wipe-data - /services/windows/operation/wipe-data - POST - emm_admin - - - - Ring - /device-mgt/windows/operation/ring-device - /services/windows/operation/ring-device - POST - emm_admin,emm_user - - - - Disenroll - /device-mgt/windows/operation/disenroll - /services/windows/operation/disenroll - POST - emm_admin,emm_user - - - - LockReset - /device-mgt/windows/operation/lock-reset - /services/windows/operation/lock-reset - POST - emm_admin,emm_user - - - - - Get CSR Policy - /device-mgt/windows/devices/getPolicy - /services/certificatepolicy/xcep - POST - emm_windows_agent - - - Get BST - /device-mgt/windows/devices/getBST - /services/federated/bst/authentication - POST - emm_windows_agent - - - Provide CSR - /device-mgt/windows/devices/requestSecurityToken - /services/deviceenrolment/wstep - POST - emm_windows_agent - - - GetLicense - /device-mgt/windows/devices/license - /services/device/license - GET - emm_windows_agent - - - - View Policies - /device-mgt/windows/policies/view - /services/policy/* - GET - emm_admin - - - - View Policy Features - /device-mgt/windows/policies/view - /services/policy/features/* - GET - emm_admin - - - - View Tenant configuration - /device-mgt/windows/tenant/configuration - /services/configuration - GET - emm_admin - - - - Add Tenant configuration - /device-mgt/windows/tenant/configuration - /services/configuration - POST - emm_admin - - - - Update Tenant configuration - /device-mgt/windows/tenant/configuration - /services/configuration - PUT - emm_admin - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml deleted file mode 100644 index c90403cc6..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/META-INF/webapp-classloading.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - false - - - Carbon - 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 deleted file mode 100644 index cebd427bb..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index d4d1c22e9..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - Windows-Agent-Webapp - - - contextConfigLocation - /WEB-INF/cxf-servlet.xml - - - - org.wso2.carbon.device.mgt.mobile.windows.api.common.util.ContextInitializer - - - - - JAX-WS/JAX-RS-windows Endpoint - JAX-WS/JAX-RS-windows Servlet - JAXServlet-windows - - org.apache.cxf.transport.servlet.CXFServlet - - 1 - - - JAXServlet-windows - /* - - - 60 - - - managed-api-enabled - true - - - doAuthentication - true - - - isSharedWithAllTenants - true - - - nonSecuredEndPoints - /api/device-mgt/windows/v1.0/discovery/get,/api/device-mgt/windows/v1.0/discovery/post, - /api/device-mgt/windows/v1.0/certificatepolicy/xcep,/api/device-mgt/windows/v1.0/deviceenrolment/wstep, - /api/device-mgt/windows/v1.0/syncml/devicemanagement/request, - /api/device-mgt/windows/v1.0/deviceenrolment/enrollment, - /api/device-mgt/windows/v1.0/management/devicemgt/pending-operations - - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/servicelist.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/servicelist.css deleted file mode 100644 index b659c905e..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/servicelist.css +++ /dev/null @@ -1,143 +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. - */ - -@CHARSET "ISO-8859-1"; - -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -html, body, div, span, applet, object, iframe, -h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, -del, dfn, em, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, -b, u, i, center, -dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td, -article, aside, canvas, details, embed, -figure, figcaption, footer, header, hgroup, -menu, nav, output, ruby, section, summary, -time, mark, audio, video { - margin: 0; - padding: 0; - border: 0; - font-size: 100%; - font: inherit; - vertical-align: baseline; -} - -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} - -html { - background: #efefef; -} - -body { - line-height: 1; - width: 960px; - margin: auto; - background: white; - padding: 10px; - box-shadow: 0px 0px 5px #CCC; - font-family: "Lucida Grande", "Lucida Sans", "Microsoft Sans Serif", "Lucida Sans Unicode", "Verdana", "Sans-serif", "trebuchet ms" !important; - -} - -ol, ul { - list-style: none; -} - -blockquote, q { - quotes: none; -} - -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} - -table { - border-collapse: collapse; - border-spacing: 0; - width: 960px; - border: solid 1px #ccc; -} - -table a { - font-size: 12px; - color: #1e90ff; - padding: 7px; - float: left;; -} - -.heading { - font-size: 18px; - margin-top: 20px; - float: left; - color: #0067B1; - margin-bottom: 20px; - padding-top: 20px; -} - -.field { - font-weight: normal; - width: 120px; - font-size: 12px; - float: left; - padding: 7px; - clear: left; -} - -.value { - font-weight: bold; - font-size: 12px; - float: left; - padding: 7px; - clear: right; -} - -.porttypename { - font-weight: bold; - font-size: 14px; -} - -UL { - margin-top: 0; -} - -LI { - font-weight: normal; - font-size: 12px; - margin-top: 10px; -} - -TD { - border: 1px solid #ccc; - vertical-align: text-top; - padding: 5px; -} - - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml deleted file mode 100644 index 1896294d6..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - windows-plugin - org.wso2.carbon.devicemgt-plugins - 4.2.7-SNAPSHOT - ../pom.xml - - - 4.0.0 - org.wso2.carbon.device.mgt.mobile.windows.ui - 4.2.7-SNAPSHOT - WSO2 Carbon - Mobile Windows UI - pom - - - - - maven-assembly-plugin - 2.5.5 - - ${project.artifactId}-${carbon.devicemgt.plugins.version} - false - - src/assembly/src.xml - - - - - create-archive - package - - single - - - - - - - - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml deleted file mode 100644 index 5996c0457..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/assembly/src.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - src - - zip - - false - ${basedir}/src - - - ${basedir}/src/main/resources/jaggeryapps/windows-web-agent - /windows-web-agent - true - - - ${basedir}/src/main/resources/jaggeryapps/devicemgt - /devicemgt - true - - - ${basedir}/src/main/resources/jaggeryapps/uuf-template-app - /windows-web-agent - true - - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.hbs deleted file mode 100644 index d1787fd27..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.hbs +++ /dev/null @@ -1,25 +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. -}} -{{#zone "topCss"}} - {{css "css/daterangepicker.css"}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/moment.min.js"}} - {{js "js/daterangepicker.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.js deleted file mode 100644 index 82648b301..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.js +++ /dev/null @@ -1,21 +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. - */ - -function onRequest() { - return ""; -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.json deleted file mode 100644 index 688e93980..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/date-range-picker.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/css/daterangepicker.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/css/daterangepicker.css deleted file mode 100644 index b1b44916b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/css/daterangepicker.css +++ /dev/null @@ -1,361 +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. - */ - -.date-picker { - width: 170px; - height: 25px; - padding: 0; - border: 0; - line-height: 25px; - padding-left: 10px; - font-size: 12px; - font-family: Arial; - font-weight: bold; - cursor: pointer; - color: #303030; - position: relative; - z-index: 2; -} - -.date-picker-wrapper { - position: absolute; - z-index: 1; - border: 1px solid #bfbfbf; - background-color: #efefef; - width: 448px; - padding: 5px 12px; - font-size: 12px; - line-height: 20px; - color: #aaa; - font-family: Arial; - box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.5); -} - -.date-picker-wrapper.single-date { - width: auto; -} - -.date-picker-wrapper.no-shortcuts { - padding-bottom: 12px; -} - -.date-picker-wrapper .footer { - display: none; - font-size: 11px; - padding-top: 3px; -} - -.date-picker-wrapper b { - color: #666; - font-weight: 700; -} - -.date-picker-wrapper a { - color: rgb(107, 180, 214); - text-decoration: underline; -} - -.date-picker-wrapper .month-wrapper { - border: 1px solid #bfbfbf; - border-radius: 3px; - background-color: #fff; - padding: 5px; - cursor: default; - position: relative; - _overflow: hidden; -} - -.date-picker-wrapper .month-wrapper table { - width: 190px; - float: left; -} - -.date-picker-wrapper .month-wrapper table.month2 { - width: 190px; - float: right; -} - -.date-picker-wrapper .month-wrapper table th, -.date-picker-wrapper .month-wrapper table td { - vertical-align: middle; - text-align: center; - line-height: 14px; - margin: 0px; - padding: 0px; -} - -.date-picker-wrapper .month-wrapper table .day { - height: 19px; - line-height: 19px; - font-size: 12px; - margin-bottom: 1px; - color: #999; - cursor: default; -} - -.date-picker-wrapper .month-wrapper table div.day.lastMonth, -.date-picker-wrapper .month-wrapper table div.day.nextMonth { - color: #999; - cursor: default; -} - -.date-picker-wrapper .month-wrapper table .day.checked { - background-color: rgb(156, 219, 247); -} - -.date-picker-wrapper .month-wrapper table .week-name { - height: 20px; - line-height: 20px; - font-weight: 100; -} - -.date-picker-wrapper .month-wrapper table .day.has-tooltip { - cursor: help !important; -} - -.date-picker-wrapper .month-wrapper table .day.toMonth.valid { - color: #333; - cursor: pointer; -} - -.date-picker-wrapper .month-wrapper table .day.real-today { - background-color: rgb(255, 230, 132); -} - -.date-picker-wrapper .month-wrapper table .day.real-today.checked { - background-color: rgb(112, 204, 213); -} - -.date-picker-wrapper table .caption { - height: 40px; -} - -.date-picker-wrapper table .caption .next, -.date-picker-wrapper table .caption .prev { - padding: 0 5px; - cursor: pointer; -} - -.date-picker-wrapper table .caption .next:hover, -.date-picker-wrapper table .caption .prev:hover { - background-color: #ccc; - color: white; -} - -.date-picker-wrapper .gap { - position: absolute; - display: none; - top: 0px; - left: 204px; - z-index: 1; - width: 15px; - height: 100%; - background-color: red; - font-size: 0; - line-height: 0; -} - -.date-picker-wrapper .gap .gap-lines { - height: 100%; - overflow: hidden; -} - -.date-picker-wrapper .gap .gap-line { - height: 15px; - width: 15px; - position: relative; -} - -.date-picker-wrapper .gap .gap-line .gap-1 { - z-index: 1; - height: 0; - border-left: 8px solid white; - border-top: 8px solid #eee; - border-bottom: 8px solid #eee; -} - -.date-picker-wrapper .gap .gap-line .gap-2 { - position: absolute; - right: 0; - top: 0px; - z-index: 2; - height: 0; - border-left: 8px solid transparent; - border-top: 8px solid white; -} - -.date-picker-wrapper .gap .gap-line .gap-3 { - position: absolute; - right: 0; - top: 8px; - z-index: 2; - height: 0; - border-left: 8px solid transparent; - border-bottom: 8px solid white; -} - -.date-picker-wrapper .gap .gap-top-mask { - width: 6px; - height: 1px; - position: absolute; - top: -1px; - left: 1px; - background-color: #eee; - z-index: 3; -} - -.date-picker-wrapper .gap .gap-bottom-mask { - width: 6px; - height: 1px; - position: absolute; - bottom: -1px; - left: 7px; - background-color: #eee; - z-index: 3; -} - -.date-picker-wrapper .selected-days { - display: none; -} - -.date-picker-wrapper .drp_top-bar { - line-height: 40px; - height: 40px; - position: relative; -} - -.date-picker-wrapper .drp_top-bar .error-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar .normal-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar .default-top { - display: block; -} - -.date-picker-wrapper .drp_top-bar.error .default-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar.error .error-top { - display: block; - color: red; -} - -.date-picker-wrapper .drp_top-bar.normal .default-top { - display: none; -} - -.date-picker-wrapper .drp_top-bar.normal .normal-top { - display: block; -} - -.date-picker-wrapper .drp_top-bar .apply-btn { - position: absolute; - right: 0px; - top: 6px; - padding: 3px 5px; - margin: 0; - font-size: 12px; - border-radius: 4px; - cursor: pointer; - - color: #d9eef7; - border: solid 1px #0076a3; - background: #0095cd; - background: -webkit-gradient(linear, left top, left bottom, from(#00adee), to(#0078a5)); - background: -moz-linear-gradient(top, #00adee, #0078a5); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee', endColorstr='#0078a5'); - color: white; -} - -.date-picker-wrapper .drp_top-bar .apply-btn.disabled { - pointer-events: none; - color: #606060; - border: solid 1px #b7b7b7; - background: #fff; - background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ededed)); - background: -moz-linear-gradient(top, #fff, #ededed); - filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#ededed'); -} - -/*time styling*/ -.time { - position: relative; -} - -.time input[type=range] { - vertical-align: middle; -} - -.time1, .time2 { - width: 180px; - padding: 0 5px; - text-align: center; -} - -.time1 { - float: left; -} - -.time2 { - float: right; -} - -.hour, .minute { - text-align: left; -} - -.hide { - display: none; -} - -input.hour-range, input.minute-range { - width: 150px; -} - -#dateRangePickerContainer .date-range, #dateRangePickerContainer .input-append { - background: none !important; -} - -#date-range { - padding-right: 30px; - width: 300px; - height: 100%; - display: inline-block; -} - -#dateRangePickerContainer { - float: right; -} - -.date-range { - border: 1px solid #ccc; -} - -#dateRangePickerContainer button.active { - background-color: #e6e6e6 !important; -} - -#dateRangePickerContainer .btn-default:hover { - background-color: #b2b2b2; - border-color: #000000; -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/daterangepicker.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/daterangepicker.js deleted file mode 100644 index b218d58bf..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/daterangepicker.js +++ /dev/null @@ -1,1542 +0,0 @@ -/** -* @version: 2.1.19 -* @author: Dan Grossman http://www.dangrossman.info/ -* @copyright: Copyright (c) 2012-2015 Dan Grossman. All rights reserved. -* @license: Licensed under the MIT license. See http://www.opensource.org/licenses/mit-license.php -* @website: https://www.improvely.com/ -*/ - -(function(root, factory) { - - if (typeof define === 'function' && define.amd) { - define(['moment', 'jquery', 'exports'], function(momentjs, $, exports) { - root.daterangepicker = factory(root, exports, momentjs, $); - }); - - } else if (typeof exports !== 'undefined') { - var momentjs = require('moment'); - var jQuery = (typeof window != 'undefined') ? window.jQuery : undefined; //isomorphic issue - if (!jQuery) { - try { - jQuery = require('jquery'); - if (!jQuery.fn) jQuery.fn = {}; //isomorphic issue - } catch (err) { - if (!jQuery) throw new Error('jQuery dependency not found'); - } - } - - factory(root, exports, momentjs, jQuery); - - // Finally, as a browser global. - } else { - root.daterangepicker = factory(root, {}, root.moment || moment, (root.jQuery || root.Zepto || root.ender || root.$)); - } - -}(this || {}, function(root, daterangepicker, moment, $) { // 'this' doesn't exist on a server - - var DateRangePicker = function(element, options, cb) { - - //default settings for options - this.parentEl = 'body'; - this.element = $(element); - this.startDate = moment().startOf('day'); - this.endDate = moment().endOf('day'); - this.minDate = false; - this.maxDate = false; - this.dateLimit = false; - this.autoApply = false; - this.singleDatePicker = false; - this.showDropdowns = false; - this.showWeekNumbers = false; - this.showISOWeekNumbers = false; - this.timePicker = false; - this.timePicker24Hour = false; - this.timePickerIncrement = 1; - this.timePickerSeconds = false; - this.linkedCalendars = true; - this.autoUpdateInput = true; - this.alwaysShowCalendars = false; - this.ranges = {}; - - this.opens = 'right'; - if (this.element.hasClass('pull-right')) - this.opens = 'left'; - - this.drops = 'down'; - if (this.element.hasClass('dropup')) - this.drops = 'up'; - - this.buttonClasses = 'btn btn-sm'; - this.applyClass = 'btn-success'; - this.cancelClass = 'btn-default'; - - this.locale = { - format: 'MM/DD/YYYY', - separator: ' - ', - applyLabel: 'Apply', - cancelLabel: 'Cancel', - weekLabel: 'W', - customRangeLabel: 'Custom Range', - daysOfWeek: moment.weekdaysMin(), - monthNames: moment.monthsShort(), - firstDay: moment.localeData().firstDayOfWeek() - }; - - this.callback = function() { }; - - //some state information - this.isShowing = false; - this.leftCalendar = {}; - this.rightCalendar = {}; - - //custom options from user - if (typeof options !== 'object' || options === null) - options = {}; - - //allow setting options with data attributes - //data-api options will be overwritten with custom javascript options - options = $.extend(this.element.data(), options); - - //html template for the picker UI - if (typeof options.template !== 'string' && !(options.template instanceof $)) - options.template = '

'; - - this.parentEl = (options.parentEl && $(options.parentEl).length) ? $(options.parentEl) : $(this.parentEl); - this.container = $(options.template).appendTo(this.parentEl); - - // - // handle all the possible options overriding defaults - // - - if (typeof options.locale === 'object') { - - if (typeof options.locale.format === 'string') - this.locale.format = options.locale.format; - - if (typeof options.locale.separator === 'string') - this.locale.separator = options.locale.separator; - - if (typeof options.locale.daysOfWeek === 'object') - this.locale.daysOfWeek = options.locale.daysOfWeek.slice(); - - if (typeof options.locale.monthNames === 'object') - this.locale.monthNames = options.locale.monthNames.slice(); - - if (typeof options.locale.firstDay === 'number') - this.locale.firstDay = options.locale.firstDay; - - if (typeof options.locale.applyLabel === 'string') - this.locale.applyLabel = options.locale.applyLabel; - - if (typeof options.locale.cancelLabel === 'string') - this.locale.cancelLabel = options.locale.cancelLabel; - - if (typeof options.locale.weekLabel === 'string') - this.locale.weekLabel = options.locale.weekLabel; - - if (typeof options.locale.customRangeLabel === 'string') - this.locale.customRangeLabel = options.locale.customRangeLabel; - - } - - if (typeof options.startDate === 'string') - this.startDate = moment(options.startDate, this.locale.format); - - if (typeof options.endDate === 'string') - this.endDate = moment(options.endDate, this.locale.format); - - if (typeof options.minDate === 'string') - this.minDate = moment(options.minDate, this.locale.format); - - if (typeof options.maxDate === 'string') - this.maxDate = moment(options.maxDate, this.locale.format); - - if (typeof options.startDate === 'object') - this.startDate = moment(options.startDate); - - if (typeof options.endDate === 'object') - this.endDate = moment(options.endDate); - - if (typeof options.minDate === 'object') - this.minDate = moment(options.minDate); - - if (typeof options.maxDate === 'object') - this.maxDate = moment(options.maxDate); - - // sanity check for bad options - if (this.minDate && this.startDate.isBefore(this.minDate)) - this.startDate = this.minDate.clone(); - - // sanity check for bad options - if (this.maxDate && this.endDate.isAfter(this.maxDate)) - this.endDate = this.maxDate.clone(); - - if (typeof options.applyClass === 'string') - this.applyClass = options.applyClass; - - if (typeof options.cancelClass === 'string') - this.cancelClass = options.cancelClass; - - if (typeof options.dateLimit === 'object') - this.dateLimit = options.dateLimit; - - if (typeof options.opens === 'string') - this.opens = options.opens; - - if (typeof options.drops === 'string') - this.drops = options.drops; - - if (typeof options.showWeekNumbers === 'boolean') - this.showWeekNumbers = options.showWeekNumbers; - - if (typeof options.showISOWeekNumbers === 'boolean') - this.showISOWeekNumbers = options.showISOWeekNumbers; - - if (typeof options.buttonClasses === 'string') - this.buttonClasses = options.buttonClasses; - - if (typeof options.buttonClasses === 'object') - this.buttonClasses = options.buttonClasses.join(' '); - - if (typeof options.showDropdowns === 'boolean') - this.showDropdowns = options.showDropdowns; - - if (typeof options.singleDatePicker === 'boolean') { - this.singleDatePicker = options.singleDatePicker; - if (this.singleDatePicker) - this.endDate = this.startDate.clone(); - } - - if (typeof options.timePicker === 'boolean') - this.timePicker = options.timePicker; - - if (typeof options.timePickerSeconds === 'boolean') - this.timePickerSeconds = options.timePickerSeconds; - - if (typeof options.timePickerIncrement === 'number') - this.timePickerIncrement = options.timePickerIncrement; - - if (typeof options.timePicker24Hour === 'boolean') - this.timePicker24Hour = options.timePicker24Hour; - - if (typeof options.autoApply === 'boolean') - this.autoApply = options.autoApply; - - if (typeof options.autoUpdateInput === 'boolean') - this.autoUpdateInput = options.autoUpdateInput; - - if (typeof options.linkedCalendars === 'boolean') - this.linkedCalendars = options.linkedCalendars; - - if (typeof options.isInvalidDate === 'function') - this.isInvalidDate = options.isInvalidDate; - - if (typeof options.alwaysShowCalendars === 'boolean') - this.alwaysShowCalendars = options.alwaysShowCalendars; - - // update day names order to firstDay - if (this.locale.firstDay != 0) { - var iterator = this.locale.firstDay; - while (iterator > 0) { - this.locale.daysOfWeek.push(this.locale.daysOfWeek.shift()); - iterator--; - } - } - - var start, end, range; - - //if no start/end dates set, check if an input element contains initial values - if (typeof options.startDate === 'undefined' && typeof options.endDate === 'undefined') { - if ($(this.element).is('input[type=text]')) { - var val = $(this.element).val(), - split = val.split(this.locale.separator); - - start = end = null; - - if (split.length == 2) { - start = moment(split[0], this.locale.format); - end = moment(split[1], this.locale.format); - } else if (this.singleDatePicker && val !== "") { - start = moment(val, this.locale.format); - end = moment(val, this.locale.format); - } - if (start !== null && end !== null) { - this.setStartDate(start); - this.setEndDate(end); - } - } - } - - if (typeof options.ranges === 'object') { - for (range in options.ranges) { - - if (typeof options.ranges[range][0] === 'string') - start = moment(options.ranges[range][0], this.locale.format); - else - start = moment(options.ranges[range][0]); - - if (typeof options.ranges[range][1] === 'string') - end = moment(options.ranges[range][1], this.locale.format); - else - end = moment(options.ranges[range][1]); - - // If the start or end date exceed those allowed by the minDate or dateLimit - // options, shorten the range to the allowable period. - if (this.minDate && start.isBefore(this.minDate)) - start = this.minDate.clone(); - - var maxDate = this.maxDate; - if (this.dateLimit && start.clone().add(this.dateLimit).isAfter(maxDate)) - maxDate = start.clone().add(this.dateLimit); - if (maxDate && end.isAfter(maxDate)) - end = maxDate.clone(); - - // If the end of the range is before the minimum or the start of the range is - // after the maximum, don't display this range option at all. - if ((this.minDate && end.isBefore(this.minDate)) || (maxDate && start.isAfter(maxDate))) - continue; - - //Support unicode chars in the range names. - var elem = document.createElement('textarea'); - elem.innerHTML = range; - var rangeHtml = elem.value; - - this.ranges[rangeHtml] = [start, end]; - } - - var list = '
    '; - for (range in this.ranges) { - list += '
  • ' + range + '
  • '; - } - list += '
  • ' + this.locale.customRangeLabel + '
  • '; - list += '
'; - this.container.find('.ranges').prepend(list); - } - - if (typeof cb === 'function') { - this.callback = cb; - } - - if (!this.timePicker) { - this.startDate = this.startDate.startOf('day'); - this.endDate = this.endDate.endOf('day'); - this.container.find('.calendar-time').hide(); - } - - //can't be used together for now - if (this.timePicker && this.autoApply) - this.autoApply = false; - - if (this.autoApply && typeof options.ranges !== 'object') { - this.container.find('.ranges').hide(); - } else if (this.autoApply) { - this.container.find('.applyBtn, .cancelBtn').addClass('hide'); - } - - if (this.singleDatePicker) { - this.container.addClass('single'); - this.container.find('.calendar.left').addClass('single'); - this.container.find('.calendar.left').show(); - this.container.find('.calendar.right').hide(); - this.container.find('.daterangepicker_input input, .daterangepicker_input i').hide(); - if (!this.timePicker) { - this.container.find('.ranges').hide(); - } - } - - if ((typeof options.ranges === 'undefined' && !this.singleDatePicker) || this.alwaysShowCalendars) { - this.container.addClass('show-calendar'); - } - - this.container.addClass('opens' + this.opens); - - //swap the position of the predefined ranges if opens right - if (typeof options.ranges !== 'undefined' && this.opens == 'right') { - var ranges = this.container.find('.ranges'); - var html = ranges.clone(); - ranges.remove(); - this.container.find('.calendar.left').parent().prepend(html); - } - - //apply CSS classes and labels to buttons - this.container.find('.applyBtn, .cancelBtn').addClass(this.buttonClasses); - if (this.applyClass.length) - this.container.find('.applyBtn').addClass(this.applyClass); - if (this.cancelClass.length) - this.container.find('.cancelBtn').addClass(this.cancelClass); - this.container.find('.applyBtn').html(this.locale.applyLabel); - this.container.find('.cancelBtn').html(this.locale.cancelLabel); - - // - // event listeners - // - - this.container.find('.calendar') - .on('click.daterangepicker', '.prev', $.proxy(this.clickPrev, this)) - .on('click.daterangepicker', '.next', $.proxy(this.clickNext, this)) - .on('click.daterangepicker', 'td.available', $.proxy(this.clickDate, this)) - .on('mouseenter.daterangepicker', 'td.available', $.proxy(this.hoverDate, this)) - .on('mouseleave.daterangepicker', 'td.available', $.proxy(this.updateFormInputs, this)) - .on('change.daterangepicker', 'select.yearselect', $.proxy(this.monthOrYearChanged, this)) - .on('change.daterangepicker', 'select.monthselect', $.proxy(this.monthOrYearChanged, this)) - .on('change.daterangepicker', 'select.hourselect,select.minuteselect,select.secondselect,select.ampmselect', $.proxy(this.timeChanged, this)) - .on('click.daterangepicker', '.daterangepicker_input input', $.proxy(this.showCalendars, this)) - //.on('keyup.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this)) - .on('change.daterangepicker', '.daterangepicker_input input', $.proxy(this.formInputsChanged, this)); - - this.container.find('.ranges') - .on('click.daterangepicker', 'button.applyBtn', $.proxy(this.clickApply, this)) - .on('click.daterangepicker', 'button.cancelBtn', $.proxy(this.clickCancel, this)) - .on('click.daterangepicker', 'li', $.proxy(this.clickRange, this)) - .on('mouseenter.daterangepicker', 'li', $.proxy(this.hoverRange, this)) - .on('mouseleave.daterangepicker', 'li', $.proxy(this.updateFormInputs, this)); - - if (this.element.is('input')) { - this.element.on({ - 'click.daterangepicker': $.proxy(this.show, this), - 'focus.daterangepicker': $.proxy(this.show, this), - 'keyup.daterangepicker': $.proxy(this.elementChanged, this), - 'keydown.daterangepicker': $.proxy(this.keydown, this) - }); - } else { - this.element.on('click.daterangepicker', $.proxy(this.toggle, this)); - } - - // - // if attached to a text input, set the initial value - // - - if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) { - this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format)); - this.element.trigger('change'); - } else if (this.element.is('input') && this.autoUpdateInput) { - this.element.val(this.startDate.format(this.locale.format)); - this.element.trigger('change'); - } - - }; - - DateRangePicker.prototype = { - - constructor: DateRangePicker, - - setStartDate: function(startDate) { - if (typeof startDate === 'string') - this.startDate = moment(startDate, this.locale.format); - - if (typeof startDate === 'object') - this.startDate = moment(startDate); - - if (!this.timePicker) - this.startDate = this.startDate.startOf('day'); - - if (this.timePicker && this.timePickerIncrement) - this.startDate.minute(Math.round(this.startDate.minute() / this.timePickerIncrement) * this.timePickerIncrement); - - if (this.minDate && this.startDate.isBefore(this.minDate)) - this.startDate = this.minDate; - - if (this.maxDate && this.startDate.isAfter(this.maxDate)) - this.startDate = this.maxDate; - - if (!this.isShowing) - this.updateElement(); - - this.updateMonthsInView(); - }, - - setEndDate: function(endDate) { - if (typeof endDate === 'string') - this.endDate = moment(endDate, this.locale.format); - - if (typeof endDate === 'object') - this.endDate = moment(endDate); - - if (!this.timePicker) - this.endDate = this.endDate.endOf('day'); - - if (this.timePicker && this.timePickerIncrement) - this.endDate.minute(Math.round(this.endDate.minute() / this.timePickerIncrement) * this.timePickerIncrement); - - if (this.endDate.isBefore(this.startDate)) - this.endDate = this.startDate.clone(); - - if (this.maxDate && this.endDate.isAfter(this.maxDate)) - this.endDate = this.maxDate; - - if (this.dateLimit && this.startDate.clone().add(this.dateLimit).isBefore(this.endDate)) - this.endDate = this.startDate.clone().add(this.dateLimit); - - this.previousRightTime = this.endDate.clone(); - - if (!this.isShowing) - this.updateElement(); - - this.updateMonthsInView(); - }, - - isInvalidDate: function() { - return false; - }, - - updateView: function() { - if (this.timePicker) { - this.renderTimePicker('left'); - this.renderTimePicker('right'); - if (!this.endDate) { - this.container.find('.right .calendar-time select').attr('disabled', 'disabled').addClass('disabled'); - } else { - this.container.find('.right .calendar-time select').removeAttr('disabled').removeClass('disabled'); - } - } - if (this.endDate) { - this.container.find('input[name="daterangepicker_end"]').removeClass('active'); - this.container.find('input[name="daterangepicker_start"]').addClass('active'); - } else { - this.container.find('input[name="daterangepicker_end"]').addClass('active'); - this.container.find('input[name="daterangepicker_start"]').removeClass('active'); - } - this.updateMonthsInView(); - this.updateCalendars(); - this.updateFormInputs(); - }, - - updateMonthsInView: function() { - if (this.endDate) { - - //if both dates are visible already, do nothing - if (!this.singleDatePicker && this.leftCalendar.month && this.rightCalendar.month && - (this.startDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.startDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM')) - && - (this.endDate.format('YYYY-MM') == this.leftCalendar.month.format('YYYY-MM') || this.endDate.format('YYYY-MM') == this.rightCalendar.month.format('YYYY-MM')) - ) { - return; - } - - this.leftCalendar.month = this.startDate.clone().date(2); - if (!this.linkedCalendars && (this.endDate.month() != this.startDate.month() || this.endDate.year() != this.startDate.year())) { - this.rightCalendar.month = this.endDate.clone().date(2); - } else { - this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month'); - } - - } else { - if (this.leftCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM') && this.rightCalendar.month.format('YYYY-MM') != this.startDate.format('YYYY-MM')) { - this.leftCalendar.month = this.startDate.clone().date(2); - this.rightCalendar.month = this.startDate.clone().date(2).add(1, 'month'); - } - } - }, - - updateCalendars: function() { - - if (this.timePicker) { - var hour, minute, second; - if (this.endDate) { - hour = parseInt(this.container.find('.left .hourselect').val(), 10); - minute = parseInt(this.container.find('.left .minuteselect').val(), 10); - second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0; - if (!this.timePicker24Hour) { - var ampm = this.container.find('.left .ampmselect').val(); - if (ampm === 'PM' && hour < 12) - hour += 12; - if (ampm === 'AM' && hour === 12) - hour = 0; - } - } else { - hour = parseInt(this.container.find('.right .hourselect').val(), 10); - minute = parseInt(this.container.find('.right .minuteselect').val(), 10); - second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0; - if (!this.timePicker24Hour) { - var ampm = this.container.find('.right .ampmselect').val(); - if (ampm === 'PM' && hour < 12) - hour += 12; - if (ampm === 'AM' && hour === 12) - hour = 0; - } - } - this.leftCalendar.month.hour(hour).minute(minute).second(second); - this.rightCalendar.month.hour(hour).minute(minute).second(second); - } - - this.renderCalendar('left'); - this.renderCalendar('right'); - - //highlight any predefined range matching the current start and end dates - this.container.find('.ranges li').removeClass('active'); - if (this.endDate == null) return; - - this.calculateChosenLabel(); - }, - - renderCalendar: function(side) { - - // - // Build the matrix of dates that will populate the calendar - // - - var calendar = side == 'left' ? this.leftCalendar : this.rightCalendar; - var month = calendar.month.month(); - var year = calendar.month.year(); - var hour = calendar.month.hour(); - var minute = calendar.month.minute(); - var second = calendar.month.second(); - var daysInMonth = moment([year, month]).daysInMonth(); - var firstDay = moment([year, month, 1]); - var lastDay = moment([year, month, daysInMonth]); - var lastMonth = moment(firstDay).subtract(1, 'month').month(); - var lastYear = moment(firstDay).subtract(1, 'month').year(); - var daysInLastMonth = moment([lastYear, lastMonth]).daysInMonth(); - var dayOfWeek = firstDay.day(); - - //initialize a 6 rows x 7 columns array for the calendar - var calendar = []; - calendar.firstDay = firstDay; - calendar.lastDay = lastDay; - - for (var i = 0; i < 6; i++) { - calendar[i] = []; - } - - //populate the calendar with date objects - var startDay = daysInLastMonth - dayOfWeek + this.locale.firstDay + 1; - if (startDay > daysInLastMonth) - startDay -= 7; - - if (dayOfWeek == this.locale.firstDay) - startDay = daysInLastMonth - 6; - - var curDate = moment([lastYear, lastMonth, startDay, 12, minute, second]); - - var col, row; - for (var i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = moment(curDate).add(24, 'hour')) { - if (i > 0 && col % 7 === 0) { - col = 0; - row++; - } - calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second); - curDate.hour(12); - - if (this.minDate && calendar[row][col].format('YYYY-MM-DD') == this.minDate.format('YYYY-MM-DD') && calendar[row][col].isBefore(this.minDate) && side == 'left') { - calendar[row][col] = this.minDate.clone(); - } - - if (this.maxDate && calendar[row][col].format('YYYY-MM-DD') == this.maxDate.format('YYYY-MM-DD') && calendar[row][col].isAfter(this.maxDate) && side == 'right') { - calendar[row][col] = this.maxDate.clone(); - } - - } - - //make the calendar object available to hoverDate/clickDate - if (side == 'left') { - this.leftCalendar.calendar = calendar; - } else { - this.rightCalendar.calendar = calendar; - } - - // - // Display the calendar - // - - var minDate = side == 'left' ? this.minDate : this.startDate; - var maxDate = this.maxDate; - var selected = side == 'left' ? this.startDate : this.endDate; - - var html = ''; - html += ''; - html += ''; - - // add empty cell for week number - if (this.showWeekNumbers || this.showISOWeekNumbers) - html += ''; - - if ((!minDate || minDate.isBefore(calendar.firstDay)) && (!this.linkedCalendars || side == 'left')) { - html += ''; - } else { - html += ''; - } - - var dateHtml = this.locale.monthNames[calendar[1][1].month()] + calendar[1][1].format(" YYYY"); - - if (this.showDropdowns) { - var currentMonth = calendar[1][1].month(); - var currentYear = calendar[1][1].year(); - var maxYear = (maxDate && maxDate.year()) || (currentYear + 5); - var minYear = (minDate && minDate.year()) || (currentYear - 50); - var inMinYear = currentYear == minYear; - var inMaxYear = currentYear == maxYear; - - var monthHtml = '"; - - var yearHtml = ''; - - dateHtml = monthHtml + yearHtml; - } - - html += ''; - if ((!maxDate || maxDate.isAfter(calendar.lastDay)) && (!this.linkedCalendars || side == 'right' || this.singleDatePicker)) { - html += ''; - } else { - html += ''; - } - - html += ''; - html += ''; - - // add week number label - if (this.showWeekNumbers || this.showISOWeekNumbers) - html += ''; - - $.each(this.locale.daysOfWeek, function(index, dayOfWeek) { - html += ''; - }); - - html += ''; - html += ''; - html += ''; - - //adjust maxDate to reflect the dateLimit setting in order to - //grey out end dates beyond the dateLimit - if (this.endDate == null && this.dateLimit) { - var maxLimit = this.startDate.clone().add(this.dateLimit).endOf('day'); - if (!maxDate || maxLimit.isBefore(maxDate)) { - maxDate = maxLimit; - } - } - - for (var row = 0; row < 6; row++) { - html += ''; - - // add week number - if (this.showWeekNumbers) - html += ''; - else if (this.showISOWeekNumbers) - html += ''; - - for (var col = 0; col < 7; col++) { - - var classes = []; - - //highlight today's date - if (calendar[row][col].isSame(new Date(), "day")) - classes.push('today'); - - //highlight weekends - if (calendar[row][col].isoWeekday() > 5) - classes.push('weekend'); - - //grey out the dates in other months displayed at beginning and end of this calendar - if (calendar[row][col].month() != calendar[1][1].month()) - classes.push('off'); - - //don't allow selection of dates before the minimum date - if (this.minDate && calendar[row][col].isBefore(this.minDate, 'day')) - classes.push('off', 'disabled'); - - //don't allow selection of dates after the maximum date - if (maxDate && calendar[row][col].isAfter(maxDate, 'day')) - classes.push('off', 'disabled'); - - //don't allow selection of date if a custom function decides it's invalid - if (this.isInvalidDate(calendar[row][col])) - classes.push('off', 'disabled'); - - //highlight the currently selected start date - if (calendar[row][col].format('YYYY-MM-DD') == this.startDate.format('YYYY-MM-DD')) - classes.push('active', 'start-date'); - - //highlight the currently selected end date - if (this.endDate != null && calendar[row][col].format('YYYY-MM-DD') == this.endDate.format('YYYY-MM-DD')) - classes.push('active', 'end-date'); - - //highlight dates in-between the selected dates - if (this.endDate != null && calendar[row][col] > this.startDate && calendar[row][col] < this.endDate) - classes.push('in-range'); - - var cname = '', disabled = false; - for (var i = 0; i < classes.length; i++) { - cname += classes[i] + ' '; - if (classes[i] == 'disabled') - disabled = true; - } - if (!disabled) - cname += 'available'; - - html += ''; - - } - html += ''; - } - - html += ''; - html += '
' + dateHtml + '
' + this.locale.weekLabel + '' + dayOfWeek + '
' + calendar[row][0].week() + '' + calendar[row][0].isoWeek() + '' + calendar[row][col].date() + '
'; - - this.container.find('.calendar.' + side + ' .calendar-table').html(html); - - }, - - renderTimePicker: function(side) { - - var html, selected, minDate, maxDate = this.maxDate; - - if (this.dateLimit && (!this.maxDate || this.startDate.clone().add(this.dateLimit).isAfter(this.maxDate))) - maxDate = this.startDate.clone().add(this.dateLimit); - - if (side == 'left') { - selected = this.startDate.clone(); - minDate = this.minDate; - } else if (side == 'right') { - selected = this.endDate ? this.endDate.clone() : this.previousRightTime.clone(); - minDate = this.startDate; - - //Preserve the time already selected - var timeSelector = this.container.find('.calendar.right .calendar-time div'); - if (timeSelector.html() != '') { - - selected.hour(timeSelector.find('.hourselect option:selected').val() || selected.hour()); - selected.minute(timeSelector.find('.minuteselect option:selected').val() || selected.minute()); - selected.second(timeSelector.find('.secondselect option:selected').val() || selected.second()); - - if (!this.timePicker24Hour) { - var ampm = timeSelector.find('.ampmselect option:selected').val(); - if (ampm === 'PM' && selected.hour() < 12) - selected.hour(selected.hour() + 12); - if (ampm === 'AM' && selected.hour() === 12) - selected.hour(0); - } - - if (selected.isBefore(this.startDate)) - selected = this.startDate.clone(); - - if (maxDate && selected.isAfter(maxDate)) - selected = maxDate.clone(); - - } - } - - // - // hours - // - - html = ' '; - - // - // minutes - // - - html += ': '; - - // - // seconds - // - - if (this.timePickerSeconds) { - html += ': '; - } - - // - // AM/PM - // - - if (!this.timePicker24Hour) { - html += ''; - } - - this.container.find('.calendar.' + side + ' .calendar-time div').html(html); - - }, - - updateFormInputs: function() { - - //ignore mouse movements while an above-calendar text input has focus - if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus")) - return; - - this.container.find('input[name=daterangepicker_start]').val(this.startDate.format(this.locale.format)); - if (this.endDate) - this.container.find('input[name=daterangepicker_end]').val(this.endDate.format(this.locale.format)); - - if (this.singleDatePicker || (this.endDate && (this.startDate.isBefore(this.endDate) || this.startDate.isSame(this.endDate)))) { - this.container.find('button.applyBtn').removeAttr('disabled'); - } else { - this.container.find('button.applyBtn').attr('disabled', 'disabled'); - } - - }, - - move: function() { - var parentOffset = { top: 0, left: 0 }, - containerTop; - var parentRightEdge = $(window).width(); - if (!this.parentEl.is('body')) { - parentOffset = { - top: this.parentEl.offset().top - this.parentEl.scrollTop(), - left: this.parentEl.offset().left - this.parentEl.scrollLeft() - }; - parentRightEdge = this.parentEl[0].clientWidth + this.parentEl.offset().left; - } - - if (this.drops == 'up') - containerTop = this.element.offset().top - this.container.outerHeight() - parentOffset.top; - else - containerTop = this.element.offset().top + this.element.outerHeight() - parentOffset.top; - this.container[this.drops == 'up' ? 'addClass' : 'removeClass']('dropup'); - - if (this.opens == 'left') { - this.container.css({ - top: containerTop, - right: parentRightEdge - this.element.offset().left - this.element.outerWidth(), - left: 'auto' - }); - if (this.container.offset().left < 0) { - this.container.css({ - right: 'auto', - left: 9 - }); - } - } else if (this.opens == 'center') { - this.container.css({ - top: containerTop, - left: this.element.offset().left - parentOffset.left + this.element.outerWidth() / 2 - - this.container.outerWidth() / 2, - right: 'auto' - }); - if (this.container.offset().left < 0) { - this.container.css({ - right: 'auto', - left: 9 - }); - } - } else { - this.container.css({ - top: containerTop, - left: this.element.offset().left - parentOffset.left, - right: 'auto' - }); - if (this.container.offset().left + this.container.outerWidth() > $(window).width()) { - this.container.css({ - left: 'auto', - right: 0 - }); - } - } - }, - - show: function(e) { - if (this.isShowing) return; - - // Create a click proxy that is private to this instance of datepicker, for unbinding - this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this); - - // Bind global datepicker mousedown for hiding and - $(document) - .on('mousedown.daterangepicker', this._outsideClickProxy) - // also support mobile devices - .on('touchend.daterangepicker', this._outsideClickProxy) - // also explicitly play nice with Bootstrap dropdowns, which stopPropagation when clicking them - .on('click.daterangepicker', '[data-toggle=dropdown]', this._outsideClickProxy) - // and also close when focus changes to outside the picker (eg. tabbing between controls) - .on('focusin.daterangepicker', this._outsideClickProxy); - - // Reposition the picker if the window is resized while it's open - $(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this)); - - this.oldStartDate = this.startDate.clone(); - this.oldEndDate = this.endDate.clone(); - this.previousRightTime = this.endDate.clone(); - - this.updateView(); - this.container.show(); - this.move(); - this.element.trigger('show.daterangepicker', this); - this.isShowing = true; - }, - - hide: function(e) { - if (!this.isShowing) return; - - //incomplete date selection, revert to last values - if (!this.endDate) { - this.startDate = this.oldStartDate.clone(); - this.endDate = this.oldEndDate.clone(); - } - - //if a new date range was selected, invoke the user callback function - if (!this.startDate.isSame(this.oldStartDate) || !this.endDate.isSame(this.oldEndDate)) - this.callback(this.startDate, this.endDate, this.chosenLabel); - - //if picker is attached to a text input, update it - this.updateElement(); - - $(document).off('.daterangepicker'); - $(window).off('.daterangepicker'); - this.container.hide(); - this.element.trigger('hide.daterangepicker', this); - this.isShowing = false; - }, - - toggle: function(e) { - if (this.isShowing) { - this.hide(); - } else { - this.show(); - } - }, - - outsideClick: function(e) { - var target = $(e.target); - // if the page is clicked anywhere except within the daterangerpicker/button - // itself then call this.hide() - if ( - // ie modal dialog fix - e.type == "focusin" || - target.closest(this.element).length || - target.closest(this.container).length || - target.closest('.calendar-table').length - ) return; - this.hide(); - }, - - showCalendars: function() { - this.container.addClass('show-calendar'); - this.move(); - this.element.trigger('showCalendar.daterangepicker', this); - }, - - hideCalendars: function() { - this.container.removeClass('show-calendar'); - this.element.trigger('hideCalendar.daterangepicker', this); - }, - - hoverRange: function(e) { - - //ignore mouse movements while an above-calendar text input has focus - if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus")) - return; - - var label = e.target.innerHTML; - if (label == this.locale.customRangeLabel) { - this.updateView(); - } else { - var dates = this.ranges[label]; - this.container.find('input[name=daterangepicker_start]').val(dates[0].format(this.locale.format)); - this.container.find('input[name=daterangepicker_end]').val(dates[1].format(this.locale.format)); - } - - }, - - clickRange: function(e) { - var label = e.target.innerHTML; - this.chosenLabel = label; - if (label == this.locale.customRangeLabel) { - this.showCalendars(); - } else { - var dates = this.ranges[label]; - this.startDate = dates[0]; - this.endDate = dates[1]; - - if (!this.timePicker) { - this.startDate.startOf('day'); - this.endDate.endOf('day'); - } - - if (!this.alwaysShowCalendars) - this.hideCalendars(); - this.clickApply(); - } - }, - - clickPrev: function(e) { - var cal = $(e.target).parents('.calendar'); - if (cal.hasClass('left')) { - this.leftCalendar.month.subtract(1, 'month'); - if (this.linkedCalendars) - this.rightCalendar.month.subtract(1, 'month'); - } else { - this.rightCalendar.month.subtract(1, 'month'); - } - this.updateCalendars(); - }, - - clickNext: function(e) { - var cal = $(e.target).parents('.calendar'); - if (cal.hasClass('left')) { - this.leftCalendar.month.add(1, 'month'); - } else { - this.rightCalendar.month.add(1, 'month'); - if (this.linkedCalendars) - this.leftCalendar.month.add(1, 'month'); - } - this.updateCalendars(); - }, - - hoverDate: function(e) { - - //ignore mouse movements while an above-calendar text input has focus - if (this.container.find('input[name=daterangepicker_start]').is(":focus") || this.container.find('input[name=daterangepicker_end]').is(":focus")) - return; - - //ignore dates that can't be selected - if (!$(e.target).hasClass('available')) return; - - //have the text inputs above calendars reflect the date being hovered over - var title = $(e.target).attr('data-title'); - var row = title.substr(1, 1); - var col = title.substr(3, 1); - var cal = $(e.target).parents('.calendar'); - var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col]; - - if (this.endDate) { - this.container.find('input[name=daterangepicker_start]').val(date.format(this.locale.format)); - } else { - this.container.find('input[name=daterangepicker_end]').val(date.format(this.locale.format)); - } - - //highlight the dates between the start date and the date being hovered as a potential end date - var leftCalendar = this.leftCalendar; - var rightCalendar = this.rightCalendar; - var startDate = this.startDate; - if (!this.endDate) { - this.container.find('.calendar td').each(function(index, el) { - - //skip week numbers, only look at dates - if ($(el).hasClass('week')) return; - - var title = $(el).attr('data-title'); - var row = title.substr(1, 1); - var col = title.substr(3, 1); - var cal = $(el).parents('.calendar'); - var dt = cal.hasClass('left') ? leftCalendar.calendar[row][col] : rightCalendar.calendar[row][col]; - - if (dt.isAfter(startDate) && dt.isBefore(date)) { - $(el).addClass('in-range'); - } else { - $(el).removeClass('in-range'); - } - - }); - } - - }, - - clickDate: function(e) { - - if (!$(e.target).hasClass('available')) return; - - var title = $(e.target).attr('data-title'); - var row = title.substr(1, 1); - var col = title.substr(3, 1); - var cal = $(e.target).parents('.calendar'); - var date = cal.hasClass('left') ? this.leftCalendar.calendar[row][col] : this.rightCalendar.calendar[row][col]; - - // - // this function needs to do a few things: - // * alternate between selecting a start and end date for the range, - // * if the time picker is enabled, apply the hour/minute/second from the select boxes to the clicked date - // * if autoapply is enabled, and an end date was chosen, apply the selection - // * if single date picker mode, and time picker isn't enabled, apply the selection immediately - // - - if (this.endDate || date.isBefore(this.startDate, 'day')) { - if (this.timePicker) { - var hour = parseInt(this.container.find('.left .hourselect').val(), 10); - if (!this.timePicker24Hour) { - var ampm = this.container.find('.left .ampmselect').val(); - if (ampm === 'PM' && hour < 12) - hour += 12; - if (ampm === 'AM' && hour === 12) - hour = 0; - } - var minute = parseInt(this.container.find('.left .minuteselect').val(), 10); - var second = this.timePickerSeconds ? parseInt(this.container.find('.left .secondselect').val(), 10) : 0; - date = date.clone().hour(hour).minute(minute).second(second); - } - this.endDate = null; - this.setStartDate(date.clone()); - } else if (!this.endDate && date.isBefore(this.startDate)) { - //special case: clicking the same date for start/end, - //but the time of the end date is before the start date - this.setEndDate(this.startDate.clone()); - } else { - if (this.timePicker) { - var hour = parseInt(this.container.find('.right .hourselect').val(), 10); - if (!this.timePicker24Hour) { - var ampm = this.container.find('.right .ampmselect').val(); - if (ampm === 'PM' && hour < 12) - hour += 12; - if (ampm === 'AM' && hour === 12) - hour = 0; - } - var minute = parseInt(this.container.find('.right .minuteselect').val(), 10); - var second = this.timePickerSeconds ? parseInt(this.container.find('.right .secondselect').val(), 10) : 0; - date = date.clone().hour(hour).minute(minute).second(second); - } - this.setEndDate(date.clone()); - if (this.autoApply) { - this.calculateChosenLabel(); - this.clickApply(); - } - } - - if (this.singleDatePicker) { - this.setEndDate(this.startDate); - if (!this.timePicker) - this.clickApply(); - } - - this.updateView(); - - }, - - calculateChosenLabel: function() { - var customRange = true; - var i = 0; - for (var range in this.ranges) { - if (this.timePicker) { - if (this.startDate.isSame(this.ranges[range][0]) && this.endDate.isSame(this.ranges[range][1])) { - customRange = false; - this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html(); - break; - } - } else { - //ignore times when comparing dates if time picker is not enabled - if (this.startDate.format('YYYY-MM-DD') == this.ranges[range][0].format('YYYY-MM-DD') && this.endDate.format('YYYY-MM-DD') == this.ranges[range][1].format('YYYY-MM-DD')) { - customRange = false; - this.chosenLabel = this.container.find('.ranges li:eq(' + i + ')').addClass('active').html(); - break; - } - } - i++; - } - if (customRange) { - this.chosenLabel = this.container.find('.ranges li:last').addClass('active').html(); - this.showCalendars(); - } - }, - - clickApply: function(e) { - this.hide(); - this.element.trigger('apply.daterangepicker', this); - }, - - clickCancel: function(e) { - this.startDate = this.oldStartDate; - this.endDate = this.oldEndDate; - this.hide(); - this.element.trigger('cancel.daterangepicker', this); - }, - - monthOrYearChanged: function(e) { - var isLeft = $(e.target).closest('.calendar').hasClass('left'), - leftOrRight = isLeft ? 'left' : 'right', - cal = this.container.find('.calendar.'+leftOrRight); - - // Month must be Number for new moment versions - var month = parseInt(cal.find('.monthselect').val(), 10); - var year = cal.find('.yearselect').val(); - - if (!isLeft) { - if (year < this.startDate.year() || (year == this.startDate.year() && month < this.startDate.month())) { - month = this.startDate.month(); - year = this.startDate.year(); - } - } - - if (this.minDate) { - if (year < this.minDate.year() || (year == this.minDate.year() && month < this.minDate.month())) { - month = this.minDate.month(); - year = this.minDate.year(); - } - } - - if (this.maxDate) { - if (year > this.maxDate.year() || (year == this.maxDate.year() && month > this.maxDate.month())) { - month = this.maxDate.month(); - year = this.maxDate.year(); - } - } - - if (isLeft) { - this.leftCalendar.month.month(month).year(year); - if (this.linkedCalendars) - this.rightCalendar.month = this.leftCalendar.month.clone().add(1, 'month'); - } else { - this.rightCalendar.month.month(month).year(year); - if (this.linkedCalendars) - this.leftCalendar.month = this.rightCalendar.month.clone().subtract(1, 'month'); - } - this.updateCalendars(); - }, - - timeChanged: function(e) { - - var cal = $(e.target).closest('.calendar'), - isLeft = cal.hasClass('left'); - - var hour = parseInt(cal.find('.hourselect').val(), 10); - var minute = parseInt(cal.find('.minuteselect').val(), 10); - var second = this.timePickerSeconds ? parseInt(cal.find('.secondselect').val(), 10) : 0; - - if (!this.timePicker24Hour) { - var ampm = cal.find('.ampmselect').val(); - if (ampm === 'PM' && hour < 12) - hour += 12; - if (ampm === 'AM' && hour === 12) - hour = 0; - } - - if (isLeft) { - var start = this.startDate.clone(); - start.hour(hour); - start.minute(minute); - start.second(second); - this.setStartDate(start); - if (this.singleDatePicker) { - this.endDate = this.startDate.clone(); - } else if (this.endDate && this.endDate.format('YYYY-MM-DD') == start.format('YYYY-MM-DD') && this.endDate.isBefore(start)) { - this.setEndDate(start.clone()); - } - } else if (this.endDate) { - var end = this.endDate.clone(); - end.hour(hour); - end.minute(minute); - end.second(second); - this.setEndDate(end); - } - - //update the calendars so all clickable dates reflect the new time component - this.updateCalendars(); - - //update the form inputs above the calendars with the new time - this.updateFormInputs(); - - //re-render the time pickers because changing one selection can affect what's enabled in another - this.renderTimePicker('left'); - this.renderTimePicker('right'); - - }, - - formInputsChanged: function(e) { - var isRight = $(e.target).closest('.calendar').hasClass('right'); - var start = moment(this.container.find('input[name="daterangepicker_start"]').val(), this.locale.format); - var end = moment(this.container.find('input[name="daterangepicker_end"]').val(), this.locale.format); - - if (start.isValid() && end.isValid()) { - - if (isRight && end.isBefore(start)) - start = end.clone(); - - this.setStartDate(start); - this.setEndDate(end); - - if (isRight) { - this.container.find('input[name="daterangepicker_start"]').val(this.startDate.format(this.locale.format)); - } else { - this.container.find('input[name="daterangepicker_end"]').val(this.endDate.format(this.locale.format)); - } - - } - - this.updateCalendars(); - if (this.timePicker) { - this.renderTimePicker('left'); - this.renderTimePicker('right'); - } - }, - - elementChanged: function() { - if (!this.element.is('input')) return; - if (!this.element.val().length) return; - if (this.element.val().length < this.locale.format.length) return; - - var dateString = this.element.val().split(this.locale.separator), - start = null, - end = null; - - if (dateString.length === 2) { - start = moment(dateString[0], this.locale.format); - end = moment(dateString[1], this.locale.format); - } - - if (this.singleDatePicker || start === null || end === null) { - start = moment(this.element.val(), this.locale.format); - end = start; - } - - if (!start.isValid() || !end.isValid()) return; - - this.setStartDate(start); - this.setEndDate(end); - this.updateView(); - }, - - keydown: function(e) { - //hide on tab or enter - if ((e.keyCode === 9) || (e.keyCode === 13)) { - this.hide(); - } - }, - - updateElement: function() { - if (this.element.is('input') && !this.singleDatePicker && this.autoUpdateInput) { - this.element.val(this.startDate.format(this.locale.format) + this.locale.separator + this.endDate.format(this.locale.format)); - this.element.trigger('change'); - } else if (this.element.is('input') && this.autoUpdateInput) { - this.element.val(this.startDate.format(this.locale.format)); - this.element.trigger('change'); - } - }, - - remove: function() { - this.container.remove(); - this.element.off('.daterangepicker'); - this.element.removeData(); - } - - }; - - $.fn.daterangepicker = function(options, callback) { - this.each(function() { - var el = $(this); - if (el.data('daterangepicker')) - el.data('daterangepicker').remove(); - el.data('daterangepicker', new DateRangePicker(el, options, callback)); - }); - return this; - }; - - return DateRangePicker; - -})); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/moment.min.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/moment.min.js deleted file mode 100644 index 05199bd3b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.date-range-picker/public/js/moment.min.js +++ /dev/null @@ -1,7 +0,0 @@ -//! moment.js -//! version : 2.10.3 -//! authors : Tim Wood, Iskren Chernev, Moment.js contributors -//! license : MIT -//! momentjs.com -!function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):a.moment=b()}(this,function(){"use strict";function a(){return Dc.apply(null,arguments)}function b(a){Dc=a}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(a){return a instanceof Date||"[object Date]"===Object.prototype.toString.call(a)}function e(a,b){var c,d=[];for(c=0;c0)for(c in Fc)d=Fc[c],e=b[d],"undefined"!=typeof e&&(a[d]=e);return a}function n(b){m(this,b),this._d=new Date(+b._d),Gc===!1&&(Gc=!0,a.updateOffset(this),Gc=!1)}function o(a){return a instanceof n||null!=a&&null!=a._isAMomentObject}function p(a){var b=+a,c=0;return 0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}function q(a,b,c){var d,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&p(a[d])!==p(b[d]))&&g++;return g+f}function r(){}function s(a){return a?a.toLowerCase().replace("_","-"):a}function t(a){for(var b,c,d,e,f=0;f0;){if(d=u(e.slice(0,b).join("-")))return d;if(c&&c.length>=b&&q(e,c,!0)>=b-1)break;b--}f++}return null}function u(a){var b=null;if(!Hc[a]&&"undefined"!=typeof module&&module&&module.exports)try{b=Ec._abbr,require("./locale/"+a),v(b)}catch(c){}return Hc[a]}function v(a,b){var c;return a&&(c="undefined"==typeof b?x(a):w(a,b),c&&(Ec=c)),Ec._abbr}function w(a,b){return null!==b?(b.abbr=a,Hc[a]||(Hc[a]=new r),Hc[a].set(b),v(a),Hc[a]):(delete Hc[a],null)}function x(a){var b;if(a&&a._locale&&a._locale._abbr&&(a=a._locale._abbr),!a)return Ec;if(!c(a)){if(b=u(a))return b;a=[a]}return t(a)}function y(a,b){var c=a.toLowerCase();Ic[c]=Ic[c+"s"]=Ic[b]=a}function z(a){return"string"==typeof a?Ic[a]||Ic[a.toLowerCase()]:void 0}function A(a){var b,c,d={};for(c in a)f(a,c)&&(b=z(c),b&&(d[b]=a[c]));return d}function B(b,c){return function(d){return null!=d?(D(this,b,d),a.updateOffset(this,c),this):C(this,b)}}function C(a,b){return a._d["get"+(a._isUTC?"UTC":"")+b]()}function D(a,b,c){return a._d["set"+(a._isUTC?"UTC":"")+b](c)}function E(a,b){var c;if("object"==typeof a)for(c in a)this.set(c,a[c]);else if(a=z(a),"function"==typeof this[a])return this[a](b);return this}function F(a,b,c){for(var d=""+Math.abs(a),e=a>=0;d.lengthb;b++)Mc[d[b]]?d[b]=Mc[d[b]]:d[b]=H(d[b]);return function(e){var f="";for(b=0;c>b;b++)f+=d[b]instanceof Function?d[b].call(e,a):d[b];return f}}function J(a,b){return a.isValid()?(b=K(b,a.localeData()),Lc[b]||(Lc[b]=I(b)),Lc[b](a)):a.localeData().invalidDate()}function K(a,b){function c(a){return b.longDateFormat(a)||a}var d=5;for(Kc.lastIndex=0;d>=0&&Kc.test(a);)a=a.replace(Kc,c),Kc.lastIndex=0,d-=1;return a}function L(a,b,c){_c[a]="function"==typeof b?b:function(a){return a&&c?c:b}}function M(a,b){return f(_c,a)?_c[a](b._strict,b._locale):new RegExp(N(a))}function N(a){return a.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){return b||c||d||e}).replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function O(a,b){var c,d=b;for("string"==typeof a&&(a=[a]),"number"==typeof b&&(d=function(a,c){c[b]=p(a)}),c=0;cd;d++){if(e=h([2e3,d]),c&&!this._longMonthsParse[d]&&(this._longMonthsParse[d]=new RegExp("^"+this.months(e,"").replace(".","")+"$","i"),this._shortMonthsParse[d]=new RegExp("^"+this.monthsShort(e,"").replace(".","")+"$","i")),c||this._monthsParse[d]||(f="^"+this.months(e,"")+"|^"+this.monthsShort(e,""),this._monthsParse[d]=new RegExp(f.replace(".",""),"i")),c&&"MMMM"===b&&this._longMonthsParse[d].test(a))return d;if(c&&"MMM"===b&&this._shortMonthsParse[d].test(a))return d;if(!c&&this._monthsParse[d].test(a))return d}}function V(a,b){var c;return"string"==typeof b&&(b=a.localeData().monthsParse(b),"number"!=typeof b)?a:(c=Math.min(a.date(),R(a.year(),b)),a._d["set"+(a._isUTC?"UTC":"")+"Month"](b,c),a)}function W(b){return null!=b?(V(this,b),a.updateOffset(this,!0),this):C(this,"Month")}function X(){return R(this.year(),this.month())}function Y(a){var b,c=a._a;return c&&-2===j(a).overflow&&(b=c[cd]<0||c[cd]>11?cd:c[dd]<1||c[dd]>R(c[bd],c[cd])?dd:c[ed]<0||c[ed]>24||24===c[ed]&&(0!==c[fd]||0!==c[gd]||0!==c[hd])?ed:c[fd]<0||c[fd]>59?fd:c[gd]<0||c[gd]>59?gd:c[hd]<0||c[hd]>999?hd:-1,j(a)._overflowDayOfYear&&(bd>b||b>dd)&&(b=dd),j(a).overflow=b),a}function Z(b){a.suppressDeprecationWarnings===!1&&"undefined"!=typeof console&&console.warn&&console.warn("Deprecation warning: "+b)}function $(a,b){var c=!0,d=a+"\n"+(new Error).stack;return g(function(){return c&&(Z(d),c=!1),b.apply(this,arguments)},b)}function _(a,b){kd[a]||(Z(b),kd[a]=!0)}function aa(a){var b,c,d=a._i,e=ld.exec(d);if(e){for(j(a).iso=!0,b=0,c=md.length;c>b;b++)if(md[b][1].exec(d)){a._f=md[b][0]+(e[6]||" ");break}for(b=0,c=nd.length;c>b;b++)if(nd[b][1].exec(d)){a._f+=nd[b][0];break}d.match(Yc)&&(a._f+="Z"),ta(a)}else a._isValid=!1}function ba(b){var c=od.exec(b._i);return null!==c?void(b._d=new Date(+c[1])):(aa(b),void(b._isValid===!1&&(delete b._isValid,a.createFromInputFallback(b))))}function ca(a,b,c,d,e,f,g){var h=new Date(a,b,c,d,e,f,g);return 1970>a&&h.setFullYear(a),h}function da(a){var b=new Date(Date.UTC.apply(null,arguments));return 1970>a&&b.setUTCFullYear(a),b}function ea(a){return fa(a)?366:365}function fa(a){return a%4===0&&a%100!==0||a%400===0}function ga(){return fa(this.year())}function ha(a,b,c){var d,e=c-b,f=c-a.day();return f>e&&(f-=7),e-7>f&&(f+=7),d=Aa(a).add(f,"d"),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}function ia(a){return ha(a,this._week.dow,this._week.doy).week}function ja(){return this._week.dow}function ka(){return this._week.doy}function la(a){var b=this.localeData().week(this);return null==a?b:this.add(7*(a-b),"d")}function ma(a){var b=ha(this,1,4).week;return null==a?b:this.add(7*(a-b),"d")}function na(a,b,c,d,e){var f,g,h=da(a,0,1).getUTCDay();return h=0===h?7:h,c=null!=c?c:e,f=e-h+(h>d?7:0)-(e>h?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:ea(a-1)+g}}function oa(a){var b=Math.round((this.clone().startOf("day")-this.clone().startOf("year"))/864e5)+1;return null==a?b:this.add(a-b,"d")}function pa(a,b,c){return null!=a?a:null!=b?b:c}function qa(a){var b=new Date;return a._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}function ra(a){var b,c,d,e,f=[];if(!a._d){for(d=qa(a),a._w&&null==a._a[dd]&&null==a._a[cd]&&sa(a),a._dayOfYear&&(e=pa(a._a[bd],d[bd]),a._dayOfYear>ea(e)&&(j(a)._overflowDayOfYear=!0),c=da(e,0,a._dayOfYear),a._a[cd]=c.getUTCMonth(),a._a[dd]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=f[b]=d[b];for(;7>b;b++)a._a[b]=f[b]=null==a._a[b]?2===b?1:0:a._a[b];24===a._a[ed]&&0===a._a[fd]&&0===a._a[gd]&&0===a._a[hd]&&(a._nextDay=!0,a._a[ed]=0),a._d=(a._useUTC?da:ca).apply(null,f),null!=a._tzm&&a._d.setUTCMinutes(a._d.getUTCMinutes()-a._tzm),a._nextDay&&(a._a[ed]=24)}}function sa(a){var b,c,d,e,f,g,h;b=a._w,null!=b.GG||null!=b.W||null!=b.E?(f=1,g=4,c=pa(b.GG,a._a[bd],ha(Aa(),1,4).year),d=pa(b.W,1),e=pa(b.E,1)):(f=a._locale._week.dow,g=a._locale._week.doy,c=pa(b.gg,a._a[bd],ha(Aa(),f,g).year),d=pa(b.w,1),null!=b.d?(e=b.d,f>e&&++d):e=null!=b.e?b.e+f:f),h=na(c,d,e,g,f),a._a[bd]=h.year,a._dayOfYear=h.dayOfYear}function ta(b){if(b._f===a.ISO_8601)return void aa(b);b._a=[],j(b).empty=!0;var c,d,e,f,g,h=""+b._i,i=h.length,k=0;for(e=K(b._f,b._locale).match(Jc)||[],c=0;c0&&j(b).unusedInput.push(g),h=h.slice(h.indexOf(d)+d.length),k+=d.length),Mc[f]?(d?j(b).empty=!1:j(b).unusedTokens.push(f),Q(f,d,b)):b._strict&&!d&&j(b).unusedTokens.push(f);j(b).charsLeftOver=i-k,h.length>0&&j(b).unusedInput.push(h),j(b).bigHour===!0&&b._a[ed]<=12&&b._a[ed]>0&&(j(b).bigHour=void 0),b._a[ed]=ua(b._locale,b._a[ed],b._meridiem),ra(b),Y(b)}function ua(a,b,c){var d;return null==c?b:null!=a.meridiemHour?a.meridiemHour(b,c):null!=a.isPM?(d=a.isPM(c),d&&12>b&&(b+=12),d||12!==b||(b=0),b):b}function va(a){var b,c,d,e,f;if(0===a._f.length)return j(a).invalidFormat=!0,void(a._d=new Date(0/0));for(e=0;ef)&&(d=f,c=b));g(a,c||b)}function wa(a){if(!a._d){var b=A(a._i);a._a=[b.year,b.month,b.day||b.date,b.hour,b.minute,b.second,b.millisecond],ra(a)}}function xa(a){var b,e=a._i,f=a._f;return a._locale=a._locale||x(a._l),null===e||void 0===f&&""===e?l({nullInput:!0}):("string"==typeof e&&(a._i=e=a._locale.preparse(e)),o(e)?new n(Y(e)):(c(f)?va(a):f?ta(a):d(e)?a._d=e:ya(a),b=new n(Y(a)),b._nextDay&&(b.add(1,"d"),b._nextDay=void 0),b))}function ya(b){var f=b._i;void 0===f?b._d=new Date:d(f)?b._d=new Date(+f):"string"==typeof f?ba(b):c(f)?(b._a=e(f.slice(0),function(a){return parseInt(a,10)}),ra(b)):"object"==typeof f?wa(b):"number"==typeof f?b._d=new Date(f):a.createFromInputFallback(b)}function za(a,b,c,d,e){var f={};return"boolean"==typeof c&&(d=c,c=void 0),f._isAMomentObject=!0,f._useUTC=f._isUTC=e,f._l=c,f._i=a,f._f=b,f._strict=d,xa(f)}function Aa(a,b,c,d){return za(a,b,c,d,!1)}function Ba(a,b){var d,e;if(1===b.length&&c(b[0])&&(b=b[0]),!b.length)return Aa();for(d=b[0],e=1;ea&&(a=-a,c="-"),c+F(~~(a/60),2)+b+F(~~a%60,2)})}function Ha(a){var b=(a||"").match(Yc)||[],c=b[b.length-1]||[],d=(c+"").match(td)||["-",0,0],e=+(60*d[1])+p(d[2]);return"+"===d[0]?e:-e}function Ia(b,c){var e,f;return c._isUTC?(e=c.clone(),f=(o(b)||d(b)?+b:+Aa(b))-+e,e._d.setTime(+e._d+f),a.updateOffset(e,!1),e):Aa(b).local();return c._isUTC?Aa(b).zone(c._offset||0):Aa(b).local()}function Ja(a){return 15*-Math.round(a._d.getTimezoneOffset()/15)}function Ka(b,c){var d,e=this._offset||0;return null!=b?("string"==typeof b&&(b=Ha(b)),Math.abs(b)<16&&(b=60*b),!this._isUTC&&c&&(d=Ja(this)),this._offset=b,this._isUTC=!0,null!=d&&this.add(d,"m"),e!==b&&(!c||this._changeInProgress?$a(this,Va(b-e,"m"),1,!1):this._changeInProgress||(this._changeInProgress=!0,a.updateOffset(this,!0),this._changeInProgress=null)),this):this._isUTC?e:Ja(this)}function La(a,b){return null!=a?("string"!=typeof a&&(a=-a),this.utcOffset(a,b),this):-this.utcOffset()}function Ma(a){return this.utcOffset(0,a)}function Na(a){return this._isUTC&&(this.utcOffset(0,a),this._isUTC=!1,a&&this.subtract(Ja(this),"m")),this}function Oa(){return this._tzm?this.utcOffset(this._tzm):"string"==typeof this._i&&this.utcOffset(Ha(this._i)),this}function Pa(a){return a=a?Aa(a).utcOffset():0,(this.utcOffset()-a)%60===0}function Qa(){return this.utcOffset()>this.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()}function Ra(){if(this._a){var a=this._isUTC?h(this._a):Aa(this._a);return this.isValid()&&q(this._a,a.toArray())>0}return!1}function Sa(){return!this._isUTC}function Ta(){return this._isUTC}function Ua(){return this._isUTC&&0===this._offset}function Va(a,b){var c,d,e,g=a,h=null;return Fa(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeof a?(g={},b?g[b]=a:g.milliseconds=a):(h=ud.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:p(h[dd])*c,h:p(h[ed])*c,m:p(h[fd])*c,s:p(h[gd])*c,ms:p(h[hd])*c}):(h=vd.exec(a))?(c="-"===h[1]?-1:1,g={y:Wa(h[2],c),M:Wa(h[3],c),d:Wa(h[4],c),h:Wa(h[5],c),m:Wa(h[6],c),s:Wa(h[7],c),w:Wa(h[8],c)}):null==g?g={}:"object"==typeof g&&("from"in g||"to"in g)&&(e=Ya(Aa(g.from),Aa(g.to)),g={},g.ms=e.milliseconds,g.M=e.months),d=new Ea(g),Fa(a)&&f(a,"_locale")&&(d._locale=a._locale),d}function Wa(a,b){var c=a&&parseFloat(a.replace(",","."));return(isNaN(c)?0:c)*b}function Xa(a,b){var c={milliseconds:0,months:0};return c.months=b.month()-a.month()+12*(b.year()-a.year()),a.clone().add(c.months,"M").isAfter(b)&&--c.months,c.milliseconds=+b-+a.clone().add(c.months,"M"),c}function Ya(a,b){var c;return b=Ia(b,a),a.isBefore(b)?c=Xa(a,b):(c=Xa(b,a),c.milliseconds=-c.milliseconds,c.months=-c.months),c}function Za(a,b){return function(c,d){var e,f;return null===d||isNaN(+d)||(_(b,"moment()."+b+"(period, number) is deprecated. Please use moment()."+b+"(number, period)."),f=c,c=d,d=f),c="string"==typeof c?+c:c,e=Va(c,d),$a(this,e,a),this}}function $a(b,c,d,e){var f=c._milliseconds,g=c._days,h=c._months;e=null==e?!0:e,f&&b._d.setTime(+b._d+f*d),g&&D(b,"Date",C(b,"Date")+g*d),h&&V(b,C(b,"Month")+h*d),e&&a.updateOffset(b,g||h)}function _a(a){var b=a||Aa(),c=Ia(b,this).startOf("day"),d=this.diff(c,"days",!0),e=-6>d?"sameElse":-1>d?"lastWeek":0>d?"lastDay":1>d?"sameDay":2>d?"nextDay":7>d?"nextWeek":"sameElse";return this.format(this.localeData().calendar(e,this,Aa(b)))}function ab(){return new n(this)}function bb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+this>+a):(c=o(a)?+a:+Aa(a),c<+this.clone().startOf(b))}function cb(a,b){var c;return b=z("undefined"!=typeof b?b:"millisecond"),"millisecond"===b?(a=o(a)?a:Aa(a),+a>+this):(c=o(a)?+a:+Aa(a),+this.clone().endOf(b)a?Math.ceil(a):Math.floor(a)}function gb(a,b,c){var d,e,f=Ia(a,this),g=6e4*(f.utcOffset()-this.utcOffset());return b=z(b),"year"===b||"month"===b||"quarter"===b?(e=hb(this,f),"quarter"===b?e/=3:"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:fb(e)}function hb(a,b){var c,d,e=12*(b.year()-a.year())+(b.month()-a.month()),f=a.clone().add(e,"months");return 0>b-f?(c=a.clone().add(e-1,"months"),d=(b-f)/(f-c)):(c=a.clone().add(e+1,"months"),d=(b-f)/(c-f)),-(e+d)}function ib(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")}function jb(){var a=this.clone().utc();return 0b;b++)if(this._weekdaysParse[b]||(c=Aa([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=new RegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))return b}function Mb(a){var b=this._isUTC?this._d.getUTCDay():this._d.getDay();return null!=a?(a=Hb(a,this.localeData()),this.add(a-b,"d")):b}function Nb(a){var b=(this.day()+7-this.localeData()._week.dow)%7;return null==a?b:this.add(a-b,"d")}function Ob(a){return null==a?this.day()||7:this.day(this.day()%7?a:a-7)}function Pb(a,b){G(a,0,0,function(){return this.localeData().meridiem(this.hours(),this.minutes(),b)})}function Qb(a,b){return b._meridiemParse}function Rb(a){return"p"===(a+"").toLowerCase().charAt(0)}function Sb(a,b,c){return a>11?c?"pm":"PM":c?"am":"AM"}function Tb(a){G(0,[a,3],0,"millisecond")}function Ub(){return this._isUTC?"UTC":""}function Vb(){return this._isUTC?"Coordinated Universal Time":""}function Wb(a){return Aa(1e3*a)}function Xb(){return Aa.apply(null,arguments).parseZone()}function Yb(a,b,c){var d=this._calendar[a];return"function"==typeof d?d.call(b,c):d}function Zb(a){var b=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){return a.slice(1)}),this._longDateFormat[a]=b),b}function $b(){return this._invalidDate}function _b(a){return this._ordinal.replace("%d",a)}function ac(a){return a}function bc(a,b,c,d){var e=this._relativeTime[c];return"function"==typeof e?e(a,b,c,d):e.replace(/%d/i,a)}function cc(a,b){var c=this._relativeTime[a>0?"future":"past"];return"function"==typeof c?c(b):c.replace(/%s/i,b)}function dc(a){var b,c;for(c in a)b=a[c],"function"==typeof b?this[c]=b:this["_"+c]=b;this._ordinalParseLenient=new RegExp(this._ordinalParse.source+"|"+/\d{1,2}/.source)}function ec(a,b,c,d){var e=x(),f=h().set(d,b);return e[c](f,a)}function fc(a,b,c,d,e){if("number"==typeof a&&(b=a,a=void 0),a=a||"",null!=b)return ec(a,b,c,e);var f,g=[];for(f=0;d>f;f++)g[f]=ec(a,f,c,e);return g}function gc(a,b){return fc(a,b,"months",12,"month")}function hc(a,b){return fc(a,b,"monthsShort",12,"month")}function ic(a,b){return fc(a,b,"weekdays",7,"day")}function jc(a,b){return fc(a,b,"weekdaysShort",7,"day")}function kc(a,b){return fc(a,b,"weekdaysMin",7,"day")}function lc(){var a=this._data;return this._milliseconds=Rd(this._milliseconds),this._days=Rd(this._days),this._months=Rd(this._months),a.milliseconds=Rd(a.milliseconds),a.seconds=Rd(a.seconds),a.minutes=Rd(a.minutes),a.hours=Rd(a.hours),a.months=Rd(a.months),a.years=Rd(a.years),this}function mc(a,b,c,d){var e=Va(b,c);return a._milliseconds+=d*e._milliseconds,a._days+=d*e._days,a._months+=d*e._months,a._bubble()}function nc(a,b){return mc(this,a,b,1)}function oc(a,b){return mc(this,a,b,-1)}function pc(){var a,b,c,d=this._milliseconds,e=this._days,f=this._months,g=this._data,h=0;return g.milliseconds=d%1e3,a=fb(d/1e3),g.seconds=a%60,b=fb(a/60),g.minutes=b%60,c=fb(b/60),g.hours=c%24,e+=fb(c/24),h=fb(qc(e)),e-=fb(rc(h)),f+=fb(e/30),e%=30,h+=fb(f/12),f%=12,g.days=e,g.months=f,g.years=h,this}function qc(a){return 400*a/146097}function rc(a){return 146097*a/400}function sc(a){var b,c,d=this._milliseconds;if(a=z(a),"month"===a||"year"===a)return b=this._days+d/864e5,c=this._months+12*qc(b),"month"===a?c:c/12;switch(b=this._days+Math.round(rc(this._months/12)),a){case"week":return b/7+d/6048e5;case"day":return b+d/864e5;case"hour":return 24*b+d/36e5;case"minute":return 1440*b+d/6e4;case"second":return 86400*b+d/1e3;case"millisecond":return Math.floor(864e5*b)+d;default:throw new Error("Unknown unit "+a)}}function tc(){return this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*p(this._months/12)}function uc(a){return function(){return this.as(a)}}function vc(a){return a=z(a),this[a+"s"]()}function wc(a){return function(){return this._data[a]}}function xc(){return fb(this.days()/7)}function yc(a,b,c,d,e){return e.relativeTime(b||1,!!c,a,d)}function zc(a,b,c){var d=Va(a).abs(),e=fe(d.as("s")),f=fe(d.as("m")),g=fe(d.as("h")),h=fe(d.as("d")),i=fe(d.as("M")),j=fe(d.as("y")),k=e0,k[4]=c,yc.apply(null,k)}function Ac(a,b){return void 0===ge[a]?!1:void 0===b?ge[a]:(ge[a]=b,!0)}function Bc(a){var b=this.localeData(),c=zc(this,!a,b);return a&&(c=b.pastFuture(+this,c)),b.postformat(c)}function Cc(){var a=he(this.years()),b=he(this.months()),c=he(this.days()),d=he(this.hours()),e=he(this.minutes()),f=he(this.seconds()+this.milliseconds()/1e3),g=this.asSeconds();return g?(0>g?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}var Dc,Ec,Fc=a.momentProperties=[],Gc=!1,Hc={},Ic={},Jc=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,Kc=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,Lc={},Mc={},Nc=/\d/,Oc=/\d\d/,Pc=/\d{3}/,Qc=/\d{4}/,Rc=/[+-]?\d{6}/,Sc=/\d\d?/,Tc=/\d{1,3}/,Uc=/\d{1,4}/,Vc=/[+-]?\d{1,6}/,Wc=/\d+/,Xc=/[+-]?\d+/,Yc=/Z|[+-]\d\d:?\d\d/gi,Zc=/[+-]?\d+(\.\d{1,3})?/,$c=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,_c={},ad={},bd=0,cd=1,dd=2,ed=3,fd=4,gd=5,hd=6;G("M",["MM",2],"Mo",function(){return this.month()+1}),G("MMM",0,0,function(a){return this.localeData().monthsShort(this,a)}),G("MMMM",0,0,function(a){return this.localeData().months(this,a)}),y("month","M"),L("M",Sc),L("MM",Sc,Oc),L("MMM",$c),L("MMMM",$c),O(["M","MM"],function(a,b){b[cd]=p(a)-1}),O(["MMM","MMMM"],function(a,b,c,d){var e=c._locale.monthsParse(a,d,c._strict);null!=e?b[cd]=e:j(c).invalidMonth=a});var id="January_February_March_April_May_June_July_August_September_October_November_December".split("_"),jd="Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),kd={};a.suppressDeprecationWarnings=!1;var ld=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,md=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],nd=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],od=/^\/?Date\((\-?\d+)/i;a.createFromInputFallback=$("moment construction falls back to js Date. This is discouraged and will be removed in upcoming major release. Please refer to https://github.com/moment/moment/issues/1407 for more info.",function(a){a._d=new Date(a._i+(a._useUTC?" UTC":""))}),G(0,["YY",2],0,function(){return this.year()%100}),G(0,["YYYY",4],0,"year"),G(0,["YYYYY",5],0,"year"),G(0,["YYYYYY",6,!0],0,"year"),y("year","y"),L("Y",Xc),L("YY",Sc,Oc),L("YYYY",Uc,Qc),L("YYYYY",Vc,Rc),L("YYYYYY",Vc,Rc),O(["YYYY","YYYYY","YYYYYY"],bd),O("YY",function(b,c){c[bd]=a.parseTwoDigitYear(b)}),a.parseTwoDigitYear=function(a){return p(a)+(p(a)>68?1900:2e3)};var pd=B("FullYear",!1);G("w",["ww",2],"wo","week"),G("W",["WW",2],"Wo","isoWeek"),y("week","w"),y("isoWeek","W"),L("w",Sc),L("ww",Sc,Oc),L("W",Sc),L("WW",Sc,Oc),P(["w","ww","W","WW"],function(a,b,c,d){b[d.substr(0,1)]=p(a)});var qd={dow:0,doy:6};G("DDD",["DDDD",3],"DDDo","dayOfYear"),y("dayOfYear","DDD"),L("DDD",Tc),L("DDDD",Pc),O(["DDD","DDDD"],function(a,b,c){c._dayOfYear=p(a)}),a.ISO_8601=function(){};var rd=$("moment().min is deprecated, use moment.min instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return this>a?this:a}),sd=$("moment().max is deprecated, use moment.max instead. https://github.com/moment/moment/issues/1548",function(){var a=Aa.apply(null,arguments);return a>this?this:a});Ga("Z",":"),Ga("ZZ",""),L("Z",Yc),L("ZZ",Yc),O(["Z","ZZ"],function(a,b,c){c._useUTC=!0,c._tzm=Ha(a)});var td=/([\+\-]|\d\d)/gi;a.updateOffset=function(){};var ud=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,vd=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/;Va.fn=Ea.prototype;var wd=Za(1,"add"),xd=Za(-1,"subtract");a.defaultFormat="YYYY-MM-DDTHH:mm:ssZ";var yd=$("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.",function(a){return void 0===a?this.localeData():this.locale(a)});G(0,["gg",2],0,function(){return this.weekYear()%100}),G(0,["GG",2],0,function(){return this.isoWeekYear()%100}),Ab("gggg","weekYear"),Ab("ggggg","weekYear"),Ab("GGGG","isoWeekYear"),Ab("GGGGG","isoWeekYear"),y("weekYear","gg"),y("isoWeekYear","GG"),L("G",Xc),L("g",Xc),L("GG",Sc,Oc),L("gg",Sc,Oc),L("GGGG",Uc,Qc),L("gggg",Uc,Qc),L("GGGGG",Vc,Rc),L("ggggg",Vc,Rc),P(["gggg","ggggg","GGGG","GGGGG"],function(a,b,c,d){b[d.substr(0,2)]=p(a)}),P(["gg","GG"],function(b,c,d,e){c[e]=a.parseTwoDigitYear(b)}),G("Q",0,0,"quarter"),y("quarter","Q"),L("Q",Nc),O("Q",function(a,b){b[cd]=3*(p(a)-1)}),G("D",["DD",2],"Do","date"),y("date","D"),L("D",Sc),L("DD",Sc,Oc),L("Do",function(a,b){return a?b._ordinalParse:b._ordinalParseLenient}),O(["D","DD"],dd),O("Do",function(a,b){b[dd]=p(a.match(Sc)[0],10)});var zd=B("Date",!0);G("d",0,"do","day"),G("dd",0,0,function(a){return this.localeData().weekdaysMin(this,a)}),G("ddd",0,0,function(a){return this.localeData().weekdaysShort(this,a)}),G("dddd",0,0,function(a){return this.localeData().weekdays(this,a)}),G("e",0,0,"weekday"),G("E",0,0,"isoWeekday"),y("day","d"),y("weekday","e"),y("isoWeekday","E"),L("d",Sc),L("e",Sc),L("E",Sc),L("dd",$c),L("ddd",$c),L("dddd",$c),P(["dd","ddd","dddd"],function(a,b,c){var d=c._locale.weekdaysParse(a);null!=d?b.d=d:j(c).invalidWeekday=a}),P(["d","e","E"],function(a,b,c,d){b[d]=p(a)});var Ad="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Bd="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Cd="Su_Mo_Tu_We_Th_Fr_Sa".split("_");G("H",["HH",2],0,"hour"),G("h",["hh",2],0,function(){return this.hours()%12||12}),Pb("a",!0),Pb("A",!1),y("hour","h"),L("a",Qb),L("A",Qb),L("H",Sc),L("h",Sc),L("HH",Sc,Oc),L("hh",Sc,Oc),O(["H","HH"],ed),O(["a","A"],function(a,b,c){c._isPm=c._locale.isPM(a),c._meridiem=a}),O(["h","hh"],function(a,b,c){b[ed]=p(a),j(c).bigHour=!0});var Dd=/[ap]\.?m?\.?/i,Ed=B("Hours",!0);G("m",["mm",2],0,"minute"),y("minute","m"),L("m",Sc),L("mm",Sc,Oc),O(["m","mm"],fd);var Fd=B("Minutes",!1);G("s",["ss",2],0,"second"),y("second","s"),L("s",Sc),L("ss",Sc,Oc),O(["s","ss"],gd);var Gd=B("Seconds",!1);G("S",0,0,function(){return~~(this.millisecond()/100)}),G(0,["SS",2],0,function(){return~~(this.millisecond()/10)}),Tb("SSS"),Tb("SSSS"),y("millisecond","ms"),L("S",Tc,Nc),L("SS",Tc,Oc),L("SSS",Tc,Pc),L("SSSS",Wc),O(["S","SS","SSS","SSSS"],function(a,b){b[hd]=p(1e3*("0."+a))});var Hd=B("Milliseconds",!1);G("z",0,0,"zoneAbbr"),G("zz",0,0,"zoneName");var Id=n.prototype;Id.add=wd,Id.calendar=_a,Id.clone=ab,Id.diff=gb,Id.endOf=sb,Id.format=kb,Id.from=lb,Id.fromNow=mb,Id.to=nb,Id.toNow=ob,Id.get=E,Id.invalidAt=zb,Id.isAfter=bb,Id.isBefore=cb,Id.isBetween=db,Id.isSame=eb,Id.isValid=xb,Id.lang=yd,Id.locale=pb,Id.localeData=qb,Id.max=sd,Id.min=rd,Id.parsingFlags=yb,Id.set=E,Id.startOf=rb,Id.subtract=xd,Id.toArray=wb,Id.toDate=vb,Id.toISOString=jb,Id.toJSON=jb,Id.toString=ib,Id.unix=ub,Id.valueOf=tb,Id.year=pd,Id.isLeapYear=ga,Id.weekYear=Cb,Id.isoWeekYear=Db,Id.quarter=Id.quarters=Gb,Id.month=W,Id.daysInMonth=X,Id.week=Id.weeks=la,Id.isoWeek=Id.isoWeeks=ma,Id.weeksInYear=Fb,Id.isoWeeksInYear=Eb,Id.date=zd,Id.day=Id.days=Mb,Id.weekday=Nb,Id.isoWeekday=Ob,Id.dayOfYear=oa,Id.hour=Id.hours=Ed,Id.minute=Id.minutes=Fd,Id.second=Id.seconds=Gd,Id.millisecond=Id.milliseconds=Hd,Id.utcOffset=Ka,Id.utc=Ma,Id.local=Na,Id.parseZone=Oa,Id.hasAlignedHourOffset=Pa,Id.isDST=Qa,Id.isDSTShifted=Ra,Id.isLocal=Sa,Id.isUtcOffset=Ta,Id.isUtc=Ua,Id.isUTC=Ua,Id.zoneAbbr=Ub,Id.zoneName=Vb,Id.dates=$("dates accessor is deprecated. Use date instead.",zd),Id.months=$("months accessor is deprecated. Use month instead",W),Id.years=$("years accessor is deprecated. Use year instead",pd),Id.zone=$("moment().zone is deprecated, use moment().utcOffset instead. https://github.com/moment/moment/issues/1779",La);var Jd=Id,Kd={sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},Ld={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY LT",LLLL:"dddd, MMMM D, YYYY LT"},Md="Invalid date",Nd="%d",Od=/\d{1,2}/,Pd={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour", -hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},Qd=r.prototype;Qd._calendar=Kd,Qd.calendar=Yb,Qd._longDateFormat=Ld,Qd.longDateFormat=Zb,Qd._invalidDate=Md,Qd.invalidDate=$b,Qd._ordinal=Nd,Qd.ordinal=_b,Qd._ordinalParse=Od,Qd.preparse=ac,Qd.postformat=ac,Qd._relativeTime=Pd,Qd.relativeTime=bc,Qd.pastFuture=cc,Qd.set=dc,Qd.months=S,Qd._months=id,Qd.monthsShort=T,Qd._monthsShort=jd,Qd.monthsParse=U,Qd.week=ia,Qd._week=qd,Qd.firstDayOfYear=ka,Qd.firstDayOfWeek=ja,Qd.weekdays=Ib,Qd._weekdays=Ad,Qd.weekdaysMin=Kb,Qd._weekdaysMin=Cd,Qd.weekdaysShort=Jb,Qd._weekdaysShort=Bd,Qd.weekdaysParse=Lb,Qd.isPM=Rb,Qd._meridiemParse=Dd,Qd.meridiem=Sb,v("en",{ordinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(a){var b=a%10,c=1===p(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";return a+c}}),a.lang=$("moment.lang is deprecated. Use moment.locale instead.",v),a.langData=$("moment.langData is deprecated. Use moment.localeData instead.",x);var Rd=Math.abs,Sd=uc("ms"),Td=uc("s"),Ud=uc("m"),Vd=uc("h"),Wd=uc("d"),Xd=uc("w"),Yd=uc("M"),Zd=uc("y"),$d=wc("milliseconds"),_d=wc("seconds"),ae=wc("minutes"),be=wc("hours"),ce=wc("days"),de=wc("months"),ee=wc("years"),fe=Math.round,ge={s:45,m:45,h:22,d:26,M:11},he=Math.abs,ie=Ea.prototype;ie.abs=lc,ie.add=nc,ie.subtract=oc,ie.as=sc,ie.asMilliseconds=Sd,ie.asSeconds=Td,ie.asMinutes=Ud,ie.asHours=Vd,ie.asDays=Wd,ie.asWeeks=Xd,ie.asMonths=Yd,ie.asYears=Zd,ie.valueOf=tc,ie._bubble=pc,ie.get=vc,ie.milliseconds=$d,ie.seconds=_d,ie.minutes=ae,ie.hours=be,ie.days=ce,ie.weeks=xc,ie.months=de,ie.years=ee,ie.humanize=Bc,ie.toISOString=Cc,ie.toString=Cc,ie.toJSON=Cc,ie.locale=pb,ie.localeData=qb,ie.toIsoString=$("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",Cc),ie.lang=yd,G("X",0,0,"unix"),G("x",0,0,"valueOf"),L("x",Xc),L("X",Zc),O("X",function(a,b,c){c._d=new Date(1e3*parseFloat(a,10))}),O("x",function(a,b,c){c._d=new Date(p(a))}),a.version="2.10.3",b(Aa),a.fn=Jd,a.min=Ca,a.max=Da,a.utc=h,a.unix=Wb,a.months=gc,a.isDate=d,a.locale=v,a.invalid=l,a.duration=Va,a.isMoment=o,a.weekdays=ic,a.parseZone=Xb,a.localeData=x,a.isDuration=Fa,a.monthsShort=hc,a.weekdaysMin=kc,a.defineLocale=w,a.weekdaysShort=jc,a.normalizeUnits=z,a.relativeTimeThreshold=Ac;var je=a;return je}); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs deleted file mode 100644 index f1951c492..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.hbs +++ /dev/null @@ -1,138 +0,0 @@ -{{unit "cdmf.unit.lib.editable"}} -{{unit "cdmf.unit.lib.qrcode"}} -{{unit "cdmf.unit.device.type.qr-modal"}} - -{{#if deviceFound}} - {{#if isAuthorized}} - - {{#zone "device-thumbnail"}} - - {{/zone}} - - {{#zone "device-details-header"}} -

- {{device.owner}}'s {{device.name}} -

- - - - {{#if device.model}} -

{{device.vendor}} {{device.model}}

- {{/if}} -

Ownership - {{device.ownership}}

-

Device is - - {{#equal device.status "ACTIVE"}}Active{{/equal}} - {{#equal device.status "INACTIVE"}}Inactive{{/equal}} - {{#equal device.status "BLOCKED"}}Blocked{{/equal}} - {{#equal device.status "REMOVED"}}Removed{{/equal}} - {{#equal device.status "UNREACHABLE"}}Unreachable{{/equal}} - -

- {{/zone}} - - {{#zone "device-opetations"}} - {{#if device.isNotRemoved}} -
-
-

Device Operations

-
- {{unit "cdmf.unit.device.type.windows.operation-bar" device=device - backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}} -
- {{/if}} - {{/zone}} - - {{#zone "device-details"}} -
- {{#if device.deviceInfoAvailable}} - {{#if device.BatteryLevel}} -

{{device.BatteryLevel.value}}%

- {{/if}} - {{#if device.ramUsage}} -

{{device.ramUsage.value}} MB

- {{/if}} - {{#if device.internalMemory}} -

{{device.internalMemory.value}} GB -

- {{/if}} - {{else}} -

Battery, RAM and Storage related information are not - available yet.

- {{/if}} -
- {{/zone}} - - {{#zone "device-details-tab-injected"}} -
  • Location
  • -
  • Policy Compliance
  • - {{/zone}} - - {{#zone "device-view-tab-injected-conents"}} -
    - {{#if device.location}} -
    -
    -
    -
    -
    - {{unit "cdmf.unit.geo-dashboard" device=device noGeoFencing=false hideSearch=true}} - {{else}} -
    -

    - - The device location information is not available right now! Please refresh the page in a few minutes. - The location details will not be available if the device’s “Location Services setting” is disabled - or if Entgra IoT Server has not received the device’s location information from the device. -

    -
    -

    -

    -

    - {{/if}} -
    -
    -
    -
    -
    - - {{/zone}} - - - - {{else}} -

    - Permission Denied -

    -
    - You are not authorized to view specified device in the system. - {{/if}} -{{else}} -

    - Device not found -

    -
    - You have tried to access either a removed or non-existing device. -{{/if}} - -{{#zone "bottomJs"}} - {{#if isAuthorized}} - - - {{js "js/device-detail.js"}} - {{/if}} -{{/zone}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js deleted file mode 100644 index da372562f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.js +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -function onRequest(context) { - // var log = new Log("device-view.js"); - var deviceType = context["uriParams"]["deviceType"]; - var deviceId = request.getParameter("id"); - var owner = request.getParameter("owner"); - var deviceViewData = {}; - - if (deviceType && deviceId) { - var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; - var response = deviceModule.viewDevice(deviceType, deviceId, owner); - if (response["status"] === "success") { - deviceViewData["deviceFound"] = true; - deviceViewData["isAuthorized"] = true; - - var filteredDeviceData = response["content"]; - - // creating deviceView information model from filtered device data - var viewModel = {}; - var deviceInfoServiceAPI = devicemgtProps["deviceInfoServiceAPI"]; - var deviceLocationServiceAPI = devicemgtProps["deviceLocationServiceAPI"]; - - if (deviceInfoServiceAPI){ - viewModel["deviceInfoServiceAPI"] = deviceInfoServiceAPI.replace("%device-type%", deviceType) - } - if (deviceLocationServiceAPI){ - viewModel['deviceLocationServiceAPI'] = deviceLocationServiceAPI.replace("%device-type%", deviceType) - } - if (filteredDeviceData["type"]) { - viewModel["type"] = filteredDeviceData["type"]; - viewModel.isNotWindows = true; - } - if (filteredDeviceData["deviceIdentifier"]) { - viewModel["deviceIdentifier"] = filteredDeviceData["deviceIdentifier"]; - } - if (filteredDeviceData["name"]) { - viewModel["name"] = filteredDeviceData["name"]; - } - if (filteredDeviceData["enrolmentInfo"]) { - if (filteredDeviceData["enrolmentInfo"]["status"]) { - viewModel["status"] = filteredDeviceData["enrolmentInfo"]["status"]; - viewModel.isActive = false ; - viewModel.isNotRemoved = true; - if (filteredDeviceData["enrolmentInfo"]["status"]== "ACTIVE") { - viewModel.isActive = true ; - } - if (filteredDeviceData["enrolmentInfo"]["status"]== "REMOVED") { - viewModel.isNotRemoved = false ; - } - } - if (filteredDeviceData["enrolmentInfo"]["owner"]) { - viewModel["owner"] = filteredDeviceData["enrolmentInfo"]["owner"]; - } - if (filteredDeviceData["enrolmentInfo"]["ownership"]) { - viewModel["ownership"] = filteredDeviceData["enrolmentInfo"]["ownership"]; - } - } - if (filteredDeviceData["latestDeviceInfo"]) { - viewModel["deviceInfoAvailable"] = true; - if (filteredDeviceData["latestDeviceInfo"]["osBuildDate"]) { - if (filteredDeviceData["latestDeviceInfo"]["osBuildDate"] != "0") { - viewModel["osBuildDate"] = new Date(filteredDeviceData["latestDeviceInfo"]["osBuildDate"] * 1000); - } - } - if (filteredDeviceData["latestDeviceInfo"]["location"]["latitude"] && - filteredDeviceData["latestDeviceInfo"]["location"]["longitude"]) { - viewModel["location"] = {}; - viewModel["location"]["latitude"] = filteredDeviceData["latestDeviceInfo"]["location"]["latitude"]; - viewModel["location"]["longitude"] = filteredDeviceData["latestDeviceInfo"]["location"]["longitude"]; - viewModel["location"]["updatedTime"] = filteredDeviceData["latestDeviceInfo"]["location"]["updatedTime"]; - } - if (filteredDeviceData["latestDeviceInfo"]["vendor"] && filteredDeviceData["latestDeviceInfo"]["deviceModel"]) { - viewModel["vendor"] = filteredDeviceData["latestDeviceInfo"]["vendor"]; - viewModel["model"] = filteredDeviceData["latestDeviceInfo"]["deviceModel"]; - } - if (filteredDeviceData["latestDeviceInfo"]["updatedTime"]) { - viewModel["lastUpdatedTime"] = filteredDeviceData["latestDeviceInfo"]["updatedTime"]. - substr(0, filteredDeviceData["latestDeviceInfo"]["updatedTime"].indexOf("+")); - } - viewModel["BatteryLevel"] = {}; - viewModel["BatteryLevel"]["value"] = filteredDeviceData["latestDeviceInfo"]["batteryLevel"]; - - viewModel["ramUsage"] = {}; - viewModel["ramUsage"]["value"] = (filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"]); - - viewModel["internalMemory"] = {}; - viewModel["internalMemory"]["value"] = replaceNaNVal(Math.round((filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) / 1024)); - - } - if (!filteredDeviceData["initialDeviceInfo"] && !filteredDeviceData["latestDeviceInfo"]) { - viewModel["deviceInfoAvailable"] = false; - } - viewModel.locationHistory = stringify(filteredDeviceData["locationHistory"]); - deviceViewData["device"] = viewModel; - } else if (response["status"] == "unauthorized") { - deviceViewData["deviceFound"] = true; - deviceViewData["isAuthorized"] = false; - } else if (response["status"] == "notFound") { - deviceViewData["deviceFound"] = false; - } - } else { - deviceViewData["deviceFound"] = false; - } - - var autoCompleteParams = [ - {"name" : "deviceId", "value" : deviceId} - ]; - - var userModule = require("/app/modules/business-controllers/user.js")["userModule"]; - var permissions = userModule.getUIPermissions(); - deviceViewData["autoCompleteParams"] = autoCompleteParams; - deviceViewData["permissions"] = permissions; - return deviceViewData; - - function replaceNaNVal(val) { - if (isNaN(val)) { - return "N/A"; - } - return val; - } -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json deleted file mode 100644 index 688e93980..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/device-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/TemperatureController.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/TemperatureController.png deleted file mode 100755 index e16b48d8e..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/TemperatureController.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/android.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/android.png deleted file mode 100755 index 7fee78a64..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/android.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/ios.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/ios.png deleted file mode 100755 index 4b09796f8..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/ios.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/windows_app_icon.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/windows_app_icon.png deleted file mode 100644 index b37346031..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/device_icons/windows_app_icon.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/graph.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/graph.png deleted file mode 100755 index dd819ef4f..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/img/graph.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js deleted file mode 100755 index 47bf3e1a8..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/js/device-detail.js +++ /dev/null @@ -1,398 +0,0 @@ -/* - * Copyright (c) 2015, 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 InitiateViewOption = null; - -(function () { - var deviceId = $(".device-id"); - var deviceIdentifier = deviceId.data("deviceid"); - var deviceType = deviceId.data("type"); - var ownership = deviceId.data("ownership"); - var devStatus = deviceId.data("status"); - var payload = [deviceIdentifier]; - var operationTable; - - if ("REMOVED" !== devStatus) { - var deviceInfoServiceAPI = deviceId.data("deviceinfoservice"); - var deviceLocationServiceAPI = deviceId.data("devicelocationservice"); - if (deviceInfoServiceAPI) { - invokerUtil.post( - deviceInfoServiceAPI, - payload, - // success-callback - function () { - $(".panel-body").show(); - }, - // error-callback - function () { - var defaultInnerHTML = - "

    Device data may not have been updated. Please refresh to try again.

    "; - $(".panel-body").append(defaultInnerHTML); - } - ); - } - if (deviceLocationServiceAPI) { - invokerUtil.post( - deviceLocationServiceAPI, - payload, - // success-callback - function () { - $(".panel-body").show(); - }, - // error-callback - function () { - var defaultInnerHTML = - "

    Device data may not have been updated. Please refresh to try again.

    "; - $(".panel-body").append(defaultInnerHTML); - } - ); - } - } - - - $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { - var activeTabPane = $(e.target).attr("href"); - var activeListGroupItem = $(".media .list-group-item.active"); - - $(activeTabPane).removeClass("visible-xs-block"); - $(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block"); - positionArrow(activeListGroupItem); - }); - - $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { - var thisParent = $(e.target).parent(); - var activeTabPaneCaret = thisParent.find('.caret-updown'); - var activeTabPaneCaretSiblings = thisParent.siblings().find('.caret-updown'); - - activeTabPaneCaret.removeClass("fw-up").addClass("fw-down"); - activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up"); - }); - - $('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){ - var clickedPanel = $(this).attr('href'); - - if($(clickedPanel).hasClass('in')){ - $(clickedPanel).collapse('hide'); - }else{ - $(clickedPanel).collapse('show'); - } - }); - - $('#status').on('save', function (e, params) { - var deviceStatus = params.submitValue.toUpperCase(); - var serviceUrl = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceIdentifier - + "/changestatus?newStatus=" + deviceStatus; - var payload = null; - - if (serviceUrl) { - var successCallback = function (jqXHR, status, resp) { - if (resp.status == 200) { - setTimeout(function () { - if (deviceStatus == "REMOVED") { - $('#statusIcon').removeClass().addClass('fw fw-delete icon-danger'); - } else if (deviceStatus == "INACTIVE") { - $('#statusIcon').removeClass().addClass('fw fw-warning icon-warning'); - } else if (deviceStatus == "ACTIVE") { - $('#statusIcon').removeClass().addClass('fw fw-success icon-success'); - } - $("#statusIcon").show(); - - }, 1500); - } else { - console.log(resp.status); - } - }; - - invokerUtil.put(serviceUrl, payload, - successCallback, function (message) { - console.log(message); - }); - } - - }); - - $("#status").click(function () { - $("#statusIcon").hide(); - }); - - $.fn.editable.defaults.mode = 'inline'; - - $('#status').editable({ - value: $('#status').attr("selectedValue"), - source: [ - {value: 'Active', text: 'Active'}, - {value: "Inactive", text: 'Inactive'}, - {value: "Removed", text: 'Removed'} - ], - success: this.update_elements - }); - - $.fn.editableform.buttons = - '' + - ''; - - function positionArrow(selectedTab) { - var selectedTabHeight = $(selectedTab).innerHeight(); - var arrowPosition = 0; - var totalHeight = 0; - var arrow = $(".media .panel-group.tab-content .arrow-left"); - var parentHeight = $(arrow).parent().innerHeight(); - - - if($(selectedTab).prev().length){ - $(selectedTab).prevAll().each(function() { - totalHeight += $(this).innerHeight(); - }); - arrowPosition = totalHeight + (selectedTabHeight / 2); - }else{ - arrowPosition = selectedTabHeight / 2; - } - - if(arrowPosition >= parentHeight){ - parentHeight = arrowPosition + 50; - $(arrow).siblings(".panel.active").height(parentHeight); - }else{ - $(arrow).parent().removeAttr("style"); - } - - $(arrow).css("top", arrowPosition - 10); - } - - $(document).ready(function() { - $(".device-detail-body").removeClass("hidden"); - $("#loading-content").remove(); - loadApplicationsList(); - loadPolicyCompliance(); - - $("#refresh-policy").click(function () { - $("#policy-spinner").removeClass("hidden"); - loadPolicyCompliance(); - }); - - $("#refresh-apps").click(function () { - $("#apps-spinner").removeClass("hidden"); - loadApplicationsList(); - }); - }); - - function loadOperationsLog(update) { - var owner = $("#device-owner").data("owner"); - var operationsLogTable = "#operations-log-table"; - if (update) { - operationTable = $(operationsLogTable).DataTable(); - operationTable.ajax.reload(false); - return; - } - operationTable = $(operationsLogTable).datatables_extended({ - serverSide: true, - processing: false, - searching: false, - ordering: false, - pageLength : 10, - order: [], - ajax: { - url: "/devicemgt/api/operation/paginate", - data: {deviceId : deviceIdentifier, deviceType: deviceType, owner:owner}, - dataSrc: function (json) { - $("#operations-spinner").addClass("hidden"); - $("#operations-log-container").empty(); - return json.data; - } - }, - columnDefs: [ - {targets: 0, data: "code" }, - {targets: 1, data: "status", render: - function (status) { - var html; - switch (status) { - case "COMPLETED" : - html = " Completed"; - break; - case "PENDING" : - html = " Pending"; - break; - case "ERROR" : - html = " Error"; - break; - case "IN_PROGRESS" : - html = " In Progress"; - break; - case "REPEATED" : - html = " Repeated"; - break; - } - return html; - } - }, - {targets: 2, data: "createdTimeStamp", render: - function (date) { - var value = String(date); - return value.slice(0, 16); - } - } - ], - "createdRow": function(row, data) { - $(row).attr("data-type", "selectable"); - $(row).attr("data-id", data["id"]); - $.each($("td", row), - function(colIndex) { - switch(colIndex) { - case 1: - $(this).attr("data-grid-label", "Code"); - $(this).attr("data-display", data["code"]); - break; - case 2: - $(this).attr("data-grid-label", "Status"); - $(this).attr("data-display", data["status"]); - break; - case 3: - $(this).attr("data-grid-label", "Created Timestamp"); - $(this).attr("data-display", data["createdTimeStamp"]); - break; - } - } - ); - } - }); - } - - function loadApplicationsList() { - var applicationsList = $("#applications-list"); - var applicationListingTemplate = applicationsList.attr("src"); - var deviceId = applicationsList.data("device-id"); - var deviceType = applicationsList.data("device-type"); - - $.template("application-list", applicationListingTemplate, function (template) { - var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/applications"; - invokerUtil.get( - serviceURL, - // success-callback - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - data = JSON.parse(data); - $("#apps-spinner").addClass("hidden"); - if (data.length > 0) { - for (var i = 0; i < data.length; i++) { - data[i]["name"] = decodeURIComponent(data[i]["name"]); - data[i]["platform"] = deviceType; - } - - var viewModel = {}; - viewModel["applications"] = data; - viewModel["deviceType"] = deviceType; - viewModel["deviceId"] = deviceId; - viewModel["appContext"] = context; - var content = template(viewModel); - $("#applications-list-container").html(content); - var iconSource = $("#applications-list-container").data("public-uri") + "/img/device_icons/windows_app_icon.png"; - $("#applications-list-container img").attr("src",iconSource); - } else { - $("#applications-list-container"). - html("

    No applications found.

    " + - "

    Please try refreshing the list in a while.

    "); - } - } - }, - // error-callback - function () { - $("#applications-list-container"). - html("

     Loading application list " + - "was not successful. please try refreshing the list in a while.

    "); - }); - }); - } - - function loadPolicyCompliance() { - var policyCompliance = $("#policy-view"); - var policyComplianceTemplate = policyCompliance.attr("src"); - var deviceId = policyCompliance.data("device-id"); - var deviceType = policyCompliance.data("device-type"); - var activePolicy = null; - - $.template( - "policy-view", - policyComplianceTemplate, - function (template) { - var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy"; - var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data"; - - invokerUtil.get( - getEffectivePolicyURL, - // success-callback - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - data = JSON.parse(data); - $("#policy-spinner").addClass("hidden"); - if (data["active"] == true) { - activePolicy = data; - invokerUtil.get( - getDeviceComplianceURL, - // success-callback - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - var viewModel = {}; - viewModel["policy"] = activePolicy; - viewModel["deviceType"] = deviceType; - data = JSON.parse(data); - var content; - if (data["complianceData"]) { - if (data["complianceData"]["complianceFeatures"] && - data["complianceData"]["complianceFeatures"].length > 0) { - viewModel["compliance"] = "NON-COMPLIANT"; - viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"]; - content = template(viewModel); - $("#policy-list-container").html(content); - } else { - viewModel["compliance"] = "COMPLIANT"; - content = template(viewModel); - $("#policy-list-container").html(content); - $("#policy-compliance-table").addClass("hidden"); - } - } else { - $("#policy-list-container"). - html("

    This device " + - "has no policy applied.

    "); - } - } - }, - // error-callback - function () { - $("#policy-list-container"). - html("

    Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

    "); - } - ); - } - } - }, - // error-callback - function () { - $("#policy-list-container"). - html("

    Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

    "); - } - ); - } - ); - } - -}()); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/applications-list.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/applications-list.hbs deleted file mode 100644 index 984df89cf..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/applications-list.hbs +++ /dev/null @@ -1,9 +0,0 @@ -{{#each applications}} -
    - -
    -

    {{name}}

    -

    v{{version}}

    -
    -
    -{{/each}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/policy-compliance.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/policy-compliance.hbs deleted file mode 100644 index d87b813f1..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.device-view/public/templates/policy-compliance.hbs +++ /dev/null @@ -1,45 +0,0 @@ -
    - {{#equal compliance "COMPLIANT"}} - - {{/equal}} - {{#equal compliance "NON-COMPLIANT"}} - - {{/equal}} -

    - {{policy.policyName}} - {{deviceType}} -

    -

    - Compliance Type : {{policy.compliance}} - Ownership type : {{policy.ownershipType}} -

    -
    - -
    -

    Revoke Policy

    -
    -
    -
    - - - - - - - - - {{#each complianceFeatures}} - - - - - {{/each}} -
    - -
    FeatureCompliance
    {{featureCode}} - {{#equal compliance true}} Compliant{{/equal}} - {{#equal compliance false}} Not Compliant{{/equal}} -
    diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.hbs deleted file mode 100644 index 9385d60d5..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.hbs +++ /dev/null @@ -1,6 +0,0 @@ -{{#zone "topLibCss"}} - -{{/zone}} -{{#zone "bottomJs"}} - -{{/zone}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/leaflet.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/css/leaflet.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/css/leaflet.css deleted file mode 100644 index c161c3134..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/css/leaflet.css +++ /dev/null @@ -1,479 +0,0 @@ -/* required styles */ - -.leaflet-map-pane, -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow, -.leaflet-tile-pane, -.leaflet-tile-container, -.leaflet-overlay-pane, -.leaflet-shadow-pane, -.leaflet-marker-pane, -.leaflet-popup-pane, -.leaflet-overlay-pane svg, -.leaflet-zoom-box, -.leaflet-image-layer, -.leaflet-layer { - position: absolute; - left: 0; - top: 0; - } -.leaflet-container { - overflow: hidden; - -ms-touch-action: none; - touch-action: none; - } -.leaflet-tile, -.leaflet-marker-icon, -.leaflet-marker-shadow { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; - -webkit-user-drag: none; - } -.leaflet-marker-icon, -.leaflet-marker-shadow { - display: block; - } -/* map is broken in FF if you have max-width: 100% on tiles */ -.leaflet-container img { - max-width: none !important; - } -/* stupid Android 2 doesn't understand "max-width: none" properly */ -.leaflet-container img.leaflet-image-layer { - max-width: 15000px !important; - } -.leaflet-tile { - filter: inherit; - visibility: hidden; - } -.leaflet-tile-loaded { - visibility: inherit; - } -.leaflet-zoom-box { - width: 0; - height: 0; - } -/* workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=888319 */ -.leaflet-overlay-pane svg { - -moz-user-select: none; - } - -.leaflet-tile-pane { z-index: 2; } -.leaflet-objects-pane { z-index: 3; } -.leaflet-overlay-pane { z-index: 4; } -.leaflet-shadow-pane { z-index: 5; } -.leaflet-marker-pane { z-index: 6; } -.leaflet-popup-pane { z-index: 7; } - -.leaflet-vml-shape { - width: 1px; - height: 1px; - } -.lvml { - behavior: url(#default#VML); - display: inline-block; - position: absolute; - } - - -/* control positioning */ - -.leaflet-control { - position: relative; - z-index: 7; - pointer-events: auto; - } -.leaflet-top, -.leaflet-bottom { - position: absolute; - z-index: 1000; - pointer-events: none; - } -.leaflet-top { - top: 0; - } -.leaflet-right { - right: 0; - } -.leaflet-bottom { - bottom: 0; - } -.leaflet-left { - left: 0; - } -.leaflet-control { - float: left; - clear: both; - } -.leaflet-right .leaflet-control { - float: right; - } -.leaflet-top .leaflet-control { - margin-top: 10px; - } -.leaflet-bottom .leaflet-control { - margin-bottom: 10px; - } -.leaflet-left .leaflet-control { - margin-left: 10px; - } -.leaflet-right .leaflet-control { - margin-right: 10px; - } - - -/* zoom and fade animations */ - -.leaflet-fade-anim .leaflet-tile, -.leaflet-fade-anim .leaflet-popup { - opacity: 0; - -webkit-transition: opacity 0.2s linear; - -moz-transition: opacity 0.2s linear; - -o-transition: opacity 0.2s linear; - transition: opacity 0.2s linear; - } -.leaflet-fade-anim .leaflet-tile-loaded, -.leaflet-fade-anim .leaflet-map-pane .leaflet-popup { - opacity: 1; - } - -.leaflet-zoom-anim .leaflet-zoom-animated { - -webkit-transition: -webkit-transform 0.25s cubic-bezier(0,0,0.25,1); - -moz-transition: -moz-transform 0.25s cubic-bezier(0,0,0.25,1); - -o-transition: -o-transform 0.25s cubic-bezier(0,0,0.25,1); - transition: transform 0.25s cubic-bezier(0,0,0.25,1); - } -.leaflet-zoom-anim .leaflet-tile, -.leaflet-pan-anim .leaflet-tile, -.leaflet-touching .leaflet-zoom-animated { - -webkit-transition: none; - -moz-transition: none; - -o-transition: none; - transition: none; - } - -.leaflet-zoom-anim .leaflet-zoom-hide { - visibility: hidden; - } - - -/* cursors */ - -.leaflet-clickable { - cursor: pointer; - } -.leaflet-container { - cursor: -webkit-grab; - cursor: -moz-grab; - } -.leaflet-popup-pane, -.leaflet-control { - cursor: auto; - } -.leaflet-dragging .leaflet-container, -.leaflet-dragging .leaflet-clickable { - cursor: move; - cursor: -webkit-grabbing; - cursor: -moz-grabbing; - } - - -/* visual tweaks */ - -.leaflet-container { - background: #ddd; - outline: 0; - } -.leaflet-container a { - color: #0078A8; - } -.leaflet-container a.leaflet-active { - outline: 2px solid orange; - } -.leaflet-zoom-box { - border: 2px dotted #38f; - background: rgba(255,255,255,0.5); - } - - -/* general typography */ -.leaflet-container { - font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif; - } - - -/* general toolbar styles */ - -.leaflet-bar { - box-shadow: 0 1px 5px rgba(0,0,0,0.65); - border-radius: 4px; - } -.leaflet-bar a, -.leaflet-bar a:hover { - background-color: #fff; - border-bottom: 1px solid #ccc; - width: 26px; - height: 26px; - line-height: 26px; - display: block; - text-align: center; - text-decoration: none; - color: black; - } -.leaflet-bar a, -.leaflet-control-layers-toggle { - background-position: 50% 50%; - background-repeat: no-repeat; - display: block; - } -.leaflet-bar a:hover { - background-color: #f4f4f4; - } -.leaflet-bar a:first-child { - border-top-left-radius: 4px; - border-top-right-radius: 4px; - } -.leaflet-bar a:last-child { - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom: none; - } -.leaflet-bar a.leaflet-disabled { - cursor: default; - background-color: #f4f4f4; - color: #bbb; - } - -.leaflet-touch .leaflet-bar a { - width: 30px; - height: 30px; - line-height: 30px; - } - - -/* zoom control */ - -.leaflet-control-zoom-in, -.leaflet-control-zoom-out { - font: bold 18px 'Lucida Console', Monaco, monospace; - text-indent: 1px; - } -.leaflet-control-zoom-out { - font-size: 20px; - } - -.leaflet-touch .leaflet-control-zoom-in { - font-size: 22px; - } -.leaflet-touch .leaflet-control-zoom-out { - font-size: 24px; - } - - -/* layers control */ - -.leaflet-control-layers { - box-shadow: 0 1px 5px rgba(0,0,0,0.4); - background: #fff; - border-radius: 5px; - } -.leaflet-control-layers-toggle { - background-image: url(images/layers.png); - width: 36px; - height: 36px; - } -.leaflet-retina .leaflet-control-layers-toggle { - background-image: url(images/layers-2x.png); - background-size: 26px 26px; - } -.leaflet-touch .leaflet-control-layers-toggle { - width: 44px; - height: 44px; - } -.leaflet-control-layers .leaflet-control-layers-list, -.leaflet-control-layers-expanded .leaflet-control-layers-toggle { - display: none; - } -.leaflet-control-layers-expanded .leaflet-control-layers-list { - display: block; - position: relative; - } -.leaflet-control-layers-expanded { - padding: 6px 10px 6px 6px; - color: #333; - background: #fff; - } -.leaflet-control-layers-selector { - margin-top: 2px; - position: relative; - top: 1px; - } -.leaflet-control-layers label { - display: block; - } -.leaflet-control-layers-separator { - height: 0; - border-top: 1px solid #ddd; - margin: 5px -10px 5px -6px; - } - - -/* attribution and scale controls */ - -.leaflet-container .leaflet-control-attribution { - background: #fff; - background: rgba(255, 255, 255, 0.7); - margin: 0; - } -.leaflet-control-attribution, -.leaflet-control-scale-line { - padding: 0 5px; - color: #333; - } -.leaflet-control-attribution a { - text-decoration: none; - } -.leaflet-control-attribution a:hover { - text-decoration: underline; - } -.leaflet-container .leaflet-control-attribution, -.leaflet-container .leaflet-control-scale { - font-size: 11px; - } -.leaflet-left .leaflet-control-scale { - margin-left: 5px; - } -.leaflet-bottom .leaflet-control-scale { - margin-bottom: 5px; - } -.leaflet-control-scale-line { - border: 2px solid #777; - border-top: none; - line-height: 1.1; - padding: 2px 5px 1px; - font-size: 11px; - white-space: nowrap; - overflow: hidden; - -moz-box-sizing: content-box; - box-sizing: content-box; - - background: #fff; - background: rgba(255, 255, 255, 0.5); - } -.leaflet-control-scale-line:not(:first-child) { - border-top: 2px solid #777; - border-bottom: none; - margin-top: -2px; - } -.leaflet-control-scale-line:not(:first-child):not(:last-child) { - border-bottom: 2px solid #777; - } - -.leaflet-touch .leaflet-control-attribution, -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - box-shadow: none; - } -.leaflet-touch .leaflet-control-layers, -.leaflet-touch .leaflet-bar { - border: 2px solid rgba(0,0,0,0.2); - background-clip: padding-box; - } - - -/* popup */ - -.leaflet-popup { - position: absolute; - text-align: center; - } -.leaflet-popup-content-wrapper { - padding: 1px; - text-align: left; - border-radius: 12px; - } -.leaflet-popup-content { - margin: 13px 19px; - line-height: 1.4; - } -.leaflet-popup-content p { - margin: 18px 0; - } -.leaflet-popup-tip-container { - margin: 0 auto; - width: 40px; - height: 20px; - position: relative; - overflow: hidden; - } -.leaflet-popup-tip { - width: 17px; - height: 17px; - padding: 1px; - - margin: -10px auto 0; - - -webkit-transform: rotate(45deg); - -moz-transform: rotate(45deg); - -ms-transform: rotate(45deg); - -o-transform: rotate(45deg); - transform: rotate(45deg); - } -.leaflet-popup-content-wrapper, -.leaflet-popup-tip { - background: white; - - box-shadow: 0 3px 14px rgba(0,0,0,0.4); - } -.leaflet-container a.leaflet-popup-close-button { - position: absolute; - top: 0; - right: 0; - padding: 4px 4px 0 0; - text-align: center; - width: 18px; - height: 14px; - font: 16px/14px Tahoma, Verdana, sans-serif; - color: #c3c3c3; - text-decoration: none; - font-weight: bold; - background: transparent; - } -.leaflet-container a.leaflet-popup-close-button:hover { - color: #999; - } -.leaflet-popup-scrolled { - overflow: auto; - border-bottom: 1px solid #ddd; - border-top: 1px solid #ddd; - } - -.leaflet-oldie .leaflet-popup-content-wrapper { - zoom: 1; - } -.leaflet-oldie .leaflet-popup-tip { - width: 24px; - margin: 0 auto; - - -ms-filter: "progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678)"; - filter: progid:DXImageTransform.Microsoft.Matrix(M11=0.70710678, M12=0.70710678, M21=-0.70710678, M22=0.70710678); - } -.leaflet-oldie .leaflet-popup-tip-container { - margin-top: -1px; - } - -.leaflet-oldie .leaflet-control-zoom, -.leaflet-oldie .leaflet-control-layers, -.leaflet-oldie .leaflet-popup-content-wrapper, -.leaflet-oldie .leaflet-popup-tip { - border: 1px solid #999; - } - - -/* div icon */ - -.leaflet-div-icon { - background: #fff; - border: 1px solid #666; - } diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers-2x.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers-2x.png deleted file mode 100644 index a2cf7f9ef..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers-2x.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers.png deleted file mode 100644 index bca0a0e42..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/layers.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon-2x.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon-2x.png deleted file mode 100644 index 0015b6495..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon-2x.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon.png deleted file mode 100644 index e2e9f757f..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-icon.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-shadow.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-shadow.png deleted file mode 100644 index d1e773c71..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/images/marker-shadow.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/leaflet.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/leaflet.js deleted file mode 100644 index ee5ff5a1d..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.leaflet/public/js/leaflet.js +++ /dev/null @@ -1,9 +0,0 @@ -/* - Leaflet, a JavaScript library for mobile-friendly interactive maps. http://leafletjs.com - (c) 2010-2013, Vladimir Agafonkin - (c) 2010-2011, CloudMade -*/ -!function(t,e,i){var n=t.L,o={};o.version="0.7.7","object"==typeof module&&"object"==typeof module.exports?module.exports=o:"function"==typeof define&&define.amd&&define(o),o.noConflict=function(){return t.L=n,this},t.L=o,o.Util={extend:function(t){var e,i,n,o,s=Array.prototype.slice.call(arguments,1);for(i=0,n=s.length;n>i;i++){o=s[i]||{};for(e in o)o.hasOwnProperty(e)&&(t[e]=o[e])}return t},bind:function(t,e){var i=arguments.length>2?Array.prototype.slice.call(arguments,2):null;return function(){return t.apply(e,i||arguments)}},stamp:function(){var t=0,e="_leaflet_id";return function(i){return i[e]=i[e]||++t,i[e]}}(),invokeEach:function(t,e,i){var n,o;if("object"==typeof t){o=Array.prototype.slice.call(arguments,3);for(n in t)e.apply(i,[n,t[n]].concat(o));return!0}return!1},limitExecByInterval:function(t,e,i){var n,o;return function s(){var a=arguments;return n?void(o=!0):(n=!0,setTimeout(function(){n=!1,o&&(s.apply(i,a),o=!1)},e),void t.apply(i,a))}},falseFn:function(){return!1},formatNum:function(t,e){var i=Math.pow(10,e||5);return Math.round(t*i)/i},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},splitWords:function(t){return o.Util.trim(t).split(/\s+/)},setOptions:function(t,e){return t.options=o.extend({},t.options,e),t.options},getParamString:function(t,e,i){var n=[];for(var o in t)n.push(encodeURIComponent(i?o.toUpperCase():o)+"="+encodeURIComponent(t[o]));return(e&&-1!==e.indexOf("?")?"&":"?")+n.join("&")},template:function(t,e){return t.replace(/\{ *([\w_]+) *\}/g,function(t,n){var o=e[n];if(o===i)throw new Error("No value provided for variable "+t);return"function"==typeof o&&(o=o(e)),o})},isArray:Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},emptyImageUrl:"data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs="},function(){function e(e){var i,n,o=["webkit","moz","o","ms"];for(i=0;it;t++)n._initHooks[t].call(this)}},e},o.Class.include=function(t){o.extend(this.prototype,t)},o.Class.mergeOptions=function(t){o.extend(this.prototype.options,t)},o.Class.addInitHook=function(t){var e=Array.prototype.slice.call(arguments,1),i="function"==typeof t?t:function(){this[t].apply(this,e)};this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(i)};var s="_leaflet_events";o.Mixin={},o.Mixin.Events={addEventListener:function(t,e,i){if(o.Util.invokeEach(t,this.addEventListener,this,e,i))return this;var n,a,r,h,l,u,c,d=this[s]=this[s]||{},p=i&&i!==this&&o.stamp(i);for(t=o.Util.splitWords(t),n=0,a=t.length;a>n;n++)r={action:e,context:i||this},h=t[n],p?(l=h+"_idx",u=l+"_len",c=d[l]=d[l]||{},c[p]||(c[p]=[],d[u]=(d[u]||0)+1),c[p].push(r)):(d[h]=d[h]||[],d[h].push(r));return this},hasEventListeners:function(t){var e=this[s];return!!e&&(t in e&&e[t].length>0||t+"_idx"in e&&e[t+"_idx_len"]>0)},removeEventListener:function(t,e,i){if(!this[s])return this;if(!t)return this.clearAllEventListeners();if(o.Util.invokeEach(t,this.removeEventListener,this,e,i))return this;var n,a,r,h,l,u,c,d,p,_=this[s],m=i&&i!==this&&o.stamp(i);for(t=o.Util.splitWords(t),n=0,a=t.length;a>n;n++)if(r=t[n],u=r+"_idx",c=u+"_len",d=_[u],e){if(h=m&&d?d[m]:_[r]){for(l=h.length-1;l>=0;l--)h[l].action!==e||i&&h[l].context!==i||(p=h.splice(l,1),p[0].action=o.Util.falseFn);i&&d&&0===h.length&&(delete d[m],_[c]--)}}else delete _[r],delete _[u],delete _[c];return this},clearAllEventListeners:function(){return delete this[s],this},fireEvent:function(t,e){if(!this.hasEventListeners(t))return this;var i,n,a,r,h,l=o.Util.extend({},e,{type:t,target:this}),u=this[s];if(u[t])for(i=u[t].slice(),n=0,a=i.length;a>n;n++)i[n].action.call(i[n].context,l);r=u[t+"_idx"];for(h in r)if(i=r[h].slice())for(n=0,a=i.length;a>n;n++)i[n].action.call(i[n].context,l);return this},addOneTimeEventListener:function(t,e,i){if(o.Util.invokeEach(t,this.addOneTimeEventListener,this,e,i))return this;var n=o.bind(function(){this.removeEventListener(t,e,i).removeEventListener(t,n,i)},this);return this.addEventListener(t,e,i).addEventListener(t,n,i)}},o.Mixin.Events.on=o.Mixin.Events.addEventListener,o.Mixin.Events.off=o.Mixin.Events.removeEventListener,o.Mixin.Events.once=o.Mixin.Events.addOneTimeEventListener,o.Mixin.Events.fire=o.Mixin.Events.fireEvent,function(){var n="ActiveXObject"in t,s=n&&!e.addEventListener,a=navigator.userAgent.toLowerCase(),r=-1!==a.indexOf("webkit"),h=-1!==a.indexOf("chrome"),l=-1!==a.indexOf("phantom"),u=-1!==a.indexOf("android"),c=-1!==a.search("android [23]"),d=-1!==a.indexOf("gecko"),p=typeof orientation!=i+"",_=!t.PointerEvent&&t.MSPointerEvent,m=t.PointerEvent&&t.navigator.pointerEnabled||_,f="devicePixelRatio"in t&&t.devicePixelRatio>1||"matchMedia"in t&&t.matchMedia("(min-resolution:144dpi)")&&t.matchMedia("(min-resolution:144dpi)").matches,g=e.documentElement,v=n&&"transition"in g.style,y="WebKitCSSMatrix"in t&&"m11"in new t.WebKitCSSMatrix&&!c,P="MozPerspective"in g.style,L="OTransition"in g.style,x=!t.L_DISABLE_3D&&(v||y||P||L)&&!l,w=!t.L_NO_TOUCH&&!l&&(m||"ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch);o.Browser={ie:n,ielt9:s,webkit:r,gecko:d&&!r&&!t.opera&&!n,android:u,android23:c,chrome:h,ie3d:v,webkit3d:y,gecko3d:P,opera3d:L,any3d:x,mobile:p,mobileWebkit:p&&r,mobileWebkit3d:p&&y,mobileOpera:p&&t.opera,touch:w,msPointer:_,pointer:m,retina:f}}(),o.Point=function(t,e,i){this.x=i?Math.round(t):t,this.y=i?Math.round(e):e},o.Point.prototype={clone:function(){return new o.Point(this.x,this.y)},add:function(t){return this.clone()._add(o.point(t))},_add:function(t){return this.x+=t.x,this.y+=t.y,this},subtract:function(t){return this.clone()._subtract(o.point(t))},_subtract:function(t){return this.x-=t.x,this.y-=t.y,this},divideBy:function(t){return this.clone()._divideBy(t)},_divideBy:function(t){return this.x/=t,this.y/=t,this},multiplyBy:function(t){return this.clone()._multiplyBy(t)},_multiplyBy:function(t){return this.x*=t,this.y*=t,this},round:function(){return this.clone()._round()},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},floor:function(){return this.clone()._floor()},_floor:function(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this},distanceTo:function(t){t=o.point(t);var e=t.x-this.x,i=t.y-this.y;return Math.sqrt(e*e+i*i)},equals:function(t){return t=o.point(t),t.x===this.x&&t.y===this.y},contains:function(t){return t=o.point(t),Math.abs(t.x)<=Math.abs(this.x)&&Math.abs(t.y)<=Math.abs(this.y)},toString:function(){return"Point("+o.Util.formatNum(this.x)+", "+o.Util.formatNum(this.y)+")"}},o.point=function(t,e,n){return t instanceof o.Point?t:o.Util.isArray(t)?new o.Point(t[0],t[1]):t===i||null===t?t:new o.Point(t,e,n)},o.Bounds=function(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;o>n;n++)this.extend(i[n])},o.Bounds.prototype={extend:function(t){return t=o.point(t),this.min||this.max?(this.min.x=Math.min(t.x,this.min.x),this.max.x=Math.max(t.x,this.max.x),this.min.y=Math.min(t.y,this.min.y),this.max.y=Math.max(t.y,this.max.y)):(this.min=t.clone(),this.max=t.clone()),this},getCenter:function(t){return new o.Point((this.min.x+this.max.x)/2,(this.min.y+this.max.y)/2,t)},getBottomLeft:function(){return new o.Point(this.min.x,this.max.y)},getTopRight:function(){return new o.Point(this.max.x,this.min.y)},getSize:function(){return this.max.subtract(this.min)},contains:function(t){var e,i;return t="number"==typeof t[0]||t instanceof o.Point?o.point(t):o.bounds(t),t instanceof o.Bounds?(e=t.min,i=t.max):e=i=t,e.x>=this.min.x&&i.x<=this.max.x&&e.y>=this.min.y&&i.y<=this.max.y},intersects:function(t){t=o.bounds(t);var e=this.min,i=this.max,n=t.min,s=t.max,a=s.x>=e.x&&n.x<=i.x,r=s.y>=e.y&&n.y<=i.y;return a&&r},isValid:function(){return!(!this.min||!this.max)}},o.bounds=function(t,e){return!t||t instanceof o.Bounds?t:new o.Bounds(t,e)},o.Transformation=function(t,e,i,n){this._a=t,this._b=e,this._c=i,this._d=n},o.Transformation.prototype={transform:function(t,e){return this._transform(t.clone(),e)},_transform:function(t,e){return e=e||1,t.x=e*(this._a*t.x+this._b),t.y=e*(this._c*t.y+this._d),t},untransform:function(t,e){return e=e||1,new o.Point((t.x/e-this._b)/this._a,(t.y/e-this._d)/this._c)}},o.DomUtil={get:function(t){return"string"==typeof t?e.getElementById(t):t},getStyle:function(t,i){var n=t.style[i];if(!n&&t.currentStyle&&(n=t.currentStyle[i]),(!n||"auto"===n)&&e.defaultView){var o=e.defaultView.getComputedStyle(t,null);n=o?o[i]:null}return"auto"===n?null:n},getViewportOffset:function(t){var i,n=0,s=0,a=t,r=e.body,h=e.documentElement;do{if(n+=a.offsetTop||0,s+=a.offsetLeft||0,n+=parseInt(o.DomUtil.getStyle(a,"borderTopWidth"),10)||0,s+=parseInt(o.DomUtil.getStyle(a,"borderLeftWidth"),10)||0,i=o.DomUtil.getStyle(a,"position"),a.offsetParent===r&&"absolute"===i)break;if("fixed"===i){n+=r.scrollTop||h.scrollTop||0,s+=r.scrollLeft||h.scrollLeft||0;break}if("relative"===i&&!a.offsetLeft){var l=o.DomUtil.getStyle(a,"width"),u=o.DomUtil.getStyle(a,"max-width"),c=a.getBoundingClientRect();("none"!==l||"none"!==u)&&(s+=c.left+a.clientLeft),n+=c.top+(r.scrollTop||h.scrollTop||0);break}a=a.offsetParent}while(a);a=t;do{if(a===r)break;n-=a.scrollTop||0,s-=a.scrollLeft||0,a=a.parentNode}while(a);return new o.Point(s,n)},documentIsLtr:function(){return o.DomUtil._docIsLtrCached||(o.DomUtil._docIsLtrCached=!0,o.DomUtil._docIsLtr="ltr"===o.DomUtil.getStyle(e.body,"direction")),o.DomUtil._docIsLtr},create:function(t,i,n){var o=e.createElement(t);return o.className=i,n&&n.appendChild(o),o},hasClass:function(t,e){if(t.classList!==i)return t.classList.contains(e);var n=o.DomUtil._getClass(t);return n.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(n)},addClass:function(t,e){if(t.classList!==i)for(var n=o.Util.splitWords(e),s=0,a=n.length;a>s;s++)t.classList.add(n[s]);else if(!o.DomUtil.hasClass(t,e)){var r=o.DomUtil._getClass(t);o.DomUtil._setClass(t,(r?r+" ":"")+e)}},removeClass:function(t,e){t.classList!==i?t.classList.remove(e):o.DomUtil._setClass(t,o.Util.trim((" "+o.DomUtil._getClass(t)+" ").replace(" "+e+" "," ")))},_setClass:function(t,e){t.className.baseVal===i?t.className=e:t.className.baseVal=e},_getClass:function(t){return t.className.baseVal===i?t.className:t.className.baseVal},setOpacity:function(t,e){if("opacity"in t.style)t.style.opacity=e;else if("filter"in t.style){var i=!1,n="DXImageTransform.Microsoft.Alpha";try{i=t.filters.item(n)}catch(o){if(1===e)return}e=Math.round(100*e),i?(i.Enabled=100!==e,i.Opacity=e):t.style.filter+=" progid:"+n+"(opacity="+e+")"}},testProp:function(t){for(var i=e.documentElement.style,n=0;ni||i===e?e:t),new o.LatLng(this.lat,i)}},o.latLng=function(t,e){return t instanceof o.LatLng?t:o.Util.isArray(t)?"number"==typeof t[0]||"string"==typeof t[0]?new o.LatLng(t[0],t[1],t[2]):null:t===i||null===t?t:"object"==typeof t&&"lat"in t?new o.LatLng(t.lat,"lng"in t?t.lng:t.lon):e===i?null:new o.LatLng(t,e)},o.LatLngBounds=function(t,e){if(t)for(var i=e?[t,e]:t,n=0,o=i.length;o>n;n++)this.extend(i[n])},o.LatLngBounds.prototype={extend:function(t){if(!t)return this;var e=o.latLng(t);return t=null!==e?e:o.latLngBounds(t),t instanceof o.LatLng?this._southWest||this._northEast?(this._southWest.lat=Math.min(t.lat,this._southWest.lat),this._southWest.lng=Math.min(t.lng,this._southWest.lng),this._northEast.lat=Math.max(t.lat,this._northEast.lat),this._northEast.lng=Math.max(t.lng,this._northEast.lng)):(this._southWest=new o.LatLng(t.lat,t.lng),this._northEast=new o.LatLng(t.lat,t.lng)):t instanceof o.LatLngBounds&&(this.extend(t._southWest),this.extend(t._northEast)),this},pad:function(t){var e=this._southWest,i=this._northEast,n=Math.abs(e.lat-i.lat)*t,s=Math.abs(e.lng-i.lng)*t;return new o.LatLngBounds(new o.LatLng(e.lat-n,e.lng-s),new o.LatLng(i.lat+n,i.lng+s))},getCenter:function(){return new o.LatLng((this._southWest.lat+this._northEast.lat)/2,(this._southWest.lng+this._northEast.lng)/2)},getSouthWest:function(){return this._southWest},getNorthEast:function(){return this._northEast},getNorthWest:function(){return new o.LatLng(this.getNorth(),this.getWest())},getSouthEast:function(){return new o.LatLng(this.getSouth(),this.getEast())},getWest:function(){return this._southWest.lng},getSouth:function(){return this._southWest.lat},getEast:function(){return this._northEast.lng},getNorth:function(){return this._northEast.lat},contains:function(t){t="number"==typeof t[0]||t instanceof o.LatLng?o.latLng(t):o.latLngBounds(t);var e,i,n=this._southWest,s=this._northEast;return t instanceof o.LatLngBounds?(e=t.getSouthWest(),i=t.getNorthEast()):e=i=t,e.lat>=n.lat&&i.lat<=s.lat&&e.lng>=n.lng&&i.lng<=s.lng},intersects:function(t){t=o.latLngBounds(t);var e=this._southWest,i=this._northEast,n=t.getSouthWest(),s=t.getNorthEast(),a=s.lat>=e.lat&&n.lat<=i.lat,r=s.lng>=e.lng&&n.lng<=i.lng;return a&&r},toBBoxString:function(){return[this.getWest(),this.getSouth(),this.getEast(),this.getNorth()].join(",")},equals:function(t){return t?(t=o.latLngBounds(t),this._southWest.equals(t.getSouthWest())&&this._northEast.equals(t.getNorthEast())):!1},isValid:function(){return!(!this._southWest||!this._northEast)}},o.latLngBounds=function(t,e){return!t||t instanceof o.LatLngBounds?t:new o.LatLngBounds(t,e)},o.Projection={},o.Projection.SphericalMercator={MAX_LATITUDE:85.0511287798,project:function(t){var e=o.LatLng.DEG_TO_RAD,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),s=t.lng*e,a=n*e;return a=Math.log(Math.tan(Math.PI/4+a/2)),new o.Point(s,a)},unproject:function(t){var e=o.LatLng.RAD_TO_DEG,i=t.x*e,n=(2*Math.atan(Math.exp(t.y))-Math.PI/2)*e;return new o.LatLng(n,i)}},o.Projection.LonLat={project:function(t){return new o.Point(t.lng,t.lat)},unproject:function(t){return new o.LatLng(t.y,t.x)}},o.CRS={latLngToPoint:function(t,e){var i=this.projection.project(t),n=this.scale(e);return this.transformation._transform(i,n)},pointToLatLng:function(t,e){var i=this.scale(e),n=this.transformation.untransform(t,i);return this.projection.unproject(n)},project:function(t){return this.projection.project(t)},scale:function(t){return 256*Math.pow(2,t)},getSize:function(t){var e=this.scale(t);return o.point(e,e)}},o.CRS.Simple=o.extend({},o.CRS,{projection:o.Projection.LonLat,transformation:new o.Transformation(1,0,-1,0),scale:function(t){return Math.pow(2,t)}}),o.CRS.EPSG3857=o.extend({},o.CRS,{code:"EPSG:3857",projection:o.Projection.SphericalMercator,transformation:new o.Transformation(.5/Math.PI,.5,-.5/Math.PI,.5),project:function(t){var e=this.projection.project(t),i=6378137;return e.multiplyBy(i)}}),o.CRS.EPSG900913=o.extend({},o.CRS.EPSG3857,{code:"EPSG:900913"}),o.CRS.EPSG4326=o.extend({},o.CRS,{code:"EPSG:4326",projection:o.Projection.LonLat,transformation:new o.Transformation(1/360,.5,-1/360,.5)}),o.Map=o.Class.extend({includes:o.Mixin.Events,options:{crs:o.CRS.EPSG3857,fadeAnimation:o.DomUtil.TRANSITION&&!o.Browser.android23,trackResize:!0,markerZoomAnimation:o.DomUtil.TRANSITION&&o.Browser.any3d},initialize:function(t,e){e=o.setOptions(this,e),this._initContainer(t),this._initLayout(),this._onResize=o.bind(this._onResize,this),this._initEvents(),e.maxBounds&&this.setMaxBounds(e.maxBounds),e.center&&e.zoom!==i&&this.setView(o.latLng(e.center),e.zoom,{reset:!0}),this._handlers=[],this._layers={},this._zoomBoundLayers={},this._tileLayersNum=0,this.callInitHooks(),this._addLayers(e.layers)},setView:function(t,e){return e=e===i?this.getZoom():e,this._resetView(o.latLng(t),this._limitZoom(e)),this},setZoom:function(t,e){return this._loaded?this.setView(this.getCenter(),t,{zoom:e}):(this._zoom=this._limitZoom(t),this)},zoomIn:function(t,e){return this.setZoom(this._zoom+(t||1),e)},zoomOut:function(t,e){return this.setZoom(this._zoom-(t||1),e)},setZoomAround:function(t,e,i){var n=this.getZoomScale(e),s=this.getSize().divideBy(2),a=t instanceof o.Point?t:this.latLngToContainerPoint(t),r=a.subtract(s).multiplyBy(1-1/n),h=this.containerPointToLatLng(s.add(r));return this.setView(h,e,{zoom:i})},fitBounds:function(t,e){e=e||{},t=t.getBounds?t.getBounds():o.latLngBounds(t);var i=o.point(e.paddingTopLeft||e.padding||[0,0]),n=o.point(e.paddingBottomRight||e.padding||[0,0]),s=this.getBoundsZoom(t,!1,i.add(n));s=e.maxZoom?Math.min(e.maxZoom,s):s;var a=n.subtract(i).divideBy(2),r=this.project(t.getSouthWest(),s),h=this.project(t.getNorthEast(),s),l=this.unproject(r.add(h).divideBy(2).add(a),s);return this.setView(l,s,e)},fitWorld:function(t){return this.fitBounds([[-90,-180],[90,180]],t)},panTo:function(t,e){return this.setView(t,this._zoom,{pan:e})},panBy:function(t){return this.fire("movestart"),this._rawPanBy(o.point(t)),this.fire("move"),this.fire("moveend")},setMaxBounds:function(t){return t=o.latLngBounds(t),this.options.maxBounds=t,t?(this._loaded&&this._panInsideMaxBounds(),this.on("moveend",this._panInsideMaxBounds,this)):this.off("moveend",this._panInsideMaxBounds,this)},panInsideBounds:function(t,e){var i=this.getCenter(),n=this._limitCenter(i,this._zoom,t);return i.equals(n)?this:this.panTo(n,e)},addLayer:function(t){var e=o.stamp(t);return this._layers[e]?this:(this._layers[e]=t,!t.options||isNaN(t.options.maxZoom)&&isNaN(t.options.minZoom)||(this._zoomBoundLayers[e]=t,this._updateZoomLevels()),this.options.zoomAnimation&&o.TileLayer&&t instanceof o.TileLayer&&(this._tileLayersNum++,this._tileLayersToLoad++,t.on("load",this._onTileLayerLoad,this)),this._loaded&&this._layerAdd(t),this)},removeLayer:function(t){var e=o.stamp(t);return this._layers[e]?(this._loaded&&t.onRemove(this),delete this._layers[e],this._loaded&&this.fire("layerremove",{layer:t}),this._zoomBoundLayers[e]&&(delete this._zoomBoundLayers[e],this._updateZoomLevels()),this.options.zoomAnimation&&o.TileLayer&&t instanceof o.TileLayer&&(this._tileLayersNum--,this._tileLayersToLoad--,t.off("load",this._onTileLayerLoad,this)),this):this},hasLayer:function(t){return t?o.stamp(t)in this._layers:!1},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},invalidateSize:function(t){if(!this._loaded)return this;t=o.extend({animate:!1,pan:!0},t===!0?{animate:!0}:t);var e=this.getSize();this._sizeChanged=!0,this._initialCenter=null;var i=this.getSize(),n=e.divideBy(2).round(),s=i.divideBy(2).round(),a=n.subtract(s);return a.x||a.y?(t.animate&&t.pan?this.panBy(a):(t.pan&&this._rawPanBy(a),this.fire("move"),t.debounceMoveend?(clearTimeout(this._sizeTimer),this._sizeTimer=setTimeout(o.bind(this.fire,this,"moveend"),200)):this.fire("moveend")),this.fire("resize",{oldSize:e,newSize:i})):this},addHandler:function(t,e){if(!e)return this;var i=this[t]=new e(this);return this._handlers.push(i),this.options[t]&&i.enable(),this},remove:function(){this._loaded&&this.fire("unload"),this._initEvents("off");try{delete this._container._leaflet}catch(t){this._container._leaflet=i}return this._clearPanes(),this._clearControlPos&&this._clearControlPos(),this._clearHandlers(),this},getCenter:function(){return this._checkIfLoaded(),this._initialCenter&&!this._moved()?this._initialCenter:this.layerPointToLatLng(this._getCenterLayerPoint())},getZoom:function(){return this._zoom},getBounds:function(){var t=this.getPixelBounds(),e=this.unproject(t.getBottomLeft()),i=this.unproject(t.getTopRight());return new o.LatLngBounds(e,i)},getMinZoom:function(){return this.options.minZoom===i?this._layersMinZoom===i?0:this._layersMinZoom:this.options.minZoom},getMaxZoom:function(){return this.options.maxZoom===i?this._layersMaxZoom===i?1/0:this._layersMaxZoom:this.options.maxZoom},getBoundsZoom:function(t,e,i){t=o.latLngBounds(t);var n,s=this.getMinZoom()-(e?1:0),a=this.getMaxZoom(),r=this.getSize(),h=t.getNorthWest(),l=t.getSouthEast(),u=!0;i=o.point(i||[0,0]);do s++,n=this.project(l,s).subtract(this.project(h,s)).add(i),u=e?n.x=s);return u&&e?null:e?s:s-1},getSize:function(){return(!this._size||this._sizeChanged)&&(this._size=new o.Point(this._container.clientWidth,this._container.clientHeight),this._sizeChanged=!1),this._size.clone()},getPixelBounds:function(){var t=this._getTopLeftPoint();return new o.Bounds(t,t.add(this.getSize()))},getPixelOrigin:function(){return this._checkIfLoaded(),this._initialTopLeftPoint},getPanes:function(){return this._panes},getContainer:function(){return this._container},getZoomScale:function(t){var e=this.options.crs;return e.scale(t)/e.scale(this._zoom)},getScaleZoom:function(t){return this._zoom+Math.log(t)/Math.LN2},project:function(t,e){return e=e===i?this._zoom:e,this.options.crs.latLngToPoint(o.latLng(t),e)},unproject:function(t,e){return e=e===i?this._zoom:e,this.options.crs.pointToLatLng(o.point(t),e)},layerPointToLatLng:function(t){var e=o.point(t).add(this.getPixelOrigin());return this.unproject(e)},latLngToLayerPoint:function(t){var e=this.project(o.latLng(t))._round();return e._subtract(this.getPixelOrigin())},containerPointToLayerPoint:function(t){return o.point(t).subtract(this._getMapPanePos())},layerPointToContainerPoint:function(t){return o.point(t).add(this._getMapPanePos())},containerPointToLatLng:function(t){var e=this.containerPointToLayerPoint(o.point(t));return this.layerPointToLatLng(e)},latLngToContainerPoint:function(t){return this.layerPointToContainerPoint(this.latLngToLayerPoint(o.latLng(t)))},mouseEventToContainerPoint:function(t){return o.DomEvent.getMousePosition(t,this._container)},mouseEventToLayerPoint:function(t){return this.containerPointToLayerPoint(this.mouseEventToContainerPoint(t))},mouseEventToLatLng:function(t){return this.layerPointToLatLng(this.mouseEventToLayerPoint(t))},_initContainer:function(t){var e=this._container=o.DomUtil.get(t);if(!e)throw new Error("Map container not found.");if(e._leaflet)throw new Error("Map container is already initialized.");e._leaflet=!0},_initLayout:function(){var t=this._container;o.DomUtil.addClass(t,"leaflet-container"+(o.Browser.touch?" leaflet-touch":"")+(o.Browser.retina?" leaflet-retina":"")+(o.Browser.ielt9?" leaflet-oldie":"")+(this.options.fadeAnimation?" leaflet-fade-anim":""));var e=o.DomUtil.getStyle(t,"position");"absolute"!==e&&"relative"!==e&&"fixed"!==e&&(t.style.position="relative"),this._initPanes(),this._initControlPos&&this._initControlPos()},_initPanes:function(){var t=this._panes={};this._mapPane=t.mapPane=this._createPane("leaflet-map-pane",this._container),this._tilePane=t.tilePane=this._createPane("leaflet-tile-pane",this._mapPane),t.objectsPane=this._createPane("leaflet-objects-pane",this._mapPane),t.shadowPane=this._createPane("leaflet-shadow-pane"),t.overlayPane=this._createPane("leaflet-overlay-pane"),t.markerPane=this._createPane("leaflet-marker-pane"),t.popupPane=this._createPane("leaflet-popup-pane");var e=" leaflet-zoom-hide";this.options.markerZoomAnimation||(o.DomUtil.addClass(t.markerPane,e),o.DomUtil.addClass(t.shadowPane,e),o.DomUtil.addClass(t.popupPane,e))},_createPane:function(t,e){return o.DomUtil.create("div",t,e||this._panes.objectsPane)},_clearPanes:function(){this._container.removeChild(this._mapPane)},_addLayers:function(t){t=t?o.Util.isArray(t)?t:[t]:[];for(var e=0,i=t.length;i>e;e++)this.addLayer(t[e])},_resetView:function(t,e,i,n){var s=this._zoom!==e;n||(this.fire("movestart"),s&&this.fire("zoomstart")),this._zoom=e,this._initialCenter=t,this._initialTopLeftPoint=this._getNewTopLeftPoint(t),i?this._initialTopLeftPoint._add(this._getMapPanePos()):o.DomUtil.setPosition(this._mapPane,new o.Point(0,0)),this._tileLayersToLoad=this._tileLayersNum;var a=!this._loaded;this._loaded=!0,this.fire("viewreset",{hard:!i}),a&&(this.fire("load"),this.eachLayer(this._layerAdd,this)),this.fire("move"),(s||n)&&this.fire("zoomend"),this.fire("moveend",{hard:!i})},_rawPanBy:function(t){o.DomUtil.setPosition(this._mapPane,this._getMapPanePos().subtract(t))},_getZoomSpan:function(){return this.getMaxZoom()-this.getMinZoom()},_updateZoomLevels:function(){var t,e=1/0,n=-(1/0),o=this._getZoomSpan();for(t in this._zoomBoundLayers){var s=this._zoomBoundLayers[t];isNaN(s.options.minZoom)||(e=Math.min(e,s.options.minZoom)),isNaN(s.options.maxZoom)||(n=Math.max(n,s.options.maxZoom))}t===i?this._layersMaxZoom=this._layersMinZoom=i:(this._layersMaxZoom=n,this._layersMinZoom=e),o!==this._getZoomSpan()&&this.fire("zoomlevelschange")},_panInsideMaxBounds:function(){this.panInsideBounds(this.options.maxBounds)},_checkIfLoaded:function(){if(!this._loaded)throw new Error("Set map center and zoom first.")},_initEvents:function(e){if(o.DomEvent){e=e||"on",o.DomEvent[e](this._container,"click",this._onMouseClick,this);var i,n,s=["dblclick","mousedown","mouseup","mouseenter","mouseleave","mousemove","contextmenu"];for(i=0,n=s.length;n>i;i++)o.DomEvent[e](this._container,s[i],this._fireMouseEvent,this);this.options.trackResize&&o.DomEvent[e](t,"resize",this._onResize,this)}},_onResize:function(){o.Util.cancelAnimFrame(this._resizeRequest),this._resizeRequest=o.Util.requestAnimFrame(function(){this.invalidateSize({debounceMoveend:!0})},this,!1,this._container)},_onMouseClick:function(t){!this._loaded||!t._simulated&&(this.dragging&&this.dragging.moved()||this.boxZoom&&this.boxZoom.moved())||o.DomEvent._skipped(t)||(this.fire("preclick"),this._fireMouseEvent(t))},_fireMouseEvent:function(t){if(this._loaded&&!o.DomEvent._skipped(t)){var e=t.type;if(e="mouseenter"===e?"mouseover":"mouseleave"===e?"mouseout":e,this.hasEventListeners(e)){"contextmenu"===e&&o.DomEvent.preventDefault(t);var i=this.mouseEventToContainerPoint(t),n=this.containerPointToLayerPoint(i),s=this.layerPointToLatLng(n);this.fire(e,{latlng:s,layerPoint:n,containerPoint:i,originalEvent:t})}}},_onTileLayerLoad:function(){this._tileLayersToLoad--,this._tileLayersNum&&!this._tileLayersToLoad&&this.fire("tilelayersload")},_clearHandlers:function(){for(var t=0,e=this._handlers.length;e>t;t++)this._handlers[t].disable()},whenReady:function(t,e){return this._loaded?t.call(e||this,this):this.on("load",t,e),this},_layerAdd:function(t){t.onAdd(this),this.fire("layeradd",{layer:t})},_getMapPanePos:function(){return o.DomUtil.getPosition(this._mapPane)},_moved:function(){var t=this._getMapPanePos();return t&&!t.equals([0,0])},_getTopLeftPoint:function(){return this.getPixelOrigin().subtract(this._getMapPanePos())},_getNewTopLeftPoint:function(t,e){var i=this.getSize()._divideBy(2);return this.project(t,e)._subtract(i)._round()},_latLngToNewLayerPoint:function(t,e,i){var n=this._getNewTopLeftPoint(i,e).add(this._getMapPanePos());return this.project(t,e)._subtract(n)},_getCenterLayerPoint:function(){return this.containerPointToLayerPoint(this.getSize()._divideBy(2))},_getCenterOffset:function(t){return this.latLngToLayerPoint(t).subtract(this._getCenterLayerPoint())},_limitCenter:function(t,e,i){if(!i)return t;var n=this.project(t,e),s=this.getSize().divideBy(2),a=new o.Bounds(n.subtract(s),n.add(s)),r=this._getBoundsOffset(a,i,e);return this.unproject(n.add(r),e)},_limitOffset:function(t,e){if(!e)return t;var i=this.getPixelBounds(),n=new o.Bounds(i.min.add(t),i.max.add(t));return t.add(this._getBoundsOffset(n,e))},_getBoundsOffset:function(t,e,i){var n=this.project(e.getNorthWest(),i).subtract(t.min),s=this.project(e.getSouthEast(),i).subtract(t.max),a=this._rebound(n.x,-s.x),r=this._rebound(n.y,-s.y);return new o.Point(a,r)},_rebound:function(t,e){return t+e>0?Math.round(t-e)/2:Math.max(0,Math.ceil(t))-Math.max(0,Math.floor(e))},_limitZoom:function(t){var e=this.getMinZoom(),i=this.getMaxZoom();return Math.max(e,Math.min(i,t))}}),o.map=function(t,e){return new o.Map(t,e)},o.Projection.Mercator={MAX_LATITUDE:85.0840591556,R_MINOR:6356752.314245179,R_MAJOR:6378137,project:function(t){var e=o.LatLng.DEG_TO_RAD,i=this.MAX_LATITUDE,n=Math.max(Math.min(i,t.lat),-i),s=this.R_MAJOR,a=this.R_MINOR,r=t.lng*e*s,h=n*e,l=a/s,u=Math.sqrt(1-l*l),c=u*Math.sin(h);c=Math.pow((1-c)/(1+c),.5*u);var d=Math.tan(.5*(.5*Math.PI-h))/c;return h=-s*Math.log(d),new o.Point(r,h)},unproject:function(t){for(var e,i=o.LatLng.RAD_TO_DEG,n=this.R_MAJOR,s=this.R_MINOR,a=t.x*i/n,r=s/n,h=Math.sqrt(1-r*r),l=Math.exp(-t.y/n),u=Math.PI/2-2*Math.atan(l),c=15,d=1e-7,p=c,_=.1;Math.abs(_)>d&&--p>0;)e=h*Math.sin(u),_=Math.PI/2-2*Math.atan(l*Math.pow((1-e)/(1+e),.5*h))-u,u+=_;return new o.LatLng(u*i,a)}},o.CRS.EPSG3395=o.extend({},o.CRS,{code:"EPSG:3395",projection:o.Projection.Mercator, -transformation:function(){var t=o.Projection.Mercator,e=t.R_MAJOR,i=.5/(Math.PI*e);return new o.Transformation(i,.5,-i,.5)}()}),o.TileLayer=o.Class.extend({includes:o.Mixin.Events,options:{minZoom:0,maxZoom:18,tileSize:256,subdomains:"abc",errorTileUrl:"",attribution:"",zoomOffset:0,opacity:1,unloadInvisibleTiles:o.Browser.mobile,updateWhenIdle:o.Browser.mobile},initialize:function(t,e){e=o.setOptions(this,e),e.detectRetina&&o.Browser.retina&&e.maxZoom>0&&(e.tileSize=Math.floor(e.tileSize/2),e.zoomOffset++,e.minZoom>0&&e.minZoom--,this.options.maxZoom--),e.bounds&&(e.bounds=o.latLngBounds(e.bounds)),this._url=t;var i=this.options.subdomains;"string"==typeof i&&(this.options.subdomains=i.split(""))},onAdd:function(t){this._map=t,this._animated=t._zoomAnimated,this._initContainer(),t.on({viewreset:this._reset,moveend:this._update},this),this._animated&&t.on({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this),this.options.updateWhenIdle||(this._limitedUpdate=o.Util.limitExecByInterval(this._update,150,this),t.on("move",this._limitedUpdate,this)),this._reset(),this._update()},addTo:function(t){return t.addLayer(this),this},onRemove:function(t){this._container.parentNode.removeChild(this._container),t.off({viewreset:this._reset,moveend:this._update},this),this._animated&&t.off({zoomanim:this._animateZoom,zoomend:this._endZoomAnim},this),this.options.updateWhenIdle||t.off("move",this._limitedUpdate,this),this._container=null,this._map=null},bringToFront:function(){var t=this._map._panes.tilePane;return this._container&&(t.appendChild(this._container),this._setAutoZIndex(t,Math.max)),this},bringToBack:function(){var t=this._map._panes.tilePane;return this._container&&(t.insertBefore(this._container,t.firstChild),this._setAutoZIndex(t,Math.min)),this},getAttribution:function(){return this.options.attribution},getContainer:function(){return this._container},setOpacity:function(t){return this.options.opacity=t,this._map&&this._updateOpacity(),this},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},setUrl:function(t,e){return this._url=t,e||this.redraw(),this},redraw:function(){return this._map&&(this._reset({hard:!0}),this._update()),this},_updateZIndex:function(){this._container&&this.options.zIndex!==i&&(this._container.style.zIndex=this.options.zIndex)},_setAutoZIndex:function(t,e){var i,n,o,s=t.children,a=-e(1/0,-(1/0));for(n=0,o=s.length;o>n;n++)s[n]!==this._container&&(i=parseInt(s[n].style.zIndex,10),isNaN(i)||(a=e(a,i)));this.options.zIndex=this._container.style.zIndex=(isFinite(a)?a:0)+e(1,-1)},_updateOpacity:function(){var t,e=this._tiles;if(o.Browser.ielt9)for(t in e)o.DomUtil.setOpacity(e[t],this.options.opacity);else o.DomUtil.setOpacity(this._container,this.options.opacity)},_initContainer:function(){var t=this._map._panes.tilePane;if(!this._container){if(this._container=o.DomUtil.create("div","leaflet-layer"),this._updateZIndex(),this._animated){var e="leaflet-tile-container";this._bgBuffer=o.DomUtil.create("div",e,this._container),this._tileContainer=o.DomUtil.create("div",e,this._container)}else this._tileContainer=this._container;t.appendChild(this._container),this.options.opacity<1&&this._updateOpacity()}},_reset:function(t){for(var e in this._tiles)this.fire("tileunload",{tile:this._tiles[e]});this._tiles={},this._tilesToLoad=0,this.options.reuseTiles&&(this._unusedTiles=[]),this._tileContainer.innerHTML="",this._animated&&t&&t.hard&&this._clearBgBuffer(),this._initContainer()},_getTileSize:function(){var t=this._map,e=t.getZoom()+this.options.zoomOffset,i=this.options.maxNativeZoom,n=this.options.tileSize;return i&&e>i&&(n=Math.round(t.getZoomScale(e)/t.getZoomScale(i)*n)),n},_update:function(){if(this._map){var t=this._map,e=t.getPixelBounds(),i=t.getZoom(),n=this._getTileSize();if(!(i>this.options.maxZoom||in;n++)this._addTile(a[n],l);this._tileContainer.appendChild(l)}},_tileShouldBeLoaded:function(t){if(t.x+":"+t.y in this._tiles)return!1;var e=this.options;if(!e.continuousWorld){var i=this._getWrapTileNum();if(e.noWrap&&(t.x<0||t.x>=i.x)||t.y<0||t.y>=i.y)return!1}if(e.bounds){var n=this._getTileSize(),o=t.multiplyBy(n),s=o.add([n,n]),a=this._map.unproject(o),r=this._map.unproject(s);if(e.continuousWorld||e.noWrap||(a=a.wrap(),r=r.wrap()),!e.bounds.intersects([a,r]))return!1}return!0},_removeOtherTiles:function(t){var e,i,n,o;for(o in this._tiles)e=o.split(":"),i=parseInt(e[0],10),n=parseInt(e[1],10),(it.max.x||nt.max.y)&&this._removeTile(o)},_removeTile:function(t){var e=this._tiles[t];this.fire("tileunload",{tile:e,url:e.src}),this.options.reuseTiles?(o.DomUtil.removeClass(e,"leaflet-tile-loaded"),this._unusedTiles.push(e)):e.parentNode===this._tileContainer&&this._tileContainer.removeChild(e),o.Browser.android||(e.onload=null,e.src=o.Util.emptyImageUrl),delete this._tiles[t]},_addTile:function(t,e){var i=this._getTilePos(t),n=this._getTile();o.DomUtil.setPosition(n,i,o.Browser.chrome),this._tiles[t.x+":"+t.y]=n,this._loadTile(n,t),n.parentNode!==this._tileContainer&&e.appendChild(n)},_getZoomForUrl:function(){var t=this.options,e=this._map.getZoom();return t.zoomReverse&&(e=t.maxZoom-e),e+=t.zoomOffset,t.maxNativeZoom?Math.min(e,t.maxNativeZoom):e},_getTilePos:function(t){var e=this._map.getPixelOrigin(),i=this._getTileSize();return t.multiplyBy(i).subtract(e)},getTileUrl:function(t){return o.Util.template(this._url,o.extend({s:this._getSubdomain(t),z:t.z,x:t.x,y:t.y},this.options))},_getWrapTileNum:function(){var t=this._map.options.crs,e=t.getSize(this._map.getZoom());return e.divideBy(this._getTileSize())._floor()},_adjustTilePoint:function(t){var e=this._getWrapTileNum();this.options.continuousWorld||this.options.noWrap||(t.x=(t.x%e.x+e.x)%e.x),this.options.tms&&(t.y=e.y-t.y-1),t.z=this._getZoomForUrl()},_getSubdomain:function(t){var e=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[e]},_getTile:function(){if(this.options.reuseTiles&&this._unusedTiles.length>0){var t=this._unusedTiles.pop();return this._resetTile(t),t}return this._createTile()},_resetTile:function(){},_createTile:function(){var t=o.DomUtil.create("img","leaflet-tile");return t.style.width=t.style.height=this._getTileSize()+"px",t.galleryimg="no",t.onselectstart=t.onmousemove=o.Util.falseFn,o.Browser.ielt9&&this.options.opacity!==i&&o.DomUtil.setOpacity(t,this.options.opacity),o.Browser.mobileWebkit3d&&(t.style.WebkitBackfaceVisibility="hidden"),t},_loadTile:function(t,e){t._layer=this,t.onload=this._tileOnLoad,t.onerror=this._tileOnError,this._adjustTilePoint(e),t.src=this.getTileUrl(e),this.fire("tileloadstart",{tile:t,url:t.src})},_tileLoaded:function(){this._tilesToLoad--,this._animated&&o.DomUtil.addClass(this._tileContainer,"leaflet-zoom-animated"),this._tilesToLoad||(this.fire("load"),this._animated&&(clearTimeout(this._clearBgBufferTimer),this._clearBgBufferTimer=setTimeout(o.bind(this._clearBgBuffer,this),500)))},_tileOnLoad:function(){var t=this._layer;this.src!==o.Util.emptyImageUrl&&(o.DomUtil.addClass(this,"leaflet-tile-loaded"),t.fire("tileload",{tile:this,url:this.src})),t._tileLoaded()},_tileOnError:function(){var t=this._layer;t.fire("tileerror",{tile:this,url:this.src});var e=t.options.errorTileUrl;e&&(this.src=e),t._tileLoaded()}}),o.tileLayer=function(t,e){return new o.TileLayer(t,e)},o.TileLayer.WMS=o.TileLayer.extend({defaultWmsParams:{service:"WMS",request:"GetMap",version:"1.1.1",layers:"",styles:"",format:"image/jpeg",transparent:!1},initialize:function(t,e){this._url=t;var i=o.extend({},this.defaultWmsParams),n=e.tileSize||this.options.tileSize;e.detectRetina&&o.Browser.retina?i.width=i.height=2*n:i.width=i.height=n;for(var s in e)this.options.hasOwnProperty(s)||"crs"===s||(i[s]=e[s]);this.wmsParams=i,o.setOptions(this,e)},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var e=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[e]=this._crs.code,o.TileLayer.prototype.onAdd.call(this,t)},getTileUrl:function(t){var e=this._map,i=this.options.tileSize,n=t.multiplyBy(i),s=n.add([i,i]),a=this._crs.project(e.unproject(n,t.z)),r=this._crs.project(e.unproject(s,t.z)),h=this._wmsVersion>=1.3&&this._crs===o.CRS.EPSG4326?[r.y,a.x,a.y,r.x].join(","):[a.x,r.y,r.x,a.y].join(","),l=o.Util.template(this._url,{s:this._getSubdomain(t)});return l+o.Util.getParamString(this.wmsParams,l,!0)+"&BBOX="+h},setParams:function(t,e){return o.extend(this.wmsParams,t),e||this.redraw(),this}}),o.tileLayer.wms=function(t,e){return new o.TileLayer.WMS(t,e)},o.TileLayer.Canvas=o.TileLayer.extend({options:{async:!1},initialize:function(t){o.setOptions(this,t)},redraw:function(){this._map&&(this._reset({hard:!0}),this._update());for(var t in this._tiles)this._redrawTile(this._tiles[t]);return this},_redrawTile:function(t){this.drawTile(t,t._tilePoint,this._map._zoom)},_createTile:function(){var t=o.DomUtil.create("canvas","leaflet-tile");return t.width=t.height=this.options.tileSize,t.onselectstart=t.onmousemove=o.Util.falseFn,t},_loadTile:function(t,e){t._layer=this,t._tilePoint=e,this._redrawTile(t),this.options.async||this.tileDrawn(t)},drawTile:function(){},tileDrawn:function(t){this._tileOnLoad.call(t)}}),o.tileLayer.canvas=function(t){return new o.TileLayer.Canvas(t)},o.ImageOverlay=o.Class.extend({includes:o.Mixin.Events,options:{opacity:1},initialize:function(t,e,i){this._url=t,this._bounds=o.latLngBounds(e),o.setOptions(this,i)},onAdd:function(t){this._map=t,this._image||this._initImage(),t._panes.overlayPane.appendChild(this._image),t.on("viewreset",this._reset,this),t.options.zoomAnimation&&o.Browser.any3d&&t.on("zoomanim",this._animateZoom,this),this._reset()},onRemove:function(t){t.getPanes().overlayPane.removeChild(this._image),t.off("viewreset",this._reset,this),t.options.zoomAnimation&&t.off("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},setOpacity:function(t){return this.options.opacity=t,this._updateOpacity(),this},bringToFront:function(){return this._image&&this._map._panes.overlayPane.appendChild(this._image),this},bringToBack:function(){var t=this._map._panes.overlayPane;return this._image&&t.insertBefore(this._image,t.firstChild),this},setUrl:function(t){this._url=t,this._image.src=this._url},getAttribution:function(){return this.options.attribution},_initImage:function(){this._image=o.DomUtil.create("img","leaflet-image-layer"),this._map.options.zoomAnimation&&o.Browser.any3d?o.DomUtil.addClass(this._image,"leaflet-zoom-animated"):o.DomUtil.addClass(this._image,"leaflet-zoom-hide"),this._updateOpacity(),o.extend(this._image,{galleryimg:"no",onselectstart:o.Util.falseFn,onmousemove:o.Util.falseFn,onload:o.bind(this._onImageLoad,this),src:this._url})},_animateZoom:function(t){var e=this._map,i=this._image,n=e.getZoomScale(t.zoom),s=this._bounds.getNorthWest(),a=this._bounds.getSouthEast(),r=e._latLngToNewLayerPoint(s,t.zoom,t.center),h=e._latLngToNewLayerPoint(a,t.zoom,t.center)._subtract(r),l=r._add(h._multiplyBy(.5*(1-1/n)));i.style[o.DomUtil.TRANSFORM]=o.DomUtil.getTranslateString(l)+" scale("+n+") "},_reset:function(){var t=this._image,e=this._map.latLngToLayerPoint(this._bounds.getNorthWest()),i=this._map.latLngToLayerPoint(this._bounds.getSouthEast())._subtract(e);o.DomUtil.setPosition(t,e),t.style.width=i.x+"px",t.style.height=i.y+"px"},_onImageLoad:function(){this.fire("load")},_updateOpacity:function(){o.DomUtil.setOpacity(this._image,this.options.opacity)}}),o.imageOverlay=function(t,e,i){return new o.ImageOverlay(t,e,i)},o.Icon=o.Class.extend({options:{className:""},initialize:function(t){o.setOptions(this,t)},createIcon:function(t){return this._createIcon("icon",t)},createShadow:function(t){return this._createIcon("shadow",t)},_createIcon:function(t,e){var i=this._getIconUrl(t);if(!i){if("icon"===t)throw new Error("iconUrl not set in Icon options (see the docs).");return null}var n;return n=e&&"IMG"===e.tagName?this._createImg(i,e):this._createImg(i),this._setIconStyles(n,t),n},_setIconStyles:function(t,e){var i,n=this.options,s=o.point(n[e+"Size"]);i="shadow"===e?o.point(n.shadowAnchor||n.iconAnchor):o.point(n.iconAnchor),!i&&s&&(i=s.divideBy(2,!0)),t.className="leaflet-marker-"+e+" "+n.className,i&&(t.style.marginLeft=-i.x+"px",t.style.marginTop=-i.y+"px"),s&&(t.style.width=s.x+"px",t.style.height=s.y+"px")},_createImg:function(t,i){return i=i||e.createElement("img"),i.src=t,i},_getIconUrl:function(t){return o.Browser.retina&&this.options[t+"RetinaUrl"]?this.options[t+"RetinaUrl"]:this.options[t+"Url"]}}),o.icon=function(t){return new o.Icon(t)},o.Icon.Default=o.Icon.extend({options:{iconSize:[25,41],iconAnchor:[12,41],popupAnchor:[1,-34],shadowSize:[41,41]},_getIconUrl:function(t){var e=t+"Url";if(this.options[e])return this.options[e];o.Browser.retina&&"icon"===t&&(t+="-2x");var i=o.Icon.Default.imagePath;if(!i)throw new Error("Couldn't autodetect L.Icon.Default.imagePath, set it manually.");return i+"/marker-"+t+".png"}}),o.Icon.Default.imagePath=function(){var t,i,n,o,s,a=e.getElementsByTagName("script"),r=/[\/^]leaflet[\-\._]?([\w\-\._]*)\.js\??/;for(t=0,i=a.length;i>t;t++)if(n=a[t].src,o=n.match(r))return s=n.split(r)[0],(s?s+"/":"")+"images"}(),o.Marker=o.Class.extend({includes:o.Mixin.Events,options:{icon:new o.Icon.Default,title:"",alt:"",clickable:!0,draggable:!1,keyboard:!0,zIndexOffset:0,opacity:1,riseOnHover:!1,riseOffset:250},initialize:function(t,e){o.setOptions(this,e),this._latlng=o.latLng(t)},onAdd:function(t){this._map=t,t.on("viewreset",this.update,this),this._initIcon(),this.update(),this.fire("add"),t.options.zoomAnimation&&t.options.markerZoomAnimation&&t.on("zoomanim",this._animateZoom,this)},addTo:function(t){return t.addLayer(this),this},onRemove:function(t){this.dragging&&this.dragging.disable(),this._removeIcon(),this._removeShadow(),this.fire("remove"),t.off({viewreset:this.update,zoomanim:this._animateZoom},this),this._map=null},getLatLng:function(){return this._latlng},setLatLng:function(t){return this._latlng=o.latLng(t),this.update(),this.fire("move",{latlng:this._latlng})},setZIndexOffset:function(t){return this.options.zIndexOffset=t,this.update(),this},setIcon:function(t){return this.options.icon=t,this._map&&(this._initIcon(),this.update()),this._popup&&this.bindPopup(this._popup),this},update:function(){return this._icon&&this._setPos(this._map.latLngToLayerPoint(this._latlng).round()),this},_initIcon:function(){var t=this.options,e=this._map,i=e.options.zoomAnimation&&e.options.markerZoomAnimation,n=i?"leaflet-zoom-animated":"leaflet-zoom-hide",s=t.icon.createIcon(this._icon),a=!1;s!==this._icon&&(this._icon&&this._removeIcon(),a=!0,t.title&&(s.title=t.title),t.alt&&(s.alt=t.alt)),o.DomUtil.addClass(s,n),t.keyboard&&(s.tabIndex="0"),this._icon=s,this._initInteraction(),t.riseOnHover&&o.DomEvent.on(s,"mouseover",this._bringToFront,this).on(s,"mouseout",this._resetZIndex,this);var r=t.icon.createShadow(this._shadow),h=!1;r!==this._shadow&&(this._removeShadow(),h=!0),r&&o.DomUtil.addClass(r,n),this._shadow=r,t.opacity<1&&this._updateOpacity();var l=this._map._panes;a&&l.markerPane.appendChild(this._icon),r&&h&&l.shadowPane.appendChild(this._shadow)},_removeIcon:function(){this.options.riseOnHover&&o.DomEvent.off(this._icon,"mouseover",this._bringToFront).off(this._icon,"mouseout",this._resetZIndex),this._map._panes.markerPane.removeChild(this._icon),this._icon=null},_removeShadow:function(){this._shadow&&this._map._panes.shadowPane.removeChild(this._shadow),this._shadow=null},_setPos:function(t){o.DomUtil.setPosition(this._icon,t),this._shadow&&o.DomUtil.setPosition(this._shadow,t),this._zIndex=t.y+this.options.zIndexOffset,this._resetZIndex()},_updateZIndex:function(t){this._icon.style.zIndex=this._zIndex+t},_animateZoom:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center).round();this._setPos(e)},_initInteraction:function(){if(this.options.clickable){var t=this._icon,e=["dblclick","mousedown","mouseover","mouseout","contextmenu"];o.DomUtil.addClass(t,"leaflet-clickable"),o.DomEvent.on(t,"click",this._onMouseClick,this),o.DomEvent.on(t,"keypress",this._onKeyPress,this);for(var i=0;is?(e.height=s+"px",o.DomUtil.addClass(t,a)):o.DomUtil.removeClass(t,a),this._containerWidth=this._container.offsetWidth},_updatePosition:function(){if(this._map){var t=this._map.latLngToLayerPoint(this._latlng),e=this._animated,i=o.point(this.options.offset);e&&o.DomUtil.setPosition(this._container,t),this._containerBottom=-i.y-(e?0:t.y),this._containerLeft=-Math.round(this._containerWidth/2)+i.x+(e?0:t.x),this._container.style.bottom=this._containerBottom+"px",this._container.style.left=this._containerLeft+"px"}},_zoomAnimation:function(t){var e=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center);o.DomUtil.setPosition(this._container,e)},_adjustPan:function(){if(this.options.autoPan){var t=this._map,e=this._container.offsetHeight,i=this._containerWidth,n=new o.Point(this._containerLeft,-e-this._containerBottom);this._animated&&n._add(o.DomUtil.getPosition(this._container));var s=t.layerPointToContainerPoint(n),a=o.point(this.options.autoPanPadding),r=o.point(this.options.autoPanPaddingTopLeft||a),h=o.point(this.options.autoPanPaddingBottomRight||a),l=t.getSize(),u=0,c=0;s.x+i+h.x>l.x&&(u=s.x+i-l.x+h.x),s.x-u-r.x<0&&(u=s.x-r.x),s.y+e+h.y>l.y&&(c=s.y+e-l.y+h.y),s.y-c-r.y<0&&(c=s.y-r.y),(u||c)&&t.fire("autopanstart").panBy([u,c])}},_onCloseButtonClick:function(t){this._close(),o.DomEvent.stop(t)}}),o.popup=function(t,e){return new o.Popup(t,e)},o.Map.include({openPopup:function(t,e,i){if(this.closePopup(),!(t instanceof o.Popup)){var n=t;t=new o.Popup(i).setLatLng(e).setContent(n)}return t._isOpen=!0,this._popup=t,this.addLayer(t)},closePopup:function(t){return t&&t!==this._popup||(t=this._popup,this._popup=null),t&&(this.removeLayer(t),t._isOpen=!1),this}}),o.Marker.include({openPopup:function(){return this._popup&&this._map&&!this._map.hasLayer(this._popup)&&(this._popup.setLatLng(this._latlng),this._map.openPopup(this._popup)),this},closePopup:function(){return this._popup&&this._popup._close(),this},togglePopup:function(){return this._popup&&(this._popup._isOpen?this.closePopup():this.openPopup()),this},bindPopup:function(t,e){var i=o.point(this.options.icon.options.popupAnchor||[0,0]);return i=i.add(o.Popup.prototype.options.offset),e&&e.offset&&(i=i.add(e.offset)),e=o.extend({offset:i},e),this._popupHandlersAdded||(this.on("click",this.togglePopup,this).on("remove",this.closePopup,this).on("move",this._movePopup,this),this._popupHandlersAdded=!0),t instanceof o.Popup?(o.setOptions(t,e),this._popup=t,t._source=this):this._popup=new o.Popup(e,this).setContent(t),this},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},unbindPopup:function(){return this._popup&&(this._popup=null,this.off("click",this.togglePopup,this).off("remove",this.closePopup,this).off("move",this._movePopup,this),this._popupHandlersAdded=!1),this},getPopup:function(){return this._popup},_movePopup:function(t){this._popup.setLatLng(t.latlng)}}),o.LayerGroup=o.Class.extend({initialize:function(t){this._layers={};var e,i;if(t)for(e=0,i=t.length;i>e;e++)this.addLayer(t[e])},addLayer:function(t){var e=this.getLayerId(t);return this._layers[e]=t,this._map&&this._map.addLayer(t),this},removeLayer:function(t){var e=t in this._layers?t:this.getLayerId(t);return this._map&&this._layers[e]&&this._map.removeLayer(this._layers[e]),delete this._layers[e],this},hasLayer:function(t){return t?t in this._layers||this.getLayerId(t)in this._layers:!1},clearLayers:function(){return this.eachLayer(this.removeLayer,this),this},invoke:function(t){var e,i,n=Array.prototype.slice.call(arguments,1);for(e in this._layers)i=this._layers[e],i[t]&&i[t].apply(i,n);return this},onAdd:function(t){this._map=t,this.eachLayer(t.addLayer,t)},onRemove:function(t){this.eachLayer(t.removeLayer,t),this._map=null},addTo:function(t){return t.addLayer(this),this},eachLayer:function(t,e){for(var i in this._layers)t.call(e,this._layers[i]);return this},getLayer:function(t){return this._layers[t]},getLayers:function(){var t=[];for(var e in this._layers)t.push(this._layers[e]);return t},setZIndex:function(t){return this.invoke("setZIndex",t)},getLayerId:function(t){return o.stamp(t)}}),o.layerGroup=function(t){return new o.LayerGroup(t)},o.FeatureGroup=o.LayerGroup.extend({includes:o.Mixin.Events,statics:{EVENTS:"click dblclick mouseover mouseout mousemove contextmenu popupopen popupclose"},addLayer:function(t){return this.hasLayer(t)?this:("on"in t&&t.on(o.FeatureGroup.EVENTS,this._propagateEvent,this),o.LayerGroup.prototype.addLayer.call(this,t),this._popupContent&&t.bindPopup&&t.bindPopup(this._popupContent,this._popupOptions),this.fire("layeradd",{layer:t}))},removeLayer:function(t){return this.hasLayer(t)?(t in this._layers&&(t=this._layers[t]),"off"in t&&t.off(o.FeatureGroup.EVENTS,this._propagateEvent,this),o.LayerGroup.prototype.removeLayer.call(this,t),this._popupContent&&this.invoke("unbindPopup"),this.fire("layerremove",{layer:t})):this},bindPopup:function(t,e){return this._popupContent=t,this._popupOptions=e,this.invoke("bindPopup",t,e)},openPopup:function(t){for(var e in this._layers){this._layers[e].openPopup(t);break}return this},setStyle:function(t){return this.invoke("setStyle",t)},bringToFront:function(){return this.invoke("bringToFront")},bringToBack:function(){return this.invoke("bringToBack")},getBounds:function(){var t=new o.LatLngBounds;return this.eachLayer(function(e){t.extend(e instanceof o.Marker?e.getLatLng():e.getBounds())}),t},_propagateEvent:function(t){t=o.extend({layer:t.target,target:this},t),this.fire(t.type,t)}}),o.featureGroup=function(t){return new o.FeatureGroup(t)},o.Path=o.Class.extend({includes:[o.Mixin.Events],statics:{CLIP_PADDING:function(){var e=o.Browser.mobile?1280:2e3,i=(e/Math.max(t.outerWidth,t.outerHeight)-1)/2;return Math.max(0,Math.min(.5,i))}()},options:{stroke:!0,color:"#0033ff",dashArray:null,lineCap:null,lineJoin:null,weight:5,opacity:.5,fill:!1,fillColor:null,fillOpacity:.2,clickable:!0},initialize:function(t){o.setOptions(this,t)},onAdd:function(t){this._map=t,this._container||(this._initElements(),this._initEvents()),this.projectLatlngs(),this._updatePath(),this._container&&this._map._pathRoot.appendChild(this._container),this.fire("add"),t.on({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},addTo:function(t){return t.addLayer(this),this},onRemove:function(t){t._pathRoot.removeChild(this._container),this.fire("remove"),this._map=null,o.Browser.vml&&(this._container=null,this._stroke=null,this._fill=null),t.off({viewreset:this.projectLatlngs,moveend:this._updatePath},this)},projectLatlngs:function(){},setStyle:function(t){return o.setOptions(this,t),this._container&&this._updateStyle(),this},redraw:function(){return this._map&&(this.projectLatlngs(),this._updatePath()),this}}),o.Map.include({_updatePathViewport:function(){var t=o.Path.CLIP_PADDING,e=this.getSize(),i=o.DomUtil.getPosition(this._mapPane),n=i.multiplyBy(-1)._subtract(e.multiplyBy(t)._round()),s=n.add(e.multiplyBy(1+2*t)._round());this._pathViewport=new o.Bounds(n,s)}}),o.Path.SVG_NS="http://www.w3.org/2000/svg",o.Browser.svg=!(!e.createElementNS||!e.createElementNS(o.Path.SVG_NS,"svg").createSVGRect),o.Path=o.Path.extend({statics:{SVG:o.Browser.svg},bringToFront:function(){var t=this._map._pathRoot,e=this._container;return e&&t.lastChild!==e&&t.appendChild(e),this},bringToBack:function(){var t=this._map._pathRoot,e=this._container,i=t.firstChild;return e&&i!==e&&t.insertBefore(e,i),this},getPathString:function(){},_createElement:function(t){return e.createElementNS(o.Path.SVG_NS,t)},_initElements:function(){this._map._initPathRoot(),this._initPath(),this._initStyle()},_initPath:function(){this._container=this._createElement("g"),this._path=this._createElement("path"),this.options.className&&o.DomUtil.addClass(this._path,this.options.className),this._container.appendChild(this._path)},_initStyle:function(){this.options.stroke&&(this._path.setAttribute("stroke-linejoin","round"),this._path.setAttribute("stroke-linecap","round")),this.options.fill&&this._path.setAttribute("fill-rule","evenodd"),this.options.pointerEvents&&this._path.setAttribute("pointer-events",this.options.pointerEvents),this.options.clickable||this.options.pointerEvents||this._path.setAttribute("pointer-events","none"),this._updateStyle()},_updateStyle:function(){this.options.stroke?(this._path.setAttribute("stroke",this.options.color),this._path.setAttribute("stroke-opacity",this.options.opacity),this._path.setAttribute("stroke-width",this.options.weight),this.options.dashArray?this._path.setAttribute("stroke-dasharray",this.options.dashArray):this._path.removeAttribute("stroke-dasharray"),this.options.lineCap&&this._path.setAttribute("stroke-linecap",this.options.lineCap),this.options.lineJoin&&this._path.setAttribute("stroke-linejoin",this.options.lineJoin)):this._path.setAttribute("stroke","none"),this.options.fill?(this._path.setAttribute("fill",this.options.fillColor||this.options.color),this._path.setAttribute("fill-opacity",this.options.fillOpacity)):this._path.setAttribute("fill","none")},_updatePath:function(){var t=this.getPathString();t||(t="M0 0"),this._path.setAttribute("d",t)},_initEvents:function(){if(this.options.clickable){(o.Browser.svg||!o.Browser.vml)&&o.DomUtil.addClass(this._path,"leaflet-clickable"),o.DomEvent.on(this._container,"click",this._onMouseClick,this);for(var t=["dblclick","mousedown","mouseover","mouseout","mousemove","contextmenu"],e=0;e';var i=t.firstChild;return i.style.behavior="url(#default#VML)",i&&"object"==typeof i.adj}catch(n){return!1}}(),o.Path=o.Browser.svg||!o.Browser.vml?o.Path:o.Path.extend({statics:{VML:!0,CLIP_PADDING:.02},_createElement:function(){try{return e.namespaces.add("lvml","urn:schemas-microsoft-com:vml"),function(t){return e.createElement("')}}catch(t){return function(t){return e.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}}}(),_initPath:function(){var t=this._container=this._createElement("shape");o.DomUtil.addClass(t,"leaflet-vml-shape"+(this.options.className?" "+this.options.className:"")),this.options.clickable&&o.DomUtil.addClass(t,"leaflet-clickable"),t.coordsize="1 1",this._path=this._createElement("path"),t.appendChild(this._path),this._map._pathRoot.appendChild(t)},_initStyle:function(){this._updateStyle()},_updateStyle:function(){var t=this._stroke,e=this._fill,i=this.options,n=this._container;n.stroked=i.stroke,n.filled=i.fill,i.stroke?(t||(t=this._stroke=this._createElement("stroke"),t.endcap="round",n.appendChild(t)),t.weight=i.weight+"px",t.color=i.color,t.opacity=i.opacity,i.dashArray?t.dashStyle=o.Util.isArray(i.dashArray)?i.dashArray.join(" "):i.dashArray.replace(/( *, *)/g," "):t.dashStyle="",i.lineCap&&(t.endcap=i.lineCap.replace("butt","flat")),i.lineJoin&&(t.joinstyle=i.lineJoin)):t&&(n.removeChild(t),this._stroke=null),i.fill?(e||(e=this._fill=this._createElement("fill"),n.appendChild(e)),e.color=i.fillColor||i.color,e.opacity=i.fillOpacity):e&&(n.removeChild(e),this._fill=null)},_updatePath:function(){var t=this._container.style;t.display="none",this._path.v=this.getPathString()+" ",t.display=""}}),o.Map.include(o.Browser.svg||!o.Browser.vml?{}:{_initPathRoot:function(){if(!this._pathRoot){var t=this._pathRoot=e.createElement("div");t.className="leaflet-vml-container",this._panes.overlayPane.appendChild(t),this.on("moveend",this._updatePathViewport),this._updatePathViewport()}}}),o.Browser.canvas=function(){return!!e.createElement("canvas").getContext}(),o.Path=o.Path.SVG&&!t.L_PREFER_CANVAS||!o.Browser.canvas?o.Path:o.Path.extend({statics:{CANVAS:!0,SVG:!1},redraw:function(){return this._map&&(this.projectLatlngs(),this._requestUpdate()),this},setStyle:function(t){return o.setOptions(this,t),this._map&&(this._updateStyle(),this._requestUpdate()),this},onRemove:function(t){t.off("viewreset",this.projectLatlngs,this).off("moveend",this._updatePath,this),this.options.clickable&&(this._map.off("click",this._onClick,this),this._map.off("mousemove",this._onMouseMove,this)),this._requestUpdate(),this.fire("remove"),this._map=null},_requestUpdate:function(){this._map&&!o.Path._updateRequest&&(o.Path._updateRequest=o.Util.requestAnimFrame(this._fireMapMoveEnd,this._map))},_fireMapMoveEnd:function(){o.Path._updateRequest=null,this.fire("moveend")},_initElements:function(){this._map._initPathRoot(),this._ctx=this._map._canvasCtx},_updateStyle:function(){var t=this.options;t.stroke&&(this._ctx.lineWidth=t.weight,this._ctx.strokeStyle=t.color),t.fill&&(this._ctx.fillStyle=t.fillColor||t.color),t.lineCap&&(this._ctx.lineCap=t.lineCap),t.lineJoin&&(this._ctx.lineJoin=t.lineJoin)},_drawPath:function(){var t,e,i,n,s,a;for(this._ctx.beginPath(),t=0,i=this._parts.length;i>t;t++){for(e=0,n=this._parts[t].length;n>e;e++)s=this._parts[t][e],a=(0===e?"move":"line")+"To",this._ctx[a](s.x,s.y);this instanceof o.Polygon&&this._ctx.closePath()}},_checkIfEmpty:function(){return!this._parts.length},_updatePath:function(){if(!this._checkIfEmpty()){var t=this._ctx,e=this.options;this._drawPath(),t.save(),this._updateStyle(),e.fill&&(t.globalAlpha=e.fillOpacity,t.fill(e.fillRule||"evenodd")),e.stroke&&(t.globalAlpha=e.opacity,t.stroke()),t.restore()}},_initEvents:function(){this.options.clickable&&(this._map.on("mousemove",this._onMouseMove,this),this._map.on("click dblclick contextmenu",this._fireMouseEvent,this))},_fireMouseEvent:function(t){this._containsPoint(t.layerPoint)&&this.fire(t.type,t)},_onMouseMove:function(t){this._map&&!this._map._animatingZoom&&(this._containsPoint(t.layerPoint)?(this._ctx.canvas.style.cursor="pointer",this._mouseInside=!0,this.fire("mouseover",t)):this._mouseInside&&(this._ctx.canvas.style.cursor="",this._mouseInside=!1,this.fire("mouseout",t)))}}),o.Map.include(o.Path.SVG&&!t.L_PREFER_CANVAS||!o.Browser.canvas?{}:{_initPathRoot:function(){var t,i=this._pathRoot;i||(i=this._pathRoot=e.createElement("canvas"),i.style.position="absolute",t=this._canvasCtx=i.getContext("2d"),t.lineCap="round",t.lineJoin="round",this._panes.overlayPane.appendChild(i),this.options.zoomAnimation&&(this._pathRoot.className="leaflet-zoom-animated",this.on("zoomanim",this._animatePathZoom),this.on("zoomend",this._endPathZoom)),this.on("moveend",this._updateCanvasViewport),this._updateCanvasViewport())},_updateCanvasViewport:function(){if(!this._pathZooming){this._updatePathViewport();var t=this._pathViewport,e=t.min,i=t.max.subtract(e),n=this._pathRoot;o.DomUtil.setPosition(n,e),n.width=i.x,n.height=i.y,n.getContext("2d").translate(-e.x,-e.y)}}}),o.LineUtil={simplify:function(t,e){if(!e||!t.length)return t.slice();var i=e*e;return t=this._reducePoints(t,i),t=this._simplifyDP(t,i)},pointToSegmentDistance:function(t,e,i){return Math.sqrt(this._sqClosestPointOnSegment(t,e,i,!0))},closestPointOnSegment:function(t,e,i){return this._sqClosestPointOnSegment(t,e,i)},_simplifyDP:function(t,e){var n=t.length,o=typeof Uint8Array!=i+""?Uint8Array:Array,s=new o(n);s[0]=s[n-1]=1,this._simplifyDPStep(t,s,e,0,n-1);var a,r=[];for(a=0;n>a;a++)s[a]&&r.push(t[a]);return r},_simplifyDPStep:function(t,e,i,n,o){var s,a,r,h=0;for(a=n+1;o-1>=a;a++)r=this._sqClosestPointOnSegment(t[a],t[n],t[o],!0),r>h&&(s=a,h=r);h>i&&(e[s]=1,this._simplifyDPStep(t,e,i,n,s),this._simplifyDPStep(t,e,i,s,o))},_reducePoints:function(t,e){for(var i=[t[0]],n=1,o=0,s=t.length;s>n;n++)this._sqDist(t[n],t[o])>e&&(i.push(t[n]),o=n);return s-1>o&&i.push(t[s-1]),i},clipSegment:function(t,e,i,n){var o,s,a,r=n?this._lastCode:this._getBitCode(t,i),h=this._getBitCode(e,i);for(this._lastCode=h;;){if(!(r|h))return[t,e];if(r&h)return!1;o=r||h,s=this._getEdgeIntersection(t,e,o,i),a=this._getBitCode(s,i),o===r?(t=s,r=a):(e=s,h=a)}},_getEdgeIntersection:function(t,e,i,n){var s=e.x-t.x,a=e.y-t.y,r=n.min,h=n.max;return 8&i?new o.Point(t.x+s*(h.y-t.y)/a,h.y):4&i?new o.Point(t.x+s*(r.y-t.y)/a,r.y):2&i?new o.Point(h.x,t.y+a*(h.x-t.x)/s):1&i?new o.Point(r.x,t.y+a*(r.x-t.x)/s):void 0},_getBitCode:function(t,e){var i=0;return t.xe.max.x&&(i|=2),t.ye.max.y&&(i|=8),i},_sqDist:function(t,e){var i=e.x-t.x,n=e.y-t.y;return i*i+n*n},_sqClosestPointOnSegment:function(t,e,i,n){var s,a=e.x,r=e.y,h=i.x-a,l=i.y-r,u=h*h+l*l;return u>0&&(s=((t.x-a)*h+(t.y-r)*l)/u,s>1?(a=i.x,r=i.y):s>0&&(a+=h*s,r+=l*s)),h=t.x-a,l=t.y-r,n?h*h+l*l:new o.Point(a,r)}},o.Polyline=o.Path.extend({initialize:function(t,e){o.Path.prototype.initialize.call(this,e),this._latlngs=this._convertLatLngs(t)},options:{smoothFactor:1,noClip:!1},projectLatlngs:function(){this._originalPoints=[];for(var t=0,e=this._latlngs.length;e>t;t++)this._originalPoints[t]=this._map.latLngToLayerPoint(this._latlngs[t])},getPathString:function(){for(var t=0,e=this._parts.length,i="";e>t;t++)i+=this._getPathPartStr(this._parts[t]);return i},getLatLngs:function(){return this._latlngs},setLatLngs:function(t){return this._latlngs=this._convertLatLngs(t),this.redraw()},addLatLng:function(t){return this._latlngs.push(o.latLng(t)),this.redraw()},spliceLatLngs:function(){var t=[].splice.apply(this._latlngs,arguments);return this._convertLatLngs(this._latlngs,!0),this.redraw(),t},closestLayerPoint:function(t){for(var e,i,n=1/0,s=this._parts,a=null,r=0,h=s.length;h>r;r++)for(var l=s[r],u=1,c=l.length;c>u;u++){e=l[u-1],i=l[u];var d=o.LineUtil._sqClosestPointOnSegment(t,e,i,!0);n>d&&(n=d,a=o.LineUtil._sqClosestPointOnSegment(t,e,i))}return a&&(a.distance=Math.sqrt(n)),a},getBounds:function(){return new o.LatLngBounds(this.getLatLngs())},_convertLatLngs:function(t,e){var i,n,s=e?t:[];for(i=0,n=t.length;n>i;i++){if(o.Util.isArray(t[i])&&"number"!=typeof t[i][0])return;s[i]=o.latLng(t[i])}return s},_initEvents:function(){o.Path.prototype._initEvents.call(this)},_getPathPartStr:function(t){for(var e,i=o.Path.VML,n=0,s=t.length,a="";s>n;n++)e=t[n],i&&e._round(),a+=(n?"L":"M")+e.x+" "+e.y;return a},_clipPoints:function(){var t,e,i,n=this._originalPoints,s=n.length;if(this.options.noClip)return void(this._parts=[n]);this._parts=[];var a=this._parts,r=this._map._pathViewport,h=o.LineUtil;for(t=0,e=0;s-1>t;t++)i=h.clipSegment(n[t],n[t+1],r,t),i&&(a[e]=a[e]||[],a[e].push(i[0]),(i[1]!==n[t+1]||t===s-2)&&(a[e].push(i[1]),e++))},_simplifyPoints:function(){for(var t=this._parts,e=o.LineUtil,i=0,n=t.length;n>i;i++)t[i]=e.simplify(t[i],this.options.smoothFactor)},_updatePath:function(){this._map&&(this._clipPoints(),this._simplifyPoints(),o.Path.prototype._updatePath.call(this))}}),o.polyline=function(t,e){return new o.Polyline(t,e)},o.PolyUtil={},o.PolyUtil.clipPolygon=function(t,e){var i,n,s,a,r,h,l,u,c,d=[1,4,2,8],p=o.LineUtil;for(n=0,l=t.length;l>n;n++)t[n]._code=p._getBitCode(t[n],e);for(a=0;4>a;a++){for(u=d[a],i=[],n=0,l=t.length,s=l-1;l>n;s=n++)r=t[n],h=t[s],r._code&u?h._code&u||(c=p._getEdgeIntersection(h,r,u,e),c._code=p._getBitCode(c,e),i.push(c)):(h._code&u&&(c=p._getEdgeIntersection(h,r,u,e),c._code=p._getBitCode(c,e),i.push(c)),i.push(r));t=i}return t},o.Polygon=o.Polyline.extend({options:{fill:!0},initialize:function(t,e){o.Polyline.prototype.initialize.call(this,t,e),this._initWithHoles(t)},_initWithHoles:function(t){var e,i,n;if(t&&o.Util.isArray(t[0])&&"number"!=typeof t[0][0])for(this._latlngs=this._convertLatLngs(t[0]),this._holes=t.slice(1),e=0,i=this._holes.length;i>e;e++)n=this._holes[e]=this._convertLatLngs(this._holes[e]),n[0].equals(n[n.length-1])&&n.pop();t=this._latlngs,t.length>=2&&t[0].equals(t[t.length-1])&&t.pop()},projectLatlngs:function(){if(o.Polyline.prototype.projectLatlngs.call(this),this._holePoints=[],this._holes){var t,e,i,n;for(t=0,i=this._holes.length;i>t;t++)for(this._holePoints[t]=[],e=0,n=this._holes[t].length;n>e;e++)this._holePoints[t][e]=this._map.latLngToLayerPoint(this._holes[t][e])}},setLatLngs:function(t){return t&&o.Util.isArray(t[0])&&"number"!=typeof t[0][0]?(this._initWithHoles(t),this.redraw()):o.Polyline.prototype.setLatLngs.call(this,t)},_clipPoints:function(){var t=this._originalPoints,e=[];if(this._parts=[t].concat(this._holePoints),!this.options.noClip){for(var i=0,n=this._parts.length;n>i;i++){var s=o.PolyUtil.clipPolygon(this._parts[i],this._map._pathViewport);s.length&&e.push(s)}this._parts=e}},_getPathPartStr:function(t){var e=o.Polyline.prototype._getPathPartStr.call(this,t);return e+(o.Browser.svg?"z":"x")}}),o.polygon=function(t,e){return new o.Polygon(t,e)},function(){function t(t){return o.FeatureGroup.extend({initialize:function(t,e){this._layers={},this._options=e,this.setLatLngs(t)},setLatLngs:function(e){var i=0,n=e.length;for(this.eachLayer(function(t){n>i?t.setLatLngs(e[i++]):this.removeLayer(t)},this);n>i;)this.addLayer(new t(e[i++],this._options));return this},getLatLngs:function(){var t=[];return this.eachLayer(function(e){t.push(e.getLatLngs())}),t}})}o.MultiPolyline=t(o.Polyline),o.MultiPolygon=t(o.Polygon),o.multiPolyline=function(t,e){return new o.MultiPolyline(t,e)},o.multiPolygon=function(t,e){return new o.MultiPolygon(t,e)}}(),o.Rectangle=o.Polygon.extend({initialize:function(t,e){o.Polygon.prototype.initialize.call(this,this._boundsToLatLngs(t),e)},setBounds:function(t){this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=o.latLngBounds(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}}),o.rectangle=function(t,e){return new o.Rectangle(t,e)},o.Circle=o.Path.extend({initialize:function(t,e,i){o.Path.prototype.initialize.call(this,i),this._latlng=o.latLng(t),this._mRadius=e},options:{fill:!0},setLatLng:function(t){return this._latlng=o.latLng(t),this.redraw()},setRadius:function(t){return this._mRadius=t,this.redraw()},projectLatlngs:function(){var t=this._getLngRadius(),e=this._latlng,i=this._map.latLngToLayerPoint([e.lat,e.lng-t]);this._point=this._map.latLngToLayerPoint(e),this._radius=Math.max(this._point.x-i.x,1)},getBounds:function(){var t=this._getLngRadius(),e=this._mRadius/40075017*360,i=this._latlng;return new o.LatLngBounds([i.lat-e,i.lng-t],[i.lat+e,i.lng+t])},getLatLng:function(){return this._latlng},getPathString:function(){var t=this._point,e=this._radius;return this._checkIfEmpty()?"":o.Browser.svg?"M"+t.x+","+(t.y-e)+"A"+e+","+e+",0,1,1,"+(t.x-.1)+","+(t.y-e)+" z":(t._round(),e=Math.round(e),"AL "+t.x+","+t.y+" "+e+","+e+" 0,23592600")},getRadius:function(){return this._mRadius},_getLatRadius:function(){return this._mRadius/40075017*360},_getLngRadius:function(){return this._getLatRadius()/Math.cos(o.LatLng.DEG_TO_RAD*this._latlng.lat)},_checkIfEmpty:function(){if(!this._map)return!1;var t=this._map._pathViewport,e=this._radius,i=this._point;return i.x-e>t.max.x||i.y-e>t.max.y||i.x+ei;i++)for(l=this._parts[i],n=0,r=l.length,s=r-1;r>n;s=n++)if((e||0!==n)&&(h=o.LineUtil.pointToSegmentDistance(t,l[s],l[n]),u>=h))return!0;return!1}}:{}),o.Polygon.include(o.Path.CANVAS?{_containsPoint:function(t){var e,i,n,s,a,r,h,l,u=!1;if(o.Polyline.prototype._containsPoint.call(this,t,!0))return!0;for(s=0,h=this._parts.length;h>s;s++)for(e=this._parts[s],a=0,l=e.length,r=l-1;l>a;r=a++)i=e[a],n=e[r],i.y>t.y!=n.y>t.y&&t.x<(n.x-i.x)*(t.y-i.y)/(n.y-i.y)+i.x&&(u=!u);return u}}:{}),o.Circle.include(o.Path.CANVAS?{_drawPath:function(){var t=this._point;this._ctx.beginPath(),this._ctx.arc(t.x,t.y,this._radius,0,2*Math.PI,!1)},_containsPoint:function(t){var e=this._point,i=this.options.stroke?this.options.weight/2:0;return t.distanceTo(e)<=this._radius+i}}:{}),o.CircleMarker.include(o.Path.CANVAS?{_updateStyle:function(){o.Path.prototype._updateStyle.call(this)}}:{}),o.GeoJSON=o.FeatureGroup.extend({initialize:function(t,e){o.setOptions(this,e),this._layers={},t&&this.addData(t)},addData:function(t){var e,i,n,s=o.Util.isArray(t)?t:t.features;if(s){for(e=0,i=s.length;i>e;e++)n=s[e],(n.geometries||n.geometry||n.features||n.coordinates)&&this.addData(s[e]);return this}var a=this.options;if(!a.filter||a.filter(t)){var r=o.GeoJSON.geometryToLayer(t,a.pointToLayer,a.coordsToLatLng,a);return r.feature=o.GeoJSON.asFeature(t),r.defaultOptions=r.options,this.resetStyle(r),a.onEachFeature&&a.onEachFeature(t,r),this.addLayer(r)}},resetStyle:function(t){var e=this.options.style;e&&(o.Util.extend(t.options,t.defaultOptions),this._setLayerStyle(t,e))},setStyle:function(t){this.eachLayer(function(e){this._setLayerStyle(e,t)},this)},_setLayerStyle:function(t,e){"function"==typeof e&&(e=e(t.feature)),t.setStyle&&t.setStyle(e)}}),o.extend(o.GeoJSON,{geometryToLayer:function(t,e,i,n){var s,a,r,h,l="Feature"===t.type?t.geometry:t,u=l.coordinates,c=[];switch(i=i||this.coordsToLatLng,l.type){case"Point":return s=i(u),e?e(t,s):new o.Marker(s);case"MultiPoint":for(r=0,h=u.length;h>r;r++)s=i(u[r]),c.push(e?e(t,s):new o.Marker(s));return new o.FeatureGroup(c);case"LineString":return a=this.coordsToLatLngs(u,0,i),new o.Polyline(a,n);case"Polygon":if(2===u.length&&!u[1].length)throw new Error("Invalid GeoJSON object.");return a=this.coordsToLatLngs(u,1,i),new o.Polygon(a,n);case"MultiLineString":return a=this.coordsToLatLngs(u,1,i),new o.MultiPolyline(a,n);case"MultiPolygon":return a=this.coordsToLatLngs(u,2,i),new o.MultiPolygon(a,n);case"GeometryCollection":for(r=0,h=l.geometries.length;h>r;r++)c.push(this.geometryToLayer({geometry:l.geometries[r],type:"Feature",properties:t.properties},e,i,n));return new o.FeatureGroup(c);default:throw new Error("Invalid GeoJSON object.")}},coordsToLatLng:function(t){return new o.LatLng(t[1],t[0],t[2])},coordsToLatLngs:function(t,e,i){var n,o,s,a=[];for(o=0,s=t.length;s>o;o++)n=e?this.coordsToLatLngs(t[o],e-1,i):(i||this.coordsToLatLng)(t[o]),a.push(n);return a},latLngToCoords:function(t){var e=[t.lng,t.lat];return t.alt!==i&&e.push(t.alt),e},latLngsToCoords:function(t){for(var e=[],i=0,n=t.length;n>i;i++)e.push(o.GeoJSON.latLngToCoords(t[i]));return e},getFeature:function(t,e){return t.feature?o.extend({},t.feature,{geometry:e}):o.GeoJSON.asFeature(e)},asFeature:function(t){return"Feature"===t.type?t:{type:"Feature",properties:{},geometry:t}}});var a={toGeoJSON:function(){return o.GeoJSON.getFeature(this,{type:"Point",coordinates:o.GeoJSON.latLngToCoords(this.getLatLng())})}};o.Marker.include(a),o.Circle.include(a),o.CircleMarker.include(a),o.Polyline.include({toGeoJSON:function(){return o.GeoJSON.getFeature(this,{type:"LineString",coordinates:o.GeoJSON.latLngsToCoords(this.getLatLngs())})}}),o.Polygon.include({toGeoJSON:function(){var t,e,i,n=[o.GeoJSON.latLngsToCoords(this.getLatLngs())];if(n[0].push(n[0][0]),this._holes)for(t=0,e=this._holes.length;e>t;t++)i=o.GeoJSON.latLngsToCoords(this._holes[t]),i.push(i[0]),n.push(i);return o.GeoJSON.getFeature(this,{type:"Polygon",coordinates:n})}}),function(){function t(t){return function(){var e=[];return this.eachLayer(function(t){e.push(t.toGeoJSON().geometry.coordinates)}),o.GeoJSON.getFeature(this,{type:t,coordinates:e})}}o.MultiPolyline.include({toGeoJSON:t("MultiLineString")}),o.MultiPolygon.include({toGeoJSON:t("MultiPolygon")}),o.LayerGroup.include({toGeoJSON:function(){var e,i=this.feature&&this.feature.geometry,n=[];if(i&&"MultiPoint"===i.type)return t("MultiPoint").call(this);var s=i&&"GeometryCollection"===i.type;return this.eachLayer(function(t){t.toGeoJSON&&(e=t.toGeoJSON(),n.push(s?e.geometry:o.GeoJSON.asFeature(e)))}),s?o.GeoJSON.getFeature(this,{geometries:n,type:"GeometryCollection"}):{type:"FeatureCollection",features:n}}})}(),o.geoJson=function(t,e){return new o.GeoJSON(t,e)},o.DomEvent={addListener:function(t,e,i,n){var s,a,r,h=o.stamp(i),l="_leaflet_"+e+h;return t[l]?this:(s=function(e){return i.call(n||t,e||o.DomEvent._getEvent())},o.Browser.pointer&&0===e.indexOf("touch")?this.addPointerListener(t,e,s,h):(o.Browser.touch&&"dblclick"===e&&this.addDoubleTapListener&&this.addDoubleTapListener(t,s,h),"addEventListener"in t?"mousewheel"===e?(t.addEventListener("DOMMouseScroll",s,!1),t.addEventListener(e,s,!1)):"mouseenter"===e||"mouseleave"===e?(a=s,r="mouseenter"===e?"mouseover":"mouseout",s=function(e){return o.DomEvent._checkMouse(t,e)?a(e):void 0},t.addEventListener(r,s,!1)):"click"===e&&o.Browser.android?(a=s,s=function(t){return o.DomEvent._filterClick(t,a)},t.addEventListener(e,s,!1)):t.addEventListener(e,s,!1):"attachEvent"in t&&t.attachEvent("on"+e,s),t[l]=s,this))},removeListener:function(t,e,i){var n=o.stamp(i),s="_leaflet_"+e+n,a=t[s];return a?(o.Browser.pointer&&0===e.indexOf("touch")?this.removePointerListener(t,e,n):o.Browser.touch&&"dblclick"===e&&this.removeDoubleTapListener?this.removeDoubleTapListener(t,n):"removeEventListener"in t?"mousewheel"===e?(t.removeEventListener("DOMMouseScroll",a,!1),t.removeEventListener(e,a,!1)):"mouseenter"===e||"mouseleave"===e?t.removeEventListener("mouseenter"===e?"mouseover":"mouseout",a,!1):t.removeEventListener(e,a,!1):"detachEvent"in t&&t.detachEvent("on"+e,a),t[s]=null,this):this},stopPropagation:function(t){return t.stopPropagation?t.stopPropagation():t.cancelBubble=!0,o.DomEvent._skipped(t),this},disableScrollPropagation:function(t){var e=o.DomEvent.stopPropagation;return o.DomEvent.on(t,"mousewheel",e).on(t,"MozMousePixelScroll",e)},disableClickPropagation:function(t){for(var e=o.DomEvent.stopPropagation,i=o.Draggable.START.length-1;i>=0;i--)o.DomEvent.on(t,o.Draggable.START[i],e);return o.DomEvent.on(t,"click",o.DomEvent._fakeStop).on(t,"dblclick",e)},preventDefault:function(t){return t.preventDefault?t.preventDefault():t.returnValue=!1,this},stop:function(t){return o.DomEvent.preventDefault(t).stopPropagation(t)},getMousePosition:function(t,e){if(!e)return new o.Point(t.clientX,t.clientY);var i=e.getBoundingClientRect();return new o.Point(t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop)},getWheelDelta:function(t){var e=0;return t.wheelDelta&&(e=t.wheelDelta/120),t.detail&&(e=-t.detail/3),e},_skipEvents:{},_fakeStop:function(t){o.DomEvent._skipEvents[t.type]=!0},_skipped:function(t){var e=this._skipEvents[t.type];return this._skipEvents[t.type]=!1,e},_checkMouse:function(t,e){var i=e.relatedTarget;if(!i)return!0;try{for(;i&&i!==t;)i=i.parentNode}catch(n){return!1}return i!==t},_getEvent:function(){var e=t.event;if(!e)for(var i=arguments.callee.caller;i&&(e=i.arguments[0],!e||t.Event!==e.constructor);)i=i.caller;return e},_filterClick:function(t,e){var i=t.timeStamp||t.originalEvent.timeStamp,n=o.DomEvent._lastClick&&i-o.DomEvent._lastClick;return n&&n>100&&500>n||t.target._simulatedClick&&!t._simulated?void o.DomEvent.stop(t):(o.DomEvent._lastClick=i,e(t))}},o.DomEvent.on=o.DomEvent.addListener,o.DomEvent.off=o.DomEvent.removeListener,o.Draggable=o.Class.extend({includes:o.Mixin.Events,statics:{START:o.Browser.touch?["touchstart","mousedown"]:["mousedown"],END:{mousedown:"mouseup",touchstart:"touchend",pointerdown:"touchend",MSPointerDown:"touchend"},MOVE:{mousedown:"mousemove",touchstart:"touchmove",pointerdown:"touchmove",MSPointerDown:"touchmove"}},initialize:function(t,e){this._element=t,this._dragStartTarget=e||t},enable:function(){if(!this._enabled){for(var t=o.Draggable.START.length-1;t>=0;t--)o.DomEvent.on(this._dragStartTarget,o.Draggable.START[t],this._onDown,this);this._enabled=!0}},disable:function(){if(this._enabled){for(var t=o.Draggable.START.length-1;t>=0;t--)o.DomEvent.off(this._dragStartTarget,o.Draggable.START[t],this._onDown,this);this._enabled=!1,this._moved=!1}},_onDown:function(t){if(this._moved=!1,!t.shiftKey&&(1===t.which||1===t.button||t.touches)&&(o.DomEvent.stopPropagation(t),!o.Draggable._disabled&&(o.DomUtil.disableImageDrag(),o.DomUtil.disableTextSelection(),!this._moving))){var i=t.touches?t.touches[0]:t;this._startPoint=new o.Point(i.clientX,i.clientY),this._startPos=this._newPos=o.DomUtil.getPosition(this._element),o.DomEvent.on(e,o.Draggable.MOVE[t.type],this._onMove,this).on(e,o.Draggable.END[t.type],this._onUp,this)}},_onMove:function(t){if(t.touches&&t.touches.length>1)return void(this._moved=!0);var i=t.touches&&1===t.touches.length?t.touches[0]:t,n=new o.Point(i.clientX,i.clientY),s=n.subtract(this._startPoint);(s.x||s.y)&&(o.Browser.touch&&Math.abs(s.x)+Math.abs(s.y)<3||(o.DomEvent.preventDefault(t),this._moved||(this.fire("dragstart"),this._moved=!0,this._startPos=o.DomUtil.getPosition(this._element).subtract(s),o.DomUtil.addClass(e.body,"leaflet-dragging"),this._lastTarget=t.target||t.srcElement,o.DomUtil.addClass(this._lastTarget,"leaflet-drag-target")),this._newPos=this._startPos.add(s),this._moving=!0,o.Util.cancelAnimFrame(this._animRequest),this._animRequest=o.Util.requestAnimFrame(this._updatePosition,this,!0,this._dragStartTarget)))},_updatePosition:function(){this.fire("predrag"),o.DomUtil.setPosition(this._element,this._newPos),this.fire("drag")},_onUp:function(){o.DomUtil.removeClass(e.body,"leaflet-dragging"),this._lastTarget&&(o.DomUtil.removeClass(this._lastTarget,"leaflet-drag-target"),this._lastTarget=null);for(var t in o.Draggable.MOVE)o.DomEvent.off(e,o.Draggable.MOVE[t],this._onMove).off(e,o.Draggable.END[t],this._onUp);o.DomUtil.enableImageDrag(),o.DomUtil.enableTextSelection(),this._moved&&this._moving&&(o.Util.cancelAnimFrame(this._animRequest),this.fire("dragend",{distance:this._newPos.distanceTo(this._startPos)})),this._moving=!1}}),o.Handler=o.Class.extend({initialize:function(t){this._map=t},enable:function(){this._enabled||(this._enabled=!0,this.addHooks())},disable:function(){this._enabled&&(this._enabled=!1,this.removeHooks())},enabled:function(){return!!this._enabled}}),o.Map.mergeOptions({dragging:!0,inertia:!o.Browser.android23,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,inertiaThreshold:o.Browser.touch?32:18,easeLinearity:.25,worldCopyJump:!1}),o.Map.Drag=o.Handler.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new o.Draggable(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDrag,this),t.on("viewreset",this._onViewReset,this),t.whenReady(this._onViewReset,this))}this._draggable.enable()},removeHooks:function(){this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(){var t=this._map;t._panAnim&&t._panAnim.stop(),t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(){if(this._map.options.inertia){var t=this._lastTime=+new Date,e=this._lastPos=this._draggable._newPos;this._positions.push(e),this._times.push(t),t-this._times[0]>200&&(this._positions.shift(),this._times.shift())}this._map.fire("move").fire("drag")},_onViewReset:function(){var t=this._map.getSize()._divideBy(2),e=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=e.subtract(t).x,this._worldWidth=this._map.project([0,180]).x},_onPreDrag:function(){var t=this._worldWidth,e=Math.round(t/2),i=this._initialWorldOffset,n=this._draggable._newPos.x,o=(n-e+i)%t+e-i,s=(n+e+i)%t-e-i,a=Math.abs(o+i)i.inertiaThreshold||!this._positions[0];if(e.fire("dragend",t),s)e.fire("moveend");else{var a=this._lastPos.subtract(this._positions[0]),r=(this._lastTime+n-this._times[0])/1e3,h=i.easeLinearity,l=a.multiplyBy(h/r),u=l.distanceTo([0,0]),c=Math.min(i.inertiaMaxSpeed,u),d=l.multiplyBy(c/u),p=c/(i.inertiaDeceleration*h),_=d.multiplyBy(-p/2).round();_.x&&_.y?(_=e._limitOffset(_,e.options.maxBounds),o.Util.requestAnimFrame(function(){e.panBy(_,{duration:p,easeLinearity:h,noMoveStart:!0})})):e.fire("moveend")}}}),o.Map.addInitHook("addHandler","dragging",o.Map.Drag),o.Map.mergeOptions({doubleClickZoom:!0}),o.Map.DoubleClickZoom=o.Handler.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var e=this._map,i=e.getZoom()+(t.originalEvent.shiftKey?-1:1);"center"===e.options.doubleClickZoom?e.setZoom(i):e.setZoomAround(t.containerPoint,i)}}),o.Map.addInitHook("addHandler","doubleClickZoom",o.Map.DoubleClickZoom),o.Map.mergeOptions({scrollWheelZoom:!0}),o.Map.ScrollWheelZoom=o.Handler.extend({addHooks:function(){o.DomEvent.on(this._map._container,"mousewheel",this._onWheelScroll,this),o.DomEvent.on(this._map._container,"MozMousePixelScroll",o.DomEvent.preventDefault),this._delta=0},removeHooks:function(){o.DomEvent.off(this._map._container,"mousewheel",this._onWheelScroll),o.DomEvent.off(this._map._container,"MozMousePixelScroll",o.DomEvent.preventDefault)},_onWheelScroll:function(t){var e=o.DomEvent.getWheelDelta(t);this._delta+=e,this._lastMousePos=this._map.mouseEventToContainerPoint(t),this._startTime||(this._startTime=+new Date);var i=Math.max(40-(+new Date-this._startTime),0);clearTimeout(this._timer),this._timer=setTimeout(o.bind(this._performZoom,this),i),o.DomEvent.preventDefault(t),o.DomEvent.stopPropagation(t)},_performZoom:function(){var t=this._map,e=this._delta,i=t.getZoom();e=e>0?Math.ceil(e):Math.floor(e),e=Math.max(Math.min(e,4),-4),e=t._limitZoom(i+e)-i,this._delta=0,this._startTime=null,e&&("center"===t.options.scrollWheelZoom?t.setZoom(i+e):t.setZoomAround(this._lastMousePos,i+e))}}),o.Map.addInitHook("addHandler","scrollWheelZoom",o.Map.ScrollWheelZoom),o.extend(o.DomEvent,{_touchstart:o.Browser.msPointer?"MSPointerDown":o.Browser.pointer?"pointerdown":"touchstart",_touchend:o.Browser.msPointer?"MSPointerUp":o.Browser.pointer?"pointerup":"touchend",addDoubleTapListener:function(t,i,n){function s(t){var e;if(o.Browser.pointer?(_.push(t.pointerId),e=_.length):e=t.touches.length,!(e>1)){var i=Date.now(),n=i-(r||i);h=t.touches?t.touches[0]:t,l=n>0&&u>=n,r=i}}function a(t){if(o.Browser.pointer){var e=_.indexOf(t.pointerId);if(-1===e)return;_.splice(e,1)}if(l){if(o.Browser.pointer){var n,s={};for(var a in h)n=h[a],"function"==typeof n?s[a]=n.bind(h):s[a]=n;h=s}h.type="dblclick",i(h),r=null}}var r,h,l=!1,u=250,c="_leaflet_",d=this._touchstart,p=this._touchend,_=[];t[c+d+n]=s,t[c+p+n]=a;var m=o.Browser.pointer?e.documentElement:t;return t.addEventListener(d,s,!1),m.addEventListener(p,a,!1),o.Browser.pointer&&m.addEventListener(o.DomEvent.POINTER_CANCEL,a,!1),this},removeDoubleTapListener:function(t,i){var n="_leaflet_";return t.removeEventListener(this._touchstart,t[n+this._touchstart+i],!1),(o.Browser.pointer?e.documentElement:t).removeEventListener(this._touchend,t[n+this._touchend+i],!1),o.Browser.pointer&&e.documentElement.removeEventListener(o.DomEvent.POINTER_CANCEL,t[n+this._touchend+i],!1),this}}),o.extend(o.DomEvent,{POINTER_DOWN:o.Browser.msPointer?"MSPointerDown":"pointerdown",POINTER_MOVE:o.Browser.msPointer?"MSPointerMove":"pointermove",POINTER_UP:o.Browser.msPointer?"MSPointerUp":"pointerup",POINTER_CANCEL:o.Browser.msPointer?"MSPointerCancel":"pointercancel",_pointers:[],_pointerDocumentListener:!1,addPointerListener:function(t,e,i,n){switch(e){case"touchstart":return this.addPointerListenerStart(t,e,i,n); -case"touchend":return this.addPointerListenerEnd(t,e,i,n);case"touchmove":return this.addPointerListenerMove(t,e,i,n);default:throw"Unknown touch event type"}},addPointerListenerStart:function(t,i,n,s){var a="_leaflet_",r=this._pointers,h=function(t){"mouse"!==t.pointerType&&t.pointerType!==t.MSPOINTER_TYPE_MOUSE&&o.DomEvent.preventDefault(t);for(var e=!1,i=0;i1))&&(this._moved||(o.DomUtil.addClass(e._mapPane,"leaflet-touching"),e.fire("movestart").fire("zoomstart"),this._moved=!0),o.Util.cancelAnimFrame(this._animRequest),this._animRequest=o.Util.requestAnimFrame(this._updateOnMove,this,!0,this._map._container),o.DomEvent.preventDefault(t))}},_updateOnMove:function(){var t=this._map,e=this._getScaleOrigin(),i=t.layerPointToLatLng(e),n=t.getScaleZoom(this._scale);t._animateZoom(i,n,this._startCenter,this._scale,this._delta,!1,!0)},_onTouchEnd:function(){if(!this._moved||!this._zooming)return void(this._zooming=!1);var t=this._map;this._zooming=!1,o.DomUtil.removeClass(t._mapPane,"leaflet-touching"),o.Util.cancelAnimFrame(this._animRequest),o.DomEvent.off(e,"touchmove",this._onTouchMove).off(e,"touchend",this._onTouchEnd);var i=this._getScaleOrigin(),n=t.layerPointToLatLng(i),s=t.getZoom(),a=t.getScaleZoom(this._scale)-s,r=a>0?Math.ceil(a):Math.floor(a),h=t._limitZoom(s+r),l=t.getZoomScale(h)/this._scale;t._animateZoom(n,h,i,l)},_getScaleOrigin:function(){var t=this._centerOffset.subtract(this._delta).divideBy(this._scale);return this._startCenter.add(t)}}),o.Map.addInitHook("addHandler","touchZoom",o.Map.TouchZoom),o.Map.mergeOptions({tap:!0,tapTolerance:15}),o.Map.Tap=o.Handler.extend({addHooks:function(){o.DomEvent.on(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){o.DomEvent.off(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(t.touches){if(o.DomEvent.preventDefault(t),this._fireClick=!0,t.touches.length>1)return this._fireClick=!1,void clearTimeout(this._holdTimeout);var i=t.touches[0],n=i.target;this._startPos=this._newPos=new o.Point(i.clientX,i.clientY),n.tagName&&"a"===n.tagName.toLowerCase()&&o.DomUtil.addClass(n,"leaflet-active"),this._holdTimeout=setTimeout(o.bind(function(){this._isTapValid()&&(this._fireClick=!1,this._onUp(),this._simulateEvent("contextmenu",i))},this),1e3),o.DomEvent.on(e,"touchmove",this._onMove,this).on(e,"touchend",this._onUp,this)}},_onUp:function(t){if(clearTimeout(this._holdTimeout),o.DomEvent.off(e,"touchmove",this._onMove,this).off(e,"touchend",this._onUp,this),this._fireClick&&t&&t.changedTouches){var i=t.changedTouches[0],n=i.target;n&&n.tagName&&"a"===n.tagName.toLowerCase()&&o.DomUtil.removeClass(n,"leaflet-active"),this._isTapValid()&&this._simulateEvent("click",i)}},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_onMove:function(t){var e=t.touches[0];this._newPos=new o.Point(e.clientX,e.clientY)},_simulateEvent:function(i,n){var o=e.createEvent("MouseEvents");o._simulated=!0,n.target._simulatedClick=!0,o.initMouseEvent(i,!0,!0,t,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),n.target.dispatchEvent(o)}}),o.Browser.touch&&!o.Browser.pointer&&o.Map.addInitHook("addHandler","tap",o.Map.Tap),o.Map.mergeOptions({boxZoom:!0}),o.Map.BoxZoom=o.Handler.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._moved=!1},addHooks:function(){o.DomEvent.on(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){o.DomEvent.off(this._container,"mousedown",this._onMouseDown),this._moved=!1},moved:function(){return this._moved},_onMouseDown:function(t){return this._moved=!1,!t.shiftKey||1!==t.which&&1!==t.button?!1:(o.DomUtil.disableTextSelection(),o.DomUtil.disableImageDrag(),this._startLayerPoint=this._map.mouseEventToLayerPoint(t),void o.DomEvent.on(e,"mousemove",this._onMouseMove,this).on(e,"mouseup",this._onMouseUp,this).on(e,"keydown",this._onKeyDown,this))},_onMouseMove:function(t){this._moved||(this._box=o.DomUtil.create("div","leaflet-zoom-box",this._pane),o.DomUtil.setPosition(this._box,this._startLayerPoint),this._container.style.cursor="crosshair",this._map.fire("boxzoomstart"));var e=this._startLayerPoint,i=this._box,n=this._map.mouseEventToLayerPoint(t),s=n.subtract(e),a=new o.Point(Math.min(n.x,e.x),Math.min(n.y,e.y));o.DomUtil.setPosition(i,a),this._moved=!0,i.style.width=Math.max(0,Math.abs(s.x)-4)+"px",i.style.height=Math.max(0,Math.abs(s.y)-4)+"px"},_finish:function(){this._moved&&(this._pane.removeChild(this._box),this._container.style.cursor=""),o.DomUtil.enableTextSelection(),o.DomUtil.enableImageDrag(),o.DomEvent.off(e,"mousemove",this._onMouseMove).off(e,"mouseup",this._onMouseUp).off(e,"keydown",this._onKeyDown)},_onMouseUp:function(t){this._finish();var e=this._map,i=e.mouseEventToLayerPoint(t);if(!this._startLayerPoint.equals(i)){var n=new o.LatLngBounds(e.layerPointToLatLng(this._startLayerPoint),e.layerPointToLatLng(i));e.fitBounds(n),e.fire("boxzoomend",{boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&this._finish()}}),o.Map.addInitHook("addHandler","boxZoom",o.Map.BoxZoom),o.Map.mergeOptions({keyboard:!0,keyboardPanOffset:80,keyboardZoomOffset:1}),o.Map.Keyboard=o.Handler.extend({keyCodes:{left:[37],right:[39],down:[40],up:[38],zoomIn:[187,107,61,171],zoomOut:[189,109,173]},initialize:function(t){this._map=t,this._setPanOffset(t.options.keyboardPanOffset),this._setZoomOffset(t.options.keyboardZoomOffset)},addHooks:function(){var t=this._map._container;-1===t.tabIndex&&(t.tabIndex="0"),o.DomEvent.on(t,"focus",this._onFocus,this).on(t,"blur",this._onBlur,this).on(t,"mousedown",this._onMouseDown,this),this._map.on("focus",this._addHooks,this).on("blur",this._removeHooks,this)},removeHooks:function(){this._removeHooks();var t=this._map._container;o.DomEvent.off(t,"focus",this._onFocus,this).off(t,"blur",this._onBlur,this).off(t,"mousedown",this._onMouseDown,this),this._map.off("focus",this._addHooks,this).off("blur",this._removeHooks,this)},_onMouseDown:function(){if(!this._focused){var i=e.body,n=e.documentElement,o=i.scrollTop||n.scrollTop,s=i.scrollLeft||n.scrollLeft;this._map._container.focus(),t.scrollTo(s,o)}},_onFocus:function(){this._focused=!0,this._map.fire("focus")},_onBlur:function(){this._focused=!1,this._map.fire("blur")},_setPanOffset:function(t){var e,i,n=this._panKeys={},o=this.keyCodes;for(e=0,i=o.left.length;i>e;e++)n[o.left[e]]=[-1*t,0];for(e=0,i=o.right.length;i>e;e++)n[o.right[e]]=[t,0];for(e=0,i=o.down.length;i>e;e++)n[o.down[e]]=[0,t];for(e=0,i=o.up.length;i>e;e++)n[o.up[e]]=[0,-1*t]},_setZoomOffset:function(t){var e,i,n=this._zoomKeys={},o=this.keyCodes;for(e=0,i=o.zoomIn.length;i>e;e++)n[o.zoomIn[e]]=t;for(e=0,i=o.zoomOut.length;i>e;e++)n[o.zoomOut[e]]=-t},_addHooks:function(){o.DomEvent.on(e,"keydown",this._onKeyDown,this)},_removeHooks:function(){o.DomEvent.off(e,"keydown",this._onKeyDown,this)},_onKeyDown:function(t){var e=t.keyCode,i=this._map;if(e in this._panKeys){if(i._panAnim&&i._panAnim._inProgress)return;i.panBy(this._panKeys[e]),i.options.maxBounds&&i.panInsideBounds(i.options.maxBounds)}else{if(!(e in this._zoomKeys))return;i.setZoom(i.getZoom()+this._zoomKeys[e])}o.DomEvent.stop(t)}}),o.Map.addInitHook("addHandler","keyboard",o.Map.Keyboard),o.Handler.MarkerDrag=o.Handler.extend({initialize:function(t){this._marker=t},addHooks:function(){var t=this._marker._icon;this._draggable||(this._draggable=new o.Draggable(t,t)),this._draggable.on("dragstart",this._onDragStart,this).on("drag",this._onDrag,this).on("dragend",this._onDragEnd,this),this._draggable.enable(),o.DomUtil.addClass(this._marker._icon,"leaflet-marker-draggable")},removeHooks:function(){this._draggable.off("dragstart",this._onDragStart,this).off("drag",this._onDrag,this).off("dragend",this._onDragEnd,this),this._draggable.disable(),o.DomUtil.removeClass(this._marker._icon,"leaflet-marker-draggable")},moved:function(){return this._draggable&&this._draggable._moved},_onDragStart:function(){this._marker.closePopup().fire("movestart").fire("dragstart")},_onDrag:function(){var t=this._marker,e=t._shadow,i=o.DomUtil.getPosition(t._icon),n=t._map.layerPointToLatLng(i);e&&o.DomUtil.setPosition(e,i),t._latlng=n,t.fire("move",{latlng:n}).fire("drag")},_onDragEnd:function(t){this._marker.fire("moveend").fire("dragend",t)}}),o.Control=o.Class.extend({options:{position:"topright"},initialize:function(t){o.setOptions(this,t)},getPosition:function(){return this.options.position},setPosition:function(t){var e=this._map;return e&&e.removeControl(this),this.options.position=t,e&&e.addControl(this),this},getContainer:function(){return this._container},addTo:function(t){this._map=t;var e=this._container=this.onAdd(t),i=this.getPosition(),n=t._controlCorners[i];return o.DomUtil.addClass(e,"leaflet-control"),-1!==i.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e),this},removeFrom:function(t){var e=this.getPosition(),i=t._controlCorners[e];return i.removeChild(this._container),this._map=null,this.onRemove&&this.onRemove(t),this},_refocusOnMap:function(){this._map&&this._map.getContainer().focus()}}),o.control=function(t){return new o.Control(t)},o.Map.include({addControl:function(t){return t.addTo(this),this},removeControl:function(t){return t.removeFrom(this),this},_initControlPos:function(){function t(t,s){var a=i+t+" "+i+s;e[t+s]=o.DomUtil.create("div",a,n)}var e=this._controlCorners={},i="leaflet-",n=this._controlContainer=o.DomUtil.create("div",i+"control-container",this._container);t("top","left"),t("top","right"),t("bottom","left"),t("bottom","right")},_clearControlPos:function(){this._container.removeChild(this._controlContainer)}}),o.Control.Zoom=o.Control.extend({options:{position:"topleft",zoomInText:"+",zoomInTitle:"Zoom in",zoomOutText:"-",zoomOutTitle:"Zoom out"},onAdd:function(t){var e="leaflet-control-zoom",i=o.DomUtil.create("div",e+" leaflet-bar");return this._map=t,this._zoomInButton=this._createButton(this.options.zoomInText,this.options.zoomInTitle,e+"-in",i,this._zoomIn,this),this._zoomOutButton=this._createButton(this.options.zoomOutText,this.options.zoomOutTitle,e+"-out",i,this._zoomOut,this),this._updateDisabled(),t.on("zoomend zoomlevelschange",this._updateDisabled,this),i},onRemove:function(t){t.off("zoomend zoomlevelschange",this._updateDisabled,this)},_zoomIn:function(t){this._map.zoomIn(t.shiftKey?3:1)},_zoomOut:function(t){this._map.zoomOut(t.shiftKey?3:1)},_createButton:function(t,e,i,n,s,a){var r=o.DomUtil.create("a",i,n);r.innerHTML=t,r.href="#",r.title=e;var h=o.DomEvent.stopPropagation;return o.DomEvent.on(r,"click",h).on(r,"mousedown",h).on(r,"dblclick",h).on(r,"click",o.DomEvent.preventDefault).on(r,"click",s,a).on(r,"click",this._refocusOnMap,a),r},_updateDisabled:function(){var t=this._map,e="leaflet-disabled";o.DomUtil.removeClass(this._zoomInButton,e),o.DomUtil.removeClass(this._zoomOutButton,e),t._zoom===t.getMinZoom()&&o.DomUtil.addClass(this._zoomOutButton,e),t._zoom===t.getMaxZoom()&&o.DomUtil.addClass(this._zoomInButton,e)}}),o.Map.mergeOptions({zoomControl:!0}),o.Map.addInitHook(function(){this.options.zoomControl&&(this.zoomControl=new o.Control.Zoom,this.addControl(this.zoomControl))}),o.control.zoom=function(t){return new o.Control.Zoom(t)},o.Control.Attribution=o.Control.extend({options:{position:"bottomright",prefix:'Leaflet'},initialize:function(t){o.setOptions(this,t),this._attributions={}},onAdd:function(t){this._container=o.DomUtil.create("div","leaflet-control-attribution"),o.DomEvent.disableClickPropagation(this._container);for(var e in t._layers)t._layers[e].getAttribution&&this.addAttribution(t._layers[e].getAttribution());return t.on("layeradd",this._onLayerAdd,this).on("layerremove",this._onLayerRemove,this),this._update(),this._container},onRemove:function(t){t.off("layeradd",this._onLayerAdd).off("layerremove",this._onLayerRemove)},setPrefix:function(t){return this.options.prefix=t,this._update(),this},addAttribution:function(t){return t?(this._attributions[t]||(this._attributions[t]=0),this._attributions[t]++,this._update(),this):void 0},removeAttribution:function(t){return t?(this._attributions[t]&&(this._attributions[t]--,this._update()),this):void 0},_update:function(){if(this._map){var t=[];for(var e in this._attributions)this._attributions[e]&&t.push(e);var i=[];this.options.prefix&&i.push(this.options.prefix),t.length&&i.push(t.join(", ")),this._container.innerHTML=i.join(" | ")}},_onLayerAdd:function(t){t.layer.getAttribution&&this.addAttribution(t.layer.getAttribution())},_onLayerRemove:function(t){t.layer.getAttribution&&this.removeAttribution(t.layer.getAttribution())}}),o.Map.mergeOptions({attributionControl:!0}),o.Map.addInitHook(function(){this.options.attributionControl&&(this.attributionControl=(new o.Control.Attribution).addTo(this))}),o.control.attribution=function(t){return new o.Control.Attribution(t)},o.Control.Scale=o.Control.extend({options:{position:"bottomleft",maxWidth:100,metric:!0,imperial:!0,updateWhenIdle:!1},onAdd:function(t){this._map=t;var e="leaflet-control-scale",i=o.DomUtil.create("div",e),n=this.options;return this._addScales(n,e,i),t.on(n.updateWhenIdle?"moveend":"move",this._update,this),t.whenReady(this._update,this),i},onRemove:function(t){t.off(this.options.updateWhenIdle?"moveend":"move",this._update,this)},_addScales:function(t,e,i){t.metric&&(this._mScale=o.DomUtil.create("div",e+"-line",i)),t.imperial&&(this._iScale=o.DomUtil.create("div",e+"-line",i))},_update:function(){var t=this._map.getBounds(),e=t.getCenter().lat,i=6378137*Math.PI*Math.cos(e*Math.PI/180),n=i*(t.getNorthEast().lng-t.getSouthWest().lng)/180,o=this._map.getSize(),s=this.options,a=0;o.x>0&&(a=n*(s.maxWidth/o.x)),this._updateScales(s,a)},_updateScales:function(t,e){t.metric&&e&&this._updateMetric(e),t.imperial&&e&&this._updateImperial(e)},_updateMetric:function(t){var e=this._getRoundNum(t);this._mScale.style.width=this._getScaleWidth(e/t)+"px",this._mScale.innerHTML=1e3>e?e+" m":e/1e3+" km"},_updateImperial:function(t){var e,i,n,o=3.2808399*t,s=this._iScale;o>5280?(e=o/5280,i=this._getRoundNum(e),s.style.width=this._getScaleWidth(i/e)+"px",s.innerHTML=i+" mi"):(n=this._getRoundNum(o),s.style.width=this._getScaleWidth(n/o)+"px",s.innerHTML=n+" ft")},_getScaleWidth:function(t){return Math.round(this.options.maxWidth*t)-10},_getRoundNum:function(t){var e=Math.pow(10,(Math.floor(t)+"").length-1),i=t/e;return i=i>=10?10:i>=5?5:i>=3?3:i>=2?2:1,e*i}}),o.control.scale=function(t){return new o.Control.Scale(t)},o.Control.Layers=o.Control.extend({options:{collapsed:!0,position:"topright",autoZIndex:!0},initialize:function(t,e,i){o.setOptions(this,i),this._layers={},this._lastZIndex=0,this._handlingClick=!1;for(var n in t)this._addLayer(t[n],n);for(n in e)this._addLayer(e[n],n,!0)},onAdd:function(t){return this._initLayout(),this._update(),t.on("layeradd",this._onLayerChange,this).on("layerremove",this._onLayerChange,this),this._container},onRemove:function(t){t.off("layeradd",this._onLayerChange,this).off("layerremove",this._onLayerChange,this)},addBaseLayer:function(t,e){return this._addLayer(t,e),this._update(),this},addOverlay:function(t,e){return this._addLayer(t,e,!0),this._update(),this},removeLayer:function(t){var e=o.stamp(t);return delete this._layers[e],this._update(),this},_initLayout:function(){var t="leaflet-control-layers",e=this._container=o.DomUtil.create("div",t);e.setAttribute("aria-haspopup",!0),o.Browser.touch?o.DomEvent.on(e,"click",o.DomEvent.stopPropagation):o.DomEvent.disableClickPropagation(e).disableScrollPropagation(e);var i=this._form=o.DomUtil.create("form",t+"-list");if(this.options.collapsed){o.Browser.android||o.DomEvent.on(e,"mouseover",this._expand,this).on(e,"mouseout",this._collapse,this);var n=this._layersLink=o.DomUtil.create("a",t+"-toggle",e);n.href="#",n.title="Layers",o.Browser.touch?o.DomEvent.on(n,"click",o.DomEvent.stop).on(n,"click",this._expand,this):o.DomEvent.on(n,"focus",this._expand,this),o.DomEvent.on(i,"click",function(){setTimeout(o.bind(this._onInputClick,this),0)},this),this._map.on("click",this._collapse,this)}else this._expand();this._baseLayersList=o.DomUtil.create("div",t+"-base",i),this._separator=o.DomUtil.create("div",t+"-separator",i),this._overlaysList=o.DomUtil.create("div",t+"-overlays",i),e.appendChild(i)},_addLayer:function(t,e,i){var n=o.stamp(t);this._layers[n]={layer:t,name:e,overlay:i},this.options.autoZIndex&&t.setZIndex&&(this._lastZIndex++,t.setZIndex(this._lastZIndex))},_update:function(){if(this._container){this._baseLayersList.innerHTML="",this._overlaysList.innerHTML="";var t,e,i=!1,n=!1;for(t in this._layers)e=this._layers[t],this._addItem(e),n=n||e.overlay,i=i||!e.overlay;this._separator.style.display=n&&i?"":"none"}},_onLayerChange:function(t){var e=this._layers[o.stamp(t.layer)];if(e){this._handlingClick||this._update();var i=e.overlay?"layeradd"===t.type?"overlayadd":"overlayremove":"layeradd"===t.type?"baselayerchange":null;i&&this._map.fire(i,e)}},_createRadioElement:function(t,i){var n='t;t++)e=n[t],i=this._layers[e.layerId],e.checked&&!this._map.hasLayer(i.layer)?this._map.addLayer(i.layer):!e.checked&&this._map.hasLayer(i.layer)&&this._map.removeLayer(i.layer);this._handlingClick=!1,this._refocusOnMap()},_expand:function(){o.DomUtil.addClass(this._container,"leaflet-control-layers-expanded")},_collapse:function(){this._container.className=this._container.className.replace(" leaflet-control-layers-expanded","")}}),o.control.layers=function(t,e,i){return new o.Control.Layers(t,e,i)},o.PosAnimation=o.Class.extend({includes:o.Mixin.Events,run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._newPos=e,this.fire("start"),t.style[o.DomUtil.TRANSITION]="all "+(i||.25)+"s cubic-bezier(0,0,"+(n||.5)+",1)",o.DomEvent.on(t,o.DomUtil.TRANSITION_END,this._onTransitionEnd,this),o.DomUtil.setPosition(t,e),o.Util.falseFn(t.offsetWidth),this._stepTimer=setInterval(o.bind(this._onStep,this),50)},stop:function(){this._inProgress&&(o.DomUtil.setPosition(this._el,this._getPos()),this._onTransitionEnd(),o.Util.falseFn(this._el.offsetWidth))},_onStep:function(){var t=this._getPos();return t?(this._el._leaflet_pos=t,void this.fire("step")):void this._onTransitionEnd()},_transformRe:/([-+]?(?:\d*\.)?\d+)\D*, ([-+]?(?:\d*\.)?\d+)\D*\)/,_getPos:function(){var e,i,n,s=this._el,a=t.getComputedStyle(s);if(o.Browser.any3d){if(n=a[o.DomUtil.TRANSFORM].match(this._transformRe),!n)return;e=parseFloat(n[1]),i=parseFloat(n[2])}else e=parseFloat(a.left),i=parseFloat(a.top);return new o.Point(e,i,!0)},_onTransitionEnd:function(){o.DomEvent.off(this._el,o.DomUtil.TRANSITION_END,this._onTransitionEnd,this),this._inProgress&&(this._inProgress=!1,this._el.style[o.DomUtil.TRANSITION]="",this._el._leaflet_pos=this._newPos,clearInterval(this._stepTimer),this.fire("step").fire("end"))}}),o.Map.include({setView:function(t,e,n){if(e=e===i?this._zoom:this._limitZoom(e),t=this._limitCenter(o.latLng(t),e,this.options.maxBounds),n=n||{},this._panAnim&&this._panAnim.stop(),this._loaded&&!n.reset&&n!==!0){n.animate!==i&&(n.zoom=o.extend({animate:n.animate},n.zoom),n.pan=o.extend({animate:n.animate},n.pan));var s=this._zoom!==e?this._tryAnimatedZoom&&this._tryAnimatedZoom(t,e,n.zoom):this._tryAnimatedPan(t,n.pan);if(s)return clearTimeout(this._sizeTimer),this}return this._resetView(t,e),this},panBy:function(t,e){if(t=o.point(t).round(),e=e||{},!t.x&&!t.y)return this;if(this._panAnim||(this._panAnim=new o.PosAnimation,this._panAnim.on({step:this._onPanTransitionStep,end:this._onPanTransitionEnd},this)),e.noMoveStart||this.fire("movestart"),e.animate!==!1){o.DomUtil.addClass(this._mapPane,"leaflet-pan-anim");var i=this._getMapPanePos().subtract(t);this._panAnim.run(this._mapPane,i,e.duration||.25,e.easeLinearity)}else this._rawPanBy(t),this.fire("move").fire("moveend");return this},_onPanTransitionStep:function(){this.fire("move")},_onPanTransitionEnd:function(){o.DomUtil.removeClass(this._mapPane,"leaflet-pan-anim"),this.fire("moveend")},_tryAnimatedPan:function(t,e){var i=this._getCenterOffset(t)._floor();return(e&&e.animate)===!0||this.getSize().contains(i)?(this.panBy(i,e),!0):!1}}),o.PosAnimation=o.DomUtil.TRANSITION?o.PosAnimation:o.PosAnimation.extend({run:function(t,e,i,n){this.stop(),this._el=t,this._inProgress=!0,this._duration=i||.25,this._easeOutPower=1/Math.max(n||.5,.2),this._startPos=o.DomUtil.getPosition(t),this._offset=e.subtract(this._startPos),this._startTime=+new Date,this.fire("start"),this._animate()},stop:function(){this._inProgress&&(this._step(),this._complete())},_animate:function(){this._animId=o.Util.requestAnimFrame(this._animate,this),this._step()},_step:function(){var t=+new Date-this._startTime,e=1e3*this._duration;e>t?this._runFrame(this._easeOut(t/e)):(this._runFrame(1),this._complete())},_runFrame:function(t){var e=this._startPos.add(this._offset.multiplyBy(t));o.DomUtil.setPosition(this._el,e),this.fire("step")},_complete:function(){o.Util.cancelAnimFrame(this._animId),this._inProgress=!1,this.fire("end")},_easeOut:function(t){return 1-Math.pow(1-t,this._easeOutPower)}}),o.Map.mergeOptions({zoomAnimation:!0,zoomAnimationThreshold:4}),o.DomUtil.TRANSITION&&o.Map.addInitHook(function(){this._zoomAnimated=this.options.zoomAnimation&&o.DomUtil.TRANSITION&&o.Browser.any3d&&!o.Browser.android23&&!o.Browser.mobileOpera,this._zoomAnimated&&o.DomEvent.on(this._mapPane,o.DomUtil.TRANSITION_END,this._catchTransitionEnd,this)}),o.Map.include(o.DomUtil.TRANSITION?{_catchTransitionEnd:function(t){this._animatingZoom&&t.propertyName.indexOf("transform")>=0&&this._onZoomTransitionEnd()},_nothingToAnimate:function(){return!this._container.getElementsByClassName("leaflet-zoom-animated").length},_tryAnimatedZoom:function(t,e,i){if(this._animatingZoom)return!0;if(i=i||{},!this._zoomAnimated||i.animate===!1||this._nothingToAnimate()||Math.abs(e-this._zoom)>this.options.zoomAnimationThreshold)return!1;var n=this.getZoomScale(e),o=this._getCenterOffset(t)._divideBy(1-1/n),s=this._getCenterLayerPoint()._add(o);return i.animate===!0||this.getSize().contains(o)?(this.fire("movestart").fire("zoomstart"),this._animateZoom(t,e,s,n,null,!0),!0):!1},_animateZoom:function(t,e,i,n,s,a,r){r||(this._animatingZoom=!0),o.DomUtil.addClass(this._mapPane,"leaflet-zoom-anim"),this._animateToCenter=t,this._animateToZoom=e,o.Draggable&&(o.Draggable._disabled=!0),o.Util.requestAnimFrame(function(){this.fire("zoomanim",{center:t,zoom:e,origin:i,scale:n,delta:s,backwards:a}),setTimeout(o.bind(this._onZoomTransitionEnd,this),250)},this)},_onZoomTransitionEnd:function(){this._animatingZoom&&(this._animatingZoom=!1,o.DomUtil.removeClass(this._mapPane,"leaflet-zoom-anim"),o.Util.requestAnimFrame(function(){this._resetView(this._animateToCenter,this._animateToZoom,!0,!0),o.Draggable&&(o.Draggable._disabled=!1)},this))}}:{}),o.TileLayer.include({_animateZoom:function(t){this._animating||(this._animating=!0,this._prepareBgBuffer());var e=this._bgBuffer,i=o.DomUtil.TRANSFORM,n=t.delta?o.DomUtil.getTranslateString(t.delta):e.style[i],s=o.DomUtil.getScaleString(t.scale,t.origin);e.style[i]=t.backwards?s+" "+n:n+" "+s},_endZoomAnim:function(){var t=this._tileContainer,e=this._bgBuffer;t.style.visibility="",t.parentNode.appendChild(t),o.Util.falseFn(e.offsetWidth);var i=this._map.getZoom();(i>this.options.maxZoom||i.5&&.5>n?(t.style.visibility="hidden",void this._stopLoadingImages(t)):(e.style.visibility="hidden",e.style[o.DomUtil.TRANSFORM]="",this._tileContainer=e,e=this._bgBuffer=t,this._stopLoadingImages(e),void clearTimeout(this._clearBgBufferTimer))},_getLoadedTilesPercentage:function(t){var e,i,n=t.getElementsByTagName("img"),o=0;for(e=0,i=n.length;i>e;e++)n[e].complete&&o++;return o/i},_stopLoadingImages:function(t){var e,i,n,s=Array.prototype.slice.call(t.getElementsByTagName("img"));for(e=0,i=s.length;i>e;e++)n=s[e],n.complete||(n.onload=o.Util.falseFn,n.onerror=o.Util.falseFn,n.src=o.Util.emptyImageUrl,n.parentNode.removeChild(n))}}),o.Map.include({_defaultLocateOptions:{watch:!1,setView:!1,maxZoom:1/0,timeout:1e4,maximumAge:0,enableHighAccuracy:!1},locate:function(t){if(t=this._locateOptions=o.extend(this._defaultLocateOptions,t),!navigator.geolocation)return this._handleGeolocationError({code:0,message:"Geolocation not supported."}),this;var e=o.bind(this._handleGeolocationResponse,this),i=o.bind(this._handleGeolocationError,this);return t.watch?this._locationWatchId=navigator.geolocation.watchPosition(e,i,t):navigator.geolocation.getCurrentPosition(e,i,t),this},stopLocate:function(){return navigator.geolocation&&navigator.geolocation.clearWatch(this._locationWatchId),this._locateOptions&&(this._locateOptions.setView=!1),this},_handleGeolocationError:function(t){var e=t.code,i=t.message||(1===e?"permission denied":2===e?"position unavailable":"timeout");this._locateOptions.setView&&!this._loaded&&this.fitWorld(),this.fire("locationerror",{code:e,message:"Geolocation error: "+i+"."})},_handleGeolocationResponse:function(t){var e=t.coords.latitude,i=t.coords.longitude,n=new o.LatLng(e,i),s=180*t.coords.accuracy/40075017,a=s/Math.cos(o.LatLng.DEG_TO_RAD*e),r=o.latLngBounds([e-s,i-a],[e+s,i+a]),h=this._locateOptions;if(h.setView){var l=Math.min(this.getBoundsZoom(r),h.maxZoom);this.setView(n,l)}var u={latlng:n,bounds:r,timestamp:t.timestamp};for(var c in t.coords)"number"==typeof t.coords[c]&&(u[c]=t.coords[c]);this.fire("locationfound",u)}})}(window,document); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.hbs deleted file mode 100644 index 9c836a537..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.hbs +++ /dev/null @@ -1,146 +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. -}} -{{#if control_operations}} -
    - - {{#each control_operations}} - - {{#if iconFont}} - - {{else}} - {{#if icon}} - - {{else}} - - {{/if}} - {{/if}} - {{name}} - - -
    -
    -
    -
    -

    - - - - - {{name}} -
    -

    -

    - {{description}} -
    -

    - -
    - {{#each params.0.pathParams}} - -
    - {{/each}} - {{#each params.0.formParams}} - -
    - {{/each}} - {{#each params.0.queryParams}} - -
    - {{/each}} - {{#each uiParams}} - {{#equal this.type "checkbox"}} - - {{this.label}} -
    - {{/equal}} - {{#equal this.type "text"}} - -
    - {{/equal}} - {{/each}} - - - -
    -
    -
    -
    -
    - {{/each}} -
    -{{else}} -
    -

    - Operations Loading Failed!

    -
    -{{/if}} - - - -{{#zone "bottomJs"}} - {{js "js/operation-bar.js"}} -{{/zone}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.js deleted file mode 100644 index 30a8d397f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.js +++ /dev/null @@ -1,65 +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. - */ - -function onRequest(context) { - var log = new Log("operation.js"); - var operationModule = require("/app/modules/business-controllers/operation.js")["operationModule"]; - var device = context.unit.params.device; - var autoCompleteParams = context.unit.params.autoCompleteParams; - var encodedFeaturePayloads=context.unit.params.encodedFeaturePayloads; - var controlOperations = operationModule.getControlOperations(device); - var queryParams = []; - var formParams = []; - var pathParams = []; - for (var i = 0; i < controlOperations.length; i++) { - var currentParamList = controlOperations[i]["params"]; - var uiParamList = controlOperations[i]["uiParams"]; - for (var j = 0; j < currentParamList.length; j++) { - var currentParam = currentParamList[j]; - currentParamList[j]["formParams"] = processParams(currentParam["formParams"], autoCompleteParams); - currentParamList[j]["queryParams"] = processParams(currentParam["queryParams"], autoCompleteParams); - currentParamList[j]["pathParams"] = processParams(currentParam["pathParams"], autoCompleteParams); - } - controlOperations[i]["uiParams"] = uiParamList; - if (encodedFeaturePayloads) { - controlOperations[i]["payload"] = getPayload(encodedFeaturePayloads, controlOperations[i]["operation"]); - } - } - return {"control_operations": controlOperations, "device": device}; -} - -function processParams(paramsList, autoCompleteParams) { - for (var i = 0; i < paramsList.length; i++) { - var paramName = paramsList[i]; - var paramValue = ""; - var paramType = "text"; - for (var k = 0; k < autoCompleteParams.length; k++) { - if (paramName == autoCompleteParams[k].name) { - paramValue = autoCompleteParams[k].value; - paramType = "hidden"; - } - } - paramsList[i] = {"name": paramName, "value": paramValue, "type": paramType}; - } - return paramsList; -} - -function getPayload(featuresPayload, featureCode){ - var featuresJSONPayloads = JSON.parse(featuresPayload); - return featuresJSONPayloads[featureCode]; -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.json deleted file mode 100644 index 688e93980..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/operation-bar.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/js/operation-bar.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/js/operation-bar.js deleted file mode 100644 index 64d736076..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/js/operation-bar.js +++ /dev/null @@ -1,243 +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. - */ - -/* - * Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - * - * Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * On operation click function. - * @param selection: Selected operation - */ -function operationSelect(selection) { - $(modalPopupContent).addClass("operation-data"); - $(modalPopupContent).html($(" .operation[data-operation-code=" + selection + "]").html()); - $(modalPopupContent).data("operation-code", selection); - showPopup(); -} - -function submitForm(formId) { - var form = $("#" + formId); - var uri = form.attr("action"); - var deviceIdList = form.data("device-id"); - var contentType = form.data("content-type"); - var operationCode = form.data("operation-code"); - var uriEncodedQueryStr = ""; - var uriEncodedFormStr = ""; - var payload = {}; - form.find("input").each(function () { - var input = $(this); - var prefix; - if (input.data("param-type") === "path") { - uri = uri.replace("{" + input.attr("id") + "}", input.val()); - } else if (input.data("param-type") === "query") { - prefix = !uriEncodedQueryStr ? "?" : "&"; - uriEncodedQueryStr += prefix + input.attr("id") + "=" + input.val(); - } else if (input.data("param-type") === "form") { - prefix = !uriEncodedFormStr ? "" : "&"; - uriEncodedFormStr += prefix + input.attr("id") + "=" + input.val(); - if(input.attr("type") === "text"){ - payload[input.attr("id")] = input.val(); - } else if(input.attr("type") === "checkbox"){ - payload[input.attr("id")] = input.is(":checked"); - } - } - }); - uri += uriEncodedQueryStr; - var httpMethod = form.attr("method").toUpperCase(); - - if (!contentType) { - contentType = "application/x-www-form-urlencoded"; - payload = uriEncodedFormStr; - } - - //setting responses callbacks - var defaultStatusClasses = "fw fw-stack-1x"; - var content = $("#operation-response-template").find(".content"); - var title = content.find("#title"); - var statusIcon = content.find("#status-icon"); - var description = content.find("#description"); - description.html(""); - var successCallBack = function (response) { - var res = response; - try { - res = JSON.parse(response).messageFromServer; - } catch (err) { - //do nothing - } - title.html("Operation Triggered!"); - statusIcon.attr("class", defaultStatusClasses + " fw-check"); - description.html(res); - console.log("success!"); - $(modalPopupContent).html(content.html()); - }; - var errorCallBack = function (response) { - console.log(response); - title.html("An Error Occurred!"); - statusIcon.attr("class", defaultStatusClasses + " fw-error"); - var reason = (response.responseText === "null")?response.statusText:response.responseText; - try { - reason = JSON.parse(reason).message; - } catch (err) { - //do nothing - } - description.html(reason); - console.log("Error!"); - $(modalPopupContent).html(content.html()); - }; - //executing http request - if (httpMethod === "GET") { - invokerUtil.get(uri, successCallBack, errorCallBack, contentType); - } else if (httpMethod === "POST") { - var deviceList = deviceIdList.split(","); - payload = generatePayload(operationCode, payload, deviceList); - invokerUtil.post(uri, payload, successCallBack, errorCallBack, contentType); - } else if (httpMethod === "PUT") { - invokerUtil.put(uri, payload, successCallBack, errorCallBack, contentType); - } else if (httpMethod === "DELETE") { - invokerUtil.delete(uri, successCallBack, errorCallBack, contentType); - } else { - title.html("An Error Occurred!"); - statusIcon.attr("class", defaultStatusClasses + " fw-error"); - description.html("This operation requires http method: " + httpMethod + " which is not supported yet!"); - $(modalPopupContent).html(content.html()); - } -} - -$(document).on('submit', 'form', function (e) { - e.preventDefault(); - var postOperationRequest = $.ajax({ - url: $(this).attr("action") + '&' + $(this).serialize(), - method: "post" - }); - - var btnSubmit = $('#btnSend', this); - btnSubmit.addClass('hidden'); - - var lblSending = $('#lblSending', this); - lblSending.removeClass('hidden'); - - var lblSent = $('#lblSent', this); - postOperationRequest.done(function (data) { - lblSending.addClass('hidden'); - lblSent.removeClass('hidden'); - setTimeout(function () { - hidePopup(); - }, 3000); - }); - - postOperationRequest.fail(function (jqXHR, textStatus) { - lblSending.addClass('hidden'); - lblSent.addClass('hidden'); - }); -}); - -// Constants to define operation types available -var operationTypeConstants = { - "PROFILE": "profile", - "CONFIG": "config", - "COMMAND": "command" -}; - - -var generatePayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case windowsOperationConstants["CAMERA_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "enabled": operationData["cameraEnabled"] - } - }; - break; - case windowsOperationConstants["CHANGE_LOCK_CODE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "lockCode": operationData["lockCode"] - } - }; - break; - case windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "encrypted": operationData["encryptStorageEnabled"] - } - }; - break; - case windowsOperationConstants["NOTIFICATION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "message": operationData["message"] - } - }; - break; - case windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType === operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - return payload; -}; - - -// Constants to define Windows Operation Constants -var windowsOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE" -}; \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/templates/operation-bar.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/templates/operation-bar.hbs deleted file mode 100644 index f15d531de..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-bar/public/templates/operation-bar.hbs +++ /dev/null @@ -1,142 +0,0 @@ -{{! - Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved. - - Entgra (Pvt) Ltd. licenses this file to you under the Apache License, - Version 2.0 (the "License"); you may not use this file except - in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -}} -{{#if control_operations}} -
    - - {{#each control_operations}} - - {{#if iconFont}} - - {{else}} - {{#if icon}} - - {{else}} - - {{/if}} - {{/if}} - {{name}} - - -
    -
    -
    -
    -

    - - - - - {{name}} -
    -

    -

    - {{description}} -
    -

    - -
    - {{#each params.0.pathParams}} - -
    - {{/each}} - {{#each params.0.formParams}} - -
    - {{/each}} - {{#each params.0.queryParams}} - -
    - {{/each}} - {{#each uiParams}} - {{#equal this.type "checkbox"}} - - {{this.label}} -
    - {{/equal}} - {{#equal this.type "text"}} - -
    - {{/equal}} - {{/each}} - - - -
    -
    -
    -
    -
    - {{/each}} -
    -{{else}} -
    -

    - Operations Loading Failed!

    -
    -{{/if}} - - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.hbs deleted file mode 100644 index 8d7e6bc16..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.hbs +++ /dev/null @@ -1,20 +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. -}} -{{#zone "bottomJs"}} - {{js "js/operation-mod.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.json deleted file mode 100644 index 8fcf779d1..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/operation-mod.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "pushedUris": [ - "/policies", - "/policy/{+any}" - ], - "extends": "cdmf.unit.device.operation-mod" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js deleted file mode 100644 index b064ef186..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.operation-mod/public/js/operation-mod.js +++ /dev/null @@ -1,500 +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. - */ - -var windowsOperationModule = function () { - var publicMethods = {}; - var privateMethods = {}; - - // Constants to define operation types available - var operationTypeConstants = { - "PROFILE": "profile", - "CONFIG": "config", - "COMMAND": "command" - }; - - // Constants to define Windows Operation Constants - var windowsOperationConstants = { - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE", - "NOTIFICATION_OPERATION_CODE": "NOTIFICATION", - "CHANGE_LOCK_CODE_OPERATION_CODE": "CHANGE_LOCK_CODE" - }; - - /** - * Convert the windows platform specific code to the generic payload. - * TODO: think of the possibility to follow a pattern to the key name (namespace?) - * @param operationCode - * @param operationPayload - * @returns {{}} - */ - privateMethods.generateGenericPayloadFromWindowsPayload = function (operationCode, operationPayload) { - var payload = {}; - operationPayload = JSON.parse(operationPayload); - switch (operationCode) { - case windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - payload = { - "passcodePolicyAllowSimple": operationPayload["allowSimple"], - "passcodePolicyRequireAlphanumeric": operationPayload["requireAlphanumeric"], - "passcodePolicyMinLength": operationPayload["minLength"], - "passcodePolicyMinComplexChars": operationPayload["minComplexChars"], - "passcodePolicyMaxPasscodeAgeInDays": operationPayload["maxPINAgeInDays"], - "passcodePolicyPasscodeHistory": operationPayload["pinHistory"], - "passcodePolicyMaxFailedAttempts": operationPayload["maxFailedAttempts"] - }; - break; - case windowsOperationConstants["CAMERA_OPERATION_CODE"]: - payload = { - "cameraEnabled": operationPayload["enabled"] - }; - break; - case windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - payload = { - "encryptStorageEnabled": operationPayload["encrypted"] - }; - break; - } - return payload; - }; - - privateMethods.generateWindowsOperationPayload = function (operationCode, operationData, deviceList) { - var payload; - var operationType; - switch (operationCode) { - case windowsOperationConstants["CAMERA_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "enabled": operationData["cameraEnabled"] - } - }; - break; - case windowsOperationConstants["CHANGE_LOCK_CODE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "lockCode": operationData["lockCode"] - } - }; - break; - case windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "encrypted": operationData["encryptStorageEnabled"] - } - }; - break; - case windowsOperationConstants["NOTIFICATION_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "message": operationData["message"] - } - }; - break; - case windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]: - operationType = operationTypeConstants["PROFILE"]; - payload = { - "operation": { - "allowSimple": operationData["passcodePolicyAllowSimple"], - "requireAlphanumeric": operationData["passcodePolicyRequireAlphanumeric"], - "minLength": operationData["passcodePolicyMinLength"], - "minComplexChars": operationData["passcodePolicyMinComplexChars"], - "maxPINAgeInDays": operationData["passcodePolicyMaxPasscodeAgeInDays"], - "pinHistory": operationData["passcodePolicyPasscodeHistory"], - "maxFailedAttempts": operationData["passcodePolicyMaxFailedAttempts"] - } - }; - break; - default: - // If the operation is neither of above, it is a command operation - operationType = operationTypeConstants["COMMAND"]; - // Operation payload of a command operation is simply an array of device IDs - payload = deviceList; - } - - if (operationType == operationTypeConstants["PROFILE"] && deviceList) { - payload["deviceIDs"] = deviceList; - } - - return payload; - }; - - - publicMethods.getWindowsServiceEndpoint = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "lock-devices", - "DISENROLL": "disenroll", - "DEVICE_RING": "ring-device", - "LOCK_RESET": "lock-reset", - "WIPE_DATA": "wipe-data", - "DEVICE_LOCATION": "location", - "DEVICE_REBOOT": "reboot" - }; - return "/api/device-mgt/windows/v1.0/operation/admin/devices/" + featureMap[operationCode]; - }; - - /** - * Get the icon for the featureCode - * @param operationCode - * @returns icon class - */ - publicMethods.getWindowsIconForFeature = function (operationCode) { - var featureMap = { - "DEVICE_LOCK": "fw-lock", - "DEVICE_RING": "fw-dial-up", - "DISENROLL": "fw-export", - "LOCK_RESET": "fw-key", - "WIPE_DATA": "fw-delete", - "DEVICE_LOCATION": "location", - "DEVICE_REBOOT": "fw-refresh" - }; - return featureMap[operationCode]; - }; - - /** - * Filter a list by a data attribute. - * @param prop - * @param val - * @returns {Array} - */ - $.fn.filterByData = function (prop, val) { - return this.filter( - function () { - return $(this).data(prop) == val; - } - ); - }; - - /** - * Method to generate Platform specific operation payload. - * - * @param operationCode Operation Codes to generate the profile from - * @param deviceList Optional device list to include in payload body for operations - * @returns {*} - */ - publicMethods.generatePayload = function (operationCode, deviceList) { - var payload; - var operationData = {}; - // capturing form input data designated by .operationDataKeys - $(".operation-data").filterByData("operation-code", operationCode).find(".operationDataKeys").each( - function () { - var operationDataObj = $(this); - var key = operationDataObj.data("key"); - var value; - if (operationDataObj.is(":text") || operationDataObj.is("textarea") || - operationDataObj.is(":password") || operationDataObj.is("input[type=hidden]")) { - value = operationDataObj.val(); - operationData[key] = value; - } else if (operationDataObj.is(":checkbox")) { - value = operationDataObj.is(":checked"); - operationData[key] = value; - } else if (operationDataObj.is(":radio") && operationDataObj.is(":checked")) { - value = operationDataObj.val(); - operationData[key] = value; - } else if (operationDataObj.is("select")) { - value = operationDataObj.find("option:selected").attr("value"); - operationData[key] = value; - } else if (operationDataObj.hasClass("grouped-array-input")) { - value = []; - var childInput; - var childInputValue; - if (operationDataObj.hasClass("one-column-input-array")) { - $(".child-input", this).each(function () { - childInput = $(this); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is("input[type=hidden]")) { - childInputValue = childInput.val(); - } else if (childInput.is(":checkbox")) { - childInputValue = childInput.is(":checked"); - } else if (childInput.is("select")) { - childInputValue = childInput.find("option:selected").attr("value"); - } - // push to value - value.push(childInputValue); - }); - } else if (operationDataObj.hasClass("valued-check-box-array")) { - $(".child-input", this).each(function () { - childInput = $(this); - if (childInput.is(":checked")) { - // get associated value with check-box - childInputValue = childInput.data("value"); - // push to value - value.push(childInputValue); - } - }); - } else if (operationDataObj.hasClass("multi-column-joined-input-array")) { - var columnCount = operationDataObj.data("column-count"); - var inputCount = 0; - var joinedInput; - $(".child-input", this).each(function () { - childInput = $(this); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is("input[type=hidden]")) { - childInputValue = childInput.val(); - } else if (childInput.is(":checkbox")) { - childInputValue = childInput.is(":checked"); - } else if (childInput.is("select")) { - childInputValue = childInput.find("option:selected").attr("value"); - } - inputCount++; - if (inputCount % columnCount == 1) { - // initialize joinedInput value - joinedInput = ""; - // append childInputValue to joinedInput - joinedInput += childInputValue; - } else if ((inputCount % columnCount) >= 2) { - // append childInputValue to joinedInput - joinedInput += childInputValue; - } else { - // append childInputValue to joinedInput - joinedInput += childInputValue; - // push to value - value.push(joinedInput); - } - }); - } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) { - columnCount = operationDataObj.data("column-count"); - inputCount = 0; - var childInputKey; - var keyValuePairJson; - $(".child-input", this).each(function () { - childInput = $(this); - childInputKey = childInput.data("child-key"); - if (childInput.is(":text") || childInput.is("textarea") || childInput.is(":password") - || childInput.is("input[type=hidden]")) { - childInputValue = childInput.val(); - } else if (childInput.is(":checkbox")) { - childInputValue = childInput.is(":checked"); - } else if (childInput.is("select")) { - childInputValue = childInput.find("option:selected").attr("value"); - } - inputCount++; - if ((inputCount % columnCount) == 1) { - // initialize keyValuePairJson value - keyValuePairJson = {}; - // set key-value-pair - keyValuePairJson[childInputKey] = childInputValue; - } else if ((inputCount % columnCount) >= 2) { - // set key-value-pair - keyValuePairJson[childInputKey] = childInputValue; - } else { - // set key-value-pair - keyValuePairJson[childInputKey] = childInputValue; - // push to value - value.push(keyValuePairJson); - } - }); - } - operationData[key] = value; - } - } - ); - payload = privateMethods.generateWindowsOperationPayload(operationCode, operationData, deviceList); - return payload; - }; - - /** - * Method to populate the Platform specific operation payload. - * - * @param operationCode Operation Codes to generate the profile from - * @param operationPayload payload - * @returns {*} - */ - publicMethods.populateUI = function (operationCode, operationPayload) { - var uiPayload = privateMethods.generateGenericPayloadFromWindowsPayload(operationCode, operationPayload); - // capturing form input data designated by .operationDataKeys - $(".operation-data").filterByData("operation-code", operationCode).find(".operationDataKeys").each( - function () { - var operationDataObj = $(this); - //operationDataObj.prop('disabled', true) - var key = operationDataObj.data("key"); - // retrieve corresponding input value associated with the key - var value = uiPayload[key]; - // populating input value according to the type of input - if (operationDataObj.is(":text") || - operationDataObj.is("textarea") || - operationDataObj.is(":password") || - operationDataObj.is("input[type=hidden]")) { - operationDataObj.val(value); - } else if (operationDataObj.is(":checkbox")) { - operationDataObj.prop("checked", value); - } else if (operationDataObj.is(":radio")) { - if (operationDataObj.val() == uiPayload[key]) { - operationDataObj.attr("checked", true); - operationDataObj.trigger("click"); - } - } else if (operationDataObj.is("select")) { - operationDataObj.val(value); - /* trigger a change of value, so that if slidable panes exist, - make them slide-down or slide-up accordingly */ - operationDataObj.trigger("change"); - } else if (operationDataObj.hasClass("grouped-array-input")) { - // then value is complex - var i, childInput; - var childInputIndex = 0; - // var childInputValue; - if (operationDataObj.hasClass("one-column-input-array")) { - // generating input fields to populate complex value - if (value) { - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); - } - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - var childInputValue = value[childInputIndex]; - // populating extracted value in the UI according to the input type - if (childInput.is(":text") || - childInput.is("textarea") || - childInput.is(":password") || - childInput.is("input[type=hidden]") || - childInput.is("select")) { - childInput.val(childInputValue); - } else if (childInput.is(":checkbox")) { - operationDataObj.prop("checked", childInputValue); - } - // incrementing childInputIndex - childInputIndex++; - }); - } - } else if (operationDataObj.hasClass("valued-check-box-array")) { - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - // check if corresponding value of current checkbox exists in the array of values - if (value) { - if (value.indexOf(childInput.data("value")) != -1) { - // if YES, set checkbox as checked - childInput.prop("checked", true); - } - } - }); - } else if (operationDataObj.hasClass("multi-column-joined-input-array")) { - // generating input fields to populate complex value - if (value) { - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); - } - var columnCount = operationDataObj.data("column-count"); - var multiColumnJoinedInputArrayIndex = 0; - // handling scenarios specifically - if (operationDataObj.attr("id") == "wifi-mcc-and-mncs") { - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - var multiColumnJoinedInput = value[multiColumnJoinedInputArrayIndex]; - var childInputValue; - if ((childInputIndex % columnCount) == 0) { - childInputValue = multiColumnJoinedInput.substring(3, 0) - } else { - childInputValue = multiColumnJoinedInput.substring(3); - // incrementing childInputIndex - multiColumnJoinedInputArrayIndex++; - } - // populating extracted value in the UI according to the input type - if (childInput.is(":text") || - childInput.is("textarea") || - childInput.is(":password") || - childInput.is("input[type=hidden]") || - childInput.is("select")) { - childInput.val(childInputValue); - } else if (childInput.is(":checkbox")) { - operationDataObj.prop("checked", childInputValue); - } - // incrementing childInputIndex - childInputIndex++; - }); - } - } - } else if (operationDataObj.hasClass("multi-column-key-value-pair-array")) { - // generating input fields to populate complex value - if (value) { - for (i = 0; i < value.length; ++i) { - operationDataObj.parent().find("a").filterByData("click-event", "add-form").click(); - } - columnCount = operationDataObj.data("column-count"); - var multiColumnKeyValuePairArrayIndex = 0; - // traversing through each child input - $(".child-input", this).each(function () { - childInput = $(this); - var multiColumnKeyValuePair = value[multiColumnKeyValuePairArrayIndex]; - var childInputKey = childInput.data("child-key"); - var childInputValue = multiColumnKeyValuePair[childInputKey]; - // populating extracted value in the UI according to the input type - if (childInput.is(":text") || - childInput.is("textarea") || - childInput.is(":password") || - childInput.is("input[type=hidden]") || - childInput.is("select")) { - childInput.val(childInputValue); - } else if (childInput.is(":checkbox")) { - operationDataObj.prop("checked", childInputValue); - } - // incrementing multiColumnKeyValuePairArrayIndex for the next row of inputs - if ((childInputIndex % columnCount) == (columnCount - 1)) { - multiColumnKeyValuePairArrayIndex++; - } - // incrementing childInputIndex - childInputIndex++; - }); - } - } - } - } - ); - }; - - /** - * generateProfile method is only used for policy-creation UIs. - * - * @param operationCodes Operation codes to generate the profile from - * @returns {{}} - */ - publicMethods.generateProfile = function (operationCodes) { - var generatedProfile = {}; - for (var i = 0; i < operationCodes.length; ++i) { - var operationCode = operationCodes[i]; - var payload = publicMethods.generatePayload(operationCode, null); - generatedProfile[operationCode] = payload["operation"]; - } - return generatedProfile; - }; - - /** - * populateProfile method is used to populate the html ui with saved payload. - * - * @param payload List of profileFeatures - * @returns [] configuredOperations array - */ - publicMethods.populateProfile = function (payload) { - var i, configuredOperations = []; - for (i = 0; i < payload.length; ++i) { - var configuredFeature = payload[i]; - var featureCode = configuredFeature["featureCode"]; - var operationPayload = configuredFeature["content"]; - //push the feature-code to the configuration array - configuredOperations.push(featureCode); - publicMethods.populateUI(featureCode, operationPayload); - } - return configuredOperations; - }; - - return publicMethods; -}(); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs deleted file mode 100644 index 07fe26ebb..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.hbs +++ /dev/null @@ -1,61 +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. -}} - -
    - -
    - -

    - Device Polling Configuration -
    -

    -
    -
    - - -
    -
    -

    - End User License Agreement ( EULA ) -
    -

    -
    - -
    -
    - -
    -
    -
    - -{{#zone "bottomJs"}} - {{js "js/platform-configuration.js"}} -{{/zone}} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.json deleted file mode 100644 index fd2590129..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/configuration.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version" : "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js deleted file mode 100644 index 32b42eac4..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.platform.configuration/public/js/platform-configuration.js +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2015, 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. - */ - -// Constants to define platform types available -var platformTypeConstants = { - "WINDOWS": "windows" -}; - -var responseCodes = { - "CREATED": "Created", - "SUCCESS": "201", - "INTERNAL_SERVER_ERROR": "Internal Server Error" -}; - -var configParams = { - "NOTIFIER_TYPE": "notifierType", - "NOTIFIER_FREQUENCY": "notifierFrequency", - "FCM_API_KEY": "fcmAPIKey", - "FCM_SENDER_ID": "fcmSenderId", - "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", - "IOS_CONFIG_MDM_MODE": "iOSConfigMDMMode", - "IOS_CONFIG_APNS_MODE": "iOSConfigAPNSMode" -}; - -function promptErrorPolicyPlatform(errorMsg) { - var mainErrorMsgWrapper = "#platform-config-main-error-msg"; - var mainErrorMsg = mainErrorMsgWrapper + " span"; - $(mainErrorMsg).text(errorMsg); - $(mainErrorMsgWrapper).show(); -} - -$(document).ready(function () { - tinymce.init({ - selector: "#windows-eula", - height:500, - theme: "modern", - plugins: [ - "autoresize", - "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 windowsConfigAPI = "/api/device-mgt/windows/v1.0/configuration"; - - invokerUtil.get( - windowsConfigAPI, - 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 / 1000); - } else if (config.name == configParams["WINDOWS_EULA"]) { - $("#windows-eula").val(config.value); - } - } - } - }, function (data) { - console.log(data); - } - ); - - $("select.select2[multiple=multiple]").select2({ - tags: true - }); - - var errorMsgWrapperWindows = "#windows-config-error-msg"; - var errorMsgWindows = "#windows-config-error-msg span"; - var fileTypesWindows = ['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) { - $(errorMsgWindows).text("The File APIs are not fully supported in this browser."); - $(errorMsgWrapperWindows).removeClass("hidden"); - notSupportedError = true; - return; - } - - var file = fileInputWindowsMDMCert[0].files[0]; - fileNameWindowsMDMCert = file.name; - var extension = file.name.split('.').pop().toLowerCase(), - isSuccess = fileTypesWindows.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.activeEditor.getContent(); - - if (!notifierFrequency) { - $(errorMsgWindows).text("Polling Interval is a required field. It cannot be empty."); - $(errorMsgWrapperWindows).removeClass("hidden"); - } else if (!windowsLicense) { - $(errorMsgWindows).text("License is a required field. It cannot be empty."); - $(errorMsgWrapperWindows).removeClass("hidden"); - } else if (!$.isNumeric(notifierFrequency)) { - $(errorMsgWindows).text("Provided Notifier frequency is invalid. It must be a number."); - $(errorMsgWrapperWindows).removeClass("hidden"); - } else { - var addConfigFormData = {}; - var configList = new Array(); - - var paramNotifierFrequency = { - "name": configParams["NOTIFIER_FREQUENCY"], - "value": String(notifierFrequency * 1000), - "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 = windowsConfigAPI; - - invokerUtil.put( - addConfigAPI, - addConfigFormData, - function (data, textStatus, jqXHR) { - data = jqXHR.status; - if (data == 200) { - $("#config-save-form").addClass("hidden"); - $("#record-created-msg").removeClass("hidden"); - } else if (data == 500) { - $(errorMsgWindows).text("Exception occurred at backend."); - } else if (data == 400) { - $(errorMsgWindows).text("Configurations cannot be empty."); - } else { - $(errorMsgWindows).text("An unexpected error occurred."); - } - - $(errorMsgWrapperWindows).removeClass("hidden"); - }, function (data) { - data = data.status; - if (data == 500) { - $(errorMsgWindows).text("Exception occurred at backend."); - } else if (data == 403) { - $(errorMsgWindows).text("Action was not permitted."); - } else { - $(errorMsgWindows).text("An unexpected error occurred."); - } - $(errorMsgWrapperWindows).removeClass("hidden"); - } - ); - } - - }); -}); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs deleted file mode 100644 index 7b9952568..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.hbs +++ /dev/null @@ -1,18 +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. -}} -{{unit "cdmf.unit.policy.edit"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/policy-edit.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js deleted file mode 100644 index 1e756185b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/js/windows-policy-edit.js +++ /dev/null @@ -1,590 +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. - */ - -var configuredOperations = []; - -var windowsOperationConstants = { - "PASSCODE_POLICY_OPERATION": "passcode-policy", - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "CAMERA_OPERATION": "camera", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION": "encrypt-storage", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE" -}; - -/** - * Method to update the visibility of grouped input. - * @param domElement HTML grouped-input element with class name "grouped-input" - */ -var updateGroupedInputVisibility = function (domElement) { - if ($(".parent-input:first", domElement).is(":checked")) { - if ($(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).removeClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', false); - }); - } else { - if (!$(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).addClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', true); - }); - } -}; - -/** - * Populates policy configuration to the ui elements. - * - * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. - * - * @param profileFeatureList saved feature list - */ -var polulateProfileOperations = function (profileFeatureList) { - var selectedOperations = windowsOperationModule.populateProfile(profileFeatureList); - $(".wr-advance-operations li.grouped-input").each(function () { - updateGroupedInputVisibility(this); - }); - for (var i = 0; i < selectedOperations.length; ++i) { - var selectedOperation = selectedOperations[i]; - $(".operation-data").filterByData("operation-code", selectedOperation) - .find(".panel-title .wr-input-control.switch input[type=checkbox]").each(function () { - $(this).click(); - }); - } -}; - -/** - * Generates policy profile feature list which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {Array} profile payloads - */ -var generateProfileFeaturesList = function () { - var profilePayloads = []; - // traverses key by key in policy["profile"] - var key; - for (key in policy["profile"]) { - if (policy["profile"].hasOwnProperty(key)) { - if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { - policy["profile"][key].enablePassword = true; - } - profilePayloads.push({ - "featureCode": key, - "deviceType": policy["platform"], - "content": policy["profile"][key] - }); - } - } - return profilePayloads; -}; - -/** - * Generates policy profile object which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {object} generated profile. - */ -var generatePolicyProfile = function () { - return windowsOperationModule.generateProfile(configuredOperations); -}; - -/** - * Checks if provided number is valid against a range. - * - * @param numberInput Number Input - * @param min Minimum Limit - * @param max Maximum Limit - * @returns {boolean} Returns true if input is within the specified range - */ -var inputIsValidAgainstRange = function (numberInput, min, max) { - return (numberInput == min || (numberInput > min && numberInput < max) || numberInput == max); -}; - -/** - * Validates policy profile operations for the windows platform. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {boolean} whether validation is successful. - */ -var validatePolicyProfile = function () { - var validationStatusArray = []; - var validationStatus; - var operation; - - // starting validation process and updating validationStatus - if (configuredOperations.length == 0) { - // updating validationStatus - validationStatus = { - "error": true, - "mainErrorMsg": "You cannot continue. Zero configured features." - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } else { - // validating each and every configured Operation - // Validating PASSCODE_POLICY - if ($.inArray(windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"], configuredOperations) != -1) { - // if PASSCODE_POLICY is configured - operation = windowsOperationConstants["PASSCODE_POLICY_OPERATION"]; - // initializing continueToCheckNextInputs to true - var continueToCheckNextInputs = true; - - // validating first input: passcodePolicyMaxPasscodeAgeInDays - var passcodePolicyMaxPasscodeAgeInDays = $("input#passcode-policy-max-passcode-age-in-days").val(); - if (passcodePolicyMaxPasscodeAgeInDays) { - if (!$.isNumeric(passcodePolicyMaxPasscodeAgeInDays)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode age is not a number.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(passcodePolicyMaxPasscodeAgeInDays, 1, 730)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode age is not with in the range of 1-to-730.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } - } - - // validating second and last input: passcodePolicyPasscodeHistory - if (continueToCheckNextInputs) { - var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val(); - if (passcodePolicyPasscodeHistory) { - if (!$.isNumeric(passcodePolicyPasscodeHistory)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode history is not a number.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(passcodePolicyPasscodeHistory, 1, 50)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode history is not with in the range of 1-to-50.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } - } - } - - // at-last, if the value of continueToCheckNextInputs is still true - // this means that no error is found - if (continueToCheckNextInputs) { - validationStatus = { - "error": false, - "okFeature": operation - }; - } - - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - // Validating CAMERA - if ($.inArray(windowsOperationConstants["CAMERA_OPERATION_CODE"], configuredOperations) != -1) { - // if CAMERA is configured - operation = windowsOperationConstants["CAMERA_OPERATION"]; - // updating validationStatus - validationStatus = { - "error": false, - "okFeature": operation - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - // Validating ENCRYPT_STORAGE - if ($.inArray(windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"], configuredOperations) != -1) { - // if ENCRYPT_STORAGE is configured - operation = windowsOperationConstants["ENCRYPT_STORAGE_OPERATION"]; - // updating validationStatus - validationStatus = { - "error": false, - "okFeature": operation - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - - } - // ending validation process - - // start taking specific notifying actions upon validation - var wizardIsToBeContinued; - var errorCount = 0; - var mainErrorMsgWrapper, mainErrorMsg, - subErrorMsgWrapper, subErrorMsg, subErrorIcon, subOkIcon, featureConfiguredIcon; - var i; - for (i = 0; i < validationStatusArray.length; i++) { - validationStatus = validationStatusArray[i]; - if (validationStatus["error"]) { - errorCount++; - if (validationStatus["mainErrorMsg"]) { - mainErrorMsgWrapper = "#policy-profile-main-error-msg"; - mainErrorMsg = mainErrorMsgWrapper + " span"; - $(mainErrorMsg).text(validationStatus["mainErrorMsg"]); - $(mainErrorMsgWrapper).removeClass("hidden"); - } else if (validationStatus["subErrorMsg"]) { - subErrorMsgWrapper = "#" + validationStatus["erroneousFeature"] + "-feature-error-msg"; - subErrorMsg = subErrorMsgWrapper + " span"; - subErrorIcon = "#" + validationStatus["erroneousFeature"] + "-error"; - subOkIcon = "#" + validationStatus["erroneousFeature"] + "-ok"; - featureConfiguredIcon = "#" + validationStatus["erroneousFeature"] + "-configured"; - // hiding featureConfiguredState as the first step - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // updating error state and corresponding messages - $(subErrorMsg).text(validationStatus["subErrorMsg"]); - if ($(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).removeClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if ($(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).removeClass("hidden"); - } - } - } else { - if (validationStatus["okFeature"]) { - subErrorMsgWrapper = "#" + validationStatus["okFeature"] + "-feature-error-msg"; - subErrorIcon = "#" + validationStatus["okFeature"] + "-error"; - subOkIcon = "#" + validationStatus["okFeature"] + "-ok"; - featureConfiguredIcon = "#" + validationStatus["okFeature"] + "-configured"; - // hiding featureConfiguredState as the first step - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // updating success state and corresponding messages - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if ($(subOkIcon).hasClass("hidden")) { - $(subOkIcon).removeClass("hidden"); - } - } - } - } - - wizardIsToBeContinued = (errorCount == 0); - return wizardIsToBeContinued; -}; - -// 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(); -}; - -/** - * Method to slide down a provided pane upon provided value set. - * - * @param selectElement Select HTML Element to consider - * @param paneID HTML ID of div element to slide down - * @param valueSet Applicable Value Set - */ -var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) { - var selectedValueOnChange = $(selectElement).find("option:selected").val(); - if ($(selectElement).is("input:checkbox")) { - selectedValueOnChange = $(selectElement).is(":checked").toString(); - } - - var i, slideDownVotes = 0; - for (i = 0; i < valueSet.length; i++) { - if (selectedValueOnChange == valueSet[i]) { - slideDownVotes++; - } - } - var paneSelector = "#" + paneID; - if (slideDownVotes > 0) { - if (!$(paneSelector).hasClass("expanded")) { - $(paneSelector).addClass("expanded"); - } - $(paneSelector).slideDown(); - } else { - if ($(paneSelector).hasClass("expanded")) { - $(paneSelector).removeClass("expanded"); - } - $(paneSelector).slideUp(); - /* now follows the code to reinitialize all inputs of the slidable pane */ - // reinitializing input fields into the defaults - $(paneSelector + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(paneSelector + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(paneSelector + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(paneSelector + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); - } -}; -// End of HTML embedded invoke methods - -// Start of functions related to grid-input-view -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var setId = function (addFormContainer) { - $(addFormContainer).find("[data-add-form-clone]").each(function (i) { - $(this).attr("id", $(this).attr("data-add-form-clone").slice(1) + "-" + (i + 1)); - if ($(this).find(".index").length > 0) { - $(this).find(".index").html(i + 1); - } - }); -}; - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var showHideHelpText = function (addFormContainer) { - var helpText = "[data-help-text=add-form]"; - if ($(addFormContainer).find("[data-add-form-clone]").length > 0) { - $(addFormContainer).find(helpText).hide(); - } else { - $(addFormContainer).find(helpText).show(); - } -}; - -$(document).ready(function () { - // Maintains an array of configured features of the profile - var advanceOperations = ".wr-advance-operations"; - $(advanceOperations).on("click", ".wr-input-control.switch", function (event) { - var operationCode = $(this).parents(".operation-data").data("operation-code"); - var operation = $(this).parents(".operation-data").data("operation"); - var operationDataWrapper = $(this).data("target"); - // prevents event bubbling by figuring out what element it's being called from. - if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; - - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); - } - } - }); - - // - $(advanceOperations).on('hidden.bs.collapse', function (event) { - var collapsedFeatureBody = event.target.id; - var operation = collapsedFeatureBody.substr(0, collapsedFeatureBody.lastIndexOf("-")); - var featureConfiguringSwitch = "#" + operation + "-heading input[type=checkbox]"; - var featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguringSwitch).prop("checked") == true) { - $(featureConfiguringSwitch).prop("checked", false); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - }); - - $(advanceOperations).on('shown.bs.collapse', function (event) { - var expandedFeatureBody = event.target.id; - var operation = expandedFeatureBody.substr(0, expandedFeatureBody.lastIndexOf("-")); - var featureConfiguringSwitch = "#" + operation + "-heading input[type=checkbox]"; - var featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguringSwitch).prop("checked") == false) { - $(featureConfiguringSwitch).prop("checked", true); - } - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - }); - // - - // adding support for cloning multiple profiles per feature with cloneable class definitions - $(advanceOperations).on("click", ".multi-view.add.enabled", function () { - // get a copy of .cloneable and create new .cloned div element - var cloned = "

    " + $(".cloneable", $(this).parent().parent()).html() + "
    "; - // append newly created .cloned div element to panel-body - $(this).parent().parent().append(cloned); - // enable remove action of newly cloned div element - $(".cloned", $(this).parent().parent()).each( - function () { - if ($(".multi-view.remove", this).hasClass("disabled")) { - $(".multi-view.remove", this).removeClass("disabled"); - } - if (!$(".multi-view.remove", this).hasClass("enabled")) { - $(".multi-view.remove", this).addClass("enabled"); - } - } - ); - }); - - $(advanceOperations).on("click", ".multi-view.remove.enabled", function () { - $(this).parent().remove(); - }); - - // enabling or disabling grouped-input based on the status of a parent check-box - $(advanceOperations).on("click", ".grouped-input", function () { - updateGroupedInputVisibility(this); - }); - - // add form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=add-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - var clonedForm = $("[data-add-form=" + $(this).attr("href") + "]").clone().find("[data-add-form-element=clone]") - .attr("data-add-form-clone", $(this).attr("href")); - - // adding class .child-input to capture text-input-array-values - $("input, select", clonedForm).addClass("child-input"); - - $(addFormContainer).append(clonedForm); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); - - // remove form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=remove-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - - $(this).closest("[data-add-form-element=clone]").remove(); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); -}); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/templates/windows-policy-edit.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/templates/windows-policy-edit.hbs deleted file mode 100644 index 5b97a6692..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-edit/public/templates/windows-policy-edit.hbs +++ /dev/null @@ -1,391 +0,0 @@ -
    - - -
    - -
    -
    - -
    -
    - - -
    - -
    - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable camera. -
    -
    -
    - -
    -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable storage-encryption. -
    -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    - - - - -
    - -
    - - - - - - - - - - - - - - -
    No:Application Name/DescriptionPackage Name
    - No entries added yet . -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs deleted file mode 100644 index e1454e050..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.hbs +++ /dev/null @@ -1,18 +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. -}} -{{unit "cdmf.unit.policy.view"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/policy-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js deleted file mode 100644 index 9280bec14..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/js/windows-policy-view.js +++ /dev/null @@ -1,186 +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. - */ - -/** - * Method to update the visibility (i.e. disabled or enabled view) - * of grouped input according to the values - * that they currently possess. - * @param domElement HTML grouped-input element with class name "grouped-input" - */ -var updateGroupedInputVisibility = function (domElement) { - if ($(".parent-input:first", domElement).is(":checked")) { - if ($(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).removeClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', false); - }); - } else { - if (!$(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).addClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', true); - }); - } -}; - -/** - * Populates policy configuration to the ui elements. - * - * This method will be invoked from the relevant cdmf unit when the edit page gets loaded. - * - * @param profileFeatureList selected configurations. - */ -var polulateProfileOperations = function (profileFeatureList) { - var selectedConfigurations = windowsOperationModule.populateProfile(profileFeatureList); - $(".wr-advance-operations li.grouped-input").each(function () { - updateGroupedInputVisibility(this); - }); - // enabling previously configured options of last update - for (var i = 0; i < selectedConfigurations.length; ++i) { - var selectedOperation = selectedConfigurations[i]; - $(".operation-data").filterByData("operation-code", selectedOperation) - .find(".panel-title .wr-input-control.switch input[type=checkbox]").each(function () { - $(this).click(); - }); - } -}; - -// 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(); -}; - -/** - * Method to slide down a provided pane upon provided value set. - * - * @param selectElement Select HTML Element to consider - * @param paneID HTML ID of div element to slide down - * @param valueSet Applicable Value Set - */ -var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) { - var selectedValueOnChange = $(selectElement).find("option:selected").val(); - if ($(selectElement).is("input:checkbox")) { - selectedValueOnChange = $(selectElement).is(":checked").toString(); - } - - var i, slideDownVotes = 0; - for (i = 0; i < valueSet.length; i++) { - if (selectedValueOnChange == valueSet[i]) { - slideDownVotes++; - } - } - var paneSelector = "#" + paneID; - if (slideDownVotes > 0) { - if (!$(paneSelector).hasClass("expanded")) { - $(paneSelector).addClass("expanded"); - } - $(paneSelector).slideDown(); - } else { - if ($(paneSelector).hasClass("expanded")) { - $(paneSelector).removeClass("expanded"); - } - $(paneSelector).slideUp(); - /* now follows the code to reinitialize all inputs of the slidable pane. - reinitializing input fields into the defaults.*/ - $(paneSelector + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - } - } - } - ); - // reinitializing select fields into the defaults - $(paneSelector + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(paneSelector + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(paneSelector + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); - } -}; - -var slideDownPaneAgainstValueSetForRadioButtons = function (selectElement, paneID, valueSet) { - var selectedValueOnChange = selectElement.value; - var slideDownVotes = 0; - for (var i = 0; i < valueSet.length; i++) { - if (selectedValueOnChange == valueSet[i]) { - slideDownVotes++; - } - } - var paneSelector = "#" + paneID; - if (slideDownVotes > 0) { - $(paneSelector).removeClass("hidden"); - } else { - $(paneSelector).addClass("hidden"); - } -}; -// End of HTML embedded invoke methods - -$(document).ready(function () { - var advanceOperations = ".wr-advance-operations"; - $(advanceOperations).on("click", ".wr-input-control.switch", function (event) { - var operation = $(this).parents(".operation-data").data("operation"); - // prevents event bubbling by figuring out what element it's being called from. - if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - } - } - }); -}); \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/templates/windows-policy-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/templates/windows-policy-view.hbs deleted file mode 100644 index cbf6f558e..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-view/public/templates/windows-policy-view.hbs +++ /dev/null @@ -1,288 +0,0 @@ -
    - - -
    - -
    -
    - -
    -
    - - -
    - -
    - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable camera. -
    -
    -
    - -
    -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable storage-encryption. -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs deleted file mode 100644 index 9e1fd3b09..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.hbs +++ /dev/null @@ -1,18 +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. -}} -{{unit "mdm.unit.policy.wizard"}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/policy-wizard.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js deleted file mode 100644 index 4f8c121d0..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/js/windows-policy-operations.js +++ /dev/null @@ -1,578 +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. - */ - -var configuredOperations = []; - -var windowsOperationConstants = { - "PASSCODE_POLICY_OPERATION": "passcode-policy", - "PASSCODE_POLICY_OPERATION_CODE": "PASSCODE_POLICY", - "CAMERA_OPERATION": "camera", - "CAMERA_OPERATION_CODE": "CAMERA", - "ENCRYPT_STORAGE_OPERATION": "encrypt-storage", - "ENCRYPT_STORAGE_OPERATION_CODE": "ENCRYPT_STORAGE" -}; - -/** - * Method to update the visibility of grouped input. - * @param domElement HTML grouped-input element with class name "grouped-input" - */ -var updateGroupedInputVisibility = function (domElement) { - if ($(".parent-input:first", domElement).is(":checked")) { - if ($(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).removeClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', false); - }); - } else { - if (!$(".grouped-child-input:first", domElement).hasClass("disabled")) { - $(".grouped-child-input:first", domElement).addClass("disabled"); - } - $(".child-input", domElement).each(function () { - $(this).prop('disabled', true); - }); - } -}; - -/** - * Checks if provided number is valid against a range. - * - * @param numberInput Number Input - * @param min Minimum Limit - * @param max Maximum Limit - * @returns {boolean} Returns true if input is within the specified range - */ -var inputIsValidAgainstRange = function (numberInput, min, max) { - return (numberInput == min || (numberInput > min && numberInput < max) || numberInput == max); -}; - -/** - * Validates policy profile operations for the windows platform. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {boolean} whether validation is successful. - */ -var validatePolicyProfile = function () { - var validationStatusArray = []; - var validationStatus; - var operation; - - // starting validation process and updating validationStatus - if (configuredOperations.length == 0) { - // updating validationStatus - validationStatus = { - "error": true, - "mainErrorMsg": "You cannot continue. Zero configured features." - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } else { - // validating each and every configured Operation - // Validating PASSCODE_POLICY - if ($.inArray(windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"], configuredOperations) != -1) { - // if PASSCODE_POLICY is configured - operation = windowsOperationConstants["PASSCODE_POLICY_OPERATION"]; - // initializing continueToCheckNextInputs to true - var continueToCheckNextInputs = true; - - // validating first input: passcodePolicyMaxPasscodeAgeInDays - var passcodePolicyMaxPasscodeAgeInDays = $("input#passcode-policy-max-passcode-age-in-days").val(); - if (passcodePolicyMaxPasscodeAgeInDays) { - if (!$.isNumeric(passcodePolicyMaxPasscodeAgeInDays)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode age is not a number.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(passcodePolicyMaxPasscodeAgeInDays, 1, 730)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode age is not with in the range of 1-to-730.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } - } - - // validating second and last input: passcodePolicyPasscodeHistory - if (continueToCheckNextInputs) { - var passcodePolicyPasscodeHistory = $("input#passcode-policy-passcode-history").val(); - if (passcodePolicyPasscodeHistory) { - if (!$.isNumeric(passcodePolicyPasscodeHistory)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode history is not a number.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } else if (!inputIsValidAgainstRange(passcodePolicyPasscodeHistory, 1, 50)) { - validationStatus = { - "error": true, - "subErrorMsg": "Provided passcode history is not with in the range of 1-to-50.", - "erroneousFeature": operation - }; - continueToCheckNextInputs = false; - } - } - } - - // at-last, if the value of continueToCheckNextInputs is still true - // this means that no error is found - if (continueToCheckNextInputs) { - validationStatus = { - "error": false, - "okFeature": operation - }; - } - - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - // Validating CAMERA - if ($.inArray(windowsOperationConstants["CAMERA_OPERATION_CODE"], configuredOperations) != -1) { - // if CAMERA is configured - operation = windowsOperationConstants["CAMERA_OPERATION"]; - // updating validationStatus - validationStatus = { - "error": false, - "okFeature": operation - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - // Validating ENCRYPT_STORAGE - if ($.inArray(windowsOperationConstants["ENCRYPT_STORAGE_OPERATION_CODE"], configuredOperations) != -1) { - // if ENCRYPT_STORAGE is configured - operation = windowsOperationConstants["ENCRYPT_STORAGE_OPERATION"]; - // updating validationStatus - validationStatus = { - "error": false, - "okFeature": operation - }; - // updating validationStatusArray with validationStatus - validationStatusArray.push(validationStatus); - } - - } - // ending validation process - - // start taking specific notifying actions upon validation - var wizardIsToBeContinued; - var errorCount = 0; - var mainErrorMsgWrapper, mainErrorMsg, - subErrorMsgWrapper, subErrorMsg, subErrorIcon, subOkIcon, featureConfiguredIcon; - var i; - for (i = 0; i < validationStatusArray.length; i++) { - validationStatus = validationStatusArray[i]; - if (validationStatus["error"]) { - errorCount++; - if (validationStatus["mainErrorMsg"]) { - mainErrorMsgWrapper = "#policy-profile-main-error-msg"; - mainErrorMsg = mainErrorMsgWrapper + " span"; - $(mainErrorMsg).text(validationStatus["mainErrorMsg"]); - $(mainErrorMsgWrapper).removeClass("hidden"); - } else if (validationStatus["subErrorMsg"]) { - subErrorMsgWrapper = "#" + validationStatus["erroneousFeature"] + "-feature-error-msg"; - subErrorMsg = subErrorMsgWrapper + " span"; - subErrorIcon = "#" + validationStatus["erroneousFeature"] + "-error"; - subOkIcon = "#" + validationStatus["erroneousFeature"] + "-ok"; - featureConfiguredIcon = "#" + validationStatus["erroneousFeature"] + "-configured"; - // hiding featureConfiguredState as the first step - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // updating error state and corresponding messages - $(subErrorMsg).text(validationStatus["subErrorMsg"]); - if ($(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).removeClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if ($(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).removeClass("hidden"); - } - } - } else { - if (validationStatus["okFeature"]) { - subErrorMsgWrapper = "#" + validationStatus["okFeature"] + "-feature-error-msg"; - subErrorIcon = "#" + validationStatus["okFeature"] + "-error"; - subOkIcon = "#" + validationStatus["okFeature"] + "-ok"; - featureConfiguredIcon = "#" + validationStatus["okFeature"] + "-configured"; - // hiding featureConfiguredState as the first step - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // updating success state and corresponding messages - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if ($(subOkIcon).hasClass("hidden")) { - $(subOkIcon).removeClass("hidden"); - } - } - } - } - - wizardIsToBeContinued = (errorCount == 0); - return wizardIsToBeContinued; -}; - -/** - * Generates policy profile feature list which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {Array} profile payloads - */ -var generateProfileFeaturesList = function () { - var profilePayloads = []; - // traverses key by key in policy["profile"] - var key; - for (key in policy["profile"]) { - if (policy["profile"].hasOwnProperty(key)) { - if (key == windowsOperationConstants["PASSCODE_POLICY_OPERATION_CODE"]) { - policy["profile"][key].enablePassword = true; - } - profilePayloads.push({ - "featureCode": key, - "deviceType": policy["platform"], - "content": policy["profile"][key] - }); - } - } - return profilePayloads; -}; - -/** - * Generates policy profile object which will be saved with the profile. - * - * This function will be invoked from the relevant cdmf unit at the time of policy creation. - * - * @returns {object} generated profile. - */ -var generatePolicyProfile = function () { - return windowsOperationModule.generateProfile(configuredOperations); -}; - -/** - * Resets policy profile configurations. - */ -var resetPolicyProfile = function () { - configuredOperations = []; -}; - -// 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(); -}; - -/** - * Method to slide down a provided pane upon provided value set. - * - * @param selectElement Select HTML Element to consider - * @param paneID HTML ID of div element to slide down - * @param valueSet Applicable Value Set - */ -var slideDownPaneAgainstValueSet = function (selectElement, paneID, valueSet) { - var selectedValueOnChange = $(selectElement).find("option:selected").val(); - if ($(selectElement).is("input:checkbox")) { - selectedValueOnChange = $(selectElement).is(":checked").toString(); - } - - var i, slideDownVotes = 0; - for (i = 0; i < valueSet.length; i++) { - if (selectedValueOnChange == valueSet[i]) { - slideDownVotes++; - } - } - var paneSelector = "#" + paneID; - if (slideDownVotes > 0) { - if (!$(paneSelector).hasClass("expanded")) { - $(paneSelector).addClass("expanded"); - } - $(paneSelector).slideDown(); - } else { - if ($(paneSelector).hasClass("expanded")) { - $(paneSelector).removeClass("expanded"); - } - $(paneSelector).slideUp(); - /** now follows the code to reinitialize all inputs of the slidable pane */ - // reinitializing input fields into the defaults - $(paneSelector + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(paneSelector + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(paneSelector + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(paneSelector + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); - } -}; -// End of HTML embedded invoke methods - - -// Start of functions related to grid-input-view - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var setId = function (addFormContainer) { - $(addFormContainer).find("[data-add-form-clone]").each(function (i) { - $(this).attr("id", $(this).attr("data-add-form-clone").slice(1) + "-" + (i + 1)); - if ($(this).find(".index").length > 0) { - $(this).find(".index").html(i + 1); - } - }); -}; - -/** - * Method to set count id to cloned elements. - * @param {object} addFormContainer - */ -var showHideHelpText = function (addFormContainer) { - var helpText = "[data-help-text=add-form]"; - if ($(addFormContainer).find("[data-add-form-clone]").length > 0) { - $(addFormContainer).find(helpText).hide(); - } else { - $(addFormContainer).find(helpText).show(); - } -}; - -$(document).ready(function () { - // Maintains an array of configured features of the profile - var advanceOperations = ".wr-advance-operations"; - $(advanceOperations).on("click", ".wr-input-control.switch", function (event) { - var operationCode = $(this).parents(".operation-data").data("operation-code"); - var operation = $(this).parents(".operation-data").data("operation"); - var operationDataWrapper = $(this).data("target"); - // prevents event bubbling by figuring out what element it's being called from. - if (event.target.tagName == "INPUT") { - var featureConfiguredIcon; - if ($("input[type='checkbox']", this).is(":checked")) { - configuredOperations.push(operationCode); - // when a feature is enabled, if "zero-configured-features" msg is available, hide that. - var zeroConfiguredOperationsErrorMsg = "#policy-profile-main-error-msg"; - if (!$(zeroConfiguredOperationsErrorMsg).hasClass("hidden")) { - $(zeroConfiguredOperationsErrorMsg).addClass("hidden"); - } - // add configured-state-icon to the feature - featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - } else { - //splicing the array if operation is present. - var index = $.inArray(operationCode, configuredOperations); - if (index != -1) { - configuredOperations.splice(index, 1); - } - // when a feature is disabled, clearing all its current configured, error or success states - var subErrorMsgWrapper = "#" + operation + "-feature-error-msg"; - var subErrorIcon = "#" + operation + "-error"; - var subOkIcon = "#" + operation + "-ok"; - featureConfiguredIcon = "#" + operation + "-configured"; - - if (!$(subErrorMsgWrapper).hasClass("hidden")) { - $(subErrorMsgWrapper).addClass("hidden"); - } - if (!$(subErrorIcon).hasClass("hidden")) { - $(subErrorIcon).addClass("hidden"); - } - if (!$(subOkIcon).hasClass("hidden")) { - $(subOkIcon).addClass("hidden"); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - // reinitializing input fields into the defaults - $(operationDataWrapper + " input").each( - function () { - if ($(this).is("input:text")) { - $(this).val($(this).data("default")); - } else if ($(this).is("input:password")) { - $(this).val(""); - } else if ($(this).is("input:checkbox")) { - $(this).prop("checked", $(this).data("default")); - // if this checkbox is the parent input of a grouped-input - if ($(this).hasClass("parent-input")) { - var groupedInput = $(this).parent().parent().parent(); - updateGroupedInputVisibility(groupedInput); - } - } - } - ); - // reinitializing select fields into the defaults - $(operationDataWrapper + " select").each( - function () { - var defaultOption = $(this).data("default"); - $("option:eq(" + defaultOption + ")", this).prop("selected", "selected"); - } - ); - // collapsing expanded-panes (upon the selection of html-select-options) if any - $(operationDataWrapper + " .expanded").each( - function () { - if ($(this).hasClass("expanded")) { - $(this).removeClass("expanded"); - } - $(this).slideUp(); - } - ); - // removing all entries of grid-input elements if exist - $(operationDataWrapper + " .grouped-array-input").each( - function () { - var gridInputs = $(this).find("[data-add-form-clone]"); - if (gridInputs.length > 0) { - gridInputs.remove(); - } - var helpTexts = $(this).find("[data-help-text=add-form]"); - if (helpTexts.length > 0) { - helpTexts.show(); - } - } - ); - } - } - }); - - // - $(advanceOperations).on('hidden.bs.collapse', function (event) { - var collapsedFeatureBody = event.target.id; - var operation = collapsedFeatureBody.substr(0, collapsedFeatureBody.lastIndexOf("-")); - var featureConfiguringSwitch = "#" + operation + "-heading input[type=checkbox]"; - var featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguringSwitch).prop("checked") == true) { - $(featureConfiguringSwitch).prop("checked", false); - } - if (!$(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).addClass("hidden"); - } - }); - - $(advanceOperations).on('shown.bs.collapse', function (event) { - var expandedFeatureBody = event.target.id; - var operation = expandedFeatureBody.substr(0, expandedFeatureBody.lastIndexOf("-")); - var featureConfiguringSwitch = "#" + operation + "-heading input[type=checkbox]"; - var featureConfiguredIcon = "#" + operation + "-configured"; - if ($(featureConfiguringSwitch).prop("checked") == false) { - $(featureConfiguringSwitch).prop("checked", true); - } - if ($(featureConfiguredIcon).hasClass("hidden")) { - $(featureConfiguredIcon).removeClass("hidden"); - } - }); - // - - // adding support for cloning multiple profiles per feature with cloneable class definitions - $(advanceOperations).on("click", ".multi-view.add.enabled", function () { - // get a copy of .cloneable and create new .cloned div element - var cloned = "

    " + $(".cloneable", $(this).parent().parent()).html() + "
    "; - // append newly created .cloned div element to panel-body - $(this).parent().parent().append(cloned); - // enable remove action of newly cloned div element - $(".cloned", $(this).parent().parent()).each( - function () { - if ($(".multi-view.remove", this).hasClass("disabled")) { - $(".multi-view.remove", this).removeClass("disabled"); - } - if (!$(".multi-view.remove", this).hasClass("enabled")) { - $(".multi-view.remove", this).addClass("enabled"); - } - } - ); - }); - - $(advanceOperations).on("click", ".multi-view.remove.enabled", function () { - $(this).parent().remove(); - }); - - // enabling or disabling grouped-input based on the status of a parent check-box - $(advanceOperations).on("click", ".grouped-input", function () { - updateGroupedInputVisibility(this); - }); - - // add form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=add-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - var clonedForm = $("[data-add-form=" + $(this).attr("href") + "]").clone().find("[data-add-form-element=clone]") - .attr("data-add-form-clone", $(this).attr("href")); - - // adding class .child-input to capture text-input-array-values - $("input, select", clonedForm).addClass("child-input"); - - $(addFormContainer).append(clonedForm); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); - - // remove form entry click function for grid inputs - $(advanceOperations).on("click", "[data-click-event=remove-form]", function () { - var addFormContainer = $("[data-add-form-container=" + $(this).attr("href") + "]"); - - $(this).closest("[data-add-form-element=clone]").remove(); - setId(addFormContainer); - showHideHelpText(addFormContainer); - }); -}); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/templates/windows-policy-operations.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/templates/windows-policy-operations.hbs deleted file mode 100644 index 5b97a6692..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.policy-wizard/public/templates/windows-policy-operations.hbs +++ /dev/null @@ -1,391 +0,0 @@ -
    - - -
    - -
    -
    - -
    -
    - - -
    - -
    - -
    - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    - -
    - - -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable camera. -
    -
    -
    - -
    -
    -
    -
    -
    - - - -
    -
    - -
    -
    - - Un-check following checkbox in case you need to disable storage-encryption. -
    -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    - - - - -
    - -
    - - - - - - - - - - - - - - -
    No:Application Name/DescriptionPackage Name
    - No entries added yet . -
    - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json deleted file mode 100644 index d6f50da06..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/private/config.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "deviceType": { - "label": "Windows", - "category": "mobile", - "scopes" : [ - "perm:windows:enroll", - "perm:windows:lock-devices", - "perm:windows:ring", - "perm:windows:wipe", - "perm:windows:lock-reset", - "perm:windows:reboot", - "perm:windows:location", - "perm:windows:disenroll", - "perm:windows:manage-configuration", - "perm:windows:view-configuration" - ], - "analyticsEnabled": "false", - "groupingEnabled": "false", - "features": { - "DEVICE_RING": { - "icon": "fw-dial-up", - "permission": "/device-mgt/devices/owning-device/operations/android/ring" - }, - "DEVICE_LOCK": { - "icon": "fw-lock", - "permission": "/device-mgt/devices/owning-device/operations/windows/lock" - }, - "DEVICE_LOCATION": { - "icon": "fw-map-location", - "permission": "/device-mgt/devices/owning-device/operations/windows/location" - }, - "DEVICE_REBOOT": { - "icon": "fw-refresh", - "permission": "/device-mgt/devices/owning-device/operations/windows/reboot" - }, - "LOCK_RESET": { - "icon": "fw-security", - "permission": "/device-mgt/devices/owning-device/operations/windows/lock-reset" - - }, - "DISENROLL": { - "icon": "fw-block", - "permission": "/device-mgt/devices/owning-device/operations/windows/disenroll" - }, - "WIPE_DATA": { - "icon": "fw-delete", - "permission": "/device-mgt/devices/owning-device/operations/windows/wipe" - } - } - } -} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/css/styles.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/css/styles.css deleted file mode 100644 index 04e2a2611..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/css/styles.css +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * Licensed 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. - */ -.circle { - background: none repeat scroll 0 0 #191919; - border-radius: 50px; - height: 50px; - padding: 10px; - width: 50px; - color: #fff; -} -.padding-top-double { - padding-top: 20px; -} -.padding-double { - padding: 20px; -} -.grey { - color: #333; -} -hr { - display: block; - height: 1px; - border: 0; - border-top: 1px solid #7f7f7f; - margin: 1em 0; - padding: 0; - opacity: 0.2; -} -.light-grey { - color: #7c7c7c; -} -.uppercase { - text-transform: uppercase; -} -.grey-bg { - background-color: #f6f4f4; -} - -.doc-link { - background: #11375B; - padding: 20px; - color: white; - margin-top: 0; -} - -.doc-link a { - color: white; -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png deleted file mode 100644 index f4541a6ec..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/thumb.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png deleted file mode 100644 index d7cd5ecef..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows-icon.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png deleted file mode 100644 index 4f7670755..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/images/windows_enrollment.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/js/type-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/js/type-view.js deleted file mode 100644 index 9d6bcd266..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/public/js/type-view.js +++ /dev/null @@ -1,388 +0,0 @@ -/* - * Copyright (c) 2015, 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 modalPopup = ".modal", - modalPopupContainer = modalPopup + " .modal-content", - modalPopupContent = modalPopup + " .modal-content"; - -var emmAdminBasePath = "/api/device-mgt/v1.0"; - -//function openCollapsedNav() { -// $(".wr-hidden-nav-toggle-btn").addClass("active"); -// $("#hiddenNav").slideToggle("slideDown", function () { -// if ($(this).css("display") == "none") { -// $(".wr-hidden-nav-toggle-btn").removeClass("active"); -// } -// }); -//} - -/* - * set popup maximum height function. - */ -function setPopupMaxHeight() { - var maxHeight = "max-height"; - var marginTop = "margin-top"; - var body = "body"; - $(modalPopupContent).css(maxHeight, ($(body).height() - ($(body).height() / 100 * 30))); - $(modalPopupContainer).css(marginTop, (-($(modalPopupContainer).height() / 2))); -} - -/* - * show popup function. - */ -function showPopup() { - $(modalPopup).modal('show'); -} - -/* - * hide popup function. - */ -function hidePopup() { - $(modalPopupContent).html(""); - $(modalPopupContent).removeClass("operation-data"); - $(modalPopup).modal('hide'); - $('body').removeClass('modal-open').css('padding-right','0px'); - $('.modal-backdrop').remove(); -} - -/* - * QR-code generation function. - */ -function generateQRCode(qrCodeClass) { - var enrollmentURL = $("#qr-code-modal").data("enrollment-url"); - $(qrCodeClass).qrcode({ - text: enrollmentURL, - width: 200, - height: 200 - }); -} - -function toggleEnrollment() { - $(".modal-content").html($("#qr-code-modal").html()); - generateQRCode(".modal-content .qr-code"); - modalDialog.show(); -} - -var updateNotificationCountOnSuccess = function (data, textStatus, jqXHR) { - var notificationBubble = "#notification-bubble"; - if (jqXHR.status == 200 && data) { - var responsePayload = JSON.parse(data); - var newNotificationsCount = responsePayload["count"]; - if (newNotificationsCount > 0) { - $(notificationBubble).html(newNotificationsCount); - $(notificationBubble).show(); - } else { - $(notificationBubble).hide(); - } - } -}; - -function updateNotificationCountOnError() { - var notificationBubble = "#notification-bubble"; - $(notificationBubble).html("Error"); - $(notificationBubble).show(); -} - -function loadNewNotificationsOnSideViewPanel() { - if ($("#right-sidebar").attr("is-authorized") == "false") { - $("#notification-bubble-wrapper").remove(); - } else { - var serviceURL = emmAdminBasePath + "/notifications?status=NEW"; - invokerUtil.get(serviceURL, updateNotificationCountOnSuccess, updateNotificationCountOnError); - loadNewNotifications(); - } -} - -function loadNewNotifications() { - var messageSideBar = ".sidebar-messages"; - if ($("#right-sidebar").attr("is-authorized") == "false") { - $(messageSideBar).html("

    You are not authorized to view notifications.

    "); - } else { - var notifications = $("#notifications"); - var currentUser = notifications.data("currentUser"); - - $.template("notification-listing", notifications.attr("src"), function (template) { - var serviceURL = emmAdminBasePath + "/notifications?offset=0&limit=5&status=NEW"; - invokerUtil.get( - serviceURL, - // on success - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - var viewModel = {}; - var responsePayload = JSON.parse(data); - if (responsePayload["notifications"]) { - if (responsePayload.count > 0) { - viewModel["notifications"] = responsePayload["notifications"]; - viewModel["appContext"] = context; - $(messageSideBar).html(template(viewModel)); - } else { - $(messageSideBar).html("

    No New Notifications

    " + - "
    " + - "Check this section for error notifications
    related to device operations" + - "
    "); - } - } else { - $(messageSideBar).html("

    Unexpected error " + - "occurred while loading new notifications.

    "); - } - } - }, - // on error - function (jqXHR) { - if (jqXHR.status = 500) { - $(messageSideBar).html("

    Unexpected error occurred while trying " + - "to retrieve any new notifications.

    "); - } - } - ); - }); - } -} - -/** - * Toggle function for - * notification listing sidebar. - * @return {Null} - */ -$.sidebar_toggle = function (action, target, container) { - var elem = '[data-toggle=sidebar]', - button, - containerOffsetLeft, - containerOffsetRight, - targetOffsetLeft, - targetOffsetRight, - targetWidth, - targetSide, - relationship, - pushType, - buttonParent; - - var sidebar_window = { - update: function (target, container, button) { - containerOffsetLeft = $(container).data('offset-left') ? $(container).data('offset-left') : 0; - containerOffsetRight = $(container).data('offset-right') ? $(container).data('offset-right') : 0; - targetOffsetLeft = $(target).data('offset-left') ? $(target).data('offset-left') : 0; - targetOffsetRight = $(target).data('offset-right') ? $(target).data('offset-right') : 0; - targetWidth = $(target).data('width'); - targetSide = $(target).data("side"); - pushType = $(container).parent().is('body') == true ? 'padding' : 'margin'; - - if (button !== undefined) { - relationship = button.attr('rel') ? button.attr('rel') : ''; - buttonParent = $(button).parent(); - } - }, - - show: function () { - if ($(target).data('sidebar-fixed') == true) { - $(target).height($(window).height() - $(target).data('fixed-offset')); - } - $(target).trigger('show.sidebar'); - if (targetWidth !== undefined) { - $(target).css('width', targetWidth); - } - $(target).addClass('toggled'); - if (button !== undefined) { - if (relationship !== '') { - // Removing active class from all relative buttons - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active"); - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false'); - } - // Adding active class to button - if (button.attr('data-handle') !== 'close') { - button.addClass("active"); - button.attr('aria-expanded', 'true'); - } - if (buttonParent.is('li')) { - if (relationship !== '') { - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active"); - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false'); - } - buttonParent.addClass("active"); - buttonParent.attr('aria-expanded', 'true'); - } - } - // Sidebar open function - if (targetSide == 'left') { - if ((button !== undefined) && (button.attr('data-container-divide'))) { - $(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetLeft); - } - $(target).css(targetSide, targetOffsetLeft); - } else if (targetSide == 'right') { - if ((button !== undefined) && (button.attr('data-container-divide'))) { - $(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetRight); - } - $(target).css(targetSide, targetOffsetRight); - } - $(target).trigger('shown.sidebar'); - }, - - hide: function () { - $(target).trigger('hide.sidebar'); - $(target).removeClass('toggled'); - if (button !== undefined) { - if (relationship !== '') { - // Removing active class from all relative buttons - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active"); - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false'); - } - // Removing active class from button - if (button.attr('data-handle') !== 'close') { - button.removeClass("active"); - button.attr('aria-expanded', 'false'); - } - if ($(button).parent().is('li')) { - if (relationship !== '') { - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active"); - $(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false'); - } - } - } - // Sidebar close function - if (targetSide == 'left') { - if ((button !== undefined) && (button.attr('data-container-divide'))) { - $(container).css(pushType + '-' + targetSide, targetOffsetLeft); - } - $(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft)); - } else if (targetSide == 'right') { - if ((button !== undefined) && (button.attr('data-container-divide'))) { - $(container).css(pushType + '-' + targetSide, targetOffsetRight); - } - $(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight)); - } - $(target).trigger('hidden.sidebar'); - } - }; - if (action === 'show') { - sidebar_window.update(target, container); - sidebar_window.show(); - } - if (action === 'hide') { - sidebar_window.update(target, container); - sidebar_window.hide(); - } - // binding click function - var body = 'body'; - $(body).off('click', elem); - $(body).on('click', elem, function (e) { - e.preventDefault(); - button = $(this); - container = button.data('container'); - target = button.data('target'); - sidebar_window.update(target, container, button); - /** - * Sidebar function on data container divide - * @return {Null} - */ - if (button.attr('aria-expanded') == 'false') { - sidebar_window.show(); - } else if (button.attr('aria-expanded') == 'true') { - sidebar_window.hide(); - } - }); -}; - -$.fn.collapse_nav_sub = function () { - var navSelector = 'ul.nav'; - - if (!$(navSelector).hasClass('collapse-nav-sub')) { - $(navSelector + ' > li', this).each(function () { - var position = $(this).offset().left - $(this).parent().scrollLeft(); - $(this).attr('data-absolute-position', (position + 5)); - }); - - $(navSelector + ' li', this).each(function () { - if ($('ul', this).length !== 0) { - $(this).addClass('has-sub'); - } - }); - - $(navSelector + ' > li', this).each(function () { - $(this).css({ - 'left': $(this).data('absolute-position'), - 'position': 'absolute' - }); - }); - - $(navSelector + ' li.has-sub', this).on('click', function () { - var elem = $(this); - if (elem.attr('aria-expanded') !== 'true') { - elem.siblings().fadeOut(100, function () { - elem.animate({'left': '15'}, 200, function () { - $(elem).first().children('ul').fadeIn(200); - }); - }); - elem.siblings().attr('aria-expanded', 'false'); - elem.attr('aria-expanded', 'true'); - } else { - $(elem).first().children('ul').fadeOut(100, function () { - elem.animate({'left': $(elem).data('absolute-position')}, 200, function () { - elem.siblings().fadeIn(100); - }); - }); - elem.siblings().attr('aria-expanded', 'false'); - elem.attr('aria-expanded', 'false'); - } - }); - - $(navSelector + ' > li.has-sub ul', this).on('click', function (e) { - e.stopPropagation(); - }); - $(navSelector).addClass('collapse-nav-sub'); - } -}; - -$(".download-link").click(function(){ - toggleEnrollment(); -}); - -$(document).ready(function () { - $.sidebar_toggle(); - if (typeof $.fn.collapse == 'function') { - $('.navbar-collapse.tiles').on('shown.bs.collapse', function () { - $(this).collapse_nav_sub(); - }); - } - - loadNewNotificationsOnSideViewPanel(); - $("#right-sidebar").on("click", ".new-notification", function () { - var notificationId = $(this).data("id"); - var redirectUrl = $(this).data("url"); - var markAsReadNotificationsEpr = emmAdminBasePath + "/notifications/" + notificationId + "/mark-checked"; - var messageSideBar = ".sidebar-messages"; - - invokerUtil.put( - markAsReadNotificationsEpr, - null, - // on success - function (data) { - data = JSON.parse(data); - if (data.statusCode == responseCodes["ACCEPTED"]) { - location.href = redirectUrl; - } - }, - // on error - function () { - var content = "
  • Warning

    " + - "

    Unexpected error occurred while loading notification. Please refresh the page and" + - " try again

  • "; - $(messageSideBar).html(content); - } - ); - }); -}); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs deleted file mode 100644 index 58818e613..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.hbs +++ /dev/null @@ -1,66 +0,0 @@ -{{unit "cdmf.unit.lib.qrcode"}} -{{unit "cdmf.unit.device.type.qr-modal" enrollmentURL=enrollmentURL deviceTypeName="Windows"}} -{{unit "cdmf.unit.device.type.email.invite-modal" deviceTypeView="windows"}} - -
    -

    Windows Mobile

    -
    -
    -
    - -
    - - -
    - -

    What it Does

    -
    -

    Connect and manage your Windows device with Entgra IoT Server.

    -
    - - Enroll Device - Invite by Email - -

    Configure your workplace account

    -
    -
      -
    • STEP 01 Open Workplace native application on your - mobile device through device settings. -
    • -
    • STEP 02 Tap add account to start the - registration process. -
    • -
    • STEP 03 Provide your corporate email address, - and tap sign in. -
    • -
    • STEP 04 Enter your details, and tap Login. - Username - Enter username provided in the email. - Password - Enter password provided in the email. -
    • - -
    • STEP 05 Read the policy agreement, - and tap I Accept to accept the agreement and completed the device enrollment. -
    • - -
    -
    -
    - -
    -

    Follow instructions in wizard

    -
    - - - -
    -
    - -
    - -{{#zone "topCss"}} - {{css "css/styles.css"}} -{{/zone}} - -{{#zone "bottomJs"}} - {{js "js/type-view.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js deleted file mode 100644 index eb13c2c89..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.js +++ /dev/null @@ -1,25 +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. - */ - -function onRequest(context){ - var viewModel = {}; - var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; - viewModel["hostName"] = devicemgtProps["httpsURL"]; - viewModel["enrollmentURL"] = devicemgtProps["managerHTTPSURL"] + devicemgtProps["windowsEnrollmentDir"]; - return viewModel; -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json deleted file mode 100644 index 9eecd8f5b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.windows.type-view/type-view.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "version": "1.0.0" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json deleted file mode 100644 index 63bcd3f5f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/app-conf.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "appName": "UUF Template App", - "cachingEnabled": false, - "debuggingEnabled": false, - "permissionRoot": "/", - "loginPage": "uuf.page.sign-in", - "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/", - "authModule": { - "enabled": true, - "login": { - "onSuccess": { - "script": "/app/modules/login.js", - "page": "uuf.page.home" - }, - "onFail": { - "script": "/app/modules/login.js", - "page": "uuf.page.sign-in" - } - }, - "logout": { - "onSuccess": { - "script": "/app/modules/logout.js", - "page": "uuf.page.sign-in" - }, - "onFail": { - "script": "/app/modules/logout.js", - "page": "uuf.page.home" - } - }, - "sso": { - "enabled": false, - "issuer": "uuf", - "responseSigningEnabled": true, - "keyStoreName": "repository/resources/security/wso2carbon.jks", - "keyStorePassword": "wso2carbon", - "identityProviderAlias": "wso2carbon", - "identityProviderUrl": "https://${server.ip}:${server.https_port}/samlsso", - "intermediatePage": "uuf.page.sso-intermediate" - } - }, - "errorPages": { - "404": "uuf.page.error", - "default": "uuf.page.error" - } -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json deleted file mode 100644 index 72d2df1ed..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/conf/uuf-conf.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "displayName": "UUF Template App", - "logLevel": "debug" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs deleted file mode 100644 index a67a3e63e..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.default.hbs +++ /dev/null @@ -1,67 +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. ---}} - - - - - - - - - {{#defineZone "title"}}WSO2 Template{{/defineZone}} - {{defineZone "favicon"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - -{{defineZone "header"}} - - - - - - - -{{defineZone "sidePanes"}} - - - -
    - {{defineZone "contentTitle"}} -
    -
    - {{defineZone "content"}} -
    -
    -
    - - - -
    -
    - {{defineZone "footer"}} -
    -
    - - -{{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs deleted file mode 100644 index 3283927e5..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/layouts/uuf.layout.sign-in.hbs +++ /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. ---}} - - - - - - - - - {{#defineZone "title"}}WSO2 Template{{/defineZone}} - {{defineZone "favicon"}} - {{defineZone "topCss"}} - {{defineZone "topJs"}} - - - -{{defineZone "header"}} - - - -
    -
    -
    - {{defineZone "content"}} -
    -
    -
    - - - -
    -
    - {{defineZone "footer"}} -
    -
    - - -{{defineZone "bottomJs"}} - - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs deleted file mode 100644 index a4a31d008..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.hbs +++ /dev/null @@ -1,38 +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. -}} -{{#zone "title"}}Error | {{@app.conf.appName}}{{/zone}} - -{{#zone "breadcrumbs"}} -
  • - - - -
  • -{{/zone}} - -{{#zone "content"}} -
    -

    An Error Occurred!

    - -
    -
    HTTP Status : {{@page.params.status}}
    - -

    {{@page.params.message}}

    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json deleted file mode 100644 index c60eb5207..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.error/error.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/error/default", - "layout": "uuf.layout.default", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js deleted file mode 100644 index 2db2c795f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/public/js/sign-in-validations.js +++ /dev/null @@ -1,24 +0,0 @@ -$(document).ready(function(){ - $("#signInForm").validate({ - rules: { - username: { - required: true, - minlength: 3 - }, - password: { - required: true, - minlength: 3 - } - }, - messages: { - username: { - required: "Please enter a username", - minlength: "Your username must consist of at least 3 characters" - }, - password: { - required: "Please provide a password", - minlength: "Your password must be at least 3 characters long" - } - } - }); -}); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs deleted file mode 100644 index 06fde86ec..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.hbs +++ /dev/null @@ -1,63 +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. -}} -{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}} - -{{~#zone "content"}} -
    -
    -
    -

    - {{#defineZone "signIn-title" scope="protected"}}Sign In to UUF Template App{{/defineZone}} -

    -
    -
    - {{#if message}} -
    - {{message}}! -
    - {{/if}} -
    -
    - -
    -
    - -
    - {{#if referer}} - - {{/if}} -
    - -
    - {{defineZone "signInForm-below" scope="protected"}} -
    -
    -
    -
    -{{/zone}} - -{{! sign-in form validation}} -{{~unit "uuf.unit.lib.form-validation"}} -{{~#zone "bottomJs"}} - {{~js "js/sign-in-validations.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js deleted file mode 100644 index 939e7c82b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.js +++ /dev/null @@ -1,30 +0,0 @@ -function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) { - // Auth module is enabled. - if (context.user) { - // User is already logged in. - response.sendRedirect(context.app.context + "/"); - exit(); - } else { - // User is not logged in. - var ssoConfigs = authModuleConfigs["sso"]; - if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true")) { - // SSO is enabled in Auth module. - var redirectUri = context.app.context + "/uuf/login"; - var queryString = request.getQueryString(); - if (queryString && (queryString.length > 0)) { - redirectUri = redirectUri + "?" + queryString; - } - response.sendRedirect(encodeURI(redirectUri)); - exit(); - } else { - // Generic login process is enabled. - return { - message: request.getParameter("error"), - referer: request.getParameter("referer") - }; - } - } - } -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json deleted file mode 100644 index 4bafc2dbb..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-in/sign-in.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/signin", - "layout": "uuf.layout.sign-in", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs deleted file mode 100644 index 23e70695f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.hbs +++ /dev/null @@ -1,18 +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. -}} -{{! This template won't be rendered. So nothing is here }} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js deleted file mode 100644 index 527c97733..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.js +++ /dev/null @@ -1,16 +0,0 @@ -function onRequest(context) { - var authModuleConfigs = context.app.conf["authModule"]; - if (authModuleConfigs && (authModuleConfigs["enabled"].toString() == "true")) { - // Auth module is enabled. - if (context.user) { - // User is logged in. - response.sendRedirect(context.app.context + "/uuf/logout"); - exit(); - } else { - // User is already logged out. - response.sendRedirect(context.app.context + "/"); - exit(); - } - } - -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json deleted file mode 100644 index 0667f6f06..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sign-out/sign-out.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "version": "1.0.0", - "uri": "/signout", - "layout": "uuf.layout.sign-in" -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs deleted file mode 100644 index 73de91e94..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.hbs +++ /dev/null @@ -1,45 +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. -}} -{{#zone "title"}}Sign In | {{@app.conf.appName}}{{/zone}} - -{{unit "uuf.unit.theme"}} -{{unit "uuf.unit.header.logo"}}{{unit "uuf.unit.header"}} -{{unit "uuf.unit.footer"}} - -{{#zone "content"}} -
    -

    - You are now being redirected to Identity Server. If the redirection fails, please click - on the button below. -

    - -
    -
    - - - - -
    -
    -
    -{{/zone}} - -{{#zone "bottomJs"}} - -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json deleted file mode 100644 index e3c6cdde2..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/pages/uuf.page.sso-intermediate/sso-intermediate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": "1.0.0", - "uri": "//", - "layout": "uuf.layout.sign-in", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs deleted file mode 100644 index 51a365f77..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.hbs +++ /dev/null @@ -1,27 +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. -}} - \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js deleted file mode 100644 index aa4e1482f..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.js +++ /dev/null @@ -1,15 +0,0 @@ -function onRequest(context) { - var type = context.unit.params.type; - switch (type) { - case "success": - return {icon: "ok"}; - case "info": - return {icon: "info"}; - case "warning": - return {icon: "warning"}; - case "danger": - return {icon: "error"}; - default: - return {icon: "ok"}; - } -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json deleted file mode 100644 index f2f22da9a..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.alert/alert.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "1.0.0", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs deleted file mode 100644 index 8274b5e66..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.hbs +++ /dev/null @@ -1,20 +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. -}} -{{#zone "favicon"}} - -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json deleted file mode 100644 index 6e8b1666c..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/favicon.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png deleted file mode 100644 index 43c53c406..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.favicon/public/img/favicon.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs deleted file mode 100644 index e726ab6dd..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.hbs +++ /dev/null @@ -1,23 +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. -}} -{{#zone "footer"}} -

    - WSO2 | © 2015 - Inc. -

    -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json deleted file mode 100644 index 6e8b1666c..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.footer/footer.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs deleted file mode 100644 index 4ce5f300d..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.hbs +++ /dev/null @@ -1,27 +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. -}} -{{#zone "brand"}} - - -

    - 
 - {{#defineZone "productNameResponsive"}}UUI Tmpl. App{{/defineZone}} -

    -
    -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json deleted file mode 100644 index 38acf5dc9..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/logo.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "1.0.0", - "index": 9100, - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png deleted file mode 100644 index b4cba1d37..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.logo/public/img/logo.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs deleted file mode 100644 index d14d5dfed..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.hbs +++ /dev/null @@ -1,39 +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. -}} -{{#zone "userMenu"}} - -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json deleted file mode 100644 index 614b0890b..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header.user-menu/user-menu.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "version": "1.0.0", - "index": 9110, - "pushedUris": [ - "/", - "/{+any}" - ] -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs deleted file mode 100644 index fe6c030d2..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs +++ /dev/null @@ -1,29 +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. -}} -{{#zone "header"}} -
    -
    -
    - {{defineZone "brand"}} -
    -
    - {{defineZone "userMenu"}} -
    -
    -
    -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json deleted file mode 100644 index 8a3fe9c7c..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version": "1.0.0", - "index": 9199, - "pushedUris": [ - "/", - "/{+any}" - ], - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs deleted file mode 100644 index e2e188f5a..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.hbs +++ /dev/null @@ -1,27 +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. -}} -{{#zone "topCss"}} - {{~css "data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css"}} - {{~css "data-tables_1.10.7/extensions/Responsive/css/dataTables.responsive.css"}} -{{/zone}} - -{{~#zone "bottomJs"}} - {{~js "data-tables_1.10.7/media/js/jquery.dataTables.min.js"}} - {{~js "data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js"}} - {{~js "data-tables_1.10.7/extensions/Responsive/js/dataTables.responsive.js"}} -{{/zone}} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json deleted file mode 100644 index f2f22da9a..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/data-table.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "version": "1.0.0", - "isAnonymous": true -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css deleted file mode 100644 index cab59b3a0..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.css +++ /dev/null @@ -1,24 +0,0 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * AutoFill styles - */ - -div.AutoFill_filler { - display: none; - position: absolute; - height: 14px; - width: 14px; - background: url(../images/filler.png) no-repeat center center; - z-index: 1002; -} - -div.AutoFill_border { - display: none; - position: absolute; - background-color: #0063dc; - z-index: 1001; - - box-shadow: 0px 0px 5px #76b4ff; - -moz-box-shadow: 0px 0px 5px #76b4ff; - -webkit-box-shadow: 0px 0px 5px #76b4ff; -} - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css deleted file mode 100644 index b485f2163..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/css/dataTables.autoFill.min.css +++ /dev/null @@ -1 +0,0 @@ -div.AutoFill_filler{display:none;position:absolute;height:14px;width:14px;background:url(../images/filler.png) no-repeat center center;z-index:1002}div.AutoFill_border{display:none;position:absolute;background-color:#0063dc;z-index:1001;box-shadow:0px 0px 5px #76b4ff;-moz-box-shadow:0px 0px 5px #76b4ff;-webkit-box-shadow:0px 0px 5px #76b4ff} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png deleted file mode 100644 index f2af65d8c..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/images/filler.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js deleted file mode 100644 index 6bbfa35b9..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/AutoFill/js/dataTables.autoFill.js +++ /dev/null @@ -1,855 +0,0 @@ -/*! AutoFill 1.2.1 - * ©2008-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary AutoFill - * @description Add Excel like click and drag auto-fill options to DataTables - * @version 1.2.1 - * @file dataTables.autoFill.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - -(function( window, document, undefined ) { - -var factory = function( $, DataTable ) { -"use strict"; - -/** - * AutoFill provides Excel like auto-fill features for a DataTable - * - * @class AutoFill - * @constructor - * @param {object} oTD DataTables settings object - * @param {object} oConfig Configuration object for AutoFill - */ -var AutoFill = function( oDT, oConfig ) -{ - /* Sanity check that we are a new instance */ - if ( ! (this instanceof AutoFill) ) { - throw( "Warning: AutoFill must be initialised with the keyword 'new'" ); - } - - if ( ! $.fn.dataTableExt.fnVersionCheck('1.7.0') ) { - throw( "Warning: AutoFill requires DataTables 1.7 or greater"); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - this.c = {}; - - /** - * @namespace Settings object which contains customisable information for AutoFill instance - */ - this.s = { - /** - * @namespace Cached information about the little dragging icon (the filler) - */ - "filler": { - "height": 0, - "width": 0 - }, - - /** - * @namespace Cached information about the border display - */ - "border": { - "width": 2 - }, - - /** - * @namespace Store for live information for the current drag - */ - "drag": { - "startX": -1, - "startY": -1, - "startTd": null, - "endTd": null, - "dragging": false - }, - - /** - * @namespace Data cache for information that we need for scrolling the screen when we near - * the edges - */ - "screen": { - "interval": null, - "y": 0, - "height": 0, - "scrollTop": 0 - }, - - /** - * @namespace Data cache for the position of the DataTables scrolling element (when scrolling - * is enabled) - */ - "scroller": { - "top": 0, - "bottom": 0 - }, - - /** - * @namespace Information stored for each column. An array of objects - */ - "columns": [] - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - "table": null, - "filler": null, - "borderTop": null, - "borderRight": null, - "borderBottom": null, - "borderLeft": null, - "currentTarget": null - }; - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} AutoFill settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - this._fnInit( oDT, oConfig ); - return this; -}; - - - -AutoFill.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Private methods (they are of course public in JS, but recommended as private) - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Initialisation - * @method _fnInit - * @param {object} dt DataTables settings object - * @param {object} config Configuration object for AutoFill - * @returns void - */ - "_fnInit": function ( dt, config ) - { - var - that = this, - i, iLen; - - // Use DataTables API to get the settings allowing selectors, instances - // etc to be used, or for backwards compatibility get from the old - // fnSettings method - this.s.dt = DataTable.Api ? - new DataTable.Api( dt ).settings()[0] : - dt.fnSettings(); - this.s.init = config || {}; - this.dom.table = this.s.dt.nTable; - - $.extend( true, this.c, AutoFill.defaults, config ); - - /* Add and configure the columns */ - this._initColumns(); - - /* Auto Fill click and drag icon */ - var filler = $('
    ', { - 'class': 'AutoFill_filler' - } ) - .appendTo( 'body' ); - this.dom.filler = filler[0]; - - // Get the height / width of the click element - this.s.filler.height = filler.height(); - this.s.filler.width = filler.width(); - filler[0].style.display = "none"; - - /* Border display - one div for each side. We can't just use a single - * one with a border, as we want the events to effectively pass through - * the transparent bit of the box - */ - var border; - var appender = document.body; - if ( that.s.dt.oScroll.sY !== "" ) { - that.s.dt.nTable.parentNode.style.position = "relative"; - appender = that.s.dt.nTable.parentNode; - } - - border = $('
    ', { - "class": "AutoFill_border" - } ); - this.dom.borderTop = border.clone().appendTo( appender )[0]; - this.dom.borderRight = border.clone().appendTo( appender )[0]; - this.dom.borderBottom = border.clone().appendTo( appender )[0]; - this.dom.borderLeft = border.clone().appendTo( appender )[0]; - - /* Events */ - filler.on( 'mousedown.DTAF', function (e) { - this.onselectstart = function() { return false; }; - that._fnFillerDragStart.call( that, e ); - return false; - } ); - - $('tbody', this.dom.table).on( - 'mouseover.DTAF mouseout.DTAF', - '>tr>td, >tr>th', - function (e) { - that._fnFillerDisplay.call( that, e ); - } - ); - - $(this.dom.table).on( 'destroy.dt.DTAF', function () { - filler.off( 'mousedown.DTAF' ).remove(); - $('tbody', this.dom.table).off( 'mouseover.DTAF mouseout.DTAF' ); - } ); - }, - - - _initColumns: function ( ) - { - var that = this; - var i, ien; - var dt = this.s.dt; - var config = this.s.init; - - for ( i=0, ien=dt.aoColumns.length ; i offsetEnd.left) { - x1 = offsetEnd.left - border; - x2 = offsetStart.left + $(nStart).outerWidth(); - width = offsetStart.left + $(nStart).outerWidth() - offsetEnd.left + (2*border); - } - - if ( this.s.dt.oScroll.sY !== "" ) - { - /* The border elements are inside the DT scroller - so position relative to that */ - var - offsetScroll = $(this.s.dt.nTable.parentNode).offset(), - scrollTop = $(this.s.dt.nTable.parentNode).scrollTop(), - scrollLeft = $(this.s.dt.nTable.parentNode).scrollLeft(); - - x1 -= offsetScroll.left - scrollLeft; - x2 -= offsetScroll.left - scrollLeft; - y1 -= offsetScroll.top - scrollTop; - y2 -= offsetScroll.top - scrollTop; - } - - /* Top */ - oStyle = this.dom.borderTop.style; - oStyle.top = y1+"px"; - oStyle.left = x1+"px"; - oStyle.height = this.s.border.width+"px"; - oStyle.width = width+"px"; - - /* Bottom */ - oStyle = this.dom.borderBottom.style; - oStyle.top = y2+"px"; - oStyle.left = x1+"px"; - oStyle.height = this.s.border.width+"px"; - oStyle.width = width+"px"; - - /* Left */ - oStyle = this.dom.borderLeft.style; - oStyle.top = y1+"px"; - oStyle.left = x1+"px"; - oStyle.height = height+"px"; - oStyle.width = this.s.border.width+"px"; - - /* Right */ - oStyle = this.dom.borderRight.style; - oStyle.top = y1+"px"; - oStyle.left = x2+"px"; - oStyle.height = height+"px"; - oStyle.width = this.s.border.width+"px"; - }, - - - /** - * Mouse down event handler for starting a drag - * @method _fnFillerDragStart - * @param {Object} e Event object - * @returns void - */ - "_fnFillerDragStart": function (e) - { - var that = this; - var startingTd = this.dom.currentTarget; - - this.s.drag.dragging = true; - - that.dom.borderTop.style.display = "block"; - that.dom.borderRight.style.display = "block"; - that.dom.borderBottom.style.display = "block"; - that.dom.borderLeft.style.display = "block"; - - var coords = this._fnTargetCoords( startingTd ); - this.s.drag.startX = coords.x; - this.s.drag.startY = coords.y; - - this.s.drag.startTd = startingTd; - this.s.drag.endTd = startingTd; - - this._fnUpdateBorder( startingTd, startingTd ); - - $(document).bind('mousemove.AutoFill', function (e) { - that._fnFillerDragMove.call( that, e ); - } ); - - $(document).bind('mouseup.AutoFill', function (e) { - that._fnFillerFinish.call( that, e ); - } ); - - /* Scrolling information cache */ - this.s.screen.y = e.pageY; - this.s.screen.height = $(window).height(); - this.s.screen.scrollTop = $(document).scrollTop(); - - if ( this.s.dt.oScroll.sY !== "" ) - { - this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top; - this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height(); - } - - /* Scrolling handler - we set an interval (which is cancelled on mouse up) which will fire - * regularly and see if we need to do any scrolling - */ - this.s.screen.interval = setInterval( function () { - var iScrollTop = $(document).scrollTop(); - var iScrollDelta = iScrollTop - that.s.screen.scrollTop; - that.s.screen.y += iScrollDelta; - - if ( that.s.screen.height - that.s.screen.y + iScrollTop < 50 ) - { - $('html, body').animate( { - "scrollTop": iScrollTop + 50 - }, 240, 'linear' ); - } - else if ( that.s.screen.y - iScrollTop < 50 ) - { - $('html, body').animate( { - "scrollTop": iScrollTop - 50 - }, 240, 'linear' ); - } - - if ( that.s.dt.oScroll.sY !== "" ) - { - if ( that.s.screen.y > that.s.scroller.bottom - 50 ) - { - $(that.s.dt.nTable.parentNode).animate( { - "scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() + 50 - }, 240, 'linear' ); - } - else if ( that.s.screen.y < that.s.scroller.top + 50 ) - { - $(that.s.dt.nTable.parentNode).animate( { - "scrollTop": $(that.s.dt.nTable.parentNode).scrollTop() - 50 - }, 240, 'linear' ); - } - } - }, 250 ); - }, - - - /** - * Mouse move event handler for during a move. See if we want to update the display based on the - * new cursor position - * @method _fnFillerDragMove - * @param {Object} e Event object - * @returns void - */ - "_fnFillerDragMove": function (e) - { - if ( e.target && e.target.nodeName.toUpperCase() == "TD" && - e.target != this.s.drag.endTd ) - { - var coords = this._fnTargetCoords( e.target ); - - if ( this.c.mode == "y" && coords.x != this.s.drag.startX ) - { - e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.dom.table)[0]; - } - if ( this.c.mode == "x" && coords.y != this.s.drag.startY ) - { - e.target = $('tbody>tr:eq('+this.s.drag.startY+')>td:eq('+coords.x+')', this.dom.table)[0]; - } - - if ( this.c.mode == "either") - { - if(coords.x != this.s.drag.startX ) - { - e.target = $('tbody>tr:eq('+this.s.drag.startY+')>td:eq('+coords.x+')', this.dom.table)[0]; - } - else if ( coords.y != this.s.drag.startY ) { - e.target = $('tbody>tr:eq('+coords.y+')>td:eq('+this.s.drag.startX+')', this.dom.table)[0]; - } - } - - // update coords - if ( this.c.mode !== "both" ) { - coords = this._fnTargetCoords( e.target ); - } - - var drag = this.s.drag; - drag.endTd = e.target; - - if ( coords.y >= this.s.drag.startY ) { - this._fnUpdateBorder( drag.startTd, drag.endTd ); - } - else { - this._fnUpdateBorder( drag.endTd, drag.startTd ); - } - this._fnFillerPosition( e.target ); - } - - /* Update the screen information so we can perform scrolling */ - this.s.screen.y = e.pageY; - this.s.screen.scrollTop = $(document).scrollTop(); - - if ( this.s.dt.oScroll.sY !== "" ) - { - this.s.scroller.scrollTop = $(this.s.dt.nTable.parentNode).scrollTop(); - this.s.scroller.top = $(this.s.dt.nTable.parentNode).offset().top; - this.s.scroller.bottom = this.s.scroller.top + $(this.s.dt.nTable.parentNode).height(); - } - }, - - - /** - * Mouse release handler - end the drag and take action to update the cells with the needed values - * @method _fnFillerFinish - * @param {Object} e Event object - * @returns void - */ - "_fnFillerFinish": function (e) - { - var that = this, i, iLen, j; - - $(document).unbind('mousemove.AutoFill mouseup.AutoFill'); - - this.dom.borderTop.style.display = "none"; - this.dom.borderRight.style.display = "none"; - this.dom.borderBottom.style.display = "none"; - this.dom.borderLeft.style.display = "none"; - - this.s.drag.dragging = false; - - clearInterval( this.s.screen.interval ); - - var cells = []; - var table = this.dom.table; - var coordsStart = this._fnTargetCoords( this.s.drag.startTd ); - var coordsEnd = this._fnTargetCoords( this.s.drag.endTd ); - var columnIndex = function ( visIdx ) { - return that.s.dt.oApi._fnVisibleToColumnIndex( that.s.dt, visIdx ); - }; - - // xxx - urgh - there must be a way of reducing this... - if ( coordsStart.y <= coordsEnd.y ) { - for ( i=coordsStart.y ; i<=coordsEnd.y ; i++ ) { - if ( coordsStart.x <= coordsEnd.x ) { - for ( j=coordsStart.x ; j<=coordsEnd.x ; j++ ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - else { - for ( j=coordsStart.x ; j>=coordsEnd.x ; j-- ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - } - } - else { - for ( i=coordsStart.y ; i>=coordsEnd.y ; i-- ) { - if ( coordsStart.x <= coordsEnd.x ) { - for ( j=coordsStart.x ; j<=coordsEnd.x ; j++ ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: j - coordsStart.x, - y: i - coordsStart.y, - colIdx: columnIndex( j ) - } ); - } - } - else { - for ( j=coordsStart.x ; j>=coordsEnd.x ; j-- ) { - cells.push( { - node: $('tbody>tr:eq('+i+')>td:eq('+j+')', table)[0], - x: coordsStart.x - j, - y: coordsStart.y - i, - colIdx: columnIndex( j ) - } ); - } - } - } - } - - // An auto-fill requires 2 or more cells - if ( cells.length <= 1 ) { - return; - } - - var edited = []; - var previous; - - for ( i=0, iLen=cells.length ; i",{"class":"AutoFill_filler"}).appendTo("body");this.dom.filler=e[0];this.s.filler.height=e.height();this.s.filler.width=e.width();e[0].style.display= -"none";var g,f=j.body;""!==a.s.dt.oScroll.sY&&(a.s.dt.nTable.parentNode.style.position="relative",f=a.s.dt.nTable.parentNode);g=c("
    ",{"class":"AutoFill_border"});this.dom.borderTop=g.clone().appendTo(f)[0];this.dom.borderRight=g.clone().appendTo(f)[0];this.dom.borderBottom=g.clone().appendTo(f)[0];this.dom.borderLeft=g.clone().appendTo(f)[0];e.on("mousedown.DTAF",function(b){this.onselectstart=function(){return false};a._fnFillerDragStart.call(a,b);return false});c("tbody",this.dom.table).on("mouseover.DTAF mouseout.DTAF", -">tr>td, >tr>th",function(b){a._fnFillerDisplay.call(a,b)});c(this.dom.table).on("destroy.dt.DTAF",function(){e.off("mousedown.DTAF").remove();c("tbody",this.dom.table).off("mouseover.DTAF mouseout.DTAF")})},_initColumns:function(){var d=this,b,a,e=this.s.dt,g=this.s.init;b=0;for(a=e.aoColumns.length;bg.left&&(f=g.left-a,i=e.left+c(d).outerWidth(),j=e.left+c(d).outerWidth()-g.left+2*a);""!==this.s.dt.oScroll.sY&&(a=c(this.s.dt.nTable.parentNode).offset(),e=c(this.s.dt.nTable.parentNode).scrollTop(), -g=c(this.s.dt.nTable.parentNode).scrollLeft(),f-=a.left-g,i-=a.left-g,n-=a.top-e,h-=a.top-e);a=this.dom.borderTop.style;a.top=n+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderBottom.style;a.top=h+"px";a.left=f+"px";a.height=this.s.border.width+"px";a.width=j+"px";a=this.dom.borderLeft.style;a.top=n+"px";a.left=f+"px";a.height=k+"px";a.width=this.s.border.width+"px";a=this.dom.borderRight.style;a.top=n+"px";a.left=i+"px";a.height=k+"px";a.width=this.s.border.width+ -"px"},_fnFillerDragStart:function(d){var b=this,a=this.dom.currentTarget;this.s.drag.dragging=!0;b.dom.borderTop.style.display="block";b.dom.borderRight.style.display="block";b.dom.borderBottom.style.display="block";b.dom.borderLeft.style.display="block";var e=this._fnTargetCoords(a);this.s.drag.startX=e.x;this.s.drag.startY=e.y;this.s.drag.startTd=a;this.s.drag.endTd=a;this._fnUpdateBorder(a,a);c(j).bind("mousemove.AutoFill",function(a){b._fnFillerDragMove.call(b,a)});c(j).bind("mouseup.AutoFill", -function(a){b._fnFillerFinish.call(b,a)});this.s.screen.y=d.pageY;this.s.screen.height=c(o).height();this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom=this.s.scroller.top+c(this.s.dt.nTable.parentNode).height());this.s.screen.interval=setInterval(function(){var a=c(j).scrollTop();b.s.screen.y=b.s.screen.y+(a-b.s.screen.scrollTop);b.s.screen.height-b.s.screen.y+a<50?c("html, body").animate({scrollTop:a+ -50},240,"linear"):b.s.screen.y-a<50&&c("html, body").animate({scrollTop:a-50},240,"linear");b.s.dt.oScroll.sY!==""&&(b.s.screen.y>b.s.scroller.bottom-50?c(b.s.dt.nTable.parentNode).animate({scrollTop:c(b.s.dt.nTable.parentNode).scrollTop()+50},240,"linear"):b.s.screen.ytr:eq("+b.y+")>td:eq("+this.s.drag.startX+")",this.dom.table)[0]);"x"==this.c.mode&&b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]);"either"==this.c.mode&&(b.x!=this.s.drag.startX?d.target=c("tbody>tr:eq("+this.s.drag.startY+")>td:eq("+b.x+")",this.dom.table)[0]:b.y!=this.s.drag.startY&&(d.target=c("tbody>tr:eq("+b.y+")>td:eq("+this.s.drag.startX+ -")",this.dom.table)[0]));"both"!==this.c.mode&&(b=this._fnTargetCoords(d.target));var a=this.s.drag;a.endTd=d.target;b.y>=this.s.drag.startY?this._fnUpdateBorder(a.startTd,a.endTd):this._fnUpdateBorder(a.endTd,a.startTd);this._fnFillerPosition(d.target)}this.s.screen.y=d.pageY;this.s.screen.scrollTop=c(j).scrollTop();""!==this.s.dt.oScroll.sY&&(this.s.scroller.scrollTop=c(this.s.dt.nTable.parentNode).scrollTop(),this.s.scroller.top=c(this.s.dt.nTable.parentNode).offset().top,this.s.scroller.bottom= -this.s.scroller.top+c(this.s.dt.nTable.parentNode).height())},_fnFillerFinish:function(){var d=this,b,a;c(j).unbind("mousemove.AutoFill mouseup.AutoFill");this.dom.borderTop.style.display="none";this.dom.borderRight.style.display="none";this.dom.borderBottom.style.display="none";this.dom.borderLeft.style.display="none";this.s.drag.dragging=!1;clearInterval(this.s.screen.interval);var e=[],g=this.dom.table,f=this._fnTargetCoords(this.s.drag.startTd),i=this._fnTargetCoords(this.s.drag.endTd),h=function(a){return d.s.dt.oApi._fnVisibleToColumnIndex(d.s.dt, -a)};if(f.y<=i.y)for(b=f.y;b<=i.y;b++)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(b=f.y;b>=i.y;b--)if(f.x<=i.x)for(a=f.x;a<=i.x;a++)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:a-f.x,y:b-f.y,colIdx:h(a)});else for(a=f.x;a>=i.x;a--)e.push({node:c("tbody>tr:eq("+b+")>td:eq("+a+")",g)[0],x:f.x-a,y:f.y- -b,colIdx:h(a)});if(!(1>=e.length)){var g=[],m;b=0;for(a=e.length;bg||0>f?-1:1)):a===m?b:a}}};return h};"function"===typeof define&&define.amd? -define(["jquery","datatables"],l):"object"===typeof exports?l(require("jquery"),require("datatables")):jQuery&&!jQuery.fn.dataTable.AutoFill&&l(jQuery,jQuery.fn.dataTable)})(window,document); diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css deleted file mode 100644 index 2ccacaff8..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/css/dataTables.bootstrap.css +++ /dev/null @@ -1,372 +0,0 @@ -div.dataTables_length label { - font-weight: normal; - text-align: left; - white-space: nowrap; -} - -div.dataTables_length select { - width: 75px; - display: inline-block; -} - -div.dataTables_filter { - text-align: right; -} - -div.dataTables_filter label { - font-weight: normal; - white-space: nowrap; - text-align: left; -} - -div.dataTables_filter input { - margin-left: 0.5em; - display: inline-block; - width: auto; -} - -div.dataTables_info { - padding-top: 8px; - white-space: nowrap; -} - -div.dataTables_paginate { - margin: 0; - white-space: nowrap; - text-align: right; -} - -div.dataTables_paginate ul.pagination { - margin: 2px 0; - white-space: nowrap; -} - -@media screen and (max-width: 767px) { - div.dataTables_wrapper > div.row > div, - div.dataTables_length, - div.dataTables_filter, - div.dataTables_info, - div.dataTables_paginate { - text-align: center; - } - - div.DTTT { - margin-bottom: 0.5em; - } -} - - -table.dataTable td, -table.dataTable th { - -webkit-box-sizing: content-box; - -moz-box-sizing: content-box; - box-sizing: content-box; -} - - -table.dataTable { - clear: both; - margin-top: 6px !important; - margin-bottom: 6px !important; - max-width: none !important; -} - -table.dataTable thead .sorting, -table.dataTable thead .sorting_asc, -table.dataTable thead .sorting_desc, -table.dataTable thead .sorting_asc_disabled, -table.dataTable thead .sorting_desc_disabled { - cursor: pointer; - position: relative; -} - -table.dataTable thead .sorting:after, -table.dataTable thead .sorting_asc:after, -table.dataTable thead .sorting_desc:after { - position: absolute; - top: 8px; - right: 8px; - display: block; - font-family: 'Glyphicons Halflings'; - opacity: 0.5; -} -table.dataTable thead .sorting:after { - opacity: 0.2; - content: "\e150"; /* sort */ -} -table.dataTable thead .sorting_asc:after { - content: "\e155"; /* sort-by-attributes */ -} -table.dataTable thead .sorting_desc:after { - content: "\e156"; /* sort-by-attributes-alt */ -} -div.dataTables_scrollBody table.dataTable thead .sorting:after, -div.dataTables_scrollBody table.dataTable thead .sorting_asc:after, -div.dataTables_scrollBody table.dataTable thead .sorting_desc:after { - display: none; -} - -table.dataTable thead .sorting_asc_disabled:after, -table.dataTable thead .sorting_desc_disabled:after { - color: #eee; -} - -table.dataTable thead > tr > th { - padding-right: 30px; -} - -table.dataTable th:active { - outline: none; -} - - -/* Condensed */ -table.dataTable.table-condensed thead > tr > th { - padding-right: 20px; -} - -table.dataTable.table-condensed thead .sorting:after, -table.dataTable.table-condensed thead .sorting_asc:after, -table.dataTable.table-condensed thead .sorting_desc:after { - top: 6px; - right: 6px; -} - -/* Scrolling */ -div.dataTables_scrollHead table { - margin-bottom: 0 !important; - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; -} - -div.dataTables_scrollHead table thead tr:last-child th:first-child, -div.dataTables_scrollHead table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.dataTables_scrollBody table { - border-top: none; - margin-top: 0 !important; - margin-bottom: 0 !important; -} - -div.dataTables_scrollBody tbody tr:first-child th, -div.dataTables_scrollBody tbody tr:first-child td { - border-top: none; -} - -div.dataTables_scrollFoot table { - margin-top: 0 !important; - border-top: none; -} - -/* Frustratingly the border-collapse:collapse used by Bootstrap makes the column - width calculations when using scrolling impossible to align columns. We have - to use separate - */ -table.table-bordered.dataTable { - border-collapse: separate !important; -} -table.table-bordered thead th, -table.table-bordered thead td { - border-left-width: 0; - border-top-width: 0; -} -table.table-bordered tbody th, -table.table-bordered tbody td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered tfoot th, -table.table-bordered tfoot td { - border-left-width: 0; - border-bottom-width: 0; -} -table.table-bordered th:last-child, -table.table-bordered td:last-child { - border-right-width: 0; -} -div.dataTables_scrollHead table.table-bordered { - border-bottom-width: 0; -} - - - - -/* - * TableTools styles - */ -.table.dataTable tbody tr.active td, -.table.dataTable tbody tr.active th { - background-color: #08C; - color: white; -} - -.table.dataTable tbody tr.active:hover td, -.table.dataTable tbody tr.active:hover th { - background-color: #0075b0 !important; -} - -.table.dataTable tbody tr.active th > a, -.table.dataTable tbody tr.active td > a { - color: white; -} - -.table-striped.dataTable tbody tr.active:nth-child(odd) td, -.table-striped.dataTable tbody tr.active:nth-child(odd) th { - background-color: #017ebc; -} - -table.DTTT_selectable tbody tr { - cursor: pointer; -} - -div.DTTT .btn:hover { - text-decoration: none !important; -} - -ul.DTTT_dropdown.dropdown-menu { - z-index: 2003; -} - -ul.DTTT_dropdown.dropdown-menu a { - color: #333 !important; /* needed only when demo_page.css is included */ -} - -ul.DTTT_dropdown.dropdown-menu li { - position: relative; -} - -ul.DTTT_dropdown.dropdown-menu li:hover a { - background-color: #0088cc; - color: white !important; -} - -div.DTTT_collection_background { - z-index: 2002; -} - -/* TableTools information display */ -div.DTTT_print_info { - position: fixed; - top: 50%; - left: 50%; - width: 400px; - height: 150px; - margin-left: -200px; - margin-top: -75px; - text-align: center; - color: #333; - padding: 10px 30px; - opacity: 0.95; - - background-color: white; - border: 1px solid rgba(0, 0, 0, 0.2); - border-radius: 6px; - - -webkit-box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); - box-shadow: 0 3px 7px rgba(0, 0, 0, 0.5); -} - -div.DTTT_print_info h6 { - font-weight: normal; - font-size: 28px; - line-height: 28px; - margin: 1em; -} - -div.DTTT_print_info p { - font-size: 14px; - line-height: 20px; -} - -div.dataTables_processing { - position: absolute; - top: 50%; - left: 50%; - width: 100%; - height: 60px; - margin-left: -50%; - margin-top: -25px; - padding-top: 20px; - padding-bottom: 20px; - text-align: center; - font-size: 1.2em; - background-color: white; - background: -webkit-gradient(linear, left top, right top, color-stop(0%, rgba(255,255,255,0)), color-stop(25%, rgba(255,255,255,0.9)), color-stop(75%, rgba(255,255,255,0.9)), color-stop(100%, rgba(255,255,255,0))); - background: -webkit-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -moz-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -ms-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: -o-linear-gradient(left, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); - background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.9) 25%, rgba(255,255,255,0.9) 75%, rgba(255,255,255,0) 100%); -} - - - -/* - * FixedColumns styles - */ -div.DTFC_LeftHeadWrapper table, -div.DTFC_LeftFootWrapper table, -div.DTFC_RightHeadWrapper table, -div.DTFC_RightFootWrapper table, -table.DTFC_Cloned tr.even { - background-color: white; - margin-bottom: 0; -} - -div.DTFC_RightHeadWrapper table , -div.DTFC_LeftHeadWrapper table { - border-bottom: none !important; - margin-bottom: 0 !important; - border-top-right-radius: 0 !important; - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_RightHeadWrapper table thead tr:last-child td:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child th:first-child, -div.DTFC_LeftHeadWrapper table thead tr:last-child td:first-child { - border-bottom-left-radius: 0 !important; - border-bottom-right-radius: 0 !important; -} - -div.DTFC_RightBodyWrapper table, -div.DTFC_LeftBodyWrapper table { - border-top: none; - margin: 0 !important; -} - -div.DTFC_RightBodyWrapper tbody tr:first-child th, -div.DTFC_RightBodyWrapper tbody tr:first-child td, -div.DTFC_LeftBodyWrapper tbody tr:first-child th, -div.DTFC_LeftBodyWrapper tbody tr:first-child td { - border-top: none; -} - -div.DTFC_RightFootWrapper table, -div.DTFC_LeftFootWrapper table { - border-top: none; - margin-top: 0 !important; -} - - -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_LeftBodyWrapper table.dataTable thead .sorting_desc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_asc:after, -div.DTFC_RightBodyWrapper table.dataTable thead .sorting_desc:after { - display: none; -} - - -/* - * FixedHeader styles - */ -div.FixedHeader_Cloned table { - margin: 0 !important -} - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js deleted file mode 100644 index dcc561fcf..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/Bootstrap/js/dataTables.bootstrap.js +++ /dev/null @@ -1,206 +0,0 @@ -/*! DataTables Bootstrap 3 integration - * ©2011-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * DataTables integration for Bootstrap 3. This requires Bootstrap 3 and - * DataTables 1.10 or newer. - * - * This file sets the defaults and adds options to DataTables to style its - * controls using Bootstrap. See http://datatables.net/manual/styling/bootstrap - * for further information. - */ -(function(window, document, undefined){ - -var factory = function( $, DataTable ) { -"use strict"; - - -/* Set the defaults for DataTables initialisation */ -$.extend( true, DataTable.defaults, { - dom: - "<'row'<'col-sm-6'l><'col-sm-6'f>>" + - "<'row'<'col-sm-12'tr>>" + - "<'row'<'col-sm-5'i><'col-sm-7'p>>", - renderer: 'bootstrap' -} ); - - -/* Default class modification */ -$.extend( DataTable.ext.classes, { - sWrapper: "dataTables_wrapper form-inline dt-bootstrap", - sFilterInput: "form-control input-sm", - sLengthSelect: "form-control input-sm" -} ); - - -/* Bootstrap paging button renderer */ -DataTable.ext.renderer.pageButton.bootstrap = function ( settings, host, idx, buttons, page, pages ) { - var api = new DataTable.Api( settings ); - var classes = settings.oClasses; - var lang = settings.oLanguage.oPaginate; - var btnDisplay, btnClass, counter=0; - - var attach = function( container, buttons ) { - var i, ien, node, button; - var clickHandler = function ( e ) { - e.preventDefault(); - if ( !$(e.currentTarget).hasClass('disabled') ) { - api.page( e.data.action ).draw( false ); - } - }; - - for ( i=0, ien=buttons.length ; i 0 ? - '' : ' disabled'); - break; - - case 'previous': - btnDisplay = lang.sPrevious; - btnClass = button + (page > 0 ? - '' : ' disabled'); - break; - - case 'next': - btnDisplay = lang.sNext; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - case 'last': - btnDisplay = lang.sLast; - btnClass = button + (page < pages-1 ? - '' : ' disabled'); - break; - - default: - btnDisplay = button + 1; - btnClass = page === button ? - 'active' : ''; - break; - } - - if ( btnDisplay ) { - node = $('
  • ', { - 'class': classes.sPageButton+' '+btnClass, - 'id': idx === 0 && typeof button === 'string' ? - settings.sTableId +'_'+ button : - null - } ) - .append( $('', { - 'href': '#', - 'aria-controls': settings.sTableId, - 'data-dt-idx': counter, - 'tabindex': settings.iTabIndex - } ) - .html( btnDisplay ) - ) - .appendTo( container ); - - settings.oApi._fnBindAction( - node, {action: button}, clickHandler - ); - - counter++; - } - } - } - }; - - // IE9 throws an 'unknown error' if document.activeElement is used - // inside an iframe or frame. - var activeEl; - - try { - // Because this approach is destroying and recreating the paging - // elements, focus is lost on the select button which is bad for - // accessibility. So we want to restore focus once the draw has - // completed - activeEl = $(document.activeElement).data('dt-idx'); - } - catch (e) {} - - attach( - $(host).empty().html('
      ').children('ul'), - buttons - ); - - if ( activeEl ) { - $(host).find( '[data-dt-idx='+activeEl+']' ).focus(); - } -}; - - -/* - * TableTools Bootstrap compatibility - * Required TableTools 2.1+ - */ -if ( DataTable.TableTools ) { - // Set the classes that TableTools uses to something suitable for Bootstrap - $.extend( true, DataTable.TableTools.classes, { - "container": "DTTT btn-group", - "buttons": { - "normal": "btn btn-default", - "disabled": "disabled" - }, - "collection": { - "container": "DTTT_dropdown dropdown-menu", - "buttons": { - "normal": "", - "disabled": "disabled" - } - }, - "print": { - "info": "DTTT_print_info" - }, - "select": { - "row": "active" - } - } ); - - // Have the collection use a bootstrap compatible drop down - $.extend( true, DataTable.TableTools.DEFAULTS.oTags, { - "collection": { - "container": "ul", - "button": "li", - "liner": "a" - } - } ); -} - -}; // /factory - - -// Define as an AMD module if possible -if ( typeof define === 'function' && define.amd ) { - define( ['jquery', 'datatables'], factory ); -} -else if ( typeof exports === 'object' ) { - // Node/CommonJS - factory( require('jquery'), require('datatables') ); -} -else if ( jQuery ) { - // Otherwise simply initialise as normal, stopping multiple evaluation - factory( jQuery, jQuery.fn.dataTable ); -} - - -})(window, document); - diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css deleted file mode 100644 index bdd6aa0b9..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.css +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Namespace DTCR - "DataTables ColReorder" plug-in - */ - -table.DTCR_clonedTable { - background-color: rgba(255, 255, 255, 0.7); - z-index: 202; -} - -div.DTCR_pointer { - width: 1px; - background-color: #0259C4; - z-index: 201; -} \ No newline at end of file diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css deleted file mode 100644 index 77b230e01..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/css/dataTables.colReorder.min.css +++ /dev/null @@ -1 +0,0 @@ -table.DTCR_clonedTable{background-color:rgba(255,255,255,0.7);z-index:202}div.DTCR_pointer{width:1px;background-color:#0259C4;z-index:201} diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png deleted file mode 100644 index 15d5522da..000000000 Binary files a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/images/insert.png and /dev/null differ diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js deleted file mode 100644 index c3b2f1e2a..000000000 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.lib.data-table/public/data-tables_1.10.7/extensions/ColReorder/js/dataTables.colReorder.js +++ /dev/null @@ -1,1372 +0,0 @@ -/*! ColReorder 1.1.3 - * ©2010-2014 SpryMedia Ltd - datatables.net/license - */ - -/** - * @summary ColReorder - * @description Provide the ability to reorder columns in a DataTable - * @version 1.1.3 - * @file dataTables.colReorder.js - * @author SpryMedia Ltd (www.sprymedia.co.uk) - * @contact www.sprymedia.co.uk/contact - * @copyright Copyright 2010-2014 SpryMedia Ltd. - * - * This source file is free software, available under the following license: - * MIT license - http://datatables.net/license/mit - * - * This source file is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. - * - * For details please refer to: http://www.datatables.net - */ - -(function(window, document, undefined) { - - -/** - * Switch the key value pairing of an index array to be value key (i.e. the old value is now the - * key). For example consider [ 2, 0, 1 ] this would be returned as [ 1, 2, 0 ]. - * @method fnInvertKeyValues - * @param array aIn Array to switch around - * @returns array - */ -function fnInvertKeyValues( aIn ) -{ - var aRet=[]; - for ( var i=0, iLen=aIn.length ; i= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'from' index is out of bounds: "+iFrom ); - return; - } - - if ( iTo < 0 || iTo >= iCols ) - { - this.oApi._fnLog( oSettings, 1, "ColReorder 'to' index is out of bounds: "+iTo ); - return; - } - - /* - * Calculate the new column array index, so we have a mapping between the old and new - */ - var aiMapping = []; - for ( i=0, iLen=iCols ; i this.s.fixed-1 && i < iLen - this.s.fixedRight ) - { - this._fnMouseListener( i, this.s.dt.aoColumns[i].nTh ); - } - - /* Mark the original column order for later reference */ - this.s.dt.aoColumns[i]._ColReorder_iOrigCol = i; - } - - /* State saving */ - this.s.dt.oApi._fnCallbackReg( this.s.dt, 'aoStateSaveParams', function (oS, oData) { - that._fnStateSave.call( that, oData ); - }, "ColReorder_State" ); - - /* An initial column order has been specified */ - var aiOrder = null; - if ( this.s.init.aiOrder ) - { - aiOrder = this.s.init.aiOrder.slice(); - } - - /* State loading, overrides the column order given */ - if ( this.s.dt.oLoadedState && typeof this.s.dt.oLoadedState.ColReorder != 'undefined' && - this.s.dt.oLoadedState.ColReorder.length == this.s.dt.aoColumns.length ) - { - aiOrder = this.s.dt.oLoadedState.ColReorder; - } - - /* If we have an order to apply - do so */ - if ( aiOrder ) - { - /* We might be called during or after the DataTables initialisation. If before, then we need - * to wait until the draw is done, if after, then do what we need to do right away - */ - if ( !that.s.dt._bInitComplete ) - { - var bDone = false; - this.s.dt.aoDrawCallback.push( { - "fn": function () { - if ( !that.s.dt._bInitComplete && !bDone ) - { - bDone = true; - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - }, - "sName": "ColReorder_Pre" - } ); - } - else - { - var resort = fnInvertKeyValues( aiOrder ); - that._fnOrderColumns.call( that, resort ); - } - } - else { - this._fnSetColumnIndexes(); - } - }, - - - /** - * Set the column order from an array - * @method _fnOrderColumns - * @param array a An array of integers which dictate the column order that should be applied - * @returns void - * @private - */ - "_fnOrderColumns": function ( a ) - { - if ( a.length != this.s.dt.aoColumns.length ) - { - this.s.dt.oInstance.oApi._fnLog( this.s.dt, 1, "ColReorder - array reorder does not "+ - "match known number of columns. Skipping." ); - return; - } - - for ( var i=0, iLen=a.length ; i
  • ') - .addClass( 'DTCR_pointer' ) - .css( { - position: 'absolute', - top: scrolling ? - $('div.dataTables_scroll', this.s.dt.nTableWrapper).offset().top : - $(this.s.dt.nTable).offset().top, - height : scrolling ? - $('div.dataTables_scroll', this.s.dt.nTableWrapper).height() : - $(this.s.dt.nTable).height() - } ) - .appendTo( 'body' ); - }, - - /** - * Clean up ColReorder memory references and event handlers - * @method _fnDestroy - * @returns void - * @private - */ - "_fnDestroy": function () - { - var i, iLen; - - for ( i=0, iLen=this.s.dt.aoDrawCallback.length ; ib||b>=n)this.oApi._fnLog(a,1,"ColReorder 'from' index is out of bounds: "+b);else if(0>e||e>=n)this.oApi._fnLog(a,1,"ColReorder 'to' index is out of bounds: "+e);else{f=[];c=0;for(g=n;cthis.s.fixed-1&&eMath.pow(Math.pow(a.pageX-this.s.mouse.startX,2)+Math.pow(a.pageY-this.s.mouse.startY,2),0.5))return;this._fnCreateDragNode()}this.dom.drag.css({left:a.pageX-this.s.mouse.offsetX,top:a.pageY-this.s.mouse.offsetY});for(var b=!1,e=this.s.mouse.toIndex,d=1,c=this.s.aoTargets.length;d
    ").addClass("DTCR_pointer").css({position:"absolute",top:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).offset().top:d(this.s.dt.nTable).offset().top,height:a?d("div.dataTables_scroll",this.s.dt.nTableWrapper).height(): -d(this.s.dt.nTable).height()}).appendTo("body")},_fnDestroy:function(){var a,b;a=0;for(b=this.s.dt.aoDrawCallback.length;a
    ')[0], -g=c.childNodes[0],f=c.childNodes[1];this.dom.grid.dt.parentNode.insertBefore(c,this.dom.grid.dt);c.appendChild(this.dom.grid.dt);this.dom.grid.wrapper=c;0b.clientWidth&&(c.x=!0);a.offsetHeight>b.clientHeight&&(c.y=!0);return c},_fnDraw:function(a){this._fnGridLayout();this._fnCloneLeft(a);this._fnCloneRight(a);null!==this.s.fnDrawCallback&&this.s.fnDrawCallback.call(this,this.dom.clone.left,this.dom.clone.right);d(this).trigger("draw.dtfc",{leftClone:this.dom.clone.left,rightClone:this.dom.clone.right})},_fnCloneRight:function(a){if(!(0>= -this.s.iRightColumns)){var b,c=[];for(b=this.s.iTableColumns-this.s.iRightColumns;b=this.s.iLeftColumns)){var b,c=[];for(b=0;bthead",a.header);k.empty();e=0;for(h=n.length;ethead",a.header)[0]);e=0;for(h=n.length;etbody>tr",f.dom.body).css("height","auto");null!==a.body&&(a.body.parentNode.removeChild(a.body),a.body=null);a.body=d(this.dom.body).clone(!0)[0];a.body.className+=" DTFC_Cloned";a.body.style.paddingBottom=l.oScroll.iBarWidth+"px";a.body.style.marginBottom=2*l.oScroll.iBarWidth+"px";null!==a.body.getAttribute("id")&&a.body.removeAttribute("id");d(">thead>tr",a.body).empty();d(">tfoot", -a.body).remove();var p=d("tbody",a.body)[0];d(p).empty();if(0thead>tr",a.body)[0];for(o=0;otbody>tr",f.dom.body).each(function(a){var b=this.cloneNode(false);b.removeAttribute("id");a=f.s.dt.aoData[f.s.dt.oFeatures.bServerSide===false?f.s.dt.aiDisplay[f.s.dt._iDisplayStart+ -a]:a].anCells||d(this).children("td, th");for(o=0;o0){m=d(a[j]).clone(true,true)[0];b.appendChild(m)}}p.appendChild(b)})}else d(">tbody>tr",f.dom.body).each(function(){m=this.cloneNode(true);m.className=m.className+" DTFC_NoData";d("td",m).html("");p.appendChild(m)});a.body.style.width="100%";a.body.style.margin="0";a.body.style.padding="0";l.oScroller!==t&&(h=l.oScroller.dom.force,b.forcer?b.forcer.style.height=h.style.height:(b.forcer=h.cloneNode(!0),b.liner.appendChild(b.forcer))); -b.liner.appendChild(a.body);this._fnEqualiseHeights("tbody",f.dom.body,a.body);if(null!==l.nTFoot){if(g){null!==a.footer&&a.footer.parentNode.removeChild(a.footer);a.footer=d(this.dom.footer).clone(!0,!0)[0];a.footer.className+=" DTFC_Cloned";a.footer.style.width="100%";b.foot.appendChild(a.footer);n=this._fnCopyLayout(l.aoFooter,c);b=d(">tfoot",a.footer);b.empty();e=0;for(h=n.length;etfoot",a.footer)[0]);e=0;for(h=n.length;ethead",a.header)[0]);d(b).each(function(a){j=c[a];this.style.width=f.s.aiInnerWidths[j]+"px"});null!==f.s.dt.nTFoot&&(b=l.oApi._fnGetUniqueThs(l,d(">tfoot",a.footer)[0]),d(b).each(function(a){j=c[a];this.style.width=f.s.aiInnerWidths[j]+"px"}))},_fnGetTrNodes:function(a){for(var b= -[],c=0,d=a.childNodes.length;c"+a+">tr:eq(0)",b).children(":first");a.outerHeight();a.height();for(var e=this._fnGetTrNodes(e),b=this._fnGetTrNodes(c),h=[],c=0,a=b.length;cg?f:g,"semiauto"==this.s.sHeightMatch&& -(e[c]._DTTC_iHeight=g),h.push(g);c=0;for(a=b.length;ctfoot', s.nTable).length > 0) ? true : false; - - /* Add the 'sides' that are fixed */ - if ( s.oSides.top ) - { - s.aoCache.push( that._fnCloneTable( "fixedHeader", "FixedHeader_Header", that._fnCloneThead ) ); - } - if ( s.oSides.bottom ) - { - s.aoCache.push( that._fnCloneTable( "fixedFooter", "FixedHeader_Footer", that._fnCloneTfoot ) ); - } - if ( s.oSides.left ) - { - s.aoCache.push( that._fnCloneTable( "fixedLeft", "FixedHeader_Left", that._fnCloneTLeft, s.oSides.left ) ); - } - if ( s.oSides.right ) - { - s.aoCache.push( that._fnCloneTable( "fixedRight", "FixedHeader_Right", that._fnCloneTRight, s.oSides.right ) ); - } - - /* Event listeners for window movement */ - FixedHeader.afnScroll.push( function () { - that._fnUpdatePositions.call(that); - } ); - - $(window).resize( function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones.call(that); - that._fnUpdatePositions.call(that); - } ); - - $(s.nTable) - .on('column-reorder.dt', function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones( true ); - that._fnUpdatePositions(); - } ) - .on('column-visibility.dt', function () { - FixedHeader.fnMeasure(); - that._fnUpdateClones( true ); - that._fnUpdatePositions(); - } ); - - /* Get things right to start with */ - FixedHeader.fnMeasure(); - that._fnUpdateClones(); - that._fnUpdatePositions(); - - s.bInitComplete = true; - }, - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Support functions - */ - - /* - * Function: fnInitSettings - * Purpose: Take the user's settings and copy them to our local store - * Returns: - - * Inputs: object:s - the local settings object - * object:oInit - the user's settings object - */ - fnInitSettings: function ( s, oInit ) - { - if ( oInit !== undefined ) - { - if ( oInit.top !== undefined ) { - s.oSides.top = oInit.top; - } - if ( oInit.bottom !== undefined ) { - s.oSides.bottom = oInit.bottom; - } - if ( typeof oInit.left == 'boolean' ) { - s.oSides.left = oInit.left ? 1 : 0; - } - else if ( oInit.left !== undefined ) { - s.oSides.left = oInit.left; - } - if ( typeof oInit.right == 'boolean' ) { - s.oSides.right = oInit.right ? 1 : 0; - } - else if ( oInit.right !== undefined ) { - s.oSides.right = oInit.right; - } - - if ( oInit.zTop !== undefined ) { - s.oZIndexes.top = oInit.zTop; - } - if ( oInit.zBottom !== undefined ) { - s.oZIndexes.bottom = oInit.zBottom; - } - if ( oInit.zLeft !== undefined ) { - s.oZIndexes.left = oInit.zLeft; - } - if ( oInit.zRight !== undefined ) { - s.oZIndexes.right = oInit.zRight; - } - - if ( oInit.offsetTop !== undefined ) { - s.oOffset.top = oInit.offsetTop; - } - if ( oInit.alwaysCloneTop !== undefined ) { - s.oCloneOnDraw.top = oInit.alwaysCloneTop; - } - if ( oInit.alwaysCloneBottom !== undefined ) { - s.oCloneOnDraw.bottom = oInit.alwaysCloneBottom; - } - if ( oInit.alwaysCloneLeft !== undefined ) { - s.oCloneOnDraw.left = oInit.alwaysCloneLeft; - } - if ( oInit.alwaysCloneRight !== undefined ) { - s.oCloneOnDraw.right = oInit.alwaysCloneRight; - } - } - }, - - /* - * Function: _fnCloneTable - * Purpose: Clone the table node and do basic initialisation - * Returns: - - * Inputs: - - */ - _fnCloneTable: function ( sType, sClass, fnClone, iCells ) - { - var s = this.fnGetSettings(); - var nCTable; - - /* We know that the table _MUST_ has a DIV wrapped around it, because this is simply how - * DataTables works. Therefore, we can set this to be relatively position (if it is not - * alreadu absolute, and use this as the base point for the cloned header - */ - if ( $(s.nTable.parentNode).css('position') != "absolute" ) - { - s.nTable.parentNode.style.position = "relative"; - } - - /* Just a shallow clone will do - we only want the table node */ - nCTable = s.nTable.cloneNode( false ); - nCTable.removeAttribute( 'id' ); - - var nDiv = document.createElement( 'div' ); - nDiv.style.position = "absolute"; - nDiv.style.top = "0px"; - nDiv.style.left = "0px"; - nDiv.className += " FixedHeader_Cloned "+sType+" "+sClass; - - /* Set the zIndexes */ - if ( sType == "fixedHeader" ) - { - nDiv.style.zIndex = s.oZIndexes.top; - } - if ( sType == "fixedFooter" ) - { - nDiv.style.zIndex = s.oZIndexes.bottom; - } - if ( sType == "fixedLeft" ) - { - nDiv.style.zIndex = s.oZIndexes.left; - } - else if ( sType == "fixedRight" ) - { - nDiv.style.zIndex = s.oZIndexes.right; - } - - /* remove margins since we are going to position it absolutely */ - nCTable.style.margin = "0"; - - /* Insert the newly cloned table into the DOM, on top of the "real" header */ - nDiv.appendChild( nCTable ); - document.body.appendChild( nDiv ); - - return { - "nNode": nCTable, - "nWrapper": nDiv, - "sType": sType, - "sPosition": "", - "sTop": "", - "sLeft": "", - "fnClone": fnClone, - "iCells": iCells - }; - }, - - /* - * Function: _fnMeasure - * Purpose: Get the current positioning of the table in the DOM - * Returns: - - * Inputs: - - */ - _fnMeasure: function () - { - var - s = this.fnGetSettings(), - m = s.oMes, - jqTable = $(s.nTable), - oOffset = jqTable.offset(), - iParentScrollTop = this._fnSumScroll( s.nTable.parentNode, 'scrollTop' ), - iParentScrollLeft = this._fnSumScroll( s.nTable.parentNode, 'scrollLeft' ); - - m.iTableWidth = jqTable.outerWidth(); - m.iTableHeight = jqTable.outerHeight(); - m.iTableLeft = oOffset.left + s.nTable.parentNode.scrollLeft; - m.iTableTop = oOffset.top + iParentScrollTop; - m.iTableRight = m.iTableLeft + m.iTableWidth; - m.iTableRight = FixedHeader.oDoc.iWidth - m.iTableLeft - m.iTableWidth; - m.iTableBottom = FixedHeader.oDoc.iHeight - m.iTableTop - m.iTableHeight; - }, - - /* - * Function: _fnSumScroll - * Purpose: Sum node parameters all the way to the top - * Returns: int: sum - * Inputs: node:n - node to consider - * string:side - scrollTop or scrollLeft - */ - _fnSumScroll: function ( n, side ) - { - var i = n[side]; - while ( n = n.parentNode ) - { - if ( n.nodeName == 'HTML' || n.nodeName == 'BODY' ) - { - break; - } - i = n[side]; - } - return i; - }, - - /* - * Function: _fnUpdatePositions - * Purpose: Loop over the fixed elements for this table and update their positions - * Returns: - - * Inputs: - - */ - _fnUpdatePositions: function () - { - var s = this.fnGetSettings(); - this._fnMeasure(); - - for ( var i=0, iLen=s.aoCache.length ; i oWin.iScrollTop + s.oOffset.top ) - { - /* Above the table */ - this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', oMes.iTableTop+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style ); - } - else if ( oWin.iScrollTop + s.oOffset.top > oMes.iTableTop+iTbodyHeight ) - { - /* At the bottom of the table */ - this._fnUpdateCache( oCache, 'sPosition', "absolute", 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', (oMes.iTableTop+iTbodyHeight)+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', oMes.iTableLeft+"px", 'left', nTable.style ); - } - else - { - /* In the middle of the table */ - this._fnUpdateCache( oCache, 'sPosition', 'fixed', 'position', nTable.style ); - this._fnUpdateCache( oCache, 'sTop', s.oOffset.top+"px", 'top', nTable.style ); - this._fnUpdateCache( oCache, 'sLeft', (oMes.iTableLeft-oWin.iScrollLeft)+"px", 'left', nTable.style ); - } - }, - - /* - * Function: _fnUpdateCache - * Purpose: Check the cache and update cache and value if needed - * Returns: - - * Inputs: object:oCache - local cache object - * string:sCache - cache property - * string:sSet - value to set - * string:sProperty - object property to set - * object:oObj - object to update - */ - _fnUpdateCache: function ( oCache, sCache, sSet, sProperty, oObj ) - { - if ( oCache[sCache] != sSet ) - { - oObj[sProperty] = sSet; - oCache[sCache] = sSet; - } - }, - - - - /** - * Copy the classes of all child nodes from one element to another. This implies - * that the two have identical structure - no error checking is performed to that - * fact. - * @param {element} source Node to copy classes from - * @param {element} dest Node to copy classes too - */ - _fnClassUpdate: function ( source, dest ) - { - var that = this; - - if ( source.nodeName.toUpperCase() === "TR" || source.nodeName.toUpperCase() === "TH" || - source.nodeName.toUpperCase() === "TD" || source.nodeName.toUpperCase() === "SPAN" ) - { - dest.className = source.className; - } - - $(source).children().each( function (i) { - that._fnClassUpdate( $(source).children()[i], $(dest).children()[i] ); - } ); - }, - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Cloning functions - */ - - /* - * Function: _fnCloneThead - * Purpose: Clone the thead element - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneThead: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - - if ( s.bInitComplete && !s.oCloneOnDraw.top ) - { - this._fnClassUpdate( $('thead', s.nTable)[0], $('thead', nTable)[0] ); - return; - } - - /* Set the wrapper width to match that of the cloned table */ - var iDtWidth = $(s.nTable).outerWidth(); - oCache.nWrapper.style.width = iDtWidth+"px"; - nTable.style.width = iDtWidth+"px"; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - $('thead th', nTable).unbind( 'click' ); - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Clone the DataTables header */ - var nThead = $('thead', s.nTable).clone(true)[0]; - nTable.appendChild( nThead ); - - /* Copy the widths across - apparently a clone isn't good enough for this */ - var a = []; - var b = []; - - $("thead>tr th", s.nTable).each( function (i) { - a.push( $(this).width() ); - } ); - - $("thead>tr td", s.nTable).each( function (i) { - b.push( $(this).width() ); - } ); - - $("thead>tr th", s.nTable).each( function (i) { - $("thead>tr th:eq("+i+")", nTable).width( a[i] ); - $(this).width( a[i] ); - } ); - - $("thead>tr td", s.nTable).each( function (i) { - $("thead>tr td:eq("+i+")", nTable).width( b[i] ); - $(this).width( b[i] ); - } ); - - // Stop DataTables 1.9 from putting a focus ring on the headers when - // clicked to sort - $('th.sorting, th.sorting_desc, th.sorting_asc', nTable).bind( 'click', function () { - this.blur(); - } ); - }, - - /* - * Function: _fnCloneTfoot - * Purpose: Clone the tfoot element - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTfoot: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - - /* Set the wrapper width to match that of the cloned table */ - oCache.nWrapper.style.width = $(s.nTable).outerWidth()+"px"; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Clone the DataTables footer */ - var nTfoot = $('tfoot', s.nTable).clone(true)[0]; - nTable.appendChild( nTfoot ); - - /* Copy the widths across - apparently a clone isn't good enough for this */ - $("tfoot:eq(0)>tr th", s.nTable).each( function (i) { - $("tfoot:eq(0)>tr th:eq("+i+")", nTable).width( $(this).width() ); - } ); - - $("tfoot:eq(0)>tr td", s.nTable).each( function (i) { - $("tfoot:eq(0)>tr td:eq("+i+")", nTable).width( $(this).width() ); - } ); - }, - - /* - * Function: _fnCloneTLeft - * Purpose: Clone the left column(s) - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTLeft: function ( oCache ) - { - var s = this.fnGetSettings(); - var nTable = oCache.nNode; - var nBody = $('tbody', s.nTable)[0]; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Is this the most efficient way to do this - it looks horrible... */ - nTable.appendChild( $("thead", s.nTable).clone(true)[0] ); - nTable.appendChild( $("tbody", s.nTable).clone(true)[0] ); - if ( s.bFooter ) - { - nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] ); - } - - /* Remove unneeded cells */ - var sSelector = 'gt(' + (oCache.iCells - 1) + ')'; - $('thead tr', nTable).each( function (k) { - $('th:' + sSelector, this).remove(); - } ); - - $('tfoot tr', nTable).each( function (k) { - $('th:' + sSelector, this).remove(); - } ); - - $('tbody tr', nTable).each( function (k) { - $('td:' + sSelector, this).remove(); - } ); - - this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable ); - - var iWidth = 0; - for (var i = 0; i < oCache.iCells; i++) { - iWidth += $('thead tr th:eq(' + i + ')', s.nTable).outerWidth(); - } - nTable.style.width = iWidth+"px"; - oCache.nWrapper.style.width = iWidth+"px"; - }, - - /* - * Function: _fnCloneTRight - * Purpose: Clone the right most column(s) - * Returns: - - * Inputs: object:oCache - the cached values for this fixed element - */ - _fnCloneTRight: function ( oCache ) - { - var s = this.fnGetSettings(); - var nBody = $('tbody', s.nTable)[0]; - var nTable = oCache.nNode; - var iCols = $('tbody tr:eq(0) td', s.nTable).length; - - /* Remove any children the cloned table has */ - while ( nTable.childNodes.length > 0 ) - { - nTable.removeChild( nTable.childNodes[0] ); - } - - /* Is this the most efficient way to do this - it looks horrible... */ - nTable.appendChild( $("thead", s.nTable).clone(true)[0] ); - nTable.appendChild( $("tbody", s.nTable).clone(true)[0] ); - if ( s.bFooter ) - { - nTable.appendChild( $("tfoot", s.nTable).clone(true)[0] ); - } - $('thead tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove(); - $('tfoot tr th:lt('+(iCols-oCache.iCells)+')', nTable).remove(); - - /* Remove unneeded cells */ - $('tbody tr', nTable).each( function (k) { - $('td:lt('+(iCols-oCache.iCells)+')', this).remove(); - } ); - - this.fnEqualiseHeights( 'thead', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tbody', nBody.parentNode, nTable ); - this.fnEqualiseHeights( 'tfoot', nBody.parentNode, nTable ); - - var iWidth = 0; - for (var i = 0; i < oCache.iCells; i++) { - iWidth += $('thead tr th:eq('+(iCols-1-i)+')', s.nTable).outerWidth(); - } - nTable.style.width = iWidth+"px"; - oCache.nWrapper.style.width = iWidth+"px"; - }, - - - /** - * Equalise the heights of the rows in a given table node in a cross browser way. Note that this - * is more or less lifted as is from FixedColumns - * @method fnEqualiseHeights - * @returns void - * @param {string} parent Node type - thead, tbody or tfoot - * @param {element} original Original node to take the heights from - * @param {element} clone Copy the heights to - * @private - */ - "fnEqualiseHeights": function ( parent, original, clone ) - { - var that = this; - var originals = $(parent +' tr', original); - var height; - - $(parent+' tr', clone).each( function (k) { - height = originals.eq( k ).css('height'); - - // This is nasty :-(. IE has a sub-pixel error even when setting - // the height below (the Firefox fix) which causes the fixed column - // to go out of alignment. Need to add a pixel before the assignment - // Can this be feature detected? Not sure how... - if ( navigator.appName == 'Microsoft Internet Explorer' ) { - height = parseInt( height, 10 ) + 1; - } - - $(this).css( 'height', height ); - - // For Firefox to work, we need to also set the height of the - // original row, to the value that we read from it! Otherwise there - // is a sub-pixel rounding error - originals.eq( k ).css( 'height', height ); - } ); - } -}; - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Static properties and methods - * We use these for speed! This information is common to all instances of FixedHeader, so no - * point if having them calculated and stored for each different instance. - */ - -/* - * Variable: oWin - * Purpose: Store information about the window positioning - * Scope: FixedHeader - */ -FixedHeader.oWin = { - "iScrollTop": 0, - "iScrollRight": 0, - "iScrollBottom": 0, - "iScrollLeft": 0, - "iHeight": 0, - "iWidth": 0 -}; - -/* - * Variable: oDoc - * Purpose: Store information about the document size - * Scope: FixedHeader - */ -FixedHeader.oDoc = { - "iHeight": 0, - "iWidth": 0 -}; - -/* - * Variable: afnScroll - * Purpose: Array of functions that are to be used for the scrolling components - * Scope: FixedHeader - */ -FixedHeader.afnScroll = []; - -/* - * Function: fnMeasure - * Purpose: Update the measurements for the window and document - * Returns: - - * Inputs: - - */ -FixedHeader.fnMeasure = function () -{ - var - jqWin = $(window), - jqDoc = $(document), - oWin = FixedHeader.oWin, - oDoc = FixedHeader.oDoc; - - oDoc.iHeight = jqDoc.height(); - oDoc.iWidth = jqDoc.width(); - - oWin.iHeight = jqWin.height(); - oWin.iWidth = jqWin.width(); - oWin.iScrollTop = jqWin.scrollTop(); - oWin.iScrollLeft = jqWin.scrollLeft(); - oWin.iScrollRight = oDoc.iWidth - oWin.iScrollLeft - oWin.iWidth; - oWin.iScrollBottom = oDoc.iHeight - oWin.iScrollTop - oWin.iHeight; -}; - - -FixedHeader.version = "2.1.2"; - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Global processing - */ - -/* - * Just one 'scroll' event handler in FixedHeader, which calls the required components. This is - * done as an optimisation, to reduce calculation and proagation time - */ -$(window).scroll( function () { - FixedHeader.fnMeasure(); - - for ( var i=0, iLen=FixedHeader.afnScroll.length ; itfoot",c.nTable).length?!0:!1,c.oSides.top&&c.aoCache.push(d._fnCloneTable("fixedHeader","FixedHeader_Header",d._fnCloneThead)),c.oSides.bottom&&c.aoCache.push(d._fnCloneTable("fixedFooter","FixedHeader_Footer",d._fnCloneTfoot)),c.oSides.left&&c.aoCache.push(d._fnCloneTable("fixedLeft","FixedHeader_Left",d._fnCloneTLeft,c.oSides.left)), -c.oSides.right&&c.aoCache.push(d._fnCloneTable("fixedRight","FixedHeader_Right",d._fnCloneTRight,c.oSides.right)),FixedHeader.afnScroll.push(function(){d._fnUpdatePositions.call(d)}),e(j).resize(function(){FixedHeader.fnMeasure();d._fnUpdateClones.call(d);d._fnUpdatePositions.call(d)}),e(c.nTable).on("column-reorder.dt",function(){FixedHeader.fnMeasure();d._fnUpdateClones(!0);d._fnUpdatePositions()}).on("column-visibility.dt",function(){FixedHeader.fnMeasure();d._fnUpdateClones(!0);d._fnUpdatePositions()}), -FixedHeader.fnMeasure(),d._fnUpdateClones(),d._fnUpdatePositions(),c.bInitComplete=!0)},fnInitSettings:function(a,b){if(b!==h&&(b.top!==h&&(a.oSides.top=b.top),b.bottom!==h&&(a.oSides.bottom=b.bottom),"boolean"==typeof b.left?a.oSides.left=b.left?1:0:b.left!==h&&(a.oSides.left=b.left),"boolean"==typeof b.right?a.oSides.right=b.right?1:0:b.right!==h&&(a.oSides.right=b.right),b.zTop!==h&&(a.oZIndexes.top=b.zTop),b.zBottom!==h&&(a.oZIndexes.bottom=b.zBottom),b.zLeft!==h&&(a.oZIndexes.left=b.zLeft),b.zRight!== -h&&(a.oZIndexes.right=b.zRight),b.offsetTop!==h&&(a.oOffset.top=b.offsetTop),b.alwaysCloneTop!==h&&(a.oCloneOnDraw.top=b.alwaysCloneTop),b.alwaysCloneBottom!==h&&(a.oCloneOnDraw.bottom=b.alwaysCloneBottom),b.alwaysCloneLeft!==h&&(a.oCloneOnDraw.left=b.alwaysCloneLeft),b.alwaysCloneRight!==h))a.oCloneOnDraw.right=b.alwaysCloneRight},_fnCloneTable:function(a,b,c,d){var f=this.fnGetSettings(),g;"absolute"!=e(f.nTable.parentNode).css("position")&&(f.nTable.parentNode.style.position="relative");g=f.nTable.cloneNode(!1); -g.removeAttribute("id");var i=k.createElement("div");i.style.position="absolute";i.style.top="0px";i.style.left="0px";i.className+=" FixedHeader_Cloned "+a+" "+b;"fixedHeader"==a&&(i.style.zIndex=f.oZIndexes.top);"fixedFooter"==a&&(i.style.zIndex=f.oZIndexes.bottom);"fixedLeft"==a?i.style.zIndex=f.oZIndexes.left:"fixedRight"==a&&(i.style.zIndex=f.oZIndexes.right);g.style.margin="0";i.appendChild(g);k.body.appendChild(i);return{nNode:g,nWrapper:i,sType:a,sPosition:"",sTop:"",sLeft:"",fnClone:c,iCells:d}}, -_fnMeasure:function(){var a=this.fnGetSettings(),b=a.oMes,c=e(a.nTable),d=c.offset(),f=this._fnSumScroll(a.nTable.parentNode,"scrollTop");this._fnSumScroll(a.nTable.parentNode,"scrollLeft");b.iTableWidth=c.outerWidth();b.iTableHeight=c.outerHeight();b.iTableLeft=d.left+a.nTable.parentNode.scrollLeft;b.iTableTop=d.top+f;b.iTableRight=b.iTableLeft+b.iTableWidth;b.iTableRight=FixedHeader.oDoc.iWidth-b.iTableLeft-b.iTableWidth;b.iTableBottom=FixedHeader.oDoc.iHeight-b.iTableTop-b.iTableHeight},_fnSumScroll:function(a, -b){for(var c=a[b];(a=a.parentNode)&&!("HTML"==a.nodeName||"BODY"==a.nodeName);)c=a[b];return c},_fnUpdatePositions:function(){var a=this.fnGetSettings();this._fnMeasure();for(var b=0,c=a.aoCache.length;bd.iScrollTop+b.oOffset.top?(this._fnUpdateCache(a,"sPosition","absolute","position",e.style),this._fnUpdateCache(a,"sTop",c.iTableTop+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft+"px","left",e.style)):d.iScrollTop+b.oOffset.top>c.iTableTop+ -g?(this._fnUpdateCache(a,"sPosition","absolute","position",e.style),this._fnUpdateCache(a,"sTop",c.iTableTop+g+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft+"px","left",e.style)):(this._fnUpdateCache(a,"sPosition","fixed","position",e.style),this._fnUpdateCache(a,"sTop",b.oOffset.top+"px","top",e.style),this._fnUpdateCache(a,"sLeft",c.iTableLeft-d.iScrollLeft+"px","left",e.style))},_fnUpdateCache:function(a,b,c,d,e){a[b]!=c&&(e[d]=c,a[b]=c)},_fnClassUpdate:function(a,b){var c=this; -if("TR"===a.nodeName.toUpperCase()||"TH"===a.nodeName.toUpperCase()||"TD"===a.nodeName.toUpperCase()||"SPAN"===a.nodeName.toUpperCase())b.className=a.className;e(a).children().each(function(d){c._fnClassUpdate(e(a).children()[d],e(b).children()[d])})},_fnCloneThead:function(a){var b=this.fnGetSettings(),c=a.nNode;if(b.bInitComplete&&!b.oCloneOnDraw.top)this._fnClassUpdate(e("thead",b.nTable)[0],e("thead",c)[0]);else{var d=e(b.nTable).outerWidth();a.nWrapper.style.width=d+"px";for(c.style.width=d+ -"px";0tr th",b.nTable).each(function(){f.push(e(this).width())});e("thead>tr td",b.nTable).each(function(){g.push(e(this).width())});e("thead>tr th",b.nTable).each(function(a){e("thead>tr th:eq("+a+")",c).width(f[a]);e(this).width(f[a])});e("thead>tr td",b.nTable).each(function(a){e("thead>tr td:eq("+a+")",c).width(g[a]);e(this).width(g[a])}); -e("th.sorting, th.sorting_desc, th.sorting_asc",c).bind("click",function(){this.blur()})}},_fnCloneTfoot:function(a){var b=this.fnGetSettings(),c=a.nNode;for(a.nWrapper.style.width=e(b.nTable).outerWidth()+"px";0tr th",b.nTable).each(function(a){e("tfoot:eq(0)>tr th:eq("+a+")",c).width(e(this).width())});e("tfoot:eq(0)>tr td",b.nTable).each(function(a){e("tfoot:eq(0)>tr td:eq("+ -a+")",c).width(e(this).width())})},_fnCloneTLeft:function(a){for(var b=this.fnGetSettings(),c=a.nNode,d=e("tbody",b.nTable)[0];0= oSettings.fnDisplayEnd() ) - { - if ( oSettings._iDisplayLength >= 0 ) - { - /* Make sure we are not over running the display array */ - if ( oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay() ) - { - oSettings._iDisplayStart += oSettings._iDisplayLength; - } - } - else - { - oSettings._iDisplayStart = 0; - } - _oDatatable.oApi._fnCalculateEnd( oSettings ); - } - - /* Page backwards */ - while ( iRow < oSettings._iDisplayStart ) - { - oSettings._iDisplayStart = oSettings._iDisplayLength>=0 ? - oSettings._iDisplayStart - oSettings._iDisplayLength : - 0; - - if ( oSettings._iDisplayStart < 0 ) - { - oSettings._iDisplayStart = 0; - } - _oDatatable.oApi._fnCalculateEnd( oSettings ); - } - - /* Re-draw the table */ - _oDatatable.oApi._fnDraw( oSettings ); - - /* Restore the key capture */ - _bKeyCapture = bKeyCaptureCache; - } - - /* Cache the information that we are interested in */ - var aNewPos = _fnCoordsFromCell( nTarget ); - _nOldFocus = nTarget; - _iOldX = aNewPos[0]; - _iOldY = aNewPos[1]; - - var iViewportHeight, iViewportWidth, iScrollTop, iScrollLeft, iHeight, iWidth, aiPos; - if ( bAutoScroll ) - { - /* Scroll the viewport such that the new cell is fully visible in the rendered window */ - iViewportHeight = $(window).height(); - iViewportWidth = $(window).width(); - iScrollTop = $(document).scrollTop(); - iScrollLeft = $(document).scrollLeft(); - iHeight = nTarget.offsetHeight; - iWidth = nTarget.offsetWidth; - aiPos = _fnGetPos( nTarget ); - - /* Take account of scrolling in DataTables 1.7 - remove scrolling since that would add to - * the positioning calculation - */ - if ( _oDatatable && typeof oSettings.oScroll != 'undefined' && - (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) - { - aiPos[1] -= $(oSettings.nTable.parentNode).scrollTop(); - aiPos[0] -= $(oSettings.nTable.parentNode).scrollLeft(); - } - - /* Correct viewport positioning for vertical scrolling */ - if ( aiPos[1]+iHeight > iScrollTop+iViewportHeight ) - { - /* Displayed element if off the bottom of the viewport */ - _fnSetScrollTop( aiPos[1]+iHeight - iViewportHeight ); - } - else if ( aiPos[1] < iScrollTop ) - { - /* Displayed element if off the top of the viewport */ - _fnSetScrollTop( aiPos[1] ); - } - - /* Correct viewport positioning for horizontal scrolling */ - if ( aiPos[0]+iWidth > iScrollLeft+iViewportWidth ) - { - /* Displayed element is off the bottom of the viewport */ - _fnSetScrollLeft( aiPos[0]+iWidth - iViewportWidth ); - } - else if ( aiPos[0] < iScrollLeft ) - { - /* Displayed element if off the Left of the viewport */ - _fnSetScrollLeft( aiPos[0] ); - } - } - - /* Take account of scrolling in DataTables 1.7 */ - if ( _oDatatable && typeof oSettings.oScroll != 'undefined' && - (oSettings.oScroll.sX !== "" || oSettings.oScroll.sY !== "") ) - { - var dtScrollBody = oSettings.nTable.parentNode; - iViewportHeight = dtScrollBody.clientHeight; - iViewportWidth = dtScrollBody.clientWidth; - iScrollTop = dtScrollBody.scrollTop; - iScrollLeft = dtScrollBody.scrollLeft; - iHeight = nTarget.offsetHeight; - iWidth = nTarget.offsetWidth; - - /* Correct for vertical scrolling */ - if ( nTarget.offsetTop + iHeight > iViewportHeight+iScrollTop ) - { - dtScrollBody.scrollTop = (nTarget.offsetTop + iHeight) - iViewportHeight; - } - else if ( nTarget.offsetTop < iScrollTop ) - { - dtScrollBody.scrollTop = nTarget.offsetTop; - } - - /* Correct for horizontal scrolling */ - if ( nTarget.offsetLeft + iWidth > iViewportWidth+iScrollLeft ) - { - dtScrollBody.scrollLeft = (nTarget.offsetLeft + iWidth) - iViewportWidth; - } - else if ( nTarget.offsetLeft < iScrollLeft ) - { - dtScrollBody.scrollLeft = nTarget.offsetLeft; - } - } - - /* Focused - so we want to capture the keys */ - _fnCaptureKeys(); - - /* Fire of the focus event if there is one */ - _fnEventFire( "focus", _iOldX, _iOldY ); - } - - - /* - * Function: _fnBlur - * Purpose: Blur focus from the whole table - * Returns: - - * Inputs: - - */ - function _fnBlur() - { - _fnRemoveFocus( _nOldFocus ); - _iOldX = null; - _iOldY = null; - _nOldFocus = null; - _fnReleaseKeys(); - } - - - /* - * Function: _fnRemoveFocus - * Purpose: Remove focus from a cell and fire any blur events which are attached - * Returns: - - * Inputs: node:nTarget - cell of interest - */ - function _fnRemoveFocus( nTarget ) - { - $(nTarget).removeClass( _sFocusClass ); - $(nTarget).parent().removeClass( _sFocusClass ); - _fnEventFire( "blur", _iOldX, _iOldY ); - } - - - /* - * Function: _fnClick - * Purpose: Focus on the element that has been clicked on by the user - * Returns: - - * Inputs: event:e - click event - */ - function _fnClick ( e ) - { - var nTarget = this; - while ( nTarget.nodeName != "TD" ) - { - nTarget = nTarget.parentNode; - } - - _fnSetFocus( nTarget ); - _fnCaptureKeys(); - } - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Key events - */ - - /* - * Function: _fnKey - * Purpose: Deal with a key events, be it moving the focus or return etc. - * Returns: bool: - allow browser default action - * Inputs: event:e - key event - */ - function _fnKey ( e ) - { - /* If user or system has blocked KeyTable from doing anything, just ignore this event */ - if ( _that.block || !_bKeyCapture ) - { - return true; - } - - /* If a modifier key is pressed (exapct shift), ignore the event */ - if ( e.metaKey || e.altKey || e.ctrlKey ) - { - return true; - } - var - x, y, - iTableWidth = _nBody.getElementsByTagName('tr')[0].getElementsByTagName('td').length, - iTableHeight; - - /* Get table height and width - done here so as to be dynamic (if table is updated) */ - if ( _oDatatable ) - { - /* - * Locate the current node in the DataTable overriding the old positions - the reason for - * is is that there might have been some DataTables interaction between the last focus and - * now - */ - iTableHeight = _oDatatable.aiDisplay.length; - - var aDtPos = _fnFindDtCell( _nOldFocus ); - if ( aDtPos === null ) - { - /* If the table has been updated such that the focused cell can't be seen - do nothing */ - return; - } - _iOldX = aDtPos[ 0 ]; - _iOldY = aDtPos[ 1 ]; - } - else - { - iTableHeight = _nBody.getElementsByTagName('tr').length; - } - - /* Capture shift+tab to match the left arrow key */ - var iKey = (e.keyCode == 9 && e.shiftKey) ? -1 : e.keyCode; - - switch( iKey ) - { - case 13: /* return */ - e.preventDefault(); - e.stopPropagation(); - _fnEventFire( "action", _iOldX, _iOldY ); - return true; - - case 27: /* esc */ - if ( !_fnEventFire( "esc", _iOldX, _iOldY ) ) - { - /* Only lose focus if there isn't an escape handler on the cell */ - _fnBlur(); - return; - } - x = _iOldX; - y = _iOldY; - break; - - case -1: - case 37: /* left arrow */ - if ( _iOldX > 0 ) { - x = _iOldX - 1; - y = _iOldY; - } else if ( _iOldY > 0 ) { - x = iTableWidth-1; - y = _iOldY - 1; - } else { - /* at start of table */ - if ( iKey == -1 && _bForm ) - { - /* If we are in a form, return focus to the 'input' element such that tabbing will - * follow correctly in the browser - */ - _bInputFocused = true; - _nInput.focus(); - - /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for - * focus - */ - setTimeout( function(){ _bInputFocused = false; }, 0 ); - _bKeyCapture = false; - _fnBlur(); - return true; - } - else - { - return false; - } - } - break; - - case 38: /* up arrow */ - if ( _iOldY > 0 ) { - x = _iOldX; - y = _iOldY - 1; - } else { - return false; - } - break; - - case 36: /* home */ - x = _iOldX; - y = 0; - break; - - case 33: /* page up */ - x = _iOldX; - y = _iOldY - 10; - if (y < 0) { - y = 0; - } - break; - - case 9: /* tab */ - case 39: /* right arrow */ - if ( _iOldX < iTableWidth-1 ) { - x = _iOldX + 1; - y = _iOldY; - } else if ( _iOldY < iTableHeight-1 ) { - x = 0; - y = _iOldY + 1; - } else { - /* at end of table */ - if ( iKey == 9 && _bForm ) - { - /* If we are in a form, return focus to the 'input' element such that tabbing will - * follow correctly in the browser - */ - _bInputFocused = true; - _nInput.focus(); - - /* This timeout is a little nasty - but IE appears to have some asyhnc behaviour for - * focus - */ - setTimeout( function(){ _bInputFocused = false; }, 0 ); - _bKeyCapture = false; - _fnBlur(); - return true; - } - else - { - return false; - } - } - break; - - case 40: /* down arrow */ - if ( _iOldY < iTableHeight-1 ) { - x = _iOldX; - y = _iOldY + 1; - } else { - return false; - } - break; - - case 35: /* end */ - x = _iOldX; - y = iTableHeight-1; - break; - - case 34: /* page down */ - x = _iOldX; - y = _iOldY+10; - if (y > iTableHeight-1) { - y = iTableHeight-1; - } - break; - - default: /* Nothing we are interested in */ - return true; - } - - _fnSetFocus( _fnCellFromCoords(x, y) ); - return false; - } - - - /* - * Function: _fnCaptureKeys - * Purpose: Start capturing key events for this table - * Returns: - - * Inputs: - - */ - function _fnCaptureKeys( ) - { - if ( !_bKeyCapture ) - { - _bKeyCapture = true; - } - } - - - /* - * Function: _fnReleaseKeys - * Purpose: Stop capturing key events for this table - * Returns: - - * Inputs: - - */ - function _fnReleaseKeys( ) - { - _bKeyCapture = false; - } - - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Support functions - */ - - /* - * Function: _fnCellFromCoords - * Purpose: Calulate the target TD cell from x and y coordinates - * Returns: node: - TD target - * Inputs: int:x - x coordinate - * int:y - y coordinate - */ - function _fnCellFromCoords( x, y ) - { - if ( _oDatatable ) - { - if ( typeof _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ] != 'undefined' ) - { - return _oDatatable.aoData[ _oDatatable.aiDisplay[ y ] ].nTr.getElementsByTagName('td')[x]; - } - else - { - return null; - } - } - else - { - return $('tr:eq('+y+')>td:eq('+x+')', _nBody )[0]; - } - } - - - /* - * Function: _fnCoordsFromCell - * Purpose: Calculate the x and y position in a table from a TD cell - * Returns: array[2] int: [x, y] - * Inputs: node:n - TD cell of interest - * Notes: Not actually interested in this for DataTables since it might go out of date - */ - function _fnCoordsFromCell( n ) - { - if ( _oDatatable ) - { - return [ - $('td', n.parentNode).index(n), - $('tr', n.parentNode.parentNode).index(n.parentNode) + _oDatatable._iDisplayStart - ]; - } - else - { - return [ - $('td', n.parentNode).index(n), - $('tr', n.parentNode.parentNode).index(n.parentNode) - ]; - } - } - - - /* - * Function: _fnSetScrollTop - * Purpose: Set the vertical scrolling position - * Returns: - - * Inputs: int:iPos - scrolltop - * Notes: This is so nasty, but without browser detection you can't tell which you should set - * So on browsers that support both, the scroll top will be set twice. I can live with - * that :-) - */ - function _fnSetScrollTop( iPos ) - { - document.documentElement.scrollTop = iPos; - document.body.scrollTop = iPos; - } - - - /* - * Function: _fnSetScrollLeft - * Purpose: Set the horizontal scrolling position - * Returns: - - * Inputs: int:iPos - scrollleft - */ - function _fnSetScrollLeft( iPos ) - { - document.documentElement.scrollLeft = iPos; - document.body.scrollLeft = iPos; - } - - - /* - * Function: _fnGetPos - * Purpose: Get the position of an object on the rendered page - * Returns: array[2] int: [left, right] - * Inputs: node:obj - element of interest - */ - function _fnGetPos ( obj ) - { - var iLeft = 0; - var iTop = 0; - - if (obj.offsetParent) - { - iLeft = obj.offsetLeft; - iTop = obj.offsetTop; - obj = obj.offsetParent; - while (obj) - { - iLeft += obj.offsetLeft; - iTop += obj.offsetTop; - obj = obj.offsetParent; - } - } - return [iLeft,iTop]; - } - - - /* - * Function: _fnFindDtCell - * Purpose: Get the coords. of a cell from the DataTables internal information - * Returns: array[2] int: [x, y] coords. or null if not found - * Inputs: node:nTarget - the node of interest - */ - function _fnFindDtCell( nTarget ) - { - for ( var i=0, iLen=_oDatatable.aiDisplay.length ; i
    '; - } - else { - // all other browsers get an EMBED tag - html += ''; - } - return html; - }, - - hide: function() { - // temporarily hide floater offscreen - if (this.div) { - this.div.style.left = '-2000px'; - } - }, - - show: function() { - // show ourselves after a call to hide() - this.reposition(); - }, - - destroy: function() { - // destroy control and floater - if (this.domElement && this.div) { - this.hide(); - this.div.innerHTML = ''; - - var body = document.getElementsByTagName('body')[0]; - try { body.removeChild( this.div ); } catch(e) {} - - this.domElement = null; - this.div = null; - } - }, - - reposition: function(elem) { - // reposition our floating div, optionally to new container - // warning: container CANNOT change size, only position - if (elem) { - this.domElement = ZeroClipboard_TableTools.$(elem); - if (!this.domElement) { - this.hide(); - } - } - - if (this.domElement && this.div) { - var box = ZeroClipboard_TableTools.getDOMObjectPosition(this.domElement); - var style = this.div.style; - style.left = '' + box.left + 'px'; - style.top = '' + box.top + 'px'; - } - }, - - clearText: function() { - // clear the text to be copy / saved - this.clipText = ''; - if (this.ready) { - this.movie.clearText(); - } - }, - - appendText: function(newText) { - // append text to that which is to be copied / saved - this.clipText += newText; - if (this.ready) { this.movie.appendText(newText) ;} - }, - - setText: function(newText) { - // set text to be copied to be copied / saved - this.clipText = newText; - if (this.ready) { this.movie.setText(newText) ;} - }, - - setCharSet: function(charSet) { - // set the character set (UTF16LE or UTF8) - this.charSet = charSet; - if (this.ready) { this.movie.setCharSet(charSet) ;} - }, - - setBomInc: function(bomInc) { - // set if the BOM should be included or not - this.incBom = bomInc; - if (this.ready) { this.movie.setBomInc(bomInc) ;} - }, - - setFileName: function(newText) { - // set the file name - this.fileName = newText; - if (this.ready) { - this.movie.setFileName(newText); - } - }, - - setAction: function(newText) { - // set action (save or copy) - this.action = newText; - if (this.ready) { - this.movie.setAction(newText); - } - }, - - addEventListener: function(eventName, func) { - // add user event listener for event - // event types: load, queueStart, fileStart, fileComplete, queueComplete, progress, error, cancel - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - if (!this.handlers[eventName]) { - this.handlers[eventName] = []; - } - this.handlers[eventName].push(func); - }, - - setHandCursor: function(enabled) { - // enable hand cursor (true), or default arrow cursor (false) - this.handCursorEnabled = enabled; - if (this.ready) { - this.movie.setHandCursor(enabled); - } - }, - - setCSSEffects: function(enabled) { - // enable or disable CSS effects on DOM container - this.cssEffects = !!enabled; - }, - - receiveEvent: function(eventName, args) { - var self; - - // receive event from flash - eventName = eventName.toString().toLowerCase().replace(/^on/, ''); - - // special behavior for certain events - switch (eventName) { - case 'load': - // movie claims it is ready, but in IE this isn't always the case... - // bug fix: Cannot extend EMBED DOM elements in Firefox, must use traditional function - this.movie = document.getElementById(this.movieId); - if (!this.movie) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 1 ); - return; - } - - // firefox on pc needs a "kick" in order to set these in certain cases - if (!this.ready && navigator.userAgent.match(/Firefox/) && navigator.userAgent.match(/Windows/)) { - self = this; - setTimeout( function() { self.receiveEvent('load', null); }, 100 ); - this.ready = true; - return; - } - - this.ready = true; - this.movie.clearText(); - this.movie.appendText( this.clipText ); - this.movie.setFileName( this.fileName ); - this.movie.setAction( this.action ); - this.movie.setCharSet( this.charSet ); - this.movie.setBomInc( this.incBom ); - this.movie.setHandCursor( this.handCursorEnabled ); - break; - - case 'mouseover': - if (this.domElement && this.cssEffects) { - //this.domElement.addClass('hover'); - if (this.recoverActive) { - this.domElement.addClass('active'); - } - } - break; - - case 'mouseout': - if (this.domElement && this.cssEffects) { - this.recoverActive = false; - if (this.domElement.hasClass('active')) { - this.domElement.removeClass('active'); - this.recoverActive = true; - } - //this.domElement.removeClass('hover'); - } - break; - - case 'mousedown': - if (this.domElement && this.cssEffects) { - this.domElement.addClass('active'); - } - break; - - case 'mouseup': - if (this.domElement && this.cssEffects) { - this.domElement.removeClass('active'); - this.recoverActive = false; - } - break; - } // switch eventName - - if (this.handlers[eventName]) { - for (var idx = 0, len = this.handlers[eventName].length; idx < len; idx++) { - var func = this.handlers[eventName][idx]; - - if (typeof(func) == 'function') { - // actual function reference - func(this, args); - } - else if ((typeof(func) == 'object') && (func.length == 2)) { - // PHP style object + method, i.e. [myObject, 'myMethod'] - func[0][ func[1] ](this, args); - } - else if (typeof(func) == 'string') { - // name of function - window[func](this, args); - } - } // foreach event handler defined - } // user defined handler for event - } - -}; - -// For the Flash binding to work, ZeroClipboard_TableTools must be on the global -// object list -window.ZeroClipboard_TableTools = ZeroClipboard_TableTools; -//include TableTools.js -/* TableTools - * 2009-2015 SpryMedia Ltd - datatables.net/license - */ - -/*globals TableTools,ZeroClipboard_TableTools*/ - - -(function($, window, document) { - -/** - * TableTools provides flexible buttons and other tools for a DataTables enhanced table - * @class TableTools - * @constructor - * @param {Object} oDT DataTables instance. When using DataTables 1.10 this can - * also be a jQuery collection, jQuery selector, table node, DataTables API - * instance or DataTables settings object. - * @param {Object} oOpts TableTools options - * @param {String} oOpts.sSwfPath ZeroClipboard SWF path - * @param {String} oOpts.sRowSelect Row selection options - 'none', 'single', 'multi' or 'os' - * @param {Function} oOpts.fnPreRowSelect Callback function just prior to row selection - * @param {Function} oOpts.fnRowSelected Callback function just after row selection - * @param {Function} oOpts.fnRowDeselected Callback function when row is deselected - * @param {Array} oOpts.aButtons List of buttons to be used - */ -TableTools = function( oDT, oOpts ) -{ - /* Santiy check that we are a new instance */ - if ( ! this instanceof TableTools ) - { - alert( "Warning: TableTools must be initialised with the keyword 'new'" ); - } - - // In 1.10 we can use the API to get the settings object from a number of - // sources - var dtSettings = $.fn.dataTable.Api ? - new $.fn.dataTable.Api( oDT ).settings()[0] : - oDT.fnSettings(); - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class variables - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * @namespace Settings object which contains customisable information for TableTools instance - */ - this.s = { - /** - * Store 'this' so the instance can be retrieved from the settings object - * @property that - * @type object - * @default this - */ - "that": this, - - /** - * DataTables settings objects - * @property dt - * @type object - * @default From the oDT init option - */ - "dt": dtSettings, - - /** - * @namespace Print specific information - */ - "print": { - /** - * DataTables draw 'start' point before the printing display was shown - * @property saveStart - * @type int - * @default -1 - */ - "saveStart": -1, - - /** - * DataTables draw 'length' point before the printing display was shown - * @property saveLength - * @type int - * @default -1 - */ - "saveLength": -1, - - /** - * Page scrolling point before the printing display was shown so it can be restored - * @property saveScroll - * @type int - * @default -1 - */ - "saveScroll": -1, - - /** - * Wrapped function to end the print display (to maintain scope) - * @property funcEnd - * @type Function - * @default function () {} - */ - "funcEnd": function () {} - }, - - /** - * A unique ID is assigned to each button in each instance - * @property buttonCounter - * @type int - * @default 0 - */ - "buttonCounter": 0, - - /** - * @namespace Select rows specific information - */ - "select": { - /** - * Select type - can be 'none', 'single' or 'multi' - * @property type - * @type string - * @default "" - */ - "type": "", - - /** - * Array of nodes which are currently selected - * @property selected - * @type array - * @default [] - */ - "selected": [], - - /** - * Function to run before the selection can take place. Will cancel the select if the - * function returns false - * @property preRowSelect - * @type Function - * @default null - */ - "preRowSelect": null, - - /** - * Function to run when a row is selected - * @property postSelected - * @type Function - * @default null - */ - "postSelected": null, - - /** - * Function to run when a row is deselected - * @property postDeselected - * @type Function - * @default null - */ - "postDeselected": null, - - /** - * Indicate if all rows are selected (needed for server-side processing) - * @property all - * @type boolean - * @default false - */ - "all": false, - - /** - * Class name to add to selected TR nodes - * @property selectedClass - * @type String - * @default "" - */ - "selectedClass": "" - }, - - /** - * Store of the user input customisation object - * @property custom - * @type object - * @default {} - */ - "custom": {}, - - /** - * SWF movie path - * @property swfPath - * @type string - * @default "" - */ - "swfPath": "", - - /** - * Default button set - * @property buttonSet - * @type array - * @default [] - */ - "buttonSet": [], - - /** - * When there is more than one TableTools instance for a DataTable, there must be a - * master which controls events (row selection etc) - * @property master - * @type boolean - * @default false - */ - "master": false, - - /** - * Tag names that are used for creating collections and buttons - * @namesapce - */ - "tags": {} - }; - - - /** - * @namespace Common and useful DOM elements for the class instance - */ - this.dom = { - /** - * DIV element that is create and all TableTools buttons (and their children) put into - * @property container - * @type node - * @default null - */ - "container": null, - - /** - * The table node to which TableTools will be applied - * @property table - * @type node - * @default null - */ - "table": null, - - /** - * @namespace Nodes used for the print display - */ - "print": { - /** - * Nodes which have been removed from the display by setting them to display none - * @property hidden - * @type array - * @default [] - */ - "hidden": [], - - /** - * The information display saying telling the user about the print display - * @property message - * @type node - * @default null - */ - "message": null - }, - - /** - * @namespace Nodes used for a collection display. This contains the currently used collection - */ - "collection": { - /** - * The div wrapper containing the buttons in the collection (i.e. the menu) - * @property collection - * @type node - * @default null - */ - "collection": null, - - /** - * Background display to provide focus and capture events - * @property background - * @type node - * @default null - */ - "background": null - } - }; - - /** - * @namespace Name space for the classes that this TableTools instance will use - * @extends TableTools.classes - */ - this.classes = $.extend( true, {}, TableTools.classes ); - if ( this.s.dt.bJUI ) - { - $.extend( true, this.classes, TableTools.classes_themeroller ); - } - - - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public class methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @method fnSettings - * @returns {object} TableTools settings object - */ - this.fnSettings = function () { - return this.s; - }; - - - /* Constructor logic */ - if ( typeof oOpts == 'undefined' ) - { - oOpts = {}; - } - - - TableTools._aInstances.push( this ); - this._fnConstruct( oOpts ); - - return this; -}; - - - -TableTools.prototype = { - /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Public methods - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - - /** - * Retreieve the settings object from an instance - * @returns {array} List of TR nodes which are currently selected - * @param {boolean} [filtered=false] Get only selected rows which are - * available given the filtering applied to the table. By default - * this is false - i.e. all rows, regardless of filtering are - selected. - */ - "fnGetSelected": function ( filtered ) - { - var - out = [], - data = this.s.dt.aoData, - displayed = this.s.dt.aiDisplay, - i, iLen; - - if ( filtered ) - { - // Only consider filtered rows - for ( i=0, iLen=displayed.length ; i 0 ) - { - sTitle = anTitle[0].innerHTML; - } - } - - /* Strip characters which the OS will object to - checking for UTF8 support in the scripting - * engine - */ - if ( "\u00A1".toString().length < 4 ) { - return sTitle.replace(/[^a-zA-Z0-9_\u00A1-\uFFFF\.,\-_ !\(\)]/g, ""); - } else { - return sTitle.replace(/[^a-zA-Z0-9_\.,\-_ !\(\)]/g, ""); - } - }, - - - /** - * Calculate a unity array with the column width by proportion for a set of columns to be - * included for a button. This is particularly useful for PDF creation, where we can use the - * column widths calculated by the browser to size the columns in the PDF. - * @param {Object} oConfig Button configuration object - * @returns {Array} Unity array of column ratios - */ - "fnCalcColRatios": function ( oConfig ) - { - var - aoCols = this.s.dt.aoColumns, - aColumnsInc = this._fnColumnTargets( oConfig.mColumns ), - aColWidths = [], - iWidth = 0, iTotal = 0, i, iLen; - - for ( i=0, iLen=aColumnsInc.length ; i