Skip to content

Commit 8372c3f

Browse files
author
Michael Cuthbert
authored
Merge pull request #76 from mb301878/dev
add errorTags field to Task object
2 parents 2d7d20c + 69e2279 commit 8372c3f

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/main/java/org/maproulette/client/model/Task.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ public TaskBuilder addGeojson(final String geojson)
9393
return this;
9494
}
9595

96+
public TaskBuilder addErrorTags(final String errorTags)
97+
{
98+
this.errorTags = errorTags;
99+
return this;
100+
}
101+
96102
public TaskBuilder resetGeometry()
97103
{
98104
this.geoJson = this.mapper.createArrayNode();
@@ -128,8 +134,13 @@ public Task build()
128134
{
129135
this.parent(-1);
130136
}
137+
if (this.errorTags == null)
138+
{
139+
this.errorTags = "";
140+
}
131141
return new Task(this.id, this.parent, this.name, this.instruction, this.location,
132-
this.status, this.priority, this.geometries, this.tags, null, null, null);
142+
this.status, this.priority, this.geometries, this.tags, null, null, null,
143+
this.errorTags);
133144
}
134145

135146
protected ArrayNode generateTaskFeatures(final Set<PointInformation> source,
@@ -204,6 +215,7 @@ private JsonNode buildGeometries() throws MapRouletteException
204215
private Long completedBy;
205216
private Long completedTimeSpent;
206217
private String mappedOn;
218+
private String errorTags;
207219

208220
public static TaskBuilder builder(final long parentIdentifier, final String name)
209221
{

src/test/java/org/maproulette/client/model/TaskTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,24 @@ public void taskHashcodeTest()
8989
task2 = task2.toBuilder().name("Task2").build();
9090
Assertions.assertNotEquals(task1.hashCode(), task2.hashCode());
9191
}
92+
93+
@Test
94+
public void taskWithErrorTags()
95+
{
96+
final List<String> testTags = Arrays.asList("fixtype=testing", "usecase=1");
97+
final var task = Task.builder(1234, "Task1")
98+
.addGeojson(String.format(TestConstants.FEATURE_STRING, 1.2, 4.5, "TestG"))
99+
.errorTags("dummyErrorTags").tags(testTags).build();
100+
Assertions.assertEquals("dummyErrorTags", task.getErrorTags());
101+
}
102+
103+
@Test
104+
public void taskWithoutErrorTags()
105+
{
106+
final List<String> testTags = Arrays.asList("fixtype=testing", "usecase=1");
107+
final var task = Task.builder(1234, "Task1")
108+
.addGeojson(String.format(TestConstants.FEATURE_STRING, 1.2, 4.5, "TestG"))
109+
.tags(testTags).build();
110+
Assertions.assertEquals("", task.getErrorTags());
111+
}
92112
}

0 commit comments

Comments
 (0)