Fixes bug not printing "multiple autocomplete" properties on Dataset export.
This commit is contained in:
parent
6818eaf8bf
commit
fe69154353
|
@ -4,7 +4,6 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
|||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import eu.eudat.logic.services.forms.VisibilityRuleService;
|
||||
import eu.eudat.logic.utilities.documents.types.ParagraphStyle;
|
||||
import eu.eudat.logic.utilities.documents.types.TextStyle;
|
||||
import eu.eudat.logic.utilities.interfaces.ApplierWithValue;
|
||||
import eu.eudat.models.data.components.commons.datafield.CheckBoxData;
|
||||
import eu.eudat.models.data.components.commons.datafield.ComboBoxData;
|
||||
|
@ -14,6 +13,8 @@ import eu.eudat.models.data.user.components.datasetprofile.Section;
|
|||
import eu.eudat.models.data.user.composite.DatasetProfilePage;
|
||||
import eu.eudat.models.data.user.composite.PagedDatasetProfile;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTAbstractNum;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDecimalNumber;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLvl;
|
||||
|
@ -208,9 +209,30 @@ public class WordBuilder {
|
|||
if (comboboxType.equals("autocomplete")) {
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
if (field.getValue() == null) return null;
|
||||
Map<String, String> map = mapper.readValue(field.getValue(), new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
return map.get("label");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if (!field.getValue().equals("")) {
|
||||
try {
|
||||
JSONArray jsonarray = new JSONArray(field.getValue());
|
||||
for (int i = 0; i < jsonarray.length(); i++) {
|
||||
JSONObject jsonobject = jsonarray.getJSONObject(i);
|
||||
String id = jsonobject.getString("id");
|
||||
String label = jsonobject.getString("label");
|
||||
if (id != null && label != null) {
|
||||
map.put(id, label);
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
Map<String, String> exMap = mapper.readValue(field.getValue(), new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
return exMap.get("label");
|
||||
}
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
sb.append("\n");
|
||||
sb.append(entry.getValue());
|
||||
}
|
||||
return sb.toString();
|
||||
} else if (comboboxType.equals("wordlist")) {
|
||||
return field.getValue();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue