public void load(DictManager dictManager) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } putDict(dict.getName(), dict, dictManager); }
public void load(DictManager dictManager) { List<TsysDictEntry> tsysDictEntryList = tsysDictEntryDao.query(null); if (tsysDictEntryList != null) { for (TsysDictEntry tDict : tsysDictEntryList) { Integer dictId = tDict.getId(); TsysDictItem tsysDictItem = new TsysDictItem(); tsysDictItem.setDictEntryId(dictId); //select * from t_dict_item where dict_id=? List<TsysDictItem> items = tsysDictItemDao.query(tsysDictItem); org.tinygroup.dict.Dict dict = new org.tinygroup.dict.Dict(); // dict.setName((String) bean.get(DICT_VALUE)); dict.setName(tDict.getDictEntryCode()); DictGroup group = new DictGroup(); if(items!=null){ for (TsysDictItem item : items) { org.tinygroup.dict.DictItem dictItem = new org.tinygroup.dict.DictItem(); // dictItem.setText((String) item.get(DICT_ITEM_NAME)); // dictItem.setValue((String) item.get(DICT_ITEM_VALUE)); dictItem.setText(item.getDictItemName()); dictItem.setValue(item.getDictItemCode()); group.addDictItem(dictItem); } } dict.addDictGroup(group); putDict(dict.getName(), dict, dictManager); } } }
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { DictManager dictManager = SpringUtil.getBean("dictManager"); String dictType = node.jjtGetChild(0).value(context).toString(); String dictGroupName = node.jjtGetChild(1).value(context).toString(); String dictItemValue = node.jjtGetChild(2).value(context).toString(); VelocityContext velocityContext = (VelocityContext) context .getInternalUserContext(); TinyVelocityContext tinyVelocityContext = (TinyVelocityContext) velocityContext .getChainedContext(); Context webContext = tinyVelocityContext.getContext(); Dict dict = dictManager.getDict(dictType, webContext); for (DictGroup dictGroup : dict.getDictGroupList()) { if (dictGroup.getName().equals(dictGroupName) && dictGroup.getItemList() != null) { for (DictItem item : dictGroup.getItemList()) { if (item.getValue().equals(dictItemValue)) { writer.write(item.getText()); return true; } } } } return false; }
public void load(DictManager dictManager) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } putDict(dict.getName(), dict, dictManager); }
public boolean render(InternalContextAdapter context, Writer writer, Node node) throws IOException { DictManager dictManager = SpringUtil.getBean("dictManager"); String dictType = node.jjtGetChild(0).value(context).toString(); String dictGroupName = node.jjtGetChild(1).value(context).toString(); String dictItemValue = node.jjtGetChild(2).value(context).toString(); VelocityContext velocityContext = (VelocityContext) context .getInternalUserContext(); TinyVelocityContext tinyVelocityContext = (TinyVelocityContext) velocityContext .getChainedContext(); Context webContext = tinyVelocityContext.getContext(); Dict dict = dictManager.getDict(dictType, webContext); for (DictGroup dictGroup : dict.getDictGroupList()) { if (dictGroup.getName().equals(dictGroupName) && dictGroup.getItemList() != null) { for (DictItem item : dictGroup.getItemList()) { if (item.getValue().equals(dictItemValue)) { writer.write(item.getText()); return true; } } } } return false; }
@ServiceMethod(serviceId = "loadDictFromDatabase") @ServiceResult(name = "dictResult") public Dict getDict(String beanType, String sql, String valueFieldName, String textFieldName) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } return dict; }
@ServiceMethod(serviceId = "loadDictFromDatabase") @ServiceResult(name = "dictResult") public Dict getDict(String beanType, String sql, String valueFieldName, String textFieldName) { BeanOperatorManager manager = SpringUtil .getBean(BeanOperatorManager.OPERATOR_MANAGER_BEAN); DBOperator<?> itemOperator = manager.getDbOperator(beanType); Dict dict = new Dict(beanType, beanType); Bean[] dictItemBeans = itemOperator.getBeans(sql); DictGroup dictGroup = new DictGroup("defaultGroupName", "defaultGroupName"); dict.addDictGroup(dictGroup); for (Bean bean : dictItemBeans) { String value = bean.getProperty(valueFieldName); String text = bean.getProperty(textFieldName); DictItem dictItem = new DictItem(value, text); dictGroup.addDictItem(dictItem); } return dict; }
String dictCode = bean.getProperty(DICT_CODE); String description = bean.getProperty(DICT_DESCRIPTION); Dict dict = new Dict(dictCode, description); Bean[] groupItemBeans = itemOperator .getBeans( itemParamBean.setProperty(DICT_ID, dictId); if (StringUtil.isBlank(dictItemGroup)) { dictGroup = new DictGroup(DEFAULT_GROUP_NAME, DEFAULT_GROUP_NAME); } else { dictGroup = new DictGroup(dictItemGroup, dictItemGroup); itemParamBean.setProperty(DICT_ITEM_GROUP, dictItemGroup); String dictItemValue = itemBean .getProperty(DICT_ITEM_VALUE); DictItem dictItem = new DictItem(dictItemValue, dictItemCode); dictGroup.addDictItem(dictItem); dict.addDictGroup(dictGroup); putDict(dict.getName(), dict, dictManager);
String dictCode = bean.getProperty(DICT_CODE); String description = bean.getProperty(DICT_DESCRIPTION); Dict dict = new Dict(dictCode, description); Bean[] groupItemBeans = itemOperator .getBeans( itemParamBean.setProperty(DICT_ID, dictId); if (StringUtil.isBlank(dictItemGroup)) { dictGroup = new DictGroup(DEFAULT_GROUP_NAME, DEFAULT_GROUP_NAME); } else { dictGroup = new DictGroup(dictItemGroup, dictItemGroup); itemParamBean.setProperty(DICT_ITEM_GROUP, dictItemGroup); String dictItemValue = itemBean .getProperty(DICT_ITEM_VALUE); DictItem dictItem = new DictItem(dictItemValue, dictItemCode); dictGroup.addDictItem(dictItem); dict.addDictGroup(dictGroup); putDict(dict.getName(), dict, dictManager);