public static Device convertToDevice(MobileDevice mobileDevice) {
    Device device = null;
    if (mobileDevice != null) {
      device = new Device();
      List<Device.Property> propertyList = new ArrayList<Device.Property>();
      propertyList.add(getProperty(MOBILE_DEVICE_IMEI, mobileDevice.getImei()));
      propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi()));
      propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel()));
      propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion()));
      propertyList.add(getProperty(MOBILE_DEVICE_OS_BUILD_DATE, mobileDevice.getOsBuildDate()));
      propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor()));
      if (mobileDevice.getLatitude() != null) {
        propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude()));
      }
      if (mobileDevice.getLongitude() != null) {
        propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude()));
      }
      propertyList.add(getProperty(MOBILE_DEVICE_SERIAL, mobileDevice.getSerial()));

      if (mobileDevice.getDeviceProperties() != null) {
        for (Map.Entry<String, String> deviceProperty :
            mobileDevice.getDeviceProperties().entrySet()) {
          propertyList.add(getProperty(deviceProperty.getKey(), deviceProperty.getValue()));
        }
      }

      device.setProperties(propertyList);
      device.setDeviceIdentifier(mobileDevice.getMobileDeviceId());
    }
    return device;
  }
 public static List<Integer> getMobileOperationIdsFromMobileDeviceOperations(
     List<MobileDeviceOperationMapping> mobileDeviceOperationMappings) {
   List<Integer> mobileOperationIds = new ArrayList<Integer>(mobileDeviceOperationMappings.size());
   for (MobileDeviceOperationMapping mobileDeviceOperationMapping :
       mobileDeviceOperationMappings) {
     mobileOperationIds.add(mobileDeviceOperationMapping.getOperationId());
   }
   return mobileOperationIds;
 }
 public static List<Feature> getMissingFeatures(
     List<Feature> supportedFeatures, List<Feature> existingFeatures) {
   HashMap<String, Feature> featureHashMap = new HashMap();
   for (Feature feature : existingFeatures) {
     featureHashMap.put(feature.getCode(), feature);
   }
   List<Feature> missingFeatures = new ArrayList<Feature>();
   for (Feature supportedFeature : supportedFeatures) {
     if (featureHashMap.get(supportedFeature.getCode()) != null) {
       continue;
     }
     missingFeatures.add(supportedFeature);
   }
   return missingFeatures;
 }
 public static MobileOperation convertToMobileOperation(Operation operation) {
   MobileOperation mobileOperation = new MobileOperation();
   MobileOperationProperty operationProperty;
   List<MobileOperationProperty> properties = new LinkedList<MobileOperationProperty>();
   mobileOperation.setFeatureCode(operation.getCode());
   mobileOperation.setCreatedDate(new Date().getTime());
   Properties operationProperties = operation.getProperties();
   for (String key : operationProperties.stringPropertyNames()) {
     operationProperty = new MobileOperationProperty();
     operationProperty.setProperty(key);
     operationProperty.setValue(operationProperties.getProperty(key));
     properties.add(operationProperty);
   }
   mobileOperation.setProperties(properties);
   return mobileOperation;
 }