1
|
/**
|
2
|
* Copyright (C) 2007 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.view;
|
10
|
|
11
|
import java.io.PrintWriter;
|
12
|
import java.util.Map;
|
13
|
|
14
|
import javax.servlet.http.HttpServletRequest;
|
15
|
import javax.servlet.http.HttpServletResponse;
|
16
|
|
17
|
public abstract class BaseView {
|
18
|
|
19
|
protected Object getResponseData(Map model){
|
20
|
// Retrieve data from model
|
21
|
Object data = null;
|
22
|
if (model!=null && model.values().size()>0){
|
23
|
data = model.values().toArray()[0];
|
24
|
}
|
25
|
return data;
|
26
|
}
|
27
|
|
28
|
/**
|
29
|
* Basic render method that may be used to render content with the cdmlib-remote api but without beeing in
|
30
|
* a webapplication context.
|
31
|
* @param entity
|
32
|
* @param writer
|
33
|
* @param request TODO
|
34
|
* @param response TODO
|
35
|
* @throws Exception
|
36
|
*/
|
37
|
public abstract void render (Object entity, PrintWriter writer, String jsonpCallback, HttpServletRequest request, HttpServletResponse response) throws Exception;
|
38
|
}
|