Package org.encuestame.utils.web

Examples of org.encuestame.utils.web.UnitGroupBean


            JsonMappingException, IOException {
        try {
            // log.debug(" "+folderName);
            final Map<String, Object> sucess = new HashMap<String, Object>();
            if ("create".equals(type)) {
                final UnitGroupBean unitGroupBean = new UnitGroupBean();
                unitGroupBean.setGroupDescription(groupDesc == null ? ""
                        : groupDesc);
                unitGroupBean.setGroupName(groupName);
                unitGroupBean.setStateId(stateId); // TODO: remove
                sucess.put(
                        "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) {
                    final UnitGroupBean groupBean = ConvertDomainBean
                            .convertGroupDomainToBean(groupDomain);
                    groupBean.setGroupDescription(groupDesc);
                    // TODO: Set state
                    if (!groupName.isEmpty()) {
                        groupBean.setGroupName(groupName);
                    }
                    getSecurityService().updateGroup(groupBean);
                    sucess.put("g", groupBean);
                    setItemResponse(sucess);
                }
View Full Code Here


    /**
     * Test {@link UnitGroupBean}.
     */
    @Test
    public void testUnitGroupBean(){
        final UnitGroupBean groupBean = new UnitGroupBean();
        groupBean.setId(1L);
        groupBean.setGroupDescription("group description");
        groupBean.setGroupName("group name");
        groupBean.setStateId(1L);
        assertNotNull(groupBean.getId());
        assertNotNull(groupBean.getStateId());
        assertNotNull(groupBean.getGroupDescription());
        assertNotNull(groupBean.getGroupName());
        final UnitGroupBean groupBean2 = new UnitGroupBean(1L, "group", "description");
        assertNotNull(groupBean2);
        assertNotNull(groupBean2.toString());
    }
View Full Code Here

             final String groupDescription,
             final String groupName,
             final Long groupId,
             final Long stateId
     ){
         final UnitGroupBean unitGroupBean = new UnitGroupBean();
         unitGroupBean.setGroupDescription(groupDescription);
         unitGroupBean.setGroupName(groupName);
         unitGroupBean.setId(groupId);
         unitGroupBean.setStateId(stateId);
         return unitGroupBean;
     }
View Full Code Here

        final UserAccount users = createUserAccount("juanpicado",
                this.userPrimary);
        final Group groups = createGroups("encuestador");
        UserAccountBean userBean = ConvertDomainBean
                .convertSecondaryUserToUserBean(users);
        UnitGroupBean groupBean = ConvertDomainBean
                .convertGroupDomainToBean(groups);
        // securityService.assingGroup(userBean, groupBean);
    }
View Full Code Here

    @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

    @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

    @Category(DefaultTest.class)
    @Test
    public void testUpdateGroup() throws EnMeExpcetion {
        Group secgroups = createGroups("guests");
        Long idGroupUpdate = secgroups.getGroupId();
        UnitGroupBean groupBean = ConvertDomainBean
                .convertGroupDomainToBean(secgroups);
        groupBean.setGroupName("editors");
        securityService.updateGroup(groupBean);
        Group groupUpdateRetrieve = getGroup().getGroupById(idGroupUpdate);
        assertEquals("Should be", "editors", groupUpdateRetrieve.getGroupName());

    }
View Full Code Here

        Group secCreateGroup = new Group();
        secCreateGroup.setGroupId(12L);
        secCreateGroup.setGroupDescriptionInfo("1111");
        secCreateGroup.setGroupName("vvvv");
        secCreateGroup.setIdState(1L);
        final UnitGroupBean createGroupBean = ConvertDomainBean
                .convertGroupDomainToBean(secCreateGroup);
        securityService.createGroup(createGroupBean,
                this.userAccount.getUsername());
        // TODO: need assert
    }
View Full Code Here

     * Convert {@link Group} to {@link UnitGroupBean}.
     * @param groupDomain{@link Group}
     * @return {@link UnitGroupBean}
     */
    public static final UnitGroupBean convertGroupDomainToBean(final Group groupDomain) {
        final UnitGroupBean groupBean = new UnitGroupBean();
        if (groupDomain != null) {
            groupBean.setId(groupDomain.getGroupId());
            groupBean.setGroupName(groupDomain.getGroupName());
            groupBean
                    .setGroupDescription(groupDomain.getGroupDescriptionInfo());
            groupBean.setStateId(groupDomain.getIdState());
        }
        return groupBean;
    }
View Full Code Here

TOP

Related Classes of org.encuestame.utils.web.UnitGroupBean

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.