field builder fix
This commit is contained in:
parent
4d50aefacd
commit
993406e3f0
|
@ -101,10 +101,19 @@ public class FieldBuilder extends BaseBuilder<Field, FieldEntity> {
|
||||||
},
|
},
|
||||||
Reference::getId);
|
Reference::getId);
|
||||||
} else {
|
} else {
|
||||||
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(Reference._id);
|
List<UUID> ids = new ArrayList<>();
|
||||||
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()));
|
for (FieldEntity field: data) {
|
||||||
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);
|
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(ids);
|
||||||
|
itemMap = this.builderFactory.builder(ReferenceBuilder.class).authorize(this.authorize).asForeignKey(q, clone, Reference::getId);;
|
||||||
|
}
|
||||||
|
|
||||||
if (!fields.hasField(Reference._id)) {
|
if (!fields.hasField(Reference._id)) {
|
||||||
itemMap.forEach((id, item) -> {
|
itemMap.forEach((id, item) -> {
|
||||||
if (item != null)
|
if (item != null)
|
||||||
|
|
Loading…
Reference in New Issue