/** * Creates a device in portal key with no use. * @param device Device. * @return The requested key. */ public static DeviceInPortal of(final Device device) { return of(device, DeviceNameUse.NONE); }
/** * Creates a device in portal key. * @param device Device. * @param use Device name use. * @return The requested key. */ public static DeviceInPortal of(final Device device, final DeviceNameUse use) { return of(device, device.getName(), use); }
@Override protected void checkState() { Preconditions.checkState(device != null, DEVICE_ERROR); if (devices == null) { final DeviceInPortal dip = DeviceInPortal.of(device); devices = ImmutableSet.of(dip); } else { Preconditions.checkState(any(transform(devices, DeviceInPortal.DEVICE), equalTo(device)), DEF_DEVICE_ERROR); } Preconditions.checkState(name != null, NAME_ERROR); Preconditions.checkState(contentTypes != null, CT_ERROR); Preconditions.checkState(categories != null, CG_ERROR); Preconditions.checkState(locales.contains(defaultLocale), AL_ERROR); } }
public DeviceInPortal apply(DiPObj from) { final Device d = devicesModel.get(from.getDeviceId()); return DeviceInPortal.of(d, from.getName(), from.getUse()); } };