Search in sources :

Example 6 with CommitSuccess

use of app.hongs.action.anno.CommitSuccess 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);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) CommitSuccess(app.hongs.action.anno.CommitSuccess) Preset(app.hongs.action.anno.Preset) Select(app.hongs.action.anno.Select) Verify(app.hongs.action.anno.Verify)

Example 7 with CommitSuccess

use of app.hongs.action.anno.CommitSuccess 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);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) CommitSuccess(app.hongs.action.anno.CommitSuccess) Preset(app.hongs.action.anno.Preset) Verify(app.hongs.action.anno.Verify)

Example 8 with CommitSuccess

use of app.hongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class DeptAction method doSave.

@Action("save")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    String id = model.set(rd);
    rd = new HashMap();
    rd.put("id", id);
    rd.put("name", rd.get("name"));
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.save.dept.success");
    helper.reply(ms, rd);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Example 9 with CommitSuccess

use of app.hongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class UserAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    FetchCase fc = model.fetchCase();
    fc.setOption("INCLUDE_REMOVED", Synt.declare(rd.get("include-removed"), false));
    // 不能删除自己和超级管理员
    Set rs = Synt.asSet(rd.get(model.table.primaryKey));
    if (rs != null) {
        if (rs.contains(helper.getSessibute(Cnst.UID_SES))) {
            helper.fault("不能删除当前登录用户");
            return;
        }
        if (rs.contains(Cnst.ADM_UID)) {
            helper.fault("不能删除超级管理账号");
            return;
        }
    }
    int rn = model.delete(rd, fc);
    CoreLocale ln = CoreLocale.getInstance().clone();
    ln.load("master");
    String ms = ln.translate("core.delete.user.success", Integer.toString(rn));
    helper.reply(ms, rn);
}
Also used : CoreLocale(app.hongs.CoreLocale) FetchCase(app.hongs.db.util.FetchCase) Set(java.util.Set) HashMap(java.util.HashMap) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) RoleMap(app.hongs.serv.auth.RoleMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Example 10 with CommitSuccess

use of app.hongs.action.anno.CommitSuccess in project HongsCORE by ihongs.

the class DataAction method redo.

@Action("revert/update")
@CommitSuccess
public void redo(ActionHelper helper) throws HongsException {
    String id = helper.getParameter(Cnst.ID_KEY);
    if (null == id || "".equals(id)) {
        throw new HongsException(0x1100, "id required");
    }
    Data sr = (Data) getEntity(helper);
    Map rd = helper.getRequestData();
    sr.redo(id, rd);
    helper.reply("");
}
Also used : HongsException(app.hongs.HongsException) Data(app.hongs.serv.matrix.Data) HashMap(java.util.HashMap) Map(java.util.Map) Action(app.hongs.action.anno.Action) SearchAction(app.hongs.dh.search.SearchAction) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Aggregations

Action (app.hongs.action.anno.Action)14 CommitSuccess (app.hongs.action.anno.CommitSuccess)14 Map (java.util.Map)14 HashMap (java.util.HashMap)8 CoreLocale (app.hongs.CoreLocale)7 NaviMap (app.hongs.action.NaviMap)7 Preset (app.hongs.action.anno.Preset)6 Verify (app.hongs.action.anno.Verify)6 RoleMap (app.hongs.serv.auth.RoleMap)4 IAction (app.hongs.dh.IAction)3 Select (app.hongs.action.anno.Select)2 HongsException (app.hongs.HongsException)1 FetchCase (app.hongs.db.util.FetchCase)1 SearchAction (app.hongs.dh.search.SearchAction)1 Data (app.hongs.serv.matrix.Data)1 Set (java.util.Set)1