You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.8 KiB
53 lines
1.8 KiB
package com.fr.plugin.decision.http; |
|
|
|
import com.fr.decision.fun.impl.BaseHttpHandler; |
|
import com.fr.decision.webservice.v10.user.UserService; |
|
import com.fr.json.JSONObject; |
|
import com.fr.plugin.decision.ExcelMngConfigAccessBridge; |
|
import com.fr.plugin.decision.dao.ExcelLinkService; |
|
import com.fr.plugin.decision.dao.ExcelMngDao; |
|
import com.fr.plugin.decision.dao.ExcelMngEntity; |
|
import com.fr.stable.db.action.DBAction; |
|
import com.fr.stable.db.dao.DAOContext; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
|
import com.fr.web.utils.WebUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
import java.util.UUID; |
|
|
|
public class AddLinkHttpHandler extends BaseHttpHandler { |
|
@Override |
|
public RequestMethod getMethod() { |
|
return null; |
|
} |
|
|
|
@Override |
|
public String getPath() { |
|
return "/excelmng/addlink"; |
|
} |
|
|
|
@Override |
|
public boolean isPublic() { |
|
return false; |
|
} |
|
|
|
@Override |
|
public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { |
|
|
|
final String name = WebUtils.getHTTPRequestParameter(req,"name"); |
|
final String datasouces = WebUtils.getHTTPRequestParameter(req,"datasouces"); |
|
final String schema = WebUtils.getHTTPRequestParameter(req,"schema"); |
|
final String tablename = WebUtils.getHTTPRequestParameter(req,"tablename"); |
|
final String createUser = UserService.getInstance().getCurrentUserIdFromCookie(req); |
|
|
|
try { |
|
ExcelLinkService.getInstance().addLink(name, datasouces, schema, tablename, createUser); |
|
WebUtils.printAsJSON(res, new JSONObject().put("status","success")); |
|
return; |
|
} catch (Exception e) { |
|
e.printStackTrace(); |
|
WebUtils.printAsJSON(res, new JSONObject().put("status","fail")); |
|
} |
|
} |
|
}
|
|
|