package com.vci.client.auth2.action; import java.util.List; import javax.swing.JOptionPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; import com.vci.client.auth2.utils.RightManagerHelper; import com.vci.client.common.providers.ServiceProvider; import com.vci.client.omd.btm.ui.BtmTree; import com.vci.client.omd.btm.ui.ResourceTree; import com.vci.client.omd.btm.wrapper.BtmItemWrapper; import com.vci.corba.framework.data.GrandValue; import com.vci.corba.common.VCIError; import com.vci.corba.omd.btm.BtmItem; public class SaveRuleAction extends Action { /** * */ private static final long serialVersionUID = 3971185753141477631L; public SaveRuleAction(String name) { super(name); } @Override public void execute() { // 获取资源类型树 BtmItem btm = RightManagerHelper.getResourceType(getFunclet()); if (btm == null) { JOptionPane.showMessageDialog( com.vci.client.LogonApplication.frame, "请选择业务类型", "提示", JOptionPane.INFORMATION_MESSAGE); return; } // 操作信息 List values = RightManagerHelper.fillOperationsInfo( getFunclet(), btm.name); // 主体信息 boolean isFill_subject = RightManagerHelper.fillSubjectInfo( getFunclet(), values); // 获取规则面板 boolean isFill_object = RightManagerHelper.fillObjectInfo(getFunclet(), values); if (!isFill_subject || !isFill_object) { return; } // delete // DataBase boolean isTrue = false; try { isTrue = ServiceProvider.getFrameService().deleteTypeRuleGrand( btm.name, values.get(0).ruleName); } catch (Exception e) { JOptionPane.showMessageDialog( com.vci.client.LogonApplication.frame, e.getMessage(), "错误提示", JOptionPane.ERROR_MESSAGE); return; } if (isTrue) { } // save boolean isTrue_add = false; try { isTrue_add = ServiceProvider.getFrameService().saveGrand( values.toArray(new GrandValue[values.size()])); } catch (Exception e) { JOptionPane.showMessageDialog( com.vci.client.LogonApplication.frame, ((VCIError) e).messages[0], "错误提示", JOptionPane.ERROR_MESSAGE); return; } if (isTrue_add) { JOptionPane.showMessageDialog( com.vci.client.LogonApplication.frame, "保存成功", "提示", JOptionPane.INFORMATION_MESSAGE); } getFunclet().enable(false); // 资源树 getFunclet().getResourceTree().setEnabled(true); refreshTable(); } private void refreshTable() { BtmTree resource = (BtmTree) getFunclet().getResourceTree(); TreePath path = resource.getSelectionPath(); if (path == null) { return; } DefaultMutableTreeNode node = (DefaultMutableTreeNode) path .getLastPathComponent(); if (!node.isRoot()) { BtmItemWrapper bizItem = (BtmItemWrapper) node .getUserObject(); // 重新刷新规则面板信息 GrandValue[] dataSets = RightManagerHelper .getRightDatas(bizItem.btmItem.name); // 设置规则Table //add by caill 2015.12.18 增加参数bizItem.btmItem.name RightManagerHelper.setRuleListDatas(getFunclet(), dataSets,bizItem.btmItem.name); // 刷新操作中的生命周期与链接 getFunclet().initLcOfOperationPanel(bizItem.btmItem); } else { RightManagerHelper.clear(getFunclet()); } //RightManagerHelper.clear(getFunclet()); // 资源树 getFunclet().getResourceTree().setEnabled(true); getFunclet().enable(false); getFunclet().getRightMainPanel().getSelectedSubjectComponent().setEnabled(false); getFunclet().getRightMainPanel().getOrdinaryOpPanel().setEnabled(false); getFunclet().getRightMainPanel().getRelationAndLifeCycleOpPanel().setEnabled(false); getFunclet().getRightMainPanel().getLeft().setEnabled(false); getFunclet().getRightMainPanel().getRight().setEnabled(false); } }