|
|
|
@ -101,10 +101,19 @@ public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
|
|
|
|
|
},
|
|
|
|
|
Reference::getId);
|
|
|
|
|
} else {
|
|
|
|
|
List<UUID> ids = new ArrayList<>();
|
|
|
|
|
for (FieldEntity field: data) {
|
|
|
|
|
if (field.getTextListValue() != null) {
|
|
|
|
|
for (String value: field.getTextListValue()) {
|
|
|
|
|
if (value != null && !ids.contains(value)) ids.add(UUID.fromString(value));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
|
|
|
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(data.stream().map(FieldEntity::getTextListValue).flatMap(List::stream).map(UUID::fromString).distinct().collect(Collectors.toList()));
|
|
|
|
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
|
|
|
|
ReferenceQuery q = this.queryFactory.query(ReferenceQuery.class).authorize(this.authorize).ids(ids);
|
|
|
|
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!fields.hasField(Reference._id)) {
|
|
|
|
|
itemMap.forEach((id, item) -> {
|
|
|
|
|
if (item != null)
|
|
|
|
|