diff options
author | unknown | 2014-04-14 17:52:49 +0200 |
---|---|---|
committer | unknown | 2014-04-14 17:52:49 +0200 |
commit | cd84e775c083d2013115a69ef24c6de506617c04 (patch) | |
tree | 281fa281773ea74c0128cebd769d005678af7cda | |
parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
parent | konsolenausgaben funktionierender teile entfernt (diff) | |
download | tutor-module-cd84e775c083d2013115a69ef24c6de506617c04.tar.gz tutor-module-cd84e775c083d2013115a69ef24c6de506617c04.tar.xz tutor-module-cd84e775c083d2013115a69ef24c6de506617c04.zip |
Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module
Conflicts:
Dozentenmodulserver/bin/server/ServerHandler.class
Dozentenmodulserver/src/server/ServerHandler.java
28 files changed, 184 insertions, 1536 deletions
diff --git a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class Binary files differindex 28742b7d..097b86aa 100644 --- a/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class +++ b/Dozentenmodul/bin/gui/image/DeleteImage_GUI.class diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$6.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$6.class Binary files differindex 0f16c43d..3bbfbad4 100644 --- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$6.class +++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$6.class diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$7.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$7.class Binary files differindex 70809568..14b127f6 100644 --- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$7.class +++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$7.class diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$8.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$8.class Binary files differindex f8ac881a..d03d40d7 100644 --- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$8.class +++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$8.class diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$9.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$9.class Binary files differindex 2357c0ec..7d66e216 100644 --- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$9.class +++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI$9.class diff --git a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class Binary files differindex 2725d84c..8ca7d2fa 100644 --- a/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class +++ b/Dozentenmodul/bin/gui/image/SearchEditImage_GUI.class diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI$6.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI$6.class Binary files differindex 1138b2dc..3e0a8637 100644 --- a/Dozentenmodul/bin/gui/image/SearchImage_GUI$6.class +++ b/Dozentenmodul/bin/gui/image/SearchImage_GUI$6.class diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI$7.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI$7.class Binary files differindex 6618191d..c01be42e 100644 --- a/Dozentenmodul/bin/gui/image/SearchImage_GUI$7.class +++ b/Dozentenmodul/bin/gui/image/SearchImage_GUI$7.class diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI$8.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI$8.class Binary files differindex 9096233b..4161ee8a 100644 --- a/Dozentenmodul/bin/gui/image/SearchImage_GUI$8.class +++ b/Dozentenmodul/bin/gui/image/SearchImage_GUI$8.class diff --git a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class b/Dozentenmodul/bin/gui/image/SearchImage_GUI.class Binary files differindex 6244e1eb..8568b3b2 100644 --- a/Dozentenmodul/bin/gui/image/SearchImage_GUI.class +++ b/Dozentenmodul/bin/gui/image/SearchImage_GUI.class diff --git a/Dozentenmodul/src/GUI/SearchImage_GUI.java b/Dozentenmodul/src/GUI/SearchImage_GUI.java deleted file mode 100644 index 83e6bc07..00000000 --- a/Dozentenmodul/src/GUI/SearchImage_GUI.java +++ /dev/null @@ -1,458 +0,0 @@ -package gui; - - -import gui.image.EditImageAllgemein_GUI; -import gui.image.FTPDownloader_GUI; -import gui.intro.MainMenue_GUI; -import gui.lecture.ExtendedSearchForImages_GUI; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; - -@SuppressWarnings("serial") -public class SearchImage_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox<String> comboBox; - JTable tableAllImages; - JTable tablemyImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles= {"Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", "Verantwortlicher", "Letztes Update", "Schlagwort"}; - ThriftConnection con=new ThriftConnection(); - Client client=con.getThriftConnection(); - final DefaultTableModel modelAll = new DefaultTableModel( titles, 0 ); - final DefaultTableModel modelMyImages = new DefaultTableModel( titles, 0 ); - final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll ); - final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( modelMyImages ); - - /** - * Launch the application. - */ - public static void main(String[] args) { - try { - SearchImage_GUI dialog = new SearchImage_GUI(); - dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - dialog.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Create the dialog. - */ - public SearchImage_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - //Beendet die Anwendung nach klick auf X - System.exit(0); - } - }); - //Verhindert das Vergrößern Des Fensters - setResizable(false); - - try { - //Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp*"); - //Zentriert das Fenster in die Bildmitte - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - int top=(screenSize.height - 722) / 2; - int left=(screenSize.width - 603) / 2; - setBounds(left, top, 603, 722); - - - - final DefaultTableModel model = new DefaultTableModel( titles, 0 ); - - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - //Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - //Textfield eingabe auslesen - String stext=textFieldName.getText(); - - //Wenn Textfield nicht leer - if(stext!="") - { - //Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); - - } - }}); - - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel("<html><u>Erweiterte Suche</u></html>"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - //Öffnet das Fenster Extended GUI - ExtendedSearchForImages_GUI es=new ExtendedSearchForImages_GUI(); - es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(431, 106, 89, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox<String>(); - try { - //Holt sich eine Liste aller verfügbaren Betriebssysteme vom Server - List<String> list=client.getAllOS(); - //Leeres Item hinzufügen - comboBox.addItem(""); - for(int i=0;i<list.size();i++) - { - //Hinzufügen der verfügbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - //Registriert Auswahländerungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - //Prüft das die Auswahl nicht leer ist - if(comboBox.getSelectedItem().toString()!="") - { - //Filtert nach dem ausgewählten Betriebssystem - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - //Öffnet das Hauütmenü - SearchImage_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); - if(tabbedPane.getSelectedIndex()==0){ - - - - } - else if(tabbedPane.getSelectedIndex()==1){ - String username="Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(username, 4)); - //rowSorterMyImages.toggleSortOrder(0); - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages=new JTable(); - tablemyImages.setModel(modelMyImages); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelMyImages); - tablemyImages.setRowSorter(rowSorterMyImages); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages=new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages=new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages=new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen=new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - - - - JButton btnDownload = new JButton("Download"); - btnDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - //Öffnet den Downloader - FTPDownloader_GUI down=new FTPDownloader_GUI(); - down.setVisible(true); - SearchImage_GUI.this.setVisible(false); - } - }); - btnDownload.setBounds(449, 508, 118, 23); - contentPanel.add(btnDownload); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - //Öffnet das Hauptmenü - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - EditImageAllgemein_GUI ea=new EditImageAllgemein_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mnNewMenu_1.add(mntmFaq); - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mnNewMenu_1.add(mntmOtrs); - - } - //Initiale Beffülung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model){ - List<server.Image> images; - try { - //Hole eine Liste der Images - - images = client.getImageList(); - Iterator<server.Image> i=images.iterator(); - - int x=0; - - while(i.hasNext()) - { - //erzeuge Objekte für die Tabelle - Object [] obj={images.get(x).getImageName(),images.get(x).getLicenseRestriction(),images.get(x).getOsName(),images.get(x).getLectureName(),images.get(x).getUserData(),images.get(x).getUpdateTime()}; - //Füge diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - - } - - diff --git a/Dozentenmodul/src/gui/SearchImage_GUI.java b/Dozentenmodul/src/gui/SearchImage_GUI.java deleted file mode 100644 index 83e6bc07..00000000 --- a/Dozentenmodul/src/gui/SearchImage_GUI.java +++ /dev/null @@ -1,458 +0,0 @@ -package gui; - - -import gui.image.EditImageAllgemein_GUI; -import gui.image.FTPDownloader_GUI; -import gui.intro.MainMenue_GUI; -import gui.lecture.ExtendedSearchForImages_GUI; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Iterator; -import java.util.List; - -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; - -@SuppressWarnings("serial") -public class SearchImage_GUI extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox<String> comboBox; - JTable tableAllImages; - JTable tablemyImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles= {"Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", "Verantwortlicher", "Letztes Update", "Schlagwort"}; - ThriftConnection con=new ThriftConnection(); - Client client=con.getThriftConnection(); - final DefaultTableModel modelAll = new DefaultTableModel( titles, 0 ); - final DefaultTableModel modelMyImages = new DefaultTableModel( titles, 0 ); - final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll ); - final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( modelMyImages ); - - /** - * Launch the application. - */ - public static void main(String[] args) { - try { - SearchImage_GUI dialog = new SearchImage_GUI(); - dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - dialog.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Create the dialog. - */ - public SearchImage_GUI() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - //Beendet die Anwendung nach klick auf X - System.exit(0); - } - }); - //Verhindert das Vergrößern Des Fensters - setResizable(false); - - try { - //Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - //Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp*"); - //Zentriert das Fenster in die Bildmitte - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - int top=(screenSize.height - 722) / 2; - int left=(screenSize.width - 603) / 2; - setBounds(left, top, 603, 722); - - - - final DefaultTableModel model = new DefaultTableModel( titles, 0 ); - - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie.setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - //Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - //Textfield eingabe auslesen - String stext=textFieldName.getText(); - - //Wenn Textfield nicht leer - if(stext!="") - { - //Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(textFieldName.getText(), 0)); - - } - }}); - - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel("<html><u>Erweiterte Suche</u></html>"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - //Öffnet das Fenster Extended GUI - ExtendedSearchForImages_GUI es=new ExtendedSearchForImages_GUI(); - es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(431, 106, 89, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox<String>(); - try { - //Holt sich eine Liste aller verfügbaren Betriebssysteme vom Server - List<String> list=client.getAllOS(); - //Leeres Item hinzufügen - comboBox.addItem(""); - for(int i=0;i<list.size();i++) - { - //Hinzufügen der verfügbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - //Registriert Auswahländerungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - //Prüft das die Auswahl nicht leer ist - if(comboBox.getSelectedItem().toString()!="") - { - //Filtert nach dem ausgewählten Betriebssystem - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(comboBox.getSelectedItem().toString(), 2)); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - //Öffnet das Hauütmenü - SearchImage_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); - if(tabbedPane.getSelectedIndex()==0){ - - - - } - else if(tabbedPane.getSelectedIndex()==1){ - String username="Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter(username, 4)); - //rowSorterMyImages.toggleSortOrder(0); - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages=new JTable(); - tablemyImages.setModel(modelMyImages); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelMyImages); - tablemyImages.setRowSorter(rowSorterMyImages); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages=new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages=new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages=new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen=new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - - - - JButton btnDownload = new JButton("Download"); - btnDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - //Öffnet den Downloader - FTPDownloader_GUI down=new FTPDownloader_GUI(); - down.setVisible(true); - SearchImage_GUI.this.setVisible(false); - } - }); - btnDownload.setBounds(449, 508, 118, 23); - contentPanel.add(btnDownload); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton okButton = new JButton("Zur\u00FCck"); - okButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - //Öffnet das Hauptmenü - MainMenue_GUI main=new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - okButton.setActionCommand("OK"); - buttonPane.add(okButton); - getRootPane().setDefaultButton(okButton); - } - { - JButton cancelButton = new JButton("Weiter"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - EditImageAllgemein_GUI ea=new EditImageAllgemein_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - cancelButton.setActionCommand("Cancel"); - buttonPane.add(cancelButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mnNewMenu_1.add(mntmFaq); - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mnNewMenu_1.add(mntmOtrs); - - } - //Initiale Beffülung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model){ - List<server.Image> images; - try { - //Hole eine Liste der Images - - images = client.getImageList(); - Iterator<server.Image> i=images.iterator(); - - int x=0; - - while(i.hasNext()) - { - //erzeuge Objekte für die Tabelle - Object [] obj={images.get(x).getImageName(),images.get(x).getLicenseRestriction(),images.get(x).getOsName(),images.get(x).getLectureName(),images.get(x).getUserData(),images.get(x).getUpdateTime()}; - //Füge diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - - } - - diff --git a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java b/Dozentenmodul/src/gui/image/DeleteImage_GUI.java index 376d7c5f..2c4ba5e6 100644 --- a/Dozentenmodul/src/gui/image/DeleteImage_GUI.java +++ b/Dozentenmodul/src/gui/image/DeleteImage_GUI.java @@ -370,11 +370,15 @@ public class DeleteImage_GUI extends JFrame { "Wollen Sie diese Daten löschen?", "Löschen?",JOptionPane.YES_NO_OPTION); if (eingabe == JOptionPane.YES_OPTION) { - String imageid = modelAll.getValueAt(tableAllImages.convertRowIndexToModel - (tableAllImages.getSelectedRow()), 7).toString(); + String imageid = modelMyImages.getValueAt(tablemyImages.convertRowIndexToModel + (tablemyImages.getSelectedRow()), 7).toString(); + /* modelMyImages.getValueAt( + tablemyImages.convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7).toString(); + */ - String imageversion = modelAll.getValueAt(tableAllImages.convertRowIndexToModel - (tableAllImages.getSelectedRow()), 8).toString(); + String imageversion = modelMyImages.getValueAt(tablemyImages.convertRowIndexToModel + (tablemyImages.getSelectedRow()), 8).toString(); //TODO //Image darf nur gelöscht werden, wenn keine Veranstaltung mehr auf das Image verweist. @@ -382,7 +386,8 @@ public class DeleteImage_GUI extends JFrame { //try { //if(client.connectedToEvents(imageid ,imageversion)) { - System.out.println("entrou1"); + System.out.println(imageid); + System.out.println(imageversion); try { if (client.deleteImageData(imageid ,imageversion) && client.deleteImageServer(imageid ,imageversion)) { diff --git a/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java b/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java index c54e0b66..d5c48764 100644 --- a/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java +++ b/Dozentenmodul/src/gui/image/SearchEditImage_GUI.java @@ -273,7 +273,6 @@ public class SearchEditImage_GUI extends JFrame { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); if (tabbedPane.getSelectedIndex() == 0) { String username = person.verantwortlicher.getName() + " " diff --git a/Dozentenmodul/src/gui/image/SearchImage_GUI.java b/Dozentenmodul/src/gui/image/SearchImage_GUI.java index 03b0f136..bb1e8aa7 100644 --- a/Dozentenmodul/src/gui/image/SearchImage_GUI.java +++ b/Dozentenmodul/src/gui/image/SearchImage_GUI.java @@ -273,7 +273,6 @@ public class SearchImage_GUI extends JFrame { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); if (tabbedPane.getSelectedIndex() == 0) { String username = person.verantwortlicher.getName() + " " diff --git a/Dozentenmodul/src/gui/image/SearchImage_GUI_alt.java b/Dozentenmodul/src/gui/image/SearchImage_GUI_alt.java deleted file mode 100644 index 85e8da21..00000000 --- a/Dozentenmodul/src/gui/image/SearchImage_GUI_alt.java +++ /dev/null @@ -1,459 +0,0 @@ -package gui.image; - -import gui.intro.MainMenue_GUI; -import gui.lecture.ExtendedSearchForImages_GUI; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.SystemColor; -import java.awt.Toolkit; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.util.Iterator; -import java.util.List; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JDialog; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JTabbedPane; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.JTextPane; -import javax.swing.RowFilter; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.table.DefaultTableModel; -import javax.swing.table.TableModel; -import javax.swing.table.TableRowSorter; - -import org.apache.thrift.TException; - -import server.Server.Client; -import thrift.ThriftConnection; - -@SuppressWarnings("serial") -public class SearchImage_GUI_alt extends JFrame { - - private final JPanel contentPanel = new JPanel(); - String[] result; - JRadioButton rdbtnInternetJa; - JRadioButton rdbtnInternetNein; - JComboBox<String> comboBox; - JTable tableAllImages; - JTable tablemyImages; - private JTextField textFieldName; - JTabbedPane tabbedPane; - String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "Schlagwort" }; - ThriftConnection con = new ThriftConnection(); - Client client = con.getThriftConnection(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); - final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0); - final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( - modelAll); - final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( - modelMyImages); - - /** - * Launch the application. - */ - public static void main(String[] args) { - try { - SearchImage_GUI_alt dialog = new SearchImage_GUI_alt(); - dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); - dialog.setVisible(true); - } catch (Exception e) { - e.printStackTrace(); - } - } - - /** - * Create the dialog. - */ - public SearchImage_GUI_alt() { - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - // Beendet die Anwendung nach klick auf X - System.exit(0); - } - }); - // Verhindert das Vergrößern Des Fensters - setResizable(false); - - try { - // Setzt das Look & Feel auf System - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - // Setzt den Fenstertitel - setTitle("bwLehrpool Suite *Prototyp*"); - // Zentriert das Fenster in die Bildmitte - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); - int top = (screenSize.height - 722) / 2; - int left = (screenSize.width - 603) / 2; - setBounds(left, top, 603, 722); - - final DefaultTableModel model = new DefaultTableModel(titles, 0); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 577, 57); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Suche nach VL-Image"); - lblNewLabel.setBounds(10, 11, 509, 22); - panel.add(lblNewLabel); - lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); - } - - JTextPane txtpnBitteWhlenSie = new JTextPane(); - txtpnBitteWhlenSie.setEditable(false); - txtpnBitteWhlenSie.setBackground(SystemColor.menu); - txtpnBitteWhlenSie - .setText("Hier k\u00F6nnen Sie nach Ihrem gew\u00FCnschten VL-Image suchen und dieses f\u00FCr weitere Schritte ausw\u00E4hlen"); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); - panel.add(txtpnBitteWhlenSie); - } - contentPanel.setBounds(10, 85, 577, 531); - contentPanel.setBackground(SystemColor.menu); - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JPanel panel_1 = new JPanel(); - panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Filterfunktionen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 49, 557, 131); - contentPanel.add(panel_1); - panel_1.setLayout(null); - - JLabel lblNewLabel_2 = new JLabel("Anzeigename:"); - lblNewLabel_2.setBounds(10, 30, 250, 20); - panel_1.add(lblNewLabel_2); - - JLabel lblInternetIstInnerhalb = new JLabel("Betriebssystem:"); - lblInternetIstInnerhalb.setBounds(10, 58, 250, 20); - panel_1.add(lblInternetIstInnerhalb); - - textFieldName = new JTextField(); - // Key Listener der Tastatureingabe registriert - textFieldName.addKeyListener(new KeyAdapter() { - @Override - public void keyReleased(KeyEvent e) { - // Textfield eingabe auslesen - String stext = textFieldName.getText(); - - // Wenn Textfield nicht leer - if (stext != "") { - // Filtere nach der Eingabe - rowSorterAll.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - textFieldName.getText(), 0)); - - } - } - }); - - textFieldName.setBounds(270, 30, 250, 20); - panel_1.add(textFieldName); - textFieldName.setColumns(10); - - JLabel lblErweiterteSuche = new JLabel( - "<html><u>Erweiterte Suche</u></html>"); - lblErweiterteSuche.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // Öffnet das Fenster Extended GUI - ExtendedSearchForImages_GUI es = new ExtendedSearchForImages_GUI(); - es.setVisible(true); - } - }); - lblErweiterteSuche.setForeground(Color.BLUE); - - lblErweiterteSuche.setBounds(431, 106, 89, 14); - panel_1.add(lblErweiterteSuche); - - comboBox = new JComboBox<String>(); - try { - // Holt sich eine Liste aller verfügbaren Betriebssysteme vom Server - List<String> list = client.getAllOS(); - // Leeres Item hinzufügen - comboBox.addItem(""); - for (int i = 0; i < list.size(); i++) { - // Hinzufügen der verfügbaren Betriebssysteme - comboBox.addItem(list.get(i)); - } - } catch (TException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - // Registriert Auswahländerungen der Box - comboBox.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // Prüft das die Auswahl nicht leer ist - if (comboBox.getSelectedItem().toString() != "") { - // Filtert nach dem ausgewählten Betriebssystem - rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox - .getSelectedItem().toString(), 2)); - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - comboBox.getSelectedItem().toString(), 2)); - } - } - - }); - comboBox.setBounds(270, 58, 250, 20); - panel_1.add(comboBox); - - JLabel lblHauptmen = new JLabel("Hauptmen\u00FC"); - lblHauptmen.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - // Öffnet das Hauütmenü - SearchImage_GUI_alt.this.setVisible(false); - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - } - }); - lblHauptmen.setForeground(Color.BLUE); - lblHauptmen.setBounds(10, 11, 61, 14); - contentPanel.add(lblHauptmen); - - JLabel label_1 = new JLabel(">"); - label_1.setBounds(69, 11, 13, 14); - contentPanel.add(label_1); - - JLabel lblVlimage = new JLabel("VL-Image"); - lblVlimage.setForeground(Color.BLUE); - lblVlimage.setBounds(81, 11, 45, 14); - contentPanel.add(lblVlimage); - - JLabel label_2 = new JLabel(">"); - label_2.setBounds(133, 11, 13, 14); - contentPanel.add(label_2); - - JLabel lblNewLabel_1 = new JLabel("Imageauswahl"); - lblNewLabel_1.setBounds(146, 11, 85, 14); - contentPanel.add(lblNewLabel_1); - - tabbedPane = new JTabbedPane(JTabbedPane.TOP); - tabbedPane.addChangeListener(new ChangeListener() { - public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); - if (tabbedPane.getSelectedIndex() == 0) { - - } else if (tabbedPane.getSelectedIndex() == 1) { - String username = "Spitzer Tobias"; - rowSorterMyImages.setRowFilter(RowFilter.regexFilter( - username, 4)); - // rowSorterMyImages.toggleSortOrder(0); - } - - } - }); - - tabbedPane.setBounds(10, 197, 557, 300); - contentPanel.add(tabbedPane); - - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages = new JTable(); - tablemyImages.setModel(modelMyImages); - tablemyImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelMyImages); - tablemyImages.setRowSorter(rowSorterMyImages); - - JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages = new JTable(); - tableAllImages.setModel(modelAll); - tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); - initTableModel(modelAll); - tableAllImages.setRowSorter(rowSorterAll); - - scrollPaneAllImages.setViewportView(tableAllImages); - tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); - - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPaneCoopImages = new JScrollPane(); - JTable tableCoopImages = new JTable(); - tableCoopImages.setModel(model); - tableCoopImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("Kooperative Images", null, scrollPaneCoopImages, - null); - tabbedPane.setEnabledAt(2, false); - - JScrollPane scrollPanePublicImages = new JScrollPane(); - JTable tablePublicImages = new JTable(); - tablePublicImages.setModel(model); - tablePublicImages.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicImages.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicImages.setViewportView(tablePublicImages); - tabbedPane.addTab("\u00D6ffentliche Images", null, - scrollPanePublicImages, null); - tabbedPane.setEnabledAt(3, false); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - JTable tablePublicVorlagen = new JTable(); - tablePublicVorlagen.setModel(model); - tablePublicVorlagen.getColumnModel().getColumn(1).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(2).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(3).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(4).sizeWidthToFit(); - tablePublicVorlagen.getColumnModel().getColumn(5).sizeWidthToFit(); - - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("\u00D6ffentliche Vorlagen", null, - scrollPanePublicVorlagen, null); - tabbedPane.setEnabledAt(4, false); - - JButton btnDownload = new JButton("Download"); - btnDownload.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - // Öffnet den Downloader - FTPDownloader_GUI down = new FTPDownloader_GUI(); - down.setVisible(true); - SearchImage_GUI_alt.this.setVisible(false); - } - }); - btnDownload.setBounds(449, 508, 118, 23); - contentPanel.add(btnDownload); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 640, 597, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton cancelButton = new JButton("Zur\u00FCck"); - cancelButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - // Öffnet das Hauptmenü - MainMenue_GUI main = new MainMenue_GUI(); - main.setVisible(true); - dispose(); - } - }); - cancelButton.setActionCommand("OK"); - buttonPane.add(cancelButton); - getRootPane().setDefaultButton(cancelButton); - } - { - JButton continueButton = new JButton("Weiter"); - continueButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - con.closeThriftConnection(); - EditImageAllgemein_GUI ea = new EditImageAllgemein_GUI(); - ea.setVisible(true); - dispose(); - - } - }); - continueButton.setActionCommand("Cancel"); - buttonPane.add(continueButton); - } - } - - JSeparator separator = new JSeparator(); - separator.setBounds(0, 78, 597, 2); - getContentPane().add(separator); - - JSeparator separator_1 = new JSeparator(); - separator_1.setBounds(0, 627, 597, 2); - getContentPane().add(separator_1); - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mnNewMenu_1.add(mntmFaq); - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mnNewMenu_1.add(mntmOtrs); - - } - - // Initiale Beffülung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) { - List<server.Image> images; - try { - // Hole eine Liste der Images - - images = client.getImageList(); - Iterator<server.Image> i = images.iterator(); - - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte für die Tabelle - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - images.get(x).getUpdateTime() }; - // Füge diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - - } - - return model; - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - return model; - } - -} diff --git a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java index 451ed9b4..11d3131e 100644 --- a/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java +++ b/Dozentenmodul/src/gui/lecture/CreateLectureLink_GUI.java @@ -374,10 +374,6 @@ public class CreateLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - System.out.println("Veranstaltung angelegt um: " - + formatter.format( - Lecture.lecture.getStartdate()) - .toString()); client.writeLecturedata( Lecture.lecture.getName(), Lecture.lecture.getShortDesc(), diff --git a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java index 4a4f6051..4160f855 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureLink_GUI.java @@ -370,14 +370,10 @@ public class EditLectureLink_GUI extends JFrame { String imagename = tableAllImages.getValueAt( tableAllImages.getSelectedRow(), 0) .toString(); - System.out.println("ID: "+Lecture.lecture.getid()); try { DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - System.out.println( formatter.format( - Lecture.lecture.getEnddate()) - .toString()); client.updateLecturedata(Lecture.lecture.getName(), Lecture.lecture.getNewName(), Lecture.lecture.getShortDesc(), diff --git a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java b/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java index 475f0a5f..badcf86a 100644 --- a/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java +++ b/Dozentenmodul/src/gui/lecture/EditLectureSearch_GUI.java @@ -239,7 +239,6 @@ public class EditLectureSearch_GUI extends JFrame { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); if (tabbedPane.getSelectedIndex() == 0) { String username = person.verantwortlicher.getName() + " " @@ -352,19 +351,6 @@ public class EditLectureSearch_GUI extends JFrame { JButton btnContinue = new JButton("Weiter"); btnContinue.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - System.out - .println("\ntableAllImages.getSelectedRow() = " - + tableAllLectures.getSelectedRow() - + "\ntablemyImages.getSelectedRow() = " - + tablemyLectures.getSelectedRow() - + "\ntableCoopImages.getSelectedRow() = " - + tableCoopImages.getSelectedRow() - + "\ntablePublicImages.getSelectedRow() = " - + tablePublicImages.getSelectedRow() - + "\ntablePublicVorlagen.getSelectedRow() = " - + tablePublicVorlagen.getSelectedRow()); - // check if a row is selected if ((tableAllLectures.getSelectedRow() != -1) || (tablemyLectures.getSelectedRow() != -1) diff --git a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java b/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java index a22578e1..413f1084 100644 --- a/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java +++ b/Dozentenmodul/src/gui/lecture/SearchLecture_GUI.java @@ -234,7 +234,6 @@ public class SearchLecture_GUI extends JFrame { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { - System.out.println(tabbedPane.getSelectedIndex()); if (tabbedPane.getSelectedIndex() == 0) { String username = person.verantwortlicher.getName() + " " diff --git a/Dozentenmodulserver/bin/server/BinaryListener.class b/Dozentenmodulserver/bin/server/BinaryListener.class Binary files differindex d53cdc9d..4a135f2d 100644 --- a/Dozentenmodulserver/bin/server/BinaryListener.class +++ b/Dozentenmodulserver/bin/server/BinaryListener.class diff --git a/Dozentenmodulserver/bin/server/ServerHandler.class b/Dozentenmodulserver/bin/server/ServerHandler.class Binary files differindex 942de6d1..8f9b9c51 100644 --- a/Dozentenmodulserver/bin/server/ServerHandler.class +++ b/Dozentenmodulserver/bin/server/ServerHandler.class diff --git a/Dozentenmodulserver/bin/server/startServer.class b/Dozentenmodulserver/bin/server/startServer.class Binary files differindex 030b565e..14dc0861 100644 --- a/Dozentenmodulserver/bin/server/startServer.class +++ b/Dozentenmodulserver/bin/server/startServer.class diff --git a/Dozentenmodulserver/bin/sql/SQL.class b/Dozentenmodulserver/bin/sql/SQL.class Binary files differindex 4479bf2c..9310440e 100644 --- a/Dozentenmodulserver/bin/sql/SQL.class +++ b/Dozentenmodulserver/bin/sql/SQL.class diff --git a/Dozentenmodulserver/src/server/BinaryListener.java b/Dozentenmodulserver/src/server/BinaryListener.java index 8d592992..97793778 100644 --- a/Dozentenmodulserver/src/server/BinaryListener.java +++ b/Dozentenmodulserver/src/server/BinaryListener.java @@ -28,7 +28,7 @@ public class BinaryListener implements Runnable return; } TServer server = new TSimpleServer( new Args( transport ).processor( processor ) ); - log.info(new Date() +" - Started Running Server"); + log.info(new Date() +" - Started running BinaryListener"); server.serve(); } diff --git a/Dozentenmodulserver/src/server/ServerHandler.java b/Dozentenmodulserver/src/server/ServerHandler.java index a707954b..3bf1eddf 100644 --- a/Dozentenmodulserver/src/server/ServerHandler.java +++ b/Dozentenmodulserver/src/server/ServerHandler.java @@ -19,154 +19,174 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; import org.apache.commons.io.FileUtils; +import org.apache.log4j.Logger; import org.apache.thrift.TException; import sql.SQL; import util.XMLCreator; - public class ServerHandler implements Server.Iface { - static SQL sql=new SQL(); - static Connection con=sql.getConnection(); + static SQL sql = new SQL(); + static Connection con = sql.getConnection(); + private static Logger log = Logger.getLogger(ServerHandler.class); + /** * @param args */ - /*public static void main(String[] args) { - // TODO Auto-generated method stub - - }*/ + /* + * public static void main(String[] args) { // TODO Auto-generated method + * stub + * + * } + */ @Override public User getFtpUser() throws TException { - User user=new User(); + log.info(new Date() + " - returing FTPUser..."); + User user = new User(); user.setUserName(UUID.randomUUID().toString().substring(0, 8)); - user.setPassword(getEncodedSha1Sum(UUID.randomUUID().toString().substring(0, 8))); + user.setPassword(getEncodedSha1Sum(UUID.randomUUID().toString() + .substring(0, 8))); user.setPath("/srv/openslx/nfs/temp"); - SQL sql=new SQL(); - Connection con=sql.getConnection(); + SQL sql = new SQL(); + Connection con = sql.getConnection(); sql.writeFTPUser(con, user.getUserName(), user.getPassword()); + log.info(new Date() + " - successfully returned FTPUser"); return user; } - public String getEncodedSha1Sum(String key) { - try { - MessageDigest md = MessageDigest.getInstance( "SHA1" ); - md.update( key.getBytes() ); - return new BigInteger(1, md.digest()).toString(16); - } - catch (NoSuchAlgorithmException e) { - // handle error case to taste - } + try { + log.info(new Date() + " - returned EncodedSha1Sum..."); + MessageDigest md = MessageDigest.getInstance("SHA1"); + md.update(key.getBytes()); + log.info(new Date() + " - successfully returned EncodedSha1Sum"); + return new BigInteger(1, md.digest()).toString(16); + } catch (NoSuchAlgorithmException e) { + // handle error case to taste + } return null; } @Override public long DeleteFtpUser(String user) throws TException { int ret = sql.DeleteUser(con, user); + log.info(new Date() + " - deleting FTPUser"); return ret; } @Override - public String getPathOfImage(String image_id, String version) throws TException { - + public String getPathOfImage(String image_id, String version) + throws TException { + try { - ResultSet rs=sql.getPathOfImage(con, image_id, version); + log.info(new Date() + " - returning PathOfImage..."); + ResultSet rs = sql.getPathOfImage(con, image_id, version); System.out.println("Path SQL erfolgreich"); rs.next(); System.out.println(rs.getString("image_path")); + log.info(new Date() + " - successfully returned PathOfImage: " + + rs.getString("image_path")); return rs.getString("image_path"); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + log.info(new Date() + " - returning PathOfImage: null"); return null; } @Override public boolean writeVLdata(String imagename, String firstname, String lastname, String university, String Mail, String Tel, - String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath) - throws TException { - String login="tete"; - - int pk_institution=sql.setInstitution(con, university); - - int pk_person=sql.setPerson(con, login, lastname, firstname, Mail, new Date(), pk_institution); - - sql.setImageData(con, pk_person, license, internet, cpu, ram, imagename, imagePath); + String Fak, boolean license, boolean internet, long ram, long cpu, + String imagePath) throws TException { + String login = "tete"; + + int pk_institution = sql.setInstitution(con, university); + + int pk_person = sql.setPerson(con, login, lastname, firstname, Mail, + new Date(), pk_institution); + + sql.setImageData(con, pk_person, license, internet, cpu, ram, + imagename, imagePath); + log.info(new Date() + " - writing VLdata"); // TODO Auto-generated method stub return true; } @Override public List<Image> getImageList() throws TException { - ResultSet res=sql.getImageList(con); - + ResultSet res = sql.getImageList(con); + List<Image> list = new ArrayList<Image>(); try { - - while(res.next()) - { - - list.add(new Image(res.getString("GUID_imageID"),res.getString("imageVersion"),res.getString("image_name"),res.getString("cond_hasLicenseRestriction"),res.getString("name"),res.getString("lecture"),res.getString("image_update_time"),res.getString("user"))); - + + while (res.next()) { + + list.add(new Image(res.getString("GUID_imageID"), res + .getString("imageVersion"), + res.getString("image_name"), res + .getString("cond_hasLicenseRestriction"), res + .getString("name"), res.getString("lecture"), + res.getString("image_update_time"), res + .getString("user"))); + } - + log.info(new Date() + " - returning ImageList: " + list.size()); return list; } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } - + log.info(new Date() + " - returning ImageList: " + list.size()); return null; } - @Override public List<String> getAllOS() throws TException { - List<String> list=new ArrayList<>(); - ResultSet rs=sql.getAllOS(con); + List<String> list = new ArrayList<>(); + ResultSet rs = sql.getAllOS(con); try { - while(rs.next()) - { + while (rs.next()) { list.add(rs.getString("name")); } + log.info(new Date() + " - returning AllOS: " + list.size()); return list; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } + log.info(new Date() + " - returning AllOS: " + list.size()); return null; } @Override public Map<String, String> getPersonData(String Vorname, String Nachname) throws TException { - Map<String,String> map=new HashMap<String, String>(); - - ResultSet rs=sql.getPersonData(con, Vorname, Nachname); + Map<String, String> map = new HashMap<String, String>(); + + ResultSet rs = sql.getPersonData(con, Vorname, Nachname); try { - while(rs.next()) - { - + while (rs.next()) { + map.put("mail", rs.getString("mail")); map.put("Nachname", rs.getString("Nachname")); map.put("Vorname", rs.getString("Vorname")); map.put("Hochschule", rs.getString("name")); - } + log.info(new Date() + " - returning PersonData: " + map.size()); return map; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } + log.info(new Date() + " - returning PersonData: " + map.size()); return null; } @@ -177,101 +197,115 @@ public class ServerHandler implements Server.Iface { String university, String Mail, String Tel, String Fak) throws TException { int pk_image = 0; - String login="tete"; + String login = "tete"; int imageversion = 0; - int pk_institution=sql.setInstitution(con, university); - int pk_person=sql.setPerson(con, login, lastname, firstname, Mail, new Date(), pk_institution); - - ResultSet image=sql.getImageIDandVersion(con, imagename); - - try { - while(image.next()) - { - pk_image=image.getInt("GUID_imageID"); - imageversion=image.getInt("imageVersion"); - } - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - - System.out.println(startDate); - sql.setLectureData(con, pk_person, pk_image, imageversion, name, desc, shortdesc, startDate, endDate, isActive); - XMLCreator xml=new XMLCreator(con, name); - try { - xml.create(name); - System.out.println(new Date() + " - Creator beendet"); - } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (TransformerException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + int pk_institution = sql.setInstitution(con, university); + int pk_person = sql.setPerson(con, login, lastname, firstname, Mail, + new Date(), pk_institution); + + ResultSet image = sql.getImageIDandVersion(con, imagename); + + try { + while (image.next()) { + pk_image = image.getInt("GUID_imageID"); + imageversion = image.getInt("imageVersion"); } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + System.out.println(startDate); + sql.setLectureData(con, pk_person, pk_image, imageversion, name, desc, + shortdesc, startDate, endDate, isActive); + XMLCreator xml = new XMLCreator(con, name); + try { + xml.create(name); + log.info(new Date() + " - XML created"); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ParserConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (TransformerException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } return false; } @Override public boolean startFileCopy(String file) throws TException { - File tmpFile=new File(file); + File tmpFile = new File(file); - System.out.println("Vor Move" +new Date()); + System.out.println("Vor Move" + new Date()); try { +<<<<<<< HEAD //der übergebene Filename ist falsch - hier muss der generierte name geholt werden, nicht der ursprüngliche name. wo wird dieser eingelesen? FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/"+tmpFile.getName())); +======= + // der übergebene Filename ist falsch - hier muss der generierte + // name geholt werden, nicht der ursprüngliche name. wo wird dieser + // eingelesen? + FileUtils.moveFile(tmpFile, new File("141.79.128.103:/srv/nfs4slx/" + + tmpFile.getName())); + log.info(new Date() + " - file moved"); +>>>>>>> 05f774a71379f4bb795fd5c072bfa71469e1c409 } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } - - System.out.println("Nach Move"+new Date()); return true; } - @Override - public Map<String, String> getImageData(String imageid, String imageversion) throws TException { - - ResultSet data=sql.getImageData(con, imageid, imageversion); - - Map<String,String> map=new HashMap<String, String>(); + public Map<String, String> getImageData(String imageid, String imageversion) + throws TException { + + ResultSet data = sql.getImageData(con, imageid, imageversion); + + Map<String, String> map = new HashMap<String, String>(); try { - while(data.next()) - { - System.out.println(data.getString("cond_hasInternetRestriction")+data.getString("cond_hasLicenseRestriction")+data.getString("cond_minCPUs")+data.getString("cond_minRAM")); - map.put("name",data.getString("image_name")); - map.put("internet", data.getString("cond_hasInternetRestriction")); + while (data.next()) { + System.out.println(data + .getString("cond_hasInternetRestriction") + + data.getString("cond_hasLicenseRestriction") + + data.getString("cond_minCPUs") + + data.getString("cond_minRAM")); + map.put("name", data.getString("image_name")); + map.put("internet", + data.getString("cond_hasInternetRestriction")); map.put("license", data.getString("cond_hasLicenseRestriction")); map.put("cpu", data.getString("cond_minCPUs")); map.put("ram", data.getString("cond_minRAM")); - + } System.out.println("return success"); + log.info(new Date() + " - returning ImageData: "+map.size()); return map; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } + log.info(new Date() + " - returning ImageData: "+map.size()); return null; } - @Override - public boolean updateImageData(String name, String newName,boolean license, - boolean internet, long ram, long cpu,String id, String version) throws TException { + public boolean updateImageData(String name, String newName, + boolean license, boolean internet, long ram, long cpu, String id, + String version) throws TException { System.out.println("Server: Vor Update"); - sql.UpdateImageData(con, name, newName ,license, internet, cpu, ram, id, version); + sql.UpdateImageData(con, name, newName, license, internet, cpu, ram, + id, version); System.out.println("Update erfolgreich"); + log.info(new Date() + " - updated ImageData"); return false; } - @Override public Map<String, String> getLectureData(String lecturename) throws TException { @@ -279,55 +313,60 @@ public class ServerHandler implements Server.Iface { return null; } - @Override public List<Lecture> getLectureList() throws TException { - ResultSet res=sql.getLectureList(con); - + ResultSet res = sql.getLectureList(con); + List<Lecture> list = new ArrayList<Lecture>(); try { - - while(res.next()) - { - - list.add(new Lecture(res.getString("lectureID"), res.getString("name"), res.getString("isActive"), res.getString("startTime"), res.getString("endTime"), res.getString("lastUsed"), res.getString("description"), res.getString("image_name"), res.getString("user"))); - - } - + while (res.next()) { + + list.add(new Lecture(res.getString("lectureID"), res + .getString("name"), res.getString("isActive"), res + .getString("startTime"), res.getString("endTime"), res + .getString("lastUsed"), res.getString("description"), + res.getString("image_name"), res.getString("user"))); + + } + log.info(new Date() + " - returning LectureList: "+list.size()); return list; } catch (SQLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } - + log.info(new Date() + " - returning LectureList: "+list.size()); return null; } +<<<<<<< HEAD +======= +>>>>>>> 05f774a71379f4bb795fd5c072bfa71469e1c409 @Override public boolean updateLecturedata(String name, String newName, String shortdesc, String desc, String startDate, String endDate, boolean isActive, String imagename, String firstname, String lastname, String university, String Mail, String Tel, String Fak, String id) throws TException { - int pk_image=0; - int imageversion=0; - ResultSet image=sql.getImageIDandVersion(con, imagename); + int pk_image = 0; + int imageversion = 0; + ResultSet image = sql.getImageIDandVersion(con, imagename); try { - while(image.next()) - { - pk_image=image.getInt("GUID_imageID"); - imageversion=image.getInt("imageVersion"); + while (image.next()) { + pk_image = image.getInt("GUID_imageID"); + imageversion = image.getInt("imageVersion"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } - sql.updateLectureData(con, pk_image, imageversion, lastname, newName, desc, shortdesc, startDate, endDate, isActive, id); + sql.updateLectureData(con, pk_image, imageversion, lastname, newName, + desc, shortdesc, startDate, endDate, isActive, id); + log.info(new Date() + " - updated LectureData"); return false; } diff --git a/Dozentenmodulserver/src/server/startServer.java b/Dozentenmodulserver/src/server/startServer.java index e1ab22c0..542c92b8 100644 --- a/Dozentenmodulserver/src/server/startServer.java +++ b/Dozentenmodulserver/src/server/startServer.java @@ -28,6 +28,8 @@ public class startServer { t = new Thread(new BinaryListener()); servers.add(t); t.start(); + //information + log.info( new Date()+" - new thread created. Now "+servers.size()+" thread(s).\n" ); // Run more servers // ... // Wait for all servers to die diff --git a/Dozentenmodulserver/src/sql/SQL.java b/Dozentenmodulserver/src/sql/SQL.java index 1c34d226..daffbf0b 100644 --- a/Dozentenmodulserver/src/sql/SQL.java +++ b/Dozentenmodulserver/src/sql/SQL.java @@ -459,7 +459,9 @@ public class SQL { */
public boolean deleteImage(Connection con, String id, String version) {
-
+
+ System.out.println("delete image");
+
try {
Statement stm=con.createStatement();
|