public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); if (getType() != null) { // Only validate the graph if we have a device type - that means we validate only if there // actually is a fully hydrated graph, not just a discovered device of which we haven't even // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device // type. Now that is a risky assumption... errors.addAll(getVersion().validate()); if(getIdentity() != null) { errors.addAll(getIdentity().validate()); } if (getDetails() != null) { errors.addAll(getDetails().validate()); } if (hasServices()) { for (Service service : getServices()) { if (service != null) errors.addAll(service.validate()); } } if (hasEmbeddedDevices()) { for (Device embeddedDevice : getEmbeddedDevices()) { if (embeddedDevice != null) errors.addAll(embeddedDevice.validate()); } } } return errors; }
public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList(); if (getType() != null) { // Only validate the graph if we have a device type - that means we validate only if there // actually is a fully hydrated graph, not just a discovered device of which we haven't even // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device // type. Now that is a risky assumption... errors.addAll(getVersion().validate()); if (getDetails() != null) { errors.addAll(getDetails().validate()); } if (hasServices()) { for (Service service : getServices()) { if (service != null) errors.addAll(service.validate()); } } if (hasEmbeddedDevices()) { for (Device embeddedDevice : getEmbeddedDevices()) { if (embeddedDevice != null) errors.addAll(embeddedDevice.validate()); } } } return errors; }
public void createLocalDevice() throws ValidationException { String version = ""; try { version = ctx.getPackageManager().getPackageInfo(ctx.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Application version name not found"); } DeviceDetails details = new DeviceDetails( SettingsActivity.getSettingContentDirectoryName(ctx), new ManufacturerDetails(ctx.getString(R.string.app_name), ctx.getString(R.string.app_url)), new ModelDetails(ctx.getString(R.string.app_name), ctx.getString(R.string.app_url)), ctx.getString(R.string.app_name), version); List<ValidationError> l = details.validate(); for( ValidationError v : l ) { Log.e(TAG, "Validation pb for property "+ v.getPropertyName()); Log.e(TAG, "Error is " + v.getMessage()); } DeviceType type = new UDADeviceType("MediaServer", 1); localDevice = new LocalDevice(new DeviceIdentity(udn), type, details, localService); }
public List<ValidationError> validate() { List<ValidationError> errors = new ArrayList<>(); if (getType() != null) { // Only validate the graph if we have a device type - that means we validate only if there // actually is a fully hydrated graph, not just a discovered device of which we haven't even // retrieved the descriptor yet. This assumes that the descriptor will ALWAYS contain a device // type. Now that is a risky assumption... errors.addAll(getVersion().validate()); if(getIdentity() != null) { errors.addAll(getIdentity().validate()); } if (getDetails() != null) { errors.addAll(getDetails().validate()); } if (hasServices()) { for (Service service : getServices()) { if (service != null) errors.addAll(service.validate()); } } if (hasEmbeddedDevices()) { for (Device embeddedDevice : getEmbeddedDevices()) { if (embeddedDevice != null) errors.addAll(embeddedDevice.validate()); } } } return errors; }