2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.remote
.json
.processor
.bean
;
12 import java
.util
.Arrays
;
13 import java
.util
.List
;
15 import org
.apache
.commons
.lang
.StringUtils
;
16 import org
.apache
.logging
.log4j
.LogManager
;import org
.apache
.logging
.log4j
.Logger
;
18 import eu
.etaxonomy
.cdm
.model
.common
.Language
;
19 import eu
.etaxonomy
.cdm
.model
.term
.Representation
;
20 import net
.sf
.json
.JSONObject
;
21 import net
.sf
.json
.JsonConfig
;
24 * @author a.kohlbecker
27 public class RepresentationBeanProcessor
extends AbstractCdmBeanProcessor
<Representation
> {
29 public static final Logger logger
= LogManager
.getLogger(RepresentationBeanProcessor
.class);
31 private static final List
<String
> IGNORE_LIST
= Arrays
.asList(new String
[] {
38 public List
<String
> getIgnorePropNames() {
43 public JSONObject
processBeanSecondStep(Representation representation
, JSONObject json
, JsonConfig jsonConfig
) {
45 if (representation
.getText() != null){
46 json
.element("description", representation
.getText());
48 Language language
= representation
.getLanguage();
49 if (language
!= null) {
50 String iso
= StringUtils
.isEmpty(language
.getIso639_2())? language
.getIso639_1() : language
.getIso639_2();
52 json
.element("languageIso", iso
);
54 json
.element("languageUuid", language
.getUuid().toString());