Modify View Activities endpoint by including operation id

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

@ -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;
} }

@ -2233,6 +2233,9 @@ public class GenericOperationDAOImpl implements OperationDAO {
} }
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 = ? ");
} }
@ -2269,6 +2272,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 = ? ");
} }
@ -2301,6 +2307,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());
} }
@ -2333,6 +2342,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());
} }
@ -2390,6 +2402,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 = ? ");
} }
@ -2421,6 +2436,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());
} }

@ -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();

Loading…
Cancel
Save