mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Mantis connector. Serialization problem.
This commit is contained in:
@@ -711,7 +711,7 @@ public class TaskManagerImpl extends TaskManager implements ProjectComponent, Pe
|
||||
}
|
||||
}
|
||||
|
||||
private void doUpdate(Runnable onComplete) {
|
||||
private void doUpdate(@Nullable Runnable onComplete) {
|
||||
try {
|
||||
List<Task> issues = getIssuesFromRepositories(null, myConfig.updateIssuesCount, 0, false);
|
||||
if (issues == null) return;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class TaskUtil {
|
||||
|
||||
public static String formatTask(@NotNull Task task, String format) {
|
||||
return format.replace("{id}", task.getId()).replace("{number}", task.getNumber())
|
||||
.replace("{project}", task.getProject()).replace("{summary}", task.getSummary());
|
||||
.replace("{project}", task.getProject() == null ? "" : task.getProject()).replace("{summary}", task.getSummary());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -10,6 +10,10 @@ public class MantisFilter {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public MantisFilter() {
|
||||
}
|
||||
|
||||
public MantisFilter(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
@@ -10,6 +10,10 @@ public class MantisProject {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public MantisProject() {
|
||||
}
|
||||
|
||||
public MantisProject(final int id, final String name) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.intellij.tasks.mantis;
|
||||
import biz.futureware.mantis.rpc.soap.client.*;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.tasks.Task;
|
||||
import com.intellij.tasks.TaskRepositoryType;
|
||||
import com.intellij.tasks.actions.TaskSearchSupport;
|
||||
@@ -64,7 +63,7 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
MantisConnectPortType soap = createSoap();
|
||||
try {
|
||||
IssueData[] issues;
|
||||
if (myFilter == MantisFilter.LAST_TASKS) {
|
||||
if (MantisFilter.LAST_TASKS.equals(myFilter)) {
|
||||
issues = soap.mc_project_get_issues(getUsername(), getPassword(), BigInteger.valueOf(myProject.getId()), BigInteger.ZERO,
|
||||
BigInteger.valueOf(max));
|
||||
}
|
||||
@@ -73,21 +72,22 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
BigInteger.valueOf(myFilter.getId()), BigInteger.ZERO, BigInteger.valueOf(max));
|
||||
}
|
||||
final List<Task> filteredTasks =
|
||||
TaskSearchSupport.filterTasks(request == null ? "" : request, ContainerUtil.mapNotNull(issues, new NullableFunction<IssueData, Task>() {
|
||||
public Task fun(IssueData issueData) {
|
||||
try {
|
||||
return createIssue(issueData);
|
||||
TaskSearchSupport
|
||||
.filterTasks(request == null ? "" : request, ContainerUtil.mapNotNull(issues, new NullableFunction<IssueData, Task>() {
|
||||
public Task fun(IssueData issueData) {
|
||||
try {
|
||||
return createIssue(issueData);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
return filteredTasks.toArray(new Task[filteredTasks.size()]);
|
||||
}
|
||||
catch (Exception e) {
|
||||
IssueHeaderData[] issues;
|
||||
if (myFilter == MantisFilter.LAST_TASKS) {
|
||||
if (MantisFilter.LAST_TASKS.equals(myFilter)) {
|
||||
issues = soap.mc_project_get_issue_headers(getUsername(), getPassword(), BigInteger.valueOf(myProject.getId()), BigInteger.ZERO,
|
||||
BigInteger.valueOf(max));
|
||||
}
|
||||
@@ -96,16 +96,17 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
BigInteger.valueOf(myFilter.getId()), BigInteger.ZERO, BigInteger.valueOf(max));
|
||||
}
|
||||
final List<Task> filteredTasks =
|
||||
TaskSearchSupport.filterTasks(request == null ? "" : request, ContainerUtil.mapNotNull(issues, new NullableFunction<IssueHeaderData, Task>() {
|
||||
public Task fun(IssueHeaderData issueHeaderData) {
|
||||
try {
|
||||
return createIssue(issueHeaderData);
|
||||
TaskSearchSupport
|
||||
.filterTasks(request == null ? "" : request, ContainerUtil.mapNotNull(issues, new NullableFunction<IssueHeaderData, Task>() {
|
||||
public Task fun(IssueHeaderData issueHeaderData) {
|
||||
try {
|
||||
return createIssue(issueHeaderData);
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
return filteredTasks.toArray(new Task[filteredTasks.size()]);
|
||||
}
|
||||
}
|
||||
@@ -137,12 +138,7 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
if (id == null) return null;
|
||||
String summary = data.getSummary();
|
||||
if (summary == null) return null;
|
||||
LocalTaskImpl task = new MantisTask(id, summary, ContainerUtil.find(getProjects(), new Condition<MantisProject>() {
|
||||
@Override
|
||||
public boolean value(final MantisProject project) {
|
||||
return project.getId() == data.getId().intValue();
|
||||
}
|
||||
}), this) {
|
||||
LocalTaskImpl task = new MantisTask(id, summary, myProject, this) {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return data.getDescription();
|
||||
@@ -160,12 +156,7 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
if (id == null) return null;
|
||||
String summary = data.getSummary();
|
||||
if (summary == null) return null;
|
||||
LocalTaskImpl task = new MantisTask(id, summary, ContainerUtil.find(getProjects(), new Condition<MantisProject>() {
|
||||
@Override
|
||||
public boolean value(final MantisProject project) {
|
||||
return project.getId() == data.getId().intValue();
|
||||
}
|
||||
}), this);
|
||||
LocalTaskImpl task = new MantisTask(id, summary, myProject, this);
|
||||
|
||||
task.setIssue(true);
|
||||
task.setUpdated(data.getLast_updated().getTime());
|
||||
@@ -201,7 +192,7 @@ public class MantisRepository extends BaseRepositoryImpl {
|
||||
FilterData[] filterDatas = soap.mc_filter_get(getUsername(), getPassword(), BigInteger.valueOf(project.getId()));
|
||||
List<MantisFilter> filters = new ArrayList<MantisFilter>();
|
||||
String version = soap.mc_version();
|
||||
if (project != MantisProject.ALL_PROJECTS || !version.startsWith("1.1")) {
|
||||
if (!MantisProject.ALL_PROJECTS.equals(project) || !version.startsWith("1.1")) {
|
||||
filters.add(MantisFilter.LAST_TASKS);
|
||||
}
|
||||
filters.addAll(ContainerUtil.map(filterDatas, new Function<FilterData, MantisFilter>() {
|
||||
|
||||
@@ -27,6 +27,6 @@ public class MantisTask extends LocalTaskImpl {
|
||||
@Nullable
|
||||
@Override
|
||||
public String getProject() {
|
||||
return myProject.getName();
|
||||
return !MantisProject.ALL_PROJECTS.equals(myProject) ? myProject.getName() : null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user