Package org.projectforge.timesheet

Examples of org.projectforge.timesheet.TimesheetDO


  @Test
  public void testTimesheetBookingStatus()
  {
    initialize();
    logon(getUser(TEST_USER));
    TimesheetDO sheet = createNewSheet().setTask(getTask("TBT-2"));
    save(sheet, "timesheet.error.taskNotBookable.treeClosedForBooking");
    save(sheet.setTask(getTask("TBT-2.1")), "timesheet.error.taskNotBookable.treeClosedForBooking");
    save(sheet.setTask(getTask("TBT-3")), "timesheet.error.taskNotBookable.onlyLeafsAllowedForBooking");
    save(sheet.setTask(getTask("TBT-3.1")), "timesheet.error.taskNotBookable.onlyLeafsAllowedForBooking");
    timesheetDao.save(sheet.setTask(getTask("TBT-3.2"))); // Leaf task node.
    timesheetDao.save(createNewSheet().setTask(getTask("TBT-3.1.1"))); // Leaf task node.
    timesheetDao.save(createNewSheet().setTask(getTask("TBT-3.1.2"))); // Leaf task node.
    sheet = createNewSheet();
    save(sheet.setTask(getTask("TBT-4")), "timesheet.error.taskNotBookable.taskClosedForBooking");
    save(sheet.setTask(getTask("TBT-4.1")), "timesheet.error.taskNotBookable.taskClosedForBooking"); // Inherited (not opened)
    timesheetDao.save(sheet.setTask(getTask("TBT-4.1.1"))); // Opened for booking.
  }
View Full Code Here


    logon(getUser(TEST_FINANCE_USER));
    final AuftragDO auftrag = new AuftragDO().addPosition(new AuftragsPositionDO().setTask(getTask("TBT-5.1")).setTitel("Pos 1"))
        .addPosition(new AuftragsPositionDO().setTask(getTask("TBT-5.2.1.1")).setTitel("Pos 2"));
    auftragDao.save(auftrag.setNummer(auftragDao.getNextNumber(auftrag)));
    logon(getUser(TEST_USER));
    TimesheetDO sheet = createNewSheet();
    save(sheet.setTask(getTask("TBT-5")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks");
    timesheetDao.save(sheet.setTask(getTask("TBT-5.1")));
    timesheetDao.save(createNewSheet().setTask(getTask("TBT-5.1.1")));
    timesheetDao.save(createNewSheet().setTask(getTask("TBT-5.1.2")));
    sheet = createNewSheet();
    save(sheet.setTask(getTask("TBT-5.2")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks");
    save(sheet.setTask(getTask("TBT-5.2.1")), "timesheet.error.taskNotBookable.orderPositionsFoundInSubTasks");
    timesheetDao.save(sheet.setTask(getTask("TBT-5.2.1.1")));
  }
View Full Code Here

  public void testTaskStatus()
  {
    initialize();
    final PFUserDO user = getUser(TEST_USER);
    logon(user);
    TimesheetDO sheet = createNewSheet().setTask(getTask("TBT-1"));
    timesheetDao.save(sheet);
    sheet = createNewSheet().setTask(getTask("TBT-1.1"));
    save(sheet, "timesheet.error.taskNotBookable.taskNotOpened");
    save(sheet.setTask(getTask("TBT-1.2")), "timesheet.error.taskNotBookable.taskDeleted");
    save(sheet.setTask(getTask("TBT-1.2.1")), "timesheet.error.taskNotBookable.taskDeleted");
  }
View Full Code Here

    save(sheet.setTask(getTask("TBT-1.2.1")), "timesheet.error.taskNotBookable.taskDeleted");
  }

  private TimesheetDO createNewSheet()
  {
    return new TimesheetDO().setUser(getUser(TEST_USER)).setStartDate(date.getDate()).setStopTime(
        date.add(Calendar.MINUTE, 15).getTimestamp());
  }
View Full Code Here

    final TaskDO subTask1 = initTestDB.addTask("totalDurationTask.subtask1", "totalDurationTask");
    final TaskDO subTask2 = initTestDB.addTask("totalDurationTask.subtask2", "totalDurationTask");
    assertEquals(0, taskDao.readTotalDuration(task.getId()));
    final DateHolder dh = new DateHolder();
    dh.setDate(2010, Calendar.APRIL, 20, 8, 0);
    TimesheetDO ts = new TimesheetDO().setUser(getUser(TEST_USER)).setStartDate(dh.getDate()).setStopTime(
        dh.add(Calendar.HOUR_OF_DAY, 4).getTimestamp()).setTask(task);
    timesheetDao.save(ts);
    assertEquals(4 * 3600, taskDao.readTotalDuration(task.getId()));
    assertEquals(4 * 3600, getTotalDuration(task.getId()));
    ts = new TimesheetDO().setUser(getUser(TEST_USER)).setStartDate(dh.add(Calendar.HOUR_OF_DAY, 1).getDate()).setStopTime(
        dh.add(Calendar.HOUR_OF_DAY, 4).getTimestamp()).setTask(task);
    timesheetDao.save(ts);
    assertEquals(8 * 3600, taskDao.readTotalDuration(task.getId()));
    assertEquals(8 * 3600, getTotalDuration(task.getId()));
    ts = new TimesheetDO().setUser(getUser(TEST_USER)).setStartDate(dh.add(Calendar.HOUR_OF_DAY, 1).getDate()).setStopTime(
        dh.add(Calendar.HOUR_OF_DAY, 4).getTimestamp()).setTask(subTask1);
    timesheetDao.save(ts);
    final List<Object[]> list = taskDao.readTotalDurations();
    boolean taskFound = false;
    boolean subtask1Found = false;
View Full Code Here

    taskEntry = groupTaskAccess.ensureAndGetAccessEntry(AccessType.OWN_TIMESHEETS);
    taskEntry.setAccess(false, false, false, false);
    accessDao.save(groupTaskAccess);

    TimesheetDO timesheet = new TimesheetDO();
    timesheet.setTask(initTestDB.getTask("cTm.child"));
    timesheet.setUser(getUser("user1"));
    timesheet.setLocation("Office");
    timesheet.setDescription("A lot of stuff done and more.");
    final long current = System.currentTimeMillis();
    timesheet.setStartTime(new Timestamp(current));
    timesheet.setStopTime(new Timestamp(current + 2 * 60 * 60 * 1000));
    final Serializable id = timesheetDao.internalSave(timesheet);

    logon(user1); // user1 is in group1, but not in group3
    timesheet = timesheetDao.getById(id); // OK, because is selectable for group1
    // Move task ctm.child to cTm.2 with no access to user1:
    final TaskDO childTask = getTask("cTm.child");
    childTask.setParentTask(getTask("cTm.2"));
    taskDao.internalUpdate(childTask);
    // try {
    timesheet = timesheetDao.getById(id); // AccessException, because is not selectable for group1
    // User has no access, but is owner of this timesheet, so the following properties are empty:
    assertEquals("Field should be hidden", TimesheetDao.HIDDEN_FIELD_MARKER, timesheet.getShortDescription());
    assertEquals("Field should be hidden", TimesheetDao.HIDDEN_FIELD_MARKER, timesheet.getDescription());
    assertEquals("Field should be hidden", TimesheetDao.HIDDEN_FIELD_MARKER, timesheet.getLocation());
    // fail("Timesheet should not be accessable for user1 (because he is not member of group3)");
    // } catch (AccessException ex) {
    // OK
    // }
  }
View Full Code Here

TOP

Related Classes of org.projectforge.timesheet.TimesheetDO

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.