@ -243,28 +243,30 @@ public class ApplicationOperationsImpl implements ApplicationOperations {
/ * *
/ * *
* @param applicationOperationDevice holds the information needs to retrieve device list .
* @param applicationOperationDevice holds the information needs to retrieve device list .
* @return List of devices
* @return List of devices
* @throws MobileApplicationException
* @throws MobileApplicationException If unexpected error occur in getting devices or if app platform is not supported .
* /
* /
public List < Device > getDevices ( ApplicationOperationDevice applicationOperationDevice )
public List < Device > getDevices ( ApplicationOperationDevice applicationOperationDevice )
throws MobileApplicationException {
throws MobileApplicationException {
List < Device > devices ;
List < Device > devices ;
List < org . wso2 . carbon . device . mgt . common . Device > deviceList = null ;
List < org . wso2 . carbon . device . mgt . common . Device > deviceList ;
try {
try {
DeviceManagementProviderService deviceManagementService = MDMServiceAPIUtils
DeviceManagementProviderService deviceManagementService = MDMServiceAPIUtils
. getDeviceManagementService ( applicationOperationDevice . getTenantId ( ) ) ;
. getDeviceManagementService ( applicationOperationDevice . getTenantId ( ) ) ;
final String username = applicationOperationDevice . getCurrentUser ( ) . getUsername ( ) ;
final String username = applicationOperationDevice . getCurrentUser ( ) . getUsername ( ) ;
if ( MDMAppConstants . WEBAPP . equals
final String platform = applicationOperationDevice . getPlatform ( ) ;
( applicationOperationDevice . getPlatform ( ) ) ) {
switch ( platform ) {
deviceList = deviceManagementService .
case MDMAppConstants . WEBAPP :
getDevicesOfUser ( username ) ;
deviceList = deviceManagementService . getDevicesOfUser ( username ) ;
} else {
break ;
deviceList = deviceManagementService .
case MDMAppConstants . ANDROID :
getDevicesOfUser ( username ,
deviceList = deviceManagementService . getDevicesOfUser ( username , MDMAppConstants . ANDROID ) ;
MDMAppConstants . ANDROID ) ;
break ;
deviceList . addAll ( deviceManagementService .
case MDMAppConstants . IOS :
getDevicesOfUser ( username ,
deviceList = deviceManagementService . getDevicesOfUser ( username , MDMAppConstants . IOS ) ;
MDMAppConstants . IOS ) ) ;
break ;
default :
throw new MobileApplicationException ( "App platform:" + platform + "is not supported." ) ;
}
}
devices = new ArrayList < > ( deviceList . size ( ) ) ;
devices = new ArrayList < > ( deviceList . size ( ) ) ;
if ( log . isDebugEnabled ( ) ) {
if ( log . isDebugEnabled ( ) ) {