cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TaxonNodeBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TaxonNodeDaoBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TaxonRelationshipBeanProcessor.java -text
+cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TeamOrPersonBaseBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TermBaseBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TextDataBeanProcessor.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/json/processor/bean/TypeDesignationBaseBeanProcessor.java -text
/**\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
* The abstract class for such {@link AgentBase agents} ({@link Person persons} or {@link Team teams}) who might also be used\r
* for authorship of {@link eu.etaxonomy.cdm.model.reference.Reference references} or of {@link eu.etaxonomy.cdm.model.name.TaxonNameBase taxon names}.\r
- * \r
+ *\r
* @author a.mueller\r
* @version 1.0\r
* @created 17-APR-2008\r
@Transient\r
@XmlTransient\r
protected boolean isGeneratingTitleCache = false;\r
- \r
+\r
/**\r
* Returns the identification string (nomenclatural abbreviation) used in\r
* nomenclature for this {@link Person person} or this {@link Team team}.\r
- * \r
+ *\r
* @see INomenclaturalAuthor#getNomenclaturalTitle()\r
*/\r
@Transient\r
return result;\r
}\r
\r
- /** \r
+ /**\r
* @see #getNomenclaturalTitle()\r
*/\r
public void setNomenclaturalTitle(String nomenclaturalTitle) {\r
* @see eu.etaxonomy.cdm.model.common.IdentifiableEntity#getTitleCache()\r
*/\r
@Override\r
- @Transient //TODO a.kohlbecker remove??\r
+ @Transient /*\r
+ TODO is this still needed, can't we remove this ??\r
+ @Transient is an absolutely special case and thus leads to several\r
+ special implementations in order to harmonize this exception again\r
+ in other parts of the library:\r
+ - eu.etaxonomy.cdm.remote.controller.AgentController.doGetTitleCache()\r
+ - eu.etaxonomy.cdm.remote.json.processor.bean.TeamOrPersonBaseBeanProcessor\r
+\r
+ [a.kohlbecker May 2011]\r
+ */\r
public String getTitleCache() {\r
isGeneratingTitleCache = true;\r
String result = super.getTitleCache();\r
}\r
return result;\r
}\r
- \r
- \r
+\r
+\r
}\r
// $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
package eu.etaxonomy.cdm.remote.controller;\r
\r
+import java.io.IOException;\r
+import java.util.Map;\r
+import java.util.UUID;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.stereotype.Controller;\r
+import org.springframework.web.bind.annotation.PathVariable;\r
import org.springframework.web.bind.annotation.RequestMapping;\r
+import org.springframework.web.servlet.ModelAndView;\r
\r
import eu.etaxonomy.cdm.api.service.IAgentService;\r
import eu.etaxonomy.cdm.api.service.pager.Pager;\r
* Methods mapped at type level, inherited from super classes ({@link BaseController}):\r
* <blockquote>\r
* URI: <b>/{datasource-name}/agent/name/{agent-uuid}</b>\r
- * \r
+ *\r
* Get the {@link AgentBase} instance identified by the <code>{agent-uuid}</code>.\r
* The returned AgentBase is initialized by\r
* the default initialization strategy: {@link #DEFAULT_INIT_STRATEGY}\r
* </blockquote>\r
* <blockquote>\r
* URI: <b>/{datasource-name}/agent/name/{agent-uuid}/annotation</b>\r
- * \r
+ *\r
* Returns a {@link Pager} on the {@link Annotation}s for the {@link AgentBase} instance identified by the\r
* <code>{agent-uuid}</code>.\r
* The returned AgentBase instances are initialized by\r
* the following strategy: {@link #ANNOTATION_INIT_STRATEGY}\r
* </blockquote>\r
- * \r
+ *\r
* @author a.kohlbecker\r
* @date 24.03.2009\r
*/\r
@Controller\r
@RequestMapping(value = {"/agent/{uuid}"})\r
-public class AgentController extends AnnotatableController<AgentBase, IAgentService>\r
+public class AgentController extends BaseController<AgentBase, IAgentService>\r
{\r
\r
- \r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService)\r
*/\r
this.service = service;\r
}\r
\r
+ /**\r
+ * This method is only needed for\r
+ * {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase} or sub classes\r
+ * which are also handled by this controller.\r
+ *\r
+ * The method\r
+ * {@link eu.etaxonomy.cdm.model.agent.TeamOrPersonBase#getTitleCache() } is\r
+ * annotated with @Transient and thus it is not automatically made available\r
+ * by the BaseController.\r
+ *\r
+ * @param uuid\r
+ * @param request\r
+ * @param response\r
+ * @return\r
+ * @throws IOException\r
+ */\r
+ @RequestMapping(value = {"titleCache"})\r
+ public ModelAndView doGetTitleCache(@PathVariable("uuid") UUID uuid,\r
+ HttpServletRequest request, HttpServletResponse response) throws IOException {\r
+ ModelAndView mv = new ModelAndView();\r
+ AgentBase agentbase = service.load(uuid);\r
+ mv.addObject(agentbase.getTitleCache());\r
+ return mv;\r
+\r
+ }\r
+\r
}\r
// $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
@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("taggedTitle", taggedTitle, jsonConfig);\r
json.element("taxonUuid", node.getTaxon().getUuid(), jsonConfig);\r
//Sec can be null (web services can return null for sec)\r
- //comparation made for avoding view exceptions\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
+ }\r
json.element("taxonomicChildrenCount", node.getCountChildren(), jsonConfig);\r
json.element("unplaced", node.getTaxon().isUnplaced());\r
json.element("excluded", node.getTaxon().isExcluded());\r
}\r
json.element("rankLabel", ranklabel, jsonConfig);\r
//json.element("treeUuid", node.getClassification().getUuid(), jsonConfig);\r
- \r
+\r
return json;\r
}\r
\r
--- /dev/null
+// $Id$\r
+/**\r
+* Copyright (C) 2009 EDIT\r
+* European Distributed Institute of Taxonomy\r
+* http://www.e-taxonomy.eu\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
+package eu.etaxonomy.cdm.remote.json.processor.bean;\r
+\r
+import java.util.List;\r
+\r
+import net.sf.json.JSONObject;\r
+import net.sf.json.JsonConfig;\r
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;\r
+\r
+/**\r
+ * @author a.kohlbecker\r
+ * @date 20.10.2010\r
+ *\r
+ */\r
+public class TeamOrPersonBaseBeanProcessor extends AbstractBeanProcessor<TeamOrPersonBase> {\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor#getIgnorePropNames()\r
+ */\r
+ @Override\r
+ public List<String> getIgnorePropNames() {\r
+ // TODO Auto-generated method stub\r
+ return null;\r
+ }\r
+\r
+ /* (non-Javadoc)\r
+ * @see eu.etaxonomy.cdm.remote.json.processor.bean.AbstractBeanProcessor#processBeanSecondStep(java.lang.Object, net.sf.json.JSONObject, net.sf.json.JsonConfig)\r
+ */\r
+ @Override\r
+ public JSONObject processBeanSecondStep(TeamOrPersonBase bean, JSONObject json,\r
+ JsonConfig jsonConfig) {\r
+ json.element("titleCache", bean.getTitleCache());\r
+ return json;\r
+ }\r
+\r
+}\r
/**\r
* Copyright (C) 2009 EDIT 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\r
* 1.1 See LICENSE.TXT at the top of this package for the full license terms.\r
*/\r
import org.apache.log4j.Logger;\r
import org.hibernate.proxy.HibernateProxy;\r
\r
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;\r
import eu.etaxonomy.cdm.model.common.TermBase;\r
import eu.etaxonomy.cdm.model.media.Media;\r
import eu.etaxonomy.cdm.model.name.TaxonNameBase;\r
\r
/**\r
* can handle HibernateProxys\r
- * \r
+ *\r
* @author a.kohlbecker\r
*\r
*/\r
public class CdmProxyBeanProcessorMatcher extends JsonBeanProcessorMatcher {\r
\r
public static final Logger logger = Logger.getLogger(CdmProxyBeanProcessorMatcher.class);\r
- \r
+\r
/* (non-Javadoc)\r
* @see net.sf.json.processors.JsonBeanProcessorMatcher#getMatch(java.lang.Class, java.util.Set)\r
*/\r
@SuppressWarnings("unchecked")\r
@Override\r
public Object getMatch(Class target, Set set) {\r
- \r
- \r
+\r
+\r
if (HibernateProxy.class.isAssignableFrom(target)) {\r
if(logger.isDebugEnabled()){\r
logger.debug("Found HibernateProxy object of class " + target.getClass() + " returning " + HibernateProxy.class);\r
if (TermBase.class.isAssignableFrom(target)) {\r
return DEFAULT.getMatch(TermBase.class, set);\r
}\r
-// if (NameRelationship.class.isAssignableFrom(target)) {\r
-// return DEFAULT.getMatch(NameRelationship.class, set);\r
-// }\r
-// if (TaxonRelationship.class.isAssignableFrom(target)) {\r
-// return DEFAULT.getMatch(TaxonRelationship.class, set);\r
-// }\r
+ if (TeamOrPersonBase.class.isAssignableFrom(target)) {\r
+ return DEFAULT.getMatch(TeamOrPersonBase.class, set);\r
+ }\r
if (Media.class.isAssignableFrom(target)) {\r
return DEFAULT.getMatch(Media.class, set);\r
}\r
\r
return DEFAULT.getMatch(target, set);\r
}\r
- \r
- \r
+\r
+\r
}\r
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd\r
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd\r
">\r
- \r
+\r
<bean id="genericApiCardinalityPropertyFilter" class="eu.etaxonomy.cdm.remote.json.util.CardinalityPropertyFilter">\r
<property name="includeToOneRelations" value="false" />\r
<property name="includeToManyRelations" value="false" />\r
\r
<value>TreeNode.data</value>\r
<value>TreeNode.data</value>\r
- \r
+\r
<value>PolytomousKey.root</value>\r
<value>PolytomousKeyNode.children</value>\r
<value>PolytomousKeyNode.question</value>\r
<value>PolytomousKeyNode.statement</value>\r
- <value>PolytomousKeyNode.modifyingText</value> \r
- \r
+ <value>PolytomousKeyNode.modifyingText</value>\r
+\r
<value>Media.representations</value>\r
<value>MediaRepresentation.parts</value>\r
- \r
+\r
<!-- CardinalityPropertyFilter should allow defining exceptions for abstract super classes : -->\r
- <!-- <value>eu.etaxonomy.cdm.model.description.DescriptionElementBase.feature</value> --> \r
- \r
+ <!-- <value>eu.etaxonomy.cdm.model.description.DescriptionElementBase.feature</value> -->\r
+\r
<value>TextData.feature</value>\r
<value>CategoricalData.feature</value>\r
<value>CommonTaxonName.feature</value>\r
</property>\r
</bean>\r
\r
- <!-- \r
+ <!--\r
=================================================\r
- default configuration for RESTful read(/write) service \r
+ default configuration for RESTful read(/write) service\r
=================================================\r
-->\r
<bean name="jsonConfig" class="eu.etaxonomy.cdm.remote.json.JsonConfigFactoryBean"\r
<entry key="eu.etaxonomy.cdm.model.description.KeyStatement">\r
<bean class="eu.etaxonomy.cdm.remote.json.processor.bean.KeyStatementBeanProcessor" />\r
</entry>\r
+ <entry key="eu.etaxonomy.cdm.model.agent.TeamOrPersonBase">\r
+ <bean class="eu.etaxonomy.cdm.remote.json.processor.bean.TeamOrPersonBaseBeanProcessor" />\r
+ </entry>\r
+\r
</map>\r
</property>\r
<property name="jsonPropertyFilter">\r
</entry>\r
<entry key="java.net.URI">\r
<bean class="eu.etaxonomy.cdm.remote.json.processor.value.URIJSONValueProcessor"/>\r
- </entry> \r
+ </entry>\r
</map>\r
</property>\r
<property name="ignoreDefaultExcludes" value="true" />\r
</property>\r
</bean>\r
\r
- <!-- \r
+ <!--\r
=================================================\r
- configuration for RESTful classification service \r
+ configuration for RESTful classification service\r
=================================================\r
-->\r
<bean name="jsonConfigClassification" class="eu.etaxonomy.cdm.remote.json.JsonConfigFactoryBean"\r
</entry>\r
<entry key="java.net.URI">\r
<bean class="eu.etaxonomy.cdm.remote.json.processor.value.URIJSONValueProcessor"/>\r
- </entry> \r
+ </entry>\r
</map>\r
</property>\r
<property name="ignoreDefaultExcludes" value="true" />\r
</property>\r
</bean>\r
\r
- <!-- \r
+ <!--\r
=================================================\r
- configuration for RESTful portal service \r
+ configuration for RESTful portal service\r
=================================================\r
-->\r
\r
</entry>\r
<entry key="java.net.URI">\r
<bean class="eu.etaxonomy.cdm.remote.json.processor.value.URIJSONValueProcessor"/>\r
- </entry> \r
+ </entry>\r
</map>\r
</property>\r
<property name="ignoreDefaultExcludes" value="true" />\r
<value>inDescription</value>\r
</list>\r
</property>\r
- </bean> \r
+ </bean>\r
</beans>
\ No newline at end of file