Search in sources :

Example 1 with ContentImpl

use of org.jbpm.services.task.impl.model.ContentImpl in project jbpm by kiegroup.

the class AbstractTaskSerializationTest method jaxbContentTest.

@Test
public void jaxbContentTest() throws Exception {
    Assume.assumeFalse(getType().equals(TestType.YAML));
    ContentImpl content = new ContentImpl();
    content.setId(23);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("life", new Integer(23));
    map.put("sick", new Integer(45));
    byte[] bytes = ContentMarshallerHelper.marshallContent(null, map, null);
    content.setContent(bytes);
    JaxbContent jaxbContent = new JaxbContent(content);
    JaxbContent copyJaxbContent = testRoundTrip(jaxbContent);
    Assertions.assertThat(jaxbContent).isEqualToComparingFieldByFieldRecursively(copyJaxbContent);
}
Also used : HashMap(java.util.HashMap) ContentImpl(org.jbpm.services.task.impl.model.ContentImpl) JaxbContent(org.jbpm.services.task.impl.model.xml.JaxbContent) Test(org.junit.Test)

Example 2 with ContentImpl

use of org.jbpm.services.task.impl.model.ContentImpl in project jbpm by kiegroup.

the class JPATaskPersistenceContext method findTaskIdByContentId.

@Override
public Long findTaskIdByContentId(Long contentId) {
    check();
    CriteriaBuilder builder = this.em.getCriteriaBuilder();
    CriteriaQuery<Long> query = builder.createQuery(Long.class);
    Root<TaskImpl> taskRoot = query.from(TaskImpl.class);
    Root<ContentImpl> contentRoot = query.from(ContentImpl.class);
    query.select(taskRoot.get(TaskImpl_.id));
    Predicate taskContentJoinPred = builder.equal(contentRoot.get(ContentImpl_.id), taskRoot.get(TaskImpl_.taskData).get(TaskDataImpl_.outputContentId));
    Predicate contentIdPred = builder.equal(contentRoot.get(ContentImpl_.id), contentId);
    query.where(builder.and(taskContentJoinPred, contentIdPred));
    Query choppedLiver = em.createQuery(query);
    return (Long) choppedLiver.getSingleResult();
}
Also used : CriteriaBuilder(javax.persistence.criteria.CriteriaBuilder) CriteriaQuery(javax.persistence.criteria.CriteriaQuery) Query(javax.persistence.Query) TaskImpl(org.jbpm.services.task.impl.model.TaskImpl) ContentImpl(org.jbpm.services.task.impl.model.ContentImpl) Predicate(javax.persistence.criteria.Predicate)

Aggregations

ContentImpl (org.jbpm.services.task.impl.model.ContentImpl)2 HashMap (java.util.HashMap)1 Query (javax.persistence.Query)1 CriteriaBuilder (javax.persistence.criteria.CriteriaBuilder)1 CriteriaQuery (javax.persistence.criteria.CriteriaQuery)1 Predicate (javax.persistence.criteria.Predicate)1 TaskImpl (org.jbpm.services.task.impl.model.TaskImpl)1 JaxbContent (org.jbpm.services.task.impl.model.xml.JaxbContent)1 Test (org.junit.Test)1