|
|
@ -52,25 +52,7 @@ import org.opensaml.xmlsec.signature.P;
|
|
|
|
import org.wso2.carbon.CarbonConstants;
|
|
|
|
import org.wso2.carbon.CarbonConstants;
|
|
|
|
import org.wso2.carbon.context.CarbonContext;
|
|
|
|
import org.wso2.carbon.context.CarbonContext;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.context.PrivilegedCarbonContext;
|
|
|
|
import org.wso2.carbon.device.mgt.common.ActivityPaginationRequest;
|
|
|
|
import org.wso2.carbon.device.mgt.common.*;
|
|
|
|
import org.wso2.carbon.device.mgt.common.Billing;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.Device;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceEnrollmentInfoNotification;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceManager;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceNotification;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DevicePropertyNotification;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DeviceTransferRequest;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.DynamicTaskContext;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationRequest;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.PaginationResult;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.BillingResponse;
|
|
|
|
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.MobileAppTypes;
|
|
|
|
import org.wso2.carbon.device.mgt.common.app.mgt.MobileAppTypes;
|
|
|
@ -171,17 +153,7 @@ import java.lang.reflect.Type;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.SQLException;
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
import java.sql.Timestamp;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Calendar;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.Enumeration;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
import java.util.concurrent.ExecutionException;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
@ -3707,9 +3679,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (applications != null){
|
|
|
|
|
|
|
|
this.getInstalledAppIconInfo(device);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return applications;
|
|
|
|
return applications;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -4988,16 +4957,15 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
private void getInstalledAppIconInfo(Device device) throws DeviceManagementException {
|
|
|
|
|
|
|
|
List<Application> applications = device.getApplications();
|
|
|
|
private List<Application> getInstalledAppIconInfo(List<Application> applications) throws DeviceManagementException {
|
|
|
|
String iconPath;
|
|
|
|
String iconPath;
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
for (Application app : applications) {
|
|
|
|
for (Application app : applications) {
|
|
|
|
iconPath = deviceDAO.getIconPath(app.getApplicationIdentifier());
|
|
|
|
iconPath = applicationDAO.getIconPath(app.getApplicationIdentifier());
|
|
|
|
app.setImageUrl(iconPath);
|
|
|
|
app.setImageUrl(iconPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DeviceManagementDAOFactory.commitTransaction();
|
|
|
|
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
DeviceManagementDAOFactory.rollbackTransaction();
|
|
|
|
DeviceManagementDAOFactory.rollbackTransaction();
|
|
|
|
String msg = "Error occurred while retrieving installed app icon info";
|
|
|
|
String msg = "Error occurred while retrieving installed app icon info";
|
|
|
@ -5011,5 +4979,41 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return applications;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<Application> getInstalledApplicationsOnDevice(Device device, int offset, int limit) throws DeviceManagementException {
|
|
|
|
|
|
|
|
List<Application> applications;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.openConnection();
|
|
|
|
|
|
|
|
int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
|
|
|
|
|
|
|
|
applications = applicationDAO.getInstalledApplicationListOnDevice(device.getId(),
|
|
|
|
|
|
|
|
device.getEnrolmentInfo().getId(), offset, limit, tenantId);
|
|
|
|
|
|
|
|
if (applications == null) {
|
|
|
|
|
|
|
|
String msg = "Couldn't found applications for device identifier '" + device.getId() + "'";
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
throw new DeviceManagementException(msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (DeviceManagementDAOException e) {
|
|
|
|
|
|
|
|
String msg = "Error occurred while retrieving the application list of android device, " +
|
|
|
|
|
|
|
|
"which carries the id '" + device.getId() + "'";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new DeviceManagementException(msg, e);
|
|
|
|
|
|
|
|
} catch (SQLException e) {
|
|
|
|
|
|
|
|
String msg = "Error occurred while opening a connection to the data source";
|
|
|
|
|
|
|
|
log.error(msg, e);
|
|
|
|
|
|
|
|
throw new DeviceManagementException(msg, e);
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
|
|
DeviceManagementDAOFactory.closeConnection();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Application> newApplicationList;
|
|
|
|
|
|
|
|
newApplicationList = this.getInstalledAppIconInfo(applications);
|
|
|
|
|
|
|
|
if (newApplicationList == null) {
|
|
|
|
|
|
|
|
String msg = "Error occurred while getting app icon info for device identifier '" + device.getId() + "'";
|
|
|
|
|
|
|
|
log.error(msg);
|
|
|
|
|
|
|
|
throw new DeviceManagementException(msg);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return newApplicationList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|