当前位置: 首页>>代码示例>>Java>>正文


Java Issue.getAttachments方法代码示例

本文整理汇总了Java中com.taskadapter.redmineapi.bean.Issue.getAttachments方法的典型用法代码示例。如果您正苦于以下问题:Java Issue.getAttachments方法的具体用法?Java Issue.getAttachments怎么用?Java Issue.getAttachments使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taskadapter.redmineapi.bean.Issue的用法示例。


在下文中一共展示了Issue.getAttachments方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addMissingInformationsToIssueFromCachedConfiguration

import com.taskadapter.redmineapi.bean.Issue; //导入方法依赖的package包/类
private void addMissingInformationsToIssueFromCachedConfiguration(Issue issue,
		CachedRepositoryConfiguration configuration)
{
	//Data transfer object members of issue are not populated with all the info,
	//we should hit the server to retrieve missing fields but instead we hit our
	//local cache.
	issue.setProject(configuration.getProjectById(issue.getProject().getId()));
	issue.setAssignee(configuration.getUserById(issue.getAssignee().getId()));
	issue.setAuthor(configuration.getUserById(issue.getAuthor().getId()));
	
	for(Journal j : issue.getJournals())
	{
		j.setUser(configuration.getUserById(j.getUser().getId()));
	}
	
	for(Attachment a : issue.getAttachments())
	{
		a.setAuthor(configuration.getUserById(a.getAuthor().getId()));
	}
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:21,代码来源:RedmineTaskDataHandler.java

示例2: writeIssue

import com.taskadapter.redmineapi.bean.Issue; //导入方法依赖的package包/类
public static void writeIssue(Issue issue, final JSONWriter writer) throws JSONException {
	JsonOutput.addIfNotNull(writer, "id", issue.getId());
	JsonOutput.addIfNotNull(writer, "subject", issue.getSubject());
	JsonOutput.addIfNotNull(writer, "parent_issue_id", issue.getParentId());
	JsonOutput.addIfNotNull(writer, "estimated_hours",
			issue.getEstimatedHours());
	JsonOutput.addIfNotNull(writer, "spent_hours", issue.getSpentHours());
	if (issue.getAssignee() != null)
		JsonOutput.addIfNotNull(writer, "assigned_to_id", issue
				.getAssignee().getId());
	JsonOutput.addIfNotNull(writer, "priority_id", issue.getPriorityId());
	JsonOutput.addIfNotNull(writer, "done_ratio", issue.getDoneRatio());
       if (issue.getProject() != null) {
           // Checked in Redmine 2.6.0: updating issues based on
           // identifier fails and only using the project id works.
           // As the identifier usage is used in several places, this
           // case selection is introduced. The identifier is
           // used, if no real ID is provided
           if (issue.getProject().getId() != null) {
               JsonOutput.addIfNotNull(writer, "project_id", issue.getProject()
                       .getId());
           } else {
			throw new IllegalArgumentException("Project ID must be set on issue. " +
					"You can use a factory method to create Issue object in memory: IssueFactory.create(projectId, subject)");
           }
       }
       if (issue.getAuthor() != null)
		JsonOutput.addIfNotNull(writer, "author_id", issue.getAuthor().getId());
	addShort2(writer, "start_date", issue.getStartDate());
	addIfNotNullShort2(writer, "due_date", issue.getDueDate());
	if (issue.getTracker() != null)
		JsonOutput.addIfNotNull(writer, "tracker_id", issue.getTracker().getId());
	JsonOutput.addIfNotNull(writer, "description", issue.getDescription());

	addIfNotNullFull(writer, "created_on", issue.getCreatedOn());
	addIfNotNullFull(writer, "updated_on", issue.getUpdatedOn());
	JsonOutput.addIfNotNull(writer, "status_id", issue.getStatusId());
       if (issue.getTargetVersion() != null)
           JsonOutput.addIfNotNull(writer, "fixed_version_id", issue
                   .getTargetVersion().getId());
       if (issue.getCategory() != null)
           JsonOutput.addIfNotNull(writer, "category_id", issue.getCategory().getId());
       JsonOutput.addIfNotNull(writer, "notes", issue.getNotes());
	writeCustomFields(writer, issue.getCustomFields());

       Collection<Watcher> issueWatchers = issue.getWatchers();
       if (issueWatchers != null && !issueWatchers.isEmpty()) {
           writeWatchers(writer, issueWatchers);
       }

       final List<Attachment> uploads = new ArrayList<Attachment>();
       for (Attachment attachment : issue.getAttachments()) {
           if (attachment.getToken() != null) {
               uploads.add(attachment);
           }
       }
       JsonOutput.addArrayIfNotEmpty(writer, "uploads", uploads,
               UPLOAD_WRITER);

	/*
	 * Journals and Relations cannot be set for an issue during creation or
	 * updates.
	 */
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:65,代码来源:RedmineJSONBuilder.java

示例3: writeIssue

import com.taskadapter.redmineapi.bean.Issue; //导入方法依赖的package包/类
public static void writeIssue(Issue issue, final JSONStringer writer)
		throws JSONException {
	JsonOutput.addIfNotNull(writer, "id", issue.getId());
	JsonOutput.addIfNotNull(writer, "subject", issue.getSubject());
	JsonOutput.addIfNotNull(writer, "parent_issue_id", issue.getParentId());
	JsonOutput.addIfNotNull(writer, "estimated_hours",
			issue.getEstimatedHours());
	JsonOutput.addIfNotNull(writer, "spent_hours", issue.getSpentHours());
	if (issue.getAssignee() != null)
		JsonOutput.addIfNotNull(writer, "assigned_to_id", issue
				.getAssignee().getId());
	JsonOutput.addIfNotNull(writer, "priority_id", issue.getPriorityId());
	JsonOutput.addIfNotNull(writer, "done_ratio", issue.getDoneRatio());
	if (issue.getProject() != null)
		JsonOutput.addIfNotNull(writer, "project_id", issue.getProject()
				.getIdentifier());
	if (issue.getAuthor() != null)
		JsonOutput.addIfNotNull(writer, "author_id", issue.getAuthor()
				.getId());
	addShort2(writer, "start_date", issue.getStartDate());
	addIfNotNullShort2(writer, "due_date", issue.getDueDate());
	if (issue.getTracker() != null)
		JsonOutput.addIfNotNull(writer, "tracker_id", issue.getTracker()
				.getId());
	JsonOutput.addIfNotNull(writer, "description", issue.getDescription());

	addIfNotNullFull(writer, "created_on", issue.getCreatedOn());
	addIfNotNullFull(writer, "updated_on", issue.getUpdatedOn());
	JsonOutput.addIfNotNull(writer, "status_id", issue.getStatusId());
	if (issue.getTargetVersion() != null)
		JsonOutput.addIfNotNull(writer, "fixed_version_id", issue
				.getTargetVersion().getId());
	if (issue.getCategory() != null)
		JsonOutput.addIfNotNull(writer, "category_id", issue.getCategory()
				.getId());
	JsonOutput.addIfNotNull(writer, "notes", issue.getNotes());
	writeCustomFields(writer, issue.getCustomFields());

	if (issue.getAttachments() != null && issue.getAttachments().size() > 0) {
		final List<Attachment> uploads = new ArrayList<Attachment>();
		for (Attachment attach : issue.getAttachments())
			if (attach.getToken() != null)
				uploads.add(attach);
		JsonOutput.addArrayIfNotEmpty(writer, "uploads", uploads,
				UPLOAD_WRITER);
	}
	

	/*
	 * Journals and Relations cannot be set for an issue during creation or
	 * updates.
	 */
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:54,代码来源:RedmineJSONBuilder.java


注:本文中的com.taskadapter.redmineapi.bean.Issue.getAttachments方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。