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
.List
;
15 import net
.sf
.json
.CycleSetAcess
;
16 import net
.sf
.json
.JSONObject
;
17 import net
.sf
.json
.JsonConfig
;
18 import net
.sf
.json
.processors
.JsonBeanProcessor
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
20 import eu
.etaxonomy
.cdm
.remote
.dto
.TaggedText
;
23 * WARNING! The idea i started implementing here will not work at all!!
24 * @author a.kohlbecker
27 public class TaxonNodeDaoBeanProcessor
extends CycleSetAcess
implements JsonBeanProcessor
{
31 * @see net.sf.json.processors.JsonBeanProcessor#processBean(java.lang.Object, net.sf.json.JsonConfig)
33 public JSONObject
processBean(Object bean
, JsonConfig jsonConfig
) {
35 TaxonNode node
= (TaxonNode
)bean
;
36 JSONObject json
= new JSONObject();
37 json
.element("class", "TaxonNodeDao");
38 json
.element("titleCache", node
.getTaxon().getName().getTitleCache(), jsonConfig
);
39 List
<TaggedText
> taggedTitle
= TaxonNameBaseBeanProcessor
.getTaggedName(node
.getTaxon().getName());
40 json
.element("taggedTitle", taggedTitle
, jsonConfig
);
41 json
.element("taxonUuid", node
.getTaxon().getUuid(), jsonConfig
);
42 json
.element("secUuid", node
.getTaxon().getSec().getUuid(), jsonConfig
);
43 json
.element("taxonomicChildrenCount", node
.getCountChildren(), jsonConfig
);
44 String ranklabel
= null;
45 if(node
.getTaxon().getName().getRank() != null){
46 ranklabel
= node
.getTaxon().getName().getRank().getLabel();
48 json
.element("rankLabel", ranklabel
, jsonConfig
);
49 //json.element("treeUuid", node.getTaxonomicTree().getUuid(), jsonConfig);