Skip to content

Commit 2f62800

Browse files
committed
去掉@context 注解 #484
1 parent dc0ec1a commit 2f62800

File tree

21 files changed

+102
-147
lines changed

21 files changed

+102
-147
lines changed

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceCoreRestfulApi.java

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import javax.validation.ConstraintViolationException;
4141
import javax.validation.Validator;
4242
import javax.validation.groups.Default;
43-
import javax.ws.rs.core.Context;
4443
import java.util.Calendar;
4544
import java.util.List;
4645
import java.util.Map;
@@ -66,7 +65,7 @@ public class ApiServiceCoreRestfulApi {
6665
private static final Pattern WRITABLE_PATTERN = Pattern.compile("^\\s*(insert|update|delete|drop|alter|create).*", Pattern.CASE_INSENSITIVE | Pattern.DOTALL);
6766

6867
@RequestMapping(value = "/api",method = RequestMethod.POST)
69-
public Message insert(ApiServiceVo apiService, @Context HttpServletRequest req) {
68+
public Message insert(ApiServiceVo apiService, HttpServletRequest req) {
7069
return ApiUtils.doAndResponse(() -> {
7170

7271
if (apiService.getWorkspaceId() == null){
@@ -139,7 +138,7 @@ public Message insert(ApiServiceVo apiService, @Context HttpServletRequest req)
139138
}
140139

141140
@RequestMapping(value = "/create",method = RequestMethod.POST)
142-
public Message create(ApiServiceVo apiService, @Context HttpServletRequest req) {
141+
public Message create(ApiServiceVo apiService, HttpServletRequest req) {
143142
return ApiUtils.doAndResponse(() -> {
144143

145144
if (apiService.getWorkspaceId() == null){
@@ -214,7 +213,7 @@ public Message create(ApiServiceVo apiService, @Context HttpServletRequest req)
214213
@RequestMapping(value = "/api/{api_service_version_id}",method = RequestMethod.PUT)
215214
public Message update(ApiServiceVo apiService,
216215
@PathVariable("api_service_version_id") Long apiServiceVersionId,
217-
@Context HttpServletRequest req) {
216+
HttpServletRequest req) {
218217
return ApiUtils.doAndResponse(() -> {
219218

220219
if (StringUtils.isBlank(apiService.getScriptPath())) {
@@ -299,7 +298,7 @@ public Message query(@RequestParam(required = false, name = "name") String name,
299298
@RequestParam(required = false, name = "status") Integer status,
300299
@RequestParam(required = false, name = "creator") String creator,
301300
@RequestParam(required = false, name = "workspaceId") Integer workspaceId,
302-
@Context HttpServletRequest req) {
301+
HttpServletRequest req) {
303302
String userName = SecurityFilter.getLoginUsername(req);
304303

305304
return ApiUtils.doAndResponse(() -> {
@@ -319,7 +318,7 @@ public Message query(@RequestParam(required = false, name = "name") String name,
319318

320319
@RequestMapping(value = "/getUserServices",method = RequestMethod.GET)
321320
public Message getUserServices(@RequestParam(required = false, name = "workspaceId") Integer workspaceId,
322-
@Context HttpServletRequest req){
321+
HttpServletRequest req){
323322
String userName = SecurityFilter.getLoginUsername(req);
324323
return ApiUtils.doAndResponse(() -> {
325324
if(!this.apiService.checkUserWorkspace(userName,workspaceId) ){
@@ -333,7 +332,7 @@ public Message getUserServices(@RequestParam(required = false, name = "workspace
333332

334333

335334
@RequestMapping(value = "/tags",method = RequestMethod.GET)
336-
public Message query( @Context HttpServletRequest req,@RequestParam(required = false, name = "workspaceId") Integer workspaceId) {
335+
public Message query( HttpServletRequest req,@RequestParam(required = false, name = "workspaceId") Integer workspaceId) {
337336
String userName = SecurityFilter.getLoginUsername(req);
338337
return ApiUtils.doAndResponse(() -> {
339338

@@ -347,7 +346,7 @@ public Message query( @Context HttpServletRequest req,@RequestParam(required = f
347346

348347
@RequestMapping(value = "/query",method = RequestMethod.GET)
349348
public Message queryByScriptPath(@RequestParam(required = false, name = "scriptPath") String scriptPath,
350-
@Context HttpServletRequest req) {
349+
HttpServletRequest req) {
351350
return ApiUtils.doAndResponse(() -> {
352351
String userName = SecurityFilter.getLoginUsername(req);
353352
if (StringUtils.isBlank(scriptPath)) {
@@ -372,7 +371,7 @@ public Message queryByScriptPath(@RequestParam(required = false, name = "scriptP
372371

373372
@RequestMapping(value = "/queryById",method = RequestMethod.GET)
374373
public Message queryById(@RequestParam(required = false, name = "id") Long id,
375-
@Context HttpServletRequest req) {
374+
HttpServletRequest req) {
376375
String userName = SecurityFilter.getLoginUsername(req);
377376
return ApiUtils.doAndResponse(() -> {
378377
if (id==null) {
@@ -416,7 +415,7 @@ public Message checkName(@RequestParam(required = false, name = "name") String n
416415

417416
@RequestMapping(value = "/apiDisable",method = RequestMethod.GET)
418417
public Message apiDisable(@RequestParam(required = false, name = "id") Long id,
419-
@Context HttpServletRequest req) {
418+
HttpServletRequest req) {
420419
return ApiUtils.doAndResponse(() -> {
421420
String userName = SecurityFilter.getLoginUsername(req);
422421
if (null == id) {
@@ -429,7 +428,7 @@ public Message apiDisable(@RequestParam(required = false, name = "id") Long id,
429428

430429
@RequestMapping(value = "/apiEnable",method = RequestMethod.GET)
431430
public Message apiEnable(@RequestParam(required = false, name = "id") Long id,
432-
@Context HttpServletRequest req) {
431+
HttpServletRequest req) {
433432
return ApiUtils.doAndResponse(() -> {
434433
String userName = SecurityFilter.getLoginUsername(req);
435434
if (null == id) {
@@ -442,7 +441,7 @@ public Message apiEnable(@RequestParam(required = false, name = "id") Long id,
442441

443442
@RequestMapping(value = "/apiDelete",method = RequestMethod.GET)
444443
public Message apiDelete(@RequestParam(required = false, name = "id") Long id,
445-
@Context HttpServletRequest req) {
444+
HttpServletRequest req) {
446445
//目前暂时不实际删除数据,只做不可见和不可用。
447446
return ApiUtils.doAndResponse(() -> {
448447
String userName = SecurityFilter.getLoginUsername(req);
@@ -455,7 +454,7 @@ public Message apiDelete(@RequestParam(required = false, name = "id") Long id,
455454
}
456455

457456
@RequestMapping(value = "/apiCommentUpdate",method = RequestMethod.POST)
458-
public Message apiCommentUpdate(@Context HttpServletRequest req,
457+
public Message apiCommentUpdate(HttpServletRequest req,
459458
@RequestBody ApiCommentUpdateRequest apiCommentUpdateRequest) {
460459
Long id = apiCommentUpdateRequest.getId();
461460
String comment = apiCommentUpdateRequest.getComment();
@@ -474,7 +473,7 @@ public Message apiCommentUpdate(@Context HttpServletRequest req,
474473
@RequestMapping(value = "/apiParamQuery",method = RequestMethod.GET)
475474
public Message apiParamQuery(@RequestParam(required = false, name = "scriptPath") String scriptPath,
476475
@RequestParam(required = false, name = "versionId") Long versionId,
477-
@Context HttpServletRequest req) {
476+
HttpServletRequest req) {
478477
return ApiUtils.doAndResponse(() -> {
479478
String userName = SecurityFilter.getLoginUsername(req);
480479
if (StringUtils.isEmpty(scriptPath)) {
@@ -490,7 +489,7 @@ public Message apiParamQuery(@RequestParam(required = false, name = "scriptPath"
490489

491490
@RequestMapping(value = "/apiVersionQuery",method = RequestMethod.GET)
492491
public Message apiVersionQuery(@RequestParam(required = false, name = "serviceId") Long serviceId,
493-
@Context HttpServletRequest req) {
492+
HttpServletRequest req) {
494493
return ApiUtils.doAndResponse(() -> {
495494
String userName = SecurityFilter.getLoginUsername(req);
496495
if (null == serviceId) {
@@ -505,7 +504,7 @@ public Message apiVersionQuery(@RequestParam(required = false, name = "serviceId
505504

506505
@RequestMapping(value = "/apiContentQuery",method = RequestMethod.GET)
507506
public Message apiContentQuery(@RequestParam(required = false, name = "versionId") Long versionId,
508-
@Context HttpServletRequest req) {
507+
HttpServletRequest req) {
509508
String userName = SecurityFilter.getLoginUsername(req);
510509
return ApiUtils.doAndResponse(() -> {
511510
if (null== versionId) {

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@
5454
import java.util.HashMap;
5555
import java.util.Map;
5656

57-
58-
5957
@RequestMapping(path = "/dss/apiservice", produces = {"application/json"})
6058
@RestController
6159
public class ApiServiceExecuteRestfulApi {
@@ -64,24 +62,20 @@ public class ApiServiceExecuteRestfulApi {
6462
private static final Logger logger = LoggerFactory.getLogger(ApiServiceExecuteRestfulApi.class);
6563
@Autowired
6664
private ApiServiceQueryService queryService;
67-
68-
6965
private static final String SYS_COLUMN_PREFIX = "_";
7066

7167
private static final String requestBodyDemo = "{\"moduleName\":\"aladdin-demo\",\"params\":{\"param1\": \"value1\"}}";
7268

73-
74-
7569
@RequestMapping(value = "/execute/{path:.*}",method = RequestMethod.POST)
7670
public Message post(@PathVariable("path") VariableString path, @RequestBody QueryRequest queryRequest,
77-
@Context HttpServletRequest req) {
71+
HttpServletRequest req) {
7872
String userName = SecurityFilter.getLoginUsername(req);
7973
return getResponse(userName,path.getPath(), queryRequest, HttpMethod.POST);
8074
}
8175

8276
@RequestMapping(value = "/execute/{path:.*}",method = RequestMethod.GET)
8377
public Message get(@PathVariable("path") VariableString path,
84-
@Context HttpServletRequest req) throws JsonProcessingException {
78+
HttpServletRequest req) throws JsonProcessingException {
8579
String userName = SecurityFilter.getLoginUsername(req);
8680

8781
QueryRequest queryRequest = new QueryRequest();
@@ -114,14 +108,14 @@ public Message get(@PathVariable("path") VariableString path,
114108

115109
@RequestMapping(value = "/execute/{path:.*}",method = RequestMethod.PUT)
116110
public Message put(@PathVariable("path") VariableString path, @RequestBody QueryRequest queryRequest,
117-
@Context HttpServletRequest req) {
111+
HttpServletRequest req) {
118112
String userName = SecurityFilter.getLoginUsername(req);
119113
return getResponse(userName,path.getPath(), queryRequest, HttpMethod.PUT);
120114
}
121115

122116
@RequestMapping(value = "/execute/{path:.*}",method = RequestMethod.DELETE)
123117
public Message delete(@PathVariable("path") VariableString path, @RequestBody QueryRequest queryRequest,
124-
@Context HttpServletRequest req) {
118+
HttpServletRequest req) {
125119
String userName = SecurityFilter.getLoginUsername(req);
126120
return getResponse(userName,path.getPath(), queryRequest, HttpMethod.DELETE);
127121
}
@@ -133,7 +127,7 @@ private void validParam(QueryRequest queryRequest) {
133127
}
134128

135129
@RequestMapping(value = "/getDirFileTrees",method = RequestMethod.GET)
136-
public void getDirFileTrees(@Context HttpServletRequest req, @Context HttpServletResponse resp,
130+
public void getDirFileTrees(HttpServletRequest req, HttpServletResponse resp,
137131
@RequestParam(required = false, name = "path") String path,
138132
@RequestParam(required = false, name = "taskId") String taskId) throws IOException, ApiServiceQueryException {
139133
String userName = SecurityFilter.getLoginUsername(req);
@@ -160,13 +154,13 @@ public void getDirFileTrees(@Context HttpServletRequest req, @Context HttpServle
160154

161155

162156
@RequestMapping(value = "/openFile",method = RequestMethod.GET)
163-
public void openFile(@Context HttpServletRequest req,
157+
public void openFile(HttpServletRequest req,
164158
@RequestParam(required = false, name = "path") String path,
165159
@RequestParam(required = false, name = "taskId") String taskId,
166160
@DefaultValue("1") @RequestParam(required = false, name = "page") Integer page,
167161
@DefaultValue("5000") @RequestParam(required = false, name = "pageSize") Integer pageSize,
168162
@DefaultValue("utf-8") @RequestParam(required = false, name = "charset") String charset,
169-
@Context HttpServletResponse resp) throws IOException, ApiServiceQueryException {
163+
HttpServletResponse resp) throws IOException, ApiServiceQueryException {
170164
String userName = SecurityFilter.getLoginUsername(req);
171165
if (StringUtils.isEmpty(path)) {
172166
throw new ApiServiceQueryException(80004, path);
@@ -189,8 +183,8 @@ public void openFile(@Context HttpServletRequest req,
189183

190184
@RequestMapping(value = "resultsetToExcel",method = RequestMethod.GET)
191185
public void resultsetToExcel(
192-
@Context HttpServletRequest req,
193-
@Context HttpServletResponse resp,
186+
HttpServletRequest req,
187+
HttpServletResponse resp,
194188
@RequestParam(required = false, name = "path") String path,
195189
@RequestParam(required = false, name = "taskId") String taskId,
196190
@DefaultValue("utf-8") @RequestParam(required = false, name = "charset") String charset,
@@ -248,7 +242,7 @@ public void resultsetToExcel(
248242
}
249243

250244
@RequestMapping(value = "/{id}/get",method = RequestMethod.GET)
251-
public Message getTaskByID(@Context HttpServletRequest req, @PathVariable("id") Long taskId) {
245+
public Message getTaskByID(HttpServletRequest req, @PathVariable("id") Long taskId) {
252246
String username = SecurityFilter.getLoginUsername(req);
253247
ApiServiceJob apiServiceJob = queryService.getJobByTaskId(taskId.toString());
254248
if (null != apiServiceJob && username.equals(apiServiceJob.getSubmitUser())) {

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceTokenRestfulApi.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import org.springframework.web.bind.annotation.RestController;
3636

3737
import javax.servlet.http.HttpServletRequest;
38-
import javax.ws.rs.core.Context;
3938
import java.util.Calendar;
4039
import java.util.Date;
4140

@@ -45,16 +44,11 @@
4544
@RestController
4645
public class ApiServiceTokenRestfulApi {
4746
private static final Logger LOG = LoggerFactory.getLogger(ApiServiceTokenRestfulApi.class);
48-
4947
@Autowired
5048
TokenQueryService tokenQueryService;
51-
52-
53-
5449
@Autowired
5550
TokenAuth tokenAuth;
5651

57-
5852
@RequestMapping(value = "/tokenQuery",method = RequestMethod.GET)
5953
public Message apiServiceTokenQuery(@RequestParam(required = false, name = "apiId") Long apiId,
6054
@RequestParam(required = false, name = "user") String user,
@@ -63,7 +57,7 @@ public Message apiServiceTokenQuery(@RequestParam(required = false, name = "apiI
6357
@RequestParam(required = false, name = "endDate") String endDateStr,
6458
@RequestParam(required = false, name = "currentPage") Integer currentPage,
6559
@RequestParam(required = false, name = "pageSize") Integer pageSize,
66-
@Context HttpServletRequest req) {
60+
HttpServletRequest req) {
6761
String userName = SecurityFilter.getLoginUsername(req);
6862
return ApiUtils.doAndResponse(() -> {
6963

@@ -96,7 +90,7 @@ public Message apiServiceTokenQuery(@RequestParam(required = false, name = "apiI
9690

9791
@RequestMapping(value = "/approvalRefresh",method = RequestMethod.GET)
9892
public Message refresh(@RequestParam(required = false, name = "approvalNo") String approvalNo,
99-
@Context HttpServletRequest req) {
93+
HttpServletRequest req) {
10094
String userName = SecurityFilter.getLoginUsername(req);
10195
return ApiUtils.doAndResponse(() ->{
10296
return Message.ok().data("approvalStatus", "success");

dss-apps/dss-datapipe-server/src/main/java/com/webank/wedatasphere/dss/datapipe/restful/DSSEntranceRestfulApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class DSSEntranceRestfulApi {
4747
private static final Logger logger = LoggerFactory.getLogger(DSSEntranceRestfulApi.class);
4848

4949
@RequestMapping(value = "/backgroundservice",method = RequestMethod.POST)
50-
public Message backgroundservice(@Context HttpServletRequest req,@RequestBody Map<String, Object> json) {
50+
public Message backgroundservice(HttpServletRequest req,@RequestBody Map<String, Object> json) {
5151
Message message = null;
5252
logger.info("Begin to get an execID");
5353
String backgroundType = (String) json.get("background");

dss-commons/dss-contextservice/src/main/java/com/webank/wedatasphere/dss/contextservice/service/impl/ContextServiceImpl.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,6 @@ public void checkAndSaveContext(String jsonFlow,String parentFlowID) throws DSSE
152152
workTypes.add(WorkType.PROJECT);
153153
workTypes.add(WorkType.FLOW);
154154
csWorkService.initContextServiceInfo(contextIDStr, workTypes);
155-
// ②解析和保存新的 UDF、Resource、Variable
156-
// 保存Workspace和Project的资源参数等
157-
// if (null != project.getProjectResources() && project.getProjectResources().size() > 0) {
158-
// saveContextResource(contextIDStr, project.getProjectResources(), contextClient, CSCommonUtils.PROJECT_RESOURCE_PREFIX);
159-
// }
160155

161156
// 保存flow的资源
162157
if (flowObject.has(DSSCommonUtils.FLOW_RESOURCE_NAME)) {
@@ -183,12 +178,6 @@ public void checkAndSaveContext(String jsonFlow,String parentFlowID) throws DSSE
183178
}
184179
if (json.has(DSSCommonUtils.NODE_PROP_NAME)) {
185180
JsonObject nodePropObj = json.get(DSSCommonUtils.NODE_PROP_NAME).getAsJsonObject();
186-
//节点的CS变量先不做存储,解决脚本节点执行变量没有及时清理问题
187-
// if (nodePropObj.has(DSSCommonUtils.NODE_PROP_VARIABLE_NAME)) {
188-
// JsonElement nodeVariables = nodePropObj.get(DSSCommonUtils.NODE_PROP_VARIABLE_NAME);
189-
// saveContextVariable(contextIDStr, nodeVariables, contextClient,
190-
// CSCommonUtils.NODE_PREFIX, json.get(DSSCommonUtils.NODE_NAME_NAME).getAsString());
191-
// }
192181
}
193182
}
194183
}

dss-framework/dss-framework-orchestrator-server/src/main/java/com/webank/wedatasphere/dss/orchestrator/server/restful/OrchestratorIERestful.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343

4444
import javax.servlet.http.HttpServletRequest;
4545
import javax.servlet.http.HttpServletResponse;
46-
import javax.ws.rs.DefaultValue;
47-
import javax.ws.rs.core.Context;
48-
import javax.ws.rs.core.Response;
4946
import java.io.IOException;
5047
import java.io.InputStream;
5148
import java.util.Arrays;
@@ -64,7 +61,7 @@ public class OrchestratorIERestful {
6461
private DSSOrchestratorContext orchestratorContext;
6562

6663
@RequestMapping(path ="importOrchestratorFile", method = RequestMethod.POST)
67-
public Message importOrcFile(@Context HttpServletRequest req,
64+
public Message importOrcFile(HttpServletRequest req,
6865
@RequestParam(required = false, name = "projectName") String projectName,
6966
@RequestParam(required = false, name = "projectID") Long projectID,
7067
@RequestParam(required = false, name = "labels") String labels,
@@ -107,8 +104,8 @@ public Message importOrcFile(@Context HttpServletRequest req,
107104
}
108105

109106
@RequestMapping(path ="exportOrchestrator", method = RequestMethod.GET)
110-
public void exportOrcFile(@Context HttpServletRequest req,
111-
@Context HttpServletResponse resp,
107+
public void exportOrcFile(HttpServletRequest req,
108+
HttpServletResponse resp,
112109
@RequestParam(defaultValue = "exportOrc",required = false, name = "outputFileName") String outputFileName,
113110
@RequestParam(defaultValue = "utf-8",required = false, name = "charset") String charset,
114111
@RequestParam(defaultValue = "zip",required = false, name = "outputFileType") String outputFileType,

0 commit comments

Comments
 (0)