Fix issue with unordered multiplicity fields
This commit is contained in:
parent
faeb7e0d62
commit
06364873ca
|
@ -741,7 +741,7 @@ public class DatasetManager {
|
|||
}
|
||||
|
||||
private String propertiesModelToString(PagedDatasetProfile pagedDatasetProfile) {
|
||||
Map<String, Object> values = new HashMap();
|
||||
Map<String, Object> values = new LinkedHashMap<>();
|
||||
pagedDatasetProfile.toMap(values);
|
||||
JSONObject jobject = new JSONObject(values);
|
||||
return jobject.toString();
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
import java.math.BigInteger;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WordBuilder {
|
||||
private static final Logger logger = LoggerFactory.getLogger(WordBuilder.class);
|
||||
|
@ -178,7 +179,8 @@ public class WordBuilder {
|
|||
}
|
||||
hasValue = createFields(compositeField.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
if (compositeField.getMultiplicityItems() != null && !compositeField.getMultiplicityItems().isEmpty()) {
|
||||
for (FieldSet multiplicityFieldset : compositeField.getMultiplicityItems()) {
|
||||
List<FieldSet> list = compositeField.getMultiplicityItems().stream().sorted(Comparator.comparingInt(FieldSet::getOrdinal)).collect(Collectors.toList());
|
||||
for (FieldSet multiplicityFieldset : list) {
|
||||
hasValue = createFields(multiplicityFieldset.getFields(), mainDocumentPart, 3, createListing, visibilityRuleService);
|
||||
}
|
||||
}
|
||||
|
@ -198,7 +200,8 @@ public class WordBuilder {
|
|||
private Boolean createFields(List<Field> fields, XWPFDocument mainDocumentPart, Integer indent, Boolean createListing, VisibilityRuleService visibilityRuleService) {
|
||||
if (createListing) this.addListing(mainDocumentPart, indent, false, false);
|
||||
boolean hasValue = false;
|
||||
for (Field field: fields) {
|
||||
List<Field> tempFields = fields.stream().sorted(Comparator.comparingInt(Field::getOrdinal)).collect(Collectors.toList());
|
||||
for (Field field: tempFields) {
|
||||
if (visibilityRuleService.isElementVisible(field.getId())) {
|
||||
if (!createListing) {
|
||||
try {
|
||||
|
|
|
@ -175,12 +175,12 @@ public class FieldSet implements Comparable, PropertiesModelBuilder, ViewStyleDe
|
|||
|
||||
private FieldSet CloneForMultiplicity2(List<String> key, Map<String, Object> properties,String[] ids, int index){
|
||||
FieldSet newFieldSet = new FieldSet();
|
||||
newFieldSet.id = ids[0]+"_"+ids[1]+"_"+ids[2];
|
||||
newFieldSet.id = ids[0]+"_"+ids[1]+"_"+ids[2] + (ids.length > 4 ? "_" + ids[3] : "");
|
||||
newFieldSet.description = this.description;
|
||||
newFieldSet.extendedDescription = this.extendedDescription;
|
||||
newFieldSet.additionalInformation=this.additionalInformation;
|
||||
newFieldSet.title = this.title;
|
||||
newFieldSet.ordinal = this.ordinal;
|
||||
newFieldSet.ordinal = ids.length > 4 ? Integer.valueOf(ids[3]) : this.ordinal;
|
||||
newFieldSet.fields = new LinkedList();
|
||||
|
||||
for (Field field: this.fields) {
|
||||
|
|
|
@ -196,7 +196,7 @@ export class DatasetDescriptionCompositeFieldEditorModel extends BaseFormModel {
|
|||
|
||||
cloneForMultiplicity(item: CompositeField, ordinal: number, idMappings:{old:string, new:string}[] = []): DatasetDescriptionCompositeFieldEditorModel {
|
||||
const newItem: DatasetDescriptionCompositeFieldEditorModel = new DatasetDescriptionCompositeFieldEditorModel();
|
||||
newItem.id = 'multiple_' + item.id + '_' + Guid.create();
|
||||
newItem.id = 'multiple_' + item.id + '_' + Guid.create() + '_' + ordinal;
|
||||
|
||||
idMappings.push({old: item.id, new: newItem.id });
|
||||
item.fields.forEach((field, index) => {
|
||||
|
|
Loading…
Reference in New Issue