Search in sources :

Example 21 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getBasePath.

@SuppressWarnings("unchecked")
public static String getBasePath(String sysId, HttpServletRequest request) {
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
    if (StringUtils.isBlank(sysId)) {
        return basePath;
    }
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return basePath;
        }
        sys = result.getValue();
        basePath = request.getScheme() + "://" + sys.getHost() + "/" + sys.getContextPath() + "/";
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return basePath;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 22 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getContextPath.

@SuppressWarnings("unchecked")
public static String getContextPath(String sysId) {
    String contextPath = "";
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return contextPath;
        }
        sys = result.getValue();
        contextPath = sys.getContextPath();
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return contextPath;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 23 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class CxfServerBean method shutdownOrReloadCallAllSystem.

public static Map<String, String> shutdownOrReloadCallAllSystem(HttpServletRequest request, String type) throws ServiceException, Exception {
    Map<String, String> result = new HashMap<String, String>();
    boolean status = true;
    List<SysVO> systemList = ApplicationSiteUtils.getSystems();
    StringBuilder out = new StringBuilder();
    for (SysVO sys : systemList) {
        try {
            Map<String, Object> dataMap = shutdownOrReloadCallOneSystem(request, sys.getSysId(), type);
            out.append(sys.getSysId()).append(" = ").append(dataMap.get("message")).append("\n");
            if (!YesNo.YES.equals(dataMap.get("success"))) {
                status = false;
            }
        } catch (Exception e) {
            e.printStackTrace();
            status = false;
            out.append(sys.getSysId()).append(" = ").append(e.getMessage().toString()).append("\n");
        }
    }
    result.put("message", out.toString());
    if (status) {
        result.put("success", YesNo.YES);
    } else {
        result.put("success", YesNo.NO);
    }
    return result;
}
Also used : HashMap(java.util.HashMap) SysVO(com.netsteadfast.greenstep.vo.SysVO) JsonParseException(com.fasterxml.jackson.core.JsonParseException) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException)

Example 24 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method checkLoginUrlWithAllSysHostConfig.

@SuppressWarnings("unchecked")
public static boolean checkLoginUrlWithAllSysHostConfig(HttpServletRequest request) {
    boolean pathSuccess = true;
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    try {
        List<TbSys> sysList = sysService.findListByParams(null);
        for (int i = 0; sysList != null && i < sysList.size() && pathSuccess; i++) {
            TbSys sys = sysList.get(i);
            pathSuccess = !checkCrossSite(sys.getHost().toLowerCase(), request);
            if (pathSuccess) {
                pathSuccess = checkTestConnection(sys.getHost(), sys.getContextPath(), request);
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return pathSuccess;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Example 25 with SysVO

use of com.netsteadfast.greenstep.vo.SysVO in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getHost.

@SuppressWarnings("unchecked")
public static String getHost(String sysId) {
    String host = "";
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    SysVO sys = new SysVO();
    sys.setSysId(sysId);
    try {
        DefaultResult<SysVO> result = sysService.findByUK(sys);
        if (result.getValue() == null) {
            return "";
        }
        sys = result.getValue();
        host = sys.getHost();
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return host;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ISysService(com.netsteadfast.greenstep.service.ISysService) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysVO(com.netsteadfast.greenstep.vo.SysVO) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) JsonMappingException(com.fasterxml.jackson.databind.JsonMappingException) JsonParseException(com.fasterxml.jackson.core.JsonParseException)

Aggregations

SysVO (com.netsteadfast.greenstep.vo.SysVO)35 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)30 ServiceMethodAuthority (com.netsteadfast.greenstep.base.model.ServiceMethodAuthority)13 Transactional (org.springframework.transaction.annotation.Transactional)13 JsonParseException (com.fasterxml.jackson.core.JsonParseException)7 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)7 TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)6 ISysService (com.netsteadfast.greenstep.service.ISysService)6 SysExpressionVO (com.netsteadfast.greenstep.vo.SysExpressionVO)3 HashMap (java.util.HashMap)3 SysCtxBeanVO (com.netsteadfast.greenstep.vo.SysCtxBeanVO)2 SysExprJobVO (com.netsteadfast.greenstep.vo.SysExprJobVO)2 SysIconVO (com.netsteadfast.greenstep.vo.SysIconVO)2 SysMsgNoticeConfigVO (com.netsteadfast.greenstep.vo.SysMsgNoticeConfigVO)2 SysTwitterVO (com.netsteadfast.greenstep.vo.SysTwitterVO)2 SysWsConfigVO (com.netsteadfast.greenstep.vo.SysWsConfigVO)2 TbSysIcon (com.netsteadfast.greenstep.po.hbm.TbSysIcon)1 SysBeanHelpVO (com.netsteadfast.greenstep.vo.SysBeanHelpVO)1 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)1 Map (java.util.Map)1