Compare commits
No commits in common. "85cbb3be39ee1754dc8c6d24bb57a14bf6b6b5b0" and "b35520e4d87eb1ae2f80bd93bf03fe2f40a8562a" have entirely different histories.
85cbb3be39
...
b35520e4d8
@ -7,42 +7,12 @@ package io.gitea.model;
|
|||||||
public enum IssueAction {
|
public enum IssueAction {
|
||||||
CLOSE("close"),
|
CLOSE("close"),
|
||||||
LEAVE("leave"),
|
LEAVE("leave"),
|
||||||
REOPEN("reopen");
|
REOPEN("open");
|
||||||
|
|
||||||
IssueAction(String label) {
|
IssueAction(String label) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
}
|
}
|
||||||
public final String label;
|
public final String label;
|
||||||
|
|
||||||
public static IssueAction getEnum(String other) {
|
|
||||||
if ((other == null)||(other.isBlank()) || (other.isEmpty()))
|
|
||||||
return LEAVE;
|
|
||||||
for (IssueAction a : IssueAction.values())
|
|
||||||
if (a.equals(other)) return a;
|
|
||||||
throw new IllegalArgumentException(other + " is not a IssueAction value");
|
|
||||||
}
|
|
||||||
/**Compute targeted state when apply action as transition to a state.
|
|
||||||
*
|
|
||||||
* [from State: OPENED] --> Action: CLOSE --> [to State:CLOSED]
|
|
||||||
* [from State: CLOSED] --> Action: REOPEN --> [to State: OPENDED]
|
|
||||||
* All other cases have no impact on State.
|
|
||||||
*
|
|
||||||
* @param fromState
|
|
||||||
* @return Targeted state as IssueState.
|
|
||||||
*/
|
|
||||||
public IssueState toState(IssueState fromState) {
|
|
||||||
if ((this == CLOSE) && (fromState == IssueState.STATE_OPENED)) return IssueState.STATE_CLOSED;
|
|
||||||
if ((this == REOPEN) && (fromState == IssueState.STATE_CLOSED)) return IssueState.STATE_OPENED;
|
|
||||||
return fromState;
|
|
||||||
}
|
|
||||||
static public IssueState toState(IssueState from, IssueAction onAction) {
|
|
||||||
return onAction.toState(from);
|
|
||||||
}
|
|
||||||
public boolean equals(IssueAction arg0) {
|
|
||||||
return this.label.equals(arg0.toString());
|
|
||||||
}
|
|
||||||
public boolean equals(String arg0) {
|
|
||||||
return this.label.equals(arg0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,6 @@ public enum IssueState {
|
|||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IssueState getEnum(String value) {
|
|
||||||
for(IssueState s: IssueState.values()) {
|
|
||||||
if (s.equals(value)) return s;
|
|
||||||
}
|
|
||||||
throw new IllegalArgumentException(value + " is not a IssueState value");
|
|
||||||
}
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return this.value;
|
return this.value;
|
||||||
}
|
}
|
||||||
|
@ -28,8 +28,6 @@ public enum GiteaAttribute {
|
|||||||
|
|
||||||
COMPLETED("Completed", TaskAttribute.DATE_COMPLETION, TaskAttribute.TYPE_DATETIME, GiteaFlag.READ_ONLY),
|
COMPLETED("Completed", TaskAttribute.DATE_COMPLETION, TaskAttribute.TYPE_DATETIME, GiteaFlag.READ_ONLY),
|
||||||
|
|
||||||
DUE_DATE("Due Date", TaskAttribute.DATE_DUE, TaskAttribute.TYPE_DATE, GiteaFlag.ATTRIBUTE),
|
|
||||||
|
|
||||||
AUTHOR("Author", TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, GiteaFlag.READ_ONLY, GiteaFlag.ATTRIBUTE),
|
AUTHOR("Author", TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, GiteaFlag.READ_ONLY, GiteaFlag.ATTRIBUTE),
|
||||||
|
|
||||||
PROJECT("Project", TaskAttribute.PRODUCT, TaskAttribute.TYPE_SHORT_TEXT, GiteaFlag.READ_ONLY, GiteaFlag.ATTRIBUTE),
|
PROJECT("Project", TaskAttribute.PRODUCT, TaskAttribute.TYPE_SHORT_TEXT, GiteaFlag.READ_ONLY, GiteaFlag.ATTRIBUTE),
|
||||||
|
@ -17,7 +17,6 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
|
|||||||
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
|
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
|
||||||
|
|
||||||
import io.gitea.model.GiteaDateTimeUtils;
|
import io.gitea.model.GiteaDateTimeUtils;
|
||||||
import io.gitea.model.Label;
|
|
||||||
import io.gitea.model.Milestone;
|
import io.gitea.model.Milestone;
|
||||||
import io.gitea.model.User;
|
import io.gitea.model.User;
|
||||||
|
|
||||||
@ -90,21 +89,6 @@ public class GiteaAttributeMapper extends TaskAttributeMapper {
|
|||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Label> findLabelsByNames(String names) {
|
|
||||||
List<Label> found = new ArrayList<Label>();
|
|
||||||
try {
|
|
||||||
List<Label> labels = getConnection().getLabels();
|
|
||||||
HashMap<String, Label> map = new HashMap<String,Label>();
|
|
||||||
for (Label l : labels) {
|
|
||||||
map.put(l.getName(),l);
|
|
||||||
}
|
|
||||||
for (String n: names.split(",")) {
|
|
||||||
found.add(map.get(n));
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
|
||||||
}
|
|
||||||
return found;
|
|
||||||
}
|
|
||||||
private HashMap<String, String> getAsMap(List<String> list) {
|
private HashMap<String, String> getAsMap(List<String> list) {
|
||||||
HashMap<String, String> map = new HashMap<String, String>();
|
HashMap<String, String> map = new HashMap<String, String>();
|
||||||
map.put("", "");
|
map.put("", "");
|
||||||
|
@ -15,13 +15,7 @@ import io.gitea.api.IssueApi;
|
|||||||
import io.gitea.api.RepositoryApi;
|
import io.gitea.api.RepositoryApi;
|
||||||
import io.gitea.api.UserApi;
|
import io.gitea.api.UserApi;
|
||||||
import io.gitea.model.Comment;
|
import io.gitea.model.Comment;
|
||||||
import io.gitea.model.CreateIssueCommentOption;
|
|
||||||
import io.gitea.model.CreateIssueOption;
|
|
||||||
import io.gitea.model.EditIssueCommentOption;
|
|
||||||
import io.gitea.model.EditIssueOption;
|
|
||||||
import io.gitea.model.EditLabelOption;
|
|
||||||
import io.gitea.model.Issue;
|
import io.gitea.model.Issue;
|
||||||
import io.gitea.model.IssueLabelsOption;
|
|
||||||
import io.gitea.model.IssueState;
|
import io.gitea.model.IssueState;
|
||||||
import io.gitea.model.Label;
|
import io.gitea.model.Label;
|
||||||
import io.gitea.model.Milestone;
|
import io.gitea.model.Milestone;
|
||||||
@ -190,35 +184,4 @@ public class GiteaConnection {
|
|||||||
public List<Comment> issueGetComments(Issue issue) throws ApiException {
|
public List<Comment> issueGetComments(Issue issue) throws ApiException {
|
||||||
return issueGetComments(issue, null, null);
|
return issueGetComments(issue, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Add a new comment to an issue.
|
|
||||||
*
|
|
||||||
* @param issueId
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws ApiException
|
|
||||||
*/
|
|
||||||
public Comment issueAddComment(Long issueId, CreateIssueCommentOption body) throws ApiException {
|
|
||||||
return issueApi().issueCreateComment(owner, repo, issueId, body);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Comment issueAddComment(Issue issue, CreateIssueCommentOption body) throws ApiException {
|
|
||||||
return issueAddComment(issue.getId(), body);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create an issue.
|
|
||||||
*
|
|
||||||
* @param body
|
|
||||||
* @return
|
|
||||||
* @throws ApiException
|
|
||||||
*/
|
|
||||||
public Issue createIssue(CreateIssueOption body) throws ApiException {
|
|
||||||
return issueApi().issueCreateIssue(owner, repo, body);
|
|
||||||
}
|
|
||||||
public Issue editIssue(Long issueId, EditIssueOption body) throws ApiException {
|
|
||||||
return issueApi().issueEditIssue(owner, repo, issueId, body);
|
|
||||||
}
|
|
||||||
public List<Label> issueReplaceLabels(Long issueId, IssueLabelsOption labels) throws ApiException {
|
|
||||||
return issueApi().issueReplaceLabels(owner, repo, issueId, labels);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
package io.gitea.mylyn.core;
|
package io.gitea.mylyn.core;
|
||||||
|
|
||||||
import java.time.OffsetDateTime;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
@ -13,12 +12,10 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.eclipse.core.internal.registry.OffsetTable;
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.mylyn.tasks.core.ITaskMapping;
|
import org.eclipse.mylyn.tasks.core.ITaskMapping;
|
||||||
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
|
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
|
||||||
import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
|
|
||||||
import org.eclipse.mylyn.tasks.core.TaskRepository;
|
import org.eclipse.mylyn.tasks.core.TaskRepository;
|
||||||
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
|
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
|
||||||
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
|
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
|
||||||
@ -29,17 +26,11 @@ import org.eclipse.mylyn.tasks.core.data.TaskData;
|
|||||||
import org.eclipse.mylyn.tasks.core.data.TaskOperation;
|
import org.eclipse.mylyn.tasks.core.data.TaskOperation;
|
||||||
|
|
||||||
import io.gitea.ApiException;
|
import io.gitea.ApiException;
|
||||||
import io.gitea.api.IssueApi;
|
|
||||||
import io.gitea.model.Comment;
|
import io.gitea.model.Comment;
|
||||||
import io.gitea.model.CreateIssueCommentOption;
|
|
||||||
import io.gitea.model.CreateIssueOption;
|
|
||||||
import io.gitea.model.EditIssueOption;
|
|
||||||
import io.gitea.model.GiteaDateTimeUtils;
|
import io.gitea.model.GiteaDateTimeUtils;
|
||||||
import io.gitea.model.GiteaPriorityLevel;
|
import io.gitea.model.GiteaPriorityLevel;
|
||||||
import io.gitea.model.GiteaUser;
|
import io.gitea.model.GiteaUser;
|
||||||
import io.gitea.model.Issue;
|
import io.gitea.model.Issue;
|
||||||
import io.gitea.model.IssueAction;
|
|
||||||
import io.gitea.model.IssueLabelsOption;
|
|
||||||
import io.gitea.model.IssueState;
|
import io.gitea.model.IssueState;
|
||||||
import io.gitea.model.IssueType;
|
import io.gitea.model.IssueType;
|
||||||
import io.gitea.model.Label;
|
import io.gitea.model.Label;
|
||||||
@ -48,8 +39,9 @@ import io.gitea.model.User;
|
|||||||
import io.gitea.mylyn.core.exceptions.GiteaException;
|
import io.gitea.mylyn.core.exceptions.GiteaException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the Issue<=>Task management. Downloads issues to tasks for a specific
|
* Handles the issues. It maps the attributes from the Gitea API to real Mylyn
|
||||||
* repository, update issue and creates new issues.
|
* issue attributes, downloads the issues for a specific task repository, and
|
||||||
|
* creates new issues.
|
||||||
*/
|
*/
|
||||||
public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
||||||
|
|
||||||
@ -65,10 +57,6 @@ public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize Task from local repository.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping mapping,
|
public boolean initializeTaskData(TaskRepository repository, TaskData data, ITaskMapping mapping,
|
||||||
IProgressMonitor monitor) throws CoreException {
|
IProgressMonitor monitor) throws CoreException {
|
||||||
@ -78,8 +66,7 @@ public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
|||||||
TaskAttribute root = data.getRoot();
|
TaskAttribute root = data.getRoot();
|
||||||
|
|
||||||
root.getAttribute(GiteaAttribute.PROJECT.getTaskKey()).setValue(connection.repository.getName());// FIXME: not
|
root.getAttribute(GiteaAttribute.PROJECT.getTaskKey()).setValue(connection.repository.getName());// FIXME: not
|
||||||
// the
|
// the project
|
||||||
// project
|
|
||||||
root.getAttribute(GiteaAttribute.LABELS.getTaskKey()).setValue("");
|
root.getAttribute(GiteaAttribute.LABELS.getTaskKey()).setValue("");
|
||||||
root.getAttribute(GiteaAttribute.STATUS.getTaskKey()).setValue("open");
|
root.getAttribute(GiteaAttribute.STATUS.getTaskKey()).setValue("open");
|
||||||
root.getAttribute(GiteaAttribute.MILESTONE.getTaskKey()).setValue("");
|
root.getAttribute(GiteaAttribute.MILESTONE.getTaskKey()).setValue("");
|
||||||
@ -87,38 +74,33 @@ public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Send Update to remote issues repository (create issue when required).
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public RepositoryResponse postTaskData(TaskRepository repository, TaskData data, Set<TaskAttribute> attributes,
|
public RepositoryResponse postTaskData(TaskRepository repository, TaskData data, Set<TaskAttribute> attributes,
|
||||||
IProgressMonitor monitor) throws CoreException {
|
IProgressMonitor monitor) throws CoreException {
|
||||||
|
|
||||||
GiteaAttributeMapper attributeMapper = (GiteaAttributeMapper) data.getAttributeMapper();
|
GiteaAttributeMapper attributeMapper = (GiteaAttributeMapper) data.getAttributeMapper();
|
||||||
|
|
||||||
TaskAttribute root = data.getRoot();
|
TaskAttribute root = data.getRoot();
|
||||||
String taskId = data.getTaskId();
|
String labels = root.getAttribute(GiteaAttribute.LABELS.getTaskKey()).getValue();
|
||||||
|
|
||||||
// newLabelsList could be null or may content only one 'null' item when no label
|
|
||||||
// is defined for the task
|
|
||||||
List<Label> newLabelsList = attributeMapper
|
|
||||||
.findLabelsByNames(root.getAttribute(GiteaAttribute.LABELS.getTaskKey()).getValue());
|
|
||||||
List<Long> newLabelIds = new ArrayList<Long>();
|
|
||||||
if (newLabelsList != null)
|
|
||||||
newLabelsList.forEach(label -> {
|
|
||||||
if (label != null)
|
|
||||||
newLabelIds.add(label.getId());
|
|
||||||
});
|
|
||||||
|
|
||||||
String title = root.getAttribute(GiteaAttribute.TITLE.getTaskKey()).getValue();
|
String title = root.getAttribute(GiteaAttribute.TITLE.getTaskKey()).getValue();
|
||||||
String body = root.getAttribute(GiteaAttribute.BODY.getTaskKey()).getValue();
|
String body = root.getAttribute(GiteaAttribute.BODY.getTaskKey()).getValue();
|
||||||
|
|
||||||
User assignee = null;
|
Long assigneeId = 0L;
|
||||||
// Check assignee is still part of team member
|
|
||||||
|
// TODO : confirm gitea behaviour
|
||||||
|
// We have to check, if the assignee has changed. The gitea api leaves three
|
||||||
|
// posiblities for the assignee ID:
|
||||||
|
// 0: leave as it is
|
||||||
|
// -1: unassign
|
||||||
|
// real id: assign
|
||||||
|
// If we didnt do this, Gitea would create a comment everytime we edit the
|
||||||
|
// issue and there is still no
|
||||||
|
// assignee
|
||||||
for (TaskAttribute a : attributes) {
|
for (TaskAttribute a : attributes) {
|
||||||
if (a.getId().equals(GiteaAttribute.ASSIGNEE.getTaskKey())) {
|
if (a.getId().equals(GiteaAttribute.ASSIGNEE.getTaskKey())) {
|
||||||
assignee = attributeMapper
|
User assignee = attributeMapper
|
||||||
.findProjectMemberByName(root.getAttribute(GiteaAttribute.ASSIGNEE.getTaskKey()).getValue());
|
.findProjectMemberByName(root.getAttribute(GiteaAttribute.ASSIGNEE.getTaskKey()).getValue());
|
||||||
|
assigneeId = (assignee == null ? -1 : assignee.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,73 +108,30 @@ public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
|||||||
.findMilestoneByName(root.getAttribute(GiteaAttribute.MILESTONE.getTaskKey()).getValue());
|
.findMilestoneByName(root.getAttribute(GiteaAttribute.MILESTONE.getTaskKey()).getValue());
|
||||||
Long milestoneId = (milestone == null ? 0 : milestone.getId());
|
Long milestoneId = (milestone == null ? 0 : milestone.getId());
|
||||||
|
|
||||||
GiteaConnection connection = ConnectionManager.get(repository);
|
/*
|
||||||
// FIXME:TODO: support due date
|
* FIXME: Support issue creation GiteaConnection connection =
|
||||||
// OffsetDateTime dueDate =
|
* ConnectionManager.get(repository); Gitlea API api = connection.api(); try {
|
||||||
// OffsetDateTime.GiteaDateTimeUtils.parseDate(root.getAttribute(GiteaAttribute.DUE_DATE.getTaskKey()).getValue());
|
* monitor.beginTask("Uploading task", IProgressMonitor.UNKNOWN); Issue issue =
|
||||||
|
* null; if(data.isNew()) { issue =
|
||||||
try {
|
* api.createIssue(connection.repository.getId(), assigneeId, milestoneId,
|
||||||
//monitor.beginTask("Uploading task", IProgressMonitor.UNKNOWN);
|
* labels, body, title); return new
|
||||||
Issue issue = null;
|
* RepositoryResponse(ResponseKind.TASK_CREATED, "" + issue.getIid()); } else {
|
||||||
if (data.isNew()) {
|
* if(root.getAttribute(TaskAttribute.COMMENT_NEW) != null &&
|
||||||
issue = connection.createIssue(
|
* !root.getAttribute(TaskAttribute.COMMENT_NEW).getValue().equals("")) {
|
||||||
new CreateIssueOption().title(title).body(body).assignee(GiteaUser.getName(assignee))
|
* api.createNote(connection.repository.getId(),
|
||||||
.closed(false).milestone(milestoneId).labels(newLabelIds));
|
* GiteaConnector.getTicketId(data.getTaskId()),
|
||||||
// FIXME Additional attributes like due date have to be set after issue creation
|
* root.getAttribute(TaskAttribute.COMMENT_NEW).getValue()); } String action =
|
||||||
// Always the same caveats about TaskId:
|
* root.getAttribute(TaskAttribute.OPERATION).getValue(); issue =
|
||||||
// - represented by Issue number and not the issue Id which is internal Gitea database id.
|
* api.editIssue(connection.repository.getId(),
|
||||||
// - Issue number is Long where TaskId is string representing an Integer
|
* GiteaConnector.getTicketId(data.getTaskId()), assigneeId, milestoneId,
|
||||||
taskId = Integer.toString(issue.getNumber().intValue());
|
* labels, body, title, GiteaAction.find(action).getGiteaIssueAction()); return
|
||||||
return new RepositoryResponse(ResponseKind.TASK_CREATED, taskId);
|
* new RepositoryResponse(ResponseKind.TASK_UPDATED, "" + issue.getIid()); } }
|
||||||
} else {
|
* catch (IOException e) { throw new
|
||||||
Long issueId = GiteaConnector.getTicketId(taskId);
|
* GiteaException("Unknown connection error!"); } finally { monitor.done(); }
|
||||||
issue = connection.issueGetIssue(issueId);
|
|
||||||
|
|
||||||
// A new comment is available
|
|
||||||
if (root.getAttribute(TaskAttribute.COMMENT_NEW) != null
|
|
||||||
&& !root.getAttribute(TaskAttribute.COMMENT_NEW).getValue().equals("")) {
|
|
||||||
|
|
||||||
connection.issueAddComment(issueId, new CreateIssueCommentOption()
|
|
||||||
.body(root.getAttribute(TaskAttribute.COMMENT_NEW).getValue()));
|
|
||||||
}
|
|
||||||
// Update labels if label list has changed
|
|
||||||
List<Label>oldLabels = issue.getLabels();
|
|
||||||
|
|
||||||
if (!issue.getLabels().equals(newLabelsList)) {
|
|
||||||
connection.issueReplaceLabels(issueId, new IssueLabelsOption().labels(newLabelIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Kept Step by step only for debugging purpose ...
|
|
||||||
String action = root.getAttribute(TaskAttribute.OPERATION).getValue();
|
|
||||||
String state = issue.getState();
|
|
||||||
String newState = IssueAction.getEnum(action).toState(IssueState.getEnum(state)).toString();
|
|
||||||
|
|
||||||
// OffsetDateTime dueDate = new OffsetDateTime();
|
|
||||||
// FIXME:TODO: Support DueDate
|
|
||||||
boolean unsetDueDate = true;
|
|
||||||
|
|
||||||
issue = connection.editIssue(issueId,
|
|
||||||
new EditIssueOption().assignee(GiteaUser.getName(assignee)).milestone(milestoneId).body(body)
|
|
||||||
.state(newState).title(title)
|
|
||||||
// .dueDate(dueDate)
|
|
||||||
.unsetDueDate(unsetDueDate));
|
|
||||||
return new RepositoryResponse(ResponseKind.TASK_UPDATED, taskId);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new GiteaException("Unknown connection error!");
|
|
||||||
} finally {
|
|
||||||
//monitor.done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get task data including comments from remote issue id.
|
|
||||||
*
|
|
||||||
* @param repository
|
|
||||||
* @param ticketId
|
|
||||||
* @return
|
|
||||||
* @throws CoreException
|
|
||||||
*/
|
*/
|
||||||
|
return null;// FIXME:
|
||||||
|
}
|
||||||
|
|
||||||
public TaskData downloadTaskData(TaskRepository repository, Long ticketId) throws CoreException {
|
public TaskData downloadTaskData(TaskRepository repository, Long ticketId) throws CoreException {
|
||||||
try {
|
try {
|
||||||
GiteaConnection connection = ConnectionManager.get(repository);
|
GiteaConnection connection = ConnectionManager.get(repository);
|
||||||
@ -262,7 +201,7 @@ public class GiteaTaskDataHandler extends AbstractTaskDataHandler {
|
|||||||
for (Comment note : notes) {
|
for (Comment note : notes) {
|
||||||
TaskCommentMapper cmapper = new TaskCommentMapper();
|
TaskCommentMapper cmapper = new TaskCommentMapper();
|
||||||
cmapper.setAuthor(repository.createPerson(GiteaUser.getName(note.getUser())));
|
cmapper.setAuthor(repository.createPerson(GiteaUser.getName(note.getUser())));
|
||||||
cmapper.setCreationDate(GiteaDateTimeUtils.toDate(note.getCreatedAt()));// FIXME:
|
cmapper.setCreationDate(GiteaDateTimeUtils.toDate(note.getCreatedAt()));//FIXME:
|
||||||
cmapper.setText(note.getBody());
|
cmapper.setText(note.getBody());
|
||||||
cmapper.setNumber(++i);
|
cmapper.setNumber(++i);
|
||||||
TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_COMMENT + (i + 1));
|
TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_COMMENT + (i + 1));
|
||||||
|
Loading…
Reference in New Issue
Block a user