Search in sources :

Example 1 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method configureHost.

@SuppressWarnings("unchecked")
public static void configureHost(String sysId, String logConfFileFullPath) {
    String logValue = FSUtils.readStr(logConfFileFullPath).trim();
    if (!StringUtils.isBlank(logValue) && UPDATE_HOST_ONLY_FIRST_ONE.equals(Constants.getApplicationSiteHostUpdateMode())) {
        // has before start log file, and UPDATE_HOST_ONLY_FIRST_ONE mode
        FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ONLY_FIRST_ONE);
        return;
    }
    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) {
            System.out.println(result.getSystemMessage().getValue());
            return;
        }
        sys = result.getValue();
        // 2016-06-29 rem
        /*
			String port = "";
			String tmp[] = sys.getHost().split(":");
			if ( tmp!=null && tmp.length==2 ) {
				port = tmp[1];
			}
			*/
        // 2016-06-29 add
        String port = String.valueOf(HostUtils.getHttpPort());
        String hostAddress = HostUtils.getHostAddress();
        sys.setHost(hostAddress);
        if (!StringUtils.isBlank(port)) {
            sys.setHost(hostAddress + ":" + port);
        }
        sysService.updateObject(sys);
        if (UPDATE_HOST_ALWAYS.equals(Constants.getApplicationSiteHostUpdateMode())) {
            FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ALWAYS);
        } else {
            FSUtils.writeStr2(logConfFileFullPath, UPDATE_HOST_ONLY_FIRST_ONE);
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
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 2 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ApplicationSiteUtils method getSystemsCheckCrossSiteWithTestConnection.

@SuppressWarnings("unchecked")
public static List<SysVO> getSystemsCheckCrossSiteWithTestConnection(HttpServletRequest request) {
    ISysService<SysVO, TbSys, String> sysService = (ISysService<SysVO, TbSys, String>) AppContext.getBean("core.service.SysService");
    List<SysVO> sysList = null;
    try {
        sysList = sysService.findListVOByParams(null);
        for (SysVO sys : sysList) {
            if (checkCrossSite(sys.getHost().toLowerCase(), request)) {
                sys.setCrossSiteFlag(YesNo.YES);
            } else {
                sys.setCrossSiteFlag(YesNo.NO);
            }
            if (checkTestConnection(sys.getHost(), sys.getContextPath(), request)) {
                sys.setTestFlag(YesNo.YES);
            } else {
                sys.setTestFlag(YesNo.NO);
            }
        }
    } catch (ServiceException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
    return sysList;
}
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 3 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class MenuSupportUtils method loadSysMenuData.

protected static List<SysMenuVO> loadSysMenuData(String system) throws ServiceException, Exception {
    List<SysMenuVO> menuList = null;
    TbSys sys = new TbSys();
    sys.setSysId(system);
    if (sysService.countByEntityUK(sys) != 1) {
        // 必需要有 TB_SYS 資料
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    Subject subject = SecurityUtils.getSubject();
    String account = (String) subject.getPrincipal();
    if (StringUtils.isBlank(account)) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    if (subject.hasRole(Constants.SUPER_ROLE_ADMIN) || subject.hasRole(Constants.SUPER_ROLE_ALL)) {
        account = null;
    }
    DefaultResult<List<SysMenuVO>> result = sysMenuService.findForMenuGenerator(system, account);
    if (result.getValue() != null) {
        menuList = result.getValue();
    }
    if (menuList == null) {
        menuList = new ArrayList<SysMenuVO>();
    }
    return menuList;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) SysMenuVO(com.netsteadfast.greenstep.vo.SysMenuVO) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) Subject(org.apache.shiro.subject.Subject)

Example 4 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class ReportRoleViewManagementAction method initData.

private void initData() throws ServiceException, Exception {
    String progId = super.getActionMethodProgramId();
    TbSysProg prog = new TbSysProg();
    prog.setProgId(progId);
    prog = this.sysProgService.findByEntityUK(prog);
    if (prog == null) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    TbSys sys = new TbSys();
    sys.setSysId(prog.getProgSystem());
    sys = this.sysService.findByEntityUK(sys);
    if (sys == null) {
        throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
    }
    this.defaultUrl = MenuSupportUtils.getUrl(super.getBasePath(), sys, prog, super.getHttpServletRequest().getSession().getId());
    this.roleMap = this.roleService.findForMap(true, true);
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys) ServiceException(com.netsteadfast.greenstep.base.exception.ServiceException) TbSysProg(com.netsteadfast.greenstep.po.hbm.TbSysProg)

Example 5 with TbSys

use of com.netsteadfast.greenstep.po.hbm.TbSys in project bamboobsc by billchen198318.

the class SysServiceImpl method findSysMap.

@Override
public Map<String, String> findSysMap(String basePath, boolean pleaseSelect) throws ServiceException, Exception {
    Map<String, String> sysMap = super.providedSelectZeroDataMap(pleaseSelect);
    List<TbSys> searchList = this.findListByParams(null);
    if (searchList == null || searchList.size() < 1) {
        return sysMap;
    }
    for (TbSys sys : searchList) {
        sysMap.put(sys.getOid(), IconUtils.getMenuIcon(basePath, sys.getIcon()) + sys.getName());
    }
    return sysMap;
}
Also used : TbSys(com.netsteadfast.greenstep.po.hbm.TbSys)

Aggregations

TbSys (com.netsteadfast.greenstep.po.hbm.TbSys)14 ServiceException (com.netsteadfast.greenstep.base.exception.ServiceException)11 JsonParseException (com.fasterxml.jackson.core.JsonParseException)6 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)6 ISysService (com.netsteadfast.greenstep.service.ISysService)6 SysVO (com.netsteadfast.greenstep.vo.SysVO)6 HashMap (java.util.HashMap)3 TbSysProg (com.netsteadfast.greenstep.po.hbm.TbSysProg)2 SysMenuVO (com.netsteadfast.greenstep.vo.SysMenuVO)2 LinkedList (java.util.LinkedList)2 MenuResultObj (com.netsteadfast.greenstep.model.MenuResultObj)1 TbSysIcon (com.netsteadfast.greenstep.po.hbm.TbSysIcon)1 SysProgVO (com.netsteadfast.greenstep.vo.SysProgVO)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Subject (org.apache.shiro.subject.Subject)1