/** * Returns whether the device supports layout. * @return True if the device supports layout. */ public boolean isLayout() { return type != null && type.isLayout(); } }
/** * Returns the device type. * @return The device type. */ public String getType() { return type != null ? type : DeviceType.HTML.toString(); }
public Device(UUID id, DeviceType type, String name, String description, Integer width, UserAgentPattern userAgent, Map<String, String> properties) { super(id); this.type = checkNotNull(type); this.name = checkNotNull(name); this.description = description; if (type.isLayout()) { this.width = width != null ? width : type.getWidth(); } else { this.width = null; } if (userAgent == null) { this.userAgent = UserAgentPattern.none(); } else { this.userAgent = userAgent; } if (properties == null) { this.properties = ImmutableMap.of(); } else { this.properties = ImmutableMap.copyOf(properties); } }
/** * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet() */ public void afterPropertiesSet() throws Exception { UserEntity root = user.getRootUser(); device.findOrCreate(root, DeviceType.HTML, DeviceManager.DEFAULT, "The Web", true, DeviceType.HTML.getWidth()); context.setEnvironmentId(environment.getDefaultEnvironment(root).getId()); try { migrations.publishedFlag(); } catch (Exception e) { Loggers.pms().error("Unable to perform published flag migration", e); } } }
public DefaultDeviceCapabilities(Device device) { Preconditions.checkNotNull(device); this.xhtml = DeviceType.XHTML.equals(device.getType()); this.html = DeviceType.HTML.equals(device.getType()); this.width = device.getWidth() == null ? 0 : device.getWidth(); this.caps = ImmutableMap.<String, String> of(); }
/** * Returns whether the device supports layout. * @return True if the device supports layout. */ public boolean isLayout() { return type.isLayout(); }
/** * @see com.isotrol.impe3.pms.core.DeviceManager#findOrCreate(com.isotrol.impe3.pms.model.UserEntity, * com.isotrol.impe3.api.DeviceType, java.lang.String, java.lang.String, boolean, java.lang.Integer) */ @Transactional(rollbackFor = Throwable.class) public DeviceEntity findOrCreate(UserEntity user, DeviceType type, String name, String description, boolean layout, Integer width) throws PMSException { DeviceEntity device = getDao().getDeviceByName(name); if (device != null) { return device; } device = new DeviceEntity(); device.setCreated(user); device.setUpdated(user); device.setType(type.toString()); device.setName(name); device.setDescription(description); device.setWidth(width); saveNewEntity(device); return device; }
private static void validate(DeviceDTO dto) { checkNotNull(dto); checkArgument(dto.getName() != null); checkArgument(dto.getType() != null); checkArgument(!dto.getType().isLayout() || dto.getWidth() != null); }