Package org.apache.rave.portal.model

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


    @Autowired
    private JpaCategoryConverter categoryConverter;

    @Test
    public void noConversion() {
        Category category = new JpaCategory();
        assertThat(categoryConverter.convert(category), is(sameInstance(category)));
    }
View Full Code Here


        category.setText("hello");
        category.setCreatedUserId("1");
        category.setLastModifiedUserId("1");
        category.setWidgets(new ArrayList<Widget>());

        JpaCategory converted = categoryConverter.convert(category);
        assertThat(converted, is(not(sameInstance(category))));
        assertThat(converted, is(instanceOf(JpaCategory.class)));
        assertThat(converted.getCreatedDate(), is(equalTo(category.getCreatedDate())));
        assertThat(converted.getCreatedUserId(), is(equalTo(category.getCreatedUserId())));
        assertThat(converted.getEntityId().toString(), is(equalTo(category.getId())));
        assertThat(converted.getId(), is(equalTo(category.getId())));
        assertThat(converted.getLastModifiedDate(), is(equalTo(category.getLastModifiedDate())));
        assertThat(converted.getLastModifiedUserId(), is(equalTo(category.getLastModifiedUserId())));
        assertThat(converted.getText(), is(equalTo(category.getText())));
        assertThat(converted.getWidgets(), is(equalTo(category.getWidgets())));
    }
View Full Code Here

    public JpaCategory convert(Category source) {
        return source instanceof JpaCategory ? (JpaCategory) source : createEntity(source);
    }

    private JpaCategory createEntity(Category source) {
        JpaCategory converted = null;
        if (source != null) {
            converted = source.getId() == null ? new JpaCategory() : manager.find(JpaCategory.class, Long.parseLong(source.getId()));
            if(converted == null) {
                converted = new JpaCategory();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

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

    @Override
    public Category save(Category item) {
        JpaCategory category = categoryConverter.convert(item);
        return saveOrUpdate(category.getEntityId(), manager, category);
    }
View Full Code Here

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

    @Override
    public Category save(Category item) {
        JpaCategory category = categoryConverter.convert(item);
        return saveOrUpdate(category.getEntityId(), manager, category);
    }
View Full Code Here

    public JpaCategory convert(Category source) {
        return source instanceof JpaCategory ? (JpaCategory) source : createEntity(source);
    }

    private JpaCategory createEntity(Category source) {
        JpaCategory converted = null;
        if (source != null) {
            converted = manager.find(JpaCategory.class, source.getId() == null ? null : Long.parseLong(source.getId()));
            if (converted == null) {
                converted = new JpaCategory();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

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

    @Override
    public Category save(Category item) {
        JpaCategory category = categoryConverter.convert(item);
        return saveOrUpdate(category.getEntityId(), manager, category);
    }
View Full Code Here

    public JpaCategory convert(Category source) {
        return source instanceof JpaCategory ? (JpaCategory) source : createEntity(source);
    }

    private JpaCategory createEntity(Category source) {
        JpaCategory converted = null;
        if (source != null) {
            converted = manager.find(JpaCategory.class, source.getId());
            if (converted == null) {
                converted = new JpaCategory();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

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

    @Override
    public Category save(Category item) {
        JpaCategory category = categoryConverter.convert(item);
        return saveOrUpdate(category.getEntityId(), manager, category);
    }
View Full Code Here

    public JpaCategory convert(Category source) {
        return source instanceof JpaCategory ? (JpaCategory) source : createEntity(source);
    }

    private JpaCategory createEntity(Category source) {
        JpaCategory converted = null;
        if (source != null) {
            converted = source.getId() == null ? new JpaCategory() : manager.find(JpaCategory.class, Long.parseLong(source.getId()));
            if(converted == null) {
                converted = new JpaCategory();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here

TOP

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

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.