Modify View Activities endpoint by including operation id

master
Sasini Sandamali 1 year ago
parent 9011273ff4
commit 26a049473c

@ -466,6 +466,11 @@ public interface ActivityInfoProviderService {
value = "Operation Code to filter"
)
@QueryParam("operationCode") String operationCode,
@ApiParam(
name = "operationId",
value = "Operation Id to filter"
)
@QueryParam("operationId") int operationId,
@ApiParam(
name = "deviceType",
value = "Device Type to filter"

@ -253,6 +253,7 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
@QueryParam("since") String since,
@QueryParam("initiatedBy") String initiatedBy,
@QueryParam("operationCode") String operationCode,
@QueryParam("operationId") int operationId,
@QueryParam("deviceType") String deviceType,
@QueryParam("deviceId") List<String> deviceIds,
@QueryParam("type") String type,
@ -321,6 +322,9 @@ public class ActivityProviderServiceImpl implements ActivityInfoProviderService
if (operationCode != null && !operationCode.isEmpty()) {
activityPaginationRequest.setOperationCode(operationCode);
}
if (operationId > 0) {
activityPaginationRequest.setOperationId(operationId);
}
if (deviceType != null && !deviceType.isEmpty()) {
activityPaginationRequest.setDeviceType(deviceType);
}

@ -32,6 +32,7 @@ public class ActivityPaginationRequest {
private String deviceType;
private List<String> deviceIds;
private String operationCode;
private int operationId;
private String initiatedBy;
private long since;
private Operation.Type type;
@ -132,4 +133,12 @@ public class ActivityPaginationRequest {
public void setEndTimestamp(long 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")
private String code;
@ApiModelProperty(
name = "operationId",
value = "Operation Id",
required = false,
example = "10")
@JsonProperty("operationId")
private int operationId;
@ApiModelProperty(
name = "type",
value = "Activity type",
@ -122,6 +130,14 @@ public class Activity {
this.code = code;
}
public int getOperationId() {
return operationId;
}
public void setOperationId(int operationId) {
this.operationId = operationId;
}
public Type getType() {
return type;
}

@ -2233,6 +2233,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
}
sql.append("?) ");
}
if (activityPaginationRequest.getOperationId() > 0) {
sql.append("AND OPERATION_ID = ? ");
}
if (activityPaginationRequest.getOperationCode() != null) {
sql.append("AND OPERATION_CODE = ? ");
}
@ -2269,6 +2272,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
if (activityPaginationRequest.getOperationCode() != null) {
sql.append("AND eom.OPERATION_CODE = ? ");
}
if (activityPaginationRequest.getOperationId() > 0) {
sql.append("AND eom.OPERATION_ID = ? ");
}
if (activityPaginationRequest.getInitiatedBy() != null) {
sql.append("AND eom.INITIATED_BY = ? ");
}
@ -2301,6 +2307,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
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());
}
@ -2333,6 +2342,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
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());
}
@ -2390,6 +2402,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
if (activityPaginationRequest.getOperationCode() != null) {
sql.append("AND OPERATION_CODE = ? ");
}
if (activityPaginationRequest.getOperationId() > 0) {
sql.append("AND OPERATION_ID = ? ");
}
if (activityPaginationRequest.getInitiatedBy() != null) {
sql.append("AND INITIATED_BY = ? ");
}
@ -2421,6 +2436,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
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());
}

@ -248,6 +248,7 @@ public class OperationDAOUtil {
activity.setCreatedTimeStamp(
new java.util.Date(rs.getLong(("CREATED_TIMESTAMP")) * 1000).toString());
activity.setCode(rs.getString("OPERATION_CODE"));
activity.setOperationId(rs.getInt("OPERATION_ID"));
activity.setInitiatedBy(rs.getString("INITIATED_BY"));
DeviceIdentifier deviceIdentifier = new DeviceIdentifier();

Loading…
Cancel
Save