Package org.apache.rave.portal.model

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


    }

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


    public void convertValid() {
        PortalPreference template = new PortalPreferenceImpl();
        template.setKey("KEY");
        template.setValue("VALUE");

        JpaPortalPreference jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaPortalPreference.class)));
        assertThat(jpaTemplate.getKey(), is(equalTo(template.getKey())));
        assertThat(jpaTemplate.getValue(), is(equalTo(template.getValue())));
    }
View Full Code Here

        assertEquals(repository.getType(), JpaPortalPreference.class);
    }

    @Test
    public void get() {
        JpaPortalPreference p = (JpaPortalPreference) repository.get(VALID_ID.toString());
        assertThat(p.getEntityId(), is(VALID_ID));
        assertThat(p.getKey(), is("color"));
        assertThat(p.getValues().size(), is(3));
    }
View Full Code Here

    public JpaPortalPreference convert(PortalPreference source) {
        return source instanceof JpaPortalPreference ? (JpaPortalPreference) source : createEntity(source);
    }

    private JpaPortalPreference createEntity(PortalPreference source) {
        JpaPortalPreference converted = null;
        if (source != null) {
            TypedQuery<JpaPortalPreference> query = manager.createNamedQuery(JpaPortalPreference.GET_BY_KEY, JpaPortalPreference.class);
            query.setParameter(JpaPortalPreference.PARAM_KEY, source.getKey());
            converted = getSingleResult(query.getResultList());

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

        return manager.find(JpaPortalPreference.class, Long.parseLong(id));
    }

    @Override
    public PortalPreference save(PortalPreference item) {
        JpaPortalPreference pref = converter.convert(item);
        return saveOrUpdate(pref.getEntityId(), manager, pref);
    }
View Full Code Here

        return manager.find(JpaPortalPreference.class, id);
    }

    @Override
    public PortalPreference save(PortalPreference item) {
        JpaPortalPreference pref = converter.convert(item);
        return saveOrUpdate(pref.getEntityId(), manager, pref);
    }
View Full Code Here

        return manager.find(JpaPortalPreference.class, id);
    }

    @Override
    public PortalPreference save(PortalPreference item) {
        JpaPortalPreference pref = converter.convert(item);
        return saveOrUpdate(pref.getEntityId(), manager, pref);
    }
View Full Code Here

        assertEquals(repository.getType(), JpaPortalPreference.class);
    }

    @Test
    public void get() {
        JpaPortalPreference p = (JpaPortalPreference) repository.get(VALID_ID);
        assertThat(p.getEntityId(), is(VALID_ID));
        assertThat(p.getKey(), is("color"));
        assertThat(p.getValues().size(), is(3));
    }
View Full Code Here

        assertEquals(repository.getType(), JpaPortalPreference.class);
    }

    @Test
    public void get() {
        JpaPortalPreference p = (JpaPortalPreference) repository.get(VALID_ID.toString());
        assertThat(p.getEntityId(), is(VALID_ID));
        assertThat(p.getKey(), is("color"));
        assertThat(p.getValues().size(), is(3));
    }
View Full Code Here

    }

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

TOP

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

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.