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();
}
}
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;
}
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;
}
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);
}
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;
}
Aggregations