Added new operation status

master
Rushdi Mohamed 3 years ago
parent 78824205c1
commit fd82162909

@ -610,10 +610,12 @@ public class RequestValidationUtil {
|| Constants.OperationStatus.NOTNOW.toUpperCase().equals(status.get(i)) || Constants.OperationStatus.NOTNOW.toUpperCase().equals(status.get(i))
|| Constants.OperationStatus.REPEATED.toUpperCase().equals(status.get(i)) || Constants.OperationStatus.REPEATED.toUpperCase().equals(status.get(i))
|| Constants.OperationStatus.PENDING.toUpperCase().equals(status.get(i)) || Constants.OperationStatus.PENDING.toUpperCase().equals(status.get(i))
|| Constants.OperationStatus.IN_PROGRESS.toUpperCase().equals(status.get(i))) { || Constants.OperationStatus.IN_PROGRESS.toUpperCase().equals(status.get(i))
|| Constants.OperationStatus.REQUIRE_CONFIRMATION.toUpperCase().equals(status.get(i))
|| Constants.OperationStatus.CONFIRMED.toUpperCase().equals(status.get(i))) {
} else { } else {
String msg = "Invalid status type: " + status + ". \nValid status types are COMPLETED | ERROR | " + String msg = "Invalid status type: " + status + ". \nValid status types are COMPLETED | ERROR | " +
"IN_PROGRESS | NOTNOW | PENDING | REPEATED"; "IN_PROGRESS | NOTNOW | PENDING | REPEATED | REQUIRE_CONFIRMATION | CONFIRMED";
log.error(msg); log.error(msg);
throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder() throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder()
.setCode(HttpStatus.SC_BAD_REQUEST) .setCode(HttpStatus.SC_BAD_REQUEST)

@ -68,6 +68,8 @@ public class Constants {
public static final String PENDING = "pending"; public static final String PENDING = "pending";
public static final String NOTNOW = "notnow"; public static final String NOTNOW = "notnow";
public static final String REPEATED = "repeated"; public static final String REPEATED = "repeated";
public static final String REQUIRE_CONFIRMATION = "require_confirmation";
public static final String CONFIRMED = "confirmed";
} }
public static final String DEVICES = "devices"; public static final String DEVICES = "devices";
public static final String ATTRIBUTE_DISPLAY_NAME = "DisplayName"; public static final String ATTRIBUTE_DISPLAY_NAME = "DisplayName";

@ -959,9 +959,15 @@ public class DeviceMgtAPIUtils {
case Constants.OperationStatus.REPEATED: case Constants.OperationStatus.REPEATED:
operation.setStatus(Operation.Status.REPEATED); operation.setStatus(Operation.Status.REPEATED);
break; break;
case Constants.OperationStatus.REQUIRE_CONFIRMATION:
operation.setStatus(Operation.Status.REQUIRE_CONFIRMATION);
break;
case Constants.OperationStatus.CONFIRMED:
operation.setStatus(Operation.Status.CONFIRMED);
break;
default: default:
String msg = "Invalid operation status. Valid operations: " + String msg = "Invalid operation status. Valid operations: " +
"[IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW]"; "[IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW, REQUIRE_CONFIRMATION, CONFIRMED]";
log.error(msg); log.error(msg);
throw new BadRequestException(msg); throw new BadRequestException(msg);
} }

@ -30,7 +30,7 @@ import java.util.List;
public class ActivityStatus { public class ActivityStatus {
public enum Status { public enum Status {
IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, INVALID, UNAUTHORIZED, NOTNOW IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, INVALID, UNAUTHORIZED, NOTNOW, REQUIRE_CONFIRMATION, CONFIRMED
} }
@ApiModelProperty( @ApiModelProperty(

@ -37,7 +37,7 @@ public class Operation implements Serializable {
} }
public enum Status { public enum Status {
IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW, REQUIRE_CONFIRMATION, CONFIRMED
} }
public enum Control { public enum Control {

@ -30,7 +30,7 @@ public class Operation implements Serializable {
} }
public enum Status { public enum Status {
IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW IN_PROGRESS, PENDING, COMPLETED, ERROR, REPEATED, NOTNOW, REQUIRE_CONFIRMATION, CONFIRMED
} }
public enum Control { public enum Control {

Loading…
Cancel
Save