Project

General

Profile

Revision 2d1fc4f4

ID2d1fc4f4927d79b45705207bbdf06e3ac3e1fa0c
Parent 4642e957
Child b4b7bfe8

Added by Andreas Müller about 5 years ago

Use abstract controller for identifiable controllers

View differences:

cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/AgentController.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;
......
40 38
import eu.etaxonomy.cdm.model.taxon.TaxonNodeAgentRelation;
41 39
import eu.etaxonomy.cdm.remote.controller.util.PagerParameters;
42 40
import eu.etaxonomy.cdm.remote.editor.RankPropertyEditor;
41
import io.swagger.annotations.Api;
43 42

  
44 43
/**
45 44
 * The AgentController class is a Spring MVC Controller.
......
73 72
@Controller
74 73
@Api(value = "agent")
75 74
@RequestMapping(value = {"/agent/{uuid}"})
76
public class AgentController extends BaseController<AgentBase, IAgentService>
75
public class AgentController extends AbstractIdentifiableController<AgentBase, IAgentService>
77 76
{
78 77

  
79 78
    private static final List<String> TAXONNODEAGENTRELATIONS_INIT_STRATEGY = Arrays.asList(new String[]{
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/ClassificationController.java
53 53
@Controller
54 54
@Api("classification")
55 55
@RequestMapping(value = {"/classification/{uuid}"})
56
public class ClassificationController extends BaseController<Classification,IClassificationService> {
56
public class ClassificationController extends AbstractIdentifiableController<Classification,IClassificationService> {
57 57

  
58 58

  
59 59
    private ITermService termService;
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/DescriptionController.java
56 56
@Controller
57 57
@Api("description")
58 58
@RequestMapping(value = {"/description/{uuid}", "/description/{uuid_list}"})
59
public class DescriptionController extends BaseController<DescriptionBase, IDescriptionService>
59
public class DescriptionController extends AbstractIdentifiableController<DescriptionBase, IDescriptionService>
60 60
{
61 61
    @Autowired
62 62
    private IFeatureTreeService featureTreeService;
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/FeatureTreeController.java
10 10

  
11 11
package eu.etaxonomy.cdm.remote.controller;
12 12

  
13
import io.swagger.annotations.Api;
14

  
15 13
import org.apache.log4j.Logger;
16 14
import org.springframework.beans.factory.annotation.Autowired;
17 15
import org.springframework.stereotype.Controller;
......
19 17

  
20 18
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
21 19
import eu.etaxonomy.cdm.model.description.FeatureTree;
20
import io.swagger.annotations.Api;
22 21

  
23 22
/**
24 23
 * @author n.hoffmann
......
28 27
@Controller
29 28
@Api("featureTree")
30 29
@RequestMapping(value = {"/featureTree/{uuid}"})
31
public class FeatureTreeController extends BaseController<FeatureTree, IFeatureTreeService> {
30
public class FeatureTreeController extends AbstractIdentifiableController<FeatureTree, IFeatureTreeService> {
31
    @SuppressWarnings("unused")
32 32
    private static final Logger logger = Logger
33 33
            .getLogger(FeatureTreeController.class);
34 34

  
35
    /* (non-Javadoc)
36
     * @see eu.etaxonomy.cdm.remote.controller.BaseController#setService(eu.etaxonomy.cdm.api.service.IService)
37
     */
38 35
    @Override
39 36
    @Autowired
40 37
    public void setService(IFeatureTreeService service) {
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/MediaController.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.net.URI;
17 15
import java.util.Arrays;
......
37 35
import eu.etaxonomy.cdm.model.media.Media;
38 36
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
39 37
import eu.etaxonomy.cdm.remote.exception.NoRecordsMatchException;
38
import io.swagger.annotations.Api;
40 39

  
41 40
/**
42 41
 * TODO write controller documentation
......
48 47
@Controller
49 48
@Api("media")
50 49
@RequestMapping(value = {"/media/{uuid}"})
51
public class MediaController extends BaseController<Media, IMediaService>
52
{
50
public class MediaController extends AbstractIdentifiableController<Media, IMediaService>{
51

  
53 52

  
54
    /* (non-Javadoc)
55
     * @see eu.etaxonomy.cdm.remote.controller.GenericController#setService(eu.etaxonomy.cdm.api.service.IService)
56
     */
57 53
    @Autowired
58 54
    @Override
59 55
    public void setService(IMediaService service) {
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/NameController.java
43 43
@Controller
44 44
@Api("name")
45 45
@RequestMapping(value = {"/name/{uuid}"})
46
public class NameController extends BaseController<TaxonNameBase, INameService>
47
{
46
public class NameController extends AbstractIdentifiableController<TaxonNameBase, INameService>{
48 47

  
49 48
    private static final List<String> TYPEDESIGNATION_INIT_STRATEGY = Arrays.asList(new String []{
50 49
            "typeStatus.representations",
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/OccurrenceController.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;
......
31 29
import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
32 30
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
33 31
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
32
import io.swagger.annotations.Api;
34 33

  
35 34
/**
36 35
 * TODO write controller documentation
......
41 40
@Controller
42 41
@Api("occurrence")
43 42
@RequestMapping(value = {"/occurrence/{uuid}"})
44
public class OccurrenceController extends BaseController<SpecimenOrObservationBase, IOccurrenceService>
45
{
43
public class OccurrenceController extends AbstractIdentifiableController<SpecimenOrObservationBase, IOccurrenceService>{
46 44

  
47 45
    protected static final List<String> DEFAULT_INIT_STRATEGY = Arrays.asList(new String []{
48 46
            "$",
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/PolytomousKeyController.java
9 9
*/
10 10
package eu.etaxonomy.cdm.remote.controller;
11 11

  
12
import io.swagger.annotations.Api;
13

  
14 12
import org.apache.log4j.Logger;
15 13
import org.springframework.beans.factory.annotation.Autowired;
16 14
import org.springframework.stereotype.Controller;
......
18 16

  
19 17
import eu.etaxonomy.cdm.api.service.IPolytomousKeyService;
20 18
import eu.etaxonomy.cdm.model.description.PolytomousKey;
19
import io.swagger.annotations.Api;
21 20

  
22 21
/**
23 22
 * @author a.kohlbecker
......
27 26
@Controller
28 27
@Api("polytomousKey")
29 28
@RequestMapping(value = {"/polytomousKey/{uuid}"})
30
public class PolytomousKeyController extends BaseController<PolytomousKey, IPolytomousKeyService> {
29
public class PolytomousKeyController extends AbstractIdentifiableController<PolytomousKey, IPolytomousKeyService> {
31 30
    public static final Logger logger = Logger.getLogger(PolytomousKeyController.class);
32 31

  
33 32
    @Override
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/ReferenceController.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;
......
31 29
import eu.etaxonomy.cdm.api.service.IReferenceService;
32 30
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference;
33 31
import eu.etaxonomy.cdm.model.reference.Reference;
32
import io.swagger.annotations.Api;
34 33

  
35 34
/**
36 35
 * TODO write controller documentation
......
42 41
@Controller
43 42
@Api("reference")
44 43
@RequestMapping(value = {"/reference/{uuid}"})
45
public class ReferenceController extends BaseController<Reference, IReferenceService>
44
public class ReferenceController extends AbstractIdentifiableController<Reference, IReferenceService>
46 45
{
47 46

  
48 47
    private static final List<String> NOMENCLATURAL_CITATION_INIT_STRATEGY = Arrays.asList(new String []{
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TaxonController.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;
......
48 46
import eu.etaxonomy.cdm.persistence.query.OrderHint;
49 47
import eu.etaxonomy.cdm.persistence.query.OrderHint.SortOrder;
50 48
import eu.etaxonomy.cdm.remote.controller.util.PagerParameters;
49
import io.swagger.annotations.Api;
51 50

  
52 51
/**
53 52
 * TODO write controller documentation
......
59 58
@Controller
60 59
@Api("taxon")
61 60
@RequestMapping(value = {"/taxon/{uuid}"})
62
public class TaxonController extends BaseController<TaxonBase, ITaxonService>
61
public class TaxonController extends AbstractIdentifiableController<TaxonBase, ITaxonService>
63 62
{
64 63
    public static final Logger logger = Logger.getLogger(TaxonController.class);
65 64

  
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TermController.java
9 9
*/
10 10
package eu.etaxonomy.cdm.remote.controller;
11 11

  
12
import io.swagger.annotations.Api;
13

  
14 12
import java.io.IOException;
15 13
import java.util.Arrays;
16 14
import java.util.List;
......
29 27
import eu.etaxonomy.cdm.api.service.ITermService;
30 28
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
31 29
import eu.etaxonomy.cdm.model.common.OrderedTermBase;
30
import io.swagger.annotations.Api;
32 31

  
33 32
/**
34 33
 * @author a.kohlbecker
......
38 37
@Controller
39 38
@Api("term")
40 39
@RequestMapping(value = {"/term/{uuid}"})
41
public class TermController extends BaseController<DefinedTermBase, ITermService> {
40
public class TermController extends AbstractIdentifiableController<DefinedTermBase, ITermService> {
42 41

  
43 42
    private static final List<String> TERM_COMPARE_INIT_STRATEGY = Arrays.asList(new String []{
44 43
            "vocabulary"
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/VocabularyController.java
9 9
*/
10 10
package eu.etaxonomy.cdm.remote.controller;
11 11

  
12
import io.swagger.annotations.Api;
13

  
14 12
import java.io.IOException;
15 13
import java.util.List;
16 14
import java.util.UUID;
......
30 28
import eu.etaxonomy.cdm.api.service.pager.Pager;
31 29
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
32 30
import eu.etaxonomy.cdm.model.common.TermVocabulary;
31
import io.swagger.annotations.Api;
33 32

  
34 33
/**
35 34
 * @author a.kohlbecker
......
39 38
@Controller
40 39
@Api("termVocabulary")
41 40
@RequestMapping(value = {"/termVocabulary/{uuid}"})
42
public class VocabularyController extends BaseController<TermVocabulary, IVocabularyService> {
41
public class VocabularyController extends AbstractIdentifiableController<TermVocabulary, IVocabularyService> {
43 42

  
44 43
    public static final Logger logger = Logger.getLogger(VocabularyController.class);
45 44

  
46
    /* (non-Javadoc)
47
     * @see eu.etaxonomy.cdm.remote.controller.BaseController#setService(eu.etaxonomy.cdm.api.service.IService)
48
     */
45

  
49 46
    @Autowired
50 47
    @Override
51 48
    public void setService(IVocabularyService service) {
......
62 59

  
63 60
        logger.info("terms() " + requestPathAndQuery(request));
64 61

  
65
        TermVocabulary vocabulary = getCdmBaseInstance(uuid, response, (List<String>)null);
62
        TermVocabulary<?> vocabulary = getCdmBaseInstance(uuid, response, (List<String>)null);
66 63

  
67 64
        Pager<DefinedTermBase> pager = service.getTerms(vocabulary, null, 0, orderBy.checkSuitableFor(vocabulary.getClass()).orderHints(), getInitializationStrategy());
68 65

  

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)