Search in sources :

Example 1 with FileManager

use of com.baidu.ueditor.hunter.FileManager in project HongsCORE by ihongs.

the class ActionEnter method invoke.

public String invoke() {
    if (actionType == null || !ActionMap.mapping.containsKey(actionType)) {
        return new BaseState(false, AppInfo.INVALID_ACTION).toJSONString();
    }
    if (this.configManager == null || !this.configManager.valid()) {
        return new BaseState(false, AppInfo.CONFIG_ERROR).toJSONString();
    }
    State state = null;
    int actionCode = ActionMap.getType(this.actionType);
    Map<String, Object> conf = null;
    switch(actionCode) {
        case ActionMap.CONFIG:
            return this.configManager.getAllConfig().toString();
        case ActionMap.UPLOAD_IMAGE:
        case ActionMap.UPLOAD_SCRAWL:
        case ActionMap.UPLOAD_VIDEO:
        case ActionMap.UPLOAD_FILE:
            conf = this.configManager.getConfig(actionCode);
            state = new Uploader(request, conf).doExec();
            break;
        case ActionMap.CATCH_IMAGE:
            conf = configManager.getConfig(actionCode);
            String[] list = this.request.getParameterValues((String) conf.get("fieldName"));
            state = new ImageHunter(conf).capture(list);
            break;
        case ActionMap.LIST_IMAGE:
        case ActionMap.LIST_FILE:
            conf = configManager.getConfig(actionCode);
            int start = this.getStartIndex();
            state = new FileManager(conf).listFile(start);
            break;
    }
    return state.toJSONString();
}
Also used : ImageHunter(com.baidu.ueditor.hunter.ImageHunter) BaseState(com.baidu.ueditor.define.BaseState) BaseState(com.baidu.ueditor.define.BaseState) State(com.baidu.ueditor.define.State) Uploader(com.baidu.ueditor.upload.Uploader) FileManager(com.baidu.ueditor.hunter.FileManager)

Aggregations

BaseState (com.baidu.ueditor.define.BaseState)1 State (com.baidu.ueditor.define.State)1 FileManager (com.baidu.ueditor.hunter.FileManager)1 ImageHunter (com.baidu.ueditor.hunter.ImageHunter)1 Uploader (com.baidu.ueditor.upload.Uploader)1