use of app.hongs.action.anno.Action in project HongsCORE by ihongs.
the class DBAction method create.
@Action("create")
@Preset(conf = "", form = "", deft = { ":create" })
@Select(conf = "", form = "", mode = 2)
@Verify(conf = "", form = "")
@CommitSuccess
@Override
public void create(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "create", req);
Map rsp = ett.create(req);
rsp = getRspMap(helper, ett, "create", rsp);
String msg = getRspMsg(helper, ett, "create", 1);
helper.reply(msg, rsp);
}
use of app.hongs.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 app.hongs.action.anno.Action in project HongsCORE by ihongs.
the class DBAction method update.
@Action("update")
@Preset(conf = "", form = "", deft = { ":update" })
@Verify(conf = "", form = "")
@CommitSuccess
@Override
public void update(ActionHelper helper) throws HongsException {
Model ett = getEntity(helper);
Map req = helper.getRequestData();
req = getReqMap(helper, ett, "update", req);
int num = ett.update(req);
String msg = getRspMsg(helper, ett, "update", num);
helper.reply(msg, num);
}
use of app.hongs.action.anno.Action in project HongsCORE by ihongs.
the class SearchAction method search.
@Action("search")
@Preset(conf = "", form = "")
@Select(conf = "", form = "")
@Spread(conf = "", form = "")
@Override
public void search(ActionHelper helper) throws HongsException {
/**
* 有指定查询条件则按匹配度排序
*/
Map rd = helper.getRequestData();
Object wd = rd.get(Cnst.WD_KEY);
if (null != wd && "".equals(wd)) {
List ob = Synt.asList(rd.get(Cnst.OB_KEY));
if (ob == null) {
ob = new ArrayList();
rd.put(Cnst.OB_KEY, ob);
ob.add(0, "-");
} else if (!ob.contains("-")) {
ob.add(0, "-");
}
}
super.search(helper);
}
use of app.hongs.action.anno.Action in project HongsCORE by ihongs.
the class FileAction method update.
@Override
@Action("update")
public void update(ActionHelper helper) throws HongsException {
CoreLocale lang = CoreLocale.getInstance("manage");
String path = helper.getParameter("path");
String dist = helper.getParameter("dist");
String text = helper.getParameter("text");
File file;
File dizt;
if (dist != null && dist.equals(path)) {
dist = null;
}
if (path == null) {
helper.fault(lang.translate("core.manage.file.path.required"));
return;
}
path = realPath(path);
if (path == null) {
helper.fault(lang.translate("core.manage.file.path.is.error"));
return;
}
file = new File(path);
if (!file.exists()) {
helper.fault(lang.translate("core.manage.file.path.is.not.exist"));
return;
}
if (isDenyFile(file)) {
helper.fault(lang.translate("core.manage.file.interdicted"));
return;
}
// 改名移动
if (dist != null) {
dist = realPath(dist);
if (dist == null) {
helper.fault(lang.translate("core.manage.file.path.is.error"));
return;
}
dizt = new File(dist);
if (dizt.exists()) {
helper.fault(lang.translate("core.manage.file.dist.is.exist"));
return;
}
if (isDenyFile(file)) {
helper.fault(lang.translate("core.manage.file.interdicted"));
return;
}
if (!file.renameTo(dizt)) {
helper.fault(lang.translate("core.manage.file.rename.failed"));
return;
}
if (text == null) {
return;
}
file = dizt;
}
// 写入文件
try {
saveFile(file, text);
} catch (Exception ex) {
CoreLogger.error(ex);
helper.fault(lang.translate("core.manage.file.update.failed"));
return;
}
helper.reply("");
}
Aggregations