Merge branch 'product-iots-37' into 'master'

Changing the device type plugins according to changes made in core related to Features

See merge request entgra/carbon-device-mgt-plugins!27
revert-dabc3590
Charitha Goonetilleke 6 years ago
commit a6ab78164f

@ -57,7 +57,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>

@ -203,7 +203,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
</plugin>
</plugins>

@ -101,9 +101,9 @@
{{#equal this.type "select"}}
<div class="form-group">
<select class="form-control" id="{{this.id}}">
<option>{{this.valueOne}}</option>
<option>{{this.valueTwo}}</option>
<option>{{this.valueThree}}</option>
{{#each this.value}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
{{/equal}}

@ -16,6 +16,24 @@
* 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
@ -115,41 +133,41 @@ function submitForm(formId) {
$('#' + formId + " .lbl-execution").removeClass("hidden");
var form = $("#" + formId);
var uri = form.attr("action");
var deviceId = form.data("device-id");
var deviceIdList = form.data("device-id");
var contentType = form.data("content-type");
var operationCode = form.data("operation-code");
var uriencodedQueryStr = "";
var uriencodedFormStr = "";
var uriEncodedQueryStr = "";
var uriEncodedFormStr = "";
var payload = {};
form.find("input").each(function () {
var input = $(this);
if (input.data("param-type") == "path") {
var prefix;
if (input.data("param-type") === "path") {
uri = uri.replace("{" + input.attr("id") + "}", input.val());
} else if (input.data("param-type") == "query") {
var prefix = (uriencodedQueryStr == "") ? "?" : "&";
uriencodedQueryStr += prefix + input.attr("id") + "=" + input.val();
} else if (input.data("param-type") == "form") {
var prefix = (uriencodedFormStr == "") ? "" : "&";
uriencodedFormStr += prefix + input.attr("id") + "=" + input.val();
if (input.attr("type") == "text" || input.attr("type") == "password") {
} 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" || input.attr("type") === "password") {
payload[input.attr("id")] = input.val();
} else if (input.attr("type") == "checkbox") {
} else if (input.attr("type") === "checkbox") {
payload[input.attr("id")] = input.is(":checked");
} else if (input.attr("type") == "radio") {
} else if (input.attr("type") === "radio") {
payload[input.attr("id")] = input.is(":checked");
}
}
});
uri += uriencodedQueryStr;
uri += uriEncodedQueryStr;
var httpMethod = form.attr("method").toUpperCase();
//var contentType = form.attr("enctype");
var validaterString = validatePayload(operationCode, payload);
var validateString = validatePayload(operationCode, payload);
if (validaterString == "OK") {
if (validateString === "OK") {
if (contentType == undefined || contentType == "") {
if (!contentType) {
contentType = "application/x-www-form-urlencoded";
payload = uriencodedFormStr;
payload = uriEncodedFormStr;
}
//setting responses callbacks
@ -179,7 +197,7 @@ function submitForm(formId) {
// console.log(response);
title.html("An Error Occurred!");
statusIcon.attr("class", defaultStatusClasses + " fw-error");
var reason = (response.responseText == "null") ? response.statusText : response.responseText;
var reason = (response.responseText === "null") ? response.statusText : response.responseText;
try {
reason = JSON.parse(reason).message;
} catch (err) {
@ -191,15 +209,15 @@ function submitForm(formId) {
$(modalPopupContent).html(content.html());
};
//executing http request
if (httpMethod == "GET") {
if (httpMethod === "GET") {
invokerUtil.get(uri, successCallBack, errorCallBack, contentType);
} else if (httpMethod == "POST") {
var deviceList = [deviceId];
} else if (httpMethod === "POST") {
var deviceList = deviceIdList.split(",");
payload = generatePayload(operationCode, payload, deviceList);
invokerUtil.post(uri, payload, successCallBack, errorCallBack, contentType);
} else if (httpMethod == "PUT") {
} else if (httpMethod === "PUT") {
invokerUtil.put(uri, payload, successCallBack, errorCallBack, contentType);
} else if (httpMethod == "DELETE") {
} else if (httpMethod === "DELETE") {
invokerUtil.delete(uri, successCallBack, errorCallBack, contentType);
} else {
title.html("An Error Occurred!");
@ -210,7 +228,7 @@ function submitForm(formId) {
}
} else {
resetLoader(formId);
$(".modal #operation-error-msg span").text(validaterString);
$(".modal #operation-error-msg span").text(validateString);
$(".modal #operation-error-msg").removeClass("hidden");
}
}
@ -476,7 +494,7 @@ var generatePayload = function (operationCode, operationData, deviceList) {
break;
case androidOperationConstants["SYSTEM_UPDATE_POLICY_CODE"]:
operationType = operationTypeConstants["PROFILE"];
if (operationData["cosuSystemUpdatePolicyType"] != "window") {
if (operationData["cosuSystemUpdatePolicyType"] !== "window") {
payload = {
"operation": {
"type": operationData["cosuSystemUpdatePolicyType"]
@ -516,7 +534,7 @@ var generatePayload = function (operationCode, operationData, deviceList) {
payload = deviceList;
}
if (operationType == operationTypeConstants["PROFILE"] && deviceList) {
if (operationType === operationTypeConstants["PROFILE"] && deviceList) {
payload["deviceIDs"] = deviceList;
}
return payload;

@ -0,0 +1,184 @@
{{!
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 controlOperations}}
<div class="wr-operations" style="height: 87px; display: block;"
xmlns="http://www.w3.org/1999/html">
<style>
::-webkit-input-placeholder {
color: #B8B8B8;
}
::-moz-placeholder {
color: #B8B8B8;
}
:-ms-input-placeholder {
color: #B8B8B8;
}
input:-moz-placeholder {
color: #B8B8B8;
}
</style>
{{#each controlOperations}}
<a {{#unless isDisabled}} href="javascript:operationSelect('{{operation}}')" {{else}} href="javascript:void(0)" class="op-disabled" title="{{disabledText}}" data-toggle="tooltip" {{/unless}}>
{{#if iconFont}}
<i class="fw {{iconFont}}"></i>
{{else}}
{{#if icon}}
<img src="{{@app.context}}/{{icon}}" style="width: 48px;"/>
{{else}}
<i class="fw fw-service"></i>
{{/if}}
{{/if}}
<span>{{name}}</span>
</a>
<div class="operation" data-operation-code="{{operation}}">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw {{iconFont}} fw-stack-1x"></i>
</span>
{{name}}
<br>
</h3>
<h4>
{{description}}
<br>
</h4>
<div id="operation-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div id="operation-warn-msg" class="info alert-info hidden" role="alert">
<i class="icon fw fw-info"></i><span></span>
</div>
<div id="operation-form">
<form id="form-{{operation}}" action="{{params.0.uri}}" method="{{params.0.method}}"
style="padding-bottom: 20px;"
data-payload="{{payload}}"
data-device-id="{{../devices}}"
data-content-type="{{params.0.contentType}}"
data-operation-code="{{operation}}">
{{#each params.0.pathParams}}
<input type="{{type}}" id="{{name}}" placeholder="{{name}}" class="form-control"
data-param-type="path" value="{{value}}"/>
<br/>
{{/each}}
{{#each params.0.formParams}}
<input type="{{type}}" id="{{name}}" name="{{name}}" placeholder="{{name}}"
class="form-control" data-param-type="form" value="{{value}}"/>
<br/>
{{/each}}
{{#each params.0.queryParams}}
<input type="{{type}}" id="{{name}}" placeholder="{{name}}" class="form-control"
data-param-type="query" value="{{value}}"/>
<br/>
{{/each}}
{{#each uiParams}}
{{#equal this.type "select"}}
<div class="form-group">
<select class="form-control" id="{{this.id}}">
{{#each this.value}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
{{/equal}}
{{#equal this.type "radio"}}
<input type="radio" id="{{this.id}}"
name="{{this.name}}"
value="{{this.value}}"
class="radio"
checked="checked"
data-param-type="form"/>
{{this.value}}
{{/equal}}
{{#equal this.type "checkbox"}}
<input type="{{this.type}}" id="{{this.id}}"
class="checkbox"
placeholder="{{this.label}}"
data-param-type="form"/>
{{this.label}}
<br/>
{{/equal}}
{{#equal this.type "password"}}
<input type="{{this.type}}" id="{{this.id}}"
placeholder="{{this.label}}" class="form-control"
data-param-type="form" value=""/>
<br/>
{{/equal}}
{{#equal this.type "text"}}
<input type="{{this.type}}" id="{{this.id}}"
placeholder="{{this.label}}" class="form-control"
data-param-type="form" value=""/>
<br/>
{{/equal}}
{{#equal this.type "info"}}
<div class="form-group" id="{{this.id}}">
<span class="help-block">
{{this.value}}
</span>
</div>
{{/equal}}
{{/each}}
<button type="button" onclick="submitForm('form-{{operation}}')"
class="btn btn-default btnSend">Send
to Device</button>
<label class="wr-input-label hidden"><i
class="fw fw-lifecycle fw-spin fw-2x lblSending"></i> Sending..</label>
<label class="wr-input-label hidden"><i
class="fw fw-check fw-2x lblSent"></i> Sent</label>
<i class="fw fw-wso2-logo fw-pulse fw-2x hidden lbl-execution"> Executing Operation </i>
</form>
</div>
</div>
</div>
</div>
</div>
{{/each}}
</div>
{{/if}}
<div id="operation-response-template" style="display: none">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack center-block">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i id="status-icon" class="fw fw-error fw-stack-1x"></i>
</span>
<br>
</h3>
<h4>
<span id="title"></span>
<br>
</h4>
<span id="description"></span>
</div>
</div>
</div>
</div>

@ -46,7 +46,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>

@ -16,8 +16,28 @@
* 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.android.impl;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
@ -32,6 +52,7 @@ import org.wso2.carbon.device.mgt.mobile.android.impl.util.MobileDeviceManagemen
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class AndroidFeatureManager implements FeatureManager {
@ -97,14 +118,43 @@ public class AndroidFeatureManager implements FeatureManager {
public List<Feature> getFeatures() throws DeviceManagementException {
try {
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Android platform", e);
}
}
@Override
public List<Feature> getFeatures(String featureType) throws DeviceManagementException {
if (StringUtils.isEmpty(featureType)) {
return this.getFeatures();
}
try {
List<MobileFeature> mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType);
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Android platform", e);
}
}
@Override
public List<Feature> getFeatures(String featureType, boolean isHidden) throws DeviceManagementException {
try {
List<MobileFeature> mobileFeatures;
if (StringUtils.isNotEmpty(featureType)) {
mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType, isHidden);
} else {
mobileFeatures = featureDAO.getAllFeatures(isHidden);
}
return featureList;
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Android platform", e);
"Android platform", e);
}
}

@ -16,6 +16,24 @@
* 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.android.impl.dao;
import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileFeature;
@ -107,4 +125,32 @@ public interface MobileFeatureDAO {
* @throws MobileDeviceManagementDAOException
*/
List<MobileFeature> getAllFeatures() throws MobileDeviceManagementDAOException;
/**
* Get all the MobileFeatures by a given ui visibility
*
* @param isHidden Whether the operation is hidden from UI or not.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getAllFeatures(boolean isHidden) throws MobileDeviceManagementDAOException;
/**
* Retrieve all MobileFeatures of a given feature type
*
* @param featureType Feature type.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getFeaturesByFeatureType(String featureType) throws MobileDeviceManagementDAOException;
/**
* Retrieve all MobileFeatures of a given feature type and ui visibility
*
* @param featureType Feature type.
* @param isHidden Whether the operation is hidden from UI or not.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getFeaturesByFeatureType(String featureType, boolean isHidden) throws MobileDeviceManagementDAOException;
}

@ -16,6 +16,25 @@
* 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.android.impl.dao.impl;
import org.apache.commons.logging.Log;
@ -51,17 +70,19 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = AndroidDAOFactory.getConnection();
String sql = "INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
String sql = "INSERT INTO AD_FEATURE(CODE, NAME, TYPE, HIDDEN, DESCRIPTION) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(3, mobileFeature.getType());
stmt.setBoolean(4, mobileFeature.isHidden());
stmt.setString(5, mobileFeature.getDescription());
stmt.executeUpdate();
status = true;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while adding android feature '" +
mobileFeature.getName() + "' into the metadata repository", e);
mobileFeature.getName() + "' into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
@ -71,28 +92,27 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
@Override
public boolean addFeatures(List<MobileFeature> mobileFeatures) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
MobileFeature mobileFeature;
boolean status = false;
Connection conn;
try {
conn = AndroidDAOFactory.getConnection();
stmt = conn.prepareStatement("INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)");
for (int i = 0; i < mobileFeatures.size(); i++) {
mobileFeature = mobileFeatures.get(i);
stmt = conn.prepareStatement("INSERT INTO AD_FEATURE(CODE, NAME, TYPE, HIDDEN, DESCRIPTION) " +
"VALUES (?, ?, ?, ?, ?)");
for (MobileFeature mobileFeature : mobileFeatures) {
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(3, mobileFeature.getType());
stmt.setBoolean(4, mobileFeature.isHidden());
stmt.setString(5, mobileFeature.getDescription());
stmt.addBatch();
}
stmt.executeBatch();
status = true;
return true;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while adding android features into the metadata repository", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
return status;
}
@Override
@ -103,25 +123,27 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
try {
conn = AndroidDAOFactory.getConnection();
String updateDBQuery =
"UPDATE AD_FEATURE SET NAME = ?, DESCRIPTION = ?" +
"WHERE CODE = ?";
"UPDATE AD_FEATURE SET NAME = ?, TYPE = ?, HIDDEN = ? ,DESCRIPTION = ?" +
"WHERE CODE = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileFeature.getName());
stmt.setString(2, mobileFeature.getDescription());
stmt.setString(3, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getType());
stmt.setBoolean(3, mobileFeature.isHidden());
stmt.setString(4, mobileFeature.getDescription());
stmt.setString(5, mobileFeature.getCode());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Android Feature " + mobileFeature.getCode() + " data has been " +
"modified.");
"modified.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while updating the Android Feature '" +
mobileFeature.getCode() + "' to the Android db.";
mobileFeature.getCode() + "' to the Android db.";
log.error(msg, e);
throw new AndroidFeatureManagementDAOException(msg, e);
} finally {
@ -146,7 +168,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while deleting android feature '" +
mblFeatureId + "' from Android database.", e);
mblFeatureId + "' from Android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
@ -156,7 +178,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
@Override
public boolean deleteFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
boolean status = false;
boolean status;
Connection conn;
try {
conn = AndroidDAOFactory.getConnection();
@ -168,7 +190,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while deleting android feature '" +
mblFeatureCode + "' from Android database.", e);
mblFeatureCode + "' from Android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
}
@ -182,7 +204,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE ID = ?";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM AD_FEATURE WHERE ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, mblFeatureId);
rs = stmt.executeQuery();
@ -193,8 +215,10 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID));
mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE));
mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME));
mobileFeature.setType(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_TYPE));
mobileFeature.setHidden(rs.getBoolean(AndroidPluginConstants.ANDROID_FEATURE_HIDDEN));
mobileFeature.setDescription(rs.getString(AndroidPluginConstants.
ANDROID_FEATURE_DESCRIPTION));
ANDROID_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
}
@ -202,7 +226,7 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while retrieving android feature '" +
mblFeatureId + "' from the Android database.", e);
mblFeatureId + "' from the Android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
@ -217,27 +241,20 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mblFeatureCode);
rs = stmt.executeQuery();
MobileFeature mobileFeature = null;
if (rs.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID));
mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE));
mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(AndroidPluginConstants.
ANDROID_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
mobileFeature = populateMobileFeature(rs);
}
return mobileFeature;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException(
"Error occurred while retrieving android feature '" +
mblFeatureCode + "' from the Android database.", e);
mblFeatureCode + "' from the Android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
@ -258,28 +275,123 @@ public class AndroidFeatureDAOImpl implements MobileFeatureDAO {
List<MobileFeature> features = new ArrayList<>();
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM AD_FEATURE";
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
MobileFeature mobileFeature = null;
while (rs.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID));
mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE));
mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
features.add(mobileFeature);
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all " +
"android features from the android database.", e);
throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all android features " +
"from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
}
}
@Override
public List<MobileFeature> getAllFeatures(boolean isHidden) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn = null;
List<MobileFeature> features = new ArrayList<>();
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM AD_FEATURE WHERE HIDDEN = ?";
stmt = conn.prepareStatement(sql);
stmt.setBoolean(1, isHidden);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all android features " +
"from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
}
}
@Override
public List<MobileFeature> getFeaturesByFeatureType(String featureType) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn;
List<MobileFeature> features = new ArrayList<>();
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM AD_FEATURE WHERE TYPE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, featureType);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all android features of " +
"type " + featureType + " from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
}
}
@Override
public List<MobileFeature> getFeaturesByFeatureType(String featureType, boolean isHidden) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn;
List<MobileFeature> features = new ArrayList<>();
try {
conn = AndroidDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION " +
"FROM AD_FEATURE " +
"WHERE TYPE = ? AND HIDDEN = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, featureType);
stmt.setBoolean(2, isHidden);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new AndroidFeatureManagementDAOException("Error occurred while retrieving all android features of " +
"[type: " + featureType + " & hidden: " + isHidden + "] from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
AndroidDAOFactory.closeConnection();
}
}
/**
* Generate {@link MobileFeature} from the SQL {@link ResultSet}
*
* @param rs Result set
* @return populated {@link MobileFeature}
* @throws SQLException if unable to extract data from {@link ResultSet}
*/
private MobileFeature populateMobileFeature(ResultSet rs) throws SQLException {
MobileFeature mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(AndroidPluginConstants.ANDROID_FEATURE_ID));
mobileFeature.setCode(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_CODE));
mobileFeature.setName(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(AndroidPluginConstants.
ANDROID_FEATURE_DESCRIPTION));
mobileFeature.setType(rs.getString(AndroidPluginConstants.ANDROID_FEATURE_TYPE));
mobileFeature.setHidden(rs.getBoolean(AndroidPluginConstants.ANDROID_FEATURE_HIDDEN));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
return mobileFeature;
}
}

@ -1,336 +0,0 @@
/*
* Copyright (c) 2014, 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.android.impl.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.android.impl.dao.MobileFeatureDAO;
import org.wso2.carbon.device.mgt.mobile.android.impl.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.android.impl.dto.MobileFeature;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of MobileFeatureDAO.
*/
public class MobileFeatureDAOImpl implements MobileFeatureDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(MobileFeatureDAOImpl.class);
public MobileFeatureDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public boolean addFeature(MobileFeature mobileFeature)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO AD_FEATURE(CODE, NAME, DESCRIPTION, DEVICE_TYPE) VALUES (?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(4, mobileFeature.getDeviceType());
int rows = stmt.executeUpdate();
if (rows > 0) {
if (log.isDebugEnabled()) {
log.debug("Added a new MobileFeature " + mobileFeature.getCode() + " to the MDM database.");
}
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while adding feature code - '" +
mobileFeature.getCode() + "' to feature table";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean addFeatures(List<MobileFeature> mobileFeatures) throws MobileDeviceManagementDAOException {
return false;
}
@Override
public boolean updateFeature(MobileFeature mobileFeature)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE AD_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ?, DEVICE_TYPE = ?" +
" WHERE ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(4, mobileFeature.getDeviceType());
stmt.setInt(5, mobileFeature.getId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Updated MobileFeature " + mobileFeature.getCode());
}
}
} catch (SQLException e) {
String msg = "Error occurred while updating the feature with feature code - '" +
mobileFeature.getId() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteFeatureByCode(String mblFeatureCode)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM AD_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, mblFeatureCode);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Deleted MobileFeature code " + mblFeatureCode + " from the MDM database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while deleting feature with code - " + mblFeatureCode;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteFeatureById(int mblFeatureId)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM AD_FEATURE WHERE ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, mblFeatureId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
if (log.isDebugEnabled()) {
log.debug("Deleted MobileFeature id " + mblFeatureId + " from the MDM database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while deleting feature with id - " + mblFeatureId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public MobileFeature getFeatureByCode(String mblFeatureCode)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileFeature mobileFeature = null;
ResultSet resultSet = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE " +
"WHERE CODE = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, mblFeatureCode);
resultSet = stmt.executeQuery();
if (resultSet.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(resultSet.getInt(1));
mobileFeature.setCode(resultSet.getString(2));
mobileFeature.setName(resultSet.getString(3));
mobileFeature.setDescription(resultSet.getString(4));
mobileFeature.setDeviceType(resultSet.getString(5));
if (log.isDebugEnabled()) {
log.debug("Fetched MobileFeature " + mblFeatureCode + " from the MDM database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while fetching feature code - '" + mblFeatureCode + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet);
}
return mobileFeature;
}
@Override
public MobileFeature getFeatureById(int mblFeatureId)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileFeature mobileFeature = null;
ResultSet resultSet = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" +
" WHERE ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, mblFeatureId);
resultSet = stmt.executeQuery();
if (resultSet.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(resultSet.getInt(1));
mobileFeature.setCode(resultSet.getString(2));
mobileFeature.setName(resultSet.getString(3));
mobileFeature.setDescription(resultSet.getString(4));
mobileFeature.setDeviceType(resultSet.getString(5));
if (log.isDebugEnabled()) {
log.debug("Fetched MobileFeatureId" + mblFeatureId + " from the MDM database.");
}
}
} catch (SQLException e) {
String msg = "Error occurred while fetching feature id - '" + mblFeatureId + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet);
}
return mobileFeature;
}
@Override
public List<MobileFeature> getAllFeatures() throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileFeature mobileFeature;
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>();
ResultSet resultSet = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE";
stmt = conn.prepareStatement(selectDBQuery);
resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(resultSet.getInt(1));
mobileFeature.setCode(resultSet.getString(2));
mobileFeature.setName(resultSet.getString(3));
mobileFeature.setDescription(resultSet.getString(4));
mobileFeature.setDeviceType(resultSet.getString(5));
mobileFeatures.add(mobileFeature);
}
if (log.isDebugEnabled()) {
log.debug("Fetched all MobileFeatures from the MDM database.");
}
return mobileFeatures;
} catch (SQLException e) {
String msg = "Error occurred while fetching all features.'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet);
}
}
@Override
public List<MobileFeature> getFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileFeature mobileFeature;
List<MobileFeature> mobileFeatures = new ArrayList<>();
ResultSet resultSet = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT ID, CODE, NAME, DESCRIPTION, DEVICE_TYPE FROM AD_FEATURE" +
" WHERE DEVICE_TYPE = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceType);
resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(resultSet.getInt(1));
mobileFeature.setCode(resultSet.getString(2));
mobileFeature.setName(resultSet.getString(3));
mobileFeature.setDescription(resultSet.getString(4));
mobileFeature.setDeviceType(resultSet.getString(5));
mobileFeatures.add(mobileFeature);
}
if (log.isDebugEnabled()) {
log.debug("Fetched all MobileFeatures of type " + deviceType + " from the MDM" +
" database.");
}
return mobileFeatures;
} catch (SQLException e) {
String msg = "Error occurred while fetching all features.'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, resultSet);
}
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile specific " +
"datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -16,6 +16,24 @@
* 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.android.impl.dto;
import java.io.Serializable;
@ -29,6 +47,8 @@ public class MobileFeature implements Serializable {
private String deviceType;
private String code;
private String name;
private String type;
private boolean hidden;
private String description;
public int getId() {
@ -55,6 +75,22 @@ public class MobileFeature implements Serializable {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public boolean isHidden() {
return hidden;
}
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
public String getDescription() {
return description;
}

@ -16,6 +16,24 @@
* 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.android.impl.util;
/**
@ -43,6 +61,8 @@ public final class AndroidPluginConstants {
public static final String ANDROID_FEATURE_ID = "ID";
public static final String ANDROID_FEATURE_CODE = "CODE";
public static final String ANDROID_FEATURE_NAME = "NAME";
public static final String ANDROID_FEATURE_TYPE = "TYPE";
public static final String ANDROID_FEATURE_HIDDEN = "HIDDEN";
public static final String ANDROID_FEATURE_DESCRIPTION = "DESCRIPTION";
public static final class NotifierType {

@ -16,6 +16,24 @@
* 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.android.impl.util;
import org.apache.commons.logging.Log;
@ -42,10 +60,13 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* Provides utility methods required by the mobile device management bundle.
@ -205,6 +226,8 @@ public class MobileDeviceManagementUtil {
mobileFeature.setCode(feature.getCode());
mobileFeature.setDescription(feature.getDescription());
mobileFeature.setDeviceType(feature.getDeviceType());
mobileFeature.setType(feature.getType());
mobileFeature.setHidden(feature.isHidden());
return mobileFeature;
}
@ -214,6 +237,8 @@ public class MobileDeviceManagementUtil {
feature.setDeviceType(mobileFeature.getDeviceType());
feature.setCode(mobileFeature.getCode());
feature.setName(mobileFeature.getName());
feature.setType(mobileFeature.getType());
feature.setHidden(mobileFeature.isHidden());
return feature;
}

@ -46,7 +46,7 @@
<div class="operation-title">
<h4>Device Operations</h4>
</div>
{{unit "cdmf.unit.device.type.windows.new.operation-bar" device=device
{{unit "cdmf.unit.device.type.windows.operation-bar" device=device
backendApiUri=backendApiUri autoCompleteParams=autoCompleteParams}}
</div>
{{/if}}

@ -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];
}

@ -1,227 +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.
*/
/*
* 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 deviceId = 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);
if (input.data("param-type") == "path") {
uri = uri.replace("{" + input.attr("id") + "}", input.val());
} else if (input.data("param-type") == "query") {
var prefix = (uriencodedQueryStr == "") ? "?" : "&";
uriencodedQueryStr += prefix + input.attr("id") + "=" + input.val();
} else if (input.data("param-type") == "form") {
var 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();
//var contentType = form.attr("enctype");
if (contentType == undefined || 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 = [deviceId];
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) {
cosole.log("darn!!");
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"
};

@ -15,18 +15,132 @@
specific language governing permissions and limitations
under the License.
}}
{{#if control_operations}}
<div class="wr-operations" style="height: 87px; display: block;"
xmlns="http://www.w3.org/1999/html">
<style>
::-webkit-input-placeholder {
color: #B8B8B8;
}
{{unit "cdmf.unit.device.type.windows.date-range-picker"}}
::-moz-placeholder {
color: #B8B8B8;
}
{{#zone "content"}}
<div id="operations-mod" data-permissions="{{permissions}}" data-device-type="{{deviceType}}" data-ownership="{{ownership}}">
{{unit "cdmf.unit.device.type.windows.operation-mod"}}
:-ms-input-placeholder {
color: #B8B8B8;
}
input:-moz-placeholder {
color: #B8B8B8;
}
</style>
{{#each control_operations}}
<a class="operation-tile" href="javascript:operationSelect('{{operation}}')">
{{#if iconFont}}
<i class="fw {{iconFont}}"></i>
{{else}}
{{#if icon}}
<img src="{{@app.context}}/{{icon}}" style="width: 48px;"/>
{{else}}
<i class="fw fw-service"></i>
{{/if}}
{{/if}}
<span>{{name}}</span>
</a>
<div class="operation" data-operation-code="{{operation}}">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw {{iconFont}} fw-stack-1x"></i>
</span>
{{name}}
<br>
</h3>
<h4>
{{description}}
<br>
</h4>
<form action="{{params.0.uri}}" method="{{params.0.method}}"
style="padding-bottom: 20px;"
data-payload="{{payload}}" id="form-{{operation}}"
data-device-id="{{../device.deviceIdentifier}}"
data-content-type="{{params.0.contentType}}"
data-operation-code="{{operation}}">
{{#each params.0.pathParams}}
<input type="{{type}}" id="{{name}}" placeholder="{{name}}" class="form-control" data-param-type="path" value="{{value}}" />
<br />
{{/each}}
{{#each params.0.formParams}}
<input type="{{type}}" id="{{name}}" name="{{name}}" placeholder="{{name}}" class="form-control" data-param-type="form" value="{{value}}" />
<br />
{{/each}}
{{#each params.0.queryParams}}
<input type="{{type}}" id="{{name}}" placeholder="{{name}}" class="form-control" data-param-type="query" value="{{value}}" />
<br />
{{/each}}
{{#each uiParams}}
{{#equal this.type "checkbox"}}
<input type="{{this.type}}" id="{{this.id}}"
class="checkbox"
placeholder="{{this.label}}"
data-param-type="form"/>
{{this.label}}
<br/>
{{/equal}}
{{#equal this.type "text"}}
<input type="{{this.type}}" id="{{this.id}}"
placeholder="{{this.label}}" class="form-control"
data-param-type="form" value=""/>
<br/>
{{/equal}}
{{/each}}
<button id="btnSend" type="button" onclick="submitForm('form-{{operation}}')" class="btn btn-default">&nbsp;&nbsp;&nbsp;&nbsp;Send
to Device&nbsp;&nbsp;&nbsp;&nbsp;</button>
<label id="lblSending" class="wr-input-label hidden"><i
class="fw fw-lifecycle fw-spin fw-2x"></i> Sending..</label>
<label id="lblSent" class="wr-input-label hidden"><i
class="fw fw-check fw-2x"></i> Sent</label>
</form>
</div>
</div>
</div>
</div>
{{/each}}
</div>
{{/zone}}
{{else}}
<div align="center">
<h4 style="color: #D8000C"><i class="icon fw fw-error" style="color: #D8000C"></i>
Operations Loading Failed!</h4>
</div>
{{/if}}
<div id="operation-response-template" style="display: none">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i id="status-icon" class="fw fw-error fw-stack-1x"></i>
</span>
<br>
</h3>
<h4>
<span id="title"></span>
<br>
</h4>
<span id="description"></span>
</div>
</div>
</div>
</div>
{{#zone "bottomJs"}}
<!--suppress HtmlUnknownTarget -->
<script id="operations-bar" src="{{@unit.publicUri}}/templates/operations.hbs"
type="text/x-handlebars-template"></script>
{{js "js/operation-bar.js"}}
{{/zone}}
{{/zone}}

@ -17,90 +17,49 @@
*/
function onRequest(context) {
var log = new Log("cdmf.unit.device.type.windows.operation-bar");
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var viewModel = {};
var permissions = {};
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};
}
// adding android operations related permission checks
permissions["android"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/ring")) {
permissions["android"].push("DEVICE_RING");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/lock")) {
permissions["android"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/unlock")) {
permissions["android"].push("DEVICE_UNLOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/location")) {
permissions["android"].push("DEVICE_LOCATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/clear-password")) {
permissions["android"].push("CLEAR_PASSWORD");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/reboot")) {
permissions["android"].push("DEVICE_REBOOT");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/upgrade-firmware")) {
permissions["android"].push("UPGRADE_FIRMWARE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/mute")) {
permissions["android"].push("DEVICE_MUTE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/send-notification")) {
permissions["android"].push("NOTIFICATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/change-lock-code")) {
permissions["android"].push("CHANGE_LOCK_CODE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/enterprise-wipe")) {
permissions["android"].push("ENTERPRISE_WIPE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning-device/operations/android/wipe")) {
permissions["android"].push("WIPE_DATA");
}
// adding ios operations related permission checks
permissions["ios"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/lock")) {
permissions["ios"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/location")) {
permissions["ios"].push("LOCATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/enterprise-wipe")) {
permissions["ios"].push("ENTERPRISE_WIPE");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/notification")) {
permissions["ios"].push("NOTIFICATION");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/ios/ring")) {
permissions["ios"].push("RING");
}
// adding windows operations related permission checks
permissions["windows"] = [];
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock")) {
permissions["windows"].push("DEVICE_LOCK");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/disenroll/windows")) {
permissions["windows"].push("DISENROLL");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/wipe")) {
permissions["windows"].push("WIPE_DATA");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/ring")) {
permissions["windows"].push("DEVICE_RING");
}
if (userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/operations/windows/lock-reset")) {
permissions["windows"].push("LOCK_RESET");
}
viewModel["permissions"] = stringify(permissions);
viewModel["deviceType"] = context.unit.params.deviceType;
viewModel["ownership"] = context.unit.params.ownership;
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;
}
return viewModel;
function getPayload(featuresPayload, featureCode){
var featuresJSONPayloads = JSON.parse(featuresPayload);
return featuresJSONPayloads[featureCode];
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* 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
@ -17,232 +17,227 @@
*/
/*
* Setting-up global variables.
*/
var operations = '.wr-operations',
modalPopup = '.modal',
modalPopupContent = modalPopup + ' .modal-content',
navHeight = $('#nav').height(),
headerHeight = $('header').height(),
offset = (headerHeight + navHeight),
deviceSelection = '.device-select',
platformTypeConstants = {
"ANDROID": "android",
"IOS": "ios",
"WINDOWS": "windows"
},
ownershipTypeConstants = {
"BYOD": "BYOD",
"COPE": "COPE"
},
operationBarModeConstants = {
"BULK": "BULK_OPERATION_MODE",
"SINGLE": "SINGLE_OPERATION_MODE"
};
/*
* Function to get selected devices ID's
* 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.
*/
function getSelectedDeviceIds() {
var deviceIdentifierList = [];
$(deviceSelection).each(function (index) {
var device = $(this);
var deviceId = device.data('deviceid');
var deviceType = device.data('type');
deviceIdentifierList.push({
"id": deviceId,
"type": deviceType
});
});
if (deviceIdentifierList.length == 0) {
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
thisTable.api().rows().every(function () {
if ($(this.node()).hasClass('DTTT_selected')) {
var deviceId = $(thisTable.api().row(this).node()).data('deviceid');
var deviceType = $(thisTable.api().row(this).node()).data('devicetype');
deviceIdentifierList.push({
"id": deviceId,
"type": deviceType
});
}
});
}
return deviceIdentifierList;
}
/*
* On operation click function.
* @param selection: Selected operation
*/
function operationSelect(selection) {
var deviceIdList = getSelectedDeviceIds();
if (deviceIdList == 0) {
$(modalPopupContent).html($("#errorOperations").html());
} else {
$(modalPopupContent).addClass("operation-data");
$(modalPopupContent).html($(operations + " .operation[data-operation-code=" + selection + "]").html());
$(modalPopupContent).data("operation-code", selection);
}
$(modalPopupContent).addClass("operation-data");
$(modalPopupContent).html($(" .operation[data-operation-code=" + selection + "]").html());
$(modalPopupContent).data("operation-code", selection);
showPopup();
}
function getDevicesByTypes(deviceList) {
var deviceTypes = {};
$.each(deviceList, function (index, item) {
if (!deviceTypes[item.type]) {
deviceTypes[item.type] = [];
}
if (item.type == platformTypeConstants.ANDROID ||
item.type == platformTypeConstants.IOS || item.type == platformTypeConstants.WINDOWS) {
deviceTypes[item.type].push(item.id);
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");
}
}
});
return deviceTypes;
}
//function unloadOperationBar() {
// $("#showOperationsBtn").addClass("hidden");
// $(".wr-operations").html("");
//}
function loadOperationBar(deviceType, ownership, mode) {
var operationBar = $("#operations-bar");
var operationBarSrc = operationBar.attr("src");
$.template("operations-bar", operationBarSrc, function (template) {
var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/*/features";
invokerUtil.get(
serviceURL,
// success callback
function (data) {
var permittedOperations = [];
var i;
var permissionList = $("#operations-mod").data("permissions");
var totalFeatures = JSON.parse(data);
for (i = 0; i < permissionList[deviceType].length; i++) {
var j;
for (j = 0; j < totalFeatures.length; j++) {
if (permissionList[deviceType][i] == totalFeatures[j]["code"]) {
if (deviceType == platformTypeConstants.ANDROID) {
if (totalFeatures[j]["code"] == "DEVICE_UNLOCK") {
if (ownership == ownershipTypeConstants.COPE) {
permittedOperations.push(totalFeatures[j]);
}
} else if (totalFeatures[j]["code"] == "WIPE_DATA") {
if (mode == operationBarModeConstants.BULK) {
if (ownership == ownershipTypeConstants.COPE) {
permittedOperations.push(totalFeatures[j]);
}
} else {
permittedOperations.push(totalFeatures[j]);
}
} else {
permittedOperations.push(totalFeatures[j]);
}
} else {
permittedOperations.push(totalFeatures[j]);
}
}
}
}
uri += uriEncodedQueryStr;
var httpMethod = form.attr("method").toUpperCase();
var viewModel = {};
permittedOperations = permittedOperations.filter(function (current) {
var iconName;
switch (deviceType) {
case platformTypeConstants.ANDROID:
iconName = operationModule.getAndroidIconForFeature(current.code);
break;
case platformTypeConstants.WINDOWS:
iconName = operationModule.getWindowsIconForFeature(current.code);
break;
case platformTypeConstants.IOS:
iconName = operationModule.getIOSIconForFeature(current.code);
break;
}
/* adding ownership in addition to device-type
as it's vital in cases where UI for the same feature should change
according to ownership
*/
if (ownership) {
current.ownership = ownership;
}
if (iconName) {
current.icon = iconName;
}
return current;
});
viewModel.features = permittedOperations;
var content = template(viewModel);
$(".wr-operations").html(content);
},
// error callback
function (message) {
$(".wr-operations").html(message);
});
});
}
function runOperation(operationName) {
var deviceIdList = getSelectedDeviceIds();
var list = getDevicesByTypes(deviceIdList);
if (!contentType) {
contentType = "application/x-www-form-urlencoded";
payload = uriEncodedFormStr;
}
var successCallback = function (data) {
if (operationName == "NOTIFICATION") {
$(modalPopupContent).html($("#messageSuccess").html());
} else {
$(modalPopupContent).html($("#operationSuccess").html());
//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
}
showPopup();
title.html("Operation Triggered!");
statusIcon.attr("class", defaultStatusClasses + " fw-check");
description.html(res);
console.log("success!");
$(modalPopupContent).html(content.html());
};
var errorCallback = function (data) {
$(modalPopupContent).html($("#errorOperationUnexpected").html());
showPopup();
};
var payload, serviceEndPoint;
if (list[platformTypeConstants.IOS]) {
payload =
operationModule.generatePayload(platformTypeConstants.IOS, operationName, list[platformTypeConstants.IOS]);
serviceEndPoint = operationModule.getIOSServiceEndpoint(operationName);
} else if (list[platformTypeConstants.ANDROID]) {
payload = operationModule
.generatePayload(platformTypeConstants.ANDROID, operationName, list[platformTypeConstants.ANDROID]);
serviceEndPoint = operationModule.getAndroidServiceEndpoint(operationName);
} else if (list[platformTypeConstants.WINDOWS]) {
payload = operationModule.generatePayload(platformTypeConstants.WINDOWS, operationName,
list[platformTypeConstants.WINDOWS]);
serviceEndPoint = operationModule.getWindowsServiceEndpoint(operationName);
}
if (operationName == "NOTIFICATION") {
var errorMsgWrapper = "#notification-error-msg";
var errorMsg = "#notification-error-msg span";
var messageTitle = $("#messageTitle").val();
var messageText = $("#messageText").val();
if (!(messageTitle && messageText)) {
$(errorMsg).text("Enter a message. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else {
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
$(modalPopupContent).removeData();
hidePopup();
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 {
invokerUtil.post(serviceEndPoint, payload, successCallback, errorCallback);
$(modalPopupContent).removeData();
hidePopup();
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());
}
}
/*
* DOM ready functions.
*/
$(document).ready(function () {
$(operations).show();
$(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"
};

@ -1,286 +0,0 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('security', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Security
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('restriction', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
Restrictions
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('application', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Applications
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('wifi', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-wifi fw-stack-2x"></i>
</span>
Wi-fi
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- security -->
<div class="wr-hidden-operation" data-operation="security" style="display: block">
<div class="panel panel-default operation-data" data-operation="{{features.ENCRYPT_STORAGE.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#enableEncryptionTab"
aria-expanded="true" aria-controls="enableEncryptionTab">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Encryption Enable/Disable
</a>
</h2>
</div>
<div id="enableEncryptionTab" class="panel-collapse panel-body collapse in" role="tabpanel"
aria-labelledby="enableEncryptionTab">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="enableEncryption"
data-key="enableEncryption"/>
<span class="helper" title="Enable Encryption">Enable Encryption<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.ENCRYPT_STORAGE.code}}')" class="btn-operations">Configure</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.PASSCODE_POLICY.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#passCodePolicy" aria-expanded="false"
aria-controls="passCodePolicy" class="collapsed">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Passcode Policy
</a>
</h2>
</div>
<div id="passCodePolicy" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="passCodePolicy">
<label class="wr-input-label col-sm-4" for="maxFailedAttempts">Maximum Failed Attempts</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="maxFailedAttempts"
data-key="maxFailedAttempts" placeholder="Enter maximum Failed Attempts">
</div>
<label class="wr-input-label col-sm-4" for="minLength">Minimum Length</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="minLength" data-key="minLength"
placeholder="Enter minimum Length">
</div>
<label class="wr-input-label col-sm-4" for="pinHistory">PIN History</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="pinHistory" data-key="pinHistory"
placeholder="Enter PIN History">
</div>
<label class="wr-input-label col-sm-4" for="minComplexChars">Minimum complex characters</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="minComplexChars"
data-key="minComplexChars" placeholder="Enter minimum complex characters">
</div>
<label class="wr-input-label col-sm-4" for="lockcode">Minimum PIN Age in days</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="maxPINAgeInDays"
data-key="maxPINAgeInDays" placeholder="Enter minimum PIN age in days">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="requireAlphanumeric"
data-key="requireAlphanumeric"/>
<span class="helper" title="Require Alphanumeric">Require Alphanumeric<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowSimple" data-key="allowSimple"/>
<span class="helper" title="Allow simple PIN">Allow simple PIN<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.PASSCODE_POLICY.code}}')" class="btn-operations">Configure</a>
</div>
</div>
</div>
<!-- /security -->
<!-- wi-fi -->
<div class="wr-hidden-operation panel-body" data-operation="wifi">
<div class="operation-data" data-operation="{{features.WIFI.code}}">
<label class="wr-input-label" title="Identification of the wireless network to connect to">Service Set
Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ssid" data-key="ssid"
placeholder="Enter SSID"/>
</div>
<label class="wr-input-label" title="Password for the wireless network">Password<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Password for the wireless network</span-->
<div class="wr-input-control">
<input type="password" class="form-control operationDataKeys" id="password" data-key="password"
placeholder="Password"/>
</div>
<a href="javascript:runOperation('{{features.WIFI.code}}')" class="btn-operations">Configure</a>
</div>
</div>
<!-- /wi-fi -->
<!-- application -->
<div class="wr-hidden-operation" data-operation="application">
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installApp" aria-expanded="true"
aria-controls="installApp">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install App
</a>
</h2>
</div>
<div id="installApp" class="panel-collapse panel-body collapse in" role="tabpanel"
aria-labelledby="installApp">
<label class="wr-input-label" title="Application Identifier">App Identifier<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="package-name"
data-key="packageName" placeholder="Enter App Identifer"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control dropdown">
<span class="helper" title="App Type">App Type<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
<select class="form-control col-sm-8 operationDataKeys appTypesInput" id="type"
data-key="type">
<option>Public</option>
<option>Enterprise</option>
</select>
</label>
</div>
<label class="wr-input-label" title="URL">URL<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="url" data-key="url"
placeholder="Enter URL"/>
</div>
<a href="javascript:runOperation('{{features.INSTALL_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.WEBCLIP.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installWebClip" aria-expanded="true"
aria-controls="installWebClip" class="collapsed">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Web Clip
</a>
</h2>
</div>
<div id="installWebClip" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="installWebClip">
<label class="wr-input-label" title="Title of the web clip">Title<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="title" data-key="title"
placeholder="Enter Title"/>
</div>
<label class="wr-input-label" title="URL">URL<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="url" data-key="url"
placeholder="Enter URL"/>
</div>
<a href="javascript:runOperation('{{features.WEBCLIP.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.UNINSTALL_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#uninstallApp" aria-expanded="true"
aria-controls="uninstallApp" class="collapsed">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Uninstall App
</a>
</h2>
</div>
<div id="uninstallApp" class="panel-collapse panel-body collapse" role="tabpanel"
aria-labelledby="uninstallApp">
<label class="wr-input-label" title="Application Identifier">App Identifier<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="package-name"
data-key="packageName" placeholder="Enter App Identifer"/>
</div>
<a href="javascript:runOperation('{{features.UNINSTALL_APPLICATION.code}}')" class="btn-operations">Uninstall</a>
</div>
</div>
</div>
<!-- /application -->
<!-- Restriction -->
<div class="wr-hidden-operation" data-operation="restriction">
<div class="panel panel-default operation-data" data-operation="{{features.CAMERA.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#cameraDisable" aria-expanded="true"
aria-controls="cameraDisable">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Camera Enable/Disable
</a>
</h2>
</div>
<div id="cameraDisable" class="panel-collapse panel-body collapse in" role="tabpanel"
aria-labelledby="cameraDisable">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="enableCamera" data-key="enableCamera"
checked/>
<span class="helper" title="Remove App upon dis-enrollment">Enable Camera<span
class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.CAMERA.code}}')" class="btn-operations">Configure</a>
</div>
</div>
</div>
<!-- /Restriction -->
</div>
</div>

@ -1,366 +0,0 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.WIFI.code}}', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-wifi fw-stack-2x"></i>
</span>
Wi-fi
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('application', this)" >
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Applications
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.RESTRICTION.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
Restrictions
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('mail', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-message fw-stack-2x"></i>
</span>
Mail
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.AIR_PLAY.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-service-provider fw-stack-2x"></i>
</span>
Air Play
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- application -->
<div class="wr-hidden-operation" data-operation="application" style="display: block">
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_STORE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installPublicAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Public App
</a>
</h2>
</div>
<div id="installPublicAppiOS" class="panel-collapse panel-body collapse in" role="tabpanel" aria-labelledby="installPublicAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="ituneID">iTunes store ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ituneID" data-key="ituneID" placeholder="Enter iTunes store ID">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_STORE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_ENTERPRISE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installEnterpriseAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS" class="collapsed">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Enterprise App
</a>
</h2>
</div>
<div id="installEnterpriseAppiOS" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installEnterpriseAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="manifestURL">Manifest URL</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="manifestURL" data-key="manifestURL" placeholder="Enter manifest URL">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_ENTERPRISE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.REMOVE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#removeApplication" aria-expanded="true" aria-controls="removeApplication" class="collapsed">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Uninstall App
</a>
</h2>
</div>
<div id="removeApplication" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="removeApplication">
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<a href="javascript:runOperation('{{features.REMOVE_APPLICATION.code}}')" class="btn-operations">Uninstall</a>
</div>
</div>
</div>
<!-- /application -->
<!-- wi-fi -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.WIFI.code}}">
<label class="wr-input-label" title="Identification of the wireless network to connect to">Service Set Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ssid" data-key="ssid" placeholder="Enter SSID" />
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="hiddenNetwork" data-key="hiddenNetwork" checked />
<span class="helper" title="Enable if target network is not open or broadcasting">Hidden Network<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="autoJoin" data-key="autoJoin" checked />
<span class="helper" title="Automatically join this wireless network">Auto Join<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Automatically join this wireless network</span-->
</div>
<label class="wr-input-label" title="Configures proxies to be used with this network">Proxy Setup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<select class="form-control">
<option>None</option>
</select>
</div>
<label class="wr-input-label" title="Wireless network encryption to use when connecting">Security Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control operationDataKeys" id="encryptionType" data-key="encryptionType">
<option data-id="WPA">WPA/WPA2 Personal</option>
</select>
</div>
<label class="wr-input-label" title="Password for the wireless network">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Password for the wireless network</span-->
<div class="wr-input-control">
<input type="password" value="" class="operationDataKeys" id="password" data-key="password" placeholder="input text"/>
</div>
<label class="wr-input-label" title="Configures network to appear as legacy or Passport">Network Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures network to appear as legacy or Passport</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Standard</option>
</select>
</div>
<a href="javascript:runOperation('{{features.WIFI.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /wi-fi -->
<!-- mail -->
<div class="wr-hidden-operation panel-body" data-operation="mail">
<label class="wr-input-label" title="The display name of the account">Account Description<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Account Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<div class="cus-col-25">
<select class="form-control">
<option>IMAP</option>
</select>
</div>
<div class="cus-col-50">
<span>Path Prefix</span> <input type="text" value="" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The display name of the user">User Display Name<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The address of the account">Email Address<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Messages can be moved from this account to another">Allow user to move messages from this account<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Include this account in recent address syncing">Allow Recent Address syncing<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Send outgoing mail from this account only from Mail app">Use Only in Mail<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Send outgoing mail from this account only from Mail app</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Support S/MIME for this account">Enable S/MIME<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Support S/MIME for this account</span-->
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Mail Server and Port<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The protocol for accessing the email account</span-->
<div class="wr-input-control">
<div class="cus-col-70">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="cus-col-25">
<span> : </span><input type="text" value="993" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The username used to connect to the server for incoming mail">Username<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The autyentication method for the incoming mail server">Authentication Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Password</option>
</select>
</div>
<label class="wr-input-label" title="The password for the incoming mail server">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Retrieve incoming mail through secure socket layer">Use SSL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
</div>
<!-- /mail -->
<!-- general -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.RESTRICTION.code}}">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCamera" data-key="allowCamera" checked />
<span class="helper" title="Allow Camera">Allow Camera<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCloudBackup" data-key="allowCloudBackup" checked/>
<span class="helper" title="Allow Cloud Backup">Allow Cloud Backup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowScreenShot" data-key="allowScreenShot" checked/>
<span class="helper" title="Allow Screenshots">Allow Screenshots<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowSafari" data-key="allowSafari" checked />
<span class="helper" title="Allow Safari Browser">Allow Safari Browser<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowAirDrop" data-key="allowAirDrop" checked />
<span class="helper" title="Allow AirDrop">Allow AirDrop<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.RESTRICTION.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /general -->
<!-- air play -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.AIR_PLAY.code}}">
<label class="wr-input-label col-sm-4" for="airPlayLocation">Location</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayLocation" data-key="location" placeholder="Enter location" />
</div>
<label class="wr-input-label col-sm-4" for="airPlayDeviceName">Device Name</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayDeviceName" data-key="deviceName" placeholder="Enter Device Name" />
</div
<label class="wr-input-label col-sm-4" for="airPlayPassword">AirPlay password</label>
<div class="wr-input-control">
<input type="password" class="form-control operationDataKeys" id="airPlayPassword" data-key="password" placeholder="Password" />
</div>
<a href="javascript:runOperation('{{features.AIR_PLAY.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /air play -->
</div>
</div>

@ -1,7 +1,7 @@
{{!
Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
Copyright (c) 2019, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
WSO2 Inc. licenses this file to you under the Apache License,
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
@ -69,7 +69,7 @@
<form action="{{params.0.uri}}" method="{{params.0.method}}"
style="padding-bottom: 20px;"
data-payload="{{payload}}" id="form-{{operation}}"
data-device-id="{{../device.deviceIdentifier}}"
data-device-id="{{../devices}}"
data-content-type="{{params.0.contentType}}"
data-operation-code="{{operation}}">
{{#each params.0.pathParams}}
@ -140,7 +140,3 @@
</div>
</div>
</div>
{{#zone "bottomJs"}}
{{js "js/operation-bar.js"}}
{{/zone}}

@ -1,249 +0,0 @@
<div id="errorOperations" class="operation">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Please select a device or a list of devices to perform an operation.
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div>
</div>
</div>
<div id="errorOperationUnexpected" class="operation">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Unexpected error occurred. Please Try again later.
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div>
</div>
</div>
<div id="operationSuccess" class="operation">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-check fw-stack-1x"></i>
</span>
Operation queued successfully !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
Operation has been queued successfully to be sent to the device.
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div>
</div>
</div>
<div id="messageSuccess" class="operation">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-check fw-stack-1x"></i>
</span>
Message sent successfully !
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Message has been queued to be sent to the device.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">Ok</a>
</div>
</div>
</div>
{{#each features}}
<a href="javascript:operationSelect('{{code}}')" title="{{description}}">
<i class="fw {{icon}}"></i>
<span>{{name}}</span>
</a>
<div class="operation" data-operation-code="{{code}}">
<div class="modal-content clearfix">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack add-margin-right-2x">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw {{icon}} fw-stack-1x"></i>
</span>
{{name}}
<br>
</h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>
{{#equal code "WIPE_DATA"}}
{{#equal deviceType "android"}}
{{#equal ownership "BYOD"}}
Enter PIN code* of the device
<br><br>
<div>
<input id="pin" type="password"
class="form-control modal-input operationDataKeys"
placeholder="[ Required for a BYOD device ]" data-key="pin" />
</div>
{{/equal}}
{{/equal}}
{{/equal}}
{{#equal code "NOTIFICATION"}}
Type your message below.
<br><br>
<div id="notification-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<div class="form-group">
<input class="form-control modal-input operationDataKeys"
id="messageTitle" data-key="messageTitle" placeholder="Title here..." />
</div>
<div class="form-group">
<textarea class="form-control modal-input operationDataKeys"
id="messageText" data-key="messageText" placeholder="Message here..."></textarea>
</div>
<br>
{{/equal}}
{{#equal code "CHANGE_LOCK_CODE"}}
Type new lock-code below.
<br><br>
<input type="password" class="form-control modal-input operationDataKeys" id="lockcode"
data-key="lockCode" placeholder="Enter Lockcode"/>
<br>
{{/equal}}
{{#equal code "DEVICE_LOCK"}}
{{#equal deviceType "android"}}
{{#equal ownership "COPE"}}
<label class="wr-input-control checkbox">
<input id="hard-lock" type="checkbox" class="form-control operationDataKeys"
data-key="hard-lock"/>
<span class="helper" title="Once it enables, device will be blocked permanently.">
&nbsp;&nbsp;&nbsp;Enable Permanent Lock
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<br><br>
{{/equal}}
Type your message to be shown in the lock screen
<br><br>
<div>
<textarea id="lock-message" class="form-control modal-input operationDataKeys"
data-key="lock-message" placeholder="[ Message content is optional ]"></textarea>
</div>
{{/equal}}
{{/equal}}
{{#equal code "UPGRADE_FIRMWARE"}}
{{#equal deviceType "android"}}
Enter firmware upgrade scheduling information.
<br><br>
<label class="wr-input-control checkbox">
<input id="instant-upgrade" type="checkbox" class="form-control operationDataKeys"
data-key="instant-upgrade"/>
<span class="helper"
title="Once enabled, device firmware upgrade process will start instantly.">
&nbsp;&nbsp;&nbsp;Instant Upgrade
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</span>
</label>
<br><br>
<div class='input-group date' id='dateTimePicker'>
Enter the date and time to schedule firmware upgrade.
<br><br>
<div id="firmware-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<input type='text' class="form-control modal-input operationDataKeys"
style="z-index : 900;" name="daterange" id="schedule" data-key="schedule"/>
</div>
<br><br>
<div class='wr-input-control' id='firmwareServerInfo'>
Enter firmware upgrade server URL (ie. http://abc.com or http://abc.com/ota)
(Optional).
<br><br>
<input type='text' class="form-control modal-input operationDataKeys" id="server"
data-key="server"/>
</div>
<script type="text/javascript">
$(function () {
$('.modalpopup-bg').css('z-index', '1000');
$('.modalpopup-container').css('z-index', '1200');
$('input[name="daterange"]').daterangepicker({
singleDatePicker: true,
timePicker: true,
showDropdowns: true,
timePickerIncrement: 1,
locale: {
format: 'MM-DD-YYYY hh:mm a'
}
});
});
$('#instant-upgrade').change(function () {
if ($(this).is(":checked")) {
$('#dateTimePicker').addClass("hidden");
$("#schedule").val('');
} else {
$('#dateTimePicker').removeClass("hidden");
$('input[name="daterange"]').daterangepicker({
singleDatePicker: true,
timePicker: true,
showDropdowns: true,
timePickerIncrement: 1,
locale: {
format: 'MM-DD-YYYY hh:mm a'
}
});
}
});
</script>
<br>
{{/equal}}
{{/equal}}
<br><br>
Do you want to perform this operation on selected device(s) ?
<br>
</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:runOperation('{{code}}')" class="btn-operations">Yes</a>
<a href="javascript:hidePopup()" class="btn-operations btn-default">No</a>
</div>
</div>
</div>
</div>
{{/each}}
<br class="c-both"/>

@ -42,7 +42,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>

@ -16,8 +16,27 @@
* 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.impl;
import org.apache.commons.lang.StringUtils;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.device.mgt.common.FeatureManager;
@ -30,6 +49,7 @@ import org.wso2.carbon.device.mgt.mobile.windows.impl.util.MobileDeviceManagemen
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
public class WindowsFeatureManager implements FeatureManager {
@ -95,11 +115,8 @@ public class WindowsFeatureManager implements FeatureManager {
try {
WindowsDAOFactory.openConnection();
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
}
return featureList;
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Windows platform", e);
@ -108,6 +125,44 @@ public class WindowsFeatureManager implements FeatureManager {
}
}
@Override
public List<Feature> getFeatures(String featureType) throws DeviceManagementException {
if (StringUtils.isEmpty(featureType)) {
return this.getFeatures();
}
try {
WindowsDAOFactory.openConnection();
List<MobileFeature> mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType);
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Android platform", e);
} finally {
WindowsDAOFactory.closeConnection();
}
}
@Override
public List<Feature> getFeatures(String featureType, boolean isHidden) throws DeviceManagementException {
try {
WindowsDAOFactory.openConnection();
List<MobileFeature> mobileFeatures;
if (StringUtils.isNotEmpty(featureType)) {
mobileFeatures = featureDAO.getFeaturesByFeatureType(featureType, isHidden);
} else {
mobileFeatures = featureDAO.getAllFeatures(isHidden);
}
return mobileFeatures.stream().map(MobileDeviceManagementUtil::convertToFeature).collect(
Collectors.toList());
} catch (MobileDeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while retrieving the list of features registered for " +
"Android platform", e);
} finally {
WindowsDAOFactory.closeConnection();
}
}
@Override
public boolean removeFeature(String code) throws DeviceManagementException {
boolean status;

@ -16,6 +16,24 @@
* 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.impl.dao;
import org.wso2.carbon.device.mgt.mobile.windows.impl.dto.MobileFeature;
@ -107,4 +125,32 @@ public interface MobileFeatureDAO {
* @throws MobileDeviceManagementDAOException
*/
List<MobileFeature> getAllFeatures() throws MobileDeviceManagementDAOException;
/**
* Get all the MobileFeatures by a given ui visibility
*
* @param isHidden Whether the operation is hidden from UI or not.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getAllFeatures(boolean isHidden) throws MobileDeviceManagementDAOException;
/**
* Retrieve all MobileFeatures of a given feature type
*
* @param featureType Feature type.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getFeaturesByFeatureType(String featureType) throws MobileDeviceManagementDAOException;
/**
* Retrieve all MobileFeatures of a given feature type and ui visibility
*
* @param featureType Feature type.
* @param isHidden Whether the operation is hidden from UI or not.
* @return {@link MobileFeature} object list.
* @throws MobileDeviceManagementDAOException If an error occurred while retrieving the Feature list
*/
List<MobileFeature> getFeaturesByFeatureType(String featureType, boolean isHidden) throws MobileDeviceManagementDAOException;
}

@ -16,6 +16,24 @@
* 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.impl.dao.impl;
import org.apache.commons.logging.Log;
@ -54,11 +72,13 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = WindowsDAOFactory.getConnection();
String sql = "INSERT INTO WIN_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
String sql = "INSERT INTO WIN_FEATURE(CODE, NAME, TYPE, HIDDEN, DESCRIPTION) VALUES (?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(1, mobileFeature.getName());
stmt.setString(2, mobileFeature.getType());
stmt.setBoolean(3, mobileFeature.isHidden());
stmt.setString(4, mobileFeature.getDescription());
stmt.setString(5, mobileFeature.getCode());
stmt.executeUpdate();
status = true;
} catch (SQLException e) {
@ -78,11 +98,14 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = WindowsDAOFactory.getConnection();
stmt = conn.prepareStatement("INSERT INTO WIN_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)");
stmt = conn.prepareStatement("INSERT INTO WIN_FEATURE(CODE, NAME, TYPE, HIDDEN, DESCRIPTION) " +
"VALUES (?, ?, ?, ?, ?)");
for (MobileFeature mobileFeature : mobileFeatures) {
stmt.setString(1, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getName());
stmt.setString(3, mobileFeature.getDescription());
stmt.setString(1, mobileFeature.getName());
stmt.setString(2, mobileFeature.getType());
stmt.setBoolean(3, mobileFeature.isHidden());
stmt.setString(4, mobileFeature.getDescription());
stmt.setString(5, mobileFeature.getCode());
stmt.addBatch();
}
stmt.executeBatch();
@ -104,12 +127,14 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
try {
conn = WindowsDAOFactory.getConnection();
String updateDBQuery =
"UPDATE WIN_FEATURE SET NAME = ?, DESCRIPTION = ?" +
"UPDATE WIN_FEATURE SET NAME = ?, TYPE = ?, HIDDEN = ?, DESCRIPTION = ?" +
"WHERE CODE = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileFeature.getName());
stmt.setString(2, mobileFeature.getDescription());
stmt.setString(3, mobileFeature.getCode());
stmt.setString(2, mobileFeature.getType());
stmt.setBoolean(3, mobileFeature.isHidden());
stmt.setString(4, mobileFeature.getDescription());
stmt.setString(5, mobileFeature.getCode());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
@ -178,19 +203,13 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE ID = ?";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM WIN_FEATURE WHERE ID = ?";
stmt = conn.prepareStatement(sql);
stmt.setInt(1, mblFeatureId);
rs = stmt.executeQuery();
MobileFeature mobileFeature = null;
if (rs.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(WindowsPluginConstants.WINDOWS_FEATURE_ID));
mobileFeature.setCode(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_CODE));
mobileFeature.setName(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
mobileFeature = populateMobileFeature(rs);
}
return mobileFeature;
} catch (SQLException e) {
@ -209,19 +228,13 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
Connection conn;
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE WHERE CODE = ?";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM WIN_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, mblFeatureCode);
rs = stmt.executeQuery();
MobileFeature mobileFeature = null;
if (rs.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(WindowsPluginConstants.WINDOWS_FEATURE_ID));
mobileFeature.setCode(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_CODE));
mobileFeature.setName(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
mobileFeature = populateMobileFeature(rs);
}
return mobileFeature;
} catch (SQLException e) {
@ -246,19 +259,11 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
List<MobileFeature> features = new ArrayList<>();
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM WIN_FEATURE";
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM WIN_FEATURE";
stmt = conn.prepareStatement(sql);
rs = stmt.executeQuery();
MobileFeature mobileFeature;
while (rs.next()) {
mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(WindowsPluginConstants.WINDOWS_FEATURE_ID));
mobileFeature.setCode(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_CODE));
mobileFeature.setName(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_DESCRIPTION));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
features.add(mobileFeature);
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
@ -268,4 +273,107 @@ public class WindowsFeatureDAOImpl implements MobileFeatureDAO {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
}
}
@Override
public List<MobileFeature> getAllFeatures(boolean isHidden) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn = null;
List<MobileFeature> features = new ArrayList<>();
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM WIN_FEATURE WHERE HIDDEN = ?";
stmt = conn.prepareStatement(sql);
stmt.setBoolean(1, isHidden);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new WindowsFeatureManagementDAOException("Error occurred while retrieving all windows features " +
"from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
WindowsDAOFactory.closeConnection();
}
}
@Override
public List<MobileFeature> getFeaturesByFeatureType(String featureType) throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn;
List<MobileFeature> features = new ArrayList<>();
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION FROM WIN_FEATURE WHERE TYPE = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, featureType);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new WindowsFeatureManagementDAOException("Error occurred while retrieving all windows features of " +
"type " + featureType + " from the android database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
WindowsDAOFactory.closeConnection();
}
}
@Override
public List<MobileFeature> getFeaturesByFeatureType(String featureType, boolean isHidden)
throws MobileDeviceManagementDAOException {
PreparedStatement stmt = null;
ResultSet rs = null;
Connection conn;
List<MobileFeature> features = new ArrayList<>();
try {
conn = WindowsDAOFactory.getConnection();
String sql = "SELECT ID, CODE, NAME, TYPE, HIDDEN, DESCRIPTION " +
"FROM WIN_FEATURE " +
"WHERE TYPE = ? AND HIDDEN = ?";
stmt = conn.prepareStatement(sql);
stmt.setString(1, featureType);
stmt.setBoolean(2, isHidden);
rs = stmt.executeQuery();
while (rs.next()) {
features.add(populateMobileFeature(rs));
}
return features;
} catch (SQLException e) {
throw new WindowsFeatureManagementDAOException("Error occurred while retrieving all android features of " +
"[type: " + featureType + " & hidden: " + isHidden + "] from the windows database.", e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
WindowsDAOFactory.closeConnection();
}
}
/**
* Generate {@link MobileFeature} from the SQL {@link ResultSet}
*
* @param rs Result set
* @return populated {@link MobileFeature}
* @throws SQLException if unable to extract data from {@link ResultSet}
*/
private MobileFeature populateMobileFeature(ResultSet rs) throws SQLException {
MobileFeature mobileFeature = new MobileFeature();
mobileFeature.setId(rs.getInt(WindowsPluginConstants.WINDOWS_FEATURE_ID));
mobileFeature.setCode(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_CODE));
mobileFeature.setName(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_NAME));
mobileFeature.setDescription(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_DESCRIPTION));
mobileFeature.setType(rs.getString(WindowsPluginConstants.WINDOWS_FEATURE_TYPE));
mobileFeature.setHidden(rs.getBoolean(WindowsPluginConstants.WINDOWS_FEATURE_HIDDEN));
mobileFeature.setDeviceType(
DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
return mobileFeature;
}
}

@ -16,6 +16,24 @@
* 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.impl.dto;
import java.io.Serializable;
@ -29,6 +47,8 @@ public class MobileFeature implements Serializable {
private String deviceType;
private String code;
private String name;
private String type;
private boolean hidden;
private String description;
public int getId() {
@ -70,4 +90,20 @@ public class MobileFeature implements Serializable {
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public boolean isHidden() {
return hidden;
}
public void setHidden(boolean hidden) {
this.hidden = hidden;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

@ -16,6 +16,24 @@
* 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.impl.util;
import org.apache.commons.logging.Log;
@ -42,10 +60,13 @@ import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Properties;
/**
* Provides utility methods required by the mobile device management bundle.
@ -203,6 +224,8 @@ public class MobileDeviceManagementUtil {
MobileFeature mobileFeature = new MobileFeature();
mobileFeature.setName(feature.getName());
mobileFeature.setCode(feature.getCode());
mobileFeature.setType(feature.getType());
mobileFeature.setHidden(feature.isHidden());
mobileFeature.setDescription(feature.getDescription());
mobileFeature.setDeviceType(feature.getDeviceType());
return mobileFeature;
@ -212,6 +235,8 @@ public class MobileDeviceManagementUtil {
Feature feature = new Feature();
feature.setDescription(mobileFeature.getDescription());
feature.setDeviceType(mobileFeature.getDeviceType());
feature.setType(mobileFeature.getType());
feature.setHidden(mobileFeature.isHidden());
feature.setCode(mobileFeature.getCode());
feature.setName(mobileFeature.getName());
return feature;

@ -16,6 +16,24 @@
* 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.impl.util;
/**
@ -43,6 +61,8 @@ public class WindowsPluginConstants {
public static final String WINDOWS_FEATURE_CODE = "CODE";
public static final String WINDOWS_FEATURE_NAME = "NAME";
public static final String WINDOWS_FEATURE_DESCRIPTION = "DESCRIPTION";
public static final String WINDOWS_FEATURE_TYPE = "TYPE";
public static final String WINDOWS_FEATURE_HIDDEN = "HIDDEN";
public static final String MOBILE_DB_SCRIPTS_FOLDER = "cdm";
public static final String MOBILE_CONFIG_REGISTRY_ROOT = "/_system/config";

@ -17,9 +17,27 @@
~ 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.
-->
<DeviceTypeConfiguration name="android_sense">
<Features>
<Feature code="keywords">
<Feature type="operation" code="keywords">
<Name>Add Keywords</Name>
<Description>Send keywords to the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words" method="POST">-->
@ -28,7 +46,7 @@
<!--</QueryParameters>-->
<!--</Operation>-->
</Feature>
<Feature code="threshold">
<Feature type="operation" code="threshold">
<Name>Add Threshold</Name>
<Description>Send Threshold to the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words/threshold" method="POST">-->
@ -37,7 +55,7 @@
<!--</QueryParameters>-->
<!--</Operation>-->
</Feature>
<Feature code="remove_words">
<Feature type="operation" code="remove_words">
<Name>Remove words</Name>
<Description>Remove Threshold from the device</Description>
<!--<Operation context="/android_sense/device/{deviceId}/words" method="DELETE">-->

@ -17,15 +17,39 @@
~ 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.
-->
<DeviceTypeConfiguration name="arduino">
<Features>
<Feature code="bulb">
<Feature type="operation" code="bulb">
<Name>Control Bulb</Name>
<Description>Control Bulb on Arduino Uno</Description>
<Operation context="/arduino/device/{deviceId}/bulb" method="POST">
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
<Operation hidden="false" icon="fw-light">
<params>
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
</params>
<metadata>
<uri>/arduino/device/{deviceId}/bulb</uri>
<method>POST</method>
</metadata>
</Operation>
</Feature>
</Features>

@ -17,15 +17,39 @@
~ 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.
-->
<DeviceTypeConfiguration name="raspberrypi">
<Features>
<Feature code="bulb">
<Feature type="operation" code="bulb">
<Name>Control Bulb</Name>
<Description>Control Bulb on Raspberrypi</Description>
<Operation context="/raspberrypi/device/{deviceId}/bulb" method="POST">
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
<Operation hidden="false" icon="fw-light">
<params>
<QueryParameters>
<Parameter>state</Parameter>
</QueryParameters>
</params>
<metadata>
<uri>/raspberrypi/device/{deviceId}/bulb</uri>
<method>POST</method>
</metadata>
</Operation>
</Feature>
</Features>

@ -17,12 +17,35 @@
~ 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.
-->
<DeviceTypeConfiguration name="virtual_firealarm">
<Features>
<Feature code="buzz">
<Feature type="operation" code="buzz">
<Name>Control buzzer</Name>
<Description>Control buzzer on Virtual Firealarm</Description>
<Operation context="/virtual_firealarm/device/{deviceId}/buzz" method="POST">
<Operation hidden="false" icon="fw-light">
<params/>
<metadata>
<uri>/virtual_firealarm/device/{deviceId}/buzz</uri>
<method>POST</method>
</metadata>
</Operation>
</Feature>
</Features>

@ -26,6 +26,8 @@ CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`CODE` VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NULL,
`TYPE` VARCHAR(20) NULL,
`HIDDEN` BOOLEAN DEFAULT FALSE,
`DESCRIPTION` VARCHAR(200) NULL,
PRIMARY KEY (`ID`));

@ -27,6 +27,8 @@ CREATE TABLE AD_FEATURE (
ID INT NOT NULL IDENTITY,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BIT DEFAULT 0,
DESCRIPTION VARCHAR(200) NULL,
PRIMARY KEY (ID)
);

@ -26,7 +26,8 @@ CREATE TABLE IF NOT EXISTS `AD_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`CODE` VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NULL,
`TYPE` VARCHAR(20) NULL,
`HIDDEN` BIT DEFAULT 0,
`DESCRIPTION` VARCHAR(200) NULL,
PRIMARY KEY (`ID`)
) ENGINE = InnoDB;
) ENGINE = InnoDB;

@ -27,6 +27,8 @@ CREATE TABLE AD_FEATURE (
ID INT NOT NULL,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NOT NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BIT DEFAULT 0,
DESCRIPTION VARCHAR(200) DEFAULT NULL,
CONSTRAINT AD_FEATURE PRIMARY KEY (ID)
)

@ -26,5 +26,7 @@ CREATE TABLE IF NOT EXISTS AD_FEATURE (
ID BIGSERIAL NOT NULL PRIMARY KEY,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BOOLEAN DEFAULT FALSE,
DESCRIPTION VARCHAR(200) NULL
);

@ -17,6 +17,24 @@
~ 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.
-->
<DeviceTypeConfiguration name="android">
<DeviceDetails table-id="AD_DEVICE"/>
@ -87,304 +105,533 @@
</DataSource>
<Features>
<Feature code="DEVICE_RING">
<Feature type="operation" code="DEVICE_RING">
<Name>Ring</Name>
<Description>Ring the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/ring" method="POST" type="application/json">
<Operation hidden="false" icon="fw-dial-up">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/ring</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/ring</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_LOCK">
<Feature type="operation" code="DEVICE_LOCK">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/lock-devices" method="POST" type="application/json">
<Operation hidden="false" icon="fw-lock">
<params>
<uiParams>
<uiParam optional="true">
<type>text</type>
<id>lock-message</id>
<label>Message to be sent to the device</label>
</uiParam>
<uiParam optional="true">
<type>checkbox</type>
<id>hard-lock</id>
<label>Hard lock enabled</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/lock-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/ring</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_LOCATION">
<Feature type="operation" code="DEVICE_LOCATION">
<Name>Location</Name>
<Description>Request coordinates of device location</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/location" method="POST" type="application/json">
<Operation hidden="false" icon="fw-map-location">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/location</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/location</permission>
</metadata>
</Operation>
</Feature>
<Feature code="CLEAR_PASSWORD">
<Feature type="operation" code="CLEAR_PASSWORD">
<Name>Clear Password</Name>
<Description>Clear current password (This functionality is only working with profile owners from Android 7.0 API 24 onwards.)</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/clear-password" method="POST" type="application/json">
<Operation hidden="false" icon="fw-clear">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/clear-password</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/clear-passwor</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_REBOOT">
<Feature type="operation" code="DEVICE_REBOOT">
<Name>Reboot</Name>
<Description>Reboot the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/reboot" method="POST" type="application/json">
<Operation hidden="false" icon="fw-refresh">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/reboot</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/reboot</permission>
<filters>
<filter>
<property>ownership</property>
<value>COPE</value>
<description>This feature is only available in COPE/COSU</description>
</filter>
</filters>
</metadata>
</Operation>
</Feature>
<Feature code="UPGRADE_FIRMWARE">
<Feature type="operation" code="UPGRADE_FIRMWARE">
<Name>Upgrade Firmware</Name>
<Description>Upgrade Firmware</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/upgrade-firmware" method="POST" type="application/json">
<Operation hidden="false" icon="fw-hardware">
<params>
<uiParams>
<uiParam optional="true">
<type>checkbox</type>
<id>immediate</id>
<label>Instant Upgrade</label>
<helper>Once enabled, device firmware upgrade process will start instantly.</helper>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>schedule</id>
<label>Enter the date and time to schedule firmware upgrade.</label>
</uiParam>
<uiParam optional="true">
<type>text</type>
<id>server</id>
<label>Enter firmware upgrade server URL (ie. http://abc.com or http://abc.com/ota)</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/reboot</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/upgrade-firmware</permission>
<filters>
<filter>
<property>ownership</property>
<value>COPE</value>
<description>This feature is only available in COPE/COSU</description>
</filter>
</filters>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_MUTE">
<Feature type="operation" code="DEVICE_MUTE">
<Name>Mute</Name>
<Description>Enable mute in the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/mute" method="POST" type="application/json">
<Operation hidden="false" icon="fw-mute">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/mute</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/mute</permission>
</metadata>
</Operation>
</Feature>
<Feature code="NOTIFICATION">
<Feature type="operation" code="NOTIFICATION">
<Name>Message</Name>
<Description>Send message</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/send-notification" method="POST" type="application/json">
<Operation hidden="false" icon="fw-message">
<params>
<uiParams>
<uiParam optional="false">
<type>text</type>
<id>messageTitle</id>
<label>Title Here...</label>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>messageText</id>
<label>Message Here...</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/send-notification</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/send-notification</permission>
</metadata>
</Operation>
</Feature>
<Feature code="CHANGE_LOCK_CODE">
<Feature type="operation" code="CHANGE_LOCK_CODE">
<Name>Change Lock-code</Name>
<Description>Change current lock code (This functionality is only working with profile owners from Android 7.0 API 24 onwards.)</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/change-lock-code" method="POST" type="application/json">
<Operation hidden="false" icon="fw-security">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/change-lock-code</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/change-lock-code</permission>
</metadata>
</Operation>
</Feature>
<Feature code="FILE_TRANSFER">
<Feature type="operation" code="FILE_TRANSFER">
<Name>File Transfer</Name>
<Description>Transfer file to the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/file-transfer" method="POST" type="application/json">
<Operation hidden="false" icon="fw-save">
<params>
<uiParams>
<uiParam optional="false">
<type>radio</type>
<name>directionSelection</name>
<id>upload</id>
<values>
<value>To device</value>
</values>
</uiParam>
<uiParam optional="false">
<type>radio</type>
<name>directionSelection</name>
<id>download</id>
<values>
<value>From device</value>
</values>
</uiParam>
<uiParam optional="false">
<type>select</type>
<name>protocolSelection</name>
<id>protocol</id>
<values>
<value>HTTP</value>
<value>FTP</value>
<value>SFTP</value>
</values>
<label>Protocol</label>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>fileURL</id>
<label>URL to upload file from device</label>
</uiParam>
<uiParam optional="false">
<type>info</type>
<id>defaultFileLocation</id>
<label>File will be saved in Default download directory if not specified.</label>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>fileLocation</id>
<label>File location in the device</label>
</uiParam>
<uiParam optional="false">
<type>checkbox</type>
<id>authentication</id>
<label>Authentication required</label>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>userName</id>
<label>Username</label>
</uiParam>
<uiParam optional="false">
<type>password</type>
<id>ftpPassword</id>
<label>Password (Ignore if not needed)</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/file-transfer</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/file-transfer</permission>
</metadata>
</Operation>
</Feature>
<Feature code="ENTERPRISE_WIPE">
<Feature type="operation" code="ENTERPRISE_WIPE">
<Name>Enterprise Wipe</Name>
<Description>Remove enterprise applications</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/enterprise-wipe" method="POST" type="application/json">
<Operation hidden="false" icon="fw-block">
<params/>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/enterprise-wipe</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/enterprise-wipe</permission>
</metadata>
</Operation>
</Feature>
<Feature code="WIPE_DATA">
<Feature type="operation" code="WIPE_DATA">
<Name>Wipe Data</Name>
<Description>Factory reset the device</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/wipe" method="POST" type="application/json">
<Operation hidden="false" icon="fw-delete">
<params>
<uiParams>
<uiParam optional="false">
<type>text</type>
<id>pin</id>
<label>Enter PIN code* of the device.</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/wipe</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/wipe</permission>
</metadata>
</Operation>
</Feature>
<Feature code="WIFI">
<Feature type="policy" code="WIFI">
<Name>Wifi</Name>
<Description>Setting up wifi configuration</Description>
</Feature>
<Feature code="GLOBAL_PROXY">
<Feature type="policy" code="GLOBAL_PROXY">
<Name>Global Proxy</Name>
<Description>Setting up a network-independent global HTTP proxy on a device.</Description>
</Feature>
<Feature code="CAMERA">
<Feature type="policy" code="CAMERA">
<Name>Camera</Name>
<Description>Enable or disable camera</Description>
</Feature>
<Feature code="EMAIL">
<Feature type="policy" code="EMAIL">
<Name>Email</Name>
<Description>Configure email settings</Description>
</Feature>
<Feature code="DEVICE_INFO">
<Feature type="operation" code="DEVICE_INFO">
<Name>Device info</Name>
<Description>Request device information</Description>
</Feature>
<Feature code="APPLICATION_LIST">
<Feature type="operation" code="APPLICATION_LIST">
<Name>Application List</Name>
<Description>Request list of current installed applications</Description>
</Feature>
<Feature code="INSTALL_APPLICATION">
<Feature type="operation" code="INSTALL_APPLICATION">
<Name>Install App</Name>
<Description>Install App</Description>
</Feature>
<Feature code="UNINSTALL_APPLICATION">
<Feature type="operation" code="UNINSTALL_APPLICATION">
<Name>Uninstall App</Name>
<Description>Uninstall App</Description>
</Feature>
<Feature code="BLACKLIST_APPLICATIONS">
<Feature type="policy" code="BLACKLIST_APPLICATIONS">
<Name>Blacklist app</Name>
<Description>Blacklist applications</Description>
</Feature>
<Feature code="ENCRYPT_STORAGE">
<Feature type="policy" code="ENCRYPT_STORAGE">
<Name>Encrypt Storage</Name>
<Description>Encrypt storage</Description>
</Feature>
<Feature code="PASSCODE_POLICY">
<Feature type="policy" code="PASSCODE_POLICY">
<Name>Password Policy</Name>
<Description>Set passcode policy</Description>
</Feature>
<Feature code="VPN">
<Feature type="policy" code="VPN">
<Name>Configure VPN</Name>
<Description>Configure VPN settings</Description>
</Feature>
<Feature code="DISALLOW_ADJUST_VOLUME">
<Feature type="policy" code="DISALLOW_ADJUST_VOLUME">
<Name>Disallow user to change volume</Name>
<Description>Allow or disallow user to change volume"</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_BLUETOOTH">
<Feature type="policy" code="DISALLOW_CONFIG_BLUETOOTH">
<Name>Disallow bluetooth configuration</Name>
<Description>Allow or disallow bluetooth configuration</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_CELL_BROADCASTS">
<Feature type="policy" code="DISALLOW_CONFIG_CELL_BROADCASTS">
<Name>Disallow user to change cell broadcast configurations</Name>
<Description>Allow or disallow user to change cell broadcast configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_CREDENTIALS">
<Feature type="policy" code="DISALLOW_CONFIG_CREDENTIALS">
<Name>Disallow user to change user credentials</Name>
<Description>Allow or disallow user to change user credentials</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_MOBILE_NETWORKS">
<Feature type="policy" code="DISALLOW_CONFIG_MOBILE_NETWORKS">
<Name>Disallow user to change mobile networks configurations</Name>
<Description>Allow or disallow user to change mobile networks configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_TETHERING">
<Feature type="policy" code="DISALLOW_CONFIG_TETHERING">
<Name>Disallow user to change tethering configurations</Name>
<Description>Allow or disallow user to change tethering configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_VPN">
<Feature type="policy" code="DISALLOW_CONFIG_VPN">
<Name>Disallow user to change VPN configurations</Name>
<Description>Allow or disallow user to change VPN configurations</Description>
</Feature>
<Feature code="DISALLOW_CONFIG_WIFI">
<Feature type="policy" code="DISALLOW_CONFIG_WIFI">
<Name>Disallow user to change WIFI configurations</Name>
<Description>Allow or disallow user to change WIFI configurations</Description>
</Feature>
<Feature code="DISALLOW_APPS_CONTROL">
<Feature type="policy" code="DISALLOW_APPS_CONTROL">
<Name>Disallow user to change app control</Name>
<Description>Allow or disallow user to change app control</Description>
</Feature>
<Feature code="DISALLOW_CREATE_WINDOWS">
<Feature type="policy" code="DISALLOW_CREATE_WINDOWS">
<Name>Disallow window creation</Name>
<Description>Allow or disallow window creation</Description>
</Feature>
<Feature code="DISALLOW_APPS_CONTROL">
<Feature type="policy" code="DISALLOW_APPS_CONTROL">
<Name>Disallow user to change app control configurations</Name>
<Description>Allow or disallow user to change app control configurations</Description>
</Feature>
<Feature code="DISALLOW_CROSS_PROFILE_COPY_PASTE">
<Feature type="policy" code="DISALLOW_CROSS_PROFILE_COPY_PASTE">
<Name>Disallow cross profile copy paste</Name>
<Description>Allow or disallow cross profile copy paste</Description>
</Feature>
<Feature code="DISALLOW_DEBUGGING_FEATURES">
<Feature type="policy" code="DISALLOW_DEBUGGING_FEATURES">
<Name>Disallow debugging features</Name>
<Description>Allow or disallow debugging features</Description>
</Feature>
<Feature code="DISALLOW_FACTORY_RESET">
<Feature type="policy" code="DISALLOW_FACTORY_RESET">
<Name>Disallow factory reset</Name>
<Description>Allow or disallow factory reset</Description>
</Feature>
<Feature code="DISALLOW_ADD_USER">
<Feature type="policy" code="DISALLOW_ADD_USER">
<Name>Disallow add user</Name>
<Description>Allow or disallow add user</Description>
</Feature>
<Feature code="DISALLOW_INSTALL_APPS">
<Feature type="policy" code="DISALLOW_INSTALL_APPS">
<Name>Disallow install apps</Name>
<Description>Allow or disallow install apps</Description>
</Feature>
<Feature code="DISALLOW_INSTALL_UNKNOWN_SOURCES">
<Feature type="policy" code="DISALLOW_INSTALL_UNKNOWN_SOURCES">
<Name>Disallow install unknown sources</Name>
<Description>Allow or disallow install unknown sources</Description>
</Feature>
<Feature code="DISALLOW_MODIFY_ACCOUNTS">
<Feature type="policy" code="DISALLOW_MODIFY_ACCOUNTS">
<Name>Disallow modify account</Name>
<Description>Allow or disallow modify account</Description>
</Feature>
<Feature code="DISALLOW_MOUNT_PHYSICAL_MEDIA">
<Feature type="policy" code="DISALLOW_MOUNT_PHYSICAL_MEDIA">
<Name>Disallow mount physical media</Name>
<Description>Allow or disallow mount physical media</Description>
</Feature>
<Feature code="DISALLOW_NETWORK_RESET">
<Feature type="policy" code="DISALLOW_NETWORK_RESET">
<Name>Disallow network reset</Name>
<Description>Allow or disallow network reset</Description>
</Feature>
<Feature code="DISALLOW_OUTGOING_BEAM">
<Feature type="policy" code="DISALLOW_OUTGOING_BEAM">
<Name>Disallow outgoing beam</Name>
<Description>Allow or disallow outgoing beam</Description>
</Feature>
<Feature code="DISALLOW_OUTGOING_CALLS">
<Feature type="policy" code="DISALLOW_OUTGOING_CALLS">
<Name>Disallow outgoing calls</Name>
<Description>Allow or disallow outgoing calls</Description>
</Feature>
<Feature code="DISALLOW_REMOVE_USER">
<Feature type="policy" code="DISALLOW_REMOVE_USER">
<Name>Disallow remove users</Name>
<Description>Allow or disallow remove users</Description>
</Feature>
<Feature code="DISALLOW_SAFE_BOOT">
<Feature type="policy" code="DISALLOW_SAFE_BOOT">
<Name>Disallow safe boot</Name>
<Description>Allow or disallow safe boot</Description>
</Feature>
<Feature code="DISALLOW_SHARE_LOCATION">
<Feature type="policy" code="DISALLOW_SHARE_LOCATION">
<Name>Disallow share location</Name>
<Description>Allow or disallow share location</Description>
</Feature>
<Feature code="DISALLOW_SMS">
<Feature type="policy" code="DISALLOW_SMS">
<Name>Disallow sms</Name>
<Description>Allow or disallow sms</Description>
</Feature>
<Feature code="DISALLOW_UNINSTALL_APPS">
<Feature type="policy" code="DISALLOW_UNINSTALL_APPS">
<Name>Disallow uninstall app</Name>
<Description>Allow or disallow uninstall app</Description>
</Feature>
<Feature code="DISALLOW_UNMUTE_MICROPHONE">
<Feature type="policy" code="DISALLOW_UNMUTE_MICROPHONE">
<Name>Disallow unmute mic</Name>
<Description>Allow or disallow unmute mic</Description>
</Feature>
<Feature code="DISALLOW_USB_FILE_TRANSFER">
<Feature type="policy" code="DISALLOW_USB_FILE_TRANSFER">
<Name>Disallow usb file transfer</Name>
<Description>Allow or disallow usb file transfer</Description>
</Feature>
<Feature code="ALLOW_PARENT_PROFILE_APP_LINKING">
<Feature type="policy" code="ALLOW_PARENT_PROFILE_APP_LINKING">
<Name>Disallow parent profile app linking</Name>
<Description>Allow or disallow parent profile app linking</Description>
</Feature>
<Feature code="ENSURE_VERIFY_APPS">
<Feature type="policy" code="ENSURE_VERIFY_APPS">
<Name>Disallow ensure verify apps</Name>
<Description>Allow or disallow ensure verify apps</Description>
</Feature>
<Feature code="AUTO_TIME">
<Feature type="policy" code="AUTO_TIME">
<Name>Disallow auto timing</Name>
<Description>Allow or disallow auto timing</Description>
</Feature>
<Feature code="REMOVE_DEVICE_OWNER">
<Feature type="policy" code="REMOVE_DEVICE_OWNER">
<Name>Remove device owner</Name>
<Description>Remove device owner</Description>
</Feature>
<Feature code="LOGCAT">
<Feature type="policy" code="LOGCAT">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_SET_WALLPAPER">
<Feature type="policy" code="DISALLOW_SET_WALLPAPER">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_SET_USER_ICON">
<Feature type="policy" code="DISALLOW_SET_USER_ICON">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_REMOVE_MANAGEMENT_PROFILE">
<Feature type="policy" code="DISALLOW_REMOVE_MANAGEMENT_PROFILE">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_AUTOFILL">
<Feature type="policy" code="DISALLOW_AUTOFILL">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_BLUETOOTH">
<Feature type="policy" code="DISALLOW_BLUETOOTH">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_BLUETOOTH_SHARING">
<Feature type="policy" code="DISALLOW_BLUETOOTH_SHARING">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_REMOVE_USER">
<Feature type="policy" code="DISALLOW_REMOVE_USER">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DISALLOW_DATA_ROAMING">
<Feature type="policy" code="DISALLOW_DATA_ROAMING">
<Name>Fetch device logcat</Name>
<Description>Fetch device logcat</Description>
</Feature>
<Feature code="DEVICE_UNLOCK">
<Feature type="operation" hidden="false" code="DEVICE_UNLOCK">
<Name>Unlock the device</Name>
<Description>Unlock the device</Description>
</Feature>
<Feature code="REMOTE_APP_CONFIG">
<Name>Send app restriction</Name>
<Description>Send remote configurations to app</Description>
<Operation context="/api/device-mgt/android/v1.0/admin/devices/send-app-conf" method="POST"
type="application/json">
<Feature type="operation" code="REMOTE_APP_CONFIG">
<Name>Wipe Data</Name>
<Description>Factory reset the device</Description>
<Operation disabled="false" hidden="false" icon="fw-gadget">
<params>
<uiParams>
<uiParam optional="false">
<type>text</type>
<id>app-id</id>
<label>Application identifier</label>
</uiParam>
<uiParam optional="false">
<type>text</type>
<id>payload</id>
<label>Application restriction payload</label>
</uiParam>
</uiParams>
</params>
<metadata>
<uri>/api/device-mgt/android/v1.0/admin/devices/send-app-conf</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/android/send-app-conf</permission>
</metadata>
</Operation>
</Feature>
</Features>

@ -25,6 +25,8 @@ CREATE TABLE IF NOT EXISTS `WIN_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`CODE` VARCHAR(45) NOT NULL,
`NAME` VARCHAR(100) NULL,
`TYPE` VARCHAR(20) NULL,
`HIDDEN` BOOLEAN DEFAULT FALSE,
`DESCRIPTION` VARCHAR(200) NULL,
PRIMARY KEY (`ID`)
);

@ -6,6 +6,8 @@ CREATE TABLE WIN_FEATURE (
ID INTEGER IDENTITY(1,1) NOT NULL,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BIT DEFAULT 0,
DESCRIPTION VARCHAR(200) NULL,
PRIMARY KEY (ID)
);

@ -26,6 +26,8 @@ CREATE TABLE IF NOT EXISTS `WIN_FEATURE` (
`ID` INT NOT NULL AUTO_INCREMENT,
`CODE` VARCHAR(45) NULL,
`NAME` VARCHAR(100) NULL,
`TYPE` VARCHAR(20) NULL,
`HIDDEN` BIT DEFAULT 0,
`DESCRIPTION` VARCHAR(200) NULL,
PRIMARY KEY (`ID`))
ENGINE = InnoDB;

@ -26,6 +26,8 @@ CREATE TABLE WIN_FEATURE (
ID NUMBER(10) NOT NULL,
CODE VARCHAR(45) NOT NULL,
NAME VARCHAR(100) NOT NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BIT DEFAULT 0,
DESCRIPTION VARCHAR(200) NULL,
PRIMARY KEY (ID)
)

@ -25,6 +25,8 @@ CREATE TABLE IF NOT EXISTS WIN_FEATURE (
ID SERIAL NOT NULL,
CODE VARCHAR(45) NULL,
NAME VARCHAR(100) NULL,
TYPE VARCHAR(20) NULL,
HIDDEN BOOLEAN DEFAULT FALSE,
DESCRIPTION VARCHAR(200) NULL,
PRIMARY KEY (ID)
);

@ -17,6 +17,24 @@
~ 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.
-->
<DeviceTypeConfiguration name="windows">
<DeviceDetails table-id="WIN_DEVICE"/>
@ -81,65 +99,107 @@
<Feature code="DISENROLL">
<Name>Disenroll</Name>
<Description>Dis-enrol the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/disenroll-devices" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-block">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/disenroll-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/disenroll</permission>
</metadata>
</Operation>
</Feature>
<Feature code="WIPE_DATA">
<Name>Wipe Data</Name>
<Description>Wipe the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/wipe-devices" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-delete">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/wipe-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/wipe</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_RING">
<Name>Ring</Name>
<Description>Ring the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/ring-devices" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-dial-up">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/ring-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/ring</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_LOCK">
<Name>Device Lock</Name>
<Description>Lock the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/lock-devices" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-lock">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/lock-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/lock</permission>
</metadata>
</Operation>
</Feature>
<Feature code="LOCK_RESET">
<Name>Device Lock Reset</Name>
<Description>Lock Reset the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/lock-reset-devices" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-security">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/lock-reset-devices</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/lock-reset</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_LOCATION">
<Name>Location</Name>
<Description>Request coordinates of device location</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/location" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-map-location">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/location</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/location</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_REBOOT">
<Name>Reboot</Name>
<Description>Reboot the device</Description>
<Operation context="/api/device-mgt/windows/v1.0/admin/devices/reboot" method="POST"
type="application/json">
<Operation hidden="false" icon="fw-refresh">
<params/>
<metadata>
<uri>/api/device-mgt/windows/v1.0/admin/devices/reboot</uri>
<method>POST</method>
<contentType>application/json</contentType>
<permission>/device-mgt/devices/owning-device/operations/windows/reboot</permission>
</metadata>
</Operation>
</Feature>
<Feature code="DEVICE_INFO">
<Feature type="operation" code="DEVICE_INFO">
<Name>Device info</Name>
<Description>Request device information</Description>
</Feature>
<Feature code="PASSCODE_POLICY">
<Feature type="policy" code="PASSCODE_POLICY">
<Name>Password Policy</Name>
<Description>Set passcode policy</Description>
</Feature>
<Feature code="CAMERA">
<Feature type="policy" code="CAMERA">
<Name>Camera Enable/Disable</Name>
<Description>Enable/Disable camera</Description>
</Feature>
<Feature code="ENCRYPT_STORAGE">
<Feature type="policy" code="ENCRYPT_STORAGE">
<Name>Encrypt Storage</Name>
<Description>Encrypt the device storage</Description>
</Feature>

@ -1445,7 +1445,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<obrRepository>NONE</obrRepository>

Loading…
Cancel
Save