use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.
the class SystemProgramLogicServiceImpl method delete.
/**
* 刪除 TB_SYS_PROG 資料
*
* @param sysProg
* @return
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.DELETE })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<Boolean> delete(SysProgVO sysProg) throws ServiceException, Exception {
if (sysProg == null || StringUtils.isBlank(sysProg.getOid())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
DefaultResult<SysProgVO> sysProgResult = this.sysProgService.findObjectByOid(sysProg);
if (sysProgResult.getValue() == null) {
throw new ServiceException(sysProgResult.getSystemMessage().getValue());
}
sysProg = sysProgResult.getValue();
Map<String, Object> params = new HashMap<String, Object>();
params.put("progId", sysProg.getProgId());
if (this.sysMenuService.countByParams(params) > 0) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_CANNOT_DELETE));
}
// 刪除 TB_SYS_MENU_ROLE 資料
List<TbSysMenuRole> sysMenuRoleList = this.sysMenuRoleService.findListByParams(params);
for (int i = 0; sysMenuRoleList != null && i < sysMenuRoleList.size(); i++) {
TbSysMenuRole sysMenuRole = sysMenuRoleList.get(i);
this.sysMenuRoleService.delete(sysMenuRole);
}
// 刪除名稱語言資料 tb_sys_prog_multi_name
List<TbSysProgMultiName> progMultiNames = this.sysProgMultiNameService.findListByParams(params);
for (int i = 0; progMultiNames != null && i < progMultiNames.size(); i++) {
this.sysProgMultiNameService.delete(progMultiNames.get(i));
}
return this.sysProgService.deleteObject(sysProg);
}
use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.
the class SystemProgramLogicServiceImpl method createMultiName.
/**
* 產生 tb_sys_prog_multi_name 資料
*
* @param multiName
* @return
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.INSERT })
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = { RuntimeException.class, IOException.class, Exception.class })
@Override
public DefaultResult<SysProgMultiNameVO> createMultiName(SysProgMultiNameVO multiName) throws ServiceException, Exception {
if (null == multiName || super.isBlank(multiName.getProgId()) || super.isBlank(multiName.getName()) || super.isBlank(multiName.getLocaleCode())) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
if (LocaleLanguageUtils.getMap().get(multiName.getLocaleCode()) == null) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.DATA_ERRORS));
}
SysProgVO sysProg = new SysProgVO();
sysProg.setProgId(multiName.getProgId());
DefaultResult<SysProgVO> progResult = this.sysProgService.findByUK(sysProg);
if (progResult.getValue() == null) {
throw new ServiceException(progResult.getSystemMessage().getValue());
}
super.setStringValueMaxLength(multiName, "name", 100);
return this.sysProgMultiNameService.saveObject(multiName);
}
use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.
the class SystemMenuLogicServiceImpl method findForMenuSettingsEnableAndAll.
/**
* 找出選單設定功能要的
* 已在選單的程式 與 同SYS的程式
*
* map 中的 key
* enable - 已在選單的程式
* all - 同SYS的程式
*
* @param folderProgramOid
* @return
* @throws ServiceException
* @throws Exception
*/
@ServiceMethodAuthority(type = { ServiceMethodType.SELECT })
@Override
public Map<String, List<SysProgVO>> findForMenuSettingsEnableAndAll(String folderProgramOid) throws ServiceException, Exception {
if (StringUtils.isBlank(folderProgramOid)) {
throw new ServiceException(SysMessageUtil.get(GreenStepSysMsgConstants.PARAMS_BLANK));
}
SysProgVO sysProg = new SysProgVO();
sysProg.setOid(folderProgramOid);
DefaultResult<SysProgVO> spResult = this.sysProgService.findObjectByOid(sysProg);
if (spResult.getValue() == null) {
throw new ServiceException(spResult.getSystemMessage().getValue());
}
sysProg = spResult.getValue();
Map<String, List<SysProgVO>> dataMap = new HashMap<String, List<SysProgVO>>();
SysMenuVO sysMenu = new SysMenuVO();
List<SysProgVO> enableList = null;
List<SysProgVO> allList = null;
sysMenu.setProgId(sysProg.getProgId());
sysMenu.setParentOid(ZeroKeyProvide.OID_KEY);
DefaultResult<SysMenuVO> smResult = this.sysMenuService.findByUK(sysMenu);
if (smResult.getValue() != null) {
sysMenu = smResult.getValue();
enableList = this.sysProgService.findForInTheFolderMenuItems(sysProg.getProgSystem(), sysMenu.getOid(), MenuItemType.ITEM);
}
allList = this.sysProgService.findForSystemItems(sysProg.getProgSystem());
if (enableList == null) {
enableList = new ArrayList<SysProgVO>();
}
if (allList == null) {
allList = new ArrayList<SysProgVO>();
}
dataMap.put("enable", enableList);
dataMap.put("all", allList);
return dataMap;
}
use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.
the class CommonSelectItemsDataAction method queryItems.
private void queryItems() throws ServiceException, Exception {
boolean pleaseSelect = YesNo.YES.equals(this.getFields().get("pleaseSelect"));
if ("SYS".equals(this.getFields().get("type"))) {
// 取 sys
Map<String, String> sysMap = this.sysService.findSysMap(super.getBasePath(), pleaseSelect);
this.resetPleaseSelectDataMapFromLocaleLang(sysMap);
for (Map.Entry<String, String> entry : sysMap.entrySet()) {
Map<String, String> dataMap = new HashMap<String, String>();
dataMap.put("key", entry.getKey());
dataMap.put("value", entry.getValue());
this.items.add(dataMap);
}
this.success = IS_YES;
}
if ("SYS_PROG".equals(this.getFields().get("type"))) {
// 取 sys_prog ITEM_TYPE='FOLDER'
String sysOid = this.getFields().get("sysOid");
SysVO sys = this.loadSysValueObj(sysOid);
Map<String, String> sysProgMap = this.sysProgService.findSysProgFolderMap(super.getBasePath(), sys.getSysId(), MenuItemType.FOLDER, pleaseSelect);
this.resetPleaseSelectDataMapFromLocaleLang(sysProgMap);
for (Map.Entry<String, String> entry : sysProgMap.entrySet()) {
Map<String, String> dataMap = new HashMap<String, String>();
dataMap.put("key", entry.getKey());
dataMap.put("value", entry.getValue());
this.items.add(dataMap);
}
this.success = IS_YES;
}
if ("SYS_PROG_IN_MENU".equals(this.getFields().get("type"))) {
// 取 sys_prog.prog_id 存在 tb_sys_menu 的資料
String sysOid = this.getFields().get("sysOid");
SysVO sys = this.loadSysValueObj(sysOid);
List<SysProgVO> menuProgList = this.sysProgService.findForInTheFolderMenuItems(sys.getSysId(), null, null);
//this.items.add(super.providedSelectZeroDataMap(true));
Map<String, String> dataMapFirst = new HashMap<String, String>();
dataMapFirst.put("key", Constants.HTML_SELECT_NO_SELECT_ID);
dataMapFirst.put("value", Constants.HTML_SELECT_NO_SELECT_NAME);
this.resetPleaseSelectDataMapFromLocaleLang(dataMapFirst);
this.items.add(dataMapFirst);
if (menuProgList != null) {
for (SysProgVO sysProg : menuProgList) {
Map<String, String> dataMap = new HashMap<String, String>();
dataMap.put("key", sysProg.getOid());
dataMap.put("value", IconUtils.getMenuIcon(super.getBasePath(), sysProg.getIcon()) + StringEscapeUtils.escapeHtml4(sysProg.getName()));
this.items.add(dataMap);
}
}
this.success = IS_YES;
}
}
use of com.netsteadfast.greenstep.vo.SysProgVO in project bamboobsc by billchen198318.
the class SystemProgramManagementSaveOrUpdateAction method save.
/**
* 產生 TB_SYS_PROG 資料
*
* @throws ControllerException
* @throws AuthorityException
* @throws ServiceException
* @throws Exception
*/
private void save() throws ControllerException, AuthorityException, ServiceException, Exception {
this.checkFields("A");
SysProgVO sysProg = new SysProgVO();
this.transformFields2ValueObject(sysProg, new String[] { "progId", "name", "url", "itemType", "isWindow" }, new String[] { "CORE_PROG001D0002A_progId", "CORE_PROG001D0002A_name", "CORE_PROG001D0002A_url", "CORE_PROG001D0002A_itemType", "CORE_PROG001D0002A_isWindow" });
sysProg.setEditMode(YesNo.NO);
sysProg.setIsDialog(YesNo.NO);
if ("true".equals(this.getFields().get("CORE_PROG001D0002A_editMode"))) {
sysProg.setEditMode(YesNo.YES);
}
if ("true".equals(this.getFields().get("CORE_PROG001D0002A_isDialog"))) {
sysProg.setIsDialog(YesNo.YES);
sysProg.setDialogW(SimpleUtils.getInt(this.getFields().get("CORE_PROG001D0002A_dialogW"), 50));
sysProg.setDialogH(SimpleUtils.getInt(this.getFields().get("CORE_PROG001D0002A_dialogH"), 25));
}
DefaultResult<SysProgVO> result = this.systemProgramLogicService.create(sysProg, this.getFields().get("CORE_PROG001D0002A_progSystem"), this.getFields().get("CORE_PROG001D0002A_icon"));
this.message = result.getSystemMessage().getValue();
if (result.getValue() == null) {
return;
}
this.success = IS_YES;
}
Aggregations