Search in sources :

Example 56 with Action

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

the class UnitAction method doSave.

@Action("save")
@Verify(conf = "matrix", form = "unit")
@CommitSuccess
public void doSave(ActionHelper helper) throws HongsException {
    Map data = helper.getRequestData();
    String id = model.set(data);
    Map info = new HashMap();
    info.put("id", id);
    info.put("name", data.get("name"));
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.save.unit.success");
    helper.reply(ms, info);
}
Also used : CoreLocale(app.hongs.CoreLocale) HashMap(java.util.HashMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess) Verify(app.hongs.action.anno.Verify)

Example 57 with Action

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

the class UnitAction method doDelete.

@Action("delete")
@CommitSuccess
public void doDelete(ActionHelper helper) throws HongsException {
    Map data = helper.getRequestData();
    int rows = model.delete(data);
    CoreLocale lang = CoreLocale.getInstance().clone();
    lang.load("matrix");
    String ms = lang.translate("core.delete.unit.success", Integer.toString(rows));
    helper.reply(ms, rows);
}
Also used : CoreLocale(app.hongs.CoreLocale) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action) CommitSuccess(app.hongs.action.anno.CommitSuccess)

Example 58 with Action

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

the class MenuAction method list.

@Action("list")
public void list(ActionHelper helper) throws HongsException {
    String m = helper.getParameter("m");
    String n = helper.getParameter("n");
    String d = helper.getParameter("d");
    List l;
    int b;
    if (m == null || m.length() == 0) {
        m = "default";
    }
    if (d != null && d.length() != 0) {
        b = Integer.parseInt(d);
    } else {
        b = 1;
    }
    if (n != null && n.length() != 0) {
        l = NaviMap.getInstance(m).getMenuTranslated(n, b);
    } else {
        l = NaviMap.getInstance(m).getMenuTranslated(b);
    }
    Map data = new HashMap();
    data.put("list", l);
    helper.reply(data);
}
Also used : HashMap(java.util.HashMap) List(java.util.List) NaviMap(app.hongs.action.NaviMap) Map(java.util.Map) HashMap(java.util.HashMap) Action(app.hongs.action.anno.Action)

Example 59 with Action

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

the class DBAction method isUnique.

@Action("unique")
public void isUnique(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "unique", req);
    FetchCase c = new FetchCase();
    c.setOption("INCLUDE_REMOVED", Synt.declare(req.get("include-removed"), false));
    boolean val = ett.unique(req, c);
    helper.reply(null, val ? 1 : 0);
}
Also used : FetchCase(app.hongs.db.util.FetchCase) Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction)

Example 60 with Action

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

the class DBAction method search.

@Action("search")
@Preset(conf = "", form = "")
@Select(conf = "", form = "")
@Override
public void search(ActionHelper helper) throws HongsException {
    Model ett = getEntity(helper);
    Map req = helper.getRequestData();
    req = getReqMap(helper, ett, "search", req);
    Map rsp = ett.search(req);
    rsp = getRspMap(helper, ett, "search", rsp);
    helper.reply(rsp);
}
Also used : Map(java.util.Map) Action(app.hongs.action.anno.Action) IAction(app.hongs.dh.IAction) Preset(app.hongs.action.anno.Preset) Select(app.hongs.action.anno.Select)

Aggregations

Action (app.hongs.action.anno.Action)63 Map (java.util.Map)52 HashMap (java.util.HashMap)38 NaviMap (app.hongs.action.NaviMap)16 CommitSuccess (app.hongs.action.anno.CommitSuccess)14 CoreLocale (app.hongs.CoreLocale)12 Preset (app.hongs.action.anno.Preset)12 IAction (app.hongs.dh.IAction)10 RoleMap (app.hongs.serv.auth.RoleMap)10 Verify (app.hongs.action.anno.Verify)9 FetchCase (app.hongs.db.util.FetchCase)8 CoreConfig (app.hongs.CoreConfig)7 Select (app.hongs.action.anno.Select)7 Set (java.util.Set)6 File (java.io.File)5 List (java.util.List)5 HongsException (app.hongs.HongsException)4 ActionRunner (app.hongs.action.ActionRunner)4 LuceneAction (app.hongs.dh.lucene.LuceneAction)3 SearchAction (app.hongs.dh.search.SearchAction)3