public User load(final long id) { return (User) transactionTemplate.execute((TransactionCallback) transactionStatus -> sessionFactory.getCurrentSession().get(User.class, id)); }
@Override public ChannelSeverity retrieveById(int id) { return (ChannelSeverity) sessionFactory.getCurrentSession().get( ChannelSeverity.class, id); }
public Blueprint getBlueprintByIdInternal(String uuid) { Blueprint bluePrint = (Blueprint) factory.getCurrentSession().get(Blueprint.class, uuid); // updateBluePrintFromUserApplication(bluePrint); return bluePrint; }
@Override public ChannelVulnerability retrieveById(int id) { return (ChannelVulnerability) sessionFactory.getCurrentSession().get( ChannelVulnerability.class, id); }
@Override public Item findById(Integer itemId) { Item item = (Item) sessionFactory.getCurrentSession().get(Item.class, itemId); return item; }
@Override public EmptyScan retrieveById(Integer emptyScanId) { return (EmptyScan) sessionFactory.getCurrentSession().get(EmptyScan.class, emptyScanId); }
public Blueprint getBlueprintByIdInternal(String uuid) { Blueprint bluePrint = (Blueprint) factory.getCurrentSession().get(Blueprint.class, uuid); // updateBluePrintFromUserApplication(bluePrint); return bluePrint; }
@Override public Survey retrieveById(int id) { return (Survey) sessionFactory.getCurrentSession().get(Survey.class, id); }
@Override public TerritoryCategory findCategoryById(String territoryCategoryId) throws GeomajasSecurityException { return (TerritoryCategory) factory.getCurrentSession().get(TerritoryCategory.class, territoryCategoryId); }
@Override public User findById(long userId) throws GeomajasSecurityException { return (User) factory.getCurrentSession().get(User.class, userId); }
@Override public boolean deleteGroup(long groupId) throws GeomajasSecurityException { Object group = factory.getCurrentSession().get(Territory.class, groupId); if (group != null) { factory.getCurrentSession().delete(group); return true; } return false; }
@Override public Vulnerability retrieveById(int id) { Vulnerability vuln = (Vulnerability) sessionFactory.getCurrentSession() .get(Vulnerability.class, id); if (vuln != null && !vuln.isExpired()) { return vuln; } else { assert false : "Attempted to retrieve invalid vulnerability id."; return null; } }
@Override public AuthenticationSession getActiveSessionOfToken(String token) { if (token != null) { AuthenticationSession session = (AuthenticationSession) sessionFactory. getCurrentSession().get(AuthenticationSession.class, token); if (session != null && isActive(session)) { return session; } } return null; }
@Override public boolean deleteUser(long userId) throws GeomajasSecurityException { Object user = factory.getCurrentSession().get(User.class, userId); if (user != null) { factory.getCurrentSession().delete(user); return true; } return false; }
@Override public boolean deleteGroup(long groupId) throws GeomajasSecurityException { Object group = factory.getCurrentSession().get(Territory.class, groupId); if (group != null) { factory.getCurrentSession().delete(group); return true; } return false; }
@Override public boolean deleteUser(long userId) throws GeomajasSecurityException { Object user = factory.getCurrentSession().get(User.class, userId); if (user != null) { factory.getCurrentSession().delete(user); return true; } return false; }
@Override public List<GroupMember> findGroupsOfUser(long userId) { User user = (User) factory.getCurrentSession().get(User.class, userId); List<GroupMember> groups = user.getGroups(); Hibernate.initialize(groups); return groups; }
@Override public List<GroupMember> findGroupsOfUser(long userId) { User user = (User) factory.getCurrentSession().get(User.class, userId); List<GroupMember> groups = user.getGroups(); Hibernate.initialize(groups); return groups; }
public LayerModel getLayerModelById(String id) throws GeomajasSecurityException { LayerModel l = (LayerModel) factory.getCurrentSession().get(LayerModel.class, id); if (l != null) { if (((DeskmanagerSecurityContext) securityContext).readAllowed(l)) { return l; } else { throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Read layermodel", securityContext.getUserName()); } } else { return null; } }
public Geodesk getGeodeskById(String uuid) throws GeomajasSecurityException { Geodesk l = (Geodesk) factory.getCurrentSession().get(Geodesk.class, uuid); if (l != null) { if (((DeskmanagerSecurityContext) securityContext).readAllowed(l)) { return l; } else { throw new GeomajasSecurityException(ExceptionCode.COMMAND_ACCESS_DENIED, "Read Geodesk", securityContext.getUserName()); } } else { return null; } }