mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EDU-858 Migration doesn't work from version 2.0 to 3.5
We don't add attributes that can be empty when migrating from 2.0 to 3.0, so we got exception when trying to get these attributes in 3.0 format
This commit is contained in:
+6
-4
@@ -219,17 +219,19 @@ public class StudySerializationUtils {
|
||||
for (Element placeholder : getChildList(taskFileElement, ANSWER_PLACEHOLDERS)) {
|
||||
Element valueElement = new Element(SUBTASK_INFO);
|
||||
addChildMap(placeholder, SUBTASK_INFOS, Collections.singletonMap(String.valueOf(0), valueElement));
|
||||
for (String childName : ContainerUtil.list(HINT, ADDITIONAL_HINTS, POSSIBLE_ANSWER, SELECTED, STATUS, TASK_TEXT)) {
|
||||
Element child = getChildWithName(placeholder, childName);
|
||||
for (String childName : ContainerUtil.list(HINT, POSSIBLE_ANSWER, SELECTED, STATUS, TASK_TEXT)) {
|
||||
Element child = getChildWithName(placeholder, childName, true);
|
||||
if (child == null) {
|
||||
continue;
|
||||
}
|
||||
valueElement.addContent(child.clone());
|
||||
}
|
||||
renameElement(getChildWithName(valueElement, TASK_TEXT), PLACEHOLDER_TEXT);
|
||||
List<Element> additionalHints = ContainerUtil.map(getChildList(valueElement, ADDITIONAL_HINTS), Element::clone);
|
||||
Element hint = getChildWithName(valueElement, HINT);
|
||||
Element firstHint = new Element(OPTION).setAttribute(VALUE, hint.getAttributeValue(VALUE));
|
||||
List<Element> newHints = new ArrayList<>();
|
||||
newHints.add(firstHint);
|
||||
newHints.addAll(additionalHints);
|
||||
newHints.addAll(ContainerUtil.map(getChildList(placeholder, ADDITIONAL_HINTS, true), Element::clone));
|
||||
addChildList(valueElement, "hints", newHints);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,11 +69,6 @@
|
||||
<value>
|
||||
<AnswerPlaceholderSubtaskInfo>
|
||||
<option name="hint" value="hint 1"/>
|
||||
<option name="additionalHints">
|
||||
<list>
|
||||
<option value="hint 2"/>
|
||||
</list>
|
||||
</option>
|
||||
<option name="possibleAnswer" value="Liana"/>
|
||||
<option name="selected" value="false"/>
|
||||
<option name="status" value="Solved"/>
|
||||
|
||||
Reference in New Issue
Block a user