Package net.sf.redmine_mylyn.api.model

Examples of net.sf.redmine_mylyn.api.model.Project


  public boolean initializeTaskData(TaskRepository repository, TaskData taskData, ITaskMapping taskMapping, IProgressMonitor monitor) throws CoreException {
    Configuration conf = connector.getRepositoryConfiguration(repository);
    Issue issue = new Issue();
   
    try {
      Project project = conf.getProjects().getAll().get(0);
      issue.setProjectId(project.getId());
      issue.setTrackerId(conf.getTrackers().getById(project.getTrackerIds()).get(0).getId());
     
      return initializeNewTaskData(issue, repository, taskData, monitor);
    } catch (RuntimeException e) {
      IStatus status = new Status(IStatus.ERROR, RedmineCorePlugin.PLUGIN_ID, Messages.ERRMSG_TASK_INITIALIZATION_FALED_INSUFFICENT_DATA, e);
      StatusHandler.log(status);
View Full Code Here


    createCustomAttributes(data, configuration, issue, configuration.getCustomFields().getIssueCustomFields(), IRedmineConstants.TASK_KEY_PREFIX_ISSUE_CF, false);
  }
 
  private static void createDefaultAttributes(TaskRepository repository, TaskData data, Issue issue , Configuration cfg) throws RedmineStatusException {
    boolean existingTask = issue.getId()>0;
    Project project = cfg.getProjects().getById(issue.getProjectId());

    if (project==null) {
      //https://sourceforge.net/tracker/index.php?func=detail&aid=3441198&group_id=228995&atid=1075435#
      IStatus status = RedmineCorePlugin.toStatus(IStatus.ERROR, Messages.ERRMSG_TASK_INITIALIZATION_FALED_INSUFFICENT_DATA_X_X, issue.getId(), "Project" + " " + issue.getProjectId() );
      StatusHandler.log(status);
      throw new RedmineStatusException(status);
    }

    if (cfg.getSettings()==null) {
      //https://sourceforge.net/tracker/index.php?func=detail&aid=3441198&group_id=228995&atid=1075435#
      IStatus status = RedmineCorePlugin.toStatus(IStatus.ERROR, Messages.ERRMSG_TASK_INITIALIZATION_FALED_INSUFFICENT_DATA_X_X, issue.getId(), "Settings" );
      StatusHandler.log(status);
      throw new RedmineStatusException(status);
    }

    TaskAttribute attribute;
   
    createAttribute(data, RedmineAttribute.SUMMARY);
    createAttribute(data, RedmineAttribute.DESCRIPTION);
    createAttribute(data, RedmineAttribute.PRIORITY, cfg.getIssuePriorities().getAll());
   
    if(existingTask) {
      attribute = createAttribute(data, RedmineAttribute.PROJECT, cfg.getProjects().getMoveAllowed(project));
      attribute.getMetaData().setReadOnly(true);
    } else {
      createAttribute(data, RedmineAttribute.PROJECT, cfg.getProjects().getNewAllowed());
    }
   
    createAttribute(data, RedmineAttribute.PARENT);
    createAttribute(data, RedmineAttribute.SUBTASKS);
    createAttribute(data, RedmineAttribute.TRACKER, cfg.getTrackers().getById(project.getTrackerIds()));

    if (existingTask) {
      createAttribute(data, RedmineAttribute.REPORTER);
      createAttribute(data, RedmineAttribute.DATE_SUBMITTED);
      createAttribute(data, RedmineAttribute.DATE_UPDATED);
     
      createAttribute(data, RedmineAttribute.COMMENT);
     
      createAttribute(data, RedmineAttribute.STATUS, cfg.getIssueStatuses().getById(issue.getAvailableStatusId()));
      createAttribute(data, RedmineAttribute.STATUS_CHG, cfg.getIssueStatuses().getById(issue.getAvailableStatusId()));

////      createAttribute(data, RedmineAttribute.RELATION, ticket.getRelations(), false);
//     
    } else {
      createAttribute(data, RedmineAttribute.STATUS, cfg.getIssueStatuses().getAll());
      createAttribute(data, RedmineAttribute.STATUS_CHG, cfg.getIssueStatuses().getAll());

    }
   
    createAttribute(data, RedmineAttribute.CATEGORY, cfg.getIssueCategories().getById(project.getIssueCategoryIds()), true);
    createAttribute(data, RedmineAttribute.VERSION, cfg.getVersions().getOpenById(project.getVersionIds()), true);
   
    attribute = createAttribute(data, RedmineAttribute.PROGRESS, ProgressValues.availableValues());
    if (!cfg.getSettings().isUseIssueDoneRatio()) {
      attribute.getMetaData().setReadOnly(true);
      attribute.getMetaData().setType(null);
    }
   
    //Planning
    createAttribute(data, RedmineAttribute.ESTIMATED);
    createAttribute(data, RedmineAttribute.DATE_DUE);
    createAttribute(data, RedmineAttribute.DATE_START);

    createAttribute(data, RedmineAttribute.ASSIGNED_TO, cfg.getUsers().getById(project.getAssignableMemberIds()), !existingTask);

    //Attributes for a new TimeEntry
    if(existingTask) {
      if (issue.getTimeEntries()!=null && issue.getTimeEntries().isNewAllowed()) {
        createAttribute(data, RedmineAttribute.TIME_ENTRY_HOURS);
        createAttribute(data, RedmineAttribute.TIME_ENTRY_ACTIVITY, project.getTimeEntryActivities().getAll());
        createAttribute(data, RedmineAttribute.TIME_ENTRY_COMMENTS);
       
        for (IRedmineExtensionField additionalField : RedmineCorePlugin.getDefault().getExtensionManager().getAdditionalTimeEntryFields(repository)) {
          createAttribute(data, additionalField, IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_EX);
        }
       
        createCustomAttributes(data, cfg, issue, cfg.getCustomFields().getTimeEntryCustomFields(), IRedmineConstants.TASK_KEY_PREFIX_TIMEENTRY_CF, true);
      }
    }

    //Watchers
    if(existingTask) {
      if(issue.isWatchersViewAllowed()) {
        attribute = createAttribute(data, RedmineAttribute.WATCHERS, cfg.getUsers().getAll());
       
        if(issue.isWatchersAddAllowed()) {
          TaskAttribute addWatcherAttribute = attribute.createAttribute(RedmineAttribute.WATCHERS_ADD.getTaskKey());
          addWatcherAttribute.getMetaData().setLabel(RedmineAttribute.WATCHERS_ADD.getLabel());
          addOptions(addWatcherAttribute, cfg.getUsers().getById(project.getMemberIds()));
        }

        if(issue.isWatchersDeleteAllowed()) {
          attribute.createAttribute(RedmineAttribute.WATCHERS_REMOVE.getTaskKey());
        }
View Full Code Here

    }
    return attribute;
  }

  private static void createCustomAttributes(TaskData taskData, Configuration configuration, Issue issue , List<CustomField> customFields, String prefix, boolean hidden) throws RedmineStatusException {
    Project project = configuration.getProjects().getById(issue.getProjectId());
   
    for (CustomField customField : customFields) {
      TaskAttribute taskAttribute = createAttribute(taskData, customField, prefix);
      if(hidden) {
        taskAttribute.getMetaData().setKind(null);
      }
      if (customField.getFieldFormat().isListType()) {
        if (!customField.isRequired()) {
          taskAttribute.putOption("", ""); //$NON-NLS-1$ //$NON-NLS-2$
        }
       
        switch (customField.getFieldFormat()) {
        case VERSION:
          for( Version version : configuration.getVersions().getById(project.getVersionIds()) ) {
            taskAttribute.putOption(""+version.getId(), version.getName()); //$NON-NLS-1$
          }
          break;
        case USER:
          for( Member member : project.getMembers() ) {
            User user = configuration.getUsers().getById(member.getUserId());
            if (user != null) {
              taskAttribute.putOption(""+user.getId(), user.getName()); //$NON-NLS-1$
            }
          }
View Full Code Here

    try {
      IClient client = getClientManager().getClient(repository);
      if (client!=null) {
        Configuration conf = client.getConfiguration();
        if (!conf.getProjects().isEmpty() && !conf.getTrackers().isEmpty()) {
          Project project = conf.getProjects().getAll().get(0);
          List<Tracker> trackers = conf.getTrackers().getById(project.getTrackerIds());
          if (trackers.size()>0) {
            return true;
          }
        }
       
View Full Code Here

          RedmineRepositoryConnector redmineReposConnector = (RedmineRepositoryConnector)reposConn;
         
          IClient client = redmineReposConnector.getClientManager().getClient(taskRepository);
          Configuration conf = client.getConfiguration();
          if(conf != null) {
            Project project = conf.getProjects().getById(RedmineUtil.parseIntegerId(product));
            if(project != null) {
              product = ""+project.getIdentifier(); //$NON-NLS-1$
            }
          }
         
        }
      } catch (Exception e) {
View Full Code Here

TOP

Related Classes of net.sf.redmine_mylyn.api.model.Project

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.