mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request 'Update addOperation and sql files' (#233) from Sasini_Sandamali/device-mgt-core-forked:master into master
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/233
This commit is contained in:
commit
327f507aa8
@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.CommandOperation;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
@ -46,7 +47,7 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
try {
|
try {
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
||||||
"INITIATED_BY, ENABLED) VALUES (?, ?, ?, ?, ?, ?)";
|
"INITIATED_BY, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||||
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
||||||
stmt.setString(1, operation.getType().toString());
|
stmt.setString(1, operation.getType().toString());
|
||||||
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
||||||
@ -54,6 +55,7 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
stmt.setString(4, operation.getCode());
|
stmt.setString(4, operation.getCode());
|
||||||
stmt.setString(5, operation.getInitiatedBy());
|
stmt.setString(5, operation.getInitiatedBy());
|
||||||
stmt.setBoolean(6, operation.isEnabled());
|
stmt.setBoolean(6, operation.isEnabled());
|
||||||
|
stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|
||||||
rs = stmt.getGeneratedKeys();
|
rs = stmt.getGeneratedKeys();
|
||||||
|
|||||||
@ -20,6 +20,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ConfigOperation;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
@ -49,7 +50,7 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
operation.setCreatedTimeStamp(new Timestamp(new Date().getTime()).toString());
|
operation.setCreatedTimeStamp(new Timestamp(new Date().getTime()).toString());
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
||||||
"INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)";
|
"INITIATED_BY, OPERATION_DETAILS, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||||
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
||||||
stmt.setString(1, operation.getType().toString());
|
stmt.setString(1, operation.getType().toString());
|
||||||
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
||||||
@ -57,6 +58,7 @@ public class ConfigOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
stmt.setString(4, operation.getCode());
|
stmt.setString(4, operation.getCode());
|
||||||
stmt.setString(5, operation.getInitiatedBy());
|
stmt.setString(5, operation.getInitiatedBy());
|
||||||
stmt.setObject(6, operation);
|
stmt.setObject(6, operation);
|
||||||
|
stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|
||||||
rs = stmt.getGeneratedKeys();
|
rs = stmt.getGeneratedKeys();
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
try {
|
try {
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
||||||
"INITIATED_BY, OPERATION_DETAILS) VALUES (?, ?, ?, ?, ?, ?)";
|
"INITIATED_BY, OPERATION_DETAILS, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
||||||
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
||||||
stmt.setString(1, operation.getType().toString());
|
stmt.setString(1, operation.getType().toString());
|
||||||
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
||||||
@ -82,6 +82,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
stmt.setString(4, operation.getCode());
|
stmt.setString(4, operation.getCode());
|
||||||
stmt.setString(5, operation.getInitiatedBy());
|
stmt.setString(5, operation.getInitiatedBy());
|
||||||
stmt.setObject(6, operation);
|
stmt.setObject(6, operation);
|
||||||
|
stmt.setInt(7, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|
||||||
rs = stmt.getGeneratedKeys();
|
rs = stmt.getGeneratedKeys();
|
||||||
@ -2281,7 +2282,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
sql.append("AND INITIATED_BY = ? ");
|
sql.append("AND INITIATED_BY = ? ");
|
||||||
}
|
}
|
||||||
|
|
||||||
sql.append("ORDER BY ID ASC ) dm_ordered " +
|
sql.append("ORDER BY ID ASC limit ? , ? ) dm_ordered " +
|
||||||
"ON dm_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? ");
|
"ON dm_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2384,7 +2385,8 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
}
|
}
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOffset());
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getLimit());
|
||||||
stmt.setInt(index++, tenantId);
|
stmt.setInt(index++, tenantId);
|
||||||
|
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.PolicyOperation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.PolicyOperation;
|
||||||
@ -49,7 +50,7 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
operation.setEnabled(true);
|
operation.setEnabled(true);
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
||||||
"INITIATED_BY, OPERATION_DETAILS, ENABLED) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
"INITIATED_BY, OPERATION_DETAILS, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
||||||
stmt.setString(1, operation.getType().toString());
|
stmt.setString(1, operation.getType().toString());
|
||||||
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
||||||
@ -63,6 +64,7 @@ public class PolicyOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
|
|
||||||
stmt.setBytes(6, bao.toByteArray());
|
stmt.setBytes(6, bao.toByteArray());
|
||||||
stmt.setBoolean(7, operation.isEnabled());
|
stmt.setBoolean(7, operation.isEnabled());
|
||||||
|
stmt.setInt(8, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|
||||||
rs = stmt.getGeneratedKeys();
|
rs = stmt.getGeneratedKeys();
|
||||||
|
|||||||
@ -19,6 +19,7 @@ package io.entgra.device.mgt.core.device.mgt.core.operation.mgt.dao.impl;
|
|||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
import io.entgra.device.mgt.core.device.mgt.core.dao.util.DeviceManagementDAOUtil;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.Operation;
|
||||||
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation;
|
import io.entgra.device.mgt.core.device.mgt.core.dto.operation.mgt.ProfileOperation;
|
||||||
@ -46,7 +47,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
operation.setEnabled(true);
|
operation.setEnabled(true);
|
||||||
Connection connection = OperationManagementDAOFactory.getConnection();
|
Connection connection = OperationManagementDAOFactory.getConnection();
|
||||||
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
String sql = "INSERT INTO DM_OPERATION(TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, OPERATION_CODE, " +
|
||||||
"INITIATED_BY, OPERATION_DETAILS, ENABLED) VALUES (?, ?, ?, ?, ?, ?, ?)";
|
"INITIATED_BY, OPERATION_DETAILS, ENABLED, TENANT_ID) VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||||
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
stmt = connection.prepareStatement(sql, new String[]{"id"});
|
||||||
stmt.setString(1, operation.getType().toString());
|
stmt.setString(1, operation.getType().toString());
|
||||||
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime());
|
||||||
@ -60,6 +61,7 @@ public class ProfileOperationDAOImpl extends GenericOperationDAOImpl {
|
|||||||
|
|
||||||
stmt.setBytes(6, bao.toByteArray());
|
stmt.setBytes(6, bao.toByteArray());
|
||||||
stmt.setBoolean(7, operation.isEnabled());
|
stmt.setBoolean(7, operation.isEnabled());
|
||||||
|
stmt.setInt(8, PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
|
|
||||||
rs = stmt.getGeneratedKeys();
|
rs = stmt.getGeneratedKeys();
|
||||||
|
|||||||
@ -82,6 +82,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS BLOB DEFAULT NULL,
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -68,6 +68,10 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
CREATED_TIMESTAMP BIGINT NOT NULL,
|
CREATED_TIMESTAMP BIGINT NOT NULL,
|
||||||
RECEIVED_TIMESTAMP BIGINT NULL,
|
RECEIVED_TIMESTAMP BIGINT NULL,
|
||||||
OPERATION_CODE VARCHAR(1000) NOT NULL,
|
OPERATION_CODE VARCHAR(1000) NOT NULL,
|
||||||
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS BLOB DEFAULT NULL,
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS BLOB DEFAULT NULL,
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS BLOB DEFAULT NULL,
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
ENABLED BOOLEAN NOT NULL DEFAULT FALSE,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user