use of io.github.ihongs.action.anno.Action in project HongsCORE by ihongs.
the class MenuAction method menu.
@Action("__main__")
public void menu(ActionHelper helper) throws HongsException {
// 配置名称
String m = helper.getParameter("m");
// 节点标识
String n = helper.getParameter("n");
// 附加标识(已废弃)
String x = helper.getParameter("x");
String u = MENU_ACT_URI;
if (m == null || "".equals(m)) {
m = "default";
}
u += "?m=" + m;
if (n != null) {
u += "&n=" + n;
}
if (x != null) {
u += "&x=" + x;
}
NaviMap site = NaviMap.getInstance(m);
Map menu = (Map) site.getMenu(u);
if (menu != null) {
Map mens = (Map) menu.get("menus");
if (mens != null) {
// 寻找其下有权限的菜单
u = getRedirect(site, mens);
if (u != null) {
helper.ensue(Core.SERV_PATH + "/" + u);
return;
}
}
// 找不到则转入后备地址
// 默认等同模块配置路径
u = (String) menu.get("hrel");
if (u != null) {
helper.ensue(Core.SERV_PATH + "/" + u);
return;
} else {
u = "default".equals(m) ? "" : m;
helper.ensue(Core.SERV_PATH + "/" + u);
return;
}
}
throw new HongsException(404, "Can not find the menu " + m);
}
use of io.github.ihongs.action.anno.Action in project HongsCORE by ihongs.
the class DBAction method isExists.
@Action("exists")
public void isExists(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "exists", req);
FetchCase c = new FetchCase();
c.setOption("INCLUDE_REMOVED", Synt.declare(req.get("include-removed"), false));
boolean val = ett.exists(req, c);
helper.reply(null, val ? 1 : 0);
}
use of io.github.ihongs.action.anno.Action in project HongsCORE by ihongs.
the class DBAction method delete.
@Override
@Action("delete")
@Preset(conf = "", form = "", defs = { ":defence" })
@CommitSuccess
public void delete(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "delete", req);
int num = ett.delete(req);
String msg = getRspMsg(helper, ett, "delete", num);
helper.reply(msg, num);
}
use of io.github.ihongs.action.anno.Action in project HongsCORE by ihongs.
the class DBAction method create.
@Override
@Action("create")
@Preset(conf = "", form = "", defs = { ":initial" })
@Verify(conf = "", form = "")
@CommitSuccess
public void create(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "create", req);
String nid = ett.create(req);
String msg = getRspMsg(helper, ett, "create", 1);
helper.reply(msg, nid);
}
Aggregations