3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.cdm
.remote
.json
.processor
.bean
;
13 import java
.util
.HashSet
;
14 import java
.util
.List
;
16 import java
.util
.UUID
;
18 import org
.hibernate
.Hibernate
;
20 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.cdm
.remote
.dto
.TaggedText
;
24 import net
.sf
.json
.CycleSetAcess
;
25 import net
.sf
.json
.JSONObject
;
26 import net
.sf
.json
.JsonConfig
;
27 import net
.sf
.json
.processors
.JsonBeanProcessor
;
30 * WARNING! The idea i started implementing here will not work at all!!
31 * @author a.kohlbecker
34 public class TaxonomyNodeBeanProcessor
extends CycleSetAcess
implements JsonBeanProcessor
{
38 * @see net.sf.json.processors.JsonBeanProcessor#processBean(java.lang.Object, net.sf.json.JsonConfig)
40 public JSONObject
processBean(Object bean
, JsonConfig jsonConfig
) {
42 Taxon taxon
= (Taxon
)bean
;
43 JSONObject json
= new JSONObject();
44 json
.element("titleCache", taxon
.getName().getTitleCache(), jsonConfig
);
45 List
<TaggedText
> taggedTitle
= TaxonNameBaseBeanProcessor
.getTaggedName(taxon
.getName());
46 json
.element("taggedTitle", taggedTitle
, jsonConfig
);
47 json
.element("rankLabel", taxon
.getName().getRank().getLabel(), jsonConfig
);
48 json
.element("uuid", taxon
.getUuid(), jsonConfig
);
49 json
.element("secUuid", taxon
.getSec().getUuid(), jsonConfig
);
50 json
.element("taxonomicChildrenCount", taxon
.getTaxonomicChildrenCount(), jsonConfig
);