Seperate out task operations

revert-dabc3590
madhawap 8 years ago
parent 0cf52a7b5e
commit 3249079965

@ -22,6 +22,7 @@ var InitiateViewOption = null;
var deviceId = $(".device-id"); var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid"); var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type"); var deviceType = deviceId.data("type");
var ownership = deviceId.data("ownership");
var payload = [deviceIdentifier]; var payload = [deviceIdentifier];
var operationTable; var operationTable;
var serviceUrl; var serviceUrl;
@ -134,6 +135,7 @@ var InitiateViewOption = null;
}); });
function loadOperationsLog(update) { function loadOperationsLog(update) {
var owner = $("#device-owner").data("owner");
var operationsLogTable = "#operations-log-table"; var operationsLogTable = "#operations-log-table";
if (update) { if (update) {
operationTable = $(operationsLogTable).DataTable(); operationTable = $(operationsLogTable).DataTable();
@ -148,8 +150,8 @@ var InitiateViewOption = null;
pageLength : 10, pageLength : 10,
order: [], order: [],
ajax: { ajax: {
url: "/emm/api/operation/paginate", url: "/devicemgt/api/operation/paginate",
data: {deviceId : deviceIdentifier, deviceType: deviceType}, data: {deviceId : deviceIdentifier, deviceType: deviceType, owner:owner},
dataSrc: function (json) { dataSrc: function (json) {
$("#operations-spinner").addClass("hidden"); $("#operations-spinner").addClass("hidden");
$("#operations-log-container").empty(); $("#operations-log-container").empty();

@ -23,6 +23,7 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.TaskOperation;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry; import org.wso2.carbon.device.mgt.common.configuration.mgt.ConfigurationEntry;
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration; import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
@ -52,6 +53,25 @@ public class AndroidDeviceManagementService implements DeviceManagementService {
return AndroidDeviceManagementService.DEVICE_TYPE_ANDROID; return AndroidDeviceManagementService.DEVICE_TYPE_ANDROID;
} }
// This method is not in use
@Override
public List<TaskOperation> getTasksForPlatform() {
// List<String> operationsForPlatform = new ArrayList<>();
// TaskConfiguration taskConfiguration =
// MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig()
// .getTaskConfiguration();
//
// List<TaskConfiguration.Operation> ops = taskConfiguration.getOperations();
// List<TaskOperation> taskOperations = new ArrayList<>();
// for (TaskConfiguration.Operation op : ops) {
// TaskOperation taskOperation = new TaskOperation();
// taskOperation.setTaskName(op.getOperationName());
// taskOperation.setRecurrentTimes(op.getRecurrency());
// taskOperations.add(taskOperation);
// }
return null;
}
@Override @Override
public void init() throws DeviceManagementException { public void init() throws DeviceManagementException {
this.deviceManager = new AndroidDeviceManager(); this.deviceManager = new AndroidDeviceManager();

@ -18,6 +18,8 @@
package org.wso2.carbon.device.mgt.mobile.android.impl.config; package org.wso2.carbon.device.mgt.mobile.android.impl.config;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -28,6 +30,7 @@ import javax.xml.bind.annotation.XmlRootElement;
public final class MobileDeviceManagementConfig { public final class MobileDeviceManagementConfig {
private MobileDeviceManagementRepository mobileDeviceMgtRepository; private MobileDeviceManagementRepository mobileDeviceMgtRepository;
// private TaskConfiguration taskConfiguration;
@XmlElement(name = "ManagementRepository", nillable = false) @XmlElement(name = "ManagementRepository", nillable = false)
public MobileDeviceManagementRepository getMobileDeviceMgtRepository() { public MobileDeviceManagementRepository getMobileDeviceMgtRepository() {
@ -39,4 +42,13 @@ public final class MobileDeviceManagementConfig {
this.mobileDeviceMgtRepository = mobileDeviceMgtRepository; this.mobileDeviceMgtRepository = mobileDeviceMgtRepository;
} }
// @XmlElement(name = "TaskConfiguration", required = true)
// public TaskConfiguration getTaskConfiguration() {
// return taskConfiguration;
// }
//
// public void setTaskConfiguration(TaskConfiguration taskConfiguration) {
// this.taskConfiguration = taskConfiguration;
// }
} }

@ -0,0 +1,62 @@
package org.wso2.carbon.device.mgt.mobile.android.impl.config.task;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
/**
*
*/
@XmlRootElement(name = "TaskConfiguration")
public class TaskConfiguration {
private boolean enabled;
private List<Operation> operations;
@XmlElement(name = "Enable", required = true)
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
@XmlElementWrapper(name="Operations")
@XmlElement(name = "Operation", required = true)
public List<Operation> getOperations() {
return operations;
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
@XmlRootElement(name = "Operation")
public static class Operation {
private String operationName;
private int recurrency;
@XmlElement(name = "Name", required = true)
public String getOperationName() {
return operationName;
}
public void setOperationName(String operationName) {
this.operationName = operationName;
}
@XmlElement(name = "RecurrentTimes", required = true)
public int getRecurrency() {
return recurrency;
}
public void setRecurrency(int recurrency) {
this.recurrency = recurrency;
}
}
}

@ -18,14 +18,11 @@
package org.wso2.carbon.device.mgt.mobile.windows.impl; package org.wso2.carbon.device.mgt.mobile.windows.impl;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.DeviceManager; import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.ProvisioningConfig; import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
import org.wso2.carbon.device.mgt.common.app.mgt.Application; import org.wso2.carbon.device.mgt.common.TaskOperation;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager; import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
@ -45,6 +42,11 @@ public class WindowsDeviceManagementService implements DeviceManagementService {
return WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS; return WindowsDeviceManagementService.DEVICE_TYPE_WINDOWS;
} }
@Override
public List<TaskOperation> getTasksForPlatform() {
return null;
}
@Override @Override
public void init() throws DeviceManagementException { public void init() throws DeviceManagementException {
this.deviceManager = new WindowsDeviceManager(); this.deviceManager = new WindowsDeviceManager();

@ -401,5 +401,20 @@
</Operation> </Operation>
</Feature> </Feature>
</Features> </Features>
<TaskConfiguration>
<Operations>
<Operation>
<Name>DEVICE_INFO</Name>
<RecurrentTimes>1</RecurrentTimes>
</Operation>
<Operation>
<Name>APPLICATION_LIST</Name>
<RecurrentTimes>5</RecurrentTimes>
</Operation>
<Operation>
<Name>DEVICE_LOCATION</Name>
<RecurrentTimes>1</RecurrentTimes>
</Operation>
</Operations>
</TaskConfiguration>
</DeviceTypeConfiguration> </DeviceTypeConfiguration>
Loading…
Cancel
Save