Package org.apache.rave.portal.model

Examples of org.apache.rave.portal.model.JpaGroup


        assertThat(converter.convert(category), is(nullValue()));
    }

    @Test
    public void testConvertGroupToJpaGroup() {
        JpaGroup jpaGroup = converter.convert(group);

        assertThat(jpaGroup, is(not(sameInstance(group))));
        assertThat(jpaGroup, is(instanceOf(JpaGroup.class)));
        assertEquals(description, jpaGroup.getDescription());
        assertEquals(title, jpaGroup.getTitle());
        assertEquals(owner.getDisplayName(), jpaGroup.getOwner().getDisplayName());
        assertEquals(members.size(), jpaGroup.getMembers().size());
    }
View Full Code Here


    public JpaGroup convert(Group source) {
        return source instanceof JpaGroup ? (JpaGroup) source : createEntity(source);
    }

    private JpaGroup createEntity(Group source) {
        JpaGroup converted = null;
        if (source != null) {
            TypedQuery<JpaGroup> query = manager.createNamedQuery(JpaGroup.FIND_BY_TITLE, JpaGroup.class);
            query.setParameter(JpaGroup.GROUP_ID_PARAM, source.getTitle());
            converted = getSingleResult(query.getResultList());

            if (converted == null) {
                converted = new JpaGroup();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

        group.setMemberIds(members);
    }

    @Test
    public void testNoConversion() {
        JpaGroup group = new JpaGroup();
        assertThat(converter.convert(group), is(sameInstance(group)));
    }
View Full Code Here

        assertThat(converter.convert(category), is(nullValue()));
    }

    @Test
    public void testConvertGroupToJpaGroup() {
        JpaGroup jpaGroup = converter.convert(group);

        assertThat(jpaGroup, is(not(sameInstance(group))));
        assertThat(jpaGroup, is(instanceOf(JpaGroup.class)));
        assertEquals(description, jpaGroup.getDescription());
        assertEquals(title, jpaGroup.getTitle());
        assertEquals(ownerId, jpaGroup.getOwnerId());
        assertEquals(members.size(), jpaGroup.getMemberIds().size());
    }
View Full Code Here

    public JpaGroup convert(Group source) {
        return source instanceof JpaGroup ? (JpaGroup) source : createEntity(source);
    }

    private JpaGroup createEntity(Group source) {
        JpaGroup converted = null;
        if (source != null) {
            TypedQuery<JpaGroup> query = manager.createNamedQuery(JpaGroup.FIND_BY_TITLE, JpaGroup.class);
            query.setParameter(JpaGroup.GROUP_ID_PARAM, source.getTitle());
            converted = getSingleResult(query.getResultList());

            if (converted == null) {
                converted = new JpaGroup();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

        throw new NotSupportedException("This function is not yet implemented for this class.");
    }

    @Override
    public Group save(Group item) {
        JpaGroup converted = converter.convert(item);
        return saveOrUpdate(converted.getEntityId(), manager, converted);
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.JpaGroup

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.