Dileesha Rajapakse 9 years ago
commit 4fc895588b

@ -335,7 +335,7 @@ public class AndroidDeviceManager implements DeviceManager {
List<MobileDevice> mobileDevices =
daoFactory.getMobileDeviceDAO().getAllMobileDevices();
if (mobileDevices != null) {
devices = new ArrayList<>();
devices = new ArrayList<>(mobileDevices.size());
for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
}

@ -64,7 +64,7 @@ public class AndroidFeatureManager implements FeatureManager {
@Override
public boolean addFeatures(List<Feature> features) throws DeviceManagementException {
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>();
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(features.size());
for (Feature feature : features) {
mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature));
}
@ -96,9 +96,9 @@ public class AndroidFeatureManager implements FeatureManager {
@Override
public List<Feature> getFeatures() throws DeviceManagementException {
List<Feature> featureList = new ArrayList<Feature>();
try {
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
}

@ -61,8 +61,6 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
if (compliancePayload == null || policy == null) {
return complianceData;
}
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>();
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
String compliancePayloadString = new Gson().toJson(compliancePayload);
// Parsing json string to get compliance features.
JsonElement jsonElement;
@ -75,6 +73,8 @@ public class AndroidPolicyMonitoringService implements PolicyMonitoringService {
JsonArray jsonArray = jsonElement.getAsJsonArray();
Gson gson = new Gson();
ComplianceFeature complianceFeature;
List<ComplianceFeature> complianceFeatures = new ArrayList<ComplianceFeature>(jsonArray.size());
List<ComplianceFeature> nonComplianceFeatures = new ArrayList<>();
for (JsonElement element : jsonArray) {
complianceFeature = gson.fromJson(element, ComplianceFeature.class);

@ -43,7 +43,7 @@ public class GCMService {
}
public void sendNotification(String messageData, Device device) {
List<Device> devices = new ArrayList<>();
List<Device> devices = new ArrayList<>(1);
devices.add(device);
GCMResult result = GCMUtil.sendWakeUpCall(messageData, devices);
if (result.getStatusCode() != 200) {

@ -123,6 +123,9 @@ public class GCMUtil {
//Set device reg-ids
JsonArray regIds = new JsonArray();
for (String regId : registrationIds) {
if (regId == null && regId.isEmpty()) {
continue;
}
regIds.add(new JsonPrimitive(regId));
}
@ -131,7 +134,7 @@ public class GCMUtil {
}
private static List<String> getGCMTokens(List<Device> devices) {
List<String> tokens = new ArrayList<>();
List<String> tokens = new ArrayList<>(devices.size());
for (Device device : devices) {
tokens.add(getGCMToken(device.getProperties()));
}

@ -193,7 +193,7 @@ public class WindowsDeviceManager implements DeviceManager {
WindowsDAOFactory.openConnection();
List<MobileDevice> mobileDevices = daoFactory.getMobileDeviceDAO().getAllMobileDevices();
if (mobileDevices != null) {
devices = new ArrayList<>();
devices = new ArrayList<>(mobileDevices.size());
for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
}

@ -58,7 +58,7 @@ public class WindowsFeatureManager implements FeatureManager {
@Override
public boolean addFeatures(List<Feature> features) throws DeviceManagementException {
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>();
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>(features.size());
for (Feature feature : features) {
mobileFeatures.add(MobileDeviceManagementUtil.convertToMobileFeature(feature));
}
@ -92,10 +92,10 @@ public class WindowsFeatureManager implements FeatureManager {
@Override
public List<Feature> getFeatures() throws DeviceManagementException {
List<Feature> featureList = new ArrayList<Feature>();
try {
WindowsDAOFactory.openConnection();
List<MobileFeature> mobileFeatures = featureDAO.getAllFeatures();
List<Feature> featureList = new ArrayList<Feature>(mobileFeatures.size());
for (MobileFeature mobileFeature : mobileFeatures) {
featureList.add(MobileDeviceManagementUtil.convertToFeature(mobileFeature));
}

@ -165,7 +165,7 @@ public class MobileDeviceManagementUtil {
public static List<Integer> getMobileOperationIdsFromMobileDeviceOperations(
List<MobileDeviceOperationMapping> mobileDeviceOperationMappings) {
List<Integer> mobileOperationIds = new ArrayList<Integer>();
List<Integer> mobileOperationIds = new ArrayList<Integer>(mobileDeviceOperationMappings.size());
for (MobileDeviceOperationMapping mobileDeviceOperationMapping : mobileDeviceOperationMappings) {
mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId());
}

@ -577,7 +577,7 @@
<carbon.deployment.version>4.6.0</carbon.deployment.version>
<!-- Identity -->
<carbon.identity.version>5.0.5</carbon.identity.version>
<carbon.identity.version>5.0.7</carbon.identity.version>
<!-- Multi-tenancy -->
<carbon.multitenancy.version>4.5.0</carbon.multitenancy.version>

Loading…
Cancel
Save