Search in sources :

Example 21 with ActionHelper

use of app.hongs.action.ActionHelper in project HongsCORE by ihongs.

the class Common method execAction.

@Cmdlet("exec-action")
public static void execAction(String[] args) throws HongsException {
    Map<String, Object> opts;
    opts = CmdletHelper.getOpts(args, "request:s", "context:s", "session:s", "cookies:s");
    args = (String[]) opts.get("");
    if (args.length == 0) {
        System.err.println("Action name required!\r\nUsage: ACTION_NAME --request QUERY_STRING --cookies QUERY_STRING --session QUERY_STRING --context QUERY_STRING");
        return;
    }
    ActionHelper helper = Core.getInstance(ActionHelper.class);
    helper.setRequestData(data((String) opts.get("request")));
    helper.setContextData(data((String) opts.get("context")));
    helper.setSessionData(data((String) opts.get("session")));
    helper.setCookiesData(data((String) opts.get("cookies")));
    ActionRunner runner = new ActionRunner(helper, args[0]);
    runner.doAction();
    CmdletHelper.preview(helper.getResponseData());
}
Also used : ActionRunner(app.hongs.action.ActionRunner) ActionHelper(app.hongs.action.ActionHelper) Cmdlet(app.hongs.cmdlet.anno.Cmdlet)

Aggregations

ActionHelper (app.hongs.action.ActionHelper)21 HashSet (java.util.HashSet)10 Map (java.util.Map)7 Set (java.util.Set)7 HongsException (app.hongs.HongsException)5 HashMap (java.util.HashMap)5 Core (app.hongs.Core)4 HongsError (app.hongs.HongsError)4 ActionRunner (app.hongs.action.ActionRunner)4 List (java.util.List)4 NaviMap (app.hongs.action.NaviMap)3 Cmdlet (app.hongs.cmdlet.anno.Cmdlet)3 HongsExpedient (app.hongs.HongsExpedient)2 Table (app.hongs.db.Table)2 LuceneRecord (app.hongs.dh.lucene.LuceneRecord)2 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 CoreConfig (app.hongs.CoreConfig)1 FormSet (app.hongs.action.FormSet)1