forked from community/device-mgt-plugins
parent
4a384498f2
commit
028241f518
@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This represents the iOS implementation of DeviceManagerService.
|
||||
*/
|
||||
public class IOSDeviceManager implements DeviceManager {
|
||||
|
||||
private static final Log log = LogFactory.getLog(IOSDeviceManager.class);
|
||||
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
|
||||
private IOSFeatureManager iosFeatureManager;
|
||||
|
||||
@Override
|
||||
public String getProviderType() {
|
||||
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
|
||||
}
|
||||
|
||||
public IOSDeviceManager() {
|
||||
mobileDeviceManagementDAOFactory = new IOSDAOFactory();
|
||||
iosFeatureManager = new IOSFeatureManager();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FeatureManager getFeatureManager() {
|
||||
return iosFeatureManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
||||
boolean status;
|
||||
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
||||
try {
|
||||
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
|
||||
mobileDevice);
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
String msg = "Error while enrolling the iOS device : " +
|
||||
device.getDeviceIdentifier();
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
||||
boolean status;
|
||||
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Modifying the iOS device enrollment data");
|
||||
}
|
||||
status = mobileDeviceManagementDAOFactory.getMobileDeviceDAO()
|
||||
.updateMobileDevice(mobileDevice);
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
String msg = "Error while updating the enrollment of the iOS device : " +
|
||||
device.getDeviceIdentifier();
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
boolean isEnrolled = false;
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Checking the enrollment of iOS device : " + deviceId.getId());
|
||||
}
|
||||
MobileDevice mobileDevice =
|
||||
mobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice(
|
||||
deviceId.getId());
|
||||
if (mobileDevice != null) {
|
||||
isEnrolled = true;
|
||||
}
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
String msg = "Error while checking the enrollment status of iOS device : " +
|
||||
deviceId.getId();
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
return isEnrolled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setActive(DeviceIdentifier deviceId, boolean status)
|
||||
throws DeviceManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Device> getAllDevices() throws DeviceManagementException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||
Device device;
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Getting the details of iOS device : " + deviceId.getId());
|
||||
}
|
||||
MobileDevice mobileDevice = mobileDeviceManagementDAOFactory.getMobileDeviceDAO().
|
||||
getMobileDevice(deviceId.getId());
|
||||
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
String msg = "Error while fetching the iOS device : " + deviceId.getId();
|
||||
log.error(msg, e);
|
||||
throw new DeviceManagementException(msg, e);
|
||||
}
|
||||
return device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
|
||||
throws DeviceManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.IOSDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class IOSFeatureManager implements FeatureManager {
|
||||
|
||||
private static final Log log = LogFactory.getLog(IOSFeatureManager.class);
|
||||
private MobileDeviceManagementDAOFactory mobileDeviceManagementDAOFactory;
|
||||
|
||||
private MobileFeatureDAO featureDAO;
|
||||
|
||||
public IOSFeatureManager() {
|
||||
mobileDeviceManagementDAOFactory = new IOSDAOFactory();
|
||||
this.featureDAO = mobileDeviceManagementDAOFactory.getMobileFeatureDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addFeature(Feature feature) throws DeviceManagementException {
|
||||
try {
|
||||
mobileDeviceManagementDAOFactory.beginTransaction();
|
||||
MobileFeature mobileFeature = MobileDeviceManagementUtil.convertToMobileFeature(feature);
|
||||
|
||||
try {
|
||||
featureDAO.addFeature(mobileFeature);
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
log.error("error in feature add ", e);
|
||||
throw new DeviceManagementException("error in feature add", e);
|
||||
}
|
||||
mobileDeviceManagementDAOFactory.commitTransaction();
|
||||
return true;
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
try {
|
||||
mobileDeviceManagementDAOFactory.rollbackTransaction();
|
||||
} catch (MobileDeviceManagementDAOException e1) {
|
||||
log.warn("Error occurred while roll-backing the transaction", e);
|
||||
}
|
||||
throw new DeviceManagementException("DB transaction error occurred while add the feature", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feature getFeature(String code) throws DeviceManagementException {
|
||||
try {
|
||||
MobileFeature mobileFeature = featureDAO.getFeatureByCode(code);
|
||||
Feature feature = MobileDeviceManagementUtil.convertToFeature(mobileFeature);
|
||||
return feature;
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
throw new DeviceManagementException("Error occurred while retrieving the feature", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getFeatures() throws DeviceManagementException {
|
||||
|
||||
List<Feature> featureList = new ArrayList<Feature>();
|
||||
try {
|
||||
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
|
||||
|
||||
for (MobileFeature mobileFeature : mobileFeatures) {
|
||||
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
|
||||
}
|
||||
return featureList;
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
throw new DeviceManagementException("Error occurred while retrieving the list of features registered " +
|
||||
"for Android platform", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFeature(String name) throws DeviceManagementException {
|
||||
try {
|
||||
mobileDeviceManagementDAOFactory.beginTransaction();
|
||||
featureDAO.deleteFeatureByCode(name);
|
||||
mobileDeviceManagementDAOFactory.commitTransaction();
|
||||
return true;
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
try {
|
||||
mobileDeviceManagementDAOFactory.rollbackTransaction();
|
||||
} catch (MobileDeviceManagementDAOException e1) {
|
||||
log.warn("Error occurred while roll-backing the transaction", e);
|
||||
}
|
||||
throw new DeviceManagementException("Error occurred while removing the feature", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
|
||||
public class FeatureManagementDAOException extends MobileDeviceManagementDAOException {
|
||||
|
||||
private String message;
|
||||
private static final long serialVersionUID = 2021891706072918865L;
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message and
|
||||
* nested exception.
|
||||
*
|
||||
* @param message error message
|
||||
* @param nestedException exception
|
||||
*/
|
||||
public FeatureManagementDAOException(String message, Exception nestedException) {
|
||||
super(message, nestedException);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message
|
||||
* and cause.
|
||||
*
|
||||
* @param message the detail message.
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public FeatureManagementDAOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message.
|
||||
*
|
||||
* @param message the detail message.
|
||||
*/
|
||||
public FeatureManagementDAOException(String message) {
|
||||
super(message);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified and cause.
|
||||
*
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public FeatureManagementDAOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.message = errorMessage;
|
||||
}
|
||||
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.dao;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.*;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl.FeatureDAOImpl;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl.IOSDeviceDAOImpl;
|
||||
|
||||
public class IOSDAOFactory extends MobileDeviceManagementDAOFactory {
|
||||
|
||||
private static final Log log = LogFactory.getLog(IOSDAOFactory.class);
|
||||
|
||||
public static void init(MobileDataSourceConfig config) {
|
||||
dataSource = resolveDataSource(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileDeviceDAO getMobileDeviceDAO() {
|
||||
return new IOSDeviceDAOImpl(dataSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileOperationDAO getMobileOperationDAO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileOperationPropertyDAO getMobileOperationPropertyDAO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileDeviceOperationMappingDAO getMobileDeviceOperationDAO() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileFeatureDAO getMobileFeatureDao() {
|
||||
return new FeatureDAOImpl();
|
||||
}
|
||||
|
||||
public MobileFeaturePropertyDAO getFeaturePropertyDAO() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.dao.FeatureManagementDAOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FeatureDAOImpl implements MobileFeatureDAO {
|
||||
|
||||
|
||||
public boolean addFeature(MobileFeature feature) throws MobileDeviceManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
boolean status = false;
|
||||
try {
|
||||
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
|
||||
String sql = "INSERT INTO IOS_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, feature.getCode());
|
||||
stmt.setString(2, feature.getName());
|
||||
stmt.setString(3, feature.getDescription());
|
||||
stmt.executeUpdate();
|
||||
status = true;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
|
||||
feature.getName() + "' into the metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateFeature(MobileFeature mobileFeature) throws MobileDeviceManagementDAOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
boolean status = false;
|
||||
try {
|
||||
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
|
||||
String sql = "DELETE FROM IOS_FEATURE WHERE CODE = ?";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, mblFeatureCode);
|
||||
stmt.execute();
|
||||
status = true;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
|
||||
mblFeatureCode + "' into the metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileFeature getFeatureById(int mblFeatureId) throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileFeature getFeatureByCode(String mblFeatureCode) throws MobileDeviceManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM IOS_FEATURE WHERE CODE = ?";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, mblFeatureCode);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
MobileFeature feature = null;
|
||||
if (rs.next()) {
|
||||
feature = new MobileFeature();
|
||||
feature.setId(rs.getInt("ID"));
|
||||
feature.setCode(rs.getString("CODE"));
|
||||
feature.setName(rs.getString("NAME"));
|
||||
feature.setDescription(rs.getString("DESCRIPTION"));
|
||||
}
|
||||
return feature;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while retrieving feature metadata '" +
|
||||
mblFeatureCode + "' from the feature metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileFeature> getFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileFeature> getAllFeatures() throws MobileDeviceManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<MobileFeature> features = new ArrayList<MobileFeature>();
|
||||
try {
|
||||
Connection conn = MobileDeviceManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM IOS_FEATURE";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
MobileFeature feature = new MobileFeature();
|
||||
feature.setId(rs.getInt("FEATURE_ID"));
|
||||
feature.setCode(rs.getString("CODE"));
|
||||
feature.setName(rs.getString("NAME"));
|
||||
feature.setDescription(rs.getString("DESCRIPTION"));
|
||||
features.add(feature);
|
||||
}
|
||||
return features;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while retrieving all feature metadata from the " +
|
||||
"feature metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,339 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.dao.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.util.IOSPluginConstants;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.ios.util.IOSUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class IOSDeviceDAOImpl implements MobileDeviceDAO {
|
||||
|
||||
private DataSource dataSource;
|
||||
private static final Log log = LogFactory.getLog(IOSDeviceDAOImpl.class);
|
||||
|
||||
public IOSDeviceDAOImpl(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MobileDevice getMobileDevice(String deviceID) throws MobileDeviceManagementDAOException {
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
MobileDevice mobileDevice = null;
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
|
||||
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID," +
|
||||
"LATITUDE, LONGITUDE, IMEI, VERSION FROM IOS_DEVICE WHERE MOBILE_DEVICE_ID = ?";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
stmt.setString(1, deviceID);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
|
||||
if (resultSet.next()) {
|
||||
mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(resultSet.getString(IOSPluginConstants.MOBILE_DEVICE_ID));
|
||||
|
||||
Map<String, String> tokenMap = new HashMap<String, String>();
|
||||
tokenMap.put(IOSPluginConstants.APNS_PUSH_TOKEN,
|
||||
resultSet.getString(IOSPluginConstants.APNS_PUSH_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.MAGIC_TOKEN, resultSet.getString(IOSPluginConstants.MAGIC_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.MDM_TOKEN, resultSet.getString(IOSPluginConstants.MDM_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.UNLOCK_TOKEN, resultSet.getString(IOSPluginConstants.UNLOCK_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.CHALLENGE_TOKEN,
|
||||
resultSet.getString(IOSPluginConstants.CHALLENGE_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.DEVICE_INFO, resultSet.getString(IOSPluginConstants.DEVICE_INFO));
|
||||
tokenMap.put(IOSPluginConstants.SERIAL, resultSet.getString(IOSPluginConstants.SERIAL));
|
||||
tokenMap.put(IOSPluginConstants.PRODUCT, resultSet.getString(IOSPluginConstants.PRODUCT));
|
||||
tokenMap.put(IOSPluginConstants.MAC_ADDRESS, resultSet.getString(IOSPluginConstants.MAC_ADDRESS));
|
||||
tokenMap.put(IOSPluginConstants.DEVICE_NAME, resultSet.getString(IOSPluginConstants.DEVICE_NAME));
|
||||
tokenMap.put(IOSPluginConstants.ICCID, resultSet.getString(IOSPluginConstants.ICCID));
|
||||
tokenMap.put(IOSPluginConstants.LATITUDE, resultSet.getString(IOSPluginConstants.LATITUDE));
|
||||
tokenMap.put(IOSPluginConstants.LONGITUDE, resultSet.getString(IOSPluginConstants.LONGITUDE));
|
||||
tokenMap.put(IOSPluginConstants.IMEI, resultSet.getString(IOSPluginConstants.IMEI));
|
||||
tokenMap.put(IOSPluginConstants.VERSION, resultSet.getString(IOSPluginConstants.VERSION));
|
||||
|
||||
mobileDevice.setDeviceProperties(tokenMap);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Mobile device " + deviceID + " data has been fetched from iOS database.");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while fetching mobile device '" + deviceID + "'";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
|
||||
return mobileDevice;
|
||||
}
|
||||
|
||||
public static final String IMEI = "IMEI";
|
||||
public static final String VERSION = "VERSION";
|
||||
public static final String MAC_ADDRESS = "MAC_ADDRESS";
|
||||
public static final String ICCID = "ICCID";
|
||||
@Override
|
||||
public boolean addMobileDevice(MobileDevice mobileDevice)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
boolean status = false;
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String createDBQuery =
|
||||
"INSERT INTO IOS_DEVICE(MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
|
||||
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID, " +
|
||||
"LATITUDE, LONGITUDE, IMEI, VERSION) VALUES " +
|
||||
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
stmt = conn.prepareStatement(createDBQuery);
|
||||
stmt.setString(1, mobileDevice.getMobileDeviceId());
|
||||
|
||||
if (mobileDevice.getDeviceProperties() == null) {
|
||||
mobileDevice.setDeviceProperties(new HashMap<String, String>());
|
||||
}
|
||||
|
||||
stmt.setString(2, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.APNS_PUSH_TOKEN));
|
||||
stmt.setString(3, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MAGIC_TOKEN));
|
||||
stmt.setString(4, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MDM_TOKEN));
|
||||
stmt.setString(5, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.UNLOCK_TOKEN));
|
||||
stmt.setString(6, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.CHALLENGE_TOKEN));
|
||||
stmt.setString(7, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.DEVICE_INFO));
|
||||
stmt.setString(8, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.SERIAL));
|
||||
stmt.setString(9, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.PRODUCT));
|
||||
stmt.setString(10, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MAC_ADDRESS));
|
||||
stmt.setString(11, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.DEVICE_NAME));
|
||||
stmt.setString(12, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.ICCID));
|
||||
stmt.setString(13, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.LATITUDE));
|
||||
stmt.setString(14, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.LONGITUDE));
|
||||
stmt.setString(15, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.IMEI));
|
||||
stmt.setString(16, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.VERSION));
|
||||
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Mobile device " + mobileDevice.getMobileDeviceId() + " data has been added" +
|
||||
" to the iOS database.");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while adding the mobile device '" +
|
||||
mobileDevice.getMobileDeviceId() + "' to the iOS db.";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateMobileDevice(MobileDevice mobileDevice)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
boolean status = false;
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String updateDBQuery =
|
||||
"UPDATE IOS_DEVICE SET APNS_PUSH_TOKEN = ?, MAGIC_TOKEN = ?, MDM_TOKEN = ?, UNLOCK_TOKEN = ?, " +
|
||||
"CHALLENGE_TOKEN = ?, DEVICE_INFO = ?, SERIAL = ?, PRODUCT = ?, MAC_ADDRESS = ?, " +
|
||||
"DEVICE_NAME = ?, ICCID = ?, LATITUDE = ?, LONGITUDE = ?, IMEI = ?, VERSION = ? " +
|
||||
"WHERE MOBILE_DEVICE_ID = ?";
|
||||
stmt = conn.prepareStatement(updateDBQuery);
|
||||
|
||||
stmt.setString(1, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.APNS_PUSH_TOKEN));
|
||||
stmt.setString(2, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MAGIC_TOKEN));
|
||||
stmt.setString(3, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MDM_TOKEN));
|
||||
stmt.setString(4, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.UNLOCK_TOKEN));
|
||||
stmt.setString(5, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.CHALLENGE_TOKEN));
|
||||
stmt.setString(6, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.DEVICE_INFO));
|
||||
stmt.setString(7, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.SERIAL));
|
||||
stmt.setString(8, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.PRODUCT));
|
||||
stmt.setString(9, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.MAC_ADDRESS));
|
||||
stmt.setString(10, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.DEVICE_NAME));
|
||||
stmt.setString(11, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.ICCID));
|
||||
stmt.setString(12, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.LATITUDE));
|
||||
stmt.setString(13, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.LONGITUDE));
|
||||
stmt.setString(14, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.IMEI));
|
||||
stmt.setString(15, IOSUtils.getDeviceProperty(mobileDevice.getDeviceProperties(),
|
||||
IOSPluginConstants.VERSION));
|
||||
stmt.setString(16, mobileDevice.getMobileDeviceId());
|
||||
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Mobile device " + mobileDevice.getMobileDeviceId() + " data has" +
|
||||
" updated");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while updating the mobile device '" +
|
||||
mobileDevice.getMobileDeviceId() + "'";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteMobileDevice(String mblDeviceId) throws MobileDeviceManagementDAOException {
|
||||
boolean status = false;
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String deleteDBQuery =
|
||||
"DELETE FROM IOS_DEVICE WHERE MOBILE_DEVICE_ID = ?";
|
||||
stmt = conn.prepareStatement(deleteDBQuery);
|
||||
stmt.setString(1, mblDeviceId);
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Mobile device " + mblDeviceId + " data has deleted" +
|
||||
" from the iOS database.");
|
||||
}
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while deleting mobile device " + mblDeviceId;
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException {
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
List<MobileDevice> mobileDevices = new ArrayList<MobileDevice>();
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT MOBILE_DEVICE_ID, APNS_PUSH_TOKEN, MAGIC_TOKEN, MDM_TOKEN, UNLOCK_TOKEN, " +
|
||||
"CHALLENGE_TOKEN, DEVICE_INFO, SERIAL, PRODUCT, MAC_ADDRESS, DEVICE_NAME, ICCID," +
|
||||
"LATITUDE, LONGITUDE, IMEI, VERSION FROM IOS_DEVICE";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
|
||||
MobileDevice mobileDevice = new MobileDevice();
|
||||
mobileDevice.setMobileDeviceId(resultSet.getString(IOSPluginConstants.MOBILE_DEVICE_ID));
|
||||
|
||||
Map<String, String> tokenMap = new HashMap<String, String>();
|
||||
tokenMap.put(IOSPluginConstants.APNS_PUSH_TOKEN,
|
||||
resultSet.getString(IOSPluginConstants.APNS_PUSH_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.MAGIC_TOKEN, resultSet.getString(IOSPluginConstants.MAGIC_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.MDM_TOKEN, resultSet.getString(IOSPluginConstants.MDM_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.UNLOCK_TOKEN, resultSet.getString(IOSPluginConstants.UNLOCK_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.CHALLENGE_TOKEN,
|
||||
resultSet.getString(IOSPluginConstants.CHALLENGE_TOKEN));
|
||||
tokenMap.put(IOSPluginConstants.DEVICE_INFO, resultSet.getString(IOSPluginConstants.DEVICE_INFO));
|
||||
tokenMap.put(IOSPluginConstants.SERIAL, resultSet.getString(IOSPluginConstants.SERIAL));
|
||||
tokenMap.put(IOSPluginConstants.PRODUCT, resultSet.getString(IOSPluginConstants.PRODUCT));
|
||||
tokenMap.put(IOSPluginConstants.MAC_ADDRESS, resultSet.getString(IOSPluginConstants.MAC_ADDRESS));
|
||||
tokenMap.put(IOSPluginConstants.DEVICE_NAME, resultSet.getString(IOSPluginConstants.DEVICE_NAME));
|
||||
tokenMap.put(IOSPluginConstants.ICCID, resultSet.getString(IOSPluginConstants.ICCID));
|
||||
tokenMap.put(IOSPluginConstants.LATITUDE, resultSet.getString(IOSPluginConstants.LATITUDE));
|
||||
tokenMap.put(IOSPluginConstants.LONGITUDE, resultSet.getString(IOSPluginConstants.LONGITUDE));
|
||||
tokenMap.put(IOSPluginConstants.IMEI, resultSet.getString(IOSPluginConstants.IMEI));
|
||||
tokenMap.put(IOSPluginConstants.VERSION, resultSet.getString(IOSPluginConstants.VERSION));
|
||||
|
||||
mobileDevice.setDeviceProperties(tokenMap);
|
||||
|
||||
mobileDevices.add(mobileDevice);
|
||||
}
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("All Mobile device details have fetched from iOS database.");
|
||||
}
|
||||
return mobileDevices;
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while fetching all mobile device data'";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getConnection() throws MobileDeviceManagementDAOException {
|
||||
try {
|
||||
return dataSource.getConnection();
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while obtaining a connection from the mobile device " +
|
||||
"management metadata repository datasource";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.util;
|
||||
|
||||
public class IOSPluginConstants {
|
||||
|
||||
public static final String MOBILE_DEVICE_ID = "MOBILE_DEVICE_ID";
|
||||
public static final String APNS_PUSH_TOKEN = "APNS_PUSH_TOKEN";
|
||||
public static final String MAGIC_TOKEN = "MAGIC_TOKEN";
|
||||
public static final String MDM_TOKEN = "MDM_TOKEN";
|
||||
public static final String UNLOCK_TOKEN = "UNLOCK_TOKEN";
|
||||
public static final String CHALLENGE_TOKEN = "CHALLENGE_TOKEN";
|
||||
public static final String DEVICE_INFO = "DEVICE_INFO";
|
||||
public static final String SERIAL = "SERIAL";
|
||||
public static final String PRODUCT = "PRODUCT";
|
||||
public static final String DEVICE_NAME = "DEVICE_NAME";
|
||||
public static final String LATITUDE = "LATITUDE";
|
||||
public static final String LONGITUDE = "LONGITUDE";
|
||||
public static final String IMEI = "IMEI";
|
||||
public static final String VERSION = "VERSION";
|
||||
public static final String MAC_ADDRESS = "MAC_ADDRESS";
|
||||
public static final String ICCID = "ICCID";
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.ios.util;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class IOSUtils {
|
||||
|
||||
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
|
||||
|
||||
String deviceProperty = deviceProperties.get(property);
|
||||
|
||||
if (deviceProperty == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return deviceProperty;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue