cdmlib-remote/src/main/java/carbonfive/spring/web/pathparameter/ParameterizedPathMatcher.java -text
cdmlib-remote/src/main/java/carbonfive/spring/web/pathparameter/ParameterizedPathMatcherException.java -text
cdmlib-remote/src/main/java/carbonfive/spring/web/pathparameter/ParameterizedUrlHandlerMapping.java -text
+cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/AnnotationElementSTO.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/AnnotationSTO.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/AnnotationTO.java -text
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/dto/AssociationFeatureSTO.java -text
--- /dev/null
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.cdm.remote.dto;
+
+import org.apache.log4j.Logger;
+
+import eu.etaxonomy.cdm.model.agent.Person;
+
+/**
+ * @author n.hoffmann
+ * @created 26.09.2008
+ * @version 1.0
+ */
+public class AnnotationElementSTO extends BaseTO {
+ private static Logger logger = Logger.getLogger(AnnotationElementSTO.class);
+
+ private String text;
+ private Person commentator;
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+
+ /**
+ * @param commentator
+ */
+ public void setCommentator(Person commentator) {
+ this.commentator = commentator;
+ }
+
+ /**
+ * @return
+ */
+ public Person getCommentator(){
+ return commentator;
+ }
+}
package eu.etaxonomy.cdm.remote.dto;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
import org.apache.log4j.Logger;
/**
- * @author nho
+ * @author n.hoffmann
* @created 24.09.2008
* @version 1.0
*/
public class AnnotationSTO extends BaseTO {
private static Logger logger = Logger.getLogger(AnnotationSTO.class);
-
- private String text;
+ private Set<AnnotationElementSTO> annotationElements = new HashSet<AnnotationElementSTO>();
/**
- * @return the text
+ * @return the annotationElements
*/
- public String getText() {
- return text;
+ public Set<AnnotationElementSTO> getAnnotationElements() {
+ return annotationElements;
}
/**
- * @param text the text to set
+ * @param annotationElements the annotationElements to set
*/
- public void setText(String text) {
- this.text = text;
+ public void setAnnotationElements(Set<AnnotationElementSTO> annotationElements) {
+ this.annotationElements = annotationElements;
}
+
+ public void addAnnotationElement(AnnotationElementSTO annotationElementSTO){
+ this.annotationElements.add(annotationElementSTO);
+ }
+
}
package eu.etaxonomy.cdm.remote.dto;
+import java.util.UUID;
+
import org.apache.log4j.Logger;
/**
private static Logger logger = Logger.getLogger(AnnotationTO.class);
+
}
import java.util.Enumeration;
import java.util.Locale;
+import java.util.Set;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
+import eu.etaxonomy.cdm.model.agent.Person;
+import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
import eu.etaxonomy.cdm.model.common.Annotation;
+import eu.etaxonomy.cdm.remote.dto.AnnotationElementSTO;
import eu.etaxonomy.cdm.remote.dto.AnnotationSTO;
import eu.etaxonomy.cdm.remote.dto.AnnotationTO;
* @version 1.0
*/
@Component
-public class AnnotationAssembler extends AssemblerBase<AnnotationSTO, AnnotationTO, Annotation> {
+public class AnnotationAssembler extends AssemblerBase<AnnotationSTO, AnnotationTO, AnnotatableEntity> {
private static Logger logger = Logger.getLogger(AnnotationAssembler.class);
* @see eu.etaxonomy.cdm.remote.dto.assembler.AssemblerBase#getSTO(eu.etaxonomy.cdm.model.common.CdmBase, java.util.Enumeration)
*/
@Override
- public AnnotationSTO getSTO(Annotation cdmObj, Enumeration<Locale> locales) {
+ public AnnotationSTO getSTO(AnnotatableEntity cdmObj, Enumeration<Locale> locales) {
// TODO Auto-generated method stub
return null;
}
* @see eu.etaxonomy.cdm.remote.dto.assembler.AssemblerBase#getTO(eu.etaxonomy.cdm.model.common.CdmBase, java.util.Enumeration)
*/
@Override
- public AnnotationTO getTO(Annotation annotation, Enumeration<Locale> locales) {
+ public AnnotationTO getTO(AnnotatableEntity entity, Enumeration<Locale> locales) {
AnnotationTO to = new AnnotationTO();
- to.setText(annotation.getText());
+ to.setUuid(entity.getUuid().toString());
+ //
+
+ Set<Annotation> annotations = entity.getAnnotations();
+
+ for (Annotation annotation : annotations){
+ to.addAnnotationElement(getAnnotationElementSTO(annotation));
+ }
return to;
}
+
+ private AnnotationElementSTO getAnnotationElementSTO(Annotation annotation){
+ AnnotationElementSTO sto = new AnnotationElementSTO();
+
+ sto.setText(annotation.getText());
+
+ sto.setCreated(annotation.getCreated());
+
+ Person commentator = annotation.getCommentator();
+ if(commentator != null){
+ //sto.setCommentator(annotation.getCommentator());
+ }
+
+ return sto;
+ }
}
String requestMethod = req.getMethod();
if(requestMethod.equalsIgnoreCase("GET")){
- List<AnnotationTO> annotations = service.getAnnotations(annotatableEntityUuid, locales);
- mv.addObject(annotations);
+ logger.info("Processing GET request");
+ AnnotationTO annotation = service.getAnnotation(annotatableEntityUuid, locales);
+ mv.addObject(annotation);
}else if(requestMethod.equalsIgnoreCase("POST")){
String annotationText = req.getParameter("annotation");
-
// TODO set locale
-
+ logger.info("Processing POST request");
Annotation annotation = Annotation.NewInstance(annotationText, null);