package com.vci.client.omd.btm.ui;
|
|
import java.awt.BorderLayout;
|
import java.awt.Dimension;
|
import java.awt.FlowLayout;
|
import java.awt.Insets;
|
import java.awt.Toolkit;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseEvent;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.Hashtable;
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Map.Entry;
|
import java.util.regex.Matcher;
|
import java.util.regex.Pattern;
|
|
import javax.swing.JButton;
|
import javax.swing.JDialog;
|
import javax.swing.JLabel;
|
import javax.swing.JPanel;
|
import javax.swing.JScrollPane;
|
import javax.swing.JSplitPane;
|
import javax.swing.JTable;
|
import javax.swing.JTextArea;
|
import javax.swing.JTextField;
|
import javax.swing.JTree;
|
import javax.swing.border.EmptyBorder;
|
import javax.swing.tree.DefaultMutableTreeNode;
|
import javax.swing.tree.DefaultTreeModel;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.bof.ClientBusinessObject;
|
import com.vci.client.bof.ClientBusinessObjectOperation;
|
import com.vci.client.common.oq.OQTool;
|
import com.vci.client.common.providers.ServiceProvider;
|
import com.vci.client.omd.provider.BtmProvider;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
import com.vci.client.ui.table.VCIBaseTableModel;
|
import com.vci.client.ui.table.VCIBaseTableNode;
|
import com.vci.client.ui.tree.VCIBaseTreeModel;
|
import com.vci.client.ui.tree.VCIBaseTreeNode;
|
import com.vci.common.qt.object.Condition;
|
import com.vci.common.qt.object.QueryTemplate;
|
import com.vci.omd.utils.ObjectTool;
|
import com.vci.corba.omd.atm.AttribItem;
|
import com.vci.corba.omd.data.BusinessObject;
|
import com.vci.corba.omd.tim.TypeIndexDef;
|
import com.vci.corba.omd.tim.TypeIndexServicePrx;
|
import com.vci.corba.common.VCIError;
|
|
import java.awt.GridBagLayout;
|
import java.awt.GridBagConstraints;
|
|
@SuppressWarnings("serial")
|
public class SetIndexDialog extends JDialog {
|
|
private final JPanel contentPanel = new JPanel();
|
private JTextField textIndexName;
|
private JButton addIndexBtn;
|
private JButton delIndexBtn;
|
private JButton cancelButton;
|
|
private JScrollPane scrollPane;
|
private JTable indexTable;
|
private VCIBaseTableModel indexTableModel;
|
private int tableIndex = 0;
|
String[] columnHeaders = new String[] { "业务类型名称", "索引名称", "属性名称","描述"};
|
Class types[] = new Class[] { String.class, String.class, String.class, String.class};
|
private JButton okButton;
|
private JSplitPane splitPane;
|
private JPanel panel_1;
|
private JTree tree;
|
private Object selectTreeNodeobject;
|
/**
|
* 业务类型名称
|
*/
|
private String btName = "";
|
/**
|
* 索引名称
|
*/
|
private String indexName = "";
|
private JLabel label;
|
private JScrollPane scrollPane_1;
|
private JTextArea descText;
|
private JPanel panel_2;
|
private JButton btmDel;
|
|
/**
|
* 设置索引功能页面
|
*/
|
public SetIndexDialog(Object selectTreeNodeobject,String btName) {
|
super(LogonApplication.frame,true);
|
this.selectTreeNodeobject = selectTreeNodeobject;
|
this.btName = btName;
|
initContent();
|
initData();
|
initActionListener();
|
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
// this.setLocationRelativeTo(null);
|
this.setSize(800, 600);
|
this.setLocationRelativeTo(null);
|
this.setVisible(true);
|
}
|
private void display() {
|
Insets screenInsets = Toolkit.getDefaultToolkit().getScreenInsets(
|
LogonApplication.frame.getGraphicsConfiguration());
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
//this.setLocation(0, 0);
|
// dialog.setResizable(false);
|
this.setSize(800, 600);
|
}
|
private void initContent() {
|
this.setTitle("索引信息窗口 : " + this.btName);
|
setBounds(100, 100, 761, 627);
|
getContentPane().setLayout(new BorderLayout());
|
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
contentPanel.setLayout(new BorderLayout(0, 0));
|
|
splitPane = new JSplitPane();
|
|
contentPanel.add(splitPane, BorderLayout.CENTER);
|
{
|
panel_1 = new JPanel();
|
splitPane.setRightComponent(panel_1);
|
panel_1.setLayout(new BorderLayout(0, 0));
|
{
|
JPanel infoPanel = new JPanel();
|
panel_1.add(infoPanel, BorderLayout.NORTH);
|
GridBagLayout gbl_infoPanel = new GridBagLayout();
|
gbl_infoPanel.columnWidths = new int[]{100, 400, 0};
|
gbl_infoPanel.rowHeights = new int[]{26, 80, 0};
|
gbl_infoPanel.columnWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
|
gbl_infoPanel.rowWeights = new double[]{0.0, 0.0, Double.MIN_VALUE};
|
infoPanel.setLayout(gbl_infoPanel);
|
{
|
JLabel lblIndexName = new JLabel("索引名称");
|
GridBagConstraints gbc_lblIndexName = new GridBagConstraints();
|
gbc_lblIndexName.anchor = GridBagConstraints.EAST;
|
gbc_lblIndexName.fill = GridBagConstraints.VERTICAL;
|
gbc_lblIndexName.insets = new Insets(0, 0, 5, 5);
|
gbc_lblIndexName.gridx = 0;
|
gbc_lblIndexName.gridy = 0;
|
infoPanel.add(lblIndexName, gbc_lblIndexName);
|
}
|
{
|
textIndexName = new JTextField();
|
GridBagConstraints gbc_textIndexName = new GridBagConstraints();
|
gbc_textIndexName.fill = GridBagConstraints.BOTH;
|
gbc_textIndexName.insets = new Insets(0, 0, 5, 0);
|
gbc_textIndexName.gridx = 1;
|
gbc_textIndexName.gridy = 0;
|
infoPanel.add(textIndexName, gbc_textIndexName);
|
textIndexName.setColumns(10);
|
}
|
{
|
label = new JLabel("描述");
|
GridBagConstraints gbc_label = new GridBagConstraints();
|
gbc_label.anchor = GridBagConstraints.EAST;
|
gbc_label.fill = GridBagConstraints.VERTICAL;
|
gbc_label.insets = new Insets(0, 0, 0, 5);
|
gbc_label.gridx = 0;
|
gbc_label.gridy = 1;
|
infoPanel.add(label, gbc_label);
|
}
|
{
|
scrollPane_1 = new JScrollPane();
|
GridBagConstraints gbc_scrollPane_1 = new GridBagConstraints();
|
gbc_scrollPane_1.fill = GridBagConstraints.BOTH;
|
gbc_scrollPane_1.gridx = 1;
|
gbc_scrollPane_1.gridy = 1;
|
infoPanel.add(scrollPane_1, gbc_scrollPane_1);
|
{
|
descText = new JTextArea("",0,50);
|
scrollPane_1.setViewportView(descText);
|
}
|
}
|
}
|
JPanel panel = new JPanel();
|
panel_1.add(panel, BorderLayout.CENTER);
|
panel.setLayout(new BorderLayout(0, 0));
|
{
|
JPanel contrlPanel = new JPanel();
|
panel.add(contrlPanel, BorderLayout.NORTH);
|
{
|
addIndexBtn = new JButton("增加");
|
contrlPanel.add(addIndexBtn);
|
}
|
{
|
delIndexBtn = new JButton("删除");
|
contrlPanel.add(delIndexBtn);
|
}
|
}
|
JPanel indexTablePanel = new JPanel();
|
panel.add(indexTablePanel, BorderLayout.CENTER);
|
indexTablePanel.setLayout(new BorderLayout(0, 0));
|
scrollPane = new JScrollPane();
|
indexTablePanel.add(scrollPane, BorderLayout.CENTER);
|
indexTable = new JTable();
|
indexTable.setPreferredScrollableViewportSize(new Dimension(200, 30));
|
|
indexTableModel = new VCIBaseTableModel(columnHeaders, types);
|
indexTable.setModel(indexTableModel);
|
scrollPane.setViewportView(indexTable);
|
}
|
{
|
tree = new JTree();
|
try {
|
tree.setModel(createTreeModel());
|
} catch (VCIError e) {
|
e.printStackTrace();
|
}
|
splitPane.setLeftComponent(tree);
|
}
|
splitPane.setDividerLocation(200);
|
|
{
|
panel_2 = new JPanel();
|
FlowLayout flowLayout = (FlowLayout) panel_2.getLayout();
|
flowLayout.setAlignment(FlowLayout.LEFT);
|
contentPanel.add(panel_2, BorderLayout.NORTH);
|
{
|
btmDel = new JButton("删除索引");
|
panel_2.add(btmDel);
|
}
|
}
|
{
|
JPanel buttonPane = new JPanel();
|
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
{
|
okButton = new JButton("保存");
|
buttonPane.add(okButton);
|
}
|
{
|
cancelButton = new JButton("关闭");
|
buttonPane.add(cancelButton);
|
}
|
}
|
}
|
|
private DefaultTreeModel createTreeModel() throws VCIError {
|
//List<BusinessObject> bo2 = getBos(btName);
|
TypeIndexServicePrx prx = ServiceProvider.getOMDService().getTypeIndexService();
|
TypeIndexDef[] defs = prx.getBTIndexDefs(btName);
|
|
VCIBaseTreeNode rootNode = new VCIBaseTreeNode(this.btName + " 索引信息","root");
|
VCIBaseTreeModel treeModel = new VCIBaseTreeModel(rootNode);
|
List<String> indexNameList = new ArrayList<String>();
|
|
for (TypeIndexDef def : defs) {
|
if(!indexNameList.contains(def.name)){
|
indexNameList.add(def.name);
|
VCIBaseTreeNode node = new VCIBaseTreeNode(def.name, def);
|
treeModel.insertNodeInto(node, rootNode, rootNode.getChildCount());
|
}
|
}
|
// for(int i=0;i<bo2.size();i++){
|
// BusinessObject businessObject = bo2.get(i);
|
// if(!indexNameList.contains(ObjectTool.getBOAttributeValue(businessObject, "indexname"))){
|
// indexNameList.add(ObjectTool.getBOAttributeValue(businessObject, "indexname"));
|
// VCIBaseTreeNode node = new VCIBaseTreeNode(ObjectTool.getBOAttributeValue(businessObject, "indexname"),businessObject);
|
// treeModel.insertNodeInto(node, rootNode, rootNode.getChildCount());
|
// }
|
// }
|
return new DefaultTreeModel(rootNode);
|
}
|
|
private void initActionListener() {
|
btmDel.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
// ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
// ClientBusinessObject bo;
|
try {
|
//List<String> bo2 = getBo(indexName);
|
List<String> bo2 = new ArrayList<String>();
|
if(bo2!=null && bo2.size()>0){
|
String[] indexAttr = {indexName};
|
// boolean alterFlag = BtmProvider.getInstance().dropIndex(btName,indexAttr);
|
// //String dropIndex = BtmProvider.getInstance().getDropIndex(btName,indexAttr);
|
// //boolean alterFlag = DDLToolClient.getService().executeUpdateOracle(dropIndex);
|
// if(!alterFlag){
|
// VCIOptionPane.showMessage(LogonApplication.frame, "删除索引失败");
|
// return;
|
// }else{
|
// VCIOptionPane.showMessage(LogonApplication.frame, "删除索引成功");
|
// }
|
for(int i = 0; i < bo2.size(); i ++){
|
String oid = bo2.get(i);
|
ServiceProvider.getOMDService().getTypeIndexService().delIndexDef(oid);
|
// bo = cboo.readBusinessObjectById(oid ,"indexobject");
|
// cboo.deleteBuinessObject(bo);
|
}
|
VCIOptionPane.showMessage(LogonApplication.frame, "删除索引成功");
|
}
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
VCIOptionPane.showMessage(LogonApplication.frame, "删除索引成功");
|
return;
|
}
|
try {
|
tree.setModel(createTreeModel());
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
}
|
tree.updateUI();
|
}
|
});
|
tree.addMouseListener(new MouseAdapter() {
|
@Override
|
public void mouseClicked(MouseEvent e) {
|
super.mouseClicked(e);
|
DefaultMutableTreeNode seletionNode = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
|
Object userObject = seletionNode.getUserObject();
|
if(userObject instanceof String){
|
if(String.valueOf(seletionNode.getUserObject()).equals("root")){
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择索引节点");
|
return;
|
}else{
|
indexName = String.valueOf(seletionNode.getUserObject());
|
}
|
}
|
initData();
|
setTextEditable();
|
}
|
});
|
okButton.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
String textIndex = textIndexName.getText();
|
int rowCount = indexTable.getRowCount();
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject bo;
|
List<ClientBusinessObject> boList = new ArrayList<ClientBusinessObject>();
|
StringBuffer sb = new StringBuffer();
|
if(rowCount>0){
|
try {
|
List<String> bo2 = getBo(textIndex);
|
String[] oldindexAttr = {textIndex};
|
|
BtmProvider.getInstance().dropIndex(btName,oldindexAttr);
|
|
// String dropIndex = BtmProvider.getInstance().getDropIndex(btName,oldindexAttr);
|
// DDLToolClient.getService().executeUpdateOracle(dropIndex);
|
if(bo2!=null && bo2.size()>0){
|
for(int i = 0; i < bo2.size(); i ++){
|
String oid = bo2.get(i);
|
bo = cboo.readBusinessObjectById(oid ,"indexobject");
|
cboo.deleteBuinessObject(bo);
|
}
|
}
|
|
for(int i = 0; i < rowCount; i ++){
|
bo = cboo.createBusinessObject("indexobject");
|
bo.setAttributeValue("typename", btName);
|
bo.setAttributeValue("indexname", textIndex);
|
String attrName = indexTable.getValueAt(i, 2).toString();
|
bo.setAttributeValue("attrname", attrName);
|
String description = indexTable.getValueAt(i, 3).toString();
|
bo.setDescription(description);
|
sb.append(attrName);
|
if(i<rowCount-1){
|
sb.append(",");
|
}
|
boList.add(bo);
|
}
|
String[] indexAttr = {textIndex,sb.toString()};
|
|
boolean alterFlag = BtmProvider.getInstance().addIndex(btName, indexAttr);
|
// String createIndexSql = BtmProvider.getInstance().getAddIndex(btName, indexAttr );
|
// boolean alterFlag = DDLToolClient.getService().executeUpdateOracle(createIndexSql);
|
if(!alterFlag){
|
VCIOptionPane.showMessage(LogonApplication.frame, "创建索引失败");
|
return;
|
}else{
|
VCIOptionPane.showMessage(LogonApplication.frame, "创建索引成功");
|
}
|
cboo.batchSaveCreateBuinessObject(boList.toArray(new ClientBusinessObject[boList.size()]));
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
VCIOptionPane.showMessage(LogonApplication.frame, "创建索引失败");
|
return;
|
}
|
|
}else{
|
try {
|
List<String> bo2 = getBo(textIndex);
|
if(bo2!=null && bo2.size()>0){
|
String[] indexAttr = {textIndex};
|
|
boolean alterFlag = BtmProvider.getInstance().dropIndex(btName,indexAttr);
|
|
// String dropIndex = BtmProvider.getInstance().getDropIndex(btName,indexAttr);
|
// boolean alterFlag = DDLToolClient.getService().executeUpdateOracle(dropIndex);
|
if(!alterFlag){
|
VCIOptionPane.showMessage(LogonApplication.frame, "删除索引失败");
|
return;
|
}else{
|
VCIOptionPane.showMessage(LogonApplication.frame, "删除索引成功");
|
}
|
for(int i = 0; i < bo2.size(); i ++){
|
String oid = bo2.get(i);
|
bo = cboo.readBusinessObjectById(oid ,"indexobject");
|
cboo.deleteBuinessObject(bo);
|
}
|
}
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
VCIOptionPane.showMessage(LogonApplication.frame, "删除索引成功");
|
return;
|
}
|
|
}
|
try {
|
tree.setModel(createTreeModel());
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
}
|
tree.updateUI();
|
}
|
});
|
cancelButton.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
dispose();
|
}
|
});
|
addIndexBtn.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
String textIndex = textIndexName.getText();
|
if(textIndex.isEmpty()){
|
VCIOptionPane.showMessage(LogonApplication.frame, "请填写索引名称!");
|
return;
|
}
|
// Pattern pt = Pattern.compile("^(_\\w)+([^0-9])$");
|
Pattern pt = Pattern.compile("[a-z][_a-z0-9]*");
|
Matcher matcher = pt.matcher(textIndex);
|
if(!matcher.find()){
|
VCIOptionPane.showMessage(LogonApplication.frame, "索引名称格式不对,请填写以小写字母开头的字符串!");
|
return;
|
}
|
if(textIndex.length()>30){
|
VCIOptionPane.showMessage(LogonApplication.frame, "索引名称长度不能超过30!");
|
return;
|
}
|
AttrTreeDialog atdia = new AttrTreeDialog(btName, selectTreeNodeobject);
|
|
AttribItem[] attrItems = atdia.getSelectAttribItems();
|
if(attrItems != null && attrItems.length > 0){
|
VCIBaseTableNode vciBaseTableNode = new VCIBaseTableNode(new String());
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(0), btName);
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(1), textIndexName.getText());
|
|
String attrs = null;
|
for (AttribItem ai : attrItems) {
|
if (attrs == null)
|
attrs = ai.name;
|
else
|
attrs += "," + ai.name;
|
}
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(2), attrs);
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(3), descText.getText());
|
indexTableModel.addRow(tableIndex++, vciBaseTableNode);
|
indexTable.setModel(indexTableModel);
|
indexTable.updateUI();
|
setTextEditable();
|
}
|
}
|
|
});
|
delIndexBtn.addActionListener(new ActionListener() {
|
|
@Override
|
public void actionPerformed(ActionEvent e) {
|
int selectedRow = indexTable.getSelectedRow();
|
int rowCount = indexTable.getRowCount();
|
if(rowCount==0){
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择数据");
|
return;
|
}
|
if(selectedRow==-1){
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择数据");
|
return;
|
}
|
indexTableModel.removeRow(selectedRow);
|
indexTable.setModel(indexTableModel);
|
indexTable.updateUI();
|
setTextEditable();
|
}
|
});
|
indexTable.addMouseListener(new MouseAdapter() {
|
@Override
|
public void mouseClicked(MouseEvent e) {
|
super.mouseClicked(e);
|
int selectedRow = indexTable.getSelectedRow();
|
VCIBaseTableNode valueAt = indexTableModel.getValueAt(selectedRow);
|
Hashtable<String, Object> htTable = valueAt.htTable;
|
for(Entry<String, Object> entry:htTable.entrySet()){
|
String key = entry.getKey();
|
String value = (String) entry.getValue();
|
if(key.equals(columnHeaders[1])){
|
textIndexName.setText(value);
|
}
|
if(key.equals(columnHeaders[3])){
|
descText.setText(value);
|
}
|
}
|
setTextEditable();
|
}
|
});
|
}
|
private void setTextEditable() {
|
int rowCount = indexTable.getRowCount();
|
if(rowCount>0){
|
textIndexName.setEditable(false);
|
}else{
|
textIndexName.setEditable(true);
|
}
|
}
|
private List<String> getBo(String indexName) throws VCIError{
|
List<String> indexNameList = new ArrayList<String>();
|
QueryTemplate qtl = new QueryTemplate();
|
List<String> list = new ArrayList<String>();
|
list.add("*");
|
qtl.setBtmType("indexobject");
|
qtl.setClauseList(list);
|
qtl.setId("p");
|
qtl.setType("btm");
|
qtl.setRightFlag(false);
|
Map<String, String> map = new HashMap<String, String>();
|
map.put("indexname", indexName);
|
Condition condition = OQTool.getCondition(map);
|
qtl.setCondition(condition);
|
HashMap<String, String> indexmap = new HashMap<String, String>();
|
BusinessObject findBTMObjects[] = ServiceProvider.getOQService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML());
|
for(int i = 0; i < findBTMObjects.length; i++)
|
{
|
String oid = findBTMObjects[i].oid;
|
indexNameList.add(oid);
|
}
|
return indexNameList;
|
}
|
|
private List<BusinessObject> getIndexBos(String indexName) throws VCIError{
|
List<BusinessObject> indexNameList = new ArrayList<BusinessObject>();
|
QueryTemplate qtl = new QueryTemplate();
|
List list = new ArrayList();
|
list.add("*");
|
qtl.setBtmType("indexobject");
|
qtl.setClauseList(list);
|
qtl.setId("p");
|
qtl.setType("btm");
|
qtl.setRightFlag(false);
|
Map map = new HashMap();
|
map.put("indexname", indexName);
|
Condition condition = OQTool.getCondition(map);
|
qtl.setCondition(condition);
|
HashMap indexmap = new HashMap();
|
BusinessObject findBTMObjects[] = ServiceProvider.getOQService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML());
|
for(int i = 0; i < findBTMObjects.length; i++)
|
{
|
indexNameList.add(findBTMObjects[i]);
|
}
|
return indexNameList;
|
}
|
|
// private List<BusinessObject> getBos(String typeName) throws VCIError{
|
// List<BusinessObject> boList = new ArrayList<BusinessObject>();
|
// QueryTemplate qtl = new QueryTemplate();
|
// List list = new ArrayList();
|
// list.add("*");
|
// qtl.setBtmType("indexobject");
|
// qtl.setClauseList(list);
|
// qtl.setId("p");
|
// qtl.setType("btm");
|
// qtl.setRightFlag(false);
|
// Map map = new HashMap();
|
// map.put("typename", typeName);
|
// Condition condition = OQTool.getCondition(map);
|
// qtl.setCondition(condition);
|
// HashMap indexmap = new HashMap();
|
// BusinessObject findBTMObjects[] = ServiceProvider.getOQService().findBTMObjects(qtl.getId(), OQTool.qtTOXMl(qtl).asXML());
|
// for(int i = 0; i < findBTMObjects.length; i++)
|
// {
|
// boList.add(findBTMObjects[i]);
|
// }
|
// return boList;
|
// }
|
|
|
private TypeIndexDef[] getTypeIndexs(String typeName) throws VCIError{
|
TypeIndexServicePrx prx = ServiceProvider.getOMDService().getTypeIndexService();
|
return prx.getBTIndexDefs(typeName);
|
}
|
|
|
private void initData(){
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject bo;
|
try {
|
if(indexName!=null&&!"".equals(indexName)){
|
List<BusinessObject> bo2 = getIndexBos(indexName);
|
for(int i = indexTable.getRowCount()-1; i >= 0; i --){
|
indexTableModel.removeRow(i);
|
}
|
if(bo2!=null && bo2.size() > 0){
|
for(int i=0;i<bo2.size();i++){
|
BusinessObject businessObject = bo2.get(i);
|
VCIBaseTableNode vciBaseTableNode = new VCIBaseTableNode(new String());
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(0), ObjectTool.getBOAttributeValue(businessObject, "typename"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(1), ObjectTool.getBOAttributeValue(businessObject, "indexname"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(2), ObjectTool.getBOAttributeValue(businessObject, "attrname"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(3), businessObject.description);
|
indexTableModel.addRow(tableIndex++, vciBaseTableNode);
|
}
|
textIndexName.setText(indexName);
|
}else{
|
textIndexName.setText("");
|
}
|
}else{
|
textIndexName.setText("");
|
}
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
}
|
indexTable.setModel(indexTableModel);
|
indexTable.updateUI();
|
}
|
|
private void initDataNew(){
|
try {
|
if(indexName!=null && !"".equals(indexName)){
|
List<BusinessObject> bo2 = getIndexBos(indexName);
|
for(int i = indexTable.getRowCount()-1; i >= 0; i --){
|
indexTableModel.removeRow(i);
|
}
|
if(bo2!=null && bo2.size() > 0){
|
for(int i=0;i<bo2.size();i++){
|
BusinessObject businessObject = bo2.get(i);
|
VCIBaseTableNode vciBaseTableNode = new VCIBaseTableNode(new String());
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(0), ObjectTool.getBOAttributeValue(businessObject, "typename"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(1), ObjectTool.getBOAttributeValue(businessObject, "indexname"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(2), ObjectTool.getBOAttributeValue(businessObject, "attrname"));
|
vciBaseTableNode.setPropertyValueByName(indexTable.getColumnName(3), businessObject.description);
|
indexTableModel.addRow(tableIndex++, vciBaseTableNode);
|
}
|
textIndexName.setText(indexName);
|
}else{
|
textIndexName.setText("");
|
}
|
}else{
|
textIndexName.setText("");
|
}
|
} catch (VCIError e1) {
|
e1.printStackTrace();
|
}
|
indexTable.setModel(indexTableModel);
|
indexTable.updateUI();
|
}
|
}
|