mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request 'Modify View Activities endpoint' (#227) from Sasini_Sandamali/device-mgt-core-forked:master into master
Reviewed-on: https://repository.entgra.net/community/device-mgt-core/pulls/227
This commit is contained in:
commit
ea6744288a
@ -466,6 +466,11 @@ public interface ActivityInfoProviderService {
|
|||||||
value = "Operation Code to filter"
|
value = "Operation Code to filter"
|
||||||
)
|
)
|
||||||
@QueryParam("operationCode") String operationCode,
|
@QueryParam("operationCode") String operationCode,
|
||||||
|
@ApiParam(
|
||||||
|
name = "operationId",
|
||||||
|
value = "Operation Id to filter"
|
||||||
|
)
|
||||||
|
@QueryParam("operationId") int operationId,
|
||||||
@ApiParam(
|
@ApiParam(
|
||||||
name = "deviceType",
|
name = "deviceType",
|
||||||
value = "Device Type to filter"
|
value = "Device Type to filter"
|
||||||
|
|||||||
@ -253,6 +253,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|||||||
@QueryParam("since") String since,
|
@QueryParam("since") String since,
|
||||||
@QueryParam("initiatedBy") String initiatedBy,
|
@QueryParam("initiatedBy") String initiatedBy,
|
||||||
@QueryParam("operationCode") String operationCode,
|
@QueryParam("operationCode") String operationCode,
|
||||||
|
@QueryParam("operationId") int operationId,
|
||||||
@QueryParam("deviceType") String deviceType,
|
@QueryParam("deviceType") String deviceType,
|
||||||
@QueryParam("deviceId") List<String> deviceIds,
|
@QueryParam("deviceId") List<String> deviceIds,
|
||||||
@QueryParam("type") String type,
|
@QueryParam("type") String type,
|
||||||
@ -321,6 +322,9 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
|
|||||||
if (operationCode != null && !operationCode.isEmpty()) {
|
if (operationCode != null && !operationCode.isEmpty()) {
|
||||||
activityPaginationRequest.setOperationCode(operationCode);
|
activityPaginationRequest.setOperationCode(operationCode);
|
||||||
}
|
}
|
||||||
|
if (operationId > 0) {
|
||||||
|
activityPaginationRequest.setOperationId(operationId);
|
||||||
|
}
|
||||||
if (deviceType != null && !deviceType.isEmpty()) {
|
if (deviceType != null && !deviceType.isEmpty()) {
|
||||||
activityPaginationRequest.setDeviceType(deviceType);
|
activityPaginationRequest.setDeviceType(deviceType);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public class ActivityPaginationRequest {
|
|||||||
private String deviceType;
|
private String deviceType;
|
||||||
private List<String> deviceIds;
|
private List<String> deviceIds;
|
||||||
private String operationCode;
|
private String operationCode;
|
||||||
|
private int operationId;
|
||||||
private String initiatedBy;
|
private String initiatedBy;
|
||||||
private long since;
|
private long since;
|
||||||
private Operation.Type type;
|
private Operation.Type type;
|
||||||
@ -132,4 +133,12 @@ public class ActivityPaginationRequest {
|
|||||||
public void setEndTimestamp(long endTimestamp) {
|
public void setEndTimestamp(long endTimestamp) {
|
||||||
this.endTimestamp = endTimestamp;
|
this.endTimestamp = endTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOperationId() {
|
||||||
|
return operationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperationId(int operationId) {
|
||||||
|
this.operationId = operationId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -49,6 +49,14 @@ public class Activity {
|
|||||||
@JsonProperty("code")
|
@JsonProperty("code")
|
||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "operationId",
|
||||||
|
value = "Operation Id",
|
||||||
|
required = false,
|
||||||
|
example = "10")
|
||||||
|
@JsonProperty("operationId")
|
||||||
|
private int operationId;
|
||||||
|
|
||||||
@ApiModelProperty(
|
@ApiModelProperty(
|
||||||
name = "type",
|
name = "type",
|
||||||
value = "Activity type",
|
value = "Activity type",
|
||||||
@ -122,6 +130,14 @@ public class Activity {
|
|||||||
this.code = code;
|
this.code = code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getOperationId() {
|
||||||
|
return operationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperationId(int operationId) {
|
||||||
|
this.operationId = operationId;
|
||||||
|
}
|
||||||
|
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2220,19 +2220,28 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
" DM_ENROLMENT_OP_MAPPING eom " +
|
" DM_ENROLMENT_OP_MAPPING eom " +
|
||||||
"LEFT JOIN " +
|
"LEFT JOIN " +
|
||||||
" DM_DEVICE_OPERATION_RESPONSE opr ON opr.EN_OP_MAP_ID = eom.ID " +
|
" DM_DEVICE_OPERATION_RESPONSE opr ON opr.EN_OP_MAP_ID = eom.ID " +
|
||||||
"INNER JOIN " +
|
"INNER JOIN ");
|
||||||
" (SELECT DISTINCT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? ");
|
|
||||||
|
if (activityPaginationRequest.getDeviceType() != null ||
|
||||||
|
(activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) ||
|
||||||
|
activityPaginationRequest.getSince() != 0 ||
|
||||||
|
activityPaginationRequest.getStatus() != null) {
|
||||||
|
|
||||||
|
sql.append("(SELECT DISTINCT OPERATION_ID FROM DM_ENROLMENT_OP_MAPPING eom WHERE TENANT_ID = ? ");
|
||||||
|
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
sql.append("AND DEVICE_TYPE = ? ");
|
sql.append("AND DEVICE_TYPE = ? ");
|
||||||
}
|
}
|
||||||
if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) {
|
if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) {
|
||||||
sql.append("AND DEVICE_IDENTIFICATION IN (");
|
sql.append("AND eom.DEVICE_IDENTIFICATION IN (");
|
||||||
for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) {
|
for (int i = 0; i < activityPaginationRequest.getDeviceIds().size() - 1; i++) {
|
||||||
sql.append("?, ");
|
sql.append("?, ");
|
||||||
}
|
}
|
||||||
sql.append("?) ");
|
sql.append("?) ");
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
sql.append("AND OPERATION_ID = ? ");
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
sql.append("AND OPERATION_CODE = ? ");
|
sql.append("AND OPERATION_CODE = ? ");
|
||||||
}
|
}
|
||||||
@ -2255,6 +2264,26 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
|
|
||||||
sql.append("ORDER BY OPERATION_ID ASC limit ? , ? ) eom_ordered " +
|
sql.append("ORDER BY OPERATION_ID ASC limit ? , ? ) eom_ordered " +
|
||||||
"ON eom_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? ");
|
"ON eom_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? ");
|
||||||
|
} else {
|
||||||
|
sql.append("(SELECT ID AS OPERATION_ID FROM DM_OPERATION WHERE TENANT_ID = ? ");
|
||||||
|
|
||||||
|
if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) {
|
||||||
|
isTimeDurationFilteringProvided = true;
|
||||||
|
sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? ");
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
sql.append("AND ID = ? ");
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
|
sql.append("AND OPERATION_CODE = ? ");
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
|
sql.append("AND INITIATED_BY = ? ");
|
||||||
|
}
|
||||||
|
|
||||||
|
sql.append("ORDER BY ID ASC ) dm_ordered " +
|
||||||
|
"ON dm_ordered.OPERATION_ID = eom.OPERATION_ID WHERE eom.TENANT_ID = ? ");
|
||||||
|
}
|
||||||
|
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
sql.append("AND eom.DEVICE_TYPE = ? ");
|
sql.append("AND eom.DEVICE_TYPE = ? ");
|
||||||
@ -2269,6 +2298,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
sql.append("AND eom.OPERATION_CODE = ? ");
|
sql.append("AND eom.OPERATION_CODE = ? ");
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
sql.append("AND eom.OPERATION_ID = ? ");
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
sql.append("AND eom.INITIATED_BY = ? ");
|
sql.append("AND eom.INITIATED_BY = ? ");
|
||||||
}
|
}
|
||||||
@ -2290,6 +2322,11 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
int index = 1;
|
int index = 1;
|
||||||
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
||||||
stmt.setInt(index++, tenantId);
|
stmt.setInt(index++, tenantId);
|
||||||
|
if (activityPaginationRequest.getDeviceType() != null ||
|
||||||
|
(activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) ||
|
||||||
|
activityPaginationRequest.getSince() != 0 ||
|
||||||
|
activityPaginationRequest.getStatus() != null) {
|
||||||
|
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getDeviceType());
|
stmt.setString(index++, activityPaginationRequest.getDeviceType());
|
||||||
}
|
}
|
||||||
@ -2301,6 +2338,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOperationId());
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
}
|
}
|
||||||
@ -2330,9 +2370,38 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
stmt.setString(index++, deviceId);
|
stmt.setString(index++, deviceId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (isTimeDurationFilteringProvided) {
|
||||||
|
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
||||||
|
stmt.setLong(index++, activityPaginationRequest.getEndTimestamp());
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOperationId());
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt.setInt(index++, tenantId);
|
||||||
|
|
||||||
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
|
stmt.setString(index++, activityPaginationRequest.getDeviceType());
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) {
|
||||||
|
for (String deviceId : activityPaginationRequest.getDeviceIds()) {
|
||||||
|
stmt.setString(index++, deviceId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
|
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOperationId());
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
}
|
}
|
||||||
@ -2374,7 +2443,14 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
boolean isTimeDurationFilteringProvided = false;
|
boolean isTimeDurationFilteringProvided = false;
|
||||||
Connection conn = OperationManagementDAOFactory.getConnection();
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
||||||
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
||||||
StringBuilder sql = new StringBuilder("SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT " +
|
StringBuilder sql = new StringBuilder();
|
||||||
|
|
||||||
|
if (activityPaginationRequest.getDeviceType() != null ||
|
||||||
|
(activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) ||
|
||||||
|
activityPaginationRequest.getSince() != 0 ||
|
||||||
|
activityPaginationRequest.getStatus() != null) {
|
||||||
|
|
||||||
|
sql.append("SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT " +
|
||||||
"FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? ");
|
"FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ? ");
|
||||||
|
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
@ -2390,6 +2466,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
sql.append("AND OPERATION_CODE = ? ");
|
sql.append("AND OPERATION_CODE = ? ");
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
sql.append("AND OPERATION_ID = ? ");
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
sql.append("AND INITIATED_BY = ? ");
|
sql.append("AND INITIATED_BY = ? ");
|
||||||
}
|
}
|
||||||
@ -2402,6 +2481,20 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getStatus() != null) {
|
if (activityPaginationRequest.getStatus() != null) {
|
||||||
sql.append("AND STATUS = ? ");
|
sql.append("AND STATUS = ? ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sql.append("SELECT count(ID) AS ACTIVITY_COUNT FROM DM_OPERATION WHERE TENANT_ID = ? ");
|
||||||
|
|
||||||
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
|
sql.append("AND OPERATION_CODE = ? ");
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
sql.append("AND ID = ? ");
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
|
sql.append("AND INITIATED_BY = ? ");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) {
|
if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) {
|
||||||
isTimeDurationFilteringProvided = true;
|
isTimeDurationFilteringProvided = true;
|
||||||
sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? ");
|
sql.append("AND CREATED_TIMESTAMP BETWEEN ? AND ? ");
|
||||||
@ -2410,6 +2503,11 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
int index = 1;
|
int index = 1;
|
||||||
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
try (PreparedStatement stmt = conn.prepareStatement(sql.toString())) {
|
||||||
stmt.setInt(index++, tenantId);
|
stmt.setInt(index++, tenantId);
|
||||||
|
|
||||||
|
if (activityPaginationRequest.getDeviceType() != null ||
|
||||||
|
(activityPaginationRequest.getDeviceIds() != null && !activityPaginationRequest.getDeviceIds().isEmpty()) ||
|
||||||
|
activityPaginationRequest.getSince() != 0 ||
|
||||||
|
activityPaginationRequest.getStatus() != null) {
|
||||||
if (activityPaginationRequest.getDeviceType() != null) {
|
if (activityPaginationRequest.getDeviceType() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getDeviceType());
|
stmt.setString(index++, activityPaginationRequest.getDeviceType());
|
||||||
}
|
}
|
||||||
@ -2421,6 +2519,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getOperationCode() != null) {
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
||||||
}
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOperationId());
|
||||||
|
}
|
||||||
if (activityPaginationRequest.getInitiatedBy() != null) {
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
}
|
}
|
||||||
@ -2433,6 +2534,17 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|||||||
if (activityPaginationRequest.getStatus() != null) {
|
if (activityPaginationRequest.getStatus() != null) {
|
||||||
stmt.setString(index++, activityPaginationRequest.getStatus().name());
|
stmt.setString(index++, activityPaginationRequest.getStatus().name());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (activityPaginationRequest.getOperationCode() != null) {
|
||||||
|
stmt.setString(index++, activityPaginationRequest.getOperationCode());
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getOperationId() > 0) {
|
||||||
|
stmt.setInt(index++, activityPaginationRequest.getOperationId());
|
||||||
|
}
|
||||||
|
if (activityPaginationRequest.getInitiatedBy() != null) {
|
||||||
|
stmt.setString(index++, activityPaginationRequest.getInitiatedBy());
|
||||||
|
}
|
||||||
|
}
|
||||||
if (isTimeDurationFilteringProvided) {
|
if (isTimeDurationFilteringProvided) {
|
||||||
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
||||||
stmt.setLong(index, activityPaginationRequest.getEndTimestamp());
|
stmt.setLong(index, activityPaginationRequest.getEndTimestamp());
|
||||||
|
|||||||
@ -248,6 +248,7 @@ public class OperationDAOUtil {
|
|||||||
activity.setCreatedTimeStamp(
|
activity.setCreatedTimeStamp(
|
||||||
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
|
||||||
activity.setCode(rs.getString("OPERATION_CODE"));
|
activity.setCode(rs.getString("OPERATION_CODE"));
|
||||||
|
activity.setOperationId(rs.getInt("OPERATION_ID"));
|
||||||
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
|
||||||
|
|
||||||
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
||||||
|
|||||||
@ -92,6 +92,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 INT NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -126,9 +126,17 @@ CREATE TABLE DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS VARBINARY(MAX) DEFAULT NULL,
|
OPERATION_DETAILS VARBINARY(MAX) DEFAULT NULL,
|
||||||
ENABLED BIT NOT NULL DEFAULT 0,
|
ENABLED BIT NOT NULL DEFAULT 0,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_CREATED' AND OBJECT_ID = OBJECT_ID('DM_OPERATION'))
|
||||||
|
CREATE INDEX IDX_OP_CREATED ON DM_OPERATION(CREATED_TIMESTAMP);
|
||||||
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_CODE' AND OBJECT_ID = OBJECT_ID('DM_OPERATION'))
|
||||||
|
CREATE INDEX IDX_OP_CODE ON DM_OPERATION(OPERATION_CODE);
|
||||||
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_OP_INITIATED_BY' AND OBJECT_ID = OBJECT_ID('DM_OPERATION'))
|
||||||
|
CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION(INITIATED_BY);
|
||||||
|
|
||||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_ENROLMENT]') AND TYPE IN (N'U'))
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_ENROLMENT]') AND TYPE IN (N'U'))
|
||||||
CREATE TABLE DM_ENROLMENT (
|
CREATE TABLE DM_ENROLMENT (
|
||||||
ID INTEGER IDENTITY(1,1) NOT NULL,
|
ID INTEGER IDENTITY(1,1) NOT NULL,
|
||||||
@ -196,6 +204,8 @@ IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_EN_OP_MAPPING_OP_ID'
|
|||||||
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
|
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
|
||||||
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_EN_OP_MAPPING_EN_ID_STATUS' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT_OP_MAPPING'))
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_EN_OP_MAPPING_EN_ID_STATUS' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT_OP_MAPPING'))
|
||||||
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS);
|
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS);
|
||||||
|
IF NOT EXISTS (SELECT * FROM SYS.INDEXES WHERE NAME = 'IDX_ENROLMENT_OP_MAPPING_CREATED_TS' AND OBJECT_ID = OBJECT_ID('DM_ENROLMENT_OP_MAPPING'))
|
||||||
|
CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING(CREATED_TIMESTAMP);
|
||||||
|
|
||||||
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_OPERATION_RESPONSE]') AND TYPE IN (N'U'))
|
IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[DM_DEVICE_OPERATION_RESPONSE]') AND TYPE IN (N'U'))
|
||||||
CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
CREATE TABLE DM_DEVICE_OPERATION_RESPONSE (
|
||||||
|
|||||||
@ -107,9 +107,14 @@ 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 INT NOT NULL,
|
||||||
PRIMARY KEY (ID)
|
PRIMARY KEY (ID)
|
||||||
)ENGINE = InnoDB;
|
)ENGINE = InnoDB;
|
||||||
|
|
||||||
|
CREATE INDEX IDX_OP_CREATED ON DM_OPERATION (CREATED_TIMESTAMP ASC);
|
||||||
|
CREATE INDEX IDX_OP_CODE ON DM_OPERATION (OPERATION_CODE ASC);
|
||||||
|
CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION (INITIATED_BY ASC);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
CREATE TABLE IF NOT EXISTS DM_ENROLMENT (
|
||||||
ID INTEGER AUTO_INCREMENT NOT NULL,
|
ID INTEGER AUTO_INCREMENT NOT NULL,
|
||||||
DEVICE_ID INTEGER NOT NULL,
|
DEVICE_ID INTEGER NOT NULL,
|
||||||
@ -170,6 +175,7 @@ CREATE INDEX IDX_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMEST
|
|||||||
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
|
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID);
|
||||||
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
|
CREATE INDEX IDX_EN_OP_MAPPING_OP_ID ON DM_ENROLMENT_OP_MAPPING(OPERATION_ID);
|
||||||
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS);
|
CREATE INDEX IDX_EN_OP_MAPPING_EN_ID_STATUS ON DM_ENROLMENT_OP_MAPPING(ENROLMENT_ID, STATUS);
|
||||||
|
CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING (CREATED_TIMESTAMP ASC);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE
|
CREATE TABLE IF NOT EXISTS DM_DEVICE_OPERATION_RESPONSE
|
||||||
(
|
(
|
||||||
|
|||||||
@ -181,6 +181,7 @@ CREATE TABLE DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR2(100) NULL,
|
INITIATED_BY VARCHAR2(100) NULL,
|
||||||
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
|
ENABLED NUMBER(10) DEFAULT 0 NOT NULL,
|
||||||
OPERATION_DETAILS BLOB DEFAULT NULL,
|
OPERATION_DETAILS BLOB DEFAULT NULL,
|
||||||
|
TENANT_ID INTEGER NOT NULL,
|
||||||
CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID)
|
CONSTRAINT PK_DM_OPERATION PRIMARY KEY (ID)
|
||||||
)
|
)
|
||||||
/
|
/
|
||||||
|
|||||||
@ -100,10 +100,13 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION (
|
|||||||
INITIATED_BY VARCHAR(100) NULL,
|
INITIATED_BY VARCHAR(100) NULL,
|
||||||
OPERATION_DETAILS BYTEA DEFAULT NULL,
|
OPERATION_DETAILS BYTEA 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)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CREATE INDEX IDX_OP_CREATED ON DM_OPERATION (CREATED_TIMESTAMP);
|
||||||
|
CREATE INDEX IDX_OP_CODE ON DM_OPERATION (OPERATION_CODE);
|
||||||
|
CREATE INDEX IDX_OP_INITIATED_BY ON DM_OPERATION (INITIATED_BY);
|
||||||
|
|
||||||
CREATE SEQUENCE DM_ENROLMENT_seq;
|
CREATE SEQUENCE DM_ENROLMENT_seq;
|
||||||
|
|
||||||
@ -161,6 +164,7 @@ CREATE TABLE IF NOT EXISTS DM_ENROLMENT_OP_MAPPING (
|
|||||||
CREATE INDEX fk_dm_device_operation_mapping_operation ON DM_ENROLMENT_OP_MAPPING (OPERATION_ID);
|
CREATE INDEX fk_dm_device_operation_mapping_operation ON DM_ENROLMENT_OP_MAPPING (OPERATION_ID);
|
||||||
CREATE INDEX IDX_DM_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (ENROLMENT_ID,OPERATION_ID);
|
CREATE INDEX IDX_DM_ENROLMENT_OP_MAPPING ON DM_ENROLMENT_OP_MAPPING (ENROLMENT_ID,OPERATION_ID);
|
||||||
CREATE INDEX ID_DM_ENROLMENT_OP_MAPPING_UPDATED_TIMESTAMP ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
|
CREATE INDEX ID_DM_ENROLMENT_OP_MAPPING_UPDATED_TIMESTAMP ON DM_ENROLMENT_OP_MAPPING (UPDATED_TIMESTAMP);
|
||||||
|
CREATE INDEX IDX_ENROLMENT_OP_MAPPING_CREATED_TS ON DM_ENROLMENT_OP_MAPPING (CREATED_TIMESTAMP);
|
||||||
|
|
||||||
ALTER TABLE DM_ENROLMENT_OP_MAPPING
|
ALTER TABLE DM_ENROLMENT_OP_MAPPING
|
||||||
ADD OPERATION_CODE VARCHAR(50) NOT NULL,
|
ADD OPERATION_CODE VARCHAR(50) NOT NULL,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user