@Test @Transactional public void testCrud() { LOG.info("Testing creating new Permission"); Permission permission = new Permission(); permission.setName("name"); permission.setDescription("Description"); permission.setCode("001"); permission.setActive(true); permission = permissionDao.create(permission); assertNotNull(permission); permission = permissionDao.get(permission.getId()); assertNotNull(permission); permission.setName("updated name"); permission = permissionDao.update(permission); assertNotNull(permission); assertEquals("updated name", permission.getName()); permissionDao.delete(permission.getId()); assertNull(permissionDao.get(permission.getId())); }
public UserPermissionCommand(User user) { userId = user.getId(); permissions = new ArrayList<>(); Set<Permission> userPermissions = user.getPermissions(); if (userPermissions != null && !userPermissions.isEmpty()) { for (Permission permission : userPermissions) { permissions.add(permission.getName()); } } }