protected void initTimeZoneColumn() { usersTable.addGeneratedColumn("timeZone", entity -> { Label<String> label = uiComponents.create(Label.TYPE_DEFAULT); if (Boolean.TRUE.equals(entity.getTimeZoneAuto())) { label.setValue(messages.getMainMessage("timeZone.auto")); } else if (entity.getTimeZone() != null) { label.setValue(entity.getTimeZone()); } return label; }); }
/** * INTERNAL */ public UserSession(UUID id, User user, Collection<Role> roles, Locale locale, boolean system) { this.id = id; this.user = user; this.system = system; for (Role role : roles) { this.roles.add(role.getName()); if (role.getType() != null) roleTypes.add(role.getType()); } this.locale = locale; if (user.getTimeZone() != null) this.timeZone = TimeZone.getTimeZone(user.getTimeZone()); //noinspection unchecked permissions = new Map[PermissionType.values().length]; for (int i = 0; i < permissions.length; i++) { permissions[i] = new HashMap<>(); } constraints = new HashMap<>(); attributes = new ConcurrentHashMap<>(); localAttributes = new ConcurrentHashMap<>(); }
@Override public UserTimeZone loadOwnTimeZone() { Transaction tx = persistence.createTransaction(); try { EntityManager em = persistence.getEntityManager(); User user = em.find(User.class, userSessionSource.getUserSession().getUser().getId(), "user.timeZone"); if (user == null) throw new EntityAccessException(User.class, userSessionSource.getUserSession().getUser().getId()); tx.commit(); return new UserTimeZone(user.getTimeZone(), Boolean.TRUE.equals(user.getTimeZoneAuto())); } finally { tx.end(); } }
public UserInfo(User user) { this.login = user.getLogin(); this.name = user.getName(); this.timeZone = user.getTimeZone(); this.language = user.getLanguage(); } }
public UserInfo(User user) { this.id = user.getId().toString(); this.login = user.getLogin(); this.name = user.getName(); this.firstName = user.getFirstName(); this.middleName = user.getMiddleName(); this.lastName = user.getLastName(); this.position = user.getPosition(); this.email = user.getEmail(); this.timeZone = user.getTimeZone(); this._instanceName = user.getInstanceName(); this.language = user.getLanguage(); }