parent
2883f0dda2
commit
163fe58120
@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.carbon.device.mgt.mobile.dao;
|
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperation;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This class represents the mapping between device and operations.
|
|
||||||
*/
|
|
||||||
public interface MobileDeviceOperationDAO {
|
|
||||||
/**
|
|
||||||
* Add a new mapping to plugin device_operation table.
|
|
||||||
*
|
|
||||||
* @param deviceOperation DeviceOperation object that holds data related to the DeviceOperation
|
|
||||||
* to be inserted.
|
|
||||||
* @return The status of the operation. If the insert was successful or not.
|
|
||||||
* @throws MobileDeviceManagementDAOException
|
|
||||||
*/
|
|
||||||
boolean addMobileDeviceOperation(MobileDeviceOperation deviceOperation)
|
|
||||||
throws MobileDeviceManagementDAOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update a feature in the feature table.
|
|
||||||
*
|
|
||||||
* @param deviceOperation DeviceOperation object that holds data has to be updated.
|
|
||||||
* @return The status of the operation. If the update was successful or not.
|
|
||||||
* @throws MobileDeviceManagementDAOException
|
|
||||||
*/
|
|
||||||
boolean updateMobileDeviceOperation(MobileDeviceOperation deviceOperation)
|
|
||||||
throws MobileDeviceManagementDAOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete a given device operation from device operation table.
|
|
||||||
*
|
|
||||||
* @param deviceId Device id of the mapping to be deleted.
|
|
||||||
* @param operationId Operation id of the mapping to be deleted.
|
|
||||||
* @return The status of the operation. If the deletion was successful or not.
|
|
||||||
* @throws MobileDeviceManagementDAOException
|
|
||||||
*/
|
|
||||||
boolean deleteMobileDeviceOperation(String deviceId, int operationId)
|
|
||||||
throws MobileDeviceManagementDAOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve a given device operation from plugin database.
|
|
||||||
*
|
|
||||||
* @param deviceId Device id of the mapping to be retrieved.
|
|
||||||
* @param operationId Operation id of the mapping to be retrieved.
|
|
||||||
* @return DeviceOperation object that holds data of the device operation mapping represented by
|
|
||||||
* deviceId and operationId.
|
|
||||||
* @throws MobileDeviceManagementDAOException
|
|
||||||
*/
|
|
||||||
MobileDeviceOperation getMobileDeviceOperation(String deviceId, int operationId)
|
|
||||||
throws MobileDeviceManagementDAOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieve all the device operation mapping from plugin database.
|
|
||||||
*
|
|
||||||
* @return Device operation mapping object list.
|
|
||||||
* @throws MobileDeviceManagementDAOException
|
|
||||||
*/
|
|
||||||
List<MobileDeviceOperation> getAllMobileDeviceOperationsOfDevice(String deviceId)
|
|
||||||
throws MobileDeviceManagementDAOException;
|
|
||||||
}
|
|
@ -0,0 +1,110 @@
|
|||||||
|
/*
|
||||||
|
* 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.carbon.device.mgt.mobile.dao;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperationMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class represents the mapping between mobile device and operations.
|
||||||
|
*/
|
||||||
|
public interface MobileDeviceOperationMappingDAO {
|
||||||
|
/**
|
||||||
|
* Add a new mobile device operation mapping to the table.
|
||||||
|
*
|
||||||
|
* @param deviceOperation MobileDeviceOperation object that holds data related to the MobileDeviceOperation
|
||||||
|
* to be inserted.
|
||||||
|
* @return The status of the operation. If the insert was successful or not.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
boolean addMobileDeviceOperation(MobileDeviceOperationMapping deviceOperation)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a mobile device operation mapping.
|
||||||
|
*
|
||||||
|
* @param deviceOperation MobileDeviceOperation object that holds data has to be updated.
|
||||||
|
* @return The status of the operation. If the update was successful or not.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
boolean updateMobileDeviceOperation(MobileDeviceOperationMapping deviceOperation)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a mobile device operation mapping to In-Progress state.
|
||||||
|
*
|
||||||
|
* @param deviceId Device id of the mapping to be deleted.
|
||||||
|
* @param operationId Operation id of the mapping to be deleted.
|
||||||
|
* @return The status of the operation. If the update was successful or not.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
boolean updateMobileDeviceOperationToInProgress(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates a mobile device operation mapping to completed state.
|
||||||
|
*
|
||||||
|
* @param deviceId Device id of the mapping to be deleted.
|
||||||
|
* @param operationId Operation id of the mapping to be deleted.
|
||||||
|
* @return The status of the operation. If the update was successful or not.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
boolean updateMobileDeviceOperationToCompleted(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete a given mobile device operation mapping from table.
|
||||||
|
*
|
||||||
|
* @param deviceId Device id of the mapping to be deleted.
|
||||||
|
* @param operationId Operation id of the mapping to be deleted.
|
||||||
|
* @return The status of the operation. If the deletion was successful or not.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
boolean deleteMobileDeviceOperation(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a given mobile device operation from the plugin database.
|
||||||
|
*
|
||||||
|
* @param deviceId Device id of the mapping to be retrieved.
|
||||||
|
* @param operationId Operation id of the mapping to be retrieved.
|
||||||
|
* @return MobileDeviceOperation object that holds data of the device operation mapping represented by
|
||||||
|
* deviceId and operationId.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
MobileDeviceOperationMapping getMobileDeviceOperation(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all the of mobile device operation mappings relavent to the given mobile device.
|
||||||
|
*
|
||||||
|
* @return Device operation mapping object list.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
List<MobileDeviceOperationMapping> getAllMobileDeviceOperationsOfDevice(String deviceId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves all the pending device operation mappings of a mobiel device.
|
||||||
|
*
|
||||||
|
* @return Device operation mapping object list.
|
||||||
|
* @throws MobileDeviceManagementDAOException
|
||||||
|
*/
|
||||||
|
List<MobileDeviceOperationMapping> getAllPendingOperationsOfMobileDevice(String deviceId)
|
||||||
|
throws MobileDeviceManagementDAOException;
|
||||||
|
}
|
@ -1,218 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.carbon.device.mgt.mobile.dao.impl;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceOperationDAO;
|
|
||||||
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.MobileDeviceOperation;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of MobileDeviceOperationDAO.
|
|
||||||
*/
|
|
||||||
public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO {
|
|
||||||
|
|
||||||
private DataSource dataSource;
|
|
||||||
private static final Log log = LogFactory.getLog(MobileDeviceOperationDAOImpl.class);
|
|
||||||
|
|
||||||
public MobileDeviceOperationDAOImpl(DataSource dataSource) {
|
|
||||||
this.dataSource = dataSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean addMobileDeviceOperation(MobileDeviceOperation deviceOperation)
|
|
||||||
throws MobileDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = this.getConnection();
|
|
||||||
String createDBQuery =
|
|
||||||
"INSERT INTO MBL_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE) VALUES (?, ?, ?, ?)";
|
|
||||||
|
|
||||||
stmt = conn.prepareStatement(createDBQuery);
|
|
||||||
stmt.setString(1, deviceOperation.getDeviceId());
|
|
||||||
stmt.setLong(2, deviceOperation.getOperationId());
|
|
||||||
stmt.setLong(3, deviceOperation.getSentDate());
|
|
||||||
stmt.setLong(4, deviceOperation.getReceivedDate());
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while adding device id - '" +
|
|
||||||
deviceOperation.getDeviceId() + " and operation id - " +
|
|
||||||
deviceOperation.getOperationId() +
|
|
||||||
" to mapping table MBL_DEVICE_OPERATION";
|
|
||||||
;
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new MobileDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean updateMobileDeviceOperation(MobileDeviceOperation deviceOperation)
|
|
||||||
throws MobileDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = this.getConnection();
|
|
||||||
String updateDBQuery =
|
|
||||||
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
|
||||||
stmt = conn.prepareStatement(updateDBQuery);
|
|
||||||
stmt.setLong(1, deviceOperation.getSentDate());
|
|
||||||
stmt.setLong(2, deviceOperation.getReceivedDate());
|
|
||||||
stmt.setString(3, deviceOperation.getDeviceId());
|
|
||||||
stmt.setInt(4, deviceOperation.getOperationId());
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg = "Error occurred while updating device id - '" +
|
|
||||||
deviceOperation.getDeviceId() + " and operation id - " +
|
|
||||||
deviceOperation.getOperationId() + " in table MBL_DEVICE_OPERATION";
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new MobileDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean deleteMobileDeviceOperation(String deviceId, int operationId)
|
|
||||||
throws MobileDeviceManagementDAOException {
|
|
||||||
boolean status = false;
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
try {
|
|
||||||
conn = this.getConnection();
|
|
||||||
String deleteDBQuery =
|
|
||||||
"DELETE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
|
||||||
stmt = conn.prepareStatement(deleteDBQuery);
|
|
||||||
stmt.setString(1, deviceId);
|
|
||||||
stmt.setInt(2, operationId);
|
|
||||||
int rows = stmt.executeUpdate();
|
|
||||||
if (rows > 0) {
|
|
||||||
status = true;
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg =
|
|
||||||
"Error occurred while deleting the table entry MBL_DEVICE_OPERATION with device id - '" +
|
|
||||||
deviceId + " and operation id - " + operationId;
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new MobileDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public MobileDeviceOperation getMobileDeviceOperation(String deviceId, int operationId)
|
|
||||||
throws MobileDeviceManagementDAOException {
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
MobileDeviceOperation deviceOperation = null;
|
|
||||||
try {
|
|
||||||
conn = this.getConnection();
|
|
||||||
String selectDBQuery =
|
|
||||||
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
|
||||||
stmt = conn.prepareStatement(selectDBQuery);
|
|
||||||
stmt.setString(1, deviceId);
|
|
||||||
stmt.setInt(2, operationId);
|
|
||||||
ResultSet resultSet = stmt.executeQuery();
|
|
||||||
while (resultSet.next()) {
|
|
||||||
deviceOperation = new MobileDeviceOperation();
|
|
||||||
deviceOperation.setDeviceId(resultSet.getString(1));
|
|
||||||
deviceOperation.setOperationId(resultSet.getInt(2));
|
|
||||||
deviceOperation.setSentDate(resultSet.getInt(3));
|
|
||||||
deviceOperation.setReceivedDate(resultSet.getInt(4));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg =
|
|
||||||
"Error occurred while fetching table MBL_DEVICE_OPERATION entry with device id - '" +
|
|
||||||
deviceId + " and operation id - " + operationId;
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new MobileDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
|
||||||
}
|
|
||||||
return deviceOperation;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<MobileDeviceOperation> getAllMobileDeviceOperationsOfDevice(String deviceId)
|
|
||||||
throws MobileDeviceManagementDAOException {
|
|
||||||
Connection conn = null;
|
|
||||||
PreparedStatement stmt = null;
|
|
||||||
MobileDeviceOperation deviceOperation = null;
|
|
||||||
List<MobileDeviceOperation> deviceOperations = new ArrayList<MobileDeviceOperation>();
|
|
||||||
try {
|
|
||||||
conn = this.getConnection();
|
|
||||||
String selectDBQuery =
|
|
||||||
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?";
|
|
||||||
stmt = conn.prepareStatement(selectDBQuery);
|
|
||||||
stmt.setString(1, deviceId);
|
|
||||||
ResultSet resultSet = stmt.executeQuery();
|
|
||||||
while (resultSet.next()) {
|
|
||||||
deviceOperation = new MobileDeviceOperation();
|
|
||||||
deviceOperation.setDeviceId(resultSet.getString(1));
|
|
||||||
deviceOperation.setOperationId(resultSet.getInt(2));
|
|
||||||
deviceOperation.setSentDate(resultSet.getInt(3));
|
|
||||||
deviceOperation.setReceivedDate(resultSet.getInt(4));
|
|
||||||
deviceOperations.add(deviceOperation);
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
String msg =
|
|
||||||
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entries of device id - '" +
|
|
||||||
deviceId;
|
|
||||||
log.error(msg, e);
|
|
||||||
throw new MobileDeviceManagementDAOException(msg, e);
|
|
||||||
} finally {
|
|
||||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
|
||||||
}
|
|
||||||
return deviceOperations;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,331 @@
|
|||||||
|
/*
|
||||||
|
* 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.carbon.device.mgt.mobile.dao.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceOperationMappingDAO;
|
||||||
|
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.MobileDeviceOperationMapping;
|
||||||
|
|
||||||
|
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.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implementation of MobileDeviceOperationMappingDAO.
|
||||||
|
*/
|
||||||
|
public class MobileDeviceOperationMappingDAOImpl implements MobileDeviceOperationMappingDAO {
|
||||||
|
|
||||||
|
private DataSource dataSource;
|
||||||
|
private static final Log log = LogFactory.getLog(MobileDeviceOperationMappingDAOImpl.class);
|
||||||
|
|
||||||
|
public MobileDeviceOperationMappingDAOImpl(DataSource dataSource) {
|
||||||
|
this.dataSource = dataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addMobileDeviceOperation(MobileDeviceOperationMapping deviceOperation)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String createDBQuery =
|
||||||
|
"INSERT INTO MBL_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, " +
|
||||||
|
"RECEIVED_DATE, STATUS) VALUES (?, ?, ?, ?, ?)";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(createDBQuery);
|
||||||
|
stmt.setString(1, deviceOperation.getDeviceId());
|
||||||
|
stmt.setLong(2, deviceOperation.getOperationId());
|
||||||
|
stmt.setLong(3, deviceOperation.getSentDate());
|
||||||
|
stmt.setLong(4, deviceOperation.getReceivedDate());
|
||||||
|
stmt.setString(5, deviceOperation.getStatus().name());
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while adding device id - '" +
|
||||||
|
deviceOperation.getDeviceId() + " and operation id - " +
|
||||||
|
deviceOperation.getOperationId() +
|
||||||
|
" to mapping table MBL_DEVICE_OPERATION";
|
||||||
|
;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateMobileDeviceOperation(MobileDeviceOperationMapping deviceOperation)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String updateDBQuery =
|
||||||
|
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ?, STATUS = ? " +
|
||||||
|
"WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(updateDBQuery);
|
||||||
|
stmt.setLong(1, deviceOperation.getSentDate());
|
||||||
|
stmt.setLong(2, deviceOperation.getReceivedDate());
|
||||||
|
stmt.setString(3, deviceOperation.getStatus().name());
|
||||||
|
stmt.setString(4, deviceOperation.getDeviceId());
|
||||||
|
stmt.setInt(5, deviceOperation.getOperationId());
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while updating device id - '" +
|
||||||
|
deviceOperation.getDeviceId() + " and operation id - " +
|
||||||
|
deviceOperation.getOperationId() + " in table MBL_DEVICE_OPERATION";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateMobileDeviceOperationToInProgress(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String updateDBQuery =
|
||||||
|
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, STATUS = ? " +
|
||||||
|
"WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(updateDBQuery);
|
||||||
|
stmt.setLong(1, new Date().getTime());
|
||||||
|
stmt.setString(2, MobileDeviceOperationMapping.Status.INPROGRESS.name());
|
||||||
|
stmt.setString(3, deviceId);
|
||||||
|
stmt.setInt(4, operationId);
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while updating the Status of operation to in-progress of device id - '" +
|
||||||
|
deviceId + " and operation id - " +
|
||||||
|
operationId + " in table MBL_DEVICE_OPERATION";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateMobileDeviceOperationToCompleted(String deviceId,
|
||||||
|
int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String updateDBQuery =
|
||||||
|
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET RECEIVED_DATE = ?, STATUS = ? " +
|
||||||
|
"WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(updateDBQuery);
|
||||||
|
stmt.setLong(1, new Date().getTime());
|
||||||
|
stmt.setString(2, MobileDeviceOperationMapping.Status.COMPLETED.name());
|
||||||
|
stmt.setString(3, deviceId);
|
||||||
|
stmt.setInt(4, operationId);
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while updating the Status of operation to completed of device id - '" +
|
||||||
|
deviceId + " and operation id - " +
|
||||||
|
operationId + " in table MBL_DEVICE_OPERATION";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteMobileDeviceOperation(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String deleteDBQuery =
|
||||||
|
"DELETE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(deleteDBQuery);
|
||||||
|
stmt.setString(1, deviceId);
|
||||||
|
stmt.setInt(2, operationId);
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while deleting the table entry MBL_DEVICE_OPERATION with " +
|
||||||
|
" device id - '" + deviceId + " and operation id - " + operationId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MobileDeviceOperationMapping getMobileDeviceOperation(String deviceId, int operationId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
MobileDeviceOperationMapping mblDeviceOperation = null;
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String selectDBQuery =
|
||||||
|
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " +
|
||||||
|
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
|
||||||
|
stmt = conn.prepareStatement(selectDBQuery);
|
||||||
|
stmt.setString(1, deviceId);
|
||||||
|
stmt.setInt(2, operationId);
|
||||||
|
ResultSet resultSet = stmt.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
mblDeviceOperation = new MobileDeviceOperationMapping();
|
||||||
|
mblDeviceOperation.setDeviceId(resultSet.getString(1));
|
||||||
|
mblDeviceOperation.setOperationId(resultSet.getInt(2));
|
||||||
|
mblDeviceOperation.setSentDate(resultSet.getInt(3));
|
||||||
|
mblDeviceOperation.setReceivedDate(resultSet.getInt(4));
|
||||||
|
mblDeviceOperation.setStatus(resultSet.getString(5));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while fetching table MBL_DEVICE_OPERATION entry with device id - '" +
|
||||||
|
deviceId + " and operation id - " + operationId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return mblDeviceOperation;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MobileDeviceOperationMapping> getAllMobileDeviceOperationsOfDevice(String deviceId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
MobileDeviceOperationMapping mblDeviceOperation = null;
|
||||||
|
List<MobileDeviceOperationMapping> mblDeviceOperations = new ArrayList<MobileDeviceOperationMapping>();
|
||||||
|
try {
|
||||||
|
conn = this.getConnection();
|
||||||
|
String selectDBQuery =
|
||||||
|
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM " +
|
||||||
|
"MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?";
|
||||||
|
stmt = conn.prepareStatement(selectDBQuery);
|
||||||
|
stmt.setString(1, deviceId);
|
||||||
|
ResultSet resultSet = stmt.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
mblDeviceOperation = new MobileDeviceOperationMapping();
|
||||||
|
mblDeviceOperation.setDeviceId(resultSet.getString(1));
|
||||||
|
mblDeviceOperation.setOperationId(resultSet.getInt(2));
|
||||||
|
mblDeviceOperation.setSentDate(resultSet.getInt(3));
|
||||||
|
mblDeviceOperation.setReceivedDate(resultSet.getInt(4));
|
||||||
|
mblDeviceOperation.setStatus(resultSet.getString(5));
|
||||||
|
mblDeviceOperations.add(mblDeviceOperation);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entries of " +
|
||||||
|
"device id - '" + deviceId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return mblDeviceOperations;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MobileDeviceOperationMapping> getAllPendingOperationsOfMobileDevice(String deviceId)
|
||||||
|
throws MobileDeviceManagementDAOException {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
MobileDeviceOperationMapping mblDeviceOperation = null;
|
||||||
|
List<MobileDeviceOperationMapping> mblDeviceOperations = new ArrayList<MobileDeviceOperationMapping>();
|
||||||
|
try {
|
||||||
|
|
||||||
|
conn = this.getConnection();
|
||||||
|
String selectDBQuery =
|
||||||
|
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE, STATUS FROM" +
|
||||||
|
" MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND STATUS = 'NEW'";
|
||||||
|
stmt = conn.prepareStatement(selectDBQuery);
|
||||||
|
stmt.setString(1, deviceId);
|
||||||
|
ResultSet resultSet = stmt.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
mblDeviceOperation = new MobileDeviceOperationMapping();
|
||||||
|
mblDeviceOperation.setDeviceId(resultSet.getString(1));
|
||||||
|
mblDeviceOperation.setOperationId(resultSet.getInt(2));
|
||||||
|
mblDeviceOperation.setSentDate(resultSet.getInt(3));
|
||||||
|
mblDeviceOperation.setReceivedDate(resultSet.getInt(4));
|
||||||
|
mblDeviceOperation.setStatus(resultSet.getString(5));
|
||||||
|
mblDeviceOperations.add(mblDeviceOperation);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg =
|
||||||
|
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entries of" +
|
||||||
|
" device id - '" + deviceId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new MobileDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||||
|
}
|
||||||
|
return mblDeviceOperations;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/FeaturePropertyDAOImpl.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeaturePropertyDAOImpl.java
54
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/FeaturePropertyDAOImpl.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileFeaturePropertyDAOImpl.java
@ -0,0 +1,119 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import javax.xml.XMLConstants;
|
||||||
|
import javax.xml.bind.JAXBContext;
|
||||||
|
import javax.xml.bind.JAXBException;
|
||||||
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
import javax.xml.validation.Schema;
|
||||||
|
import javax.xml.validation.SchemaFactory;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public class MobileDeviceManagementConfigTests {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(MobileDeviceManagementConfigTests.class);
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-mgt-repo.xml";
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-ds-config.xml";
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-jndi-config.xml";
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-apis-config.xml";
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-api-config.xml";
|
||||||
|
private static final String MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG =
|
||||||
|
"./src/test/resources/config/malformed-mobile-config-no-api-publisher-config.xml";
|
||||||
|
private static final String TEST_CONFIG_SCHEMA_LOCATION =
|
||||||
|
"./src/test/resources/config/schema/MobileDeviceManagementConfigSchema.xsd";
|
||||||
|
|
||||||
|
private Schema schema;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
private void initSchema() {
|
||||||
|
File deviceManagementSchemaConfig = new File(MobileDeviceManagementConfigTests.TEST_CONFIG_SCHEMA_LOCATION);
|
||||||
|
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
|
||||||
|
try {
|
||||||
|
schema = factory.newSchema(deviceManagementSchemaConfig);
|
||||||
|
} catch (SAXException e) {
|
||||||
|
Assert.fail("Invalid schema found", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test()
|
||||||
|
public void testMandateManagementRepositoryElement() {
|
||||||
|
File malformedConfig =
|
||||||
|
new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_MGT_REPOSITORY);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMandateDataSourceConfigurationElement() {
|
||||||
|
File malformedConfig = new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_DS_CONFIG);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMandateJndiLookupDefinitionElement() {
|
||||||
|
File malformedConfig = new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_JNDI_CONFIG);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMandateAPIPublisherElement() {
|
||||||
|
File malformedConfig = new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_PUBLISHER_CONFIG);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMandateAPIsElement() {
|
||||||
|
File malformedConfig = new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_APIS_CONFIG);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMandateAPIElement() {
|
||||||
|
File malformedConfig = new File(MobileDeviceManagementConfigTests.MALFORMED_TEST_CONFIG_LOCATION_NO_API_CONFIG);
|
||||||
|
this.validateMalformedConfig(malformedConfig);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateMalformedConfig(File malformedConfig) {
|
||||||
|
try {
|
||||||
|
JAXBContext ctx = JAXBContext.newInstance(MobileDeviceManagementConfig.class);
|
||||||
|
Unmarshaller um = ctx.createUnmarshaller();
|
||||||
|
um.setSchema(this.getSchema());
|
||||||
|
um.unmarshal(malformedConfig);
|
||||||
|
Assert.assertTrue(false);
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
log.error("Error occurred while unmarsharlling mobile device management config", e);
|
||||||
|
Assert.assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Schema getSchema() {
|
||||||
|
return schema;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.sql.Statement;
|
||||||
|
|
||||||
|
public class TestUtils {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(TestUtils.class);
|
||||||
|
|
||||||
|
public static void cleanupResources(Connection conn, Statement stmt, ResultSet rs) {
|
||||||
|
if (rs != null) {
|
||||||
|
try {
|
||||||
|
rs.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.warn("Error occurred while closing result set", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (stmt != null) {
|
||||||
|
try {
|
||||||
|
stmt.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.warn("Error occurred while closing prepared statement", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (conn != null) {
|
||||||
|
try {
|
||||||
|
conn.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.warn("Error occurred while closing database connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,139 @@
|
|||||||
|
/*
|
||||||
|
* 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.dao;
|
||||||
|
|
||||||
|
import org.apache.commons.dbcp.BasicDataSource;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.BeforeClass;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
import org.w3c.dom.Document;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.dao.impl.MobileFeatureDAOImpl;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.impl.common.DBTypes;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfiguration;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfigurations;
|
||||||
|
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
|
||||||
|
|
||||||
|
import javax.xml.bind.JAXBContext;
|
||||||
|
import javax.xml.bind.JAXBException;
|
||||||
|
import javax.xml.bind.Unmarshaller;
|
||||||
|
import java.io.File;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.Statement;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
public class FeatureDAOTestSuite {
|
||||||
|
|
||||||
|
private TestDBConfiguration testDBConfiguration;
|
||||||
|
private Connection conn = null;
|
||||||
|
private Statement stmt = null;
|
||||||
|
private MobileFeatureDAOImpl featureDAO;
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
@Parameters("dbType")
|
||||||
|
public void setUpDB(String dbTypeStr) throws Exception {
|
||||||
|
|
||||||
|
DBTypes dbType = DBTypes.valueOf(dbTypeStr);
|
||||||
|
testDBConfiguration = getTestDBConfiguration(dbType);
|
||||||
|
|
||||||
|
switch (dbType) {
|
||||||
|
case H2:
|
||||||
|
createH2DB(testDBConfiguration);
|
||||||
|
BasicDataSource testDataSource = new BasicDataSource();
|
||||||
|
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass());
|
||||||
|
testDataSource.setUrl(testDBConfiguration.getConnectionUrl());
|
||||||
|
testDataSource.setUsername(testDBConfiguration.getUserName());
|
||||||
|
testDataSource.setPassword(testDBConfiguration.getPwd());
|
||||||
|
featureDAO = new MobileFeatureDAOImpl(testDataSource);
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws
|
||||||
|
MobileDeviceManagementDAOException,
|
||||||
|
DeviceManagementException {
|
||||||
|
|
||||||
|
File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml");
|
||||||
|
Document doc = null;
|
||||||
|
testDBConfiguration = null;
|
||||||
|
TestDBConfigurations testDBConfigurations = null;
|
||||||
|
|
||||||
|
doc = MobileDeviceManagementUtil.convertToDocument(deviceMgtConfig);
|
||||||
|
JAXBContext testDBContext = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
testDBContext = JAXBContext.newInstance(TestDBConfigurations.class);
|
||||||
|
Unmarshaller unmarshaller = testDBContext.createUnmarshaller();
|
||||||
|
testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc);
|
||||||
|
} catch (JAXBException e) {
|
||||||
|
throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
Iterator<TestDBConfiguration> itrDBConfigs =
|
||||||
|
testDBConfigurations.getDbTypesList().iterator();
|
||||||
|
while (itrDBConfigs.hasNext()) {
|
||||||
|
testDBConfiguration = itrDBConfigs.next();
|
||||||
|
if (testDBConfiguration.getDbType().equals(dbType.toString())) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return testDBConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
|
||||||
|
Class.forName(testDBConf.getDriverClass());
|
||||||
|
conn = DriverManager.getConnection(testDBConf.getConnectionUrl());
|
||||||
|
stmt = conn.createStatement();
|
||||||
|
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
|
||||||
|
stmt.close();
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void addFeature() throws MobileDeviceManagementDAOException, DeviceManagementException {
|
||||||
|
|
||||||
|
MobileFeature mobileFeature = new MobileFeature();
|
||||||
|
mobileFeature.setCode("Camera");
|
||||||
|
mobileFeature.setDescription("Camera enable or disable");
|
||||||
|
mobileFeature.setName("Camera");
|
||||||
|
boolean added = featureDAO.addFeature(mobileFeature);
|
||||||
|
// Long deviceId = null;
|
||||||
|
// try {
|
||||||
|
// conn = DeviceManagementDAOFactory.getDataSource().getConnection();
|
||||||
|
// stmt = conn.createStatement();
|
||||||
|
// ResultSet resultSet = stmt
|
||||||
|
// .executeQuery("SELECT ID from DM_DEVICE DEVICE where DEVICE.DEVICE_IDENTIFICATION='111'");
|
||||||
|
//
|
||||||
|
// while (resultSet.next()) {
|
||||||
|
// deviceId = resultSet.getLong(1);
|
||||||
|
// }
|
||||||
|
// conn.close();
|
||||||
|
// } catch (SQLException sqlEx) {
|
||||||
|
// throw new DeviceManagementDAOException("error in fetch device by device identification id", sqlEx);
|
||||||
|
// }
|
||||||
|
|
||||||
|
Assert.assertTrue(added, "Device Id is null");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl.dao;
|
||||||
|
|
||||||
|
public class FeaturePropertyDAOTestSuite {
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl.dao;
|
||||||
|
|
||||||
|
public class MobileDeviceDAOTestSuite {
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl.dao;
|
||||||
|
|
||||||
|
public class MobileDeviceOperationDAOTestSuite {
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl.dao;
|
||||||
|
|
||||||
|
public class MobileOperationDAOTestSuite {
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 - 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.carbon.device.mgt.mobile.impl.dao;
|
||||||
|
|
||||||
|
public class MobileOperationPropertyDAOTestSuite {
|
||||||
|
}
|
@ -1,141 +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.dao;
|
|
||||||
|
|
||||||
import org.testng.Assert;
|
|
||||||
import org.testng.annotations.BeforeClass;
|
|
||||||
import org.testng.annotations.Parameters;
|
|
||||||
import org.testng.annotations.Test;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.impl.common.DBTypes;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfiguration;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfigurations;
|
|
||||||
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.dao.impl.FeatureDAOImpl;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.dto.*;
|
|
||||||
|
|
||||||
import javax.xml.bind.JAXBContext;
|
|
||||||
import javax.xml.bind.JAXBException;
|
|
||||||
import javax.xml.bind.Unmarshaller;
|
|
||||||
import java.io.File;
|
|
||||||
import java.sql.*;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
public class FeatureDAOTestSuite {
|
|
||||||
|
|
||||||
private TestDBConfiguration testDBConfiguration;
|
|
||||||
private Connection conn = null;
|
|
||||||
private Statement stmt = null;
|
|
||||||
private FeatureDAOImpl featureDAO;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
@Parameters("dbType")
|
|
||||||
public void setUpDB(String dbTypeStr) throws Exception {
|
|
||||||
|
|
||||||
DBTypes dbType = DBTypes.valueOf(dbTypeStr);
|
|
||||||
testDBConfiguration = getTestDBConfiguration(dbType);
|
|
||||||
|
|
||||||
switch (dbType) {
|
|
||||||
case H2:
|
|
||||||
createH2DB(testDBConfiguration);
|
|
||||||
BasicDataSource testDataSource = new BasicDataSource();
|
|
||||||
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass());
|
|
||||||
testDataSource.setUrl(testDBConfiguration.getConnectionUrl());
|
|
||||||
testDataSource.setUsername(testDBConfiguration.getUserName());
|
|
||||||
testDataSource.setPassword(testDBConfiguration.getPwd());
|
|
||||||
featureDAO = new FeatureDAOImpl(testDataSource);
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws
|
|
||||||
MobileDeviceManagementDAOException,
|
|
||||||
DeviceManagementException {
|
|
||||||
|
|
||||||
File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml");
|
|
||||||
Document doc = null;
|
|
||||||
testDBConfiguration = null;
|
|
||||||
TestDBConfigurations testDBConfigurations = null;
|
|
||||||
|
|
||||||
doc = DeviceManagerUtil.convertToDocument(deviceMgtConfig);
|
|
||||||
JAXBContext testDBContext = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
testDBContext = JAXBContext.newInstance(TestDBConfigurations.class);
|
|
||||||
Unmarshaller unmarshaller = testDBContext.createUnmarshaller();
|
|
||||||
testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc);
|
|
||||||
} catch (JAXBException e) {
|
|
||||||
throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterator<TestDBConfiguration> itrDBConfigs = testDBConfigurations.getDbTypesList().iterator();
|
|
||||||
while (itrDBConfigs.hasNext()) {
|
|
||||||
testDBConfiguration = itrDBConfigs.next();
|
|
||||||
if (testDBConfiguration.getDbType().equals(dbType.toString())) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return testDBConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
|
|
||||||
|
|
||||||
Class.forName(testDBConf.getDriverClass());
|
|
||||||
conn = DriverManager.getConnection(testDBConf.getConnectionUrl());
|
|
||||||
stmt = conn.createStatement();
|
|
||||||
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
|
|
||||||
stmt.close();
|
|
||||||
conn.close();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void addFeature() throws MobileDeviceManagementDAOException, DeviceManagementException {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Feature feature = new Feature();
|
|
||||||
feature.setCode("Camera");
|
|
||||||
feature.setDescription("Camera enable or disable");
|
|
||||||
feature.setName("Camera");
|
|
||||||
boolean added = featureDAO.addFeature(feature);
|
|
||||||
// Long deviceId = null;
|
|
||||||
// try {
|
|
||||||
// conn = DeviceManagementDAOFactory.getDataSource().getConnection();
|
|
||||||
// stmt = conn.createStatement();
|
|
||||||
// ResultSet resultSet = stmt
|
|
||||||
// .executeQuery("SELECT ID from DM_DEVICE DEVICE where DEVICE.DEVICE_IDENTIFICATION='111'");
|
|
||||||
//
|
|
||||||
// while (resultSet.next()) {
|
|
||||||
// deviceId = resultSet.getLong(1);
|
|
||||||
// }
|
|
||||||
// conn.close();
|
|
||||||
// } catch (SQLException sqlEx) {
|
|
||||||
// throw new DeviceManagementDAOException("error in fetch device by device identification id", sqlEx);
|
|
||||||
// }
|
|
||||||
|
|
||||||
Assert.assertTrue(added, "Device Id is null");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<ManagementRepository>
|
||||||
|
<DataSourceConfiguration>
|
||||||
|
<JndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</JndiLookupDefinition>
|
||||||
|
</DataSourceConfiguration>
|
||||||
|
</ManagementRepository>
|
||||||
|
|
||||||
|
<APIPublisher>
|
||||||
|
<APIs>
|
||||||
|
<MalformedAPI>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</MalformedAPI>
|
||||||
|
</APIs>
|
||||||
|
</APIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<ManagementRepository>
|
||||||
|
<DataSourceConfiguration>
|
||||||
|
<JndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</JndiLookupDefinition>
|
||||||
|
</DataSourceConfiguration>
|
||||||
|
</ManagementRepository>
|
||||||
|
|
||||||
|
<MalformedAPIPublisher>
|
||||||
|
<APIs>
|
||||||
|
<API>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</API>
|
||||||
|
</APIs>
|
||||||
|
</MalformedAPIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<ManagementRepository>
|
||||||
|
<DataSourceConfiguration>
|
||||||
|
<JndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</JndiLookupDefinition>
|
||||||
|
</DataSourceConfiguration>
|
||||||
|
</ManagementRepository>
|
||||||
|
|
||||||
|
<APIPublisher>
|
||||||
|
<MalformedAPIs>
|
||||||
|
<API>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</API>
|
||||||
|
</MalformedAPIs>
|
||||||
|
</APIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<ManagementRepository>
|
||||||
|
<MalformedDataSourceConfiguration>
|
||||||
|
<JndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</JndiLookupDefinition>
|
||||||
|
</MalformedDataSourceConfiguration>
|
||||||
|
</ManagementRepository>
|
||||||
|
|
||||||
|
<APIPublisher>
|
||||||
|
<APIs>
|
||||||
|
<API>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</API>
|
||||||
|
</APIs>
|
||||||
|
</APIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<ManagementRepository>
|
||||||
|
<DataSourceConfiguration>
|
||||||
|
<MalformedJndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</MalformedJndiLookupDefinition>
|
||||||
|
</DataSourceConfiguration>
|
||||||
|
</ManagementRepository>
|
||||||
|
|
||||||
|
<APIPublisher>
|
||||||
|
<APIs>
|
||||||
|
<API>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</API>
|
||||||
|
</APIs>
|
||||||
|
</APIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<MobileDeviceMgtConfiguration>
|
||||||
|
<MalformedManagementRepository>
|
||||||
|
<DataSourceConfiguration>
|
||||||
|
<JndiLookupDefinition>
|
||||||
|
<Name>jdbc/MobileDM_DS</Name>
|
||||||
|
</JndiLookupDefinition>
|
||||||
|
</DataSourceConfiguration>
|
||||||
|
</MalformedManagementRepository>
|
||||||
|
|
||||||
|
<APIPublisher>
|
||||||
|
<APIs>
|
||||||
|
<API>
|
||||||
|
<Name>enrollment</Name>
|
||||||
|
<Owner>admin</Owner>
|
||||||
|
<Context>enrollment</Context>
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
<Endpoint>http://localhost:9763/</Endpoint>
|
||||||
|
<Transports>http,https</Transports>
|
||||||
|
</API>
|
||||||
|
</APIs>
|
||||||
|
</APIPublisher>
|
||||||
|
</MobileDeviceMgtConfiguration>
|
||||||
|
|
@ -0,0 +1,67 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2014 - 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.
|
||||||
|
-->
|
||||||
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
|
||||||
|
attributeFormDefault="unqualified">
|
||||||
|
<xs:element name="MobileDeviceMgtConfiguration">
|
||||||
|
<xs:complexType>
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="ManagementRepository" minOccurs="1" maxOccurs="1"
|
||||||
|
type="DataSourceConfigurationType"/>
|
||||||
|
<xs:element name="APIPublisher" minOccurs="1" maxOccurs="1"
|
||||||
|
type="APIsConfigurationType"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:element>
|
||||||
|
|
||||||
|
<xs:complexType name="JndiLookupDefinitionType">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="DataSourceConfigurationType">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="JndiLookupDefinition" minOccurs="1" maxOccurs="1"
|
||||||
|
type="JndiLookupDefinitionType"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="ManagementRepositoryType">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="DataSourceConfiguration" minOccurs="1" maxOccurs="1"
|
||||||
|
type="DataSourceConfigurationType"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="APIConfigurationType">
|
||||||
|
<xs:all>
|
||||||
|
<xs:element name="Name" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
<xs:element name="Owner" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
<xs:element name="Context" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
<xs:element name="Version" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
<xs:element name="Endpoint" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
<xs:element name="Transports" type="xs:string" minOccurs="1" maxOccurs="1"/>
|
||||||
|
</xs:all>
|
||||||
|
</xs:complexType>
|
||||||
|
|
||||||
|
<xs:complexType name="APIsConfigurationType">
|
||||||
|
<xs:sequence>
|
||||||
|
<xs:element name="API" maxOccurs="unbounded"
|
||||||
|
type="APIConfigurationType"/>
|
||||||
|
</xs:sequence>
|
||||||
|
</xs:complexType>
|
||||||
|
</xs:schema>
|
@ -1,24 +1,82 @@
|
|||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
|
|
||||||
(
|
|
||||||
ID INT auto_increment NOT NULL,
|
|
||||||
NAME VARCHAR(300) NULL DEFAULT NULL,
|
|
||||||
PRIMARY KEY (ID)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE
|
-- -----------------------------------------------------
|
||||||
(
|
-- Table `MBL_DEVICE`
|
||||||
ID INT auto_increment NOT NULL,
|
-- -----------------------------------------------------
|
||||||
DESCRIPTION TEXT NULL DEFAULT NULL,
|
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||||
NAME VARCHAR(100) NULL DEFAULT NULL,
|
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||||
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
`REG_ID` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
`IMEI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
`IMSI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
`VENDOR` VARCHAR(45) NULL DEFAULT NULL ,
|
||||||
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||||
TENANT_ID INTEGER DEFAULT 0,
|
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||||
PRIMARY KEY (ID),
|
PRIMARY KEY (`MOBILE_DEVICE_ID`) );
|
||||||
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
|
||||||
REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
|
|
||||||
);
|
-- -----------------------------------------------------
|
||||||
|
-- Table `MBL_FEATURE`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||||
|
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||||
|
`CODE` VARCHAR(45) NOT NULL ,
|
||||||
|
`NAME` VARCHAR(100) NULL ,
|
||||||
|
`DESCRIPTION` VARCHAR(200) NULL ,
|
||||||
|
PRIMARY KEY (`FEATURE_ID`) );
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `MBL_OPERATION`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
|
||||||
|
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||||
|
`FEATURE_CODE` VARCHAR(45) NOT NULL ,
|
||||||
|
`CREATED_DATE` BIGINT NULL ,
|
||||||
|
PRIMARY KEY (`OPERATION_ID`));
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `MBL_DEVICE_OPERATION_MAPPING`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
|
||||||
|
`DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||||
|
`OPERATION_ID` INT NOT NULL ,
|
||||||
|
`SENT_DATE` BIGINT NULL ,
|
||||||
|
`RECEIVED_DATE` BIGINT NULL ,
|
||||||
|
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
|
||||||
|
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
|
||||||
|
FOREIGN KEY (`DEVICE_ID` )
|
||||||
|
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION,
|
||||||
|
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
|
||||||
|
FOREIGN KEY (`OPERATION_ID` )
|
||||||
|
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION);
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `MBL_OPERATION_PROPERTY`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||||
|
`OPERATION_ID` INT NOT NULL ,
|
||||||
|
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||||
|
`VALUE` TEXT NULL ,
|
||||||
|
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) ,
|
||||||
|
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
|
||||||
|
FOREIGN KEY (`OPERATION_ID` )
|
||||||
|
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION);
|
||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `MBL_FEATURE_PROPERTY`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||||
|
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||||
|
`FEATURE_ID` VARCHAR(45) NOT NULL ,
|
||||||
|
PRIMARY KEY (`PROPERTY`) ,
|
||||||
|
CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1`
|
||||||
|
FOREIGN KEY (`FEATURE_ID` )
|
||||||
|
REFERENCES `MBL_FEATURE` (`FEATURE_ID` )
|
||||||
|
ON DELETE NO ACTION
|
||||||
|
ON UPDATE NO ACTION);
|
||||||
|
Binary file not shown.
@ -1,27 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
@XmlSchema(namespace = "http://www.w3.org/2003/05/soap-envelope",
|
|
||||||
xmlns = {
|
|
||||||
@XmlNs(prefix = "", namespaceURI = "http://www.w3.org/2003/05/soap-envelope"),
|
|
||||||
}, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
|
|
||||||
|
|
||||||
package com.ex.wstep;
|
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlNs;
|
|
||||||
import javax.xml.bind.annotation.XmlSchema;
|
|
Loading…
Reference in new issue