Package org.intalio.tempo.workflow.util.jpa

Examples of org.intalio.tempo.workflow.util.jpa.TaskFetcher


                    "http://hellonico.net"), getXmlSampleDocument());
            task1.getRoleOwners().add("examples\\employee");
            task1.getRoleOwners().add("examples\\manager");
            persist(task1);
          
            final TaskFetcher taskFetcher = new TaskFetcher(em);
            UserRoles ur = new UserRoles("niko", new String[] {
                    "examples\\employee", "examples\\manager" });
            Task[] list = taskFetcher.fetchAllAvailableTasks(ur);
            Assert.assertEquals(1, list.length);
           }
View Full Code Here


            task1 = new Notification(getUniqueTaskID(), new URI(
                    "http://hellonico.net"), getXmlSampleDocument());
            task1.getRoleOwners().add("intalio\\manager");
            persist(task1);
          
            final TaskFetcher taskFetcher = new TaskFetcher(em);
            task2 = (Notification) taskFetcher
                    .fetchTasksForRole("intalio\\manager")[0];
            TaskEquality.areTasksEquals(task1, task2);
          
            checkRemoved(task2);
           }
View Full Code Here

            task1 = new Notification(getUniqueTaskID(), new URI(
                    "http://hellonico.net"), getXmlSampleDocument());
            task1.getUserOwners().add("intalio\\admin");
            persist(task1);
          
            final TaskFetcher taskFetcher = new TaskFetcher(em);
            task2 = (Notification) taskFetcher.fetchTasksForUser("intalio\\admin")[0];
            TaskEquality.areTasksEquals(task1, task2);
          
            checkRemoved(task2);
           }
View Full Code Here

          
            Query q = em.createNamedQuery(Task.FIND_BY_ID).setParameter(1, id);
            task2 = (Notification) (q.getResultList()).get(0);
            TaskEquality.areTasksEquals(task2, task1);
          
            TaskFetcher fetcher = new TaskFetcher(em);
            Assert.assertEquals(Notification.class, fetcher
                    .fetchTasksForUser("user1")[0].getClass());
            Assert.assertEquals(Notification.class, fetcher
                    .fetchTasksForRole("role1")[0].getClass());
          
            testFecthForUserRoles("user1", new String[] { "role2" }, 1);
            testFecthForUserRoles("user2", new String[] { "role1" }, 1);
            testFecthForUserRoles("user2", new String[] { "role2" }, 0);
View Full Code Here

            task1.setOutput(xml.getXmlDocument("/pa_output.xml"));
          
            task1.getUserOwners().add("intalio\\admin");
            persist(task1);
          
            final TaskFetcher taskFetcher = new TaskFetcher(em);
            final UserRoles user = new UserRoles("intalio\\admin", new String[] {
                    "examples\\manager", "examples\\employee" });
            task2 = (PATask) taskFetcher.fetchAllAvailableTasks(user)[0];
            TaskEquality.areTasksEquals(task1, task2);
          
            checkRemoved(task2);
          
           }
View Full Code Here

    // this is to prevent caching at the entity manager level
    em.clear();
  }

  private void testRange(int first, int max, int expected) {
    TaskFetcher taskFetcher = new TaskFetcher(factory.createEntityManager());
    HashMap map = new HashMap();
    map.put(TaskFetcher.FETCH_USER, new UserRoles("user1",
        new String[] { "examples\\employee" }));
    map.put(TaskFetcher.FETCH_CLASS, PATask.class);
    map.put(TaskFetcher.FETCH_SUB_QUERY, "");
    map.put(TaskFetcher.FETCH_FIRST, first);
    map.put(TaskFetcher.FETCH_MAX, max);
    this._logger.debug("Testing range with :first=" + first + " and :max="
        + max + " ; expected:" + expected);
    Assert.assertEquals(expected,
        taskFetcher.fetchAvailableTasks(map).length);
  }
View Full Code Here

    Assert.assertEquals(expected,
        taskFetcher.fetchAvailableTasks(map).length);
  }

  private void testCount(long expected) throws Exception {
    final TaskFetcher taskFetcher = new TaskFetcher(em);
    HashMap map = new HashMap();
    map.put(TaskFetcher.FETCH_USER, new UserRoles("user1",
        new String[] { "examples\\employee" }));
    map.put(TaskFetcher.FETCH_CLASS, PATask.class);
    Assert
        .assertEquals((Long) expected, (Long) taskFetcher
            .countTasks(map));

    remoteQuery();
  }
View Full Code Here

    persist(task1);

    for (String us : users) {
      _logger.info(user + ":" + us + ":");
      UserRoles ur = new UserRoles(us, new String[] {});
      Task[] tasks = new TaskFetcher(em).fetchAllAvailableTasks(ur);
      if (tasks.length > 0)
        Assert.assertEquals(tasks[0].isAvailableTo(ur), true);
    }

    checkRemoved(task1);
View Full Code Here

  }

  private Task[] testFetchForUserRolesWithCriteria(String userId,
      String[] roles, Class taskClass, String subQuery, int size)
      throws Exception {
    Task[] tasks = new TaskFetcher(em).fetchAvailableTasks(new UserRoles(
        userId, roles), taskClass, subQuery);
    Assert.assertEquals(size, tasks.length);
    return tasks;
  }
View Full Code Here

  }

  private Task[] testFetchForUserRolesWithCriteria(String userId,
      String[] roles, Class taskClass, String subQuery, int size,
      boolean optionalMarshalling) throws Exception {
    Task[] tasks = new TaskFetcher(em).fetchAvailableTasks(new UserRoles(
        userId, roles), taskClass, subQuery);
    Assert.assertEquals(size, tasks.length);

    if (optionalMarshalling) {
      TaskMarshaller marshaller = new TaskMarshaller();
View Full Code Here

TOP

Related Classes of org.intalio.tempo.workflow.util.jpa.TaskFetcher

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.