diff options
Diffstat (limited to 'connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java')
-rw-r--r-- | connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java index 6d6b0459e..b6dc5ded6 100644 --- a/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java +++ b/connector-bugzilla-rest/org.eclipse.mylyn.bugzilla.rest.core/src/org/eclipse/mylyn/internal/bugzilla/rest/core/BugzillaRestGsonUtil.java @@ -17,6 +17,8 @@ import java.io.IOException; import java.util.HashSet; import java.util.Set; +import org.eclipse.mylyn.tasks.core.data.TaskAttribute; + import com.google.common.base.Function; import com.google.common.collect.Iterables; import com.google.common.collect.Sets; @@ -151,4 +153,25 @@ public class BugzillaRestGsonUtil { gson.toJson(test, RemoveAddIntegerHelper.class, out); } + public static void buildFlags(JsonWriter out, Set<TaskAttribute> oldAttributes, TaskAttribute rootTaskData) + throws IOException { + boolean flagFound = false; + for (TaskAttribute element : oldAttributes) { + TaskAttribute taskAttribute = rootTaskData.getAttribute(element.getId()); + String id = taskAttribute.getId(); + if (id.startsWith(IBugzillaRestConstants.KIND_FLAG) + || id.startsWith(IBugzillaRestConstants.KIND_FLAG_TYPE)) { + if (!flagFound) { + out.name("flags").beginArray(); //$NON-NLS-1$ + } + BugzillaRestFlagMapper flagMapper = BugzillaRestFlagMapper.createFrom(taskAttribute); + flagMapper.applyTo(out); + flagFound = true; + } + } + if (flagFound) { + out.endArray(); + } + } + }
\ No newline at end of file |