forked from community/device-mgt-plugins
Merge branch 'master' of https://github.com/charithag/carbon-device-mgt-plugins
commit
df87b3f088
@ -0,0 +1,125 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>device-mgt-mdm</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<name>WSO2 Carbon - Mobile Device app Management Core</name>
|
||||||
|
<description>WSO2 Carbon - Device Management Core</description>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
<artifactId>org.wso2.mdm.appmgt</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${project.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>MDM Management Core Bundle</Bundle-Description>
|
||||||
|
<Private-Package>org.wso2.mdm.appmgt.internal</Private-Package>
|
||||||
|
<Import-Package>
|
||||||
|
org.osgi.framework,
|
||||||
|
org.osgi.service.component,
|
||||||
|
org.apache.commons.logging,
|
||||||
|
org.wso2.carbon.appmgt.mobile.*,
|
||||||
|
org.wso2.carbon.device.mgt.common,
|
||||||
|
org.wso2.carbon.device.mgt.common.operation.mgt,
|
||||||
|
org.wso2.carbon.device.mgt.core.operation.mgt,
|
||||||
|
org.wso2.mdm.mdmmgt.*,
|
||||||
|
org.wso2.carbon.device.mgt.common.app.mgt,
|
||||||
|
org.wso2.carbon.device.mgt.core.service,
|
||||||
|
org.wso2.carbon.device.mgt.core.app.mgt
|
||||||
|
</Import-Package>
|
||||||
|
<Export-Package>
|
||||||
|
!org.wso2.mdm.appmgt.internal,
|
||||||
|
org.wso2.mdm.appmgt.*
|
||||||
|
</Export-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!--
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.18</version>
|
||||||
|
<configuration>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
<suiteXmlFiles>
|
||||||
|
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
||||||
|
</suiteXmlFiles>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
-->
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.mdm.mdmmgt</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.testng</groupId>
|
||||||
|
<artifactId>testng</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.appmgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.appmgt.mobile</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.wso2.mdm.appmgt.internal;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.service.component.ComponentContext;
|
||||||
|
import org.wso2.carbon.appmgt.mobile.interfaces.MDMOperations;
|
||||||
|
import org.wso2.mdm.appmgt.service.MDMOperationsImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @scr.component name="org.wso2.mdm.appmgt.manager" immediate="true"
|
||||||
|
*/
|
||||||
|
public class AppMgtMDMService {
|
||||||
|
private static Log log = LogFactory.getLog(AppMgtMDMService.class);
|
||||||
|
|
||||||
|
protected void activate(ComponentContext componentContext) {
|
||||||
|
|
||||||
|
BundleContext bundleContext = componentContext.getBundleContext();
|
||||||
|
bundleContext.registerService(MDMOperations.class.getName(),
|
||||||
|
new MDMOperationsImpl(), null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,185 @@
|
|||||||
|
package org.wso2.mdm.appmgt.service;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.appmgt.mobile.interfaces.MDMOperations;
|
||||||
|
import org.wso2.carbon.appmgt.mobile.mdm.App;
|
||||||
|
import org.wso2.carbon.appmgt.mobile.mdm.Device;
|
||||||
|
import org.wso2.carbon.appmgt.mobile.utils.User;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.Platform;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.MobileApp;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.MobileAppTypes;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
import org.wso2.mdm.mdmmgt.util.MDMAndroidOperationUtil;
|
||||||
|
import org.wso2.mdm.mdmmgt.util.MDMIOSOperationUtil;
|
||||||
|
import org.wso2.mdm.mdmmgt.util.MDMServiceAPIUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
public class MDMOperationsImpl implements MDMOperations {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(MDMOperationsImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void performAction(User currentUser, String action, App app, int tenantId, String type,
|
||||||
|
String[] params,
|
||||||
|
HashMap<String, String> configProperties) {
|
||||||
|
|
||||||
|
ApplicationManager appManagerConnector;
|
||||||
|
org.wso2.carbon.device.mgt.common.operation.mgt.Operation operation = null;
|
||||||
|
|
||||||
|
List<String> userNameList;
|
||||||
|
List<String> roleNameList;
|
||||||
|
List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>();
|
||||||
|
List<org.wso2.carbon.device.mgt.common.Device> deviceList = null;
|
||||||
|
|
||||||
|
if ("user".equals(type)) {
|
||||||
|
String userName = null;
|
||||||
|
for (String param : params) {
|
||||||
|
userName = param;
|
||||||
|
|
||||||
|
try {
|
||||||
|
deviceList = MDMServiceAPIUtils.getDeviceManagementService(tenantId).getDevicesOfUser(userName);
|
||||||
|
} catch (DeviceManagementException devEx) {
|
||||||
|
String errorMsg =
|
||||||
|
"Error occurred fetch device for user " + userName + devEx.getErrorMessage() + " " +
|
||||||
|
"at app installation";
|
||||||
|
log.error(errorMsg, devEx);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (org.wso2.carbon.device.mgt.common.Device device : deviceList) {
|
||||||
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
||||||
|
deviceIdentifier.setId(device.getDeviceIdentifier());
|
||||||
|
deviceIdentifier.setType(device.getType());
|
||||||
|
|
||||||
|
deviceIdentifiers.add(deviceIdentifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ("role".equals(type)) {
|
||||||
|
String userRole;
|
||||||
|
for (String param : params) {
|
||||||
|
userRole = param;
|
||||||
|
try {
|
||||||
|
deviceList = MDMServiceAPIUtils.getDeviceManagementService(tenantId).getAllDevices();
|
||||||
|
} catch (DeviceManagementException devMgtEx) {
|
||||||
|
String errorMsg = "Error occurred fetch device for user role " + userRole + devMgtEx
|
||||||
|
.getErrorMessage() + " " +
|
||||||
|
"at app installation";
|
||||||
|
log.error(errorMsg, devMgtEx);
|
||||||
|
}
|
||||||
|
for (org.wso2.carbon.device.mgt.common.Device device : deviceList) {
|
||||||
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
||||||
|
deviceIdentifier.setId(device.getDeviceIdentifier());
|
||||||
|
deviceIdentifier.setType(device.getType());
|
||||||
|
deviceIdentifiers.add(deviceIdentifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
deviceIdentifiers = new ArrayList<>();
|
||||||
|
DeviceIdentifier deviceIdentifier = null;
|
||||||
|
for (String param : params) {
|
||||||
|
deviceIdentifier = new DeviceIdentifier();
|
||||||
|
String[] paramDevices = param.split("---");
|
||||||
|
deviceIdentifier.setId(paramDevices[0]);
|
||||||
|
deviceIdentifier.setType(paramDevices[1]);
|
||||||
|
deviceIdentifiers.add(deviceIdentifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
MobileApp mobileApp = new MobileApp();
|
||||||
|
mobileApp.setId(app.getId());
|
||||||
|
mobileApp.setType(MobileAppTypes.valueOf(app.getType().toUpperCase()));
|
||||||
|
mobileApp.setAppIdentifier(app.getAppIdentifier());
|
||||||
|
mobileApp.setIconImage(app.getIconImage());
|
||||||
|
mobileApp.setIdentifier(app.getIdentifier());
|
||||||
|
mobileApp.setLocation(app.getLocation());
|
||||||
|
mobileApp.setName(app.getName());
|
||||||
|
mobileApp.setPackageName(app.getPackageName());
|
||||||
|
mobileApp.setPlatform(app.getPlatform());
|
||||||
|
mobileApp.setVersion(app.getVersion());
|
||||||
|
|
||||||
|
Properties properties = new Properties();
|
||||||
|
|
||||||
|
if ("ios".equals(app.getPlatform())) {
|
||||||
|
if ("enterprise".equals(app.getType())) {
|
||||||
|
properties.put("isRemoveApp", true);
|
||||||
|
properties.put("isPreventBackup", true);
|
||||||
|
} else if ("public".equals(app.getType())) {
|
||||||
|
properties.put("iTunesId", Integer.parseInt(app.getIdentifier().toString()));
|
||||||
|
properties.put("isRemoveApp", true);
|
||||||
|
properties.put("isPreventBackup", true);
|
||||||
|
} else if ("webapp".equals(app.getType())) {
|
||||||
|
properties.put("label", app.getName());
|
||||||
|
properties.put("isRemoveApp", true);
|
||||||
|
}
|
||||||
|
} else if ("webapp".equals(app.getPlatform())) {
|
||||||
|
properties.put("label", app.getName());
|
||||||
|
properties.put("isRemoveApp", true);
|
||||||
|
}
|
||||||
|
mobileApp.setProperties(properties);
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (deviceIdentifiers != null) {
|
||||||
|
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
|
||||||
|
if (deviceIdentifier.getType().equals(Platform.android.toString())) {
|
||||||
|
if ("install".equals(action)) {
|
||||||
|
operation = MDMAndroidOperationUtil.createInstallAppOperation(mobileApp);
|
||||||
|
} else {
|
||||||
|
operation = MDMAndroidOperationUtil.createAppUninstallOperation(mobileApp);
|
||||||
|
}
|
||||||
|
} else if (deviceIdentifier.getType().equals(Platform.ios.toString())) {
|
||||||
|
if ("install".equals(action)) {
|
||||||
|
operation = MDMIOSOperationUtil.createInstallAppOperation(mobileApp);
|
||||||
|
} else {
|
||||||
|
operation = MDMIOSOperationUtil.createAppUninstallOperation(mobileApp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MDMServiceAPIUtils.getAppManagementService(tenantId).installApplicationForDevices(operation,
|
||||||
|
deviceIdentifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (MDMException mdmExce) {
|
||||||
|
log.error("Error in creating operation object using app", mdmExce);
|
||||||
|
} catch (ApplicationManagementException appMgtExce) {
|
||||||
|
log.error("Error in app installation", appMgtExce);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
|
public List<Device> getDevices(User currentUser, int tenantId, String type, String[] params,
|
||||||
|
String platform,
|
||||||
|
String platformVersion, boolean isSampleDevicesEnabled,
|
||||||
|
HashMap<String, String> configProperties) {
|
||||||
|
|
||||||
|
List<Device> devices = new ArrayList<>();
|
||||||
|
Device device = null;
|
||||||
|
try {
|
||||||
|
List<org.wso2.carbon.device.mgt.common.Device> deviceList =
|
||||||
|
MDMServiceAPIUtils.getDeviceManagementService(tenantId).getAllDevices();
|
||||||
|
|
||||||
|
for (org.wso2.carbon.device.mgt.common.Device commondevice : deviceList) {
|
||||||
|
device = new Device();
|
||||||
|
device.setId(commondevice.getDeviceIdentifier() + "---" + commondevice.getType());
|
||||||
|
device.setName(commondevice.getName());
|
||||||
|
device.setModel(commondevice.getName());
|
||||||
|
device.setType("mobileDevice");
|
||||||
|
device.setImage("/store/extensions/assets/mobileapp/resources/models/none.png");
|
||||||
|
device.setPlatform(commondevice.getType());
|
||||||
|
devices.add(device);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (DeviceManagementException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>device-mgt-mdm</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<artifactId>org.wso2.mdm.mdmmgt</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxws</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-rt-transports-http</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-httpclient.wso2</groupId>
|
||||||
|
<artifactId>commons-httpclient</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.ws.rs</groupId>
|
||||||
|
<artifactId>jsr311-api</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.utils</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.policy.mgt.core</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.identity</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.identity.oauth.stub</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.code.gson</groupId>
|
||||||
|
<artifactId>gson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${project.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>MDM Management Components Bundle</Bundle-Description>
|
||||||
|
<Export-Package>
|
||||||
|
org.wso2.mdm.mdmmgt.*
|
||||||
|
</Export-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ApplicationWrapper {
|
||||||
|
|
||||||
|
private List<String> userNameList;
|
||||||
|
private List<String> roleNameList;
|
||||||
|
private List<DeviceIdentifier> deviceIdentifiers;
|
||||||
|
private MobileApp application;
|
||||||
|
|
||||||
|
public MobileApp getApplication() {
|
||||||
|
return application;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApplication(MobileApp application) {
|
||||||
|
this.application = application;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUserNameList() {
|
||||||
|
return userNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserNameList(List<String> userNameList) {
|
||||||
|
this.userNameList = userNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getRoleNameList() {
|
||||||
|
return roleNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleNameList(List<String> roleNameList) {
|
||||||
|
this.roleNameList = roleNameList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<DeviceIdentifier> getDeviceIdentifiers() {
|
||||||
|
return deviceIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceIdentifiers(List<DeviceIdentifier> deviceIdentifiers) {
|
||||||
|
this.deviceIdentifiers = deviceIdentifiers;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,128 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the generic mobile Application information
|
||||||
|
* which is used by AppM.
|
||||||
|
*/
|
||||||
|
public class MobileApp {
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
private String name;
|
||||||
|
private MobileAppTypes type;
|
||||||
|
private String platform;
|
||||||
|
private String version;
|
||||||
|
private String identifier;
|
||||||
|
private String iconImage;
|
||||||
|
private String packageName;
|
||||||
|
private String appIdentifier;
|
||||||
|
private String location;
|
||||||
|
private Properties properties;
|
||||||
|
|
||||||
|
public MobileAppTypes getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(MobileAppTypes type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVersion(String version) {
|
||||||
|
this.version = version;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIconImage() {
|
||||||
|
return iconImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIconImage(String iconImage) {
|
||||||
|
this.iconImage = iconImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPackageName() {
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageName(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppIdentifier() {
|
||||||
|
return appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppIdentifier(String appIdentifier) {
|
||||||
|
this.appIdentifier = appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Properties getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(Properties properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
public enum MobileAppTypes {
|
||||||
|
ENTERPRISE, WEBAPP, PUBLIC
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class PolicyWrapper {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private Profile profile;
|
||||||
|
private String policyName;
|
||||||
|
private String description;
|
||||||
|
private String compliance;
|
||||||
|
private List<String> roles;
|
||||||
|
private String ownershipType;
|
||||||
|
private List<Device> devices;
|
||||||
|
private List<String> users;
|
||||||
|
private int tenantId;
|
||||||
|
private int profileId;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Profile getProfile() {
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfile(Profile profile) {
|
||||||
|
this.profile = profile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompliance() {
|
||||||
|
return compliance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompliance(String compliance) {
|
||||||
|
this.compliance = compliance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPolicyName() {
|
||||||
|
return policyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPolicyName(String policyName) {
|
||||||
|
this.policyName = policyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getRoles() {
|
||||||
|
return roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(List<String> roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnershipType() {
|
||||||
|
return ownershipType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnershipType(String ownershipType) {
|
||||||
|
this.ownershipType = ownershipType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Device> getDevices() {
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDevices(List<Device> devices) {
|
||||||
|
this.devices = devices;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getUsers() {
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsers(List<String> users) {
|
||||||
|
this.users = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(int tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProfileId() {
|
||||||
|
return profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileId(int profileId) {
|
||||||
|
this.profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
public class PriorityUpdatedPolicyWrapper {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private int priority;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPriority(int priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@XmlRootElement
|
||||||
|
public class Profile {
|
||||||
|
|
||||||
|
private int profileId;
|
||||||
|
private String profileName;
|
||||||
|
private int tenantId;
|
||||||
|
private DeviceType deviceType;
|
||||||
|
private Timestamp createdDate;
|
||||||
|
private Timestamp updatedDate;
|
||||||
|
private List<ProfileFeature> profileFeaturesList; // Features included in the policies.
|
||||||
|
|
||||||
|
public DeviceType getDeviceType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceType(DeviceType deviceType) {
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public int getTenantId() {
|
||||||
|
return tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTenantId(int tenantId) {
|
||||||
|
this.tenantId = tenantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public List<Feature> getFeaturesList() {
|
||||||
|
return featuresList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeaturesList(List<Feature> featuresList) {
|
||||||
|
this.featuresList = featuresList;
|
||||||
|
}*/
|
||||||
|
@XmlElement
|
||||||
|
public int getProfileId() {
|
||||||
|
return profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileId(int profileId) {
|
||||||
|
this.profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public String getProfileName() {
|
||||||
|
return profileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileName(String profileName) {
|
||||||
|
this.profileName = profileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public Timestamp getCreatedDate() {
|
||||||
|
return createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreatedDate(Timestamp createdDate) {
|
||||||
|
this.createdDate = createdDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public Timestamp getUpdatedDate() {
|
||||||
|
return updatedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdatedDate(Timestamp updatedDate) {
|
||||||
|
this.updatedDate = updatedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public List<ProfileFeature> getProfileFeaturesList() {
|
||||||
|
return profileFeaturesList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileFeaturesList(List<ProfileFeature> profileFeaturesList) {
|
||||||
|
this.profileFeaturesList = profileFeaturesList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ProfileFeature implements Serializable {
|
||||||
|
|
||||||
|
private int id;
|
||||||
|
private String featureCode;
|
||||||
|
private int profileId;
|
||||||
|
private int deviceTypeId;
|
||||||
|
private Object content;
|
||||||
|
private String payLoad;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFeatureCode() {
|
||||||
|
return featureCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFeatureCode(String featureCode) {
|
||||||
|
this.featureCode = featureCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProfileId() {
|
||||||
|
return profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProfileId(int profileId) {
|
||||||
|
this.profileId = profileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDeviceTypeId() {
|
||||||
|
return deviceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceTypeId(int deviceTypeId) {
|
||||||
|
this.deviceTypeId = deviceTypeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getPayLoad() {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
this.payLoad = gson.toJson(content);
|
||||||
|
return payLoad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPayLoad(String payLoad) {
|
||||||
|
this.payLoad = payLoad;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Object getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(Object content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
import org.wso2.carbon.user.mgt.common.UIPermissionNode;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
public class RoleWrapper {
|
||||||
|
private String roleName;
|
||||||
|
private String[] permissions;
|
||||||
|
private String[] users;
|
||||||
|
private UIPermissionNode permissionList;
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getPermissions() {
|
||||||
|
return permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissions(String[] permissions) {
|
||||||
|
this.permissions = permissions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getUsers() {
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsers(String[] users) {
|
||||||
|
this.users = users;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UIPermissionNode getPermissionList() {
|
||||||
|
return permissionList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPermissionList(UIPermissionNode permissionList) {
|
||||||
|
this.permissionList = permissionList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
public class UserCredentialWrapper {
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
/*
|
||||||
|
Base64 encoded password
|
||||||
|
*/
|
||||||
|
private String oldPassword;
|
||||||
|
private String newPassword;
|
||||||
|
|
||||||
|
public String getNewPassword() {
|
||||||
|
return newPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNewPassword(String newPassword) {
|
||||||
|
this.newPassword = newPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOldPassword() {
|
||||||
|
return oldPassword;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOldPassword(String oldPassword) {
|
||||||
|
this.oldPassword = oldPassword;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.beans;
|
||||||
|
|
||||||
|
public class UserWrapper {
|
||||||
|
|
||||||
|
private String username;
|
||||||
|
/*
|
||||||
|
Base64 encoded password
|
||||||
|
*/
|
||||||
|
private String password;
|
||||||
|
private String firstname;
|
||||||
|
private String lastname;
|
||||||
|
private String emailAddress;
|
||||||
|
private String[] roles;
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstname() {
|
||||||
|
return firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstname(String firstname) {
|
||||||
|
this.firstname = firstname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLastname() {
|
||||||
|
return lastname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastname(String lastname) {
|
||||||
|
this.lastname = lastname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmailAddress() {
|
||||||
|
return emailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEmailAddress(String emailAddress) {
|
||||||
|
this.emailAddress = emailAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Giving a clone of the array since arrays are mutable
|
||||||
|
*/
|
||||||
|
public String[] getRoles() {
|
||||||
|
String[] copiedRoles = roles;
|
||||||
|
if (roles != null) {
|
||||||
|
copiedRoles = roles.clone();
|
||||||
|
}
|
||||||
|
return copiedRoles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoles(String[] roles) {
|
||||||
|
this.roles = roles;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans.android;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the Appstore Application information.
|
||||||
|
*/
|
||||||
|
public class AppStoreApplication implements Serializable {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
private String appIdentifier;
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAppIdentifier() {
|
||||||
|
return appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppIdentifier(String appIdentifier) {
|
||||||
|
this.appIdentifier = appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans.android;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the Enterprise Application information.
|
||||||
|
*/
|
||||||
|
public class EnterpriseApplication implements Serializable {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
private String url;
|
||||||
|
private String appIdentifier;
|
||||||
|
|
||||||
|
public String getAppIdentifier() {
|
||||||
|
return appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppIdentifier(String appIdentifier) {
|
||||||
|
this.appIdentifier = appIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans.android;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the Web Application information.
|
||||||
|
*/
|
||||||
|
public class WebApplication implements Serializable {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String url;
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans.ios;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class AppStoreApplication implements Serializable {
|
||||||
|
|
||||||
|
private String identifier;
|
||||||
|
private int iTunesStoreID;
|
||||||
|
private boolean removeAppUponMDMProfileRemoval;
|
||||||
|
private boolean preventBackupOfAppData;
|
||||||
|
private String bundleId;
|
||||||
|
private String UUID;
|
||||||
|
|
||||||
|
public String getUUID() {
|
||||||
|
return UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUUID(String UUID) {
|
||||||
|
this.UUID = UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getiTunesStoreID() {
|
||||||
|
return iTunesStoreID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setiTunesStoreID(int iTunesStoreID) {
|
||||||
|
this.iTunesStoreID = iTunesStoreID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveAppUponMDMProfileRemoval() {
|
||||||
|
return removeAppUponMDMProfileRemoval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoveAppUponMDMProfileRemoval(boolean removeAppUponMDMProfileRemoval) {
|
||||||
|
this.removeAppUponMDMProfileRemoval = removeAppUponMDMProfileRemoval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPreventBackupOfAppData() {
|
||||||
|
return preventBackupOfAppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreventBackupOfAppData(boolean preventBackupOfAppData) {
|
||||||
|
this.preventBackupOfAppData = preventBackupOfAppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBundleId() {
|
||||||
|
return bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBundleId(String bundleId) {
|
||||||
|
this.bundleId = bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.beans.ios;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class EnterpriseApplication implements Serializable {
|
||||||
|
|
||||||
|
private String identifier;
|
||||||
|
private String manifestURL;
|
||||||
|
private boolean removeAppUponMDMProfileRemoval;
|
||||||
|
private boolean preventBackupOfAppData;
|
||||||
|
private String bundleId;
|
||||||
|
private String UUID;
|
||||||
|
|
||||||
|
public void setUUID(String UUID) {
|
||||||
|
this.UUID = UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIdentifier() {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIdentifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getManifestURL() {
|
||||||
|
return manifestURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setManifestURL(String manifestURL) {
|
||||||
|
this.manifestURL = manifestURL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRemoveAppUponMDMProfileRemoval() {
|
||||||
|
return removeAppUponMDMProfileRemoval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemoveAppUponMDMProfileRemoval(boolean removeAppUponMDMProfileRemoval) {
|
||||||
|
this.removeAppUponMDMProfileRemoval = removeAppUponMDMProfileRemoval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPreventBackupOfAppData() {
|
||||||
|
return preventBackupOfAppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPreventBackupOfAppData(boolean preventBackupOfAppData) {
|
||||||
|
this.preventBackupOfAppData = preventBackupOfAppData;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBundleId() {
|
||||||
|
return bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBundleId(String bundleId) {
|
||||||
|
this.bundleId = bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
package org.wso2.mdm.mdmmgt.beans.ios;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RemoveApplication implements Serializable {
|
||||||
|
|
||||||
|
private String bundleId;
|
||||||
|
|
||||||
|
public String getBundleId() {
|
||||||
|
return bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBundleId(String bundleId) {
|
||||||
|
this.bundleId = bundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,59 @@
|
|||||||
|
package org.wso2.mdm.mdmmgt.beans.ios;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
public class WebClip {
|
||||||
|
|
||||||
|
private String URL;
|
||||||
|
private String label;
|
||||||
|
private String icon;
|
||||||
|
private String isRemovable;
|
||||||
|
private String UUID;
|
||||||
|
|
||||||
|
public String getUUID() {
|
||||||
|
return UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUUID(String UUID) {
|
||||||
|
this.UUID = UUID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getURL() {
|
||||||
|
return URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setURL(String URL) {
|
||||||
|
this.URL = URL;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLabel() {
|
||||||
|
return label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLabel(String label) {
|
||||||
|
this.label = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIcon() {
|
||||||
|
return icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIcon(String icon) {
|
||||||
|
this.icon = icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIsRemovable() {
|
||||||
|
return isRemovable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsRemovable(String isRemovable) {
|
||||||
|
this.isRemovable = isRemovable;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toJSON() throws MDMException {
|
||||||
|
Gson gson = new Gson();
|
||||||
|
return gson.toJson(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,36 @@
|
|||||||
|
package org.wso2.mdm.mdmmgt.common;
|
||||||
|
|
||||||
|
|
||||||
|
public class MDMException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5136875495185597926L;
|
||||||
|
private String errorMessage;
|
||||||
|
|
||||||
|
|
||||||
|
public MDMException(String msg, Exception e) {
|
||||||
|
super(msg, e);
|
||||||
|
setErrorMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MDMException(String msg, Throwable cause) {
|
||||||
|
super(msg, cause);
|
||||||
|
setErrorMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MDMException(String msg) {
|
||||||
|
super(msg);
|
||||||
|
setErrorMessage(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MDMException() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public MDMException(Throwable cause) {
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setErrorMessage(String errorMessage) {
|
||||||
|
this.errorMessage = errorMessage;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,114 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.util;
|
||||||
|
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||||
|
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.MobileApp;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.android.AppStoreApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.android.EnterpriseApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.android.WebApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the all the operations related to Android.
|
||||||
|
*/
|
||||||
|
public class MDMAndroidOperationUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to create Install Application operation.
|
||||||
|
*
|
||||||
|
* @param application MobileApp application
|
||||||
|
* @return operation
|
||||||
|
* @throws MDMException
|
||||||
|
*/
|
||||||
|
public static Operation createInstallAppOperation(MobileApp application) throws MDMException {
|
||||||
|
|
||||||
|
ProfileOperation operation = new ProfileOperation();
|
||||||
|
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_INSTALL_APPLICATION);
|
||||||
|
operation.setType(Operation.Type.PROFILE);
|
||||||
|
|
||||||
|
switch (application.getType()) {
|
||||||
|
case ENTERPRISE:
|
||||||
|
EnterpriseApplication enterpriseApplication = new EnterpriseApplication();
|
||||||
|
enterpriseApplication.setType(application.getType().toString());
|
||||||
|
enterpriseApplication.setUrl(application.getLocation());
|
||||||
|
operation.setPayLoad(enterpriseApplication.toJSON());
|
||||||
|
break;
|
||||||
|
case PUBLIC:
|
||||||
|
AppStoreApplication appStoreApplication = new AppStoreApplication();
|
||||||
|
appStoreApplication.setType(application.getType().toString());
|
||||||
|
appStoreApplication.setAppIdentifier(application.getIdentifier());
|
||||||
|
operation.setPayLoad(appStoreApplication.toJSON());
|
||||||
|
break;
|
||||||
|
case WEBAPP:
|
||||||
|
WebApplication webApplication = new WebApplication();
|
||||||
|
webApplication.setUrl(application.getLocation());
|
||||||
|
webApplication.setName(application.getName());
|
||||||
|
webApplication.setType(application.getType().toString());
|
||||||
|
operation.setPayLoad(webApplication.toJSON());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
String errorMessage = "Invalid application type.";
|
||||||
|
throw new MDMException(errorMessage);
|
||||||
|
}
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to create Uninstall Application operation.
|
||||||
|
*
|
||||||
|
* @param application MobileApp application
|
||||||
|
* @return operation
|
||||||
|
* @throws MDMException
|
||||||
|
*/
|
||||||
|
public static Operation createAppUninstallOperation(MobileApp application) throws MDMException {
|
||||||
|
|
||||||
|
ProfileOperation operation = new ProfileOperation();
|
||||||
|
operation.setCode(MDMAppConstants.AndroidConstants.OPCODE_UNINSTALL_APPLICATION);
|
||||||
|
operation.setType(Operation.Type.PROFILE);
|
||||||
|
|
||||||
|
switch (application.getType()) {
|
||||||
|
case ENTERPRISE:
|
||||||
|
EnterpriseApplication enterpriseApplication = new EnterpriseApplication();
|
||||||
|
enterpriseApplication.setType(application.getType().toString());
|
||||||
|
enterpriseApplication.setAppIdentifier(application.getIdentifier());
|
||||||
|
operation.setPayLoad(enterpriseApplication.toJSON());
|
||||||
|
break;
|
||||||
|
case PUBLIC:
|
||||||
|
AppStoreApplication appStoreApplication = new AppStoreApplication();
|
||||||
|
appStoreApplication.setType(application.getType().toString());
|
||||||
|
appStoreApplication.setAppIdentifier(application.getIdentifier());
|
||||||
|
operation.setPayLoad(appStoreApplication.toJSON());
|
||||||
|
break;
|
||||||
|
case WEBAPP:
|
||||||
|
WebApplication webApplication = new WebApplication();
|
||||||
|
webApplication.setUrl(application.getLocation());
|
||||||
|
webApplication.setName(application.getName());
|
||||||
|
webApplication.setType(application.getType().toString());
|
||||||
|
operation.setPayLoad(webApplication.toJSON());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
String errorMessage = "Invalid application type.";
|
||||||
|
throw new MDMException(errorMessage);
|
||||||
|
}
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds all the constants used for IOS and Android.
|
||||||
|
*/
|
||||||
|
public class MDMAppConstants {
|
||||||
|
|
||||||
|
public class IOSConstants {
|
||||||
|
|
||||||
|
public static final String IS_REMOVE_APP = "isRemoveApp";
|
||||||
|
public static final String IS_PREVENT_BACKUP = "isPreventBackup";
|
||||||
|
public static final String I_TUNES_ID = "iTunesId";
|
||||||
|
public static final String LABEL = "label";
|
||||||
|
public static final String OPCODE_INSTALL_ENTERPRISE_APPLICATION = "INSTALL_ENTERPRISE_APPLICATION";
|
||||||
|
public static final String OPCODE_INSTALL_STORE_APPLICATION = "INSTALL_STORE_APPLICATION";
|
||||||
|
public static final String OPCODE_INSTALL_WEB_APPLICATION = "WEB_CLIP";
|
||||||
|
public static final String OPCODE_REMOVE_APPLICATION = "REMOVE_APPLICATION";
|
||||||
|
|
||||||
|
private IOSConstants() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class AndroidConstants {
|
||||||
|
|
||||||
|
public static final String OPCODE_INSTALL_APPLICATION = "INSTALL_APPLICATION";
|
||||||
|
public static final String OPCODE_UNINSTALL_APPLICATION = "UNINSTALL_APPLICATION";
|
||||||
|
|
||||||
|
private AndroidConstants() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RegistryConstants {
|
||||||
|
|
||||||
|
public static final String GENERAL_CONFIG_RESOURCE_PATH = "general";
|
||||||
|
|
||||||
|
private RegistryConstants() {
|
||||||
|
throw new AssertionError();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class APPManagerConstants {
|
||||||
|
|
||||||
|
private static final String APP_MANAGER_MDM_SERVICE_NAME = "org.wso2.carbon.appmgt.mobile.interfaces.MDMOperations";
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,105 @@
|
|||||||
|
/*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.mdm.mdmmgt.util;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||||
|
import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.MobileApp;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.ios.AppStoreApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.ios.EnterpriseApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.ios.RemoveApplication;
|
||||||
|
import org.wso2.mdm.mdmmgt.beans.ios.WebClip;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class contains the all the operations related to IOS.
|
||||||
|
*/
|
||||||
|
public class MDMIOSOperationUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to create Install Application operation.
|
||||||
|
*
|
||||||
|
* @param application MobileApp application
|
||||||
|
* @return operation
|
||||||
|
* @throws MDMException
|
||||||
|
*/
|
||||||
|
public static Operation createInstallAppOperation(MobileApp application) throws MDMException {
|
||||||
|
|
||||||
|
ProfileOperation operation = new ProfileOperation();
|
||||||
|
|
||||||
|
switch (application.getType()) {
|
||||||
|
case ENTERPRISE:
|
||||||
|
EnterpriseApplication enterpriseApplication = new EnterpriseApplication();
|
||||||
|
enterpriseApplication.setBundleId(application.getId());
|
||||||
|
enterpriseApplication.setIdentifier(application.getIdentifier());
|
||||||
|
enterpriseApplication.setManifestURL(application.getLocation());
|
||||||
|
|
||||||
|
Properties properties = application.getProperties();
|
||||||
|
enterpriseApplication.setPreventBackupOfAppData((Boolean) properties.
|
||||||
|
get(MDMAppConstants.IOSConstants.IS_PREVENT_BACKUP));
|
||||||
|
enterpriseApplication.setRemoveAppUponMDMProfileRemoval((Boolean) properties.
|
||||||
|
get(MDMAppConstants.IOSConstants.IS_REMOVE_APP));
|
||||||
|
operation.setCode(MDMAppConstants.IOSConstants.OPCODE_INSTALL_ENTERPRISE_APPLICATION);
|
||||||
|
operation.setPayLoad(enterpriseApplication.toJSON());
|
||||||
|
operation.setType(Operation.Type.COMMAND);
|
||||||
|
break;
|
||||||
|
case PUBLIC:
|
||||||
|
AppStoreApplication appStoreApplication = new AppStoreApplication();
|
||||||
|
appStoreApplication.setRemoveAppUponMDMProfileRemoval((Boolean) application.getProperties().
|
||||||
|
get(MDMAppConstants.IOSConstants.IS_REMOVE_APP));
|
||||||
|
appStoreApplication.setIdentifier(application.getIdentifier());
|
||||||
|
appStoreApplication.setPreventBackupOfAppData((Boolean) application.getProperties().
|
||||||
|
get(MDMAppConstants.IOSConstants.IS_PREVENT_BACKUP));
|
||||||
|
appStoreApplication.setBundleId(application.getId());
|
||||||
|
appStoreApplication.setiTunesStoreID((Integer) application.getProperties().
|
||||||
|
get(MDMAppConstants.IOSConstants.I_TUNES_ID));
|
||||||
|
operation.setCode(MDMAppConstants.IOSConstants.OPCODE_INSTALL_STORE_APPLICATION);
|
||||||
|
operation.setType(Operation.Type.COMMAND);
|
||||||
|
operation.setPayLoad(appStoreApplication.toJSON());
|
||||||
|
break;
|
||||||
|
case WEBAPP:
|
||||||
|
WebClip webClip = new WebClip();
|
||||||
|
webClip.setIcon(application.getIconImage());
|
||||||
|
webClip.setIsRemovable(application.getProperties().
|
||||||
|
getProperty(MDMAppConstants.IOSConstants.IS_REMOVE_APP));
|
||||||
|
webClip.setLabel(application.getProperties().
|
||||||
|
getProperty(MDMAppConstants.IOSConstants.LABEL));
|
||||||
|
webClip.setURL(application.getLocation());
|
||||||
|
|
||||||
|
operation.setCode(MDMAppConstants.IOSConstants.OPCODE_INSTALL_WEB_APPLICATION);
|
||||||
|
operation.setType(Operation.Type.PROFILE);
|
||||||
|
operation.setPayLoad(webClip.toJSON());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Operation createAppUninstallOperation(MobileApp application) throws MDMException {
|
||||||
|
|
||||||
|
ProfileOperation operation = new ProfileOperation();
|
||||||
|
operation.setCode(MDMAppConstants.IOSConstants.OPCODE_REMOVE_APPLICATION);
|
||||||
|
operation.setType(Operation.Type.PROFILE);
|
||||||
|
|
||||||
|
RemoveApplication removeApplication = new RemoveApplication();
|
||||||
|
removeApplication.setBundleId(application.getIdentifier());
|
||||||
|
operation.setPayLoad(removeApplication.toJSON());
|
||||||
|
|
||||||
|
return operation;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,226 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.mdm.mdmmgt.util;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.CarbonContext;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
||||||
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.TenantConfigurationManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.common.notification.mgt.NotificationManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementProviderService;
|
||||||
|
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
|
||||||
|
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
|
||||||
|
import org.wso2.carbon.user.api.AuthorizationManager;
|
||||||
|
import org.wso2.carbon.user.api.UserRealm;
|
||||||
|
import org.wso2.carbon.user.api.UserStoreException;
|
||||||
|
import org.wso2.carbon.user.api.UserStoreManager;
|
||||||
|
import org.wso2.carbon.user.core.service.RealmService;
|
||||||
|
import org.wso2.carbon.utils.multitenancy.MultitenantConstants;
|
||||||
|
import org.wso2.mdm.mdmmgt.common.MDMException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MDMServiceAPIUtils class provides utility function.
|
||||||
|
*/
|
||||||
|
public class MDMServiceAPIUtils {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(MDMServiceAPIUtils.class);
|
||||||
|
|
||||||
|
public static DeviceManagementProviderService getDeviceManagementService(int tenantId) {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
DeviceManagementProviderService deviceManagementProviderService =
|
||||||
|
(DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null);
|
||||||
|
if (deviceManagementProviderService == null) {
|
||||||
|
String msg = "Device Management provider service has not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
return deviceManagementProviderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int getTenantId(String tenantDomain) throws MDMException {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
|
||||||
|
try {
|
||||||
|
return realmService.getTenantManager().getTenantId(tenantDomain);
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
throw new MDMException(
|
||||||
|
"Error obtaining tenant id from tenant domain " + tenantDomain);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static UserStoreManager getUserStoreManager(int tenantId) throws MDMException {
|
||||||
|
RealmService realmService;
|
||||||
|
UserStoreManager userStoreManager;
|
||||||
|
try {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
|
||||||
|
if (realmService == null) {
|
||||||
|
String msg = "Realm service has not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager();
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
String msg = "Error occurred while retrieving current user store manager";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MDMException(msg, e);
|
||||||
|
}
|
||||||
|
return userStoreManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getting the current tenant's user realm
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws org.wso2.mdm.mdmmgt.common.MDMException
|
||||||
|
*/
|
||||||
|
public static UserRealm getUserRealm(int tenantId) throws MDMException {
|
||||||
|
RealmService realmService;
|
||||||
|
UserRealm realm;
|
||||||
|
try {
|
||||||
|
PrivilegedCarbonContext.startTenantFlow();
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
ctx.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
|
||||||
|
ctx.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
|
||||||
|
realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
|
||||||
|
|
||||||
|
if (realmService == null) {
|
||||||
|
String msg = "Realm service not initialized";
|
||||||
|
log.error(msg);
|
||||||
|
throw new MDMException(msg);
|
||||||
|
}
|
||||||
|
realm = realmService.getTenantUserRealm(tenantId);
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
String msg = "Error occurred while retrieving current user realm";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MDMException(msg, e);
|
||||||
|
} finally {
|
||||||
|
PrivilegedCarbonContext.endTenantFlow();
|
||||||
|
}
|
||||||
|
return realm;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AuthorizationManager getAuthorizationManager(int tenantId) throws MDMException {
|
||||||
|
RealmService realmService;
|
||||||
|
AuthorizationManager authorizationManager;
|
||||||
|
try {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
|
||||||
|
if (realmService == null) {
|
||||||
|
String msg = "Realm service has not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
authorizationManager = realmService.getTenantUserRealm(tenantId).getAuthorizationManager();
|
||||||
|
} catch (UserStoreException e) {
|
||||||
|
String msg = "Error occurred while retrieving current Authorization manager.";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MDMException(msg, e);
|
||||||
|
}
|
||||||
|
return authorizationManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to get the current tenant id.
|
||||||
|
*
|
||||||
|
* @return returns the tenant id.
|
||||||
|
*/
|
||||||
|
public static int getTenantId() {
|
||||||
|
return CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeviceIdentifier instantiateDeviceIdentifier(String deviceType, String deviceId) {
|
||||||
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
||||||
|
deviceIdentifier.setType(deviceType);
|
||||||
|
deviceIdentifier.setId(deviceId);
|
||||||
|
return deviceIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ApplicationManagementProviderService getAppManagementService(int tenantId) {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
ApplicationManagementProviderService applicationManagementProviderService =
|
||||||
|
(ApplicationManagementProviderService) ctx.getOSGiService(ApplicationManagementProviderService.class, null);
|
||||||
|
if (applicationManagementProviderService == null) {
|
||||||
|
String msg = "Application management service has not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
return applicationManagementProviderService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PolicyManagerService getPolicyManagementService(int tenantId) {
|
||||||
|
PolicyManagerService policyManagementService;
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
ctx.setTenantId(tenantId, true);
|
||||||
|
policyManagementService =
|
||||||
|
(PolicyManagerService) ctx.getOSGiService(PolicyManagerService.class, null);
|
||||||
|
if (policyManagementService == null) {
|
||||||
|
String msg = "Policy Management service not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
return policyManagementService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TenantConfigurationManagementService getTenantConfigurationManagementService() {
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
TenantConfigurationManagementService tenantConfigurationManagementService =
|
||||||
|
(TenantConfigurationManagementService) ctx.getOSGiService(TenantConfigurationManagementService.class, null);
|
||||||
|
if (tenantConfigurationManagementService == null) {
|
||||||
|
String msg = "Tenant configuration Management service not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
return tenantConfigurationManagementService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static NotificationManagementService getNotificationManagementService() {
|
||||||
|
NotificationManagementService notificationManagementService;
|
||||||
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
notificationManagementService = (NotificationManagementService) ctx.getOSGiService(
|
||||||
|
NotificationManagementService.class, null);
|
||||||
|
if (notificationManagementService == null) {
|
||||||
|
String msg = "Notification Management service not initialized.";
|
||||||
|
log.error(msg);
|
||||||
|
throw new IllegalStateException(msg);
|
||||||
|
}
|
||||||
|
return notificationManagementService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PaginationResult getPagingResponse(int recordsTotal, int recordsFiltered,
|
||||||
|
int draw, List<?> data) {
|
||||||
|
PaginationResult pagingResponse = new PaginationResult();
|
||||||
|
pagingResponse.setRecordsTotal(recordsTotal);
|
||||||
|
pagingResponse.setRecordsFiltered(recordsFiltered);
|
||||||
|
pagingResponse.setDraw(draw);
|
||||||
|
pagingResponse.setData(data);
|
||||||
|
return pagingResponse;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package main.java.org.wso2.mdm.mdmmgt.util;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement
|
||||||
|
public class ResponsePayload {
|
||||||
|
|
||||||
|
private int statusCode;
|
||||||
|
private String messageFromServer;
|
||||||
|
private Object responseContent;
|
||||||
|
|
||||||
|
public static ResponsePayloadBuilder statusCode(int statusCode) {
|
||||||
|
ResponsePayload message = new ResponsePayload();
|
||||||
|
return message.getBuilder().statusCode(statusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResponsePayloadBuilder messageFromServer(String messageFromServer) {
|
||||||
|
ResponsePayload message = new ResponsePayload();
|
||||||
|
return message.getBuilder().messageFromServer(messageFromServer);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ResponsePayloadBuilder responseContent(String responseContent) {
|
||||||
|
ResponsePayload message = new ResponsePayload();
|
||||||
|
return message.getBuilder().responseContent(responseContent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public String getMessageFromServer() {
|
||||||
|
return messageFromServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMessageFromServer(String messageFromServer) {
|
||||||
|
this.messageFromServer = messageFromServer;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement
|
||||||
|
public Object getResponseContent() {
|
||||||
|
return responseContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResponseContent(Object responseContent) {
|
||||||
|
this.responseContent = responseContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ResponsePayloadBuilder getBuilder() {
|
||||||
|
return new ResponsePayloadBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ResponsePayloadBuilder {
|
||||||
|
|
||||||
|
private int statusCode;
|
||||||
|
private String messageFromServer;
|
||||||
|
private Object responseContent;
|
||||||
|
|
||||||
|
public ResponsePayloadBuilder statusCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponsePayloadBuilder messageFromServer(String messageFromServer) {
|
||||||
|
this.messageFromServer = messageFromServer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponsePayloadBuilder responseContent(String responseContent) {
|
||||||
|
this.responseContent = responseContent;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ResponsePayload build() {
|
||||||
|
ResponsePayload payload = new ResponsePayload();
|
||||||
|
payload.setStatusCode(statusCode);
|
||||||
|
payload.setMessageFromServer(messageFromServer);
|
||||||
|
payload.setResponseContent(responseContent);
|
||||||
|
return payload;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,107 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>device-mgt-mdm-feature</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>org.wso2.mdm.mdmmgt.server.feature</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>src/main/resources</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>build.properties</include>
|
||||||
|
<include>p2.inf</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wso2.maven</groupId>
|
||||||
|
<artifactId>carbon-p2-plugin</artifactId>
|
||||||
|
<version>${carbon.p2.plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>p2-feature-generation</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>p2-feature-gen</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<id>org.wso2.mdm.mdmmgt.server</id>
|
||||||
|
<propertiesFile>../../../features/etc/feature.properties
|
||||||
|
</propertiesFile>
|
||||||
|
<adviceFile>
|
||||||
|
<properties>
|
||||||
|
<propertyDef>org.wso2.carbon.p2.category.type:server
|
||||||
|
</propertyDef>
|
||||||
|
<propertyDef>org.eclipse.equinox.p2.type.group:false
|
||||||
|
</propertyDef>
|
||||||
|
</properties>
|
||||||
|
</adviceFile>
|
||||||
|
<bundles>
|
||||||
|
<bundleDef>
|
||||||
|
org.wso2.carbon.devicemgt-plugins:org.wso2.mdm.mdmmgt:${project.version}
|
||||||
|
</bundleDef>
|
||||||
|
<bundleDef>
|
||||||
|
org.wso2.carbon.devicemgt-plugins:org.wso2.mdm.appmgt:${project.version}
|
||||||
|
</bundleDef>
|
||||||
|
</bundles>
|
||||||
|
<importFeatures>
|
||||||
|
<importFeatureDef>
|
||||||
|
org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
<importFeatureDef>
|
||||||
|
org.wso2.carbon.apimgt.core:${carbon.api.mgt.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
<importFeatureDef>
|
||||||
|
org.wso2.carbon.device.mgt.extensions:${carbon.device.mgt.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
</importFeatures>
|
||||||
|
<importBundles>
|
||||||
|
<importBundleDef>com.google.code.gson:gson:${google.gson.version}
|
||||||
|
</importBundleDef>
|
||||||
|
<importBundleDef>
|
||||||
|
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.common:compatible:${carbon.device.mgt.version}
|
||||||
|
</importBundleDef>
|
||||||
|
<importBundleDef>
|
||||||
|
org.wso2.carbon.devicemgt:org.wso2.carbon.device.mgt.core:compatible:${carbon.device.mgt.version}
|
||||||
|
</importBundleDef>
|
||||||
|
<importBundleDef>
|
||||||
|
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.core:compatible:${carbon.device.mgt.version}
|
||||||
|
</importBundleDef>
|
||||||
|
<importBundleDef>
|
||||||
|
org.wso2.carbon.appmgt:org.wso2.carbon.appmgt.mobile:compatible:${appmgt.feature.version}
|
||||||
|
</importBundleDef>
|
||||||
|
</importBundles>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1 @@
|
|||||||
|
custom = true
|
@ -0,0 +1 @@
|
|||||||
|
instructions.configure = \
|
Loading…
Reference in new issue