Package org.eclipse.mylyn.tasks.core.data

Examples of org.eclipse.mylyn.tasks.core.data.TaskAttribute


 
  @Override
  protected void setClosedTaskValue(TaskAttribute attribute, String value, TaskData taskData, TaskDataModel model) {
    super.setClosedTaskValue(attribute, value, taskData, model);

    TaskAttribute markasOperation = taskData.getRoot().getAttribute(TaskAttribute.PREFIX_OPERATION + RedmineOperation.markas.toString());
    if(markasOperation!=null) {
      TaskAttribute operation = taskData.getRoot().getAttribute(TaskAttribute.OPERATION);
      taskData.getAttributeMapper().setValue(operation, RedmineOperation.markas.toString());
      model.attributeChanged(operation);
    }
  }
View Full Code Here


        ITask firstTask = tasks.get(0);
        String repositoryUrl = firstTask.getRepositoryUrl();
       
        if (repositoryUrl!=null && taskDataManager.hasTaskData(firstTask)) {
          TaskData taskData = taskDataManager.getTaskData(firstTask);
          TaskAttribute attribute = taskData.getRoot().getAttribute(RedmineAttribute.STATUS.getTaskKey());
          Set<String> commonIds = new HashSet<String>(attribute.getOptions().keySet());
         
          for (ITask task : tasks) {
            if (task.getRepositoryUrl().equals(repositoryUrl)) { //Same-Repository-Policy
              if (taskDataManager.hasTaskData(task)) {
                taskData = taskDataManager.getTaskData(task);
                attribute = taskData.getRoot().getAttribute(RedmineAttribute.STATUS.getTaskKey());
                commonIds.retainAll(attribute.getOptions().keySet());
              }
            } else {
              return null; //Same-Repository-Policy
            }
          }
         
          if(commonIds.size()>0) {
            statusMap = new HashMap<String, String>(commonIds.size());
            for (String key : commonIds) {
              statusMap.put(key, attribute.getOption(key));
            }
          }
        }
      }
     
View Full Code Here

         
         
          for (RedmineAttribute redmineAttribute : attributes) {
            if(redmineAttribute!=null) {
              attributeName = redmineAttribute.name();
              TaskAttribute attribute = taskData.getRoot().getAttribute(redmineAttribute.getTaskKey());

              String newValue = getValue(redmineAttribute, taskData);
              if(!attribute.getValue().equals(newValue)) {
                if(openTask) {
                  setOpenTaskValue(attribute, newValue, taskData, model);
                } else {
                  setClosedTaskValue(attribute, newValue, taskData, model);
                }
View Full Code Here

  }
 
  @Override
  protected String getValue(RedmineAttribute attribute, TaskData taskData) {
    TaskAttributeMapper taskAttributeMapper = taskData.getAttributeMapper();
    TaskAttribute taskAttribute = taskData.getRoot().getAttribute(attribute.getTaskKey());

    switch (attribute) {
    case TIME_ENTRY_HOURS:

      long milisec = RedmineUiPlugin.getDefault().getSpentTimeManager().getAndClearUncapturedSpentTime(task);
     
      String oldValue = taskAttribute.getValue();
      if(!oldValue.isEmpty()) {
        milisec += Long.parseLong(oldValue);
      }
     
      return Long.toString(milisec);
View Full Code Here

    validateEstimatedHours(taskData, collector);
    validateTimeEntry(taskData, collector);
  }

  protected void validateRequiredDefaultAttributes(TaskData taskData, ErrorMessageCollector collector) {
    TaskAttribute rootAttr = taskData.getRoot();
    TaskAttribute taskAttr = null;
   
    for (RedmineAttribute redmineAttribute : RedmineAttribute.values()) {
      if (redmineAttribute.isRequired()) {
        if(redmineAttribute==RedmineAttribute.STATUS && taskData.isNew())  {
          redmineAttribute=RedmineAttribute.STATUS_CHG;
        }
       
        taskAttr = rootAttr.getAttribute(redmineAttribute.getTaskKey());
        if (taskAttr==null || taskAttr.getValue().trim().isEmpty()) {
          collector.add(taskAttr, String.format(Messages.ERRMSG_X_REQUIRED, redmineAttribute.getLabel()));
        }
      }
    }
  }
View Full Code Here

      }
    }
  }
 
  protected void validateEstimatedHours(TaskData taskData, ErrorMessageCollector collector) {
    TaskAttribute attribute = taskData.getRoot().getAttribute(RedmineAttribute.ESTIMATED.getTaskKey());
    if (attribute != null) {
      if (!attribute.getValue().trim().isEmpty()) {
        try {
          Double.valueOf(attribute.getValue().trim());
        } catch (NumberFormatException e) {
          collector.add(attribute, RedmineAttribute.ESTIMATED.getLabel() + Messages.ERRMSG_FLOAT);
        }
      }
    }
View Full Code Here

      }
    }
  }
 
  protected void validateTimeEntry(TaskData taskData, ErrorMessageCollector collector) {
    TaskAttribute attribute = taskData.getRoot().getAttribute(RedmineAttribute.TIME_ENTRY_HOURS.getTaskKey());
    if (attribute != null) {
      if (!attribute.getValue().trim().isEmpty()) {
        try {
          Double.valueOf(attribute.getValue().trim());
        } catch (NumberFormatException e) {
          collector.add(attribute, RedmineAttribute.TIME_ENTRY_HOURS.getLabel() + Messages.ERRMSG_FLOAT);
        }

        attribute = taskData.getRoot().getAttribute(RedmineAttribute.TIME_ENTRY_ACTIVITY.getTaskKey());
        if(attribute==null || attribute.getValue().isEmpty()) {
          collector.add(attribute, RedmineAttribute.TIME_ENTRY_ACTIVITY.getLabel() + Messages.ERRMSG_REQUIRED);
        }
      }
    }
  }
View Full Code Here

      }
    }
  }
 
  protected void validateParentTask(TaskData taskData, ErrorMessageCollector collector) {
    TaskAttribute attribute = taskData.getRoot().getAttribute(RedmineAttribute.PARENT.getTaskKey());
    if (attribute != null && !attribute.getValue().isEmpty()) {
      if (!attribute.getValue().trim().matches(IRedmineConstants.REGEX_INTEGER)) {
        collector.add(attribute, RedmineAttribute.PARENT.getLabel() + Messages.ERRMSG_SINGLE_TASK_ID);
      }
    }
  }
View Full Code Here

      }
    }
  }

  protected void validateCustomAttributes(TaskData taskData, ErrorMessageCollector collector) {
    TaskAttribute rootAttribute = taskData.getRoot();
    int projectId = RedmineUtil.parseIntegerId(rootAttribute.getAttribute(RedmineAttribute.PROJECT.getTaskKey()).getValue());
    int trackerId = RedmineUtil.parseIntegerId(rootAttribute.getAttribute(RedmineAttribute.TRACKER.getTaskKey()).getValue());
   
    Project project = configuration.getProjects().getById(projectId);
    int[] customFieldIds = project.getCustomFieldIdsByTrackerId(trackerId);
   
    if(customFieldIds!=null) {
      for (int customFieldId : customFieldIds) {
        CustomField customField = configuration.getCustomFields().getById(customFieldId);
        TaskAttribute attribute = rootAttribute.getAttribute(IRedmineConstants.TASK_KEY_PREFIX_ISSUE_CF + customFieldId);
        if(customField!=null && attribute!=null) {
          validateCustomAttribute(attribute, customField, collector);
        }
      }
    }
View Full Code Here

        item.setText(COLUMN_IDX_ID, userId);
        item.setText(COLUMN_IDX_NAME, RedmineUtil.formatUserPresentation(user.getLogin(), user.getName()));
      }
    }
   
    TaskAttribute addAttribute = getTaskAttribute().getAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
    if (addAttribute!=null) {
      for (String userId : addAttribute.getValues()) {
        User user = users.getById(RedmineUtil.parseIntegerId(userId));
       
        if (user!=null) {
          TableItem item = new TableItem(table, SWT.NONE);
          item.setText(COLUMN_IDX_ID, userId);
View Full Code Here

TOP

Related Classes of org.eclipse.mylyn.tasks.core.data.TaskAttribute

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.