// $Id$\r
/**\r
* Copyright (C) 2007 EDIT\r
- * European Distributed Institute of Taxonomy \r
+ * European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
- * \r
+ *\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
\r
import java.util.List;\r
\r
-import net.sf.json.CycleSetAcess;\r
import net.sf.json.JSONObject;\r
import net.sf.json.JsonConfig;\r
import net.sf.json.processors.JsonBeanProcessor;\r
import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
-import eu.etaxonomy.cdm.remote.dto.TaggedText;\r
+import eu.etaxonomy.cdm.strategy.TaggedText;\r
+import eu.etaxonomy.cdm.strategy.TaggedTextGenerator;\r
\r
/**\r
- * WARNING! The idea i started implementing here will not work at all!!\r
* @author a.kohlbecker\r
+ * @date 29.07.2010\r
*\r
*/\r
-public class TaxonNodeDaoBeanProcessor extends CycleSetAcess implements JsonBeanProcessor {\r
- \r
- \r
+public class TaxonNodeDaoBeanProcessor implements JsonBeanProcessor {\r
+\r
+\r
/* (non-Javadoc)\r
* @see net.sf.json.processors.JsonBeanProcessor#processBean(java.lang.Object, net.sf.json.JsonConfig)\r
*/\r
+ @Override\r
public JSONObject processBean(Object bean, JsonConfig jsonConfig) {\r
- \r
+\r
TaxonNode node = (TaxonNode)bean;\r
JSONObject json = new JSONObject();\r
json.element("class", "TaxonNodeDao");\r
+ json.element("uuid", node.getUuid(), jsonConfig);\r
json.element("titleCache", node.getTaxon().getName().getTitleCache(), jsonConfig);\r
- List<TaggedText> taggedTitle = TaxonNameBaseBeanProcessor.getTaggedName(node.getTaxon().getName());\r
+ List<TaggedText> taggedTitle = TaggedTextGenerator.getTaggedName(node.getTaxon().getName());\r
json.element("taggedTitle", taggedTitle, jsonConfig);\r
json.element("taxonUuid", node.getTaxon().getUuid(), jsonConfig);\r
- json.element("secUuid", node.getTaxon().getSec().getUuid(), jsonConfig);\r
+ //Sec can be null (web services can return null for sec)\r
+ //comparation made for avoiding view exceptions\r
+ if (node.getTaxon().getSec() == null){\r
+ json.element("secUuid", "null");\r
+ }else{\r
+ json.element("secUuid", node.getTaxon().getSec().getUuid(), jsonConfig);\r
+ }\r
json.element("taxonomicChildrenCount", node.getCountChildren(), jsonConfig);\r
+ json.element("unplaced", node.getTaxon().isUnplaced());\r
+ json.element("excluded", node.getTaxon().isExcluded());\r
String ranklabel = null;\r
if(node.getTaxon().getName().getRank() != null){\r
ranklabel = node.getTaxon().getName().getRank().getLabel();\r
}\r
json.element("rankLabel", ranklabel, jsonConfig);\r
- //json.element("treeUuid", node.getTaxonomicTree().getUuid(), jsonConfig);\r
- \r
+ //json.element("treeUuid", node.getClassification().getUuid(), jsonConfig);\r
+\r
return json;\r
}\r
\r