markus
I'm new here

DataProvider.getData() Ersetzung

Jump to solution

Hallo,

da die Methode getData() im DataProvider als deprecated gekennzeichnet ist,

brauche ich für den folgenden Codeblock eine Ersetzung.

Der Code kopiert den Inhalt von einer Sprache des Knotens in eine andere Sprache.

SectionList sectionList = contentAreaListValue.get(sourceLanguage);

for (Section<?> section : sectionList) {

    List<String> variableNames = section.getData().getVariableNames();

    for (String variable : variableNames) {

        EditorValue editorValue = (EditorValue) section.getData().get(variable).getEditor();

        if (editorValue.isLanguageDependent()) {

            editorValue.set(targetLanguage, editorValue.get(sourceLanguage));

            section.setData(editorValue.getDataValue().getData());

        }

    }

}

Kann mir jemand einen Ansatz geben?

1 Solution

Accepted Solutions
andre
I'm new here

> @deprecated since 4.2.440 - use {@link #getFormData()} instead

also sowas in der art

for (Section section : sectionList) {

            final FormData formData = section.getFormData();

            final List<String> variableNames = formData.getForm().appendEditorNames(null);

            for (final String variableName : variableNames) {

                final FormField<?> formField = formData.get(sourceLanguage, variableName);

                final Object sourceValue = sourceFormField.get();

               

                final GomFormElement formElement = formData.getForm().findEditor(variableName);

                if (formElement != null) {

                    if (formElement.usesLanguages()) {

                        formData.get(targetLanguage, variableName).set(sourceValue);

                    }

                }

            }

        }

ohne Gewähr

View solution in original post

1 Reply
andre
I'm new here

> @deprecated since 4.2.440 - use {@link #getFormData()} instead

also sowas in der art

for (Section section : sectionList) {

            final FormData formData = section.getFormData();

            final List<String> variableNames = formData.getForm().appendEditorNames(null);

            for (final String variableName : variableNames) {

                final FormField<?> formField = formData.get(sourceLanguage, variableName);

                final Object sourceValue = sourceFormField.get();

               

                final GomFormElement formElement = formData.getForm().findEditor(variableName);

                if (formElement != null) {

                    if (formElement.usesLanguages()) {

                        formData.get(targetLanguage, variableName).set(sourceValue);

                    }

                }

            }

        }

ohne Gewähr