public static DeviceIdentifier instantiateDeviceIdentifier(String deviceType, String deviceId) { DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); deviceIdentifier.setType(deviceType); deviceIdentifier.setId(deviceId); return deviceIdentifier; }
public static PaginationResult getPagingResponse(int recordsTotal, int recordsFiltered, int draw, List<?> data) { PaginationResult pagingResponse = new PaginationResult(); pagingResponse.setRecordsTotal(recordsTotal); pagingResponse.setRecordsFiltered(recordsFiltered); pagingResponse.setDraw(draw); pagingResponse.setData(data); return pagingResponse; } }
private static Device.Property getProperty(String property, String value) { if (property != null) { Device.Property prop = new Device.Property(); prop.setName(property); prop.setValue(value); return prop; } return null; }
private List<DeviceIdentifier> convertDevices(List<Device> devices) { List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); for (Device device : devices) { DeviceIdentifier identifier = new DeviceIdentifier(); identifier.setId(device.getDeviceIdentifier()); identifier.setType(device.getType()); deviceIdentifiers.add(identifier); } return deviceIdentifiers; }
public DeviceTypeMetaDefinition getDeviceTypeMetaDefinition() { DeviceTypeMetaDefinition deviceTypeMetaDefinition = new DeviceTypeMetaDefinition(); deviceTypeMetaDefinition.setProperties(properties); deviceTypeMetaDefinition.setFeatures(features); deviceTypeMetaDefinition.setClaimable(claimable); deviceTypeMetaDefinition.setPushNotificationConfig(pushNotificationConfig); // deviceTypeMetaDefinition.setPolicyMonitoringEnabled(policyMonitoringEnabled); // deviceTypeMetaDefinition.setInitialOperationConfig(initialOperationConfig); deviceTypeMetaDefinition.setLicense(license); deviceTypeMetaDefinition.setDescription(description); return deviceTypeMetaDefinition; } }
public static Feature convertToFeature(MobileFeature mobileFeature) { Feature feature = new Feature(); feature.setDescription(mobileFeature.getDescription()); feature.setDeviceType(mobileFeature.getDeviceType()); feature.setCode(mobileFeature.getCode()); feature.setName(mobileFeature.getName()); return feature; }
@Override public void markDeviceAsCompliance(DeviceIdentifier deviceIdentifier) throws PolicyComplianceException { try { DeviceManagementProviderService service = this.getDeviceManagementProviderService(); Device device = service.getDevice(deviceIdentifier, false); service.setStatus(deviceIdentifier, device.getEnrolmentInfo().getOwner(), EnrolmentInfo.Status.ACTIVE); } catch (DeviceManagementException e) { String msg = "Error occurred while marking device as compliance " + deviceIdentifier.getId() + " - " + deviceIdentifier.getType(); log.error(msg, e); } }
public static MobileFeature convertToMobileFeature(Feature feature) { MobileFeature mobileFeature = new MobileFeature(); mobileFeature.setName(feature.getName()); mobileFeature.setCode(feature.getCode()); mobileFeature.setDescription(feature.getDescription()); mobileFeature.setDeviceType(feature.getDeviceType()); return mobileFeature; }
private static String getPropertyValue(Device device, String property) { for (Device.Property prop : device.getProperties()) { if (property.equals(prop.getName())) { return prop.getValue(); } } return null; }
@Override public boolean equals(Object obj) { if (obj instanceof EnrolmentInfo) { EnrolmentInfo tempInfo = (EnrolmentInfo) obj; if (this.owner != null && this.ownership != null) { if (this.owner.equalsIgnoreCase(tempInfo.getOwner()) && this.ownership.equals( tempInfo.getOwnership())) { return true; } } } return false; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Device)) { return false; } Device device = (Device) o; return getDeviceIdentifier().equals(device.getDeviceIdentifier()); }
private static org.wso2.carbon.device.mgt.common.Feature.MetadataEntry map(MetadataEntry metadataEntry) { org.wso2.carbon.device.mgt.common.Feature.MetadataEntry rv = new org.wso2.carbon.device.mgt.common.Feature.MetadataEntry(); rv.setId(metadataEntry.getId()); rv.setValue(metadataEntry.getValue()); return rv; }
private static PushNotificationConfig map( org.wso2.carbon.device.mgt.common.PushNotificationConfig pushNotificationConfig) { PushNotificationConfig rv = new PushNotificationConfig(); rv.setType(pushNotificationConfig.getType()); rv.setProperties(pushNotificationConfig.getProperties()); rv.setIsScheduled(pushNotificationConfig.isScheduled()); return rv; }
@Override public ProvisioningConfig getProvisioningConfig() { return new ProvisioningConfig(DEVICE_TYPE_PROVIDER_DOMAIN, false); }
public static Connection getConnection() { Connection conn = currentConnection.get(); if (conn == null) { throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + "This might have ideally been caused by not properly initiating the transaction via " + "'beginTransaction'/'openConnection' methods"); } return conn; }
private List<DeviceIdentifier> getDeviceIdentifiersFromDevices(List<Device> devices) { List<DeviceIdentifier> deviceIdentifiers = new ArrayList<>(); for (Device device : devices) { DeviceIdentifier identifier = new DeviceIdentifier(); identifier.setId(device.getDeviceIdentifier()); identifier.setType(device.getType()); deviceIdentifiers.add(identifier); } return deviceIdentifiers; }
public static Device.Property getProperty(String property, String value) { if (property != null) { Device.Property prop = new Device.Property(); prop.setName(property); prop.setValue(value); return prop; } return null; }