Package org.projectforge.task

Examples of org.projectforge.task.TaskDO


  }

  private GanttTask convertToGanttObject(final TaskDO task)
  {
    final GanttTask ganttObject = Task2GanttTaskConverter.convertToGanttObject(task);
    final TaskDO predecessorTask = task.getGanttPredecessor();
    if (predecessorTask != null) {
      ganttObject.setPredecessor(convertToGanttObject(predecessorTask));
    }
    return ganttObject;
  }
View Full Code Here


   * @param task
   * @return
   */
  public static final TaskDO convertToTask(final GanttTask ganttObject)
  {
    final TaskDO task = new TaskDO();
    // Do not copy the id! The id is given by the data base.
    task.setGanttPredecessorOffset(ganttObject.getPredecessorOffset());
    task.setGanttRelationType(ganttObject.getRelationType());
    task.setDuration(ganttObject.getDuration());
    task.setStartDate(ganttObject.getStartDate());
    task.setEndDate(ganttObject.getEndDate());
    task.setProgress(ganttObject.getProgress());
    task.setGanttObjectType(ganttObject.getType());
    task.setDescription(ganttObject.getDescription());
    task.setTitle(ganttObject.getTitle());
    return task;
  }
View Full Code Here

    if (ganttTask == null) {
      log.warn("Oups, Gantt task shouldn't be null.");
      return;
    }
    if (ganttTask.equals(ganttChartData.getRootObject()) == false) {
      final TaskDO task = taskTree.getTaskById((Integer) ganttTask.getId());
      final Integer predecessorId = task.getGanttPredecessorId();
      if (predecessorId != null) {
        GanttTask predecessor = ganttChartData.getRootObject().findById(predecessorId);
        if (predecessor == null) {
          // External task (outside the given Gantt task tree):
          final TaskDO predecessortTask = taskTree.getTaskById(predecessorId);
          if (predecessortTask != null) {
            predecessor = ganttChartData.ensureAndGetExternalGanttObject(predecessortTask);
          } else {
            log.warn("Oups, task with id '" + predecessorId + "' not found.");
          }
View Full Code Here

          }
          if ("description".equals(fieldName) == true) {
            return true;
          }
          final GanttTask ganttObject = (GanttTask) obj;
          final TaskDO task = taskTree.getTaskById((Integer) ganttObject.getId());
          if (task != null) {
            if ("predecessor".equals(field.getName()) == true) {
              // Predecessor unmodified?
              return NumberHelper.isEqual((Integer) ganttObject.getPredecessorId(), task.getGanttPredecessorId());
            }
            String taskFieldname = fieldMapping.get(fieldName);
            if (taskFieldname == null) {
              taskFieldname = fieldName;
            }
            for (final Field taskField : taskFields) {
              if (taskFieldname.equals(taskField.getName()) == true) {
                final Object value = BeanHelper.getFieldValue(obj, field);
                final Object taskValue = BeanHelper.getFieldValue(task, taskField);
                if (value instanceof BigDecimal) {
                  // Needed, because 10.0 is not equal to 10.000 (if scale is different).
                  return NumberHelper.isEqual((BigDecimal) value, (BigDecimal) taskValue);
                }
                return ObjectUtils.equals(value, taskValue) == true;
              }
            }
          }
        }
        return false;
      }

      @Override
      protected void writeField(final Field field, final Object obj, final Object fieldValue, final XmlField annotation,
          final Element element)
      {
        if (GanttTask.class.isAssignableFrom(field.getDeclaringClass()) == true) {
          final String fieldName = field.getName();
          if ("id".equals(fieldName) == false) {
            final TaskTree taskTree = taskDao.getTaskTree();
            final GanttTask ganttObject = (GanttTask) obj;
            final TaskDO task = taskTree.getTaskById((Integer) ganttObject.getId());
            if (task != null) {
              String taskFieldname = fieldMapping.get(fieldName);
              if (taskFieldname == null) {
                taskFieldname = fieldName;
              }
View Full Code Here

   * @param taskId If null, then task will be set to null;
   * @see TaskTree#getTaskById(Integer)
   */
  public void setTask(final GanttChartDO ganttChart, final Integer taskId)
  {
    final TaskDO task = taskDao.getOrLoad(taskId);
    ganttChart.setTask(task);
  }
View Full Code Here

          final UserPrefEntryDO taskParam = data.getUserPrefEntry(param.getDependsOn());
          Integer taskId = null;
          if (taskParam == null) {
            log.error("Annotation for Kost2DO types should have a valid dependsOn annotation. Task param not found for: " + param);
          } else {
            final TaskDO task = (TaskDO) taskParam.getValueAsObject();
            if (task != null) {
              taskId = task.getId();
            }
          }
          final Kost2DropDownChoice kost2DropDownChoice = new Kost2DropDownChoice(fs.getDropDownChoiceId(),
              (Kost2DO) param.getValueAsObject(), taskId) {
            @Override
View Full Code Here

  {
    log.fatal("User wants to initialize database.");
    if (isEmpty() == false) {
      databaseNotEmpty();
    }
    final TaskDO task = new TaskDO();
    task.setTitle("Root");
    task.setStatus(TaskStatus.N);
    task.setShortDescription("ProjectForge root task");
    task.setCreated();
    task.setLastUpdate();
    final Serializable id = getHibernateTemplate().save(task);
    log.info("New object added (" + id + "): " + task.toString());
    // Use of taskDao does not work with maven test case: Could not synchronize database state with session?

    // Create Admin user
    final PFUserDO adminUser = new PFUserDO();
    adminUser.setUsername(user.getUsername());
View Full Code Here

      @Override
      public void populateItem(final Item<ICellPopulator<GroupTaskAccessDO>> item, final String componentId,
          final IModel<GroupTaskAccessDO> rowModel)
      {
        final GroupTaskAccessDO access = rowModel.getObject();
        final TaskDO task = access.getTask();
        final StringBuffer buf = new StringBuffer();
        taskFormatter.appendFormattedTask(getRequestCycle(), buf, task, true, false);
        final Label formattedTaskLabel = new Label(ListSelectActionPanel.LABEL_ID, buf.toString());
        formattedTaskLabel.setEscapeModelStrings(false);
        item.add(new ListSelectActionPanel(componentId, rowModel, AccessEditPage.class, access.getId(), returnToPage, formattedTaskLabel));
View Full Code Here

   * @return The Integer value of the given parameter stored as ConfigurationDO in the data base.
   * @throws ClassCastException if configuration parameter is from the wrong type.
   */
  public Integer getTaskIdValue(final ConfigurationParam parameter)
  {
    final TaskDO task = (TaskDO) getValue(parameter);
    if (task != null) {
      return task.getId();
    }
    return null;
  }
View Full Code Here

   */
  @Override
  public void onBeforeRender()
  {
    super.onBeforeRender();
    final TaskDO task = isNew() == true ? data.getParentTask() : data;
    final boolean hasKost2AndTimesheetBookingAccess = ((TaskDao) getBaseDao()).hasAccessForKost2AndTimesheetBookingStatus(
        PFUserContext.getUser(), task);
    if (Configuration.getInstance().isCostConfigured() == true && task != null) {
      // Cost 2 settings
      final ProjektDO projekt = taskTree.getProjekt(task.getId());
      if (this.projekt == projekt) {
        return;
      }
      this.projekt = projekt;
      if (projekt != null) {
View Full Code Here

TOP

Related Classes of org.projectforge.task.TaskDO

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.