This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueFieldTransformer.java | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| --- ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueFieldTransformer.java (revision 7203fef314cb301f7e023083337f688ba63b90af) | |
| +++ ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueFieldTransformer.java (revision ) | |
| @@ -86,7 +86,6 @@ | |
| private PropertysetItem delegateAggregatorItem = new PropertysetItem(); | |
| - | |
| /** | |
| * @deprecated since 5.4.2 - use {@link #DelegatingMultiValueFieldTransformer(Item, ConfiguredFieldDefinition, Class, I18NAuthoringSupport)} instead. | |
| */ | |
| @@ -147,7 +146,15 @@ | |
| @Override | |
| public Property<?> createProperty() { | |
| final String newItemName = createNewItemName(); | |
| - final JcrNodeAdapter child = new JcrNewNodeAdapter(getRootItem().getJcrItem(), childNodeType, newItemName); | |
| + | |
| + final JcrNodeAdapter child; | |
| + | |
| + // Should be check the new Item Name existed because it can be created already from other language form. | |
| + if (getRootItem().getChild(newItemName) != null) { | |
| + child = (JcrNodeAdapter) getRootItem().getChild(newItemName); | |
| + } else { | |
| + child = new JcrNewNodeAdapter(getRootItem().getJcrItem(), childNodeType, newItemName); | |
| + } | |
| child.setParent(getRootItem()); | |
| child.getParent().addChild(child); | |
| Index: ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueSubnodeTransformer.java | |
| IDEA additional info: | |
| Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
| <+>UTF-8 | |
| =================================================================== | |
| --- ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueSubnodeTransformer.java (revision 7203fef314cb301f7e023083337f688ba63b90af) | |
| +++ ../../git/magnolia-5.4-repo/ui/magnolia-ui-form/src/main/java/info/magnolia/ui/form/field/transformer/multi/DelegatingMultiValueSubnodeTransformer.java (revision ) | |
| @@ -73,6 +73,13 @@ | |
| public DelegatingMultiValueSubnodeTransformer(Item relatedFormItem, ConfiguredFieldDefinition definition, Class<PropertysetItem> type, I18NAuthoringSupport i18NAuthoringSupport) { | |
| super(relatedFormItem, definition, type, i18NAuthoringSupport); | |
| + | |
| + // In case the child item has been create already but hasn't persisted yet | |
| + if (subNode == null) { | |
| + if (((JcrNodeAdapter) relatedFormItem).getChildren().containsKey(definition.getName())) { | |
| + subNode = (JcrNodeAdapter) ((JcrNodeAdapter) relatedFormItem).getChildren().get(definition.getName()); | |
| + } | |
| + } | |
| } | |
| /** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment