Package org.nxplanner.domain

Examples of org.nxplanner.domain.RoleAssociation


    public void insertForPersonOnProject(String roleName, int personId, int projectId)
            throws RepositoryException {
        Role role = roleRepository.findRoleByName(roleName);
        if (role != null) {
            try {
                ThreadSession.get().save(new RoleAssociation(projectId, personId, role.getId()));
            } catch (HibernateException e) {
                throw new RepositoryException(e);
            }
        }
    }
View Full Code Here


    public void done() throws HibernateException {
        session.close();
    }

    private void addRoleAssociation(Session session, int roleId, int personId, int projectId) throws HibernateException {
        session.save(new RoleAssociation(projectId, personId, roleId));
    }
View Full Code Here

            while (rs.next()) {
                for (int i = 0; i < projects.size(); i++) {
                    Project project = (Project)projects.get(i);
                    Role role = getRole(session, rs.getString("role"));
                    int personId = rs.getInt("person_id");
                    session.save(new RoleAssociation(project.getId(), personId, role.getId()));
                    // Person should have permission to read/edit their own profile
                    session.save(new Permission("system.person", 0, personId, "read%"));
                    session.save(new Permission("system.person", personId, personId, "edit%"));
                }
            }
View Full Code Here

    private void initializeRoles(Session session, User user, Person person)
            throws HibernateException {
        String[] roles = user.getRoles().split(",");
        for (int i = 0; i < roles.length; i++) {
            Role role = getRole(session, roles[i]);
            session.save(new RoleAssociation(0, person.getId(), role.getId()));
        }
    }
View Full Code Here

        int projectId = 11;
        person = new Person("permissionTester");
        person.setName("permissionTester");
        person.setInitials("pt");
        int personId = ((Integer)session.save(person)).intValue();
        session.save(new RoleAssociation(projectId, personId, getRoleId(session, "admin")));
        addPermission(session, personId, "system.project", 1, "testpermission");

        session.flush();
        session.connection().commit();
View Full Code Here

    private void addRoleAssociationForProject(Session session, int projectId, int personId, String roleName)
            throws HibernateException {
        Role role = getRoleByName(session, roleName);
        if (role != null) {
            session.save(new RoleAssociation(projectId, personId, role.getId()));
        }
    }
View Full Code Here

TOP

Related Classes of org.nxplanner.domain.RoleAssociation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.