Examples of JpaWidgetComment


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

    @Autowired
    private JpaWidgetCommentConverter widgetCommentConverter;

    @Test
    public void noConversion() {
        WidgetComment comment = new JpaWidgetComment();
        assertThat(widgetCommentConverter.convert(comment, null), is(sameInstance(comment)));
    }
View Full Code Here

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

        comment.setCreatedDate(new Date());
        comment.setLastModifiedDate(new Date());
        comment.setText("hello");
        comment.setUserId("1");

        JpaWidgetComment converted = widgetCommentConverter.convert(comment, "9");
        assertThat(converted, is(not(sameInstance(comment))));
        assertThat(converted, is(instanceOf(JpaWidgetComment.class)));
        assertThat(converted.getCreatedDate(), is(equalTo(comment.getCreatedDate())));
        assertThat(converted.getEntityId().toString(), is(equalTo(comment.getId())));
        assertThat(converted.getId(), is(equalTo(comment.getId())));
        assertThat(converted.getLastModifiedDate(), is(equalTo(comment.getLastModifiedDate())));
        assertThat(converted.getText(), is(equalTo(comment.getText())));
        assertThat(converted.getUserId(), is(equalTo(comment.getUserId())));
    }
View Full Code Here

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

        Date createdDate = new Date();
        Date lastModDate = new Date();
        String text = "my comment";
        User user = new UserImpl(VALID_USER_ID.toString());

        JpaWidgetComment wc = new JpaWidgetComment();
        wc.setCreatedDate(createdDate);
        wc.setWidgetId(VALID_WIDGET_ID.toString());
        wc.setLastModifiedDate(lastModDate);
        wc.setText(text);
        wc.setUserId(VALID_USER_ID.toString());
        assertThat(wc.getId(), is(nullValue()));
        repository.createWidgetComment(VALID_WIDGET_ID.toString(), wc);
        String newId = wc.getId();
        assertThat(Long.parseLong(newId) > 0, is(true));
        WidgetComment newComment = repository.getCommentById(VALID_WIDGET_ID.toString(), newId);
        assertThat(newComment.getUserId(), is(VALID_USER_ID.toString()));
        assertThat(newComment.getText(), is(text));
        assertThat(newComment.getCreatedDate(), is(createdDate));
View Full Code Here

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

    public JpaWidgetComment convert(WidgetComment source, String widgetId) {
        return source instanceof JpaWidgetComment ? (JpaWidgetComment) source : createEntity(source, widgetId);
    }

    private JpaWidgetComment createEntity(WidgetComment source, String widgetId) {
        JpaWidgetComment converted = null;
        if (source != null) {
            converted = source.getId() == null ? new JpaWidgetComment() : manager.find(JpaWidgetComment.class, Long.parseLong(source.getId()));

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

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

    public JpaWidgetComment convert(WidgetComment source, String widgetId) {
        return source instanceof JpaWidgetComment ? (JpaWidgetComment) source : createEntity(source, widgetId);
    }

    private JpaWidgetComment createEntity(WidgetComment source, String widgetId) {
        JpaWidgetComment converted = null;
        if (source != null) {
            converted = manager.find(JpaWidgetComment.class, source.getId() == null ? null : Long.parseLong(source.getId()));

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

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

        Date createdDate = new Date();
        Date lastModDate = new Date();
        String text = "my comment";
        User user = new UserImpl(VALID_USER_ID);

        WidgetComment wc = new JpaWidgetComment();
        wc.setCreatedDate(createdDate);
        wc.setWidgetId(VALID_WIDGET_ID);
        wc.setLastModifiedDate(lastModDate);
        wc.setText(text);
        wc.setUser(user);
        assertThat(wc.getId(), is(nullValue()));
        repository.save(wc);
        long newId = wc.getId();
        assertThat(newId > 0, is(true));
        WidgetComment newComment = repository.get(newId);
        assertThat(newComment.getWidgetId(), is(VALID_WIDGET_ID));
        assertThat(newComment.getUser().getId(), is(VALID_USER_ID));
        assertThat(newComment.getText(), is(text));
View Full Code Here

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

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

    @Override
    public WidgetComment save(WidgetComment item) {
        JpaWidgetComment category = widgetCommentConverter.convert(item);
        return saveOrUpdate(category.getEntityId(), manager, category);
    }
View Full Code Here

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

    @Autowired
    private JpaWidgetCommentConverter widgetCommentConverter;

    @Test
    public void noConversion() {
        WidgetComment comment = new JpaWidgetComment();
        assertThat(widgetCommentConverter.convert(comment), is(sameInstance(comment)));
    }
View Full Code Here

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

        comment.setLastModifiedDate(new Date());
        comment.setText("hello");
        comment.setUser(new JpaUser(1L));
        comment.setWidgetId(9L);

        JpaWidgetComment converted = widgetCommentConverter.convert(comment);
        assertThat(converted, is(not(sameInstance(comment))));
        assertThat(converted, is(instanceOf(JpaWidgetComment.class)));
        assertThat(converted.getCreatedDate(), is(equalTo(comment.getCreatedDate())));
        assertThat(converted.getEntityId(), is(equalTo(comment.getId())));
        assertThat(converted.getId(), is(equalTo(comment.getId())));
        assertThat(converted.getLastModifiedDate(), is(equalTo(comment.getLastModifiedDate())));
        assertThat(converted.getText(), is(equalTo(comment.getText())));
        assertThat(converted.getUser(), is(equalTo(comment.getUser())));
        assertThat(converted.getWidgetId(), is(equalTo(comment.getWidgetId())));
    }
View Full Code Here

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

    public JpaWidgetComment convert(WidgetComment source) {
        return source instanceof JpaWidgetComment ? (JpaWidgetComment) source : createEntity(source);
    }

    private JpaWidgetComment createEntity(WidgetComment source) {
        JpaWidgetComment converted = null;
        if (source != null) {
            converted = manager.find(JpaWidgetComment.class, source.getId());

            if (converted == null) {
                converted = new JpaWidgetComment();
            }
            updateProperties(source, converted);
        }
        return converted;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.