|
|
@ -1726,6 +1726,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
public List<Activity> getActivities(ActivityPaginationRequest activityPaginationRequest)
|
|
|
|
public List<Activity> getActivities(ActivityPaginationRequest activityPaginationRequest)
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
boolean isTimeDurationFilteringProvided = false;
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
String sql = "SELECT " +
|
|
|
|
String sql = "SELECT " +
|
|
|
@ -1766,6 +1767,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
sql += "AND UPDATED_TIMESTAMP > ? ";
|
|
|
|
sql += "AND UPDATED_TIMESTAMP > ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) {
|
|
|
|
|
|
|
|
isTimeDurationFilteringProvided = true;
|
|
|
|
|
|
|
|
sql += "AND CREATED_TIMESTAMP BETWEEN ? AND ? ";
|
|
|
|
|
|
|
|
}
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
sql += "AND TYPE = ? ";
|
|
|
|
sql += "AND TYPE = ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1791,6 +1796,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
sql += "AND eom.UPDATED_TIMESTAMP > ? ";
|
|
|
|
sql += "AND eom.UPDATED_TIMESTAMP > ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTimeDurationFilteringProvided) {
|
|
|
|
|
|
|
|
sql += "AND eom.CREATED_TIMESTAMP BETWEEN ? AND ? ";
|
|
|
|
|
|
|
|
}
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
sql += "AND eom.TYPE = ? ";
|
|
|
|
sql += "AND eom.TYPE = ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1818,6 +1826,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getSince());
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getSince());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTimeDurationFilteringProvided) {
|
|
|
|
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
|
|
|
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getEndTimestamp());
|
|
|
|
|
|
|
|
}
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1844,6 +1856,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
if (activityPaginationRequest.getSince() != 0) {
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getSince());
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getSince());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTimeDurationFilteringProvided) {
|
|
|
|
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
|
|
|
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getEndTimestamp());
|
|
|
|
|
|
|
|
}
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
if (activityPaginationRequest.getType() != null) {
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1872,6 +1888,7 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
public int getActivitiesCount(ActivityPaginationRequest activityPaginationRequest)
|
|
|
|
public int getActivitiesCount(ActivityPaginationRequest activityPaginationRequest)
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
throws OperationManagementDAOException {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
|
|
|
|
boolean isTimeDurationFilteringProvided = false;
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
Connection conn = OperationManagementDAOFactory.getConnection();
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
String sql = "SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT FROM DM_ENROLMENT_OP_MAPPING " +
|
|
|
|
String sql = "SELECT count(DISTINCT OPERATION_ID) AS ACTIVITY_COUNT FROM DM_ENROLMENT_OP_MAPPING " +
|
|
|
@ -1898,6 +1915,10 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
if (activityPaginationRequest.getStatus() != null) {
|
|
|
|
if (activityPaginationRequest.getStatus() != null) {
|
|
|
|
sql += "AND STATUS = ? ";
|
|
|
|
sql += "AND STATUS = ? ";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (activityPaginationRequest.getStartTimestamp() > 0 && activityPaginationRequest.getEndTimestamp() > 0) {
|
|
|
|
|
|
|
|
isTimeDurationFilteringProvided = true;
|
|
|
|
|
|
|
|
sql += "AND CREATED_TIMESTAMP BETWEEN ? AND ? ";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int index = 1;
|
|
|
|
int index = 1;
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
|
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
|
|
|
@ -1921,7 +1942,11 @@ public class GenericOperationDAOImpl implements OperationDAO {
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getType().name());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (activityPaginationRequest.getStatus() != null) {
|
|
|
|
if (activityPaginationRequest.getStatus() != null) {
|
|
|
|
stmt.setString(index, activityPaginationRequest.getStatus().name());
|
|
|
|
stmt.setString(index++, activityPaginationRequest.getStatus().name());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isTimeDurationFilteringProvided) {
|
|
|
|
|
|
|
|
stmt.setLong(index++, activityPaginationRequest.getStartTimestamp());
|
|
|
|
|
|
|
|
stmt.setLong(index, activityPaginationRequest.getEndTimestamp());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
try (ResultSet rs = stmt.executeQuery()) {
|
|
|
|
try (ResultSet rs = stmt.executeQuery()) {
|
|
|
|