/** * @param request * @param tableCategoryId * @paqram includeAction if true, will load webactions also * @return elements are Table or WebAction */ public List getChildrenOfTableCategory( HttpServletRequest request, int tableCategoryId, boolean includeAction) { TableManager manager = TableManager.getInstance(); WebAction action; ArrayList cats = new ArrayList(); Connection conn = null; HashMap webActionEnv = null; Table table; UserWebImpl userWeb = ((UserWebImpl) WebUtils.getSessionContextManager(request.getSession()) .getActor(nds.util.WebKeys.USER)); TableCategory tc = manager.getTableCategory(tableCategoryId); List children = tc.children(); ArrayList catschild = new ArrayList(); try { if (includeAction) { conn = QueryEngine.getInstance().getConnection(); webActionEnv = new HashMap(); webActionEnv.put("connection", conn); webActionEnv.put("httpservletrequest", request); webActionEnv.put("userweb", userWeb); } for (int j = 0; j < children.size(); j++) { if (children.get(j) instanceof Table) { table = (Table) children.get(j); if (!table.isMenuObject()) { continue; } try { WebUtils.checkTableQueryPermission(table.getName(), request); } catch (NDSSecurityException e) { continue; } // table is ok for current user to list catschild.add(table); } else if (children.get(j) instanceof WebAction) { if (includeAction) { action = (WebAction) children.get(j); if (action.canDisplay(webActionEnv)) catschild.add(action); } } else { throw new NDSRuntimeException( "Unsupported element in TableCategory children:" + children.get(j).getClass()); } } } catch (Throwable t) { logger.error("Fail to load subsystem tree", t); } finally { try { if (conn != null) conn.close(); } catch (Throwable e) { } } return catschild; }
/** * MU_FAVORITE * * @throws Exception cyl * @param request * @return elements are Table or WebAction and menu list * @paqram includeAction if true?not now */ public List getSubSystemsOfmufavorite(HttpServletRequest request) throws Exception { ArrayList mufavorite = new ArrayList(); TableManager manager = TableManager.getInstance(); // Table table; try { UserWebImpl userWeb = ((UserWebImpl) WebUtils.getSessionContextManager(request.getSession()) .getActor(nds.util.WebKeys.USER)); int userid = userWeb.getUserId(); List al = QueryEngine.getInstance() .doQueryList( "select t.ad_table_id,t.fa_menu,t.menu_re,t.IS_REPORT from MU_FAVORITE t where t.ownerid=" + String.valueOf(userid) + " group by t.ad_table_id,t.menu_no,t.fa_menu,t.menu_re,t.IS_REPORT,t.creationdate order by t.menu_no,t.creationdate asc"); logger.debug("MU_FAVORITE size is " + String.valueOf(al.size())); if (al.size() > 0) { for (int i = 0; i < al.size(); i++) { // ArrayList catschild= new ArrayList(); List als = (List) al.get(i); String fa_menu = (String) als.get(1); String menu_re = (String) als.get(2); String isreport = (String) als.get(3); int table_id = Tools.getInt(als.get(0), -1); Table table = manager.getTable(table_id); logger.debug(table.getName()); /* if(!table.isMenuObject()){ continue; //because many table is webaction not ismenuobject }*/ try { WebUtils.checkTableQueryPermission(table.getName(), request); } catch (NDSSecurityException e) { continue; } logger.debug("add_table ->" + table.getName()); ArrayList row = new ArrayList(); row.add(fa_menu); row.add(menu_re); row.add(isreport); row.add(table); mufavorite.add(row); } } } catch (Throwable t) { logger.error("Fail to load mufavorite", t); } return mufavorite; }
public String[] getCleanSql() { if (cleanSql == null) { // loop over all foreign key constraints List dropForeignKeysSql = new ArrayList(); List createForeignKeysSql = new ArrayList(); Iterator iter = configuration.getTableMappings(); while (iter.hasNext()) { Table table = (Table) iter.next(); if (table.isPhysicalTable()) { Iterator subIter = table.getForeignKeyIterator(); while (subIter.hasNext()) { ForeignKey fk = (ForeignKey) subIter.next(); if (fk.isPhysicalConstraint()) { // collect the drop key constraint dropForeignKeysSql.add( fk.sqlDropString( dialect, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA))); createForeignKeysSql.add( fk.sqlCreateString( dialect, mapping, properties.getProperty(Environment.DEFAULT_CATALOG), properties.getProperty(Environment.DEFAULT_SCHEMA))); } } } } List deleteSql = new ArrayList(); iter = configuration.getTableMappings(); while (iter.hasNext()) { Table table = (Table) iter.next(); deleteSql.add("delete from " + table.getName()); } List cleanSqlList = new ArrayList(); cleanSqlList.addAll(dropForeignKeysSql); cleanSqlList.addAll(deleteSql); cleanSqlList.addAll(createForeignKeysSql); cleanSql = (String[]) cleanSqlList.toArray(new String[cleanSqlList.size()]); } return cleanSql; }
public billmotors() { initComponents(); FillList(); setLocationRelativeTo(null); CurrentDate(); Connection con = null; ResultSet rs = null; PreparedStatement pst = null; model = (DefaultTableModel) Table.getModel(); }
private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: String part = partno.getText(); String itemname = name.getText(); String qty1 = qty.getText(); String rate1 = rate.getText(); String no1 = no.getText(); String cname = custname.getText(); String bill1 = bill.getText(); String addr1 = addr.getText(); String ta = tax.getText(); String str1 = amount.getText(); DefaultTableModel model = (DefaultTableModel) Table.getModel(); model.addRow( new Object[] { (String.valueOf(++i)), partno.getText(), name.getText(), tax.getText(), qty.getText(), rate.getText(), amount.getText() }); pd = pd + "," + "(" + part + "," + itemname + "," + qty1 + ")"; tamount = tamount + Integer.parseInt(str1); try { Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/bharatmotors", "root", ""); Statement stmt2 = con.createStatement(); stmt2.executeUpdate( "UPDATE MOTORS SET QUANTITY=QUANTITY-'" + qty1 + "' WHERE ITEM_NAME='" + part + "'"); } catch (Exception e) { JOptionPane.showMessageDialog(null, e.toString()); } } // GEN-LAST:event_jButton1ActionPerformed
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { search = new javax.swing.JTextField(); jScrollPane2 = new javax.swing.JScrollPane(); List = new javax.swing.JList(); partno = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); qty = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); name = new javax.swing.JTextField(); rate = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); no = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); custname = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); bill = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); addr = new javax.swing.JTextArea(); jScrollPane3 = new javax.swing.JScrollPane(); Table = new javax.swing.JTable(); jLabel2 = new javax.swing.JLabel(); total = new javax.swing.JTextField(); chrg = new javax.swing.JTextField(); la = new javax.swing.JTextField(); con = new javax.swing.JTextField(); lcharge = new javax.swing.JTextField(); toamnt = new javax.swing.JTextField(); jLabel6 = new javax.swing.JLabel(); jLabel16 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel(); jLabel18 = new javax.swing.JLabel(); jLabel19 = new javax.swing.JLabel(); jScrollPane4 = new javax.swing.JScrollPane(); table1 = new javax.swing.JTable(); tax = new javax.swing.JTextField(); amount = new javax.swing.JTextField(); jButton3 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); cmd_print = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenu8 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenuItem2 = new javax.swing.JMenuItem(); jMenu9 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem5 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenu13 = new javax.swing.JMenu(); jMenuItem20 = new javax.swing.JMenuItem(); jMenuItem21 = new javax.swing.JMenuItem(); jMenu14 = new javax.swing.JMenu(); jMenuItem6 = new javax.swing.JMenuItem(); jMenuItem22 = new javax.swing.JMenuItem(); jMenuItem23 = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); jMenuItem9 = new javax.swing.JMenuItem(); jMenuItem13 = new javax.swing.JMenuItem(); jMenuItem14 = new javax.swing.JMenuItem(); jMenuItem15 = new javax.swing.JMenuItem(); jMenu4 = new javax.swing.JMenu(); jMenuItem10 = new javax.swing.JMenuItem(); jMenu12 = new javax.swing.JMenu(); jMenuItem11 = new javax.swing.JMenuItem(); jMenuItem12 = new javax.swing.JMenuItem(); jMenuItem16 = new javax.swing.JMenuItem(); jMenuItem17 = new javax.swing.JMenuItem(); jMenuItem18 = new javax.swing.JMenuItem(); jMenuItem19 = new javax.swing.JMenuItem(); jMenu15 = new javax.swing.JMenu(); jMenu11 = new javax.swing.JMenu(); jMenuItem7 = new javax.swing.JMenuItem(); jMenuItem8 = new javax.swing.JMenuItem(); jMenu5 = new javax.swing.JMenu(); jMenu7 = new javax.swing.JMenu(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null); search.addKeyListener( new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { searchKeyReleased(evt); } }); getContentPane().add(search); search.setBounds(10, 10, 130, 30); List.addListSelectionListener( new javax.swing.event.ListSelectionListener() { public void valueChanged(javax.swing.event.ListSelectionEvent evt) { ListValueChanged(evt); } }); jScrollPane2.setViewportView(List); getContentPane().add(jScrollPane2); jScrollPane2.setBounds(10, 40, 130, 80); partno.addKeyListener( new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { partnoKeyReleased(evt); } }); getContentPane().add(partno); partno.setBounds(254, 26, 170, 30); jLabel7.setText("Type"); getContentPane().add(jLabel7); jLabel7.setBounds(166, 26, 70, 30); jLabel11.setText("Qty"); getContentPane().add(jLabel11); jLabel11.setBounds(166, 79, 50, 20); qty.addKeyListener( new java.awt.event.KeyAdapter() { public void keyReleased(java.awt.event.KeyEvent evt) { qtyKeyReleased(evt); } }); getContentPane().add(qty); qty.setBounds(254, 74, 170, 30); jLabel9.setText("Item_Name"); getContentPane().add(jLabel9); jLabel9.setBounds(442, 31, 70, 20); jLabel12.setText("Rate"); getContentPane().add(jLabel12); jLabel12.setBounds(442, 79, 60, 20); getContentPane().add(name); name.setBounds(516, 26, 200, 30); getContentPane().add(rate); rate.setBounds(516, 74, 200, 30); jLabel14.setText("Tax"); getContentPane().add(jLabel14); jLabel14.setBounds(734, 34, 40, 14); jLabel13.setText("Amount"); getContentPane().add(jLabel13); jLabel13.setBounds(734, 79, 50, 20); jLabel10.setFont(new java.awt.Font("Imprint MT Shadow", 1, 18)); // NOI18N jLabel10.setForeground(new java.awt.Color(0, 0, 153)); jLabel10.setText("BHARATH MOTORS"); getContentPane().add(jLabel10); jLabel10.setBounds(380, 140, 220, 30); jLabel15.setText( "Bharath TVS, Opp.All Saints Church,Udayaperoor, Thripunithra, Pin: 682 307, Tin No: 32071035881 , Ph No: 9072111366/ 9072111355"); getContentPane().add(jLabel15); jLabel15.setBounds(150, 180, 700, 20); jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jLabel1.setText("BillNo"); getContentPane().add(jLabel1); jLabel1.setBounds(20, 260, 76, 20); no.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { noActionPerformed(evt); } }); getContentPane().add(no); no.setBounds(130, 260, 230, 30); jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jLabel4.setText("Customer Name"); getContentPane().add(jLabel4); jLabel4.setBounds(20, 310, 90, 30); getContentPane().add(custname); custname.setBounds(130, 310, 230, 30); jLabel8.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jLabel8.setText("BillDate"); getContentPane().add(jLabel8); jLabel8.setBounds(590, 260, 50, 20); jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jLabel5.setText("Address"); getContentPane().add(jLabel5); jLabel5.setBounds(590, 310, 70, 20); getContentPane().add(bill); bill.setBounds(690, 250, 260, 30); addr.setColumns(20); addr.setRows(5); jScrollPane1.setViewportView(addr); getContentPane().add(jScrollPane1); jScrollPane1.setBounds(690, 290, 260, 50); Table.setModel( new javax.swing.table.DefaultTableModel( new Object[][] {}, new String[] {"Sl.No", "Type", "Item_Name", "Tax%", "Qty", "Rate", "Amount"})); jScrollPane3.setViewportView(Table); getContentPane().add(jScrollPane3); jScrollPane3.setBounds(20, 350, 980, 130); jLabel2.setText("Spares"); getContentPane().add(jLabel2); jLabel2.setBounds(720, 490, 115, 20); getContentPane().add(total); total.setBounds(850, 480, 150, 30); getContentPane().add(chrg); chrg.setBounds(850, 510, 150, 30); getContentPane().add(la); la.setBounds(850, 540, 150, 30); getContentPane().add(con); con.setBounds(850, 570, 150, 30); getContentPane().add(lcharge); lcharge.setBounds(850, 600, 150, 30); getContentPane().add(toamnt); toamnt.setBounds(850, 630, 150, 30); jLabel6.setText("Washing_Chrg"); getContentPane().add(jLabel6); jLabel6.setBounds(720, 520, 100, 20); jLabel16.setText("Consumable"); getContentPane().add(jLabel16); jLabel16.setBounds(720, 550, 100, 20); jLabel17.setText("Laith"); getContentPane().add(jLabel17); jLabel17.setBounds(720, 580, 90, 20); jLabel18.setText("LabourCharge"); getContentPane().add(jLabel18); jLabel18.setBounds(720, 610, 80, 20); jLabel19.setText("TotalAmount"); getContentPane().add(jLabel19); jLabel19.setBounds(720, 640, 80, 20); table1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] {})); jScrollPane4.setViewportView(table1); getContentPane().add(jScrollPane4); jScrollPane4.setBounds(12, 140, 1000, 530); tax.setText("14.5"); tax.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { taxActionPerformed(evt); } }); getContentPane().add(tax); tax.setBounds(810, 30, 200, 30); getContentPane().add(amount); amount.setBounds(810, 80, 200, 30); jButton3.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jButton3.setText("SUBMIT"); jButton3.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); } }); getContentPane().add(jButton3); jButton3.setBounds(1040, 230, 120, 50); jButton1.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jButton1.setText("ADD"); jButton1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); getContentPane().add(jButton1); jButton1.setBounds(1040, 320, 120, 50); jButton4.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jButton4.setText("CALCULATE"); jButton4.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt); } }); getContentPane().add(jButton4); jButton4.setBounds(1040, 420, 120, 50); cmd_print.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N cmd_print.setText("PRINT"); cmd_print.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cmd_printActionPerformed(evt); } }); getContentPane().add(cmd_print); cmd_print.setBounds(1040, 510, 120, 50); jButton2.setFont(new java.awt.Font("Times New Roman", 0, 12)); // NOI18N jButton2.setText("BACK"); jButton2.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); } }); getContentPane().add(jButton2); jButton2.setBounds(1040, 590, 120, 50); jMenu1.setText("StockEntry"); jMenu1.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu1.setMaximumSize(new java.awt.Dimension(75, 32767)); jMenu8.setText("Motors"); jMenuItem1.setText("Bike"); jMenuItem1.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem1ActionPerformed(evt); } }); jMenu8.add(jMenuItem1); jMenuItem2.setText("Scooty"); jMenuItem2.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem2ActionPerformed(evt); } }); jMenu8.add(jMenuItem2); jMenu1.add(jMenu8); jMenu9.setText("Spare"); jMenuItem3.setText("Lubricants"); jMenuItem3.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem3ActionPerformed(evt); } }); jMenu9.add(jMenuItem3); jMenuItem4.setText("SpareParts"); jMenuItem4.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem4ActionPerformed(evt); } }); jMenu9.add(jMenuItem4); jMenuItem5.setText("Accessories"); jMenuItem5.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem5ActionPerformed(evt); } }); jMenu9.add(jMenuItem5); jMenu1.add(jMenu9); jMenuBar1.add(jMenu1); jMenu2.setText("Purchase"); jMenu2.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu2.setMaximumSize(new java.awt.Dimension(75, 32767)); jMenu2.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu2ActionPerformed(evt); } }); jMenu13.setText("Bill"); jMenuItem20.setText("Spare"); jMenuItem20.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem20ActionPerformed(evt); } }); jMenu13.add(jMenuItem20); jMenuItem21.setText("Motors"); jMenuItem21.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem21ActionPerformed(evt); } }); jMenu13.add(jMenuItem21); jMenu2.add(jMenu13); jMenuBar1.add(jMenu2); jMenu14.setText("Sale"); jMenu14.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu14.setMaximumSize(new java.awt.Dimension(65, 32767)); jMenuItem6.setText("Sale"); jMenuItem6.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem6ActionPerformed(evt); } }); jMenu14.add(jMenuItem6); jMenuItem22.setText("Service"); jMenuItem22.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem22ActionPerformed(evt); } }); jMenu14.add(jMenuItem22); jMenuItem23.setText("Certificate"); jMenuItem23.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem23ActionPerformed(evt); } }); jMenu14.add(jMenuItem23); jMenuBar1.add(jMenu14); jMenu3.setText("StockAvailable"); jMenu3.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu3.setMaximumSize(new java.awt.Dimension(115, 32767)); jMenu3.addMenuListener( new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) {} public void menuDeselected(javax.swing.event.MenuEvent evt) {} public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu3MenuSelected(evt); } }); jMenu3.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu3ActionPerformed(evt); } }); jMenuItem9.setText("Motors"); jMenuItem9.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem9ActionPerformed(evt); } }); jMenu3.add(jMenuItem9); jMenuItem13.setText("Lubricants"); jMenuItem13.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem13ActionPerformed(evt); } }); jMenu3.add(jMenuItem13); jMenuItem14.setText("SpareParts"); jMenuItem14.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem14ActionPerformed(evt); } }); jMenu3.add(jMenuItem14); jMenuItem15.setText("Accessories"); jMenuItem15.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem15ActionPerformed(evt); } }); jMenu3.add(jMenuItem15); jMenuBar1.add(jMenu3); jMenu4.setText("Report"); jMenu4.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu4.setMaximumSize(new java.awt.Dimension(60, 32767)); jMenu4.addMenuListener( new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) {} public void menuDeselected(javax.swing.event.MenuEvent evt) {} public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu4MenuSelected(evt); } }); jMenu4.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu4ActionPerformed(evt); } }); jMenuItem10.setText("Sale"); jMenuItem10.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem10ActionPerformed(evt); } }); jMenu4.add(jMenuItem10); jMenu12.setText("Bill"); jMenuItem11.setText("BillNo"); jMenuItem11.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem11ActionPerformed(evt); } }); jMenu12.add(jMenuItem11); jMenuItem12.setText("BillDate"); jMenuItem12.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem12ActionPerformed(evt); } }); jMenu12.add(jMenuItem12); jMenu4.add(jMenu12); jMenuItem16.setText("Lubricants"); jMenuItem16.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem16ActionPerformed(evt); } }); jMenu4.add(jMenuItem16); jMenuItem17.setText("SpareParts"); jMenuItem17.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem17ActionPerformed(evt); } }); jMenu4.add(jMenuItem17); jMenuItem18.setText("Accessories"); jMenuItem18.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem18ActionPerformed(evt); } }); jMenu4.add(jMenuItem18); jMenuItem19.setText("Motors"); jMenuItem19.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem19ActionPerformed(evt); } }); jMenu4.add(jMenuItem19); jMenuBar1.add(jMenu4); jMenu15.setText("Payroll"); jMenu15.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu15.setMaximumSize(new java.awt.Dimension(60, 32767)); jMenu15.addMenuListener( new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) {} public void menuDeselected(javax.swing.event.MenuEvent evt) {} public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu15MenuSelected(evt); } }); jMenuBar1.add(jMenu15); jMenu11.setLabel("Employee"); jMenu11.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu11.setMaximumSize(new java.awt.Dimension(70, 32767)); jMenu11.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu11ActionPerformed(evt); } }); jMenuItem7.setText("New"); jMenuItem7.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem7ActionPerformed(evt); } }); jMenu11.add(jMenuItem7); jMenuItem8.setText("Update/Delete"); jMenuItem8.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenuItem8ActionPerformed(evt); } }); jMenu11.add(jMenuItem8); jMenuBar1.add(jMenu11); jMenu5.setText("AboutUs"); jMenu5.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu5.setMaximumSize(new java.awt.Dimension(75, 32767)); jMenu5.addMenuListener( new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) {} public void menuDeselected(javax.swing.event.MenuEvent evt) {} public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu5MenuSelected(evt); } }); jMenu5.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu5ActionPerformed(evt); } }); jMenuBar1.add(jMenu5); jMenu7.setText("Exit"); jMenu7.setMargin(new java.awt.Insets(0, 5, 0, 0)); jMenu7.setMaximumSize(new java.awt.Dimension(35, 32767)); jMenu7.addMenuListener( new javax.swing.event.MenuListener() { public void menuCanceled(javax.swing.event.MenuEvent evt) {} public void menuDeselected(javax.swing.event.MenuEvent evt) {} public void menuSelected(javax.swing.event.MenuEvent evt) { jMenu7MenuSelected(evt); } }); jMenu7.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jMenu7ActionPerformed(evt); } }); jMenuBar1.add(jMenu7); setJMenuBar(jMenuBar1); pack(); } // </editor-fold>//GEN-END:initComponents
public void addBody(Body body) throws SAXException, WingException, UIException, SQLException, IOException, AuthorizeException { // If we are actually editing information of an uploaded file, // then display that body instead! if (this.editFile != null) { editFile.addBody(body); return; } // Get a list of all files in the original bundle Item item = submission.getItem(); Collection collection = submission.getCollection(); String actionURL = contextPath + "/handle/" + collection.getHandle() + "/submit/" + knot.getId() + ".continue"; boolean disableFileEditing = (submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit"); Bundle[] bundles = item.getBundles("ORIGINAL"); Bitstream[] bitstreams = new Bitstream[0]; if (bundles.length > 0) { bitstreams = bundles[0].getBitstreams(); } // Part A: // First ask the user if they would like to upload a new file (may be the first one) Division div = body.addInteractiveDivision( "submit-upload", actionURL, Division.METHOD_MULTIPART, "primary submission"); div.setHead(T_submission_head); addSubmissionProgressList(div); List upload = null; if (!disableFileEditing) { // Only add the upload capabilities for new item submissions upload = div.addList("submit-upload-new", List.TYPE_FORM); upload.setHead(T_head); addRioxxVersionSection(upload, item); File file = upload.addItem().addFile("file"); file.setLabel(T_file); file.setHelp(T_file_help); file.setRequired(); // if no files found error was thrown by processing class, display it! if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_NO_FILES_ERROR) { file.addError(T_file_error); } // if an upload error was thrown by processing class, display it! if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_UPLOAD_ERROR) { file.addError(T_upload_error); } // if virus checking was attempted and failed in error then let the user know if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_VIRUS_CHECKER_UNAVAILABLE) { file.addError(T_virus_checker_error); } // if virus checking was attempted and a virus found then let the user know if (this.errorFlag == org.dspace.submit.step.UploadStep.STATUS_CONTAINS_VIRUS) { file.addError(T_virus_error); } Text description = upload.addItem().addText("description"); description.setLabel(T_description); description.setHelp(T_description_help); Button uploadSubmit = upload.addItem().addButton("submit_upload"); uploadSubmit.setValue(T_submit_upload); } make_sherpaRomeo_submission(item, div); // Part B: // If the user has already uploaded files provide a list for the user. if (bitstreams.length > 0 || disableFileEditing) { Table summary = div.addTable("submit-upload-summary", (bitstreams.length * 2) + 2, 7); summary.setHead(T_head2); Row header = summary.addRow(Row.ROLE_HEADER); header.addCellContent(T_column0); // primary bitstream header.addCellContent(T_column1); // select checkbox header.addCellContent(T_column2); // file name header.addCellContent(T_column3); // size header.addCellContent(T_column4); // description header.addCellContent(T_column5); // format header.addCellContent(T_column6); // edit button for (Bitstream bitstream : bitstreams) { int id = bitstream.getID(); String name = bitstream.getName(); String url = makeBitstreamLink(item, bitstream); long bytes = bitstream.getSize(); String desc = bitstream.getDescription(); String algorithm = bitstream.getChecksumAlgorithm(); String checksum = bitstream.getChecksum(); Row row = summary.addRow(); // Add radio-button to select this as the primary bitstream Radio primary = row.addCell().addRadio("primary_bitstream_id"); primary.addOption(String.valueOf(id)); // If this bitstream is already marked as the primary bitstream // mark it as such. if (bundles[0].getPrimaryBitstreamID() == id) { primary.setOptionSelected(String.valueOf(id)); } if (!disableFileEditing) { // Workflow users can not remove files. CheckBox remove = row.addCell().addCheckBox("remove"); remove.setLabel("remove"); remove.addOption(id); } else { row.addCell(); } row.addCell().addXref(url, name); row.addCellContent(bytes + " bytes"); if (desc == null || desc.length() == 0) { row.addCellContent(T_unknown_name); } else { row.addCellContent(desc); } BitstreamFormat format = bitstream.getFormat(); if (format == null) { row.addCellContent(T_unknown_format); } else { int support = format.getSupportLevel(); Cell cell = row.addCell(); cell.addContent(format.getMIMEType()); cell.addContent(" "); switch (support) { case 1: cell.addContent(T_supported); break; case 2: cell.addContent(T_known); break; case 3: cell.addContent(T_unsupported); break; } } Button edit = row.addCell().addButton("submit_edit_" + id); edit.setValue(T_submit_edit); Row checksumRow = summary.addRow(); checksumRow.addCell(); Cell checksumCell = checksumRow.addCell(null, null, 0, 6, null); checksumCell.addHighlight("bold").addContent(T_checksum); checksumCell.addContent(" "); checksumCell.addContent(algorithm + ":" + checksum); } if (!disableFileEditing) { // Workflow users can not remove files. Row actionRow = summary.addRow(); actionRow.addCell(); Button removeSeleceted = actionRow.addCell(null, null, 0, 6, null).addButton("submit_remove_selected"); removeSeleceted.setValue(T_submit_remove); } upload = div.addList("submit-upload-new-part2", List.TYPE_FORM); } // Part C: // add standard control/paging buttons addControlButtons(upload); }
/** * Return table categories and table that user has view permission * * @param request * @param subSystemId * @return never null, elements are List, containing 2 elements: 1)when first element is * nds.schema.TableCategory, then second will be java.util.List (nds.schema.Table or * nds.schema.WebAction) 2) when first element is nds.schema.WebAction, then second is null */ public List getTableCategories( HttpServletRequest request, int subSystemId, boolean includeActions) { // Create categories and their tables in hashtable TableManager manager = TableManager.getInstance(); // Iterator tables = manager.getAllTables().iterator(); // Hashtable categories = new Hashtable(50,20); // key:Integer(category id), values :List of // table SubSystem ss; Integer tableCategoryId; Table table; WebAction action; ArrayList cats = new ArrayList(); Connection conn = null; HashMap webActionEnv = null; try { UserWebImpl userWeb = ((UserWebImpl) WebUtils.getSessionContextManager(request.getSession()) .getActor(nds.util.WebKeys.USER)); if (includeActions) { conn = QueryEngine.getInstance().getConnection(); webActionEnv = new HashMap(); webActionEnv.put("connection", conn); webActionEnv.put("httpservletrequest", request); webActionEnv.put("userweb", userWeb); } List categories = manager.getSubSystem(subSystemId).children(); for (int i = 0; i < categories.size(); i++) { Object o = categories.get(i); // TableCategory or WebAction if (o instanceof TableCategory) { TableCategory tc = (TableCategory) o; List children = tc.children(); ArrayList catschild = new ArrayList(); for (int j = 0; j < children.size(); j++) { if (children.get(j) instanceof Table) { table = (Table) children.get(j); if (!table.isMenuObject()) { continue; } try { WebUtils.checkTableQueryPermission(table.getName(), request); } catch (NDSSecurityException e) { continue; } // table is ok for current user to list catschild.add(table); } else if (children.get(j) instanceof WebAction) { if (includeActions) { action = (WebAction) children.get(j); if (action.canDisplay(webActionEnv)) catschild.add(action); } } else { throw new NDSRuntimeException( "Unsupported element in TableCategory children:" + children.get(j).getClass()); } } if (catschild.size() > 0) { // show this category ArrayList row = new ArrayList(); row.add(tc); row.add(catschild); cats.add(row); } } else if (o instanceof WebAction) { if (includeActions && ((WebAction) o).canDisplay(webActionEnv)) { ArrayList row = new ArrayList(); row.add(o); row.add(Collections.EMPTY_LIST); cats.add(row); } } else { throw new NDSException( "Unexpected class in subsystem (id=" + subSystemId + "), class is " + o.getClass()); } } } catch (Throwable t) { logger.error("Fail to load subsystem tree", t); } finally { try { if (conn != null) conn.close(); } catch (Throwable e) { } } return cats; }
/** * menu action * * @throws Exception cyl * @param request * @param tableCategoryId desgin menu list * @paqram includeAction if true, will load webactions also * @return elements are Table or WebAction and menu list */ public List getChildrenOfTableCategorybymenu( HttpServletRequest request, int tableCategoryId, boolean includeAction) throws Exception { TableManager manager = TableManager.getInstance(); WebAction action; ArrayList cats = new ArrayList(); List children = new ArrayList(); Connection conn = null; HashMap webActionEnv = null; Table table; List al = QueryEngine.getInstance() .doQueryList( "select e.id,e.name from ad_table g,AD_ACCORDION e where g.AD_ACCORDION_id=e.id and g.ad_tablecategory_id=" + tableCategoryId + " group by e.id,e.name,e.orderno order by e.orderno asc"); UserWebImpl userWeb = ((UserWebImpl) WebUtils.getSessionContextManager(request.getSession()) .getActor(nds.util.WebKeys.USER)); TableCategory tc = manager.getTableCategory(tableCategoryId); if (tc != null) children = tc.children(); // ArrayList prow= new ArrayList(); if (al.size() > 0) { for (int i = 0; i < al.size(); i++) { List als = (List) al.get(i); int ACCORDION = Tools.getInt(als.get(0), -1); logger.debug("ACCORDION~~~~~~~~~~" + String.valueOf(ACCORDION)); ArrayList catschild = new ArrayList(); String ACCORDION_name = (String) als.get(1); try { if (includeAction) { conn = QueryEngine.getInstance().getConnection(); webActionEnv = new HashMap(); webActionEnv.put("connection", conn); webActionEnv.put("httpservletrequest", request); webActionEnv.put("userweb", userWeb); } for (int j = 0; j < children.size(); j++) { if (children.get(j) instanceof Table) { table = (Table) children.get(j); // logger.debug("getAccordid~~~~~~~~~~"+String.valueOf(table.getAccordid())); if (!table.isMenuObject()) { continue; } else if (ACCORDION != table.getAccordid()) { // logger.debug(String.valueOf(ACCORDION)+"!="+String.valueOf(table.getAccordid())); continue; } try { WebUtils.checkTableQueryPermission(table.getName(), request); } catch (NDSSecurityException e) { continue; } // table is ok for current user to list logger.debug(String.valueOf(ACCORDION) + "&&" + String.valueOf(table.getAccordid())); catschild.add(table); } else if (children.get(j) instanceof WebAction) { if (includeAction) { action = (WebAction) children.get(j); if (action.canDisplay(webActionEnv) && (action.getAcordionId() == ACCORDION)) { logger.debug("add action" + String.valueOf(ACCORDION)); // System.out.print("add action"+String.valueOf(ACCORDION)); // System.out.print("action name"+String.valueOf(action.getName())); // System.out.print("ACCORDION name"+String.valueOf(ACCORDION)); // System.out.print("action // name"+String.valueOf(action.getAcordionId())); catschild.add(action); } } } else { throw new NDSRuntimeException( "Unsupported element in TableCategory children:" + children.get(j).getClass()); } } } catch (Throwable t) { logger.error("Fail to load subsystem tree", t); } finally { try { if (conn != null) conn.close(); } catch (Throwable e) { } } if (catschild.size() > 0) { // show this category ArrayList row = new ArrayList(); row.add(ACCORDION_name); row.add(catschild); cats.add(row); } } return cats; } else { ArrayList catschild1 = new ArrayList(); try { if (includeAction) { conn = QueryEngine.getInstance().getConnection(); webActionEnv = new HashMap(); webActionEnv.put("connection", conn); webActionEnv.put("httpservletrequest", request); webActionEnv.put("userweb", userWeb); } for (int j = 0; j < children.size(); j++) { if (children.get(j) instanceof Table) { table = (Table) children.get(j); if (!table.isMenuObject()) { continue; } try { WebUtils.checkTableQueryPermission(table.getName(), request); } catch (NDSSecurityException e) { continue; } // table is ok for current user to list catschild1.add(table); } else if (children.get(j) instanceof WebAction) { if (includeAction) { action = (WebAction) children.get(j); if (action.canDisplay(webActionEnv)) catschild1.add(action); } } else { throw new NDSRuntimeException( "Unsupported element in TableCategory children:" + children.get(j).getClass()); } } } catch (Throwable t) { logger.error("Fail to load subsystem tree", t); } finally { try { if (conn != null) conn.close(); } catch (Throwable e) { } } if (catschild1.size() > 0) { // show this category ArrayList row = new ArrayList(); row.add(tc.getName()); row.add(catschild1); cats.add(row); } } return cats; }
/** * 事实表和关联报表属于当前传入数组的交叉报表 * * @param request * @param tables elements are table.id * @return elements are ArrayList, first is cxtab id, second is cxtab name */ public List getCxtabs(HttpServletRequest request, List<Integer> tables) { TableManager manager = TableManager.getInstance(); UserWebImpl userWeb = ((UserWebImpl) WebUtils.getSessionContextManager(request.getSession()) .getActor(nds.util.WebKeys.USER)); StringBuffer sb = new StringBuffer(); for (int i = 0; i < tables.size(); i++) { // Table t= tables.get(i); if (i > 0) sb.append(","); sb.append(tables.get(i)); } String ts = sb.toString(); try { Table cxtabTable = manager.getTable("AD_CXTAB"); QueryRequestImpl queryData; // only pk,dk will be selected, order by ak asc queryData = QueryEngine.getInstance().createRequest(userWeb.getSession()); queryData.setMainTable(cxtabTable.getId()); queryData.addSelection(cxtabTable.getPrimaryKey().getId()); queryData.addSelection(cxtabTable.getDisplayKey().getId()); Column colOrderNo = cxtabTable.getColumn("orderno"); queryData.setOrderBy(new int[] {colOrderNo.getId()}, true); queryData.setRange(0, Integer.MAX_VALUE); Expression expr = new Expression( null, "(AD_CXTAB.AD_TABLE_ID in (" + ts + ") or exists (select 1 from ad_cxtab_reftable r where r.ad_cxtab_id=AD_CXTAB.id and r.ad_table_id in (" + ts + ")))", null); // set reporttype to "S" expr = expr.combine( new Expression(new ColumnLink("AD_CXTAB.REPORTTYPE"), "=S", null), SQLCombination.SQL_AND, null); expr = expr.combine( new Expression(new ColumnLink("AD_CXTAB.ISACTIVE"), "=Y", null), SQLCombination.SQL_AND, null); expr = expr.combine( new Expression(new ColumnLink("AD_CXTAB.ISPUBLIC"), "=Y", null), SQLCombination.SQL_AND, null); expr = expr.combine( userWeb.getSecurityFilter(cxtabTable.getName(), 1), SQLCombination.SQL_AND, null); queryData.addParam(expr); // read permission return QueryEngine.getInstance().doQueryList(queryData.toSQL()); } catch (Throwable t) { logger.error( "Fail to load reports for user " + userWeb.getUserId() + " with table ids: " + ts, t); } return Collections.EMPTY_LIST; }