Project

General

Profile

Revision ce3b4e95

IDce3b4e95e09db3fcb3cb13232a795087493b32e3
Parent c26edffc
Child 2bbac2af

Added by Andreas Müller 12 months ago

ref #7508 fix inverse L10n term representation

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TermBaseBeanProcessor.java
70 70
        }
71 71

  
72 72
        ITermRepresentation_L10n representation_L10n = new TermRepresentation_L10n(term, false);
73
        handleL10nRepresentation(json, representation_L10n);
73
        handleL10nRepresentation(json, representation_L10n, false);
74 74
        if(!replaceRepresentations){
75 75
            json.element("representations", term.getRepresentations(), jsonConfig);
76 76
        }
......
79 79
        if(RelationshipTermBase.class.isAssignableFrom(term.getClass())){
80 80
            RelationshipTermBase<?> relTerm = (RelationshipTermBase<?>)term;
81 81
            ITermRepresentation_L10n inverseRepresentation_L10n = new TermRepresentation_L10n(relTerm, true);
82
            handleL10nRepresentation(json, inverseRepresentation_L10n);
82
            handleL10nRepresentation(json, inverseRepresentation_L10n, true);
83 83
            if(!replaceRepresentations){
84 84
                json.element("inverseRepresentations", relTerm.getInverseRepresentations(), jsonConfig);
85 85
            }
......
91 91
     * @param json
92 92
     * @param representation_L10n
93 93
     */
94
    private void handleL10nRepresentation(JSONObject json, ITermRepresentation_L10n representation_L10n) {
94
    private void handleL10nRepresentation(JSONObject json, ITermRepresentation_L10n representation_L10n, boolean isInverse) {
95
        String baseLabel = isInverse? "inverseRepresentation_L10n" : "representation_L10n";
95 96
        if (representation_L10n.getLabel() != null) {
96
            json.element("representation_L10n",representation_L10n.getLabel());
97
            json.element(baseLabel,representation_L10n.getLabel());
97 98
        }
98 99
        if (representation_L10n.getAbbreviatedLabel() != null) {
99
            json.element("representation_L10n_abbreviatedLabel", representation_L10n.getAbbreviatedLabel());
100
            json.element(baseLabel + "_abbreviatedLabel", representation_L10n.getAbbreviatedLabel());
100 101
        }
101 102
        if (representation_L10n.getAbbreviatedLabel() != null) {
102
            json.element("representation_L10n_language_iso", representation_L10n.getLanguageIso());
103
            json.element(baseLabel + "_languageIso", representation_L10n.getLanguageIso());
103 104
        }
104 105
        if (representation_L10n.getAbbreviatedLabel() != null) {
105
            json.element("representation_L10n_language_uuid", representation_L10n.getLanguageUuid());
106
            json.element(baseLabel + "_languageUuid", representation_L10n.getLanguageUuid());
106 107
        }
107 108
    }
108 109

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)