Project

General

Profile

« Previous | Next » 

Revision 29259

partial implementation

View differences:

DbManagerInternalController.java
1 1
package eu.dnetlib.functionality.modular.ui.db;
2 2

  
3
import java.io.StringWriter;
4 3
import java.util.ArrayList;
5 4
import java.util.HashMap;
6 5
import java.util.List;
......
9 8
import javax.annotation.Resource;
10 9
import javax.servlet.ServletResponse;
11 10
import javax.servlet.http.HttpServletResponse;
12
import javax.xml.ws.wsaddressing.W3CEndpointReference;
13 11

  
14 12
import org.apache.commons.io.IOUtils;
15
import org.apache.commons.logging.Log;
16
import org.apache.commons.logging.LogFactory;
17 13
import org.springframework.jdbc.support.rowset.SqlRowSet;
18 14
import org.springframework.stereotype.Controller;
19 15
import org.springframework.web.bind.annotation.RequestMapping;
......
26 22
import eu.dnetlib.enabling.database.DatabaseServiceCore;
27 23
import eu.dnetlib.enabling.database.objects.DnetDatabase;
28 24
import eu.dnetlib.enabling.database.resultset.IterableRowSet;
29
import eu.dnetlib.enabling.resultset.client.IterableResultSetClient;
30 25
import eu.dnetlib.enabling.resultset.client.utils.EPRUtils;
31 26

  
32 27
@Controller
......
40 35
	@Resource
41 36
	private DatabaseServiceCore core;
42 37

  
43
	private static final Log log = LogFactory.getLog(DbManagerInternalController.class); // NOPMD by marko on 11/24/08 5:02 PM
44

  
45
	@RequestMapping("/db/listDBs.do")
38
	@RequestMapping("/ui/listDBs.do")
46 39
	public @ResponseBody List<DnetDatabase> listDatabases() throws Exception {
47 40
		return core.listDatabases();
48 41
	}
49 42

  
50
	@RequestMapping("/db/listTables.do")
43
	@RequestMapping("/ui/listTables.do")
51 44
	public @ResponseBody List<Map<String, Object>> listTables(@RequestParam(value = "db", required = true) String db) throws Exception {
52 45
		
53 46
		final List<Map<String, Object>> tables = new ArrayList<Map<String, Object>>();
......
84 77
		return tables;
85 78
	}
86 79

  
87
	@RequestMapping("/db/manageDB.do")
80
	@RequestMapping("/ui/manageDB.do")
88 81
	public @ResponseBody boolean manageDB(@RequestParam(value = "db", required = true) String db,
89 82
			@RequestParam(value = "manage", required = true) boolean b) throws Exception {
90 83
		core.changeDatabaseStatus(db, b);
91 84
		return true;
92 85
	}
93 86

  
94
	@RequestMapping("/db/importEPR.do")
87
	@RequestMapping("/ui/importEPR.do")
95 88
	public @ResponseBody boolean importEPR(@RequestParam(value = "db", required = true) String db,
96 89
			@RequestParam(value = "epr", required = true) String epr) throws Exception {
97 90

  
......
101 94
	}
102 95
	
103 96
	
104
	@RequestMapping("/db/query.do")
97
	@RequestMapping("/ui/query.do")
105 98
	public @ResponseBody List<String> query(@RequestParam(value = "query", required = true) final String query,
106 99
			@RequestParam(value = "db", required = true) final String db,
107 100
			@RequestParam(value = "limit", required = true) int limit) throws Exception {
......
110 103
	
111 104
	}
112 105
	
113
	@RequestMapping("/db/changeTableManagement.do")
106
	@RequestMapping("/ui/changeTableManagement.do")
114 107
	public @ResponseBody boolean changeTableManagement(@RequestParam(value = "db", required = true) final String db,
115 108
			@RequestParam(value = "t", required = true) final String t) throws Exception {
116 109
		
......
124 117
	} 
125 118

  
126 119
	
127
	@RequestMapping("/db/changeIdentifiers.do")
120
	@RequestMapping("/ui/changeIdentifiers.do")
128 121
	public @ResponseBody boolean changeId(HttpServletResponse res, 
129 122
			@RequestParam(value = "db", required = true) final String db,
130
			@RequestParam(value = "t", required = true) final String t) throws Exception {
131
			
132
		core.getDbUtils().reassignDefaultDnetIdentifiers(db, t);
123
			@RequestParam(value = "t", required = false) final String t) throws Exception {
133 124
		
125
		if (t == null || t.isEmpty()) {
126
			core.getDbUtils().reassignDefaultDnetIdentifiers(db);
127
		} else {
128
			core.getDbUtils().reassignDefaultDnetIdentifiers(db, t);
129
		}
130
		
134 131
		return true;
135 132
	} 
136 133
	
137
	@RequestMapping("/db/changeTableLog.do")
134
	@RequestMapping("/ui/changeTableLog.do")
138 135
	public @ResponseBody boolean changeTableLog(@RequestParam(value = "db", required = true) final String db,
139 136
			@RequestParam(value = "t", required = true) final String t) throws Exception {
140 137

  
......
149 146
		return true;
150 147
	} 
151 148

  
152
	@RequestMapping("/db/describeTable.do")
149
	@RequestMapping("/ui/describeTable.do")
153 150
	public @ResponseBody List<Map<?, ?>> describeTable(@RequestParam(value = "db", required = true) final String db,
154 151
			@RequestParam(value = "t", required = true) final String t) throws Exception {
155 152
		return core.getDbUtils().describeTable(db, t);
156 153
	} 
157 154

  
158
	@RequestMapping("/db/dumpTable.do")
155
	@RequestMapping("/ui/dumpTable.do")
159 156
	public @ResponseBody String dumpTable(@RequestParam(value = "db", required = true) final String db,
160 157
			@RequestParam(value = "t", required = true) final String t) throws Exception {
161 158
		return core.getDbUtils().dumpTableAsXML(db,t);
162 159
	}
163 160

  
164
	@RequestMapping("/db/getTableEPR.do")
161
	@RequestMapping("/ui/getTableEPR.do")
165 162
	public @ResponseBody String getTableEPR(final ServletResponse response, 
166 163
			@RequestParam(value = "db", required = true) final String db,
167 164
			@RequestParam(value = "t", required = true) final String t) throws Exception {

Also available in: Unified diff