Search in sources :

Example 1 with HttpPluginService

use of com.akaxin.site.business.impl.hai.HttpPluginService in project openzaly by akaxincom.

the class HttpRequestService method process.

public CommandResponse process(Command command) {
    HttpUriAction huaEnum = HttpUriAction.getUriActionEnum(command.getUri());
    command.setMethod(huaEnum.getMethod());
    CommandResponse response = null;
    try {
        switch(huaEnum) {
            case HAI_USER_UPDATE:
            case HAI_USER_SEALUP:
                if (!checkPermissions(command.getSiteUserId())) {
                    break;
                }
            case HAI_USER_LIST:
            case HAI_USER_SEARCH:
            case HAI_USER_PROFILE:
            case HAI_USER_RELATIONLIST:
                return new HttpUserService().execute(command);
            case HAI_GROUP_LIST:
            case HAI_GROUP_PROFILE:
            case HAI_GROUP_MEMBERS:
            case HAI_GROUP_ADDMEMBER:
            case HAI_GROUP_DELETE:
            case HAI_GROUP_REMOVEMEMBER:
            case HAI_GROUP_SETADMIN:
            case HAI_GROUP_UPDATEPROFILE:
            case HAI_GROUP_NONMEMBERS:
                if (checkPermissions(command.getSiteUserId())) {
                    response = new HttpGroupService().execute(command);
                }
                break;
            case HAI_FRIEND_APPLY:
                response = new HttpFriendService().execute(command);
                break;
            case HAI_SITE_GETCONFIG:
            case HAI_SITE_UPDATECONFIG:
                if (checkPermissions(command.getSiteUserId())) {
                    response = new HttpSiteConfigService().execute(command);
                }
                break;
            case HAI_PLUGIN_ADD:
            case HAI_PLUGIN_DELETE:
            case HAI_PLUGIN_DISABLE:
            case HAI_PLUGIN_LIST:
            case HAI_PLUGIN_PROFILE:
            case HAI_PLUGIN_UPDATE:
            case HAI_PLUGIN_UPDATESTATUS:
                if (checkPermissions(command.getSiteUserId())) {
                    response = new HttpPluginService().execute(command);
                }
                break;
            case HAI_UIC_CREATE:
            case HAI_UIC_INFO:
            case HAI_UIC_LIST:
                if (checkPermissions(command.getSiteUserId())) {
                    response = new HttpUICService().execute(command);
                }
                break;
            default:
                logger.error("error http request command={}", command.toString());
                break;
        }
    } catch (Exception e) {
        logger.error("http request service error.", e);
    }
    if (response == null) {
        response = new CommandResponse();
    }
    return response.setVersion(CommandConst.PROTOCOL_VERSION).setAction(CommandConst.ACTION_RES);
}
Also used : HttpUICService(com.akaxin.site.business.impl.hai.HttpUICService) HttpGroupService(com.akaxin.site.business.impl.hai.HttpGroupService) HttpSiteConfigService(com.akaxin.site.business.impl.hai.HttpSiteConfigService) HttpPluginService(com.akaxin.site.business.impl.hai.HttpPluginService) HttpUriAction(com.akaxin.common.constant.HttpUriAction) HttpUserService(com.akaxin.site.business.impl.hai.HttpUserService) CommandResponse(com.akaxin.common.command.CommandResponse) HttpFriendService(com.akaxin.site.business.impl.hai.HttpFriendService)

Aggregations

CommandResponse (com.akaxin.common.command.CommandResponse)1 HttpUriAction (com.akaxin.common.constant.HttpUriAction)1 HttpFriendService (com.akaxin.site.business.impl.hai.HttpFriendService)1 HttpGroupService (com.akaxin.site.business.impl.hai.HttpGroupService)1 HttpPluginService (com.akaxin.site.business.impl.hai.HttpPluginService)1 HttpSiteConfigService (com.akaxin.site.business.impl.hai.HttpSiteConfigService)1 HttpUICService (com.akaxin.site.business.impl.hai.HttpUICService)1 HttpUserService (com.akaxin.site.business.impl.hai.HttpUserService)1