Package org.encuestame.persistence.domain.security

Examples of org.encuestame.persistence.domain.security.Group


                        "groupBean",
                        getSecurityService().createGroup(unitGroupBean,
                                getUserPrincipalUsername()));
                setItemResponse(sucess);
            } else if ("update".equals(type)) {
                final Group groupDomain = getSecurityService()
                        .getGroupbyIdandUser(groupId,
                                getUserPrincipalUsername());// find by group Id
                                                            // and principal
                                                            // User.
                if (groupDomain != null) {
View Full Code Here


    /**
     * Delete Group Domain.
     * @param group group
     */
    public void deleteGroup(final Long groupId) {
        final Group group = getGroupDao().find(groupId);
        getGroupDao().delete(group);
    }
View Full Code Here

     * @param groupBean {@link UnitGroupBean}
     * @throws EnMeExpcetion exception
     */
    public UnitGroupBean updateGroup(UnitGroupBean groupBean) throws EnMeExpcetion {
        log.info("group to search "+groupBean.getId());
        final Group group = getGroupDao().find(Long.valueOf(groupBean.getId()));
        log.info("group found "+group);
        if (group != null) {
            log.info("group updated name "+groupBean.getGroupName());
            group.setGroupName(groupBean.getGroupName());
            log.info("group updated description "+groupBean.getGroupDescription());
            group.setGroupDescriptionInfo(groupBean.getGroupDescription());
            log.info("group updated state id "+groupBean.getStateId());
            // group.setIdState(Long.valueOf((groupBean.getStateId())));
            getGroupDao().saveOrUpdate(group);
            log.info("group new name "+group.getGroupName());
            log.info("group new description "+group.getGroupDescriptionInfo());
            groupBean = ConvertDomainBean.convertGroupDomainToBean(group);
        } else {
            throw new EnMeExpcetion("group not found");
        }
        return groupBean;
View Full Code Here

     * @throws EnMeNoResultsFoundException
     */
    public Long getUserbyGroup(final Long groupId, final String username) throws EnMeNoResultsFoundException{
        Long counterUsers = 0L;
        try {
             final Group group = getGroupDao().getGroupByIdandUser(groupId, getUserAccountId(username));
             if(group != null){
             counterUsers = getGroupDao().getCountUserbyGroup(groupId);
             }
        } catch (Exception e) {
            // TODO: handle exception Group no pertenece a usuario
View Full Code Here

     * @return
     */
    public List<Object[]> countUsersbyGroups(final Long groupId, final String username){
        List<Object[]> usersbyGroups = null;
          try {
               final Group group = getGroupDao().getGroupByIdandUser(groupId, getUserAccountId(username));
               if(group != null){
                   usersbyGroups = getGroupDao().countUsersbyGroups(getUserAccountId(username));
               }
          } catch (Exception e) {
              // TODO: handle exception Group don't belong to user
View Full Code Here

     * @param groupBean group bean
     * @throws EnMeNoResultsFoundException
     */
    public UnitGroupBean createGroup(final UnitGroupBean groupBean, final String username) throws EnMeNoResultsFoundException {
        //log.info("Create Group");
        final Group groupDomain = new Group();
        final Account secUsers = getUserAccount(username).getAccount();
        groupDomain.setGroupDescriptionInfo(groupBean.getGroupDescription());
        groupDomain.setGroupName(groupBean.getGroupName());
        groupDomain.setIdState(null);
        groupDomain.setAccount(secUsers);
        getGroupDao().saveOrUpdate(groupDomain);
        groupBean.setId(groupDomain.getGroupId());
        return ConvertDomainBean.convertGroupDomainToBean(groupDomain);
    }
View Full Code Here

            final Long groupId,
            final Long userId,
            final String username) throws EnMeNoResultsFoundException {
        final UserAccount userAccount = getUserAccount(userId); //TODO: I need confirm this user perhaps same group of logged user.
        //search group by group id and owner user id.
        final Group group = getGroupDao().getGroupById(groupId, getUserAccount(username).getAccount());
        if(group == null){
            throw new EnMeNoResultsFoundException("group not found");
        } else {
            //add new group.
            userAccount.setGroup(group);
View Full Code Here

    @Before
    public void initService() {
        this.userPrimary = createAccount();
        this.userAccount = createUserAccount("default", this.userPrimary);
        this.userAccount.setInviteCode(inviteCode);
        final Group group = createGroups("admin");
        final Group group2 = createGroups("editors");
        // this.secUserSecondary.getSecGroups().add(group);
        // this.secUserSecondary.getSecGroups().add(group2);
        this.permission = createPermission(EnMePermission.ENCUESTAME_EDITOR
                .name());
        createPermission(EnMePermission.ENCUESTAME_OWNER.name());
View Full Code Here

     * Test Delete Group.
     */
    @Category(DefaultTest.class)
    @Test
    public void testDeleteGroup() {
        final Group groupDomain = createGroups("admin");
        final Long idGroup = groupDomain.getGroupId();
        final UnitGroupBean group = ConvertDomainBean
                .convertGroupDomainToBean(groupDomain);
        securityService.deleteGroup(group.getId());
        final Group groupRetrieve = getGroup().getGroupById(idGroup);
        assertNull(groupRetrieve);
    }
View Full Code Here

     * Test delete Group.
     */
    @Category(DefaultTest.class)
    @Test
    public void testdeleteGroup() {
        final Group groupDomain = createGroups("admin");
        final Long idGroup = groupDomain.getGroupId();
        final UnitGroupBean group = ConvertDomainBean
                .convertGroupDomainToBean(groupDomain);
        securityService.deleteGroup(group.getId());
        final Group groupRetrieve = getGroup().getGroupById(idGroup);
        assertNull(groupRetrieve);

    }
View Full Code Here

TOP

Related Classes of org.encuestame.persistence.domain.security.Group

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.