Project

General

Profile

Download (2.59 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.remote.controller;
10

    
11
import java.io.IOException;
12
import java.util.UUID;
13

    
14
import javax.servlet.http.HttpServletRequest;
15
import javax.servlet.http.HttpServletResponse;
16

    
17
import org.apache.log4j.Logger;
18
import org.springframework.web.bind.WebDataBinder;
19
import org.springframework.web.bind.annotation.InitBinder;
20
import org.springframework.web.bind.annotation.PathVariable;
21
import org.springframework.web.bind.annotation.RequestMapping;
22
import org.springframework.web.bind.annotation.RequestMethod;
23
import org.springframework.web.bind.annotation.RequestParam;
24

    
25
import eu.etaxonomy.cdm.api.service.IIdentifiableEntityService;
26
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
27
import eu.etaxonomy.cdm.persistence.query.MatchMode;
28
import eu.etaxonomy.cdm.remote.dto.common.StringResultDTO;
29
import eu.etaxonomy.cdm.remote.editor.MatchModePropertyEditor;
30

    
31
/**
32
 * @author a.mueller
33
 * @since 06 Oct 2016
34
 */
35
public abstract class AbstractIdentifiableController <T extends IdentifiableEntity, SERVICE extends IIdentifiableEntityService<T>>
36
        extends BaseController<T,SERVICE>  {
37

    
38
    private static final Logger logger = Logger.getLogger(AbstractIdentifiableController.class);
39

    
40
    @InitBinder
41
    @Override
42
    public void initBinder(WebDataBinder binder) {
43
        super.initBinder(binder);
44
        binder.registerCustomEditor(MatchMode.class, new MatchModePropertyEditor());
45
    }
46

    
47
    /**
48
     * List identifiable entities by markers
49
     *
50
     * @param type
51
     * @param request
52
     * @param response
53
     * @return
54
     * @see AbstractIdentifiableListController#doFindByIdentifier(Class, String, String, Integer, Integer, MatchMode, Boolean, HttpServletRequest, HttpServletResponse)
55
     * @throws IOException
56
     */
57
    @RequestMapping(method = RequestMethod.GET, value={"titleCache"})
58
    public StringResultDTO doGetTitleCache(
59
            @PathVariable("uuid") UUID uuid,
60
            @RequestParam(value = "refresh", defaultValue= "false", required = false) Boolean refresh,
61
            HttpServletRequest request,
62
            HttpServletResponse response
63
            )
64
            throws IOException {
65

    
66
        if (logger.isDebugEnabled()){logger.info("doGetTitleCache  : " + request.getRequestURI() + "?" + request.getQueryString() );}
67

    
68
        String result = service.getTitleCache(uuid, refresh);
69

    
70
        return new StringResultDTO(result);
71
    }
72
}
(2-2/76)