Allow plugins to define custom data in SubmitRequirement

Replace the raw short/long reasons of SubmitRequirement with a dynamic
type and map, allowing for more powerful implementations later.
Also remove the label field, superseeded by the data Map.

Use AutoValues for the SubmitRequirement class, as it is marked
GwtIncompatible.

The idea behind this change is to provide a future proof API that
both plugins and end users will enjoy. A user interface is being
worked on, and will benefit of these changes.

Change-Id: I030609cd164d308f2231a2abba2eb16b09524b7f
This commit is contained in:
Maxime Guerreiro
2018-04-03 17:26:28 +00:00
parent 3817100d4a
commit 36c9725f3f
8 changed files with 106 additions and 78 deletions

View File

@@ -261,9 +261,9 @@ public class EventFactory {
sa.requirements = new ArrayList<>();
for (SubmitRequirement req : submitRecord.requirements) {
SubmitRequirementAttribute re = new SubmitRequirementAttribute();
re.shortReason = req.shortReason();
re.fullReason = req.fullReason();
re.label = req.label().orElse(null);
re.fallbackText = req.fallbackText();
re.type = req.type();
re.data = req.data();
sa.requirements.add(re);
}
}