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 "";
|
}
|
}
|