Project

General

Profile

Download (2.46 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.springframework.web.bind.WebDataBinder;
18
import org.springframework.web.bind.annotation.InitBinder;
19
import org.springframework.web.bind.annotation.PathVariable;
20
import org.springframework.web.bind.annotation.RequestMapping;
21
import org.springframework.web.bind.annotation.RequestMethod;
22
import org.springframework.web.bind.annotation.RequestParam;
23

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

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

    
37

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

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

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

    
66
        String result = service.getTitleCache(uuid, refresh);
67

    
68
        return new StringResultDTO(result);
69
    }
70
}
(2-2/66)