Search in sources :

Example 6 with Select

use of io.github.ihongs.action.anno.Select in project HongsCORE by ihongs.

the class UserAction method getInfo.

@Action("info")
@Select(conf = "master", form = "user")
public void getInfo(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    String id = helper.getParameter("id");
    String nc = helper.getParameter("with-roles");
    String ud = (String) helper.getSessibute(Cnst.UID_SES);
    if (id != null && id.length() != 0) {
        rd = model.getInfo(rd);
    } else {
        rd = new HashMap();
    }
    // With all roles
    if (nc != null && nc.length() != 0) {
        List rs = NaviMap.getInstance(nc).getRoleTranslated(0, !Cnst.ADM_UID.equals(ud) ? AuthKit.getUserRoles(ud) : null);
        Dict.put(rd, rs, "enfo", "roles..role");
    }
    // Remove the password field, don't show password in page
    Map info = (Map) rd.get("info");
    if (info != null) {
        info.remove("password");
        info.remove("passcode");
    }
    helper.reply(rd);
}
Also used : HashMap(java.util.HashMap) List(java.util.List) HashMap(java.util.HashMap) NaviMap(io.github.ihongs.action.NaviMap) Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) Select(io.github.ihongs.action.anno.Select)

Example 7 with Select

use of io.github.ihongs.action.anno.Select in project HongsCORE by ihongs.

the class FormAction method getList.

@Action("list")
@Select(conf = "matrix", form = "form")
public void getList(ActionHelper helper) throws HongsException {
    Map rd = helper.getRequestData();
    Map sd = model.getList(rd);
    helper.reply(sd);
}
Also used : Map(java.util.Map) Action(io.github.ihongs.action.anno.Action) Select(io.github.ihongs.action.anno.Select)

Example 8 with Select

use of io.github.ihongs.action.anno.Select in project HongsCORE by ihongs.

the class SearchAction method search.

@Action("search")
@Preset(conf = "", form = "")
@Select(conf = "", form = "")
@Override
public void search(ActionHelper helper) throws HongsException {
    /**
     * 有指定查询条件则按匹配度排序
     */
    Map rd = helper.getRequestData();
    Object wd = rd.get(Cnst.WD_KEY);
    if (wd != null && !"".equals(wd)) {
        Set xb = Synt.toTerms(rd.get(Cnst.OB_KEY));
        List ob;
        if (xb == null) {
            ob = new ArrayList(1);
            rd.put(Cnst.OB_KEY, ob);
            ob.add(0, "-");
        } else if (!xb.contains("-") && !xb.contains("*")) {
            ob = new ArrayList(xb);
            rd.put(Cnst.OB_KEY, ob);
            ob.add(0, "-");
        }
    }
    super.search(helper);
}
Also used : FormSet(io.github.ihongs.action.FormSet) Set(java.util.Set) HashSet(java.util.HashSet) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) JAction(io.github.ihongs.dh.JAction) Action(io.github.ihongs.action.anno.Action) Preset(io.github.ihongs.action.anno.Preset) Select(io.github.ihongs.action.anno.Select)

Aggregations

Action (io.github.ihongs.action.anno.Action)8 Select (io.github.ihongs.action.anno.Select)8 Map (java.util.Map)8 Preset (io.github.ihongs.action.anno.Preset)4 List (java.util.List)3 NaviMap (io.github.ihongs.action.NaviMap)2 JAction (io.github.ihongs.dh.JAction)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 Set (java.util.Set)2 FormSet (io.github.ihongs.action.FormSet)1 IAction (io.github.ihongs.dh.IAction)1 ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1