ludc
2025-01-16 986aa62ed00bee39363bab41b4eeb8259d446efd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package com.vci.client.auth2.action;
 
import java.util.List;
 
import javax.swing.JOptionPane;
 
import com.vci.client.auth2.model.BooleanTableModel;
import com.vci.client.auth2.utils.RightManagerHelper;
import com.vci.client.common.providers.ServiceProvider;
import com.vci.corba.framework.data.GrandValue;
 
public class DelAction extends Action {
 
    /**
     * 
     */
    private static final long serialVersionUID = 8044665966084970545L;
 
    public DelAction(String name) {
        super(name);
    }
 
    @Override
    public void execute() {
        BooleanTableModel model = (BooleanTableModel) getFunclet().getRightMainPanel().getRuleTable().getModel();
        int row = getFunclet().getRightMainPanel().getRuleTable().getSelectedRow();
        if (row == -1) {
            JOptionPane.showMessageDialog(
                    com.vci.client.LogonApplication.frame,
                    "请选择要删除的规则信息", "提示", JOptionPane.INFORMATION_MESSAGE);
            return;
        }
        Object[] options = { "Yes", "No" };
        /*int option = JOptionPane
                .showOptionDialog(getInstance(), "确认是否删除业务类型\""
                        + btmName + "\"", "业务类型删除",
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, options,
                        options[1]);
//    int option = JOptionPane.showConfirmDialog(getInstance(), "是否确认删除", "删除确认", JOptionPane.YES_NO_CANCEL_OPTION);
        if(option != JOptionPane.YES_OPTION){
            return;
        }*/
        /*int comeOn = JOptionPane.showConfirmDialog(
                com.vci.rmip.logon.client.LogonApplication.frame, "是否要删除",
                "提示", JOptionPane.INFORMATION_MESSAGE);
        if (comeOn == 2) {
            return;
        }*/
        GrandValue value = ((List<GrandValue>) model.getConditionValueAt(row))
                .get(0);
        int option = JOptionPane
                .showOptionDialog(com.vci.client.LogonApplication.frame, "确认是否删除授权规则\""
                        + value.ruleName + "\"", "授权规则删除",
                        JOptionPane.YES_NO_OPTION,
                        JOptionPane.QUESTION_MESSAGE, null, options,
                        options[1]);
//    int option = JOptionPane.showConfirmDialog(getInstance(), "是否确认删除", "删除确认", JOptionPane.YES_NO_CANCEL_OPTION);
        if(option != JOptionPane.YES_OPTION){
            return;
        }
        // DataBase
        boolean isTrue = false;
        try {
            isTrue = ServiceProvider.getFrameService().deleteTypeRuleGrand(getType(value.identifier),
                    value.ruleName);
        } catch (Exception e) {
            JOptionPane.showMessageDialog(
                    com.vci.client.LogonApplication.frame,
                    e.getMessage(), "错误提示", JOptionPane.ERROR_MESSAGE);
            return;
        }
        if (isTrue) {
 
        }
        model.removeRow(row);
    }
    private String getType(String identifier){
        if(identifier!=null&&!identifier.equals("")){
            return identifier.substring(0, identifier.indexOf("_"));
        }
        return "";
    }
}