Revision 5ccb7fa7
Added by Andreas Müller almost 8 years ago
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/ClassificationListController.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.remote.controller; |
12 | 12 |
|
13 |
import io.swagger.annotations.Api; |
|
14 |
|
|
15 | 13 |
import java.util.Arrays; |
16 | 14 |
import java.util.List; |
17 | 15 |
|
... | ... | |
22 | 20 |
|
23 | 21 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
24 | 22 |
import eu.etaxonomy.cdm.model.taxon.Classification; |
23 |
import io.swagger.annotations.Api; |
|
25 | 24 |
|
26 | 25 |
/** |
27 | 26 |
* @author n.hoffmann |
28 | 27 |
* @created Apr 8, 2010 |
29 |
* @version 1.0 |
|
30 | 28 |
*/ |
31 | 29 |
@Controller |
32 | 30 |
@Api("classification") |
33 | 31 |
@RequestMapping(value = {"/classification"}) |
34 | 32 |
public class ClassificationListController extends IdentifiableListController<Classification,IClassificationService> { |
35 | 33 |
|
34 |
@SuppressWarnings("unused") |
|
36 | 35 |
private static final Logger logger = Logger |
37 | 36 |
.getLogger(ClassificationListController.class); |
38 | 37 |
|
... | ... | |
42 | 41 |
}); |
43 | 42 |
|
44 | 43 |
|
45 |
/* (non-Javadoc) |
|
46 |
* @see eu.etaxonomy.cdm.remote.controller.AbstractListController#setService(eu.etaxonomy.cdm.api.service.IService) |
|
47 |
*/ |
|
48 | 44 |
@Override |
49 | 45 |
@Autowired |
50 | 46 |
public void setService(IClassificationService service) { |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DescriptionController.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.remote.controller; |
12 | 12 |
|
13 |
import io.swagger.annotations.Api; |
|
14 |
|
|
15 | 13 |
import java.io.IOException; |
16 | 14 |
import java.util.Arrays; |
17 | 15 |
import java.util.List; |
... | ... | |
46 | 44 |
import eu.etaxonomy.cdm.remote.editor.UUIDListPropertyEditor; |
47 | 45 |
import eu.etaxonomy.cdm.remote.editor.UuidList; |
48 | 46 |
import eu.etaxonomy.cdm.remote.l10n.LocaleContext; |
47 |
import io.swagger.annotations.Api; |
|
49 | 48 |
|
50 | 49 |
/** |
51 | 50 |
* TODO write controller documentation |
... | ... | |
83 | 82 |
binder.registerCustomEditor(DefinedTermBaseList.class, new TermBaseListPropertyEditor<MarkerType>(termService)); |
84 | 83 |
} |
85 | 84 |
|
86 |
/* (non-Javadoc) |
|
87 |
* @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService) |
|
88 |
*/ |
|
89 | 85 |
@Autowired |
90 | 86 |
@Override |
91 | 87 |
public void setService(IDescriptionService service) { |
... | ... | |
101 | 97 |
|
102 | 98 |
ModelAndView mv = new ModelAndView(); |
103 | 99 |
|
104 |
DescriptionBase description = service.load(uuid); |
|
100 |
DescriptionBase<?> description = service.load(uuid);
|
|
105 | 101 |
|
106 | 102 |
if(!(description instanceof TaxonDescription)){ |
107 | 103 |
HttpStatusMessage.UUID_REFERENCES_WRONG_TYPE.send(response); |
... | ... | |
141 | 137 |
HttpServletResponse response) throws IOException { |
142 | 138 |
logger.info("doGenerateNaturalLanguageDescription() - " + request.getRequestURI()); |
143 | 139 |
|
144 |
DescriptionBase description = service.load(uuid); |
|
140 |
DescriptionBase<?> description = service.load(uuid);
|
|
145 | 141 |
|
146 | 142 |
ModelAndView mv = new ModelAndView(); |
147 | 143 |
|
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NameController.java | ||
---|---|---|
10 | 10 |
|
11 | 11 |
package eu.etaxonomy.cdm.remote.controller; |
12 | 12 |
|
13 |
import io.swagger.annotations.Api; |
|
14 |
|
|
15 | 13 |
import java.io.IOException; |
16 | 14 |
import java.util.ArrayList; |
17 | 15 |
import java.util.Arrays; |
... | ... | |
33 | 31 |
import eu.etaxonomy.cdm.model.name.NonViralName; |
34 | 32 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
35 | 33 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
34 |
import io.swagger.annotations.Api; |
|
36 | 35 |
|
37 | 36 |
/** |
38 | 37 |
* TODO write controller documentation |
... | ... | |
65 | 64 |
setInitializationStrategy(Arrays.asList(new String[]{"$"})); //TODO still needed???? |
66 | 65 |
} |
67 | 66 |
|
68 |
/* (non-Javadoc) |
|
69 |
* @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService) |
|
70 |
*/ |
|
71 | 67 |
@Autowired |
72 | 68 |
@Override |
73 | 69 |
public void setService(INameService service) { |
... | ... | |
97 | 93 |
if (request != null) { |
98 | 94 |
logger.info("doGetTypeDesignations()" + request.getRequestURI()); |
99 | 95 |
} |
100 |
TaxonNameBase tnb = getCdmBaseInstance(uuid, response, |
|
96 |
TaxonNameBase<?,?> tnb = getCdmBaseInstance(uuid, response,
|
|
101 | 97 |
(List<String>) null); |
102 | 98 |
Pager<TypeDesignationBase> p = service.getTypeDesignations(tnb, null, |
103 | 99 |
null, null, TYPEDESIGNATION_INIT_STRATEGY); |
... | ... | |
111 | 107 |
HttpServletRequest request, HttpServletResponse response)throws IOException { |
112 | 108 |
|
113 | 109 |
logger.info("doGetNameCache()" + request.getRequestURI()); |
114 |
TaxonNameBase tnb = getCdmBaseInstance(uuid, response, NAME_CACHE_INIT_STRATEGY); |
|
115 |
NonViralName nvn = (NonViralName) tnb;
|
|
110 |
TaxonNameBase<?,?> tnb = getCdmBaseInstance(uuid, response, NAME_CACHE_INIT_STRATEGY);
|
|
111 |
NonViralName<?> nvn = (NonViralName<?>) tnb;
|
|
116 | 112 |
String nameCacheString = nvn.getNameCache(); |
117 |
List result = new ArrayList<String>();
|
|
113 |
List<String> result = new ArrayList<>();
|
|
118 | 114 |
result.add(nameCacheString); |
119 | 115 |
return result; |
120 | 116 |
|
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/AnnotatableServiceBase.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
26 | 26 |
|
27 | 27 |
public abstract class AnnotatableServiceBase<T extends AnnotatableEntity,DAO extends IAnnotatableDao<T>> extends VersionableServiceBase<T, DAO> |
28 | 28 |
implements IAnnotatableService<T> { |
29 |
@Transactional(readOnly = true) |
|
29 |
@Override |
|
30 |
@Transactional(readOnly = true) |
|
30 | 31 |
public Pager<Annotation> getAnnotations(T annotatedObj, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) { |
31 | 32 |
Integer numberOfResults = dao.countAnnotations(annotatedObj, status); |
32 |
|
|
33 |
|
|
33 | 34 |
List<Annotation> results = new ArrayList<Annotation>(); |
34 | 35 |
if(numberOfResults > 0) { // no point checking again //TODO use AbstractPagerImpl.hasResultsInRange(numberOfResults, pageNumber, pageSize) |
35 |
results = dao.getAnnotations(annotatedObj, status, pageSize, pageNumber, orderHints, propertyPaths);
|
|
36 |
results = dao.getAnnotations(annotatedObj, status, pageSize, pageNumber, orderHints, propertyPaths); |
|
36 | 37 |
} |
37 |
|
|
38 |
|
|
38 | 39 |
return new DefaultPagerImpl<Annotation>(pageNumber, numberOfResults, pageSize, results); |
39 | 40 |
} |
40 |
|
|
41 |
@Transactional(readOnly = true) |
|
41 |
|
|
42 |
@Override |
|
43 |
@Transactional(readOnly = true) |
|
42 | 44 |
public Pager<Marker> getMarkers(T annotatableEntity, Boolean technical, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths) { |
43 | 45 |
Integer numberOfResults = dao.countMarkers(annotatableEntity, technical); |
44 |
|
|
46 |
|
|
45 | 47 |
List<Marker> results = new ArrayList<Marker>(); |
46 | 48 |
if(numberOfResults > 0) { // no point checking again //TODO use AbstractPagerImpl.hasResultsInRange(numberOfResults, pageNumber, pageSize) |
47 | 49 |
results = dao.getMarkers(annotatableEntity, technical, pageSize, pageNumber, orderHints, propertyPaths); |
48 | 50 |
} |
49 |
|
|
51 |
|
|
50 | 52 |
return new DefaultPagerImpl<Marker>(pageNumber, numberOfResults, pageSize, results); |
51 | 53 |
} |
52 |
|
|
53 | 54 |
|
54 |
@Transactional(readOnly = true) |
|
55 |
|
|
56 |
@Override |
|
57 |
@Transactional(readOnly = true) |
|
55 | 58 |
public List<Object[]> groupMarkers(Class<? extends T> clazz, Boolean technical, Integer pageSize, Integer pageNumber, List<String> propertyPaths) { |
56 | 59 |
return dao.groupMarkers(clazz, technical, pageSize, pageNumber, propertyPaths); |
57 | 60 |
} |
58 | 61 |
|
59 |
@Transactional(readOnly = true) |
|
62 |
@Override |
|
63 |
@Transactional(readOnly = true) |
|
60 | 64 |
public int countMarkers(Class<? extends T> clazz, Boolean technical) { |
61 | 65 |
return dao.countMarkers(clazz, technical); |
62 | 66 |
} |
63 | 67 |
|
68 |
|
|
64 | 69 |
} |
Also available in: Unified diff
Cleanup