diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java index 97c1ae5dee..c37417ac61 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/BlacklistApplications.java @@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.bean; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; -import javax.validation.constraints.Pattern; import javax.validation.constraints.Size; import java.io.Serializable; import java.util.List; @@ -36,7 +35,6 @@ public class BlacklistApplications extends AndroidOperation implements Serializa @ApiModelProperty(name = "appIdentifiers", value = "A list of application package names to be blacklisted.", required = true) @Size(min = 2, max = 45) - @Pattern(regexp = "^[A-Za-z0-9]*$") private List appIdentifiers; public List getAppIdentifier() { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java index 3abf32c22c..32b107bf46 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/bean/wrapper/BlacklistApplicationsBeanWrapper.java @@ -32,16 +32,15 @@ import java.util.List; public class BlacklistApplicationsBeanWrapper { @ApiModelProperty(name = "operation", value = "Blacklist applications information", required = true) - @Valid - private BlacklistApplications operation; + private @Valid BlacklistApplications operation; @ApiModelProperty(name = "deviceIDs", value = "List of device Ids", required = true) private List deviceIDs; - public BlacklistApplications getOperation() { + public @Valid BlacklistApplications getOperation() { return operation; } - public void setOperation(BlacklistApplications operation) { + public void setOperation(@Valid BlacklistApplications operation) { this.operation = operation; } diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java index a23eedb331..d923e49bde 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/DeviceManagementAdminService.java @@ -24,6 +24,7 @@ import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.common.operation.mgt.Activity; import org.wso2.carbon.mdm.services.android.bean.wrapper.*; +import javax.validation.Valid; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -961,7 +962,7 @@ public interface DeviceManagementAdminService { Response blacklistApplications( @ApiParam(name = "blacklistApplicationsBeanWrapper", value = "BlacklistApplications " + "Configuration and DeviceIds") - BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper); + @Valid BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper); @POST @Path("/upgrade-firmware") diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java index 20283b727f..b5eecd3e78 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/DeviceManagementAdminServiceImpl.java @@ -25,43 +25,15 @@ import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException; import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation; import org.wso2.carbon.device.mgt.core.operation.mgt.ProfileOperation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationInstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUninstallation; -import org.wso2.carbon.mdm.services.android.bean.ApplicationUpdate; -import org.wso2.carbon.mdm.services.android.bean.BlacklistApplications; -import org.wso2.carbon.mdm.services.android.bean.Camera; -import org.wso2.carbon.mdm.services.android.bean.DeviceEncryption; -import org.wso2.carbon.mdm.services.android.bean.DeviceLock; -import org.wso2.carbon.mdm.services.android.bean.ErrorResponse; -import org.wso2.carbon.mdm.services.android.bean.LockCode; -import org.wso2.carbon.mdm.services.android.bean.Notification; -import org.wso2.carbon.mdm.services.android.bean.PasscodePolicy; -import org.wso2.carbon.mdm.services.android.bean.UpgradeFirmware; -import org.wso2.carbon.mdm.services.android.bean.Vpn; -import org.wso2.carbon.mdm.services.android.bean.WebClip; -import org.wso2.carbon.mdm.services.android.bean.Wifi; -import org.wso2.carbon.mdm.services.android.bean.WipeData; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationInstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUninstallationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.ApplicationUpdateBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.BlacklistApplicationsBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.CameraBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.DeviceLockBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.EncryptionBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.LockCodeBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.NotificationBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.PasswordPolicyBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.UpgradeFirmwareBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.VpnBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WebClipBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WifiBeanWrapper; -import org.wso2.carbon.mdm.services.android.bean.wrapper.WipeDataBeanWrapper; +import org.wso2.carbon.mdm.services.android.bean.*; +import org.wso2.carbon.mdm.services.android.bean.wrapper.*; import org.wso2.carbon.mdm.services.android.exception.BadRequestException; import org.wso2.carbon.mdm.services.android.exception.UnexpectedServerErrorException; import org.wso2.carbon.mdm.services.android.services.DeviceManagementAdminService; import org.wso2.carbon.mdm.services.android.util.AndroidAPIUtils; import org.wso2.carbon.mdm.services.android.util.AndroidConstants; +import javax.validation.Valid; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -556,7 +528,7 @@ public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminSe @POST @Path("/blacklist-applications") @Override - public Response blacklistApplications(BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) { + public Response blacklistApplications(@Valid BlacklistApplicationsBeanWrapper blacklistApplicationsBeanWrapper) { if (log.isDebugEnabled()) { log.debug("Invoking 'Blacklist-Applications' operation"); }