diff --git a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java index 642107afc19..d36c0e25128 100644 --- a/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java +++ b/components/application-mgt/io.entgra.application.mgt.store.api/src/main/java/io/entgra/application/mgt/store/api/services/impl/util/RequestValidationUtil.java @@ -50,11 +50,22 @@ public class RequestValidationUtil { case "REMOVED": case "BLOCKED": case "CREATED": + case "CONFIGURED": + case "READY_TO_CONNECT": + case "RETURN_PENDING": + case "RETURNED": + case "DEFECTIVE": + case "WARRANTY_PENDING": + case "WARRANTY_SENT": + case "WARRANTY_REPLACED": + case "ASSIGNED": break; default: String msg = "Invalid enrollment status type: " + status + ". \nValid status types " + "are ACTIVE | INACTIVE | UNCLAIMED | UNREACHABLE | SUSPENDED | " + - "DISENROLLMENT_REQUESTED | REMOVED | BLOCKED | CREATED"; + "DISENROLLMENT_REQUESTED | REMOVED | BLOCKED | CREATED | CONFIGURED | READY_TO_CONNECT | " + + "RETURN_PENDING | RETURNED | DEFECTIVE | WARRANTY_PENDING | WARRANTY_SENT | " + + "WARRANTY_REPLACED | ASSIGNED |"; log.error(msg); throw new BadRequestException(msg); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java index 1308dfa9700..b41d39158b5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/util/RequestValidationUtil.java @@ -153,11 +153,21 @@ public class RequestValidationUtil { case "REMOVED": case "BLOCKED": case "CREATED": + case "CONFIGURED": + case "READY_TO_CONNECT": + case "RETURN_PENDING": + case "RETURNED": + case "DEFECTIVE": + case "WARRANTY_PENDING": + case "WARRANTY_SENT": + case "WARRANTY_REPLACED": + case "ASSIGNED": break; default: String msg = "Invalid enrollment status type: " + status + ". \nValid status types are " + "ACTIVE | INACTIVE | UNCLAIMED | UNREACHABLE | SUSPENDED | " + - "DISENROLLMENT_REQUESTED | REMOVED | BLOCKED | CREATED"; + "DISENROLLMENT_REQUESTED | REMOVED | BLOCKED | CREATED | CONFIGURED | READY_TO_CONNECT | " + + "RETURN_PENDING | RETURNED | DEFECTIVE | WARRANTY_PENDING | WARRANTY_SENT | WARRANTY_REPLACED | ASSIGNED "; log.error(msg); throw new InputValidationException(new ErrorResponse.ErrorResponseBuilder() .setCode(HttpStatus.SC_BAD_REQUEST) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 91b549d9e63..089bb4cf034 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -26,6 +26,7 @@ import java.util.Date; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.el.lang.ELSupport; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceBilling; @@ -211,6 +212,24 @@ public final class DeviceManagementDAOUtil { return enrolmentInfos.get(EnrolmentInfo.Status.SUSPENDED); } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.BLOCKED)) { return enrolmentInfos.get(EnrolmentInfo.Status.BLOCKED); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.CONFIGURED)) { + return enrolmentInfos.get(EnrolmentInfo.Status.CONFIGURED); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.READY_TO_CONNECT)) { + return enrolmentInfos.get(EnrolmentInfo.Status.READY_TO_CONNECT); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.RETURN_PENDING)) { + return enrolmentInfos.get(EnrolmentInfo.Status.RETURN_PENDING); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.RETURNED)) { + return enrolmentInfos.get(EnrolmentInfo.Status.RETURNED); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.DEFECTIVE)) { + return enrolmentInfos.get(EnrolmentInfo.Status.DEFECTIVE); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.WARRANTY_PENDING)) { + return enrolmentInfos.get(EnrolmentInfo.Status.WARRANTY_PENDING); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.WARRANTY_SENT)) { + return enrolmentInfos.get(EnrolmentInfo.Status.WARRANTY_SENT); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.WARRANTY_REPLACED)) { + return enrolmentInfos.get(EnrolmentInfo.Status.WARRANTY_REPLACED); + } else if (enrolmentInfos.containsKey(EnrolmentInfo.Status.ASSIGNED)) { + return enrolmentInfos.get(EnrolmentInfo.Status.ASSIGNED); } return enrolmentInfo; }