diff options
| author | Michael Wilson | 2014-10-27 18:13:20 +0100 |
|---|---|---|
| committer | Michael Wilson | 2014-10-27 18:13:20 +0100 |
| commit | 0ed4549c028e2523534a09fd6e41c49c9d178ec1 (patch) | |
| tree | b7a829b485b644eadb4801faad15be8a81c723b1 | |
| parent | Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module (diff) | |
| download | tutor-module-0ed4549c028e2523534a09fd6e41c49c9d178ec1.tar.gz tutor-module-0ed4549c028e2523534a09fd6e41c49c9d178ec1.tar.xz tutor-module-0ed4549c028e2523534a09fd6e41c49c9d178ec1.zip | |
Sämtliche Logik und Grafiken zur Vergabe und Verwaltung von Berechtigungen eingeführt. Kleinere Bugs sind bekannt, werden aktuell behoben
18 files changed, 6153 insertions, 2408 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java index 09cf5dd8..239b5a0f 100644 --- a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java @@ -1,6 +1,7 @@ package gui.image; import gui.intro.About_GUI; +import gui.intro.ListAllOtherUsers_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -77,6 +78,8 @@ public class PermissionCreateImage_GUI extends JFrame { private List<Person> map = null; // List of people who have rights Component c = null; // Map<String,String> ogUsers = new HashMap(); + + List<String> user = new ArrayList<String>(); final DefaultTableModel model = new DefaultTableModel(titles, 0) { @@ -112,6 +115,8 @@ public class PermissionCreateImage_GUI extends JFrame { + "implizit freigeben darf. Eine Person mit Adminrechten darf zusätzlich das Image löschen und Berechtigungen<br />" + "für andere Benutzer festlegen und ist somit wie der Besitzer zu betrachten." + "</div></html>"; + private JButton btnAddUser; + private JButton btnDeleteUser; public PermissionCreateImage_GUI(Component formerGUI) { addWindowListener(new WindowAdapter() { @@ -165,16 +170,16 @@ public class PermissionCreateImage_GUI extends JFrame { JPanel panel_1 = new JPanel(); panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Berechtigungen", + panel_1.setBorder(new TitledBorder(null, "Weitere Berechtigungen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); - panel_1.setBounds(10, 170, 557, 354); + panel_1.setBounds(10, 170, 557, 361); contentPanel.add(panel_1); panel_1.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBounds(10, 21, 537, 228); + scrollPane.setBounds(10, 21, 537, 185); panel_1.add(scrollPane); table = new JTable(); @@ -193,13 +198,20 @@ public class PermissionCreateImage_GUI extends JFrame { table.getColumnModel().getColumn(5).setWidth(0); table.getColumnModel().getColumn(5).setMinWidth(0); table.getColumnModel().getColumn(5).setMaxWidth(0); - - // if new session, get values for table from database + + + // if new session, get values for table from database -> initialiting users if (RightsManagement.rightsManagement.getPermittedUserList().size() <= 0) { System.out.println("Loading data from db"); - try { - map = client.getAllOtherSatelliteUsers(person.verantwortlicher - .getUserID()); + //do nothing + /*try { + + user.add(0, person.verantwortlicher.getUserID()); + if(user==null){ + System.out.println("user is null"); + } + //map = client.getAllOtherSatelliteUsers(person.verantwortlicher.getUserID()); + map = client.getAllOtherSatelliteUsers(user); Iterator<server.generated.Person> i = map.iterator(); int x = 0; @@ -224,7 +236,7 @@ public class PermissionCreateImage_GUI extends JFrame { } catch (TException e1) { // TODO Auto-generated catch block e1.printStackTrace(); - } + }*/ } else // read from model { System.out.println("reading from model"); @@ -239,7 +251,6 @@ public class PermissionCreateImage_GUI extends JFrame { int x = 0; while (i.hasNext()) { - // System.out.println("current pos=" + x); // erzeuge Objekte fuer die Tabelle person temp = i.next(); @@ -259,14 +270,16 @@ public class PermissionCreateImage_GUI extends JFrame { x++; } }// end set list of permitted users + - TableCellRenderer rend = table.getTableHeader().getDefaultRenderer(); + //TableCellRenderer rend = table.getTableHeader().getDefaultRenderer(); TableColumn tc1 = table.getColumnModel().getColumn(1); tc1.setCellEditor(table.getDefaultEditor(Boolean.class)); tc1.setCellRenderer(table.getDefaultRenderer(Boolean.class)); tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(), (String) titles[1])); + // tc1.setCellRenderer(cellRenderer) TableColumn tc2 = table.getColumnModel().getColumn(2); @@ -286,7 +299,8 @@ public class PermissionCreateImage_GUI extends JFrame { tc4.setCellRenderer(table.getDefaultRenderer(Boolean.class)); tc4.setHeaderRenderer(new CheckBoxHeader(new MyItemListener4(), (String) titles[4])); - + + scrollPane.setViewportView(table); JPanel panel = new JPanel(); @@ -309,6 +323,37 @@ public class PermissionCreateImage_GUI extends JFrame { comboBox_1.setSelectedIndex(0); comboBox_1.setBounds(270, 30, 250, 20); panel.add(comboBox_1); + + btnAddUser = new JButton("Hinzufügen..."); + btnAddUser.setBounds(10, 217, 113, 23); + panel_1.add(btnAddUser); + + btnDeleteUser = new JButton("Löschen"); + btnDeleteUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // delete selected users from table + int[] deletableRows= table.getSelectedRows(); + int pointerCorrection=0; //after deleting a row, the length of selected rows is reduced by 1. This pointer counts the already deleted rows and correct the offset of i + LOGGER.info("deletabelRows.length="+deletableRows.length); + + for (int i=0; i<deletableRows.length; i++){ + + LOGGER.info("Deleting rowCount["+i+"], tableRow number "+deletableRows[i-pointerCorrection]); + model.removeRow(deletableRows[i-pointerCorrection]); + pointerCorrection++; + } + } + }); + btnDeleteUser.setBounds(134, 217, 113, 23); + panel_1.add(btnDeleteUser); + btnAddUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //show list of all other relevant users + ListAllOtherUsers_GUI lu = new ListAllOtherUsers_GUI(c, table, 5); //give access to the table model and inform that the userID is position 5 in the model + lu.setVisible(true); + } + }); JLabel lblHauptmen = new JLabel("Hauptmenü"); lblHauptmen.addMouseListener(new MouseAdapter() { @@ -509,8 +554,8 @@ public class PermissionCreateImage_GUI extends JFrame { } }); menuBar.add(mnNewMenu_Info); - c = this; - + c = this; + this.setLocationRelativeTo(formerGUI); this.setVisible(true); }// end constructor @@ -673,7 +718,6 @@ public class PermissionCreateImage_GUI extends JFrame { RightsManagement.rightsManagement.setPermittedUserList(list); }// end saveTableToList() - } // end class class CheckBoxHeader extends JCheckBox implements TableCellRenderer, diff --git a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java index 9ab70a5f..8de41289 100644 --- a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java @@ -1,6 +1,7 @@ package gui.image; import gui.intro.About_GUI; +import gui.intro.ListAllOtherUsers_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -25,7 +26,6 @@ import java.util.List; import javax.swing.AbstractButton; import javax.swing.DefaultComboBoxModel; import javax.swing.JButton; -import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; @@ -37,7 +37,6 @@ import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JSeparator; import javax.swing.JTable; -import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.ScrollPaneConstants; import javax.swing.UIManager; @@ -48,21 +47,24 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; -import org.apache.thrift.TException; - import models.Image; import models.Links; import models.RightsManagement; import models.person; + +import org.apache.log4j.Logger; +import org.apache.thrift.TException; + import server.generated.Person; import server.generated.Server.Client; import util.CheckIntegrity; -import util.GuiOrganizer; import util.OpenLinks; @SuppressWarnings("serial") public class PermissionEditImage_GUI extends JFrame { - + + private final static Logger LOGGER = Logger + .getLogger(PermissionCreateImage_GUI.class); Client client = models.Client.clientcon.getClient(); private final JPanel contentPanel = new JPanel(); String[] result; @@ -156,7 +158,7 @@ public class PermissionEditImage_GUI extends JFrame { JPanel panel_1 = new JPanel(); panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Berechtigungen", + panel_1.setBorder(new TitledBorder(null, "Weitere Berechtigungen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_1.setBounds(10, 170, 557, 354); contentPanel.add(panel_1); @@ -165,7 +167,7 @@ public class PermissionEditImage_GUI extends JFrame { JScrollPane scrollPane = new JScrollPane(); scrollPane .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBounds(10, 21, 537, 228); + scrollPane.setBounds(10, 21, 537, 185); panel_1.add(scrollPane); table = new JTable(); @@ -314,6 +316,39 @@ public class PermissionEditImage_GUI extends JFrame { comboBox_1.setSelectedIndex(Image.image.getShareMode()); comboBox_1.setBounds(270, 30, 250, 20); panel_2.add(comboBox_1); + + JButton btnAddUser = new JButton("Hinzufügen..."); + btnAddUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + //show list of all other relevant users + ListAllOtherUsers_GUI lu = new ListAllOtherUsers_GUI(c, table, 5); //give access to the table model and inform that the userID is position 5 in the model + lu.setVisible(true); + + } + }); + btnAddUser.setBounds(10, 217, 113, 23); + panel_1.add(btnAddUser); + + JButton btnDeleteUser = new JButton("Löschen"); + btnDeleteUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + + // delete selected users from table + int[] deletableRows= table.getSelectedRows(); + int pointerCorrection=0; //after deleting a row, the length of selected rows is reduced by 1. This pointer counts the already deleted rows and correct the offset of i + LOGGER.info("deletabelRows.length="+deletableRows.length); + + for (int i=0; i<deletableRows.length; i++){ + + LOGGER.info("Deleting rowCount["+i+"], tableRow number "+deletableRows[i-pointerCorrection]); + model.removeRow(deletableRows[i-pointerCorrection]); + pointerCorrection++; + } + } + }); + btnDeleteUser.setBounds(133, 217, 113, 23); + panel_1.add(btnDeleteUser); JLabel lblHauptmen = new JLabel("Hauptmenü"); lblHauptmen.addMouseListener(new MouseAdapter() { @@ -672,40 +707,5 @@ public class PermissionEditImage_GUI extends JFrame { } } } -} - -/* - * class CheckBoxHeader extends JCheckBox implements TableCellRenderer, - * MouseListener { protected CheckBoxHeader rendererComponent; protected int - * column; protected boolean mousePressed = false; - * - * public CheckBoxHeader(ItemListener itemListener ,String text) { - * rendererComponent = this; rendererComponent.addItemListener(itemListener); - * rendererComponent.setText(text); } - * - * public Component getTableCellRendererComponent( JTable table, Object value, - * boolean isSelected, boolean hasFocus, int row, int column) { if (table != - * null) { JTableHeader header = table.getTableHeader(); if (header != null) { - * rendererComponent.setForeground(header.getForeground()); - * rendererComponent.setBackground(header.getBackground()); - * rendererComponent.setFont(header.getFont()); - * rendererComponent.setBorder(header.getBorder()); - * header.addMouseListener(rendererComponent); } } setColumn(column); - * //rendererComponent.setText("Check All"); - * //setBorder(UIManager.getBorder("TableHeader.cellBorder")); - * - * return rendererComponent; } protected void setColumn(int column) { - * this.column = column; } public int getColumn() { return column; } protected - * void handleClickEvent(MouseEvent e) { if (mousePressed) { mousePressed=false; - * JTableHeader header = (JTableHeader)(e.getSource()); JTable tableView = - * header.getTable(); TableColumnModel columnModel = tableView.getColumnModel(); - * int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = - * tableView.convertColumnIndexToModel(viewColumn); - * - * if (viewColumn == this.column && e.getClickCount() == 1 && column != -1) { - * doClick(); } } } public void mouseClicked(MouseEvent e) { - * handleClickEvent(e); ((JTableHeader)e.getSource()).repaint(); } public void - * mousePressed(MouseEvent e) { mousePressed = true; } public void - * mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } - * public void mouseExited(MouseEvent e) { } } - */ +}// end class + diff --git a/dozentenmodul/src/main/java/gui/intro/ListAllOtherUsers_GUI.java b/dozentenmodul/src/main/java/gui/intro/ListAllOtherUsers_GUI.java new file mode 100644 index 00000000..c67ad6cb --- /dev/null +++ b/dozentenmodul/src/main/java/gui/intro/ListAllOtherUsers_GUI.java @@ -0,0 +1,417 @@ +package gui.intro; + +import gui.intro.About_GUI; +import gui.intro.MainMenue_GUI; + +import java.awt.Color; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.SystemColor; +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.net.URI; +import java.net.URISyntaxException; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.swing.DefaultListSelectionModel; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.JTable; +import javax.swing.JTextArea; +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.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.DefaultTableModel; +import javax.swing.table.TableModel; +import javax.swing.table.TableRowSorter; + +import models.Links; +import models.person; + +import org.apache.log4j.Logger; +import org.apache.thrift.TException; + +import server.generated.Person; +import server.generated.Server.Client; +import thrift.ThriftConnection; +import util.OpenLinks; +import javax.swing.ListSelectionModel; + +@SuppressWarnings("serial") +public class ListAllOtherUsers_GUI extends JFrame { + + private final static Logger LOGGER = Logger + .getLogger(ListAllOtherUsers_GUI.class); + + private final JPanel contentPanel = new JPanel(); + String[] result; + JTable tableUsers; + boolean activeSearch = false; + + String[] titles = { "userID", "Nachname", "Vorname", "Mail" }; + + ThriftConnection con = new ThriftConnection(); + Client client = models.Client.clientcon.getClient(); + final DefaultTableModel modelUsers = new DefaultTableModel(titles, 0); + final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( + modelUsers); + private JButton btnAdd; + private List<Person> map = null; // List of people + private JTextField textField; + Component c = null; + private JTable table; + private int userIDPos; + + List<String> user = new ArrayList<String>(); + + private static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "In der Übersicht sehen Sie primär alle Veranstaltungen, die Sie erzeugt haben.<br />" + + "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete Einträge irgendwann automatisch gelöscht.<br />" + + "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + + "</div></html>"; + + /** + * + * Constructor + */ + + public ListAllOtherUsers_GUI(Component formerGUI, final JTable table, + final int userIDPos) { + + // get table model to work with + final DefaultTableModel model = (DefaultTableModel) table.getModel(); + + //set incoming table + this.table=table; + this.userIDPos=userIDPos; + + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent arg0) { + // Beendet die Anwendung nach klick auf X + con.closeThriftConnection(); + dispose(); + } + + @Override + public void windowOpened(WindowEvent arg0) { + + // auszublendende Angaben + // 0=userID + + tableUsers.getColumnModel().getColumn(0).setWidth(0); + tableUsers.getColumnModel().getColumn(0).setMinWidth(0); + tableUsers.getColumnModel().getColumn(0).setMaxWidth(0); + } + }); + // Verhindert das Vergroessern Des Fensters + setResizable(false); + + try { + // Setzt das Look & Feel auf System + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException | UnsupportedLookAndFeelException e) { + + e.printStackTrace(); + } + // Setzt den Fenstertitel + setTitle("bwLehrpool Suite - Benutzer hinzufügen"); + // Zentriert das Fenster in die Bildmitte + setBounds(0, 0, 531, 673); + setLocationRelativeTo(formerGUI); + + getContentPane().setLayout(null); + { + JPanel panel = new JPanel(); + panel.setBackground(SystemColor.menu); + panel.setBounds(10, 11, 570, 57); + getContentPane().add(panel); + panel.setLayout(null); + { + JLabel lblNewLabel = new JLabel("Benutzer hinzufügen"); + 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("Wählen Sie bitte aus der unten stehenden Liste Benutzer aus, denen Sie Rechte vergeben möchten."); + txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); + panel.add(txtpnBitteWhlenSie); + } + contentPanel.setBounds(10, 176, 498, 359); + contentPanel.setBackground(SystemColor.menu); + contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); + getContentPane().add(contentPanel); + contentPanel.setLayout(null); + JScrollPane scrollPaneMyImage = new JScrollPane(); + scrollPaneMyImage.setBounds(0, 0, 498, 359); + contentPanel.add(scrollPaneMyImage); + tableUsers = new JTable(); + tableUsers.setSelectionModel(new MyDefaultListSelectionModel()); + + tableUsers.setModel(modelUsers); + + tableUsers.getColumnModel().getColumn(1).sizeWidthToFit();// Nachname + tableUsers.getColumnModel().getColumn(2).sizeWidthToFit();// Vorname + tableUsers.getColumnModel().getColumn(3).sizeWidthToFit();// email + + // initialize content + initTableContent(); + + tableUsers.setRowSorter(rowSorterAll); + + scrollPaneMyImage.setViewportView(tableUsers); + { + JPanel buttonPane = new JPanel(); + buttonPane.setBounds(0, 568, 508, 33); + buttonPane.setBackground(SystemColor.menu); + buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); + getContentPane().add(buttonPane); + + btnAdd = new JButton("Übernehmen und schließen"); + buttonPane.add(btnAdd); + { + JButton btnCancel = new JButton("Abbrechen"); + buttonPane.add(btnCancel); + btnCancel.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // only close window + dispose(); + } + }); + btnCancel.setActionCommand("OK"); + getRootPane().setDefaultButton(btnCancel); + } + btnAdd.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // save the user list and go back to last GUI + int pos = 0; // pointer for array + int[] selectedRows = tableUsers.getSelectedRows(); // list + + // check if a row is selected + if (selectedRows.length > 0) { + // step through entries + for (int i = 0; i < selectedRows.length; i++) { + // get userID and write it to the table in former + // GUI + + if (table.getColumnCount() == 6) { // is it an image + // GUI? + + Object[] obj = { + tableUsers.getValueAt( + selectedRows[pos], 1) + + ", " + + tableUsers.getValueAt( + selectedRows[pos], 2), // Nachname + // und + // Vorname + false, // Read image + false, // Write image + false, // Link image + false, // Admin image + tableUsers.getValueAt( + selectedRows[pos], 0) // userID + }; + model.addRow(obj); + + } else if (table.getColumnCount() == 5) { // is it a + // lecture + // GUI? + Object[] obj = { + tableUsers.getValueAt( + selectedRows[pos], 1) + + ", " + + tableUsers.getValueAt( + selectedRows[pos], 2), // Nachname + // und + // Vorname + false, // Read image + false, // Write image + false, // Admin image + tableUsers.getValueAt( + selectedRows[pos], 0) // userID + }; + model.addRow(obj); + } + + System.out.println("Info in row(" + + pos + + ") is=" + + tableUsers.getValueAt(selectedRows[pos], + 0)); + pos++;// next selected row + } + }// end if + + dispose(); + }// end actionPerformed + }); + } + + JSeparator separator = new JSeparator(); + separator.setBounds(0, 79, 836, 1); + getContentPane().add(separator); + + JSeparator separator_1 = new JSeparator(); + separator_1.setBounds(0, 552, 836, 1); + 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"); + mntmFaq.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + + URI windows; + try { + windows = new URI(Links.getFAQ()); + open.openWebpage(windows); + } catch (URISyntaxException e) { + + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmFaq); + + JMenuItem mntmOtrs = new JMenuItem("OTRS"); + mntmOtrs.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent arg0) { + + OpenLinks open = new OpenLinks(); + URI windows; + try { + windows = new URI(Links.getOTRS()); + open.openWebpage(windows); + } catch (URISyntaxException e) { + e.printStackTrace(); + } + } + }); + mnNewMenu_1.add(mntmOtrs); + + JMenuItem mntmAbout = new JMenuItem("About"); + mntmAbout.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + About_GUI ab = new About_GUI(); + ab.setVisible(true); + } + }); + mnNewMenu_1.add(mntmAbout); + + JMenu mnNewMenu_Info = new JMenu("Info"); + mnNewMenu_Info.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent arg0) { + JOptionPane.showMessageDialog(c, HELP_MESSAGE, + "Hilfe zu dieser Oberfläche", + JOptionPane.INFORMATION_MESSAGE); + } + }); + menuBar.add(mnNewMenu_Info); + + c = this; + + } + + + // get users from db which are not in listed in the permission yet + public void initTableContent() { + + LOGGER.info("Getting list of all other users from server"); + try { + + //set users which are NOT to be listed in table + //logged on user + System.out.println("adding value'"+ person.verantwortlicher.getUserID()); + user.add(0, person.verantwortlicher.getUserID()); + + //users already in table + for(int y=0; y<table.getRowCount(); y++){ + System.out.println("adding value'"+table.getValueAt(y, userIDPos)+"'"); + user.add(""+table.getValueAt(y, userIDPos)); + } + System.out.println("user has '"+user.size()+"' elements."); + + + //get the info + map = client.getAllOtherSatelliteUsers(user); + Iterator<server.generated.Person> i = map.iterator(); + + int x = 0; + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { map.get(x).getUserID(), // userID + map.get(x).getNachname(), // Nachname + map.get(x).getVorname(),// Vorname + map.get(x).getMail() // EMail + }; + // Fuege diese Objekte der Tabelle hinzu + modelUsers.addRow(obj); + i.next(); + x++; + }// end while + + } catch (TException e2) { + LOGGER.info("Failed to get List of users from server"); + e2.printStackTrace(); + } + }// end initTableContent +}// end class ListAllOtherUsers + +@SuppressWarnings("serial") +class MyDefaultListSelectionModel extends DefaultListSelectionModel { + + public MyDefaultListSelectionModel() { + super(); + } + + public void setSelectionInterval(int index0, int index1) { + if (isSelectedIndex(index0)) { + super.removeSelectionInterval(index0, index1); + } else { + super.addSelectionInterval(index0, index1); + } + } +}// end class MyDefaultListSelectionModel
\ No newline at end of file diff --git a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java index 04a74ab8..fd95bd8d 100644 --- a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java +++ b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java @@ -45,7 +45,9 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import models.GUIRights; +import models.Image; import models.ImageRights; +import models.Lecture; import models.Links; import models.RightsManagement; import models.SessionData; @@ -139,6 +141,7 @@ public class MainMenue_GUI extends JFrame { //reset the list of permissions every time the user goes back to the main menu RightsManagement.rightsManagement.getPermittedUserList().clear(); + contentPanel.setBounds(10, 104, 567, 502); contentPanel.setBackground(SystemColor.menu); @@ -504,14 +507,13 @@ public class MainMenue_GUI extends JFrame { - - - - - c = this; }// end main + + + + /** * Enables/disables radio button given the user's rights */ diff --git a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java index 8d85ed47..2f4d958a 100644 --- a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java @@ -51,8 +51,10 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import models.Image; import models.Lecture; import models.Links; +import models.RightsManagement; import models.person; import org.apache.thrift.TException; @@ -175,53 +177,7 @@ public class CreateLectureLink_GUI extends JFrame { tablemyImages.getColumnModel().getColumn(7).setWidth(0); tablemyImages.getColumnModel().getColumn(7).setMinWidth(0); tablemyImages.getColumnModel().getColumn(7).setMaxWidth(0); - /* - * tablePublicVorlagen.getColumnModel().getColumn(1).setWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(1).setMinWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(1).setMaxWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(3).setWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(3).setMinWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(3).setMaxWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(8).setWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(8).setMinWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(8).setMaxWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(6).setWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(6).setMinWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(6).setMaxWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(7).setWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(7).setMinWidth(0); - * tablePublicVorlagen - * .getColumnModel().getColumn(7).setMaxWidth(0); - * - * tableAllImages.getColumnModel().getColumn(1).setWidth(0); - * tableAllImages.getColumnModel().getColumn(1).setMinWidth(0); - * tableAllImages.getColumnModel().getColumn(1).setMaxWidth(0); - * tableAllImages.getColumnModel().getColumn(3).setWidth(0); - * tableAllImages.getColumnModel().getColumn(3).setMinWidth(0); - * tableAllImages.getColumnModel().getColumn(3).setMaxWidth(0); - * tableAllImages.getColumnModel().getColumn(8).setWidth(0); - * tableAllImages.getColumnModel().getColumn(8).setMinWidth(0); - * tableAllImages.getColumnModel().getColumn(8).setMaxWidth(0); - * tableAllImages.getColumnModel().getColumn(6).setWidth(0); - * tableAllImages.getColumnModel().getColumn(6).setMinWidth(0); - * tableAllImages.getColumnModel().getColumn(6).setMaxWidth(0); - * tableAllImages.getColumnModel().getColumn(7).setWidth(0); - * tableAllImages.getColumnModel().getColumn(7).setMinWidth(0); - * tableAllImages.getColumnModel().getColumn(7).setMaxWidth(0); - */ + textFieldName.requestFocusInWindow(); } }); @@ -466,6 +422,8 @@ public class CreateLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); + + //create new lecture client.writeLecturedata( Lecture.lecture.getName(), Lecture.lecture.getShortDesc(), @@ -485,6 +443,8 @@ public class CreateLectureLink_GUI extends JFrame { person.verantwortlicher.getEMail(), person.verantwortlicher.getTel(), person.verantwortlicher.getFakultaet()); + + //set rights for this user client.writeLectureRights( Lecture.lecture.getName(), person.verantwortlicher.getUsername(), @@ -493,6 +453,21 @@ public class CreateLectureLink_GUI extends JFrame { person.verantwortlicher.getEMail(), person.verantwortlicher.getHochschule(), person.verantwortlicher.getRole()); + + //set rights for additional users + for(int i=0; i< RightsManagement.rightsManagement.getPermittedUserList().size(); i++){ + System.out.println("Writing additional rights for user "+RightsManagement.rightsManagement.getPermittedUserList().get(i).getUserID()+", User "+(i+1)+"/"+RightsManagement.rightsManagement.getPermittedUserList().size()); + client.writeAdditionalLectureRights( + Lecture.lecture.getName(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).getUserID(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isLecture_read(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isLecture_write(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isLecture_admin() + ); + + }//end for + + JOptionPane .showMessageDialog( c, @@ -519,103 +494,6 @@ public class CreateLectureLink_GUI extends JFrame { dispose(); - /* - * }else if (tablePublicVorlagen.getSelectedRow() != - * -1){ - * - * // a row is selected, do operations String - * imagename = tablePublicVorlagen.getValueAt( - * tablePublicVorlagen.getSelectedRow(), 0) - * .toString(); try { DateFormat formatter = new - * SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - * client.writeLecturedata( - * Lecture.lecture.getName(), - * Lecture.lecture.getShortDesc(), - * Lecture.lecture.getDesc(), formatter.format( - * Lecture.lecture.getStartdate()) .toString(), - * formatter.format( Lecture.lecture.getEnddate()) - * .toString(), Lecture.lecture.isActive(), - * imagename, person.verantwortlicher.getUsername(), - * person.verantwortlicher.getVorname(), - * person.verantwortlicher.getName(), - * person.verantwortlicher.getHochschule(), - * person.verantwortlicher.getEMail(), - * person.verantwortlicher.getTel(), - * person.verantwortlicher.getFakultaet()); - * client.writeLectureRights - * (Lecture.lecture.getName(), - * person.verantwortlicher.getUsername(), - * person.verantwortlicher.getName(), - * person.verantwortlicher.getVorname(), - * person.verantwortlicher.getEMail(), - * person.verantwortlicher.getHochschule(), - * person.verantwortlicher.getRole()); JOptionPane - * .showMessageDialog( c, - * "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmenü zurück." - * , "Veranstaltung angelegt", - * JOptionPane.INFORMATION_MESSAGE); // zurueck zum - * Menue MainMenue_GUI m = new MainMenue_GUI(c); - * m.setVisible(true); } catch (TException e1) { // - * TODO Auto-generated catch block - * e1.printStackTrace(); JOptionPane - * .showMessageDialog( c, - * "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten." - * , "Error", JOptionPane.ERROR_MESSAGE); - * JOptionPane.showMessageDialog(c, - * e1.getCause()+"\n"+e1.getStackTrace(), - * "Debug-Message", JOptionPane.ERROR_MESSAGE); } - * - * dispose(); - * - * }else if (tableAllImages.getSelectedRow() != -1 - * &&tableAllImages.getValueAt(tableAllImages. - * getSelectedRow(), - * 4).toString().equals(username)){ - * - * // a row is selected, do operations String - * imagename = tableAllImages.getValueAt( - * tableAllImages.getSelectedRow(), 0) .toString(); - * try { DateFormat formatter = new - * SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); - * client.writeLecturedata( - * Lecture.lecture.getName(), - * Lecture.lecture.getShortDesc(), - * Lecture.lecture.getDesc(), formatter.format( - * Lecture.lecture.getStartdate()) .toString(), - * formatter.format( Lecture.lecture.getEnddate()) - * .toString(), Lecture.lecture.isActive(), - * imagename, person.verantwortlicher.getUsername(), - * person.verantwortlicher.getVorname(), - * person.verantwortlicher.getName(), - * person.verantwortlicher.getHochschule(), - * person.verantwortlicher.getEMail(), - * person.verantwortlicher.getTel(), - * person.verantwortlicher.getFakultaet()); - * client.writeLectureRights - * (Lecture.lecture.getName(), - * person.verantwortlicher.getUsername(), - * person.verantwortlicher.getName(), - * person.verantwortlicher.getVorname(), - * person.verantwortlicher.getEMail(), - * person.verantwortlicher.getHochschule(), - * person.verantwortlicher.getRole()); JOptionPane - * .showMessageDialog( c, - * "Ihre Veranstaltung wurde erfolgreich angelegt. Sie kehren nun zum Hauptmenü zurück." - * , "Veranstaltung angelegt", - * JOptionPane.INFORMATION_MESSAGE); // zurueck zum - * Menue MainMenue_GUI m = new MainMenue_GUI(c); - * m.setVisible(true); } catch (TException e1) { // - * TODO Auto-generated catch block - * e1.printStackTrace(); JOptionPane - * .showMessageDialog( c, - * "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten." - * , "Error", JOptionPane.ERROR_MESSAGE); - * JOptionPane.showMessageDialog(c, - * e1.getCause()+"\n"+e1.getStackTrace(), - * "Debug-Message", JOptionPane.ERROR_MESSAGE); } - * - * dispose(); - */ } else { // nothing selected JOptionPane.showMessageDialog(c, diff --git a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java index cbde2d18..38d29620 100644 --- a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java @@ -1,7 +1,6 @@ package gui.lecture; import gui.intro.About_GUI; -import gui.intro.Login_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -36,19 +35,15 @@ 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.JTextArea; import javax.swing.JTextField; import javax.swing.JTextPane; import javax.swing.RowFilter; -import javax.swing.ScrollPaneConstants; 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.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.DefaultTableModel; @@ -63,13 +58,13 @@ import org.apache.thrift.TException; import server.generated.Server.Client; import thrift.ThriftConnection; -import util.GuiOrganizer; import util.OpenLinks; @SuppressWarnings("serial") public class DeleteLecture_GUI extends JFrame { - - private final static Logger LOGGER = Logger.getLogger(DeleteLecture_GUI.class); + + private final static Logger LOGGER = Logger + .getLogger(DeleteLecture_GUI.class); private final JPanel contentPanel = new JPanel(); String[] result; @@ -85,11 +80,11 @@ public class DeleteLecture_GUI extends JFrame { JLabel labelVerantwortlicher; JTable tablemyLectures; private JTextField textFieldName; - boolean activeSearch=false; + boolean activeSearch = false; String[] titles = { "Veranstaltungsname", "Beschreibung", "Gültigkeitsdatum", "Aktiv", "Letzte Benutzung", "Verantwortlicher", "Image", "Schlagwort", "ID" }; - + ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); final DefaultTableModel modelAll = new DefaultTableModel(titles, 0); @@ -102,15 +97,13 @@ public class DeleteLecture_GUI extends JFrame { private JTextField textField; Component c = null; - - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "In der Übersicht sehen Sie primär alle Veranstaltungen, die Sie erzeugt haben.<br />" + - "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete Einträge irgendwann automatisch gelöscht.<br />" + - "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + - "</div></html>"; + private static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "In der Übersicht sehen Sie primär alle Veranstaltungen, die Sie erzeugt haben.<br />" + + "Sie können die Veranstaltungen hier löschen. Alternativ werden veraltete Einträge irgendwann automatisch gelöscht.<br />" + + "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + + "</div></html>"; - /** * Create the dialog. */ @@ -122,6 +115,7 @@ public class DeleteLecture_GUI extends JFrame { con.closeThriftConnection(); System.exit(0); } + @Override public void windowOpened(WindowEvent arg0) { textFieldName.requestFocusInWindow(); @@ -133,7 +127,7 @@ public class DeleteLecture_GUI extends JFrame { // TODO Auto-generated catch block e.printStackTrace(); } - + // auszublendende Angaben // 1=Beschreibung // 2=Gültigkeitsdatum @@ -159,27 +153,39 @@ public class DeleteLecture_GUI extends JFrame { tablemyLectures.getColumnModel().getColumn(8).setWidth(0); tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0); tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0); - + /* - tableAllLectures.getColumnModel().getColumn(1).setWidth(0); - tableAllLectures.getColumnModel().getColumn(1).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(1).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setMaxWidth(0); - */ + * tableAllLectures.getColumnModel().getColumn(1).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(1).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(1).setMaxWidth(0); + * tableAllLectures.getColumnModel().getColumn(2).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(2).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(2).setMaxWidth(0); + * tableAllLectures.getColumnModel().getColumn(3).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(3).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(3).setMaxWidth(0); + * tableAllLectures.getColumnModel().getColumn(6).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(6).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(6).setMaxWidth(0); + * tableAllLectures.getColumnModel().getColumn(7).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(7).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(7).setMaxWidth(0); + * tableAllLectures.getColumnModel().getColumn(8).setWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(8).setMinWidth(0); + * tableAllLectures + * .getColumnModel().getColumn(8).setMaxWidth(0); + */ } }); // Verhindert das Vergroessern Des Fensters @@ -199,7 +205,6 @@ public class DeleteLecture_GUI extends JFrame { setBounds(0, 0, 842, 722); setLocationRelativeTo(formerGUI); - getContentPane().setLayout(null); { JPanel panel = new JPanel(); @@ -250,15 +255,15 @@ public class DeleteLecture_GUI extends JFrame { String stext = textFieldName.getText(); // Wenn Textfield nicht leer if (stext != "") { - activeSearch=true; + activeSearch = true; // Filtere nach der Eingabe rowSorterAll.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); - }else{ - activeSearch=false; + } else { + activeSearch = false; String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname(); rowSorterMyLectures.setRowFilter(RowFilter.regexFilter( @@ -277,7 +282,7 @@ public class DeleteLecture_GUI extends JFrame { @Override public void mouseClicked(MouseEvent arg0) { // oeffnet das Hauptmenue - + DeleteLecture_GUI.this.setVisible(false); MainMenue_GUI main = new MainMenue_GUI(c); main.setVisible(true); @@ -307,38 +312,36 @@ public class DeleteLecture_GUI extends JFrame { scrollPaneMyImage.setBounds(10, 120, 552, 369); contentPanel.add(scrollPaneMyImage); tablemyLectures = new JTable(); - tablemyLectures.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - String imageid = modelMyLectures - .getValueAt( + tablemyLectures.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + String imageid = modelMyLectures.getValueAt( tablemyLectures .convertRowIndexToModel(tablemyLectures .getSelectedRow()), 8) - .toString(); - - try { - writeLectureData(imageid); - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } catch (ParseException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - } - }); + .toString(); + + try { + writeLectureData(imageid); + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } catch (ParseException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } + }); tablemyLectures.setModel(modelMyLectures); - - tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); - tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); - tablemyLectures.setRowSorter(rowSorterMyLectures); - - scrollPaneMyImage.setViewportView(tablemyLectures); + + tablemyLectures.getColumnModel().getColumn(1).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(2).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(3).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(4).sizeWidthToFit(); + tablemyLectures.getColumnModel().getColumn(5).sizeWidthToFit(); + tablemyLectures.setRowSorter(rowSorterMyLectures); + + scrollPaneMyImage.setViewportView(tablemyLectures); { JPanel buttonPane = new JPanel(); buttonPane.setBounds(0, 640, 826, 33); @@ -350,7 +353,7 @@ public class DeleteLecture_GUI extends JFrame { btnBack.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // oeffnet das Hauptmenue - + MainMenue_GUI main = new MainMenue_GUI(c); main.setVisible(true); dispose(); @@ -369,69 +372,68 @@ public class DeleteLecture_GUI extends JFrame { JSeparator separator_1 = new JSeparator(); separator_1.setBounds(0, 628, 836, 1); getContentPane().add(separator_1); - + JPanel panel = new JPanel(); panel.setLayout(null); panel.setBorder(new TitledBorder(null, "Detailinformationen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setBackground(SystemColor.menu); panel.setBounds(591, 85, 235, 518); getContentPane().add(panel); - + JLabel lblNewLabel_3 = new JLabel("Name:"); lblNewLabel_3.setBounds(10, 27, 104, 14); panel.add(lblNewLabel_3); - + JLabel lblAktiv = new JLabel("Aktiv:"); lblAktiv.setBounds(10, 98, 104, 14); panel.add(lblAktiv); - + labelAktiv = new JLabel(""); labelAktiv.setBounds(10, 114, 218, 14); panel.add(labelAktiv); - + labelstartdate = new JLabel(""); labelstartdate.setBounds(10, 147, 218, 14); panel.add(labelstartdate); - + JLabel lblStartdatum = new JLabel("Startdatum:"); lblStartdatum.setBounds(10, 129, 104, 14); panel.add(lblStartdatum); - + labelenddate = new JLabel(""); labelenddate.setBounds(10, 175, 218, 14); panel.add(labelenddate); - + JLabel lblEnddatum = new JLabel("Enddatum:"); lblEnddatum.setBounds(10, 161, 104, 14); panel.add(lblEnddatum); - + JLabel lblBeschreibung = new JLabel("Beschreibung:"); lblBeschreibung.setBounds(10, 189, 104, 14); panel.add(lblBeschreibung); - + JLabel lblImage = new JLabel("Image:"); lblImage.setBounds(10, 293, 104, 14); panel.add(lblImage); - + labelVerantwortlicher = new JLabel(""); labelVerantwortlicher.setBounds(10, 426, 218, 14); panel.add(labelVerantwortlicher); - + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); lblVerantwortlicher.setBounds(10, 411, 104, 14); panel.add(lblVerantwortlicher); - + JLabel lblImageversion = new JLabel("Imageversion:"); lblImageversion.setBounds(10, 381, 104, 14); panel.add(lblImageversion); - + labelimageversion = new JLabel(""); labelimageversion.setBounds(10, 399, 218, 14); panel.add(labelimageversion); - - + labeldesc = new JTextArea(); labeldesc.setFont(new Font("Tahoma", Font.PLAIN, 11)); labeldesc.setEditable(false); @@ -441,8 +443,8 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPane = new JScrollPane(labeldesc); scrollPane.setBounds(10, 209, 218, 81); panel.add(scrollPane); - //panel.add(labeldesc); - + // panel.add(labeldesc); + labelimage = new JTextArea(); labelimage.setLineWrap(true); labelimage.setFont(new Font("Tahoma", Font.PLAIN, 11)); @@ -452,7 +454,7 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPaneImage = new JScrollPane(labelimage); scrollPaneImage.setBounds(10, 309, 215, 69); panel.add(scrollPaneImage); - + labelName = new JTextArea(); labelName.setEditable(false); labelName.setFont(new Font("Tahoma", Font.PLAIN, 11)); @@ -461,100 +463,103 @@ public class DeleteLecture_GUI extends JFrame { JScrollPane scrollPaneName = new JScrollPane(labelName); scrollPaneName.setBounds(10, 40, 218, 55); panel.add(scrollPaneName); - - button = new JButton("Löschen"); - button.setBounds(469, 606, 118, 23); - getContentPane().add(button); - button.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - - String lectureID=""; - int eingabe; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); - //check if a row is selected - if (tablemyLectures.getSelectedRowCount() !=0){ - //a row is selected - //ask for confirmation - eingabe = JOptionPane.showConfirmDialog(c, - "Wollen Sie diese Daten löschen?", "Löschen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - //user has confirmed deletion, now get the ID of the selected lecture - lectureID = modelMyLectures.getValueAt(tablemyLectures.convertColumnIndexToModel(tablemyLectures.getSelectedRow()), 8).toString(); - LOGGER.info("Lösche Veranstaltung: " + lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - LOGGER.info("Löschen erfolgreich."); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(c); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - LOGGER.error("Konnte Veranstaltung '" + lectureID + "' nicht aus der Datenbank löschen!"); - JOptionPane + + button = new JButton("Löschen"); + button.setBounds(469, 606, 118, 23); + getContentPane().add(button); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + String lectureID = ""; + int eingabe; + String username = person.verantwortlicher.getName() + " " + + person.verantwortlicher.getVorname(); + // check if a row is selected + if (tablemyLectures.getSelectedRowCount() != 0) { + // a row is selected + // ask for confirmation + eingabe = JOptionPane.showConfirmDialog(c, + "Wollen Sie diese Daten löschen?", "Löschen?", + JOptionPane.YES_NO_OPTION); + + if (eingabe == JOptionPane.YES_OPTION) { + // user has confirmed deletion, now get the ID of the + // selected lecture + lectureID = modelMyLectures + .getValueAt( + tablemyLectures + .convertColumnIndexToModel(tablemyLectures + .getSelectedRow()), 8) + .toString(); + LOGGER.info("Lösche Veranstaltung: " + lectureID); + try { + if (client.deleteLecture(lectureID, + person.verantwortlicher.getHochschule(), + person.verantwortlicher.getUsername())) { + LOGGER.info("Löschen erfolgreich."); + // delete successful + + DeleteLecture_GUI dl = new DeleteLecture_GUI(c); + dl.setVisible(true); + dispose(); + } else { + // delete not successful + LOGGER.error("Konnte Veranstaltung '" + + lectureID + + "' nicht aus der Datenbank löschen!"); + JOptionPane .showMessageDialog( c, "Löschen der Veranstaltung aus der Datenbank fehlgeschlagen.", "Fehler", JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - }//end check if a row is selected - /* else if (tableAllLectures.getSelectedRowCount() !=0 && tableAllLectures.getValueAt(tableAllLectures.getSelectedRow(), 5).toString().equals(username)){ - //a row is selected - //ask for confirmation - eingabe = JOptionPane.showConfirmDialog(null, - "Wollen Sie diese Daten löschen?", "Löschen?", - JOptionPane.YES_NO_OPTION); - - if (eingabe == JOptionPane.YES_OPTION) { - //user has confirmed deletion, now get the ID of the selected lecture - lectureID = tableAllLectures.getValueAt(tableAllLectures.convertColumnIndexToModel(tableAllLectures.getSelectedRow()), 8).toString(); - LOGGER.info("Lösche Veranstaltung: "+lectureID); - try { - if(client.deleteLecture(lectureID, person.verantwortlicher.getHochschule(),person.verantwortlicher.getUsername())){ - LOGGER.info("Löschen erfolgreich."); - //delete successful - - DeleteLecture_GUI dl = new DeleteLecture_GUI(); - dl.setVisible(true); - dispose(); - } else { - //delete not successful - LOGGER.error("Konnte Veranstaltung '" + lectureID + "' nicht aus der Datenbank löschen!"); - JOptionPane - .showMessageDialog( - null, - "Löschen aus Datenbank fehlgeschlagen.", - "Fehler", - JOptionPane.INFORMATION_MESSAGE); - } - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - }//end delete - }//end ask for confirmation - - } else { //end check if a row is selected - JOptionPane - .showMessageDialog( - null, - "Bitte wählen Sie ein eigenes Image aus.", - "Message", - JOptionPane.INFORMATION_MESSAGE); - } */ + } + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + }// end delete + }// end ask for confirmation + + }// end check if a row is selected + /* + * else if (tableAllLectures.getSelectedRowCount() !=0 && + * tableAllLectures + * .getValueAt(tableAllLectures.getSelectedRow(), + * 5).toString().equals(username)){ //a row is selected //ask + * for confirmation eingabe = + * JOptionPane.showConfirmDialog(null, + * "Wollen Sie diese Daten löschen?", "Löschen?", + * JOptionPane.YES_NO_OPTION); + * + * if (eingabe == JOptionPane.YES_OPTION) { //user has confirmed + * deletion, now get the ID of the selected lecture lectureID = + * tableAllLectures + * .getValueAt(tableAllLectures.convertColumnIndexToModel + * (tableAllLectures.getSelectedRow()), 8).toString(); + * LOGGER.info("Lösche Veranstaltung: "+lectureID); try { + * if(client.deleteLecture(lectureID, + * person.verantwortlicher.getHochschule + * (),person.verantwortlicher.getUsername())){ + * LOGGER.info("Löschen erfolgreich."); //delete successful + * + * DeleteLecture_GUI dl = new DeleteLecture_GUI(); + * dl.setVisible(true); dispose(); } else { //delete not + * successful LOGGER.error("Konnte Veranstaltung '" + lectureID + * + "' nicht aus der Datenbank löschen!"); JOptionPane + * .showMessageDialog( null, + * "Löschen aus Datenbank fehlgeschlagen.", "Fehler", + * JOptionPane.INFORMATION_MESSAGE); } } catch (TException e1) { + * // TODO Auto-generated catch block e1.printStackTrace(); + * }//end delete }//end ask for confirmation + * + * } else { //end check if a row is selected JOptionPane + * .showMessageDialog( null, + * "Bitte wählen Sie ein eigenes Image aus.", "Message", + * JOptionPane.INFORMATION_MESSAGE); } + */ - } - }); + } + }); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); @@ -566,15 +571,15 @@ public class DeleteLecture_GUI extends JFrame { mntmFaq.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - + OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getFAQ()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -582,7 +587,6 @@ public class DeleteLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmFaq); - JMenuItem mntmOtrs = new JMenuItem("OTRS"); mntmOtrs.addMouseListener(new MouseAdapter() { @@ -590,22 +594,22 @@ public class DeleteLecture_GUI extends JFrame { public void mousePressed(MouseEvent arg0) { OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getOTRS()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } }); mnNewMenu_1.add(mntmOtrs); - + JMenuItem mntmAbout = new JMenuItem("About"); mntmAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -614,30 +618,35 @@ public class DeleteLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmAbout); - + JMenu mnNewMenu_Info = new JMenu("Info"); mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - JOptionPane.showMessageDialog(c, HELP_MESSAGE, "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(c, HELP_MESSAGE, + "Hilfe zu dieser Oberfläche", + JOptionPane.INFORMATION_MESSAGE); } }); menuBar.add(mnNewMenu_Info); - + c = this; } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) throws ParseException { + public DefaultTableModel initTableModel(DefaultTableModel model) + throws ParseException { List<server.generated.Lecture> lectures; try { // Hole eine Liste der erlaubten Images für die diese Person - //lectures = client.getLectureList(); - lectures = client.getLectureListPermissionWrite(person.verantwortlicher.getUserID()); + // lectures = client.getLectureList(); + lectures = client + .getLectureListPermissionWrite(person.verantwortlicher + .getUserID()); Iterator<server.generated.Lecture> i = lectures.iterator(); - SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); int x = 0; while (i.hasNext()) { @@ -647,9 +656,10 @@ public class DeleteLecture_GUI extends JFrame { lectures.get(x).desc, out.format(in.parse(lectures.get(x).starttime)) + " " + out.format(in.parse(lectures.get(x).endtime)), - lectures.get(x).isActive, out.format(in.parse(lectures.get(x).lastused)), - lectures.get(x).username, - lectures.get(x).imagename," " ,lectures.get(x).id }; + lectures.get(x).isActive, + out.format(in.parse(lectures.get(x).lastused)), + lectures.get(x).username, lectures.get(x).imagename, + " ", lectures.get(x).id }; // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -664,20 +674,21 @@ public class DeleteLecture_GUI extends JFrame { } return model; } - public void writeLectureData(String id) throws TException, ParseException{ - - SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - Map<String,String> res=client.getLectureData(id); + + public void writeLectureData(String id) throws TException, ParseException { + + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); + Map<String, String> res = client.getLectureData(id); labelName.setText(res.get("name")); labelAktiv.setText(res.get("isActive")); labeldesc.setText(res.get("desc")); labelVerantwortlicher.setText(res.get("owner")); labelstartdate.setText(out.format(in.parse(res.get("startTime")))); labelenddate.setText(out.format(in.parse(res.get("endTime")))); - labelimage.setText(res.get("imagepath").substring(res.get("imagepath").indexOf("/")+1)); + labelimage.setText(res.get("imagepath").substring( + res.get("imagepath").indexOf("/") + 1)); labelimageversion.setText(res.get("imageversion")); - -} -} + } +}//end class diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java index 179064ea..2fa014b8 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java @@ -402,24 +402,7 @@ public class EditLectureAllgemein_GUI extends JFrame { { JButton cancelButton = new JButton("Weiter"); cancelButton.addActionListener(new ActionListener() { - /* - * public void actionPerformed(ActionEvent e) { - * if(radioButtonyes.isSelected()==true) { - * Lecture.lecture.setActive(true); } else { - * Lecture.lecture.setActive(false); } - * - * Lecture.lecture.setName(textFieldLaborname.getText()); - * Lecture.lecture.setNewName(textFieldLaborname.getText()); - * Lecture.lecture.setDesc(description.getText()); - * Lecture.lecture.setEnddate(dateChooserend.getDate()); - * Lecture.lecture.setStartdate(dateChooserstart.getDate()); - * Image.image.setImagename(textFieldLaborname.getText()); - * - * - * PermissionEditLecture_GUI ev=new - * PermissionEditLecture_GUI(); ev.setVisible(true); - * dispose(); } - */ + public void actionPerformed(ActionEvent e) { // liegt das End-Datum vor dem Start-Datum? if (dateChooserend.getDate().before( @@ -481,7 +464,7 @@ public class EditLectureAllgemein_GUI extends JFrame { && isDateOrderCorrect == true && descriptionLenghtOK() == true) { // everything is ok, proceed - Lecture.lecture.setName(textFieldLaborname + Lecture.lecture.setNewName(textFieldLaborname .getText()); Lecture.lecture.setDesc(description.getText()); Lecture.lecture.setEnddate(dateChooserend.getDate()); diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java index 1db2c46b..478c1bc0 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java @@ -52,8 +52,10 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import models.Image; import models.Lecture; import models.Links; +import models.RightsManagement; import models.person; import org.apache.thrift.TException; @@ -94,26 +96,27 @@ public class EditLectureLink_GUI extends JFrame { JTable tablePublicVorlagen = new JTable(); private JTextField textFieldName; JTabbedPane tabbedPane; - boolean activeSearch=false; + boolean activeSearch = false; Component c = null; String[] titles = { "Image-Name", "Lizenzpflichtig", "OS", "Veranstaltung", - "Verantwortlicher", "Letztes Update", "ID", "Version","Template" }; + "Verantwortlicher", "Letztes Update", "ID", "Version", "Template" }; ThriftConnection con = new ThriftConnection(); Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelAll = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } + final DefaultTableModel modelAll = new DefaultTableModel(titles, 0) { + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } }; - final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } + final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0) { + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } }; - final DefaultTableModel modelPublicVorlagen = new DefaultTableModel(titles, 0){ - public boolean isCellEditable(int rowIndex, int mColIndex) { - return false; - } + final DefaultTableModel modelPublicVorlagen = new DefaultTableModel(titles, + 0) { + public boolean isCellEditable(int rowIndex, int mColIndex) { + return false; + } }; final TableRowSorter<TableModel> rowSorterAll = new TableRowSorter<TableModel>( modelAll); @@ -122,11 +125,11 @@ public class EditLectureLink_GUI extends JFrame { final TableRowSorter<TableModel> rowSorterPublicVorlagen = new TableRowSorter<TableModel>( modelPublicVorlagen); private JTextField textField; - - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "Ändern Sie hier das Image, zu dem Ihre Veranstaltung gehört.<br />" + - "Wählen Sie das Image aus, das zu Ihrer Veranstaltung passt und klicken Sie anschließend auf \"Veranstaltung ändern und abschließen\"." + - "</div></html>"; + + private static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "Ändern Sie hier das Image, zu dem Ihre Veranstaltung gehört.<br />" + + "Wählen Sie das Image aus, das zu Ihrer Veranstaltung passt und klicken Sie anschließend auf \"Veranstaltung ändern und abschließen\"." + + "</div></html>"; /** * Create the dialog. @@ -138,6 +141,7 @@ public class EditLectureLink_GUI extends JFrame { con.closeThriftConnection(); System.exit(0); } + @Override public void windowOpened(WindowEvent arg0) { try { @@ -173,23 +177,33 @@ public class EditLectureLink_GUI extends JFrame { tablemyImages.getColumnModel().getColumn(7).setWidth(0); tablemyImages.getColumnModel().getColumn(7).setMinWidth(0); tablemyImages.getColumnModel().getColumn(7).setMaxWidth(0); - + tablePublicVorlagen.getColumnModel().getColumn(1).setWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(1).setMinWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(1).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(1) + .setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(1) + .setMaxWidth(0); tablePublicVorlagen.getColumnModel().getColumn(3).setWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(3).setMinWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(3).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(3) + .setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(3) + .setMaxWidth(0); tablePublicVorlagen.getColumnModel().getColumn(8).setWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(8).setMinWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(8).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(8) + .setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(8) + .setMaxWidth(0); tablePublicVorlagen.getColumnModel().getColumn(6).setWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(6).setMinWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(6).setMaxWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(6) + .setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(6) + .setMaxWidth(0); tablePublicVorlagen.getColumnModel().getColumn(7).setWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(7).setMinWidth(0); - tablePublicVorlagen.getColumnModel().getColumn(7).setMaxWidth(0); - + tablePublicVorlagen.getColumnModel().getColumn(7) + .setMinWidth(0); + tablePublicVorlagen.getColumnModel().getColumn(7) + .setMaxWidth(0); + tableAllImages.getColumnModel().getColumn(1).setWidth(0); tableAllImages.getColumnModel().getColumn(1).setMinWidth(0); tableAllImages.getColumnModel().getColumn(1).setMaxWidth(0); @@ -218,11 +232,10 @@ public class EditLectureLink_GUI extends JFrame { e.printStackTrace(); } setTitle("bwLehrpool Suite - Veranstaltung bearbeiten"); - + setBounds(0, 0, 918, 722); setLocationRelativeTo(formerGUI); - final DefaultTableModel model = new DefaultTableModel(titles, 0); getContentPane().setLayout(null); @@ -233,7 +246,8 @@ public class EditLectureLink_GUI extends JFrame { getContentPane().add(panel); panel.setLayout(null); { - JLabel lblNewLabel = new JLabel("Veranstaltung auf ein Image verlinken"); + JLabel lblNewLabel = new JLabel( + "Veranstaltung auf ein Image verlinken"); lblNewLabel.setBounds(10, 11, 509, 22); panel.add(lblNewLabel); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 18)); @@ -276,7 +290,7 @@ public class EditLectureLink_GUI extends JFrame { String stext = textFieldName.getText(); // Wenn Textfield nicht leer if (stext != "") { - activeSearch=true; + activeSearch = true; // Filtere nach der Eingabe rowSorterAll.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); @@ -285,8 +299,8 @@ public class EditLectureLink_GUI extends JFrame { rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter( textFieldName.getText(), 0)); - }else{ - activeSearch=false; + } else { + activeSearch = false; String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname(); rowSorterMyImages.setRowFilter(RowFilter.regexFilter( @@ -319,15 +333,15 @@ public class EditLectureLink_GUI extends JFrame { public void actionPerformed(ActionEvent arg0) { // Prueft das die Auswahl nicht leer ist if (comboBox.getSelectedItem().toString() != "") { - activeSearch=true; + activeSearch = true; rowSorterAll.setRowFilter(RowFilter.regexFilter(comboBox .getSelectedItem().toString(), 2)); rowSorterMyImages.setRowFilter(RowFilter.regexFilter( comboBox.getSelectedItem().toString(), 2)); rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter( comboBox.getSelectedItem().toString(), 2)); - }else{ - activeSearch=false; + } else { + activeSearch = false; String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname(); rowSorterMyImages.setRowFilter(RowFilter.regexFilter( @@ -375,17 +389,20 @@ public class EditLectureLink_GUI extends JFrame { tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent arg0) { - if (tabbedPane.getSelectedIndex() == 0 && activeSearch==false) { + if (tabbedPane.getSelectedIndex() == 0 && activeSearch == false) { String username = person.verantwortlicher.getName() + " " + person.verantwortlicher.getVorname(); rowSorterMyImages.setRowFilter(RowFilter.regexFilter( username, 4)); - }else if(tabbedPane.getSelectedIndex()==1 && activeSearch==false){ - rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter("true", 8)); - } else if(tabbedPane.getSelectedIndex()==2 && activeSearch==false){ + } else if (tabbedPane.getSelectedIndex() == 1 + && activeSearch == false) { + rowSorterPublicVorlagen.setRowFilter(RowFilter.regexFilter( + "true", 8)); + } else if (tabbedPane.getSelectedIndex() == 2 + && activeSearch == false) { rowSorterAll.setRowFilter(null); - } + } } }); @@ -394,27 +411,24 @@ public class EditLectureLink_GUI extends JFrame { contentPanel.add(tabbedPane); JScrollPane scrollPaneAllImages = new JScrollPane(); - tableAllImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { + tableAllImages.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { - String imageid = modelAll - .getValueAt( + String imageid = modelAll.getValueAt( tableAllImages .convertRowIndexToModel(tableAllImages .getSelectedRow()), 6) - .toString(); - String version = modelAll - .getValueAt( + .toString(); + String version = modelAll.getValueAt( tableAllImages .convertRowIndexToModel(tableAllImages .getSelectedRow()), 7) - .toString(); - writeImageData(imageid, version); + .toString(); + writeImageData(imageid, version); - } - }); + } + }); tableAllImages.setModel(modelAll); tableAllImages.getColumnModel().getColumn(1).sizeWidthToFit(); tableAllImages.getColumnModel().getColumn(2).sizeWidthToFit(); @@ -422,68 +436,62 @@ public class EditLectureLink_GUI extends JFrame { tableAllImages.getColumnModel().getColumn(4).sizeWidthToFit(); tableAllImages.getColumnModel().getColumn(5).sizeWidthToFit(); tableAllImages.setRowSorter(rowSorterAll); - JScrollPane scrollPaneMyImage = new JScrollPane(); - tablemyImages.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - String imageid = modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 6) + JScrollPane scrollPaneMyImage = new JScrollPane(); + tablemyImages.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + String imageid = modelMyImages.getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 6) .toString(); - String version = modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 7) + String version = modelMyImages.getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), 7) .toString(); - writeImageData(imageid, version); - } - }); - 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(); - tablemyImages.setRowSorter(rowSorterMyImages); - scrollPaneMyImage.setViewportView(tablemyImages); - tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); - - JScrollPane scrollPanePublicVorlagen = new JScrollPane(); - scrollPanePublicVorlagen.setEnabled(false); - tablePublicVorlagen.getSelectionModel().addListSelectionListener( new ListSelectionListener() - { - public void valueChanged(ListSelectionEvent e) - { - String imageid = modelPublicVorlagen + writeImageData(imageid, version); + } + }); + 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(); + tablemyImages.setRowSorter(rowSorterMyImages); + scrollPaneMyImage.setViewportView(tablemyImages); + tabbedPane.addTab("Meine Images", null, scrollPaneMyImage, null); + + JScrollPane scrollPanePublicVorlagen = new JScrollPane(); + scrollPanePublicVorlagen.setEnabled(false); + tablePublicVorlagen.getSelectionModel().addListSelectionListener( + new ListSelectionListener() { + public void valueChanged(ListSelectionEvent e) { + String imageid = modelPublicVorlagen .getValueAt( tablePublicVorlagen .convertRowIndexToModel(tablePublicVorlagen .getSelectedRow()), 6) .toString(); - String version = modelPublicVorlagen + String version = modelPublicVorlagen .getValueAt( tablePublicVorlagen .convertRowIndexToModel(tablePublicVorlagen .getSelectedRow()), 7) .toString(); - writeImageData(imageid, version); - } - }); - tablePublicVorlagen.setModel(modelPublicVorlagen); - 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(); - tablePublicVorlagen.setRowSorter(rowSorterPublicVorlagen); - scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); - tabbedPane.addTab("Vorlagen", null, - scrollPanePublicVorlagen, null); - + writeImageData(imageid, version); + } + }); + tablePublicVorlagen.setModel(modelPublicVorlagen); + 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(); + tablePublicVorlagen.setRowSorter(rowSorterPublicVorlagen); + scrollPanePublicVorlagen.setViewportView(tablePublicVorlagen); + tabbedPane.addTab("Vorlagen", null, scrollPanePublicVorlagen, null); scrollPaneAllImages.setViewportView(tableAllImages); tabbedPane.addTab("Alle", null, scrollPaneAllImages, null); @@ -498,8 +506,7 @@ public class EditLectureLink_GUI extends JFrame { tableCoopImages.getColumnModel().getColumn(5).sizeWidthToFit(); scrollPaneCoopImages.setViewportView(tableCoopImages); - tabbedPane.addTab("bwLehrpool", null, scrollPaneCoopImages, - null); + tabbedPane.addTab("bwLehrpool", null, scrollPaneCoopImages, null); tabbedPane.setEnabledAt(3, false); JButton btnLinkLschen = new JButton("Link löschen"); @@ -507,7 +514,6 @@ public class EditLectureLink_GUI extends JFrame { btnLinkLschen.setBounds(478, 508, 89, 23); contentPanel.add(btnLinkLschen); - { JPanel buttonPane = new JPanel(); buttonPane.setBounds(0, 640, 902, 33); @@ -519,7 +525,8 @@ public class EditLectureLink_GUI extends JFrame { okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - PermissionEditLecture_GUI el = new PermissionEditLecture_GUI(c); + PermissionEditLecture_GUI el = new PermissionEditLecture_GUI( + c); el.setVisible(true); dispose(); } @@ -533,10 +540,10 @@ public class EditLectureLink_GUI extends JFrame { "Veranstaltung ändern und abschließen"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); + String username = person.verantwortlicher.getName() + + " " + person.verantwortlicher.getVorname(); // check if a row is selected - if (tablemyImages.getSelectedRow() != -1){ + if (tablemyImages.getSelectedRow() != -1) { // a row is selected, do operations String imagename = tablemyImages.getValueAt( @@ -545,6 +552,8 @@ public class EditLectureLink_GUI extends JFrame { try { DateFormat formatter = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss"); + + // update the lecture client.updateLecturedata( Lecture.lecture.getName(), Lecture.lecture.getNewName(), @@ -558,16 +567,17 @@ public class EditLectureLink_GUI extends JFrame { .toString(), Lecture.lecture.isActive(), modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 6).toString(), - modelMyImages - .getValueAt( - tablemyImages - .convertRowIndexToModel(tablemyImages - .getSelectedRow()), 7) - .toString(), + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), + 6).toString(), + modelMyImages + .getValueAt( + tablemyImages + .convertRowIndexToModel(tablemyImages + .getSelectedRow()), + 7).toString(), person.verantwortlicher.getUsername(), person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), @@ -576,6 +586,46 @@ public class EditLectureLink_GUI extends JFrame { person.verantwortlicher.getTel(), person.verantwortlicher.getFakultaet(), Lecture.lecture.getid()); + + // remove all additional user permissions on + // first stage + client.deleteAllAdditionalLecturePermissions( + Lecture.lecture.getid(), + person.verantwortlicher.getUserID()); + + // then, add user permissions as they have been + // set new + for (int i = 0; i < RightsManagement.rightsManagement + .getPermittedUserList().size(); i++) { + System.out + .println("Writing additional rights for user " + + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID() + + ", User " + + i + + "/" + + RightsManagement.rightsManagement + .getPermittedUserList() + .size()); + client.writeAdditionalLectureRights( + Lecture.lecture.getName(), + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID(), // userID + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageRead(),// read + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageWrite(),// write + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageAdmin()// admin + ); + + }// end for + JOptionPane .showMessageDialog( c, @@ -594,14 +644,20 @@ public class EditLectureLink_GUI extends JFrame { "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten.", "Error", JOptionPane.ERROR_MESSAGE); - JOptionPane.showMessageDialog(c, - e1.getCause()+"\n"+e1.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(c, e1.getCause() + + "\n" + e1.getStackTrace(), + "Debug-Message", + JOptionPane.ERROR_MESSAGE); } - + dispose(); - }else if (tablePublicVorlagen.getSelectedRow() != -1 &&tablePublicVorlagen.getValueAt(tablePublicVorlagen.getSelectedRow(), 4).toString().equals(username)){ + } else if (tablePublicVorlagen.getSelectedRow() != -1 + && tablePublicVorlagen + .getValueAt( + tablePublicVorlagen + .getSelectedRow(), 4) + .toString().equals(username)) { // a row is selected, do operations String imagename = tablePublicVorlagen.getValueAt( @@ -623,15 +679,17 @@ public class EditLectureLink_GUI extends JFrame { .toString(), Lecture.lecture.isActive(), modelPublicVorlagen - .getValueAt( - tablePublicVorlagen - .convertRowIndexToModel(tablePublicVorlagen - .getSelectedRow()), 6).toString(), - modelPublicVorlagen - .getValueAt( - tablePublicVorlagen - .convertRowIndexToModel(tablePublicVorlagen - .getSelectedRow()), 7).toString(), + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), + 6).toString(), + modelPublicVorlagen + .getValueAt( + tablePublicVorlagen + .convertRowIndexToModel(tablePublicVorlagen + .getSelectedRow()), + 7).toString(), person.verantwortlicher.getUsername(), person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), @@ -640,6 +698,45 @@ public class EditLectureLink_GUI extends JFrame { person.verantwortlicher.getTel(), person.verantwortlicher.getFakultaet(), Lecture.lecture.getid()); + + // remove all additional user permissions on + // first stage + client.deleteAllAdditionalLecturePermissions( + Lecture.lecture.getid(), + person.verantwortlicher.getUserID()); + + // then, add user permissions as they have been + // set new + for (int i = 0; i < RightsManagement.rightsManagement + .getPermittedUserList().size(); i++) { + System.out + .println("Writing additional rights for user " + + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID() + + ", User " + + i + + "/" + + RightsManagement.rightsManagement + .getPermittedUserList() + .size()); + client.writeAdditionalLectureRights( + Lecture.lecture.getName(), + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID(), // userID + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageRead(),// read + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageWrite(),// write + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageAdmin()// admin + ); + } + JOptionPane .showMessageDialog( c, @@ -658,14 +755,19 @@ public class EditLectureLink_GUI extends JFrame { "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten.", "Error", JOptionPane.ERROR_MESSAGE); - JOptionPane.showMessageDialog(c, - e1.getCause()+"\n"+e1.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(c, e1.getCause() + + "\n" + e1.getStackTrace(), + "Debug-Message", + JOptionPane.ERROR_MESSAGE); } - + dispose(); - }else if (tableAllImages.getSelectedRow() != -1 &&tableAllImages.getValueAt(tableAllImages.getSelectedRow(), 4).toString().equals(username)){ + } else if (tableAllImages.getSelectedRow() != -1 + && tableAllImages + .getValueAt( + tableAllImages.getSelectedRow(), + 4).toString().equals(username)) { // a row is selected, do operations String imagename = tableAllImages.getValueAt( @@ -686,18 +788,16 @@ public class EditLectureLink_GUI extends JFrame { Lecture.lecture.getEnddate()) .toString(), Lecture.lecture.isActive(), - modelAll - .getValueAt( + modelAll.getValueAt( tableAllImages .convertRowIndexToModel(tableAllImages - .getSelectedRow()), 6) - .toString(), - modelAll - .getValueAt( + .getSelectedRow()), + 6).toString(), + modelAll.getValueAt( tableAllImages .convertRowIndexToModel(tableAllImages - .getSelectedRow()), 7) - .toString(), + .getSelectedRow()), + 7).toString(), person.verantwortlicher.getUsername(), person.verantwortlicher.getVorname(), person.verantwortlicher.getName(), @@ -706,6 +806,45 @@ public class EditLectureLink_GUI extends JFrame { person.verantwortlicher.getTel(), person.verantwortlicher.getFakultaet(), Lecture.lecture.getid()); + + // remove all additional user permissions on + // first stage + client.deleteAllAdditionalLecturePermissions( + Lecture.lecture.getid(), + person.verantwortlicher.getUserID()); + + // then, add user permissions as they have been + // set new + for (int i = 0; i < RightsManagement.rightsManagement + .getPermittedUserList().size(); i++) { + System.out + .println("Writing additional rights for user " + + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID() + + ", User " + + i + + "/" + + RightsManagement.rightsManagement + .getPermittedUserList() + .size()); + client.writeAdditionalLectureRights( + Lecture.lecture.getName(), + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).getUserID(), // userID + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageRead(),// read + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageWrite(),// write + RightsManagement.rightsManagement + .getPermittedUserList() + .get(i).isImageAdmin()// admin + ); + } + JOptionPane .showMessageDialog( c, @@ -724,15 +863,17 @@ public class EditLectureLink_GUI extends JFrame { "Beim Anlegen Ihrer Veranstaltung ist ein Fehler aufgetreten.", "Error", JOptionPane.ERROR_MESSAGE); - JOptionPane.showMessageDialog(null, - e1.getCause()+"\n"+e1.getStackTrace(), - "Debug-Message", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog( + null, + e1.getCause() + "\n" + + e1.getStackTrace(), + "Debug-Message", + JOptionPane.ERROR_MESSAGE); } - + dispose(); - } - else { + } else { // nothing selected JOptionPane.showMessageDialog(c, "Bitte wählen Sie ein Image aus.", @@ -754,124 +895,125 @@ public class EditLectureLink_GUI extends JFrame { JSeparator separator_1 = new JSeparator(); separator_1.setBounds(0, 627, 912, 2); getContentPane().add(separator_1); - + JPanel panel = new JPanel(); panel.setLayout(null); panel.setBorder(new TitledBorder(null, "Detailinformationen", - TitledBorder.LEADING, TitledBorder.TOP, null, null)); + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setBackground(SystemColor.menu); panel.setBounds(586, 85, 316, 531); getContentPane().add(panel); - + JLabel lblName = new JLabel("Name:"); lblName.setBounds(10, 87, 130, 14); panel.add(lblName); - + labelName = new JLabel(""); labelName.setBounds(10, 102, 296, 14); panel.add(labelName); - + JLabel lblVerantwortlicher = new JLabel("Verantwortlicher:"); lblVerantwortlicher.setBounds(10, 259, 130, 14); panel.add(lblVerantwortlicher); - + labelOS = new JLabel(""); labelOS.setBounds(10, 216, 296, 14); panel.add(labelOS); - + JLabel lblWeitereVerantwortliche = new JLabel("Betriebssystem:"); lblWeitereVerantwortliche.setBounds(10, 202, 130, 14); panel.add(lblWeitereVerantwortliche); - + labelVerantwortlicher = new JLabel(""); labelVerantwortlicher.setBounds(10, 272, 296, 14); panel.add(labelVerantwortlicher); - + JLabel label = new JLabel("Weitere Verantwortliche:"); label.setBounds(10, 284, 130, 14); panel.add(label); - + labelWeitereVerantwortliche = new JLabel(""); labelWeitereVerantwortliche.setBounds(10, 297, 296, 14); panel.add(labelWeitereVerantwortliche); - + labelUpdate = new JLabel(""); labelUpdate.setBounds(10, 245, 296, 14); panel.add(labelUpdate); - + JLabel lblLetztesUpdate = new JLabel("Letztes Update:"); lblLetztesUpdate.setBounds(10, 231, 130, 14); panel.add(lblLetztesUpdate); - + JLabel lblImageIstVorlage = new JLabel("Image ist Vorlage:"); lblImageIstVorlage.setBounds(10, 336, 130, 14); panel.add(lblImageIstVorlage); - + labelVorlage = new JLabel(""); labelVorlage.setBounds(10, 350, 296, 14); panel.add(labelVorlage); - + labelLizenzSoftware = new JLabel(""); labelLizenzSoftware.setBounds(10, 383, 296, 14); panel.add(labelLizenzSoftware); - - JLabel lblLizenzpflichtigeSoftware = new JLabel("Lizenzpflichtige Software:"); + + JLabel lblLizenzpflichtigeSoftware = new JLabel( + "Lizenzpflichtige Software:"); lblLizenzpflichtigeSoftware.setBounds(10, 367, 130, 14); panel.add(lblLizenzpflichtigeSoftware); - + JLabel lblInternet = new JLabel("Internetsperre vorhanden:"); lblInternet.setBounds(10, 400, 130, 14); panel.add(lblInternet); - + labelInternet = new JLabel(""); labelInternet.setBounds(10, 417, 296, 14); panel.add(labelInternet); - + JLabel lblEmpfehlungRam = new JLabel("Empfehlung RAM:"); lblEmpfehlungRam.setBounds(10, 432, 130, 14); panel.add(lblEmpfehlungRam); - + labelRam = new JLabel(""); labelRam.setBounds(10, 455, 296, 14); panel.add(labelRam); - + JLabel lblEmpfehlungCpu = new JLabel("Empfehlung CPU:"); lblEmpfehlungCpu.setBounds(10, 469, 130, 14); panel.add(lblEmpfehlungCpu); - + labelCPU = new JLabel(""); labelCPU.setBounds(10, 487, 296, 14); panel.add(labelCPU); - + JLabel lblTechnischeDaten = new JLabel("Technische Daten:"); lblTechnischeDaten.setBounds(10, 322, 296, 14); panel.add(lblTechnischeDaten); - + JLabel lblId = new JLabel("ID:"); lblId.setBounds(10, 23, 296, 14); panel.add(lblId); - + labelID = new JLabel(""); labelID.setBounds(10, 37, 296, 14); panel.add(labelID); - + labelVersion = new JLabel(""); labelVersion.setBounds(10, 73, 296, 14); panel.add(labelVersion); - + JLabel lblVersion = new JLabel("Version:"); lblVersion.setBounds(10, 57, 296, 14); panel.add(lblVersion); - + JLabel lblBeschreibung = new JLabel("Beschreibung:"); lblBeschreibung.setBounds(10, 119, 130, 14); panel.add(lblBeschreibung); - + JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 135, 296, 65); panel.add(scrollPane); - + textAreadesc = new JTextArea(); textAreadesc.setLineWrap(true); textAreadesc.setBackground(SystemColor.menu); @@ -887,15 +1029,15 @@ public class EditLectureLink_GUI extends JFrame { mntmFaq.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - + OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getFAQ()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -903,7 +1045,6 @@ public class EditLectureLink_GUI extends JFrame { } }); mnNewMenu_1.add(mntmFaq); - JMenuItem mntmOtrs = new JMenuItem("OTRS"); mntmOtrs.addMouseListener(new MouseAdapter() { @@ -911,22 +1052,22 @@ public class EditLectureLink_GUI extends JFrame { public void mousePressed(MouseEvent arg0) { OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getOTRS()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } }); mnNewMenu_1.add(mntmOtrs); - + JMenuItem mntmAbout = new JMenuItem("About"); mntmAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -940,75 +1081,74 @@ public class EditLectureLink_GUI extends JFrame { mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - JOptionPane.showMessageDialog(c, HELP_MESSAGE, "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(c, HELP_MESSAGE, + "Hilfe zu dieser Oberfläche", + JOptionPane.INFORMATION_MESSAGE); } }); menuBar.add(mnNewMenu_Info); - + c = this; - + } // Initiale Beffuelung eines Table models - public DefaultTableModel initTableModel(DefaultTableModel model) throws TException, ParseException { + public DefaultTableModel initTableModel(DefaultTableModel model) + throws TException, ParseException { List<server.generated.Image> images; - - // Hole eine Liste der Images - images = client.getImageListPermissionLink(person.verantwortlicher.getUserID()); - - Iterator<server.generated.Image> i = images.iterator(); - SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); - int x = 0; - - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { images.get(x).getImageName(), - images.get(x).getLicenseRestriction(), - images.get(x).getOsName(), - images.get(x).getLectureName(), - images.get(x).getUserData(), - out.format(in.parse(images.get(x).updateTime)), images.get(x).id, - images.get(x).getVersion(), - images.get(x).getIsTemplate() }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - x++; - i.next(); - } + // Hole eine Liste der Images + images = client.getImageListPermissionLink(person.verantwortlicher + .getUserID()); + + Iterator<server.generated.Image> i = images.iterator(); + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { images.get(x).getImageName(), + images.get(x).getLicenseRestriction(), + images.get(x).getOsName(), images.get(x).getLectureName(), + images.get(x).getUserData(), + out.format(in.parse(images.get(x).updateTime)), + images.get(x).id, images.get(x).getVersion(), + images.get(x).getIsTemplate() }; + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + i.next(); + + } + + return model; - return model; - - } - public void writeImageData(String id, String version){ - try { - SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); - SimpleDateFormat out=new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); - Map<String,String> res=client.getImageData(id,version); + + public void writeImageData(String id, String version) { + try { + SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy hh:mm:ss"); + Map<String, String> res = client.getImageData(id, version); labelName.setText(res.get("name")); labelOS.setText(res.get("os")); labelUpdate.setText(out.format(in.parse(res.get("lastupdate")))); labelVerantwortlicher.setText(res.get("owner")); labelWeitereVerantwortliche.setText("Noch nicht Verfügbar"); - if(res.get("template").equals("true")){ + if (res.get("template").equals("true")) { labelVorlage.setText("Ja"); - }else{ + } else { labelVorlage.setText("Nein"); } - if(res.get("license").equals("1")){ + if (res.get("license").equals("1")) { labelLizenzSoftware.setText("Ja"); - } - else - { + } else { labelLizenzSoftware.setText("Nein"); } - if(res.get("internet").equals("1")){ + if (res.get("internet").equals("1")) { labelInternet.setText("Ja"); - } - else - { + } else { labelInternet.setText("Nein"); } labelRam.setText(res.get("ram")); diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java index 0ae9147a..01b93f47 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java @@ -156,26 +156,6 @@ public class EditLectureSearch_GUI extends JFrame { tablemyLectures.getColumnModel().getColumn(8).setMinWidth(0); tablemyLectures.getColumnModel().getColumn(8).setMaxWidth(0); - /* - tableAllLectures.getColumnModel().getColumn(1).setWidth(0); - tableAllLectures.getColumnModel().getColumn(1).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(1).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(2).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(3).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(6).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(7).setMaxWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setMinWidth(0); - tableAllLectures.getColumnModel().getColumn(8).setMaxWidth(0); - */ } }); // Verhindert das Vergroessern Des Fensters diff --git a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java index de19520b..378273b3 100644 --- a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java @@ -1,6 +1,7 @@ package gui.lecture; import gui.intro.About_GUI; +import gui.intro.ListAllOtherUsers_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -80,7 +81,7 @@ public class PermissionCreateLecture_GUI extends JFrame { Client client = models.Client.clientcon.getClient(); String[] result; private Class[] classes; - //private JTable table = null; + // private JTable table = null; private JTable tablePermittedUsers = null; private final ButtonGroup buttonGroup = new ButtonGroup(); Object[] titles = { "Name", "Read", "Write", "Admin", "userID" }; @@ -92,23 +93,15 @@ public class PermissionCreateLecture_GUI extends JFrame { + "und/oder ob die Veranstaltung auch im VMChooser angezeigt wird." + "</div></html>"; private List<Person> map = null; // List of people who have rights - + final DefaultTableModel modelMyImages = new DefaultTableModel(titles, 0) { public boolean isCellEditable(int rowIndex, int mColIndex) { return false; } }; - + final TableRowSorter<TableModel> rowSorterMyImages = new TableRowSorter<TableModel>( modelMyImages); - - - - - - - - final DefaultTableModel model = new DefaultTableModel(titles, 0) { @@ -130,7 +123,7 @@ public class PermissionCreateLecture_GUI extends JFrame { }; - //private JTable tablePermittedUsers; + // private JTable tablePermittedUsers; public PermissionCreateLecture_GUI(Component formerGUI) { addWindowListener(new WindowAdapter() { @@ -145,7 +138,6 @@ public class PermissionCreateLecture_GUI extends JFrame { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block e.printStackTrace(); } setTitle("bwLehrpool Suite - Berechtigungen"); @@ -182,14 +174,7 @@ public class PermissionCreateLecture_GUI extends JFrame { getContentPane().add(contentPanel); contentPanel.setLayout(null); - - - - - - - - //tablePermittedUsers = new JTable(); + // tablePermittedUsers = new JTable(); tablePermittedUsers = new JTable(); tablePermittedUsers.addMouseListener(new MouseAdapter() { @Override @@ -209,44 +194,7 @@ public class PermissionCreateLecture_GUI extends JFrame { // if new session, get values for table from database if (RightsManagement.rightsManagement.getPermittedUserList().size() <= 0) { System.out.println("Loading data from db"); - // System.out.println(RightsManagement.rightsManagement.getPmImageCreateList().size()); - - // person.verantwortlicher.getUserID(); - // System.out.println("Current userID: " - // +person.verantwortlicher.getUserID()); - - /* - try { - map = client.getAllOtherSatelliteUsers(person.verantwortlicher - .getUserID()); - Iterator<server.generated.Person> i = map.iterator(); - - int x = 0; - while (i.hasNext()) { - // erzeuge Objekte fuer die Tabelle - Object[] obj = { - map.get(x).getNachname() + ", " - + map.get(x).getVorname(), // Name - false, // Read - false, // Write - false, // Link - false, // Admin - map.get(x).getUserID() // userID - }; - // Fuege diese Objekte der Tabelle hinzu - model.addRow(obj); - i.next(); - x++; - } - // System.out.println("Number of returned users in permission list: "+ - // map.size()); - - } catch (TException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - */ } else // read from model { System.out.println("reading from model"); @@ -261,21 +209,20 @@ public class PermissionCreateLecture_GUI extends JFrame { int x = 0; while (i.hasNext()) { - // System.out.println("current pos=" + x); // erzeuge Objekte fuer die Tabelle person temp = i.next(); Object[] obj = { temp.getName() + ", " + temp.getVorname(), // Name - temp.isImageRead(), // Read - temp.isImageWrite(), // Write - temp.isImageLinkAllowed(), // Link - temp.isImageAdmin(), // Admin + temp.isLecture_read(), // Read + temp.isLecture_write(), // Write + // temp.isImageLinkAllowed(), // Link + temp.isLecture_admin(), // Admin temp.getUserID() // userID }; System.out.println("Processing: " + temp.getName() + ", " - + temp.getVorname() + ", " + temp.isImageRead() + ", " - + temp.isImageWrite() + ", " + temp.isImageLinkAllowed() + ", " - + temp.isImageAdmin() + ", " + temp.getUserID()); + + temp.getVorname() + ", " + temp.isLecture_read() + + ", " + temp.isLecture_write() + ", " + + temp.isLecture_admin() + ", " + temp.getUserID()); // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; @@ -283,24 +230,27 @@ public class PermissionCreateLecture_GUI extends JFrame { }// end set list of permitted users // table wird hier nie initialisiert und ist entsprechend null - + if (tablePermittedUsers == null) LOGGER.error("NPE incoming..."); TableColumn tc1 = tablePermittedUsers.getColumnModel().getColumn(1); tc1.setCellEditor(tablePermittedUsers.getDefaultEditor(Boolean.class)); - tc1.setCellRenderer(tablePermittedUsers.getDefaultRenderer(Boolean.class)); + tc1.setCellRenderer(tablePermittedUsers + .getDefaultRenderer(Boolean.class)); tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(), (String) titles[1])); TableColumn tc2 = tablePermittedUsers.getColumnModel().getColumn(2); tc2.setCellEditor(tablePermittedUsers.getDefaultEditor(Boolean.class)); - tc2.setCellRenderer(tablePermittedUsers.getDefaultRenderer(Boolean.class)); + tc2.setCellRenderer(tablePermittedUsers + .getDefaultRenderer(Boolean.class)); tc2.setHeaderRenderer(new CheckBoxHeader(new MyItemListener2(), (String) titles[2])); TableColumn tc3 = tablePermittedUsers.getColumnModel().getColumn(3); tc3.setCellEditor(tablePermittedUsers.getDefaultEditor(Boolean.class)); - tc3.setCellRenderer(tablePermittedUsers.getDefaultRenderer(Boolean.class)); + tc3.setCellRenderer(tablePermittedUsers + .getDefaultRenderer(Boolean.class)); tc3.setHeaderRenderer(new CheckBoxHeader(new MyItemListener3(), (String) titles[3])); @@ -377,14 +327,6 @@ public class PermissionCreateLecture_GUI extends JFrame { lblvolleRechteRead.setBounds(128, 78, 380, 40); panel.add(lblvolleRechteRead); - JCheckBox checkBox = new JCheckBox(""); - checkBox.setBounds(123, 118, 21, 23); - panel.add(checkBox); - - JLabel label_4 = new JLabel("Für alle sichtbar"); - label_4.setBounds(28, 119, 90, 20); - panel.add(label_4); - JPanel panel_1 = new JPanel(); panel_1.setLayout(null); panel_1.setBorder(new TitledBorder(null, "Suite-Berechtigungen", @@ -398,23 +340,52 @@ public class PermissionCreateLecture_GUI extends JFrame { .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneMyImage.setBounds(10, 28, 291, 251); panel_1.add(scrollPaneMyImage); - - + tablePermittedUsers.setBounds(0, 0, 555, 1); - //panel_1.add(tablePermittedUsers); - + // panel_1.add(tablePermittedUsers); + scrollPaneMyImage.setViewportView(tablePermittedUsers); - - - JButton button = new JButton("Hinzufügen"); - button.setBounds(10, 290, 89, 23); - panel_1.add(button); + JButton btnAddUser = new JButton("Hinzufügen..."); + btnAddUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // show list of all other relevant users + ListAllOtherUsers_GUI lu = new ListAllOtherUsers_GUI(c, + tablePermittedUsers, 4); // give access to the table + // model and inform that the + // userID is position 5 in + // the model + lu.setVisible(true); + } + }); + btnAddUser.setBounds(10, 290, 113, 23); + panel_1.add(btnAddUser); + + JButton btnDeleteUser = new JButton("Löschen"); + btnDeleteUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { - JButton button_1 = new JButton("Löschen"); - button_1.setEnabled(false); - button_1.setBounds(109, 290, 89, 23); - panel_1.add(button_1); + // delete selected users from table + int[] deletableRows = tablePermittedUsers.getSelectedRows(); + int pointerCorrection = 0; // after deleting a row, the length + // of selected rows is reduced by 1. + // This pointer counts the already + // deleted rows and correct the + // offset of i + LOGGER.info("deletabelRows.length=" + deletableRows.length); + + for (int i = 0; i < deletableRows.length; i++) { + + LOGGER.info("Deleting rowCount[" + i + + "], tableRow number " + + deletableRows[i - pointerCorrection]); + model.removeRow(deletableRows[i - pointerCorrection]); + pointerCorrection++; + } + } + }); + btnDeleteUser.setBounds(133, 290, 113, 23); + panel_1.add(btnDeleteUser); JPanel panel_2 = new JPanel(); panel_2.setLayout(null); @@ -477,6 +448,16 @@ public class PermissionCreateLecture_GUI extends JFrame { continueButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { + // before save, check integrity to avoid dblClick errors + // of rights + for (int i = 0; i < tablePermittedUsers.getRowCount(); i++) { + checkIntegrity(i); // check integrity of each line + // again + System.out.println("in auto-correct"); + } + + saveTableToList(); + CreateLectureLink_GUI ea = new CreateLectureLink_GUI(c); ea.setVisible(true); dispose(); @@ -513,11 +494,8 @@ public class PermissionCreateLecture_GUI extends JFrame { URI windows; try { windows = new URI(Links.getFAQ()); - open.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -534,11 +512,8 @@ public class PermissionCreateLecture_GUI extends JFrame { URI windows; try { windows = new URI(Links.getOTRS()); - open.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -580,21 +555,19 @@ public class PermissionCreateLecture_GUI extends JFrame { selectedRow = row; } - boolean isRead, isWrite, isLink, isAdmin; + boolean isRead, isWrite, isAdmin; // collect all row data isRead = (boolean) tablePermittedUsers.getValueAt(selectedRow, 1); isWrite = (boolean) tablePermittedUsers.getValueAt(selectedRow, 2); - isLink = (boolean) tablePermittedUsers.getValueAt(selectedRow, 3); - isAdmin = (boolean) tablePermittedUsers.getValueAt(selectedRow, 4); + isAdmin = (boolean) tablePermittedUsers.getValueAt(selectedRow, 3); - boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite, - isLink, isAdmin); + boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite,isAdmin, false); tablePermittedUsers.setValueAt(checkedVals[0], selectedRow, 1); tablePermittedUsers.setValueAt(checkedVals[1], selectedRow, 2); - tablePermittedUsers.setValueAt(checkedVals[2], selectedRow, 3); - tablePermittedUsers.setValueAt(checkedVals[3], selectedRow, 4); + tablePermittedUsers.setValueAt(checkedVals[3], selectedRow, 3); + // tablePermittedUsers.setValueAt(checkedVals[3], selectedRow, 4); }// end checkIntegrity() // Column 0 == Concat user name @@ -661,37 +634,42 @@ public class PermissionCreateLecture_GUI extends JFrame { int seperatorIndex = 0; // get values from table and save the checkbox values - if (map == null) - System.out.println("Error: map is null"); // for (int i = 0; i < map.size(); i++) { for (int i = 0; i < tablePermittedUsers.getRowCount(); i++) { // System.out.println("in for, rowcount="+table.getRowCount()); person temp = new person(); - // table.getModel().setValueAt(map.get, i, 5); - - temp.setUserID(tablePermittedUsers.getModel().getValueAt(i, 5).toString()); // get - // userID - temp.setImageAdmin(Boolean.parseBoolean(tablePermittedUsers.getModel() - .getValueAt(i, 4).toString())); // get Admin - temp.setImageLinkAllowed(Boolean.parseBoolean(tablePermittedUsers.getModel() - .getValueAt(i, 3).toString()));// get Link - temp.setImageWrite(Boolean.parseBoolean(tablePermittedUsers.getModel() - .getValueAt(i, 2).toString()));// get Write - temp.setImageRead(Boolean.parseBoolean(tablePermittedUsers.getModel().getValueAt(i, 1) - .toString()));// get Read - seperatorIndex = tablePermittedUsers.getModel().getValueAt(i, 0).toString() - .indexOf(","); - temp.setName(tablePermittedUsers.getModel().getValueAt(i, 0).toString() - .substring(0, seperatorIndex)); - temp.setVorname(tablePermittedUsers.getModel().getValueAt(i, 0).toString() - .substring(seperatorIndex + 2)); + seperatorIndex = tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().indexOf(","); + LOGGER.info(tablePermittedUsers.getModel().getValueAt(i, 4) + .toString() +" (userID)\t"+ Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 3).toString())+"(admin)\t"+Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 2).toString())+"(write)\t"+Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 1).toString())+"(read)\t"+tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().substring(0, seperatorIndex)+"(Nachname)\t"+tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().substring(seperatorIndex + 2)+"(Vorname)"); + + temp.setUserID(tablePermittedUsers.getModel().getValueAt(i, 4) + .toString()); // get + // userID + temp.setLecture_admin(Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 3).toString())); // get Admin + temp.setLecture_write(Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 2).toString()));// get Write + temp.setLecture_read(Boolean.parseBoolean(tablePermittedUsers + .getModel().getValueAt(i, 1).toString()));// get Read + seperatorIndex = tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().indexOf(","); + temp.setName(tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().substring(0, seperatorIndex)); + temp.setVorname(tablePermittedUsers.getModel().getValueAt(i, 0) + .toString().substring(seperatorIndex + 2)); // check if at least one checkbox is checked. If yes, save this // entry into list, if not ignore this entry - if (temp.isImageAdmin() || temp.isImageLinkAllowed() || temp.isImageWrite() - || temp.isImageRead()) { + if (temp.isLecture_admin() || temp.isLecture_write() + || temp.isLecture_read()) { // save entry list.add(temp); } else { @@ -699,9 +677,6 @@ public class PermissionCreateLecture_GUI extends JFrame { } } - System.out.println("Setting list information.\tTable size: " - + tablePermittedUsers.getRowCount() + "\t List length (=selected users): " - + list.size()); for (int y = 0; y < list.size(); y++) { System.out.println("" + list.get(y).getName()); } diff --git a/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java index f2e29690..cb01d824 100644 --- a/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/PermissionEditLecture_GUI.java @@ -1,7 +1,8 @@ package gui.lecture; - +import gui.image.PermissionCreateImage_GUI; import gui.intro.About_GUI; +import gui.intro.ListAllOtherUsers_GUI; import gui.intro.MainMenue_GUI; import java.awt.Color; @@ -19,6 +20,9 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.net.URI; import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; import javax.swing.AbstractButton; import javax.swing.DefaultComboBoxModel; @@ -46,45 +50,56 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; +import models.Image; +import models.Lecture; import models.Links; +import models.RightsManagement; +import models.person; +import server.generated.Person; +import server.generated.Server.Client; +import util.CheckIntegrity; import util.OpenLinks; import javax.swing.JCheckBox; +import org.apache.log4j.Logger; +import org.apache.thrift.TException; + @SuppressWarnings("serial") public class PermissionEditLecture_GUI extends JFrame { + private final static Logger LOGGER = Logger + .getLogger(PermissionCreateImage_GUI.class); + Client client = models.Client.clientcon.getClient(); private final JPanel contentPanel = new JPanel(); String[] result; private JTable table; private Class[] classes; - Object[] titles = { "Name","Read", "Write","Admin"}; + Object[] titles = { "Name", "Read", "Write", "Admin", "userID" }; + private List<Person> map = null; // List of people who have rights Component c = null; - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "Hier können Sie die Berechtigungen für Ihre Veranstaltung festlegen.<br />" + - "Es wird unterschieden, ob innerhalb der Suite (dieses Programm) Änderungen vorgenommen werden dürfen, <br />" + - "und/oder ob die Veranstaltung auch im VMChooser angezeigt wird." + - "</div></html>"; - - final DefaultTableModel model = new DefaultTableModel(titles, 0){ - - - - public boolean isCellEditable(int rowIndex, int mColIndex) { - if(mColIndex>=1){ - return true; - } - return false; - } - public Class getColumnClass(int c) { - switch(c){ - case 0: - return String.class; - default: - return Boolean.class; - } - } - - + private static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "Hier können Sie die Berechtigungen für Ihre Veranstaltung festlegen.<br />" + + "Es wird unterschieden, ob innerhalb der Suite (dieses Programm) Änderungen vorgenommen werden dürfen, <br />" + + "und/oder ob die Veranstaltung auch im VMChooser angezeigt wird." + + "</div></html>"; + + final DefaultTableModel model = new DefaultTableModel(titles, 0) { + + public boolean isCellEditable(int rowIndex, int mColIndex) { + if (mColIndex >= 1) { + return true; + } + return false; + } + + public Class getColumnClass(int c) { + switch (c) { + case 0: + return String.class; + default: + return Boolean.class; + } + } }; @@ -96,7 +111,7 @@ public class PermissionEditLecture_GUI extends JFrame { } }); setResizable(false); - + try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException @@ -117,16 +132,18 @@ public class PermissionEditLecture_GUI extends JFrame { getContentPane().add(panel); panel.setLayout(null); { - JLabel lblNewLabel = new JLabel("Veranstaltung - Berechtigungen (Nur zur Veranschaulichung)"); + JLabel lblNewLabel = new JLabel( + "Veranstaltung - Berechtigungen"); 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("Definieren Sie hier bitte die gewünschten Berechtigungen für Ihre Veranstaltung"); + txtpnBitteWhlenSie + .setText("Definieren Sie hier bitte die gewünschten Berechtigungen für Ihre Veranstaltung"); txtpnBitteWhlenSie.setBounds(10, 36, 509, 32); panel.add(txtpnBitteWhlenSie); } @@ -135,159 +152,261 @@ public class PermissionEditLecture_GUI extends JFrame { contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel); contentPanel.setLayout(null); - + JPanel panel = new JPanel(); panel.setLayout(null); - panel.setBorder(new TitledBorder(null, "Beschreibung", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBorder(new TitledBorder(null, "Beschreibung", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel.setBackground(SystemColor.menu); - panel.setBounds(10, 35, 557, 148); + panel.setBounds(10, 35, 557, 130); contentPanel.add(panel); - + JLabel label = new JLabel("Read"); label.setBounds(28, 18, 90, 20); panel.add(label); - - JLabel label_3 = new JLabel("Image darf gelesen und gestartet werden und ist in Suchfenster sichtbar."); + + JLabel label_3 = new JLabel( + "Image darf gelesen und gestartet werden und ist in Suchfenster sichtbar."); label_3.setBounds(128, 18, 380, 20); panel.add(label_3); - + JLabel label_4 = new JLabel("Write"); label_4.setBounds(28, 38, 90, 20); panel.add(label_4); - - JLabel label_5 = new JLabel("<HTML>Image darf angepasst und überschrieben, jedoch nicht gelöscht werden. Berechtigungen für andere Benutzer festlegen</HTML>"); + + JLabel label_5 = new JLabel( + "<HTML>Image darf angepasst und überschrieben, jedoch nicht gelöscht werden. Berechtigungen für andere Benutzer festlegen</HTML>"); label_5.setBounds(128, 38, 380, 45); panel.add(label_5); - + JLabel label_6 = new JLabel("Admin"); label_6.setBounds(28, 78, 90, 20); panel.add(label_6); - - JLabel label_7 = new JLabel("<HTML>Volle Rechte: read, write, löschen und Berechtigungen für andere Benutzer festlegen.</HTML>"); + + JLabel label_7 = new JLabel( + "<HTML>Volle Rechte: read, write, löschen und Berechtigungen für andere Benutzer festlegen.</HTML>"); label_7.setBounds(128, 78, 380, 40); panel.add(label_7); - - JLabel label_8 = new JLabel("Für alle sichtbar"); - label_8.setBounds(28, 119, 90, 20); - panel.add(label_8); - - JCheckBox checkBox = new JCheckBox(""); - checkBox.setBounds(123, 118, 21, 23); - panel.add(checkBox); - + JPanel panel_1 = new JPanel(); panel_1.setBackground(SystemColor.menu); - panel_1.setBorder(new TitledBorder(null, "Suite-Berechtigungen", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_1.setBorder(new TitledBorder(null, "Suite-Berechtigungen", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_1.setBounds(10, 194, 311, 326); contentPanel.add(panel_1); panel_1.setLayout(null); - + JScrollPane scrollPane = new JScrollPane(); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane + .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBounds(10, 28, 291, 251); panel_1.add(scrollPane); - + table = new JTable(); table.setModel(model); table.setSelectionForeground(Color.WHITE); - Object[] rowdata={"Max Mustermann", new Boolean(false),new Boolean(false),new Boolean(false),new Boolean(false)}; - model.addRow(rowdata); - - TableCellRenderer rend=table.getTableHeader().getDefaultRenderer(); - - - TableColumn tc1 = table.getColumnModel().getColumn(1); - tc1.setCellEditor(table.getDefaultEditor(Boolean.class)); - tc1.setCellRenderer(table.getDefaultRenderer(Boolean.class)); - tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(),(String) titles[1])); - - TableColumn tc2 = table.getColumnModel().getColumn(2); - tc2.setCellEditor(table.getDefaultEditor(Boolean.class)); - tc2.setCellRenderer(table.getDefaultRenderer(Boolean.class)); - tc2.setHeaderRenderer(new CheckBoxHeader(new MyItemListener2(),(String) titles[2])); - - TableColumn tc3 = table.getColumnModel().getColumn(3); - tc3.setCellEditor(table.getDefaultEditor(Boolean.class)); - tc3.setCellRenderer(table.getDefaultRenderer(Boolean.class)); - tc3.setHeaderRenderer(new CheckBoxHeader(new MyItemListener3(),(String) titles[3])); - /* - TableColumn tc4 = table.getColumnModel().getColumn(4); - tc4.setCellEditor(table.getDefaultEditor(Boolean.class)); - tc4.setCellRenderer(table.getDefaultRenderer(Boolean.class)); - tc4.setHeaderRenderer(new CheckBoxHeader(new MyItemListener4(),(String) titles[4])); - */ + + // invisible attribute userID for identifying selected user + table.getColumnModel().getColumn(4).setWidth(0); + table.getColumnModel().getColumn(4).setMinWidth(0); + table.getColumnModel().getColumn(4).setMaxWidth(0); + + // if new session, get values for table from database + if (RightsManagement.rightsManagement.getPermittedUserList().size() <= 0) { + System.out.println("Loading data from db"); + try { + + map = client.getPermissionForUserAndLecture( + person.verantwortlicher.getUserID(), + Lecture.lecture.getid()); + Iterator<server.generated.Person> i = map.iterator(); + + int x = 0; + + while (i.hasNext()) { + // erzeuge Objekte fuer die Tabelle + Object[] obj = { + map.get(x).getNachname() + ", " + + map.get(x).getVorname(), // Name + (boolean) map.get(x).isLecture_read(), // Read + (boolean) map.get(x).isLecture_write(), // Write + (boolean) map.get(x).isLecture_admin(), // Admin + map.get(x).getUserID() // userID + }; + // System.out.println(map.get(x).isImage_read() + ""); + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + + i.next(); + x++; + + } + + } catch (TException e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + } + } else // read from model + { + System.out.println("reading from model"); + System.out + .println("RightsManagement.rightsManagement.getPermittedUserList().size() = " + + RightsManagement.rightsManagement + .getPermittedUserList().size()); + + List<person> listt = RightsManagement.rightsManagement + .getPermittedUserList(); + Iterator<person> i = listt.iterator(); + + int x = 0; + while (i.hasNext()) { + // System.out.println("current pos=" + x); + // erzeuge Objekte fuer die Tabelle + person temp = i.next(); + + Object[] obj = { temp.getName() + ", " + temp.getVorname(), // Name + temp.isLecture_read(), // Read + temp.isLecture_write(), // Write + temp.isLecture_admin(), // Admin + temp.getUserID() // userID + }; + System.out.println("Processing: " + temp.getName() + ", " + + temp.getVorname() + ", " + temp.isLecture_read() + + ", " + temp.isLecture_write() + ", " + + temp.isLecture_admin() + ", " + temp.getUserID()); + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + } + }// end set list of permitted users + + // Object[] rowdata={"Max Mustermann", new Boolean(false),new + // Boolean(false),new Boolean(false),new Boolean(false)}; + // model.addRow(rowdata); + + TableCellRenderer rend = table.getTableHeader().getDefaultRenderer(); + + TableColumn tc1 = table.getColumnModel().getColumn(1); + tc1.setCellEditor(table.getDefaultEditor(Boolean.class)); + tc1.setCellRenderer(table.getDefaultRenderer(Boolean.class)); + tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(), + (String) titles[1])); + + TableColumn tc2 = table.getColumnModel().getColumn(2); + tc2.setCellEditor(table.getDefaultEditor(Boolean.class)); + tc2.setCellRenderer(table.getDefaultRenderer(Boolean.class)); + tc2.setHeaderRenderer(new CheckBoxHeader(new MyItemListener2(), + (String) titles[2])); + + TableColumn tc3 = table.getColumnModel().getColumn(3); + tc3.setCellEditor(table.getDefaultEditor(Boolean.class)); + tc3.setCellRenderer(table.getDefaultRenderer(Boolean.class)); + tc3.setHeaderRenderer(new CheckBoxHeader(new MyItemListener3(), + (String) titles[3])); + scrollPane.setViewportView(table); - - JButton button = new JButton("Hinzufügen"); - button.setEnabled(false); - button.setBounds(10, 290, 89, 23); - panel_1.add(button); - - JButton button_1 = new JButton("Löschen"); - button_1.setEnabled(false); - button_1.setBounds(109, 290, 89, 23); - panel_1.add(button_1); - + + JButton btnAddUser = new JButton("Hinzufügen"); + btnAddUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + // show list of all other relevant users + ListAllOtherUsers_GUI lu = new ListAllOtherUsers_GUI(c, table, + 4); // give access to the table model and inform that + // the userID is position 5 in the model + lu.setVisible(true); + } + }); + btnAddUser.setBounds(10, 290, 113, 23); + panel_1.add(btnAddUser); + + JButton btnDeleteUser = new JButton("Löschen"); + btnDeleteUser.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + // delete selected users from table + int[] deletableRows = table.getSelectedRows(); + int pointerCorrection = 0; // after deleting a row, the length + // of selected rows is reduced by 1. + // This pointer counts the already + // deleted rows and correct the + // offset of i + LOGGER.info("deletabelRows.length=" + deletableRows.length); + + for (int i = 0; i < deletableRows.length; i++) { + + LOGGER.info("Deleting rowCount[" + i + + "], tableRow number " + + deletableRows[i - pointerCorrection]); + model.removeRow(deletableRows[i - pointerCorrection]); + pointerCorrection++; + } + } + }); + btnDeleteUser.setBounds(133, 290, 113, 23); + panel_1.add(btnDeleteUser); + JLabel lblHauptmen = new JLabel("Hauptmenü"); lblHauptmen.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - + PermissionEditLecture_GUI.this.setVisible(false); - MainMenue_GUI main=new MainMenue_GUI(c); + MainMenue_GUI main = new MainMenue_GUI(c); 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("Veranstaltung"); lblVlimage.setForeground(Color.BLUE); lblVlimage.setBounds(81, 11, 90, 14); contentPanel.add(lblVlimage); - + JLabel label_2 = new JLabel(">"); label_2.setBounds(181, 11, 13, 14); contentPanel.add(label_2); - + JLabel lblNewLabel_1 = new JLabel("Bearbeiten"); lblNewLabel_1.setBounds(194, 11, 155, 14); contentPanel.add(lblNewLabel_1); - + JPanel panel_2 = new JPanel(); panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Sichtbarkeit im VMChooser", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBorder(new TitledBorder(null, "Sichtbarkeit im VMChooser", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_2.setBackground(SystemColor.menu); panel_2.setBounds(331, 194, 236, 326); contentPanel.add(panel_2); - + final JScrollPane scrollPane_1 = new JScrollPane(); - scrollPane_1.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane_1 + .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane_1.setEnabled(false); scrollPane_1.setBounds(16, 88, 210, 191); panel_2.add(scrollPane_1); - + JRadioButton rdbtnAlle = new JRadioButton("Sichtbar für alle"); rdbtnAlle.setSelected(true); rdbtnAlle.setEnabled(false); rdbtnAlle.setBounds(6, 32, 109, 23); panel_2.add(rdbtnAlle); - + JRadioButton rdbtnIndividuell = new JRadioButton("Individuell"); rdbtnIndividuell.setEnabled(false); rdbtnIndividuell.setBounds(6, 58, 109, 23); panel_2.add(rdbtnIndividuell); - + final JButton btnAddVmUser = new JButton("Hinzufügen"); btnAddVmUser.setEnabled(false); btnAddVmUser.setBounds(23, 290, 89, 23); panel_2.add(btnAddVmUser); - + final JButton btnDelVmUser = new JButton("Löschen"); btnDelVmUser.setEnabled(false); btnDelVmUser.setBounds(122, 290, 89, 23); @@ -302,26 +421,36 @@ public class PermissionEditLecture_GUI extends JFrame { JButton cancelButton = new JButton("Zurück"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - - EditLectureAllgemein_GUI sr=new EditLectureAllgemein_GUI(c); + + EditLectureAllgemein_GUI sr = new EditLectureAllgemein_GUI( + c); sr.setVisible(true); dispose(); } }); cancelButton.setActionCommand("OK"); buttonPane.add(cancelButton); - //getRootPane().setDefaultButton(cancelButton); + // getRootPane().setDefaultButton(cancelButton); } { JButton continueButton = new JButton("Weiter"); continueButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - EditLectureLink_GUI ea=new EditLectureLink_GUI(c); + + // before save, check integrity to avoid dblClick errors + // of rights + for (int i = 0; i < table.getRowCount(); i++) { + checkIntegrity(i); // check integrity of each line + // again + System.out.println("in auto-correct"); + } + + saveTableToList(); + + EditLectureLink_GUI ea = new EditLectureLink_GUI(c); ea.setVisible(true); dispose(); - + } }); continueButton.setActionCommand("Cancel"); @@ -329,8 +458,7 @@ public class PermissionEditLecture_GUI extends JFrame { getRootPane().setDefaultButton(continueButton); } } - - + rdbtnAlle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scrollPane_1.setEnabled(false); @@ -338,42 +466,42 @@ public class PermissionEditLecture_GUI extends JFrame { btnDelVmUser.setEnabled(false); } }); - + rdbtnIndividuell.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scrollPane_1.setEnabled(true); btnAddVmUser.setEnabled(true); - btnDelVmUser.setEnabled(true); + btnDelVmUser.setEnabled(true); } }); - + 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"); mntmFaq.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - + OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getFAQ()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); @@ -381,7 +509,6 @@ public class PermissionEditLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmFaq); - JMenuItem mntmOtrs = new JMenuItem("OTRS"); mntmOtrs.addMouseListener(new MouseAdapter() { @@ -389,22 +516,22 @@ public class PermissionEditLecture_GUI extends JFrame { public void mousePressed(MouseEvent arg0) { OpenLinks open = new OpenLinks(); - + URI windows; try { windows = new URI(Links.getOTRS()); - + open.openWebpage(windows); - + } catch (URISyntaxException e) { // TODO Auto-generated catch block e.printStackTrace(); } - + } }); mnNewMenu_1.add(mntmOtrs); - + JMenuItem mntmAbout = new JMenuItem("About"); mntmAbout.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { @@ -413,130 +540,194 @@ public class PermissionEditLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmAbout); - + JMenu mnNewMenu_Info = new JMenu("Info"); mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - JOptionPane.showMessageDialog(c, HELP_MESSAGE, "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE); + JOptionPane.showMessageDialog(c, HELP_MESSAGE, + "Hilfe zu dieser Oberfläche", + JOptionPane.INFORMATION_MESSAGE); } }); menuBar.add(mnNewMenu_Info); - + c = this; - + + }// end constructor + + private void checkIntegrity(int row) { + + int selectedRow; + + if (row == -1) { + selectedRow = table.getSelectedRow(); + } else { + selectedRow = row; + } + + boolean isRead, isWrite, isAdmin; + + // collect all row data + isRead = (boolean) table.getValueAt(selectedRow, 1); + isWrite = (boolean) table.getValueAt(selectedRow, 2); + isAdmin = (boolean) table.getValueAt(selectedRow, 3); + + boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite,isAdmin, false); + + table.setValueAt(checkedVals[0], selectedRow, 1); + table.setValueAt(checkedVals[1], selectedRow, 2); + table.setValueAt(checkedVals[3], selectedRow, 3); + }// end checkIntegrity() + + // save the entered rights into the model and prepare them to be written to + // the database + private void saveTableToList() { + System.out.println("Saving Table to List"); + + List<person> list = new ArrayList<person>(); + + int seperatorIndex = 0; + + // get values from table and save the checkbox values + + // for (int i = 0; i < map.size(); i++) { + for (int i = 0; i < table.getRowCount(); i++) { + // System.out.println("in for, rowcount="+table.getRowCount()); + person temp = new person(); + + seperatorIndex = table.getModel().getValueAt(i, 0).toString() + .indexOf(","); + LOGGER.info(table.getModel().getValueAt(i, 4).toString() + + " (userID)\t" + + Boolean.parseBoolean(table.getModel().getValueAt(i, 3) + .toString()) + + "(admin)\t" + + Boolean.parseBoolean(table.getModel().getValueAt(i, 2) + .toString()) + + "(write)\t" + + Boolean.parseBoolean(table.getModel().getValueAt(i, 1) + .toString()) + + "(read)\t" + + table.getModel().getValueAt(i, 0).toString() + .substring(0, seperatorIndex) + + "(Nachname)\t" + + table.getModel().getValueAt(i, 0).toString() + .substring(seperatorIndex + 2) + "(Vorname)"); + + temp.setUserID(table.getModel().getValueAt(i, 4).toString()); // get + // userID + temp.setLecture_admin(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 3).toString())); // get Admin + temp.setLecture_write(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 2).toString()));// get Write + temp.setLecture_read(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 1).toString()));// get Read + seperatorIndex = table.getModel().getValueAt(i, 0).toString() + .indexOf(","); + temp.setName(table.getModel().getValueAt(i, 0).toString() + .substring(0, seperatorIndex)); + temp.setVorname(table.getModel().getValueAt(i, 0).toString() + .substring(seperatorIndex + 2)); + + // check if at least one checkbox is checked. If yes, save this + // entry into list, if not ignore this entry + if (temp.isLecture_admin() || temp.isLecture_write() + || temp.isLecture_read()) { + // save entry + list.add(temp); + } else { + // do nothing + } + } + + for (int y = 0; y < list.size(); y++) { + System.out.println("" + list.get(y).getName()); + } + + RightsManagement.rightsManagement.setPermittedUserList(list); + }// end saveTableToList() + + class MyItemListener1 implements ItemListener { + public void itemStateChanged(ItemEvent e) { + Object source = e.getSource(); + if (source instanceof AbstractButton == false) + return; + boolean checked = e.getStateChange() == ItemEvent.SELECTED; + for (int x = 0, y = table.getRowCount(); x < y; x++) { + table.setValueAt(new Boolean(checked), x, 1); + } + } + } + + class MyItemListener2 implements ItemListener { + public void itemStateChanged(ItemEvent e) { + Object source = e.getSource(); + if (source instanceof AbstractButton == false) + return; + boolean checked = e.getStateChange() == ItemEvent.SELECTED; + for (int x = 0, y = table.getRowCount(); x < y; x++) { + table.setValueAt(new Boolean(checked), x, 2); + } + } + } + + class MyItemListener3 implements ItemListener { + public void itemStateChanged(ItemEvent e) { + Object source = e.getSource(); + if (source instanceof AbstractButton == false) + return; + boolean checked = e.getStateChange() == ItemEvent.SELECTED; + for (int x = 0, y = table.getRowCount(); x < y; x++) { + table.setValueAt(new Boolean(checked), x, 3); + } + } + } + + class MyItemListener4 implements ItemListener { + public void itemStateChanged(ItemEvent e) { + Object source = e.getSource(); + if (source instanceof AbstractButton == false) + return; + boolean checked = e.getStateChange() == ItemEvent.SELECTED; + for (int x = 0, y = table.getRowCount(); x < y; x++) { + table.setValueAt(new Boolean(checked), x, 4); + } + } } - class MyItemListener1 implements ItemListener - { - public void itemStateChanged(ItemEvent e) { - Object source = e.getSource(); - if (source instanceof AbstractButton == false) return; - boolean checked = e.getStateChange() == ItemEvent.SELECTED; - for(int x = 0, y = table.getRowCount(); x < y; x++) - { - table.setValueAt(new Boolean(checked),x,1); - } - } - } - class MyItemListener2 implements ItemListener - { - public void itemStateChanged(ItemEvent e) { - Object source = e.getSource(); - if (source instanceof AbstractButton == false) return; - boolean checked = e.getStateChange() == ItemEvent.SELECTED; - for(int x = 0, y = table.getRowCount(); x < y; x++) - { - table.setValueAt(new Boolean(checked),x,2); - } - } - } - class MyItemListener3 implements ItemListener - { - public void itemStateChanged(ItemEvent e) { - Object source = e.getSource(); - if (source instanceof AbstractButton == false) return; - boolean checked = e.getStateChange() == ItemEvent.SELECTED; - for(int x = 0, y = table.getRowCount(); x < y; x++) - { - table.setValueAt(new Boolean(checked),x,3); - } - } - } - class MyItemListener4 implements ItemListener - { - public void itemStateChanged(ItemEvent e) { - Object source = e.getSource(); - if (source instanceof AbstractButton == false) return; - boolean checked = e.getStateChange() == ItemEvent.SELECTED; - for(int x = 0, y = table.getRowCount(); x < y; x++) - { - table.setValueAt(new Boolean(checked),x,4); - } - } - } } -/*class CheckBoxHeader extends JCheckBox -implements TableCellRenderer, MouseListener { -protected CheckBoxHeader rendererComponent; -protected int column; -protected boolean mousePressed = false; - -public CheckBoxHeader(ItemListener itemListener ,String text) { -rendererComponent = this; -rendererComponent.addItemListener(itemListener); -rendererComponent.setText(text); -} - -public Component getTableCellRendererComponent( - JTable table, Object value, - boolean isSelected, boolean hasFocus, int row, int column) { -if (table != null) { - JTableHeader header = table.getTableHeader(); - if (header != null) { - rendererComponent.setForeground(header.getForeground()); - rendererComponent.setBackground(header.getBackground()); - rendererComponent.setFont(header.getFont()); - rendererComponent.setBorder(header.getBorder()); - header.addMouseListener(rendererComponent); - } -} -setColumn(column); -//rendererComponent.setText("Check All"); -//setBorder(UIManager.getBorder("TableHeader.cellBorder")); - -return rendererComponent; -} -protected void setColumn(int column) { -this.column = column; -} -public int getColumn() { -return column; -} -protected void handleClickEvent(MouseEvent e) { -if (mousePressed) { - mousePressed=false; - JTableHeader header = (JTableHeader)(e.getSource()); - JTable tableView = header.getTable(); - TableColumnModel columnModel = tableView.getColumnModel(); - int viewColumn = columnModel.getColumnIndexAtX(e.getX()); - int column = tableView.convertColumnIndexToModel(viewColumn); - - if (viewColumn == this.column && e.getClickCount() == 1 && column != -1) { - doClick(); - } -} -} -public void mouseClicked(MouseEvent e) { -handleClickEvent(e); -((JTableHeader)e.getSource()).repaint(); -} -public void mousePressed(MouseEvent e) { -mousePressed = true; -} -public void mouseReleased(MouseEvent e) { -} -public void mouseEntered(MouseEvent e) { -} -public void mouseExited(MouseEvent e) { -} -} */ +/* + * class CheckBoxHeader extends JCheckBox implements TableCellRenderer, + * MouseListener { protected CheckBoxHeader rendererComponent; protected int + * column; protected boolean mousePressed = false; + * + * public CheckBoxHeader(ItemListener itemListener ,String text) { + * rendererComponent = this; rendererComponent.addItemListener(itemListener); + * rendererComponent.setText(text); } + * + * public Component getTableCellRendererComponent( JTable table, Object value, + * boolean isSelected, boolean hasFocus, int row, int column) { if (table != + * null) { JTableHeader header = table.getTableHeader(); if (header != null) { + * rendererComponent.setForeground(header.getForeground()); + * rendererComponent.setBackground(header.getBackground()); + * rendererComponent.setFont(header.getFont()); + * rendererComponent.setBorder(header.getBorder()); + * header.addMouseListener(rendererComponent); } } setColumn(column); + * //rendererComponent.setText("Check All"); + * //setBorder(UIManager.getBorder("TableHeader.cellBorder")); + * + * return rendererComponent; } protected void setColumn(int column) { + * this.column = column; } public int getColumn() { return column; } protected + * void handleClickEvent(MouseEvent e) { if (mousePressed) { mousePressed=false; + * JTableHeader header = (JTableHeader)(e.getSource()); JTable tableView = + * header.getTable(); TableColumnModel columnModel = tableView.getColumnModel(); + * int viewColumn = columnModel.getColumnIndexAtX(e.getX()); int column = + * tableView.convertColumnIndexToModel(viewColumn); + * + * if (viewColumn == this.column && e.getClickCount() == 1 && column != -1) { + * doClick(); } } } public void mouseClicked(MouseEvent e) { + * handleClickEvent(e); ((JTableHeader)e.getSource()).repaint(); } public void + * mousePressed(MouseEvent e) { mousePressed = true; } public void + * mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } + * public void mouseExited(MouseEvent e) { } } + */ diff --git a/dozentenmodul/src/main/java/models/person.java b/dozentenmodul/src/main/java/models/person.java index c786598c..4ad5bb3d 100644 --- a/dozentenmodul/src/main/java/models/person.java +++ b/dozentenmodul/src/main/java/models/person.java @@ -10,11 +10,10 @@ public class person { private String EMail; private String Tel; private String Fakultaet; - private boolean ischecked; private String role; + private boolean ischecked; private boolean image_read; private boolean image_write; - // private boolean changePermission; private boolean image_admin; private boolean image_linkAllowed; private boolean lecture_read; diff --git a/dozentenmodul/src/main/java/util/ListAllOtherUsers.java b/dozentenmodul/src/main/java/util/ListAllOtherUsers.java deleted file mode 100644 index 98b26e03..00000000 --- a/dozentenmodul/src/main/java/util/ListAllOtherUsers.java +++ /dev/null @@ -1,239 +0,0 @@ -package util; - -import gui.image.CreateImageAllgemein_GUI; -import gui.image.DeleteImage_GUI; -import gui.image.SearchEditImage_GUI; -import gui.image.SearchImage_GUI; -import gui.intro.About_GUI; -import gui.intro.MainMenue_GUI; -import gui.lecture.CreateLectureAllgemein_GUI; -import gui.lecture.DeleteLecture_GUI; -import gui.lecture.EditLectureSearch_GUI; -import gui.lecture.SearchLecture_GUI; - -import java.awt.Component; -import java.awt.FlowLayout; -import java.awt.Font; -import java.awt.ScrollPane; -import java.awt.SystemColor; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.net.URI; -import java.net.URISyntaxException; - -import javax.swing.ButtonGroup; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JSeparator; -import javax.swing.JTextArea; -import javax.swing.JTextPane; -import javax.swing.SwingConstants; -import javax.swing.ToolTipManager; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; - -import models.GUIRights; -import models.ImageRights; -import models.Links; -import models.RightsManagement; -import models.SessionData; -import models.person; - -import org.apache.log4j.Logger; -import javax.swing.JScrollPane; -import javax.swing.ScrollPaneConstants; -import javax.swing.JTable; -import java.awt.Color; - - -public class ListAllOtherUsers extends JFrame { - - - private final static Logger LOGGER = Logger.getLogger(MainMenue_GUI.class); - - private final JPanel contentPanel = new JPanel(); - - private JMenuItem mntmAbout; - Component c = null; - private JTable table; - - - /** - * Create the dialog. - */ - public ListAllOtherUsers(Component formerGUI) { - - addWindowListener(new WindowAdapter() { - @Override - public void windowClosing(WindowEvent arg0) { - System.exit(0); - } - }); - try { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - } catch (ClassNotFoundException | InstantiationException - | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - setTitle("bwLehrpool Suite - Connected Server: " - + SessionData.session.getServerAdress()); - setBounds(0, 0, 603, 722); - this.setLocationRelativeTo(formerGUI); - - getContentPane().setLayout(null); - { - JPanel panel = new JPanel(); - panel.setBackground(SystemColor.menu); - panel.setBounds(10, 11, 567, 69); - getContentPane().add(panel); - panel.setLayout(null); - { - JLabel lblNewLabel = new JLabel("Liste aller Benutzer"); - 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("Bitte markeiren Sie Benutzer, denen Sie bestimmte Rechte vergeben möchten."); - txtpnBitteWhlenSie.setBounds(10, 36, 509, 22); - panel.add(txtpnBitteWhlenSie); - } - - //reset the list of permissions every time the user goes back to the main menu - RightsManagement.rightsManagement.getPermittedUserList().clear(); - - contentPanel.setBounds(10, 104, 567, 502); - contentPanel.setBackground(SystemColor.menu); - - contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); - getContentPane().add(contentPanel); - contentPanel.setLayout(null); - - JScrollPane scrollPane = new JScrollPane(); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); - scrollPane.setBounds(0, 0, 567, 491); - contentPanel.add(scrollPane); - - table = new JTable(); - table.setSelectionForeground(Color.WHITE); - table.setBounds(0, 0, 535, 1); - //contentPanel.add(table); - scrollPane.setViewportView(table); - - // ToolTipp lange anzeigen - 60sec - ToolTipManager.sharedInstance().setDismissDelay(60000); - { - JPanel buttonPane = new JPanel(); - buttonPane.setBounds(0, 630, 587, 33); - buttonPane.setBackground(SystemColor.menu); - buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); - getContentPane().add(buttonPane); - { - JButton continueButton = new JButton("Speichern"); - - - continueButton.setActionCommand("OK"); - buttonPane.add(continueButton); - getRootPane().setDefaultButton(continueButton); - } - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 617, 587, 2); - getContentPane().add(separator); - } - { - JSeparator separator = new JSeparator(); - separator.setBounds(0, 91, 587, 2); - getContentPane().add(separator); - } - - JMenuBar menuBar = new JMenuBar(); - setJMenuBar(menuBar); - - JMenu mnNewMenu_1 = new JMenu("Hilfe"); - menuBar.add(mnNewMenu_1); - - //Template for Help-Buttons - /* - JMenu mnNewMenu_Info = new JMenu("Info"); - mnNewMenu_Info.addMouseListener(new MouseAdapter() { - @Override - public void mouseClicked(MouseEvent arg0) { - JOptionPane.showMessageDialog(null, HELP_MESSAGE, "Hilfe zu dieser Oberfläche", JOptionPane.INFORMATION_MESSAGE); - } - }); - menuBar.add(mnNewMenu_Info); - * - */ - - - JMenuItem mntmFaq = new JMenuItem("FAQ"); - mntmFaq.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - URI windows; - try { - windows = new URI(Links.getFAQ()); - OpenLinks.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmFaq); - - JMenuItem mntmOtrs = new JMenuItem("OTRS"); - mntmOtrs.addMouseListener(new MouseAdapter() { - @Override - public void mousePressed(MouseEvent arg0) { - URI windows; - try { - windows = new URI(Links.getOTRS()); - OpenLinks.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - }); - mnNewMenu_1.add(mntmOtrs); - - mntmAbout = new JMenuItem("About"); - mntmAbout.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - About_GUI ab = new About_GUI(); - ab.setVisible(true); - } - }); - mnNewMenu_1.add(mntmAbout); - - c = this; - }// end main - - /** - * Enables/disables radio button given the user's rights - */ - - - -} diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index f9835738..1247c432 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -31,8 +31,6 @@ import com.mysql.jdbc.StringUtils; import sql.SQL; import util.XMLCreator; - - public class ServerHandler implements Server.Iface { static SQL sql = new SQL(); @@ -97,7 +95,7 @@ public class ServerHandler implements Server.Iface { } }// end folderTempExists() - + public boolean folderProdExists() { // check if folder temp exists, otherwise create it Path path = null; @@ -134,8 +132,6 @@ public class ServerHandler implements Server.Iface { } }// end folderProdExists() - - public String getEncodedSha1Sum(String key) { try { @@ -164,57 +160,62 @@ public class ServerHandler implements Server.Iface { } @Override - public String setInstitution(String university){ + public String setInstitution(String university) { return sql.setInstitution(university); } - + @Override - public boolean writeVLdata(String imagename, String desc ,String login, + public boolean writeVLdata(String imagename, String desc, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, boolean license, boolean internet, long ram, long cpu, String imagePath, boolean isTemplate, long filesize, long shareMode, String os) throws TException { - - String mode=null; - - if(shareMode==0) - { - mode="only_local"; - } - else{ - mode="to_be_published"; + + String mode = null; + + if (shareMode == 0) { + mode = "only_local"; + } else { + mode = "to_be_published"; } - //String pk_institution = sql.setInstitution(university); - //String pk_person = sql.setPerson(login, lastname, firstname, Mail, new Date(), pk_institution); - - //OS impl Select and write - //ACHTUNG: Anzahl der Leerzeichen muss eingehalten werden: 'Windows 7 32 bit" - String pk_os=sql.getOSpk(os.substring(0, nthIndexOf(os, " ", 2)),os.substring(nthIndexOf(os," ", 2), os.lastIndexOf(" ")).replace(" ", "")); - - //sql.setImageData(pk_person, license, internet, cpu, ram, imagename,desc, imagePath, filesize,mode,pk_os); - - sql.setImageData(login, license, internet, cpu, ram, imagename,desc, - imagePath, filesize,mode,pk_os); - + // String pk_institution = sql.setInstitution(university); + // String pk_person = sql.setPerson(login, lastname, firstname, Mail, + // new Date(), pk_institution); + + // OS impl Select and write + // ACHTUNG: Anzahl der Leerzeichen muss eingehalten werden: 'Windows 7 + // 32 bit" + String pk_os = sql.getOSpk(os.substring(0, nthIndexOf(os, " ", 2)), os + .substring(nthIndexOf(os, " ", 2), os.lastIndexOf(" ")) + .replace(" ", "")); + + // sql.setImageData(pk_person, license, internet, cpu, ram, + // imagename,desc, imagePath, filesize,mode,pk_os); + + sql.setImageData(login, license, internet, cpu, ram, imagename, desc, + imagePath, filesize, mode, pk_os); + log.info(new Date() + " - written VLdata"); // TODO Auto-generated method stub return true; } @Override - public List<Image> getImageListPermissionWrite(String userID) throws TException { + public List<Image> getImageListPermissionWrite(String userID) + throws TException { return sql.getImageListPermissionWrite(userID); } - + @Override - public List<Image> getImageListPermissionRead(String userID) throws TException { + public List<Image> getImageListPermissionRead(String userID) + throws TException { return sql.getImageListPermissionWrite(userID); } - - + @Override - public List<Image> getImageListPermissionLink(String userID) throws TException { + public List<Image> getImageListPermissionLink(String userID) + throws TException { return sql.getImageListPermissionWrite(userID); } @@ -228,8 +229,9 @@ public class ServerHandler implements Server.Iface { throws TException { return sql.getPersonData(Vorname, Nachname); } - - public void setPerson(String login, String lastname,String firstname, String mail, String Institution){ + + public void setPerson(String login, String lastname, String firstname, + String mail, String Institution) { sql.setPerson(login, lastname, firstname, mail, new Date(), Institution); } @@ -252,6 +254,8 @@ public class ServerHandler implements Server.Iface { imageversion = Integer.parseInt(map.get("version")); sql.setLectureData(pk_person, pk_image, imageversion, name, desc, shortdesc, startDate, endDate, isActive); + + XMLCreator xml = new XMLCreator(sql.getConnection(), name); try { xml.create(name); @@ -266,12 +270,13 @@ public class ServerHandler implements Server.Iface { // TODO Auto-generated catch block e.printStackTrace(); } + return false; } @Override public boolean startFileCopy(String filename) throws TException { - //copy file from folder temp to folder prod + // copy file from folder temp to folder prod String file = Configuration.config.getAbsolute_path() + "temp/" + filename; File tmpFile = new File(file); @@ -305,80 +310,74 @@ public class ServerHandler implements Server.Iface { } @Override - public boolean updateImageData(String name, String newName,String desc, + public boolean updateImageData(String name, String newName, String desc, String image_path, boolean license, boolean internet, long ram, long cpu, String id, String version, boolean isTemplate, long filesize, long shareMode, String os) throws TException { - String mode=null; - - if(shareMode==0) - { - mode="only_local"; - } - else{ - mode="to_be_published"; + String mode = null; + + if (shareMode == 0) { + mode = "only_local"; + } else { + mode = "to_be_published"; } - String pk_os=sql.getOSpk(os.substring(0, nthIndexOf(os, " ", 2)),os.substring(nthIndexOf(os," ", 2), os.lastIndexOf(" ")).replace(" ", "")); - sql.UpdateImageData(name, newName,desc ,image_path, license, internet, cpu, - ram, id, version, isTemplate, filesize,mode,pk_os); + String pk_os = sql.getOSpk(os.substring(0, nthIndexOf(os, " ", 2)), os + .substring(nthIndexOf(os, " ", 2), os.lastIndexOf(" ")) + .replace(" ", "")); + sql.UpdateImageData(name, newName, desc, image_path, license, internet, + cpu, ram, id, version, isTemplate, filesize, mode, pk_os); return false; } - - - @Override public List<Lecture> getLectureList() throws TException { - - log.info(new Date().toString() + " - returning LectureList: " + log.info(new Date().toString() + " - returning LectureList: " + sql.getLectureList().size() + " items."); return sql.getLectureList(); - } - + @Override - public List<Lecture> getLectureListPermissionRead(String userID){ - log.info(new Date().toString() + " - returning LectureListRead: "+sql.getLectureListPermissionRead(userID).size()+" items"); + public List<Lecture> getLectureListPermissionRead(String userID) { + log.info(new Date().toString() + " - returning LectureListRead: " + + sql.getLectureListPermissionRead(userID).size() + + " items for user " + userID); return sql.getLectureListPermissionRead(userID); - }//end getLectureListPermissionRead - + }// end getLectureListPermissionRead + @Override - public List<Lecture> getLectureListPermissionWrite(String userID){ - log.info(new Date().toString() + " - returning LectureListWrite: "+sql.getLectureListPermissionWrite(userID).size()+" items"); + public List<Lecture> getLectureListPermissionWrite(String userID) { + log.info(new Date().toString() + " - returning LectureListWrite: " + + sql.getLectureListPermissionWrite(userID).size() + + " items for user " + userID); return sql.getLectureListPermissionWrite(userID); - }//end getLectureListPermissionRead - + }// end getLectureListPermissionRead + @Override - public List<Lecture> getLectureListPermissionAdmin(String userID){ - log.info(new Date().toString() + " - returning LectureListAdmin: "+sql.getLectureListPermissionAdmin(userID).size()+" items"); + public List<Lecture> getLectureListPermissionAdmin(String userID) { + log.info(new Date().toString() + " - returning LectureListAdmin: " + + sql.getLectureListPermissionAdmin(userID).size() + + " items for user " + userID); return sql.getLectureListPermissionAdmin(userID); - }//end getLectureListPermissionRead - - - - - - + }// end getLectureListPermissionRead @Override public boolean updateLecturedata(String name, String newName, String shortdesc, String desc, String startDate, String endDate, - boolean isActive, String imageid,String imageversion,String user ,String firstname, - String lastname, String university, String Mail, String Tel, - String Fak, String id) throws TException { + boolean isActive, String imageid, String imageversion, String user, + String firstname, String lastname, String university, String Mail, + String Tel, String Fak, String id) throws TException { Map<String, String> map = new HashMap<String, String>(); map = sql.getDeleteXMLData(id); sql.updateLectureData(imageid, imageversion, lastname, newName, desc, shortdesc, startDate, endDate, isActive, id); - String path = Configuration.config.getAbsolute_path() - + "prod/" - + map.get("date") - .substring(0, map.get("date").length() - 2) + "_" - + university + "_" + user + "_" + map.get("name") + ".xml"; - File tmpFile=new File(path); + String path = Configuration.config.getAbsolute_path() + "prod/" + + map.get("date").substring(0, map.get("date").length() - 2) + + "_" + university + "_" + user + "_" + map.get("name") + + ".xml"; + File tmpFile = new File(path); try { FileUtils.forceDelete(tmpFile); } catch (IOException e1) { @@ -453,13 +452,13 @@ public class ServerHandler implements Server.Iface { return sql.deleteLecture(id); } - + @Override public List<String> getAllUniversities() throws TException { return sql.getAllUniversities(); } - + @Override public Map<String, String> getLectureData(String lectureid) throws TException { @@ -467,28 +466,24 @@ public class ServerHandler implements Server.Iface { + sql.getLectureData(lectureid).size() + "items."); return sql.getLectureData(lectureid); } - - - - - public static int nthIndexOf(final String string, final String token, - final int index) - { - int j = 0; - for (int i = 0; i < index; i++) - { - j = string.indexOf(token, j + 1); - if (j == -1) break; - } + public static int nthIndexOf(final String string, final String token, + final int index) { + int j = 0; - return j; - } + for (int i = 0; i < index; i++) { + j = string.indexOf(token, j + 1); + if (j == -1) + break; + } + + return j; + } @Override public boolean checkUser(String username) throws TException { return sql.checkUser(username); - + } @Override @@ -501,8 +496,9 @@ public class ServerHandler implements Server.Iface { } @Override - public boolean writeImageRights(String imagename, String username, String lastName, String firstName, String mail, String university, String role) - throws TException { + public boolean writeImageRights(String imagename, String username, + String lastName, String firstName, String mail, String university, + String role) throws TException { String pk_image = null; Map<String, String> map = new HashMap<String, String>(); int imageversion = 0; @@ -512,38 +508,40 @@ public class ServerHandler implements Server.Iface { map = sql.getImageIDandVersion(imagename); pk_image = map.get("GUID"); imageversion = Integer.parseInt(map.get("version")); - - if(role.equals("Dozent")) { - int read=1; - int write=1; - //int changePermission=0; - int admin=1; - int linkallowed=1; - int roleID=sql.getRoleID(role); - - sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); - - }else if(role.equals("Admin")){ - int read=1; - int write=1; - //int changePermission=1; - int admin=1; - int linkallowed=1; - int roleID=sql.getRoleID(role); - - sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); - } - else{ - int read=1; - int write=0; - //int changePermission=0; - int admin=0; - int linkallowed=0; - int roleID=sql.getRoleID(role); - - sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, linkallowed); + + if (role.equals("Dozent")) { + int read = 1; + int write = 1; + // int changePermission=0; + int admin = 1; + int linkallowed = 1; + int roleID = sql.getRoleID(role); + + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, + linkallowed); + + } else if (role.equals("Admin")) { + int read = 1; + int write = 1; + // int changePermission=1; + int admin = 1; + int linkallowed = 1; + int roleID = sql.getRoleID(role); + + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, + linkallowed); + } else { + int read = 1; + int write = 0; + // int changePermission=0; + int admin = 0; + int linkallowed = 0; + int roleID = sql.getRoleID(role); + + sql.setImageRights(pk_person, pk_image, roleID, read, write, admin, + linkallowed); } - + log.info(new Date() + " - written image rights"); return true; } @@ -553,72 +551,104 @@ public class ServerHandler implements Server.Iface { String lastName, String firstName, String mail, String university, String role) throws TException { String pk_lecture = null; - + String pk_institution = sql.setInstitution(university); String pk_person = sql.setPerson(username, lastName, firstName, mail, new Date(), pk_institution); - pk_lecture=sql.getLectureID(lecturename); - - if(role.equals("Dozent")) { - int read=1; - int write=1; - int changePermission=0; - int admin=0; - int roleID=sql.getRoleID(role); - - sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, changePermission, admin); - - }else if(role.equals("Admin")){ - int read=1; - int write=1; - int changePermission=1; - int admin=1; - int roleID=sql.getRoleID(role); - - sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, changePermission, admin); - } - else{ - int read=0; - int write=0; - int changePermission=0; - int admin=0; - int roleID=sql.getRoleID(role); - - sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, changePermission, admin); + pk_lecture = sql.getLectureID(lecturename); + + if (role.equals("Dozent")) { + int read = 1; + int write = 1; + // int changePermission=0; + int admin = 1; + int roleID = sql.getRoleID(role); + + sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, + admin); + + } else if (role.equals("Admin")) { + int read = 1; + int write = 1; + // int changePermission=1; + int admin = 1; + int roleID = sql.getRoleID(role); + + sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, + admin); + } else { + int read = 0; + int write = 0; + // int changePermission=0; + int admin = 0; + int roleID = sql.getRoleID(role); + + sql.setLectureRights(pk_person, pk_lecture, roleID, read, write, + admin); } - + return true; } @Override - public List<Person> getAllOtherSatelliteUsers(String userID) throws TException { + public List<Person> getAllOtherSatelliteUsers(List<String> userID) + throws TException { return sql.getAllOtherSatelliteUsers(userID); - //return null; + // return null; } - - public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin){ + public boolean writeAdditionalImageRights(String imageName, String userID, + boolean isRead, boolean isWrite, boolean isLinkAllowed, + boolean isAdmin) { boolean success = false; Map<String, String> map = new HashMap<String, String>(); map = sql.getImageIDandVersion(imageName); String imageID = map.get("GUID"); - - sql.writeAdditionalImageRights(imageID, userID, isRead, isWrite, isLinkAllowed, isAdmin); - log.info(new Date() + " - written additional image rights for "+userID); + + sql.writeAdditionalImageRights(imageID, userID, isRead, isWrite, + isLinkAllowed, isAdmin); + log.info(new Date() + " - written additional image rights for " + + userID); return success; } + public boolean writeAdditionalLectureRights(String lectureName, + String userID, boolean isRead, boolean isWrite, boolean isAdmin) { + + Map<String, String> map = new HashMap<String, String>(); + String lectureID = sql.getLectureID(lectureName); + + sql.writeAdditionalLectureRights(lectureID, userID, isRead, isWrite, + isAdmin); + log.info(new Date() + " - written additional lecture rights for " + + userID); + + return true; + } + @Override - public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws TException { + public List<Person> getPermissionForUserAndImage(String userID, + String imageID) throws TException { return sql.getPermissionForUserAndImage(userID, imageID); } + public List<Person> getPermissionForUserAndLecture(String userID, + String lectureID) { + return sql.getPermissionForUserAndLecture(userID, lectureID); + } + @Override - public void deleteAllAdditionalImagePermissions(String imageID,String userID) throws TException { - - sql.deleteAllAdditionalImagePermissions(imageID,userID); + public void deleteAllAdditionalImagePermissions(String imageID, + String userID) throws TException { + sql.deleteAllAdditionalImagePermissions(imageID, userID); return; - } - + + @Override + public void deleteAllAdditionalLecturePermissions(String lectureID, + String userID) throws TException { + sql.deleteAllAdditionalLecturePermissions(lectureID, userID); + return; + } + }// end class diff --git a/dozentenmodulserver/src/main/java/server/generated/Person.java b/dozentenmodulserver/src/main/java/server/generated/Person.java index 8129579b..d1bdac76 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Person.java +++ b/dozentenmodulserver/src/main/java/server/generated/Person.java @@ -38,13 +38,14 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); private static final org.apache.thrift.protocol.TField NACHNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("Nachname", org.apache.thrift.protocol.TType.STRING, (short)2); private static final org.apache.thrift.protocol.TField VORNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("Vorname", org.apache.thrift.protocol.TType.STRING, (short)3); - private static final org.apache.thrift.protocol.TField IMAGE_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("image_read", org.apache.thrift.protocol.TType.BOOL, (short)4); - private static final org.apache.thrift.protocol.TField IMAGE_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("image_write", org.apache.thrift.protocol.TType.BOOL, (short)5); - private static final org.apache.thrift.protocol.TField IMAGE_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("image_admin", org.apache.thrift.protocol.TType.BOOL, (short)6); - private static final org.apache.thrift.protocol.TField IMAGE_LINK_FIELD_DESC = new org.apache.thrift.protocol.TField("image_link", org.apache.thrift.protocol.TType.BOOL, (short)7); - private static final org.apache.thrift.protocol.TField LECTURE_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_read", org.apache.thrift.protocol.TType.BOOL, (short)8); - private static final org.apache.thrift.protocol.TField LECTURE_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_write", org.apache.thrift.protocol.TType.BOOL, (short)9); - private static final org.apache.thrift.protocol.TField LECTURE_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_admin", org.apache.thrift.protocol.TType.BOOL, (short)10); + private static final org.apache.thrift.protocol.TField MAIL_FIELD_DESC = new org.apache.thrift.protocol.TField("mail", org.apache.thrift.protocol.TType.STRING, (short)4); + private static final org.apache.thrift.protocol.TField IMAGE_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("image_read", org.apache.thrift.protocol.TType.BOOL, (short)5); + private static final org.apache.thrift.protocol.TField IMAGE_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("image_write", org.apache.thrift.protocol.TType.BOOL, (short)6); + private static final org.apache.thrift.protocol.TField IMAGE_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("image_admin", org.apache.thrift.protocol.TType.BOOL, (short)7); + private static final org.apache.thrift.protocol.TField IMAGE_LINK_FIELD_DESC = new org.apache.thrift.protocol.TField("image_link", org.apache.thrift.protocol.TType.BOOL, (short)8); + private static final org.apache.thrift.protocol.TField LECTURE_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_read", org.apache.thrift.protocol.TType.BOOL, (short)9); + private static final org.apache.thrift.protocol.TField LECTURE_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_write", org.apache.thrift.protocol.TType.BOOL, (short)10); + private static final org.apache.thrift.protocol.TField LECTURE_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("lecture_admin", org.apache.thrift.protocol.TType.BOOL, (short)11); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -55,6 +56,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, public String userID; // required public String Nachname; // required public String Vorname; // required + public String mail; // required public boolean image_read; // required public boolean image_write; // required public boolean image_admin; // required @@ -68,13 +70,14 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, USER_ID((short)1, "userID"), NACHNAME((short)2, "Nachname"), VORNAME((short)3, "Vorname"), - IMAGE_READ((short)4, "image_read"), - IMAGE_WRITE((short)5, "image_write"), - IMAGE_ADMIN((short)6, "image_admin"), - IMAGE_LINK((short)7, "image_link"), - LECTURE_READ((short)8, "lecture_read"), - LECTURE_WRITE((short)9, "lecture_write"), - LECTURE_ADMIN((short)10, "lecture_admin"); + MAIL((short)4, "mail"), + IMAGE_READ((short)5, "image_read"), + IMAGE_WRITE((short)6, "image_write"), + IMAGE_ADMIN((short)7, "image_admin"), + IMAGE_LINK((short)8, "image_link"), + LECTURE_READ((short)9, "lecture_read"), + LECTURE_WRITE((short)10, "lecture_write"), + LECTURE_ADMIN((short)11, "lecture_admin"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -95,19 +98,21 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return NACHNAME; case 3: // VORNAME return VORNAME; - case 4: // IMAGE_READ + case 4: // MAIL + return MAIL; + case 5: // IMAGE_READ return IMAGE_READ; - case 5: // IMAGE_WRITE + case 6: // IMAGE_WRITE return IMAGE_WRITE; - case 6: // IMAGE_ADMIN + case 7: // IMAGE_ADMIN return IMAGE_ADMIN; - case 7: // IMAGE_LINK + case 8: // IMAGE_LINK return IMAGE_LINK; - case 8: // LECTURE_READ + case 9: // LECTURE_READ return LECTURE_READ; - case 9: // LECTURE_WRITE + case 10: // LECTURE_WRITE return LECTURE_WRITE; - case 10: // LECTURE_ADMIN + case 11: // LECTURE_ADMIN return LECTURE_ADMIN; default: return null; @@ -166,6 +171,8 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.VORNAME, new org.apache.thrift.meta_data.FieldMetaData("Vorname", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.MAIL, new org.apache.thrift.meta_data.FieldMetaData("mail", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.IMAGE_READ, new org.apache.thrift.meta_data.FieldMetaData("image_read", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); tmpMap.put(_Fields.IMAGE_WRITE, new org.apache.thrift.meta_data.FieldMetaData("image_write", org.apache.thrift.TFieldRequirementType.DEFAULT, @@ -191,6 +198,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, String userID, String Nachname, String Vorname, + String mail, boolean image_read, boolean image_write, boolean image_admin, @@ -203,6 +211,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, this.userID = userID; this.Nachname = Nachname; this.Vorname = Vorname; + this.mail = mail; this.image_read = image_read; setImage_readIsSet(true); this.image_write = image_write; @@ -233,6 +242,9 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (other.isSetVorname()) { this.Vorname = other.Vorname; } + if (other.isSetMail()) { + this.mail = other.mail; + } this.image_read = other.image_read; this.image_write = other.image_write; this.image_admin = other.image_admin; @@ -251,6 +263,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, this.userID = null; this.Nachname = null; this.Vorname = null; + this.mail = null; setImage_readIsSet(false); this.image_read = false; setImage_writeIsSet(false); @@ -339,6 +352,30 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } } + public String getMail() { + return this.mail; + } + + public Person setMail(String mail) { + this.mail = mail; + return this; + } + + public void unsetMail() { + this.mail = null; + } + + /** Returns true if field mail is set (has been assigned a value) and false otherwise */ + public boolean isSetMail() { + return this.mail != null; + } + + public void setMailIsSet(boolean value) { + if (!value) { + this.mail = null; + } + } + public boolean isImage_read() { return this.image_read; } @@ -526,6 +563,14 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } break; + case MAIL: + if (value == null) { + unsetMail(); + } else { + setMail((String)value); + } + break; + case IMAGE_READ: if (value == null) { unsetImage_read(); @@ -596,6 +641,9 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, case VORNAME: return getVorname(); + case MAIL: + return getMail(); + case IMAGE_READ: return Boolean.valueOf(isImage_read()); @@ -634,6 +682,8 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return isSetNachname(); case VORNAME: return isSetVorname(); + case MAIL: + return isSetMail(); case IMAGE_READ: return isSetImage_read(); case IMAGE_WRITE: @@ -692,6 +742,15 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return false; } + boolean this_present_mail = true && this.isSetMail(); + boolean that_present_mail = true && that.isSetMail(); + if (this_present_mail || that_present_mail) { + if (!(this_present_mail && that_present_mail)) + return false; + if (!this.mail.equals(that.mail)) + return false; + } + boolean this_present_image_read = true; boolean that_present_image_read = true; if (this_present_image_read || that_present_image_read) { @@ -801,6 +860,16 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return lastComparison; } } + lastComparison = Boolean.valueOf(isSetMail()).compareTo(other.isSetMail()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetMail()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.mail, other.mail); + if (lastComparison != 0) { + return lastComparison; + } + } lastComparison = Boolean.valueOf(isSetImage_read()).compareTo(other.isSetImage_read()); if (lastComparison != 0) { return lastComparison; @@ -915,6 +984,14 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } first = false; if (!first) sb.append(", "); + sb.append("mail:"); + if (this.mail == null) { + sb.append("null"); + } else { + sb.append(this.mail); + } + first = false; + if (!first) sb.append(", "); sb.append("image_read:"); sb.append(this.image_read); first = false; @@ -1011,7 +1088,15 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 4: // IMAGE_READ + case 4: // MAIL + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.mail = iprot.readString(); + struct.setMailIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IMAGE_READ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.image_read = iprot.readBool(); struct.setImage_readIsSet(true); @@ -1019,7 +1104,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 5: // IMAGE_WRITE + case 6: // IMAGE_WRITE if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.image_write = iprot.readBool(); struct.setImage_writeIsSet(true); @@ -1027,7 +1112,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 6: // IMAGE_ADMIN + case 7: // IMAGE_ADMIN if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.image_admin = iprot.readBool(); struct.setImage_adminIsSet(true); @@ -1035,7 +1120,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 7: // IMAGE_LINK + case 8: // IMAGE_LINK if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.image_link = iprot.readBool(); struct.setImage_linkIsSet(true); @@ -1043,7 +1128,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 8: // LECTURE_READ + case 9: // LECTURE_READ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.lecture_read = iprot.readBool(); struct.setLecture_readIsSet(true); @@ -1051,7 +1136,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 9: // LECTURE_WRITE + case 10: // LECTURE_WRITE if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.lecture_write = iprot.readBool(); struct.setLecture_writeIsSet(true); @@ -1059,7 +1144,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 10: // LECTURE_ADMIN + case 11: // LECTURE_ADMIN if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { struct.lecture_admin = iprot.readBool(); struct.setLecture_adminIsSet(true); @@ -1097,6 +1182,11 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, oprot.writeString(struct.Vorname); oprot.writeFieldEnd(); } + if (struct.mail != null) { + oprot.writeFieldBegin(MAIL_FIELD_DESC); + oprot.writeString(struct.mail); + oprot.writeFieldEnd(); + } oprot.writeFieldBegin(IMAGE_READ_FIELD_DESC); oprot.writeBool(struct.image_read); oprot.writeFieldEnd(); @@ -1145,28 +1235,31 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (struct.isSetVorname()) { optionals.set(2); } - if (struct.isSetImage_read()) { + if (struct.isSetMail()) { optionals.set(3); } - if (struct.isSetImage_write()) { + if (struct.isSetImage_read()) { optionals.set(4); } - if (struct.isSetImage_admin()) { + if (struct.isSetImage_write()) { optionals.set(5); } - if (struct.isSetImage_link()) { + if (struct.isSetImage_admin()) { optionals.set(6); } - if (struct.isSetLecture_read()) { + if (struct.isSetImage_link()) { optionals.set(7); } - if (struct.isSetLecture_write()) { + if (struct.isSetLecture_read()) { optionals.set(8); } - if (struct.isSetLecture_admin()) { + if (struct.isSetLecture_write()) { optionals.set(9); } - oprot.writeBitSet(optionals, 10); + if (struct.isSetLecture_admin()) { + optionals.set(10); + } + oprot.writeBitSet(optionals, 11); if (struct.isSetUserID()) { oprot.writeString(struct.userID); } @@ -1176,6 +1269,9 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (struct.isSetVorname()) { oprot.writeString(struct.Vorname); } + if (struct.isSetMail()) { + oprot.writeString(struct.mail); + } if (struct.isSetImage_read()) { oprot.writeBool(struct.image_read); } @@ -1202,7 +1298,7 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, @Override public void read(org.apache.thrift.protocol.TProtocol prot, Person struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(10); + BitSet incoming = iprot.readBitSet(11); if (incoming.get(0)) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); @@ -1216,30 +1312,34 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, struct.setVornameIsSet(true); } if (incoming.get(3)) { + struct.mail = iprot.readString(); + struct.setMailIsSet(true); + } + if (incoming.get(4)) { struct.image_read = iprot.readBool(); struct.setImage_readIsSet(true); } - if (incoming.get(4)) { + if (incoming.get(5)) { struct.image_write = iprot.readBool(); struct.setImage_writeIsSet(true); } - if (incoming.get(5)) { + if (incoming.get(6)) { struct.image_admin = iprot.readBool(); struct.setImage_adminIsSet(true); } - if (incoming.get(6)) { + if (incoming.get(7)) { struct.image_link = iprot.readBool(); struct.setImage_linkIsSet(true); } - if (incoming.get(7)) { + if (incoming.get(8)) { struct.lecture_read = iprot.readBool(); struct.setLecture_readIsSet(true); } - if (incoming.get(8)) { + if (incoming.get(9)) { struct.lecture_write = iprot.readBool(); struct.setLecture_writeIsSet(true); } - if (incoming.get(9)) { + if (incoming.get(10)) { struct.lecture_admin = iprot.readBool(); struct.setLecture_adminIsSet(true); } diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java index 39763c69..25c6496a 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -94,16 +94,22 @@ public class Server { public boolean writeImageRights(String imagename, String username, String lastName, String firstName, String mail, String university, String role) throws org.apache.thrift.TException; + public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException; + public boolean writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role) throws org.apache.thrift.TException; - public List<Person> getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException; + public boolean writeAdditionalLectureRights(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin) throws org.apache.thrift.TException; - public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException; + public List<Person> getAllOtherSatelliteUsers(List<String> userID) throws org.apache.thrift.TException; public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws org.apache.thrift.TException; + public List<Person> getPermissionForUserAndLecture(String userID, String lectureID) throws org.apache.thrift.TException; + public void deleteAllAdditionalImagePermissions(String imageID, String userID) throws org.apache.thrift.TException; + public void deleteAllAdditionalLecturePermissions(String lectureID, String userID) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -166,16 +172,22 @@ public class Server { public void writeImageRights(String imagename, String username, String lastName, String firstName, String mail, String university, String role, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getAllOtherSatelliteUsers(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void writeAdditionalLectureRights(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getAllOtherSatelliteUsers(List<String> userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getPermissionForUserAndImage(String userID, String imageID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getPermissionForUserAndLecture(String userID, String lectureID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void deleteAllAdditionalImagePermissions(String imageID, String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void deleteAllAdditionalLecturePermissions(String lectureID, String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -939,6 +951,34 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeImageRights failed: unknown result"); } + public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException + { + send_writeAdditionalImageRights(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin); + return recv_writeAdditionalImageRights(); + } + + public void send_writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException + { + writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); + args.setImageName(imageName); + args.setUserID(userID); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsLinkAllowed(isLinkAllowed); + args.setIsAdmin(isAdmin); + sendBase("writeAdditionalImageRights", args); + } + + public boolean recv_writeAdditionalImageRights() throws org.apache.thrift.TException + { + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + receiveBase(result, "writeAdditionalImageRights"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeAdditionalImageRights failed: unknown result"); + } + public boolean writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role) throws org.apache.thrift.TException { send_writeLectureRights(lecturename, username, lastName, firstName, mail, university, role); @@ -968,55 +1008,54 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeLectureRights failed: unknown result"); } - public List<Person> getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException + public boolean writeAdditionalLectureRights(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin) throws org.apache.thrift.TException { - send_getAllOtherSatelliteUsers(userID); - return recv_getAllOtherSatelliteUsers(); + send_writeAdditionalLectureRights(lectureName, userID, isRead, isWrite, isAdmin); + return recv_writeAdditionalLectureRights(); } - public void send_getAllOtherSatelliteUsers(String userID) throws org.apache.thrift.TException + public void send_writeAdditionalLectureRights(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin) throws org.apache.thrift.TException { - getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); + writeAdditionalLectureRights_args args = new writeAdditionalLectureRights_args(); + args.setLectureName(lectureName); args.setUserID(userID); - sendBase("getAllOtherSatelliteUsers", args); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsAdmin(isAdmin); + sendBase("writeAdditionalLectureRights", args); } - public List<Person> recv_getAllOtherSatelliteUsers() throws org.apache.thrift.TException + public boolean recv_writeAdditionalLectureRights() throws org.apache.thrift.TException { - getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); - receiveBase(result, "getAllOtherSatelliteUsers"); + writeAdditionalLectureRights_result result = new writeAdditionalLectureRights_result(); + receiveBase(result, "writeAdditionalLectureRights"); if (result.isSetSuccess()) { return result.success; } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllOtherSatelliteUsers failed: unknown result"); + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeAdditionalLectureRights failed: unknown result"); } - public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException + public List<Person> getAllOtherSatelliteUsers(List<String> userID) throws org.apache.thrift.TException { - send_writeAdditionalImageRights(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin); - return recv_writeAdditionalImageRights(); + send_getAllOtherSatelliteUsers(userID); + return recv_getAllOtherSatelliteUsers(); } - public void send_writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException + public void send_getAllOtherSatelliteUsers(List<String> userID) throws org.apache.thrift.TException { - writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); - args.setImageName(imageName); + getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); args.setUserID(userID); - args.setIsRead(isRead); - args.setIsWrite(isWrite); - args.setIsLinkAllowed(isLinkAllowed); - args.setIsAdmin(isAdmin); - sendBase("writeAdditionalImageRights", args); + sendBase("getAllOtherSatelliteUsers", args); } - public boolean recv_writeAdditionalImageRights() throws org.apache.thrift.TException + public List<Person> recv_getAllOtherSatelliteUsers() throws org.apache.thrift.TException { - writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); - receiveBase(result, "writeAdditionalImageRights"); + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); + receiveBase(result, "getAllOtherSatelliteUsers"); if (result.isSetSuccess()) { return result.success; } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeAdditionalImageRights failed: unknown result"); + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getAllOtherSatelliteUsers failed: unknown result"); } public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws org.apache.thrift.TException @@ -1043,6 +1082,30 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPermissionForUserAndImage failed: unknown result"); } + public List<Person> getPermissionForUserAndLecture(String userID, String lectureID) throws org.apache.thrift.TException + { + send_getPermissionForUserAndLecture(userID, lectureID); + return recv_getPermissionForUserAndLecture(); + } + + public void send_getPermissionForUserAndLecture(String userID, String lectureID) throws org.apache.thrift.TException + { + getPermissionForUserAndLecture_args args = new getPermissionForUserAndLecture_args(); + args.setUserID(userID); + args.setLectureID(lectureID); + sendBase("getPermissionForUserAndLecture", args); + } + + public List<Person> recv_getPermissionForUserAndLecture() throws org.apache.thrift.TException + { + getPermissionForUserAndLecture_result result = new getPermissionForUserAndLecture_result(); + receiveBase(result, "getPermissionForUserAndLecture"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPermissionForUserAndLecture failed: unknown result"); + } + public void deleteAllAdditionalImagePermissions(String imageID, String userID) throws org.apache.thrift.TException { send_deleteAllAdditionalImagePermissions(imageID, userID); @@ -1064,6 +1127,27 @@ public class Server { return; } + public void deleteAllAdditionalLecturePermissions(String lectureID, String userID) throws org.apache.thrift.TException + { + send_deleteAllAdditionalLecturePermissions(lectureID, userID); + recv_deleteAllAdditionalLecturePermissions(); + } + + public void send_deleteAllAdditionalLecturePermissions(String lectureID, String userID) throws org.apache.thrift.TException + { + deleteAllAdditionalLecturePermissions_args args = new deleteAllAdditionalLecturePermissions_args(); + args.setLectureID(lectureID); + args.setUserID(userID); + sendBase("deleteAllAdditionalLecturePermissions", args); + } + + public void recv_deleteAllAdditionalLecturePermissions() throws org.apache.thrift.TException + { + deleteAllAdditionalLecturePermissions_result result = new deleteAllAdditionalLecturePermissions_result(); + receiveBase(result, "deleteAllAdditionalLecturePermissions"); + return; + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { @@ -2241,6 +2325,53 @@ public class Server { } } + public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + writeAdditionalImageRights_call method_call = new writeAdditionalImageRights_call(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class writeAdditionalImageRights_call extends org.apache.thrift.async.TAsyncMethodCall { + private String imageName; + private String userID; + private boolean isRead; + private boolean isWrite; + private boolean isLinkAllowed; + private boolean isAdmin; + public writeAdditionalImageRights_call(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.imageName = imageName; + this.userID = userID; + this.isRead = isRead; + this.isWrite = isWrite; + this.isLinkAllowed = isLinkAllowed; + this.isAdmin = isAdmin; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("writeAdditionalImageRights", org.apache.thrift.protocol.TMessageType.CALL, 0)); + writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); + args.setImageName(imageName); + args.setUserID(userID); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsLinkAllowed(isLinkAllowed); + args.setIsAdmin(isAdmin); + args.write(prot); + prot.writeMessageEnd(); + } + + public boolean getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_writeAdditionalImageRights(); + } + } + public void writeLectureRights(String lecturename, String username, String lastName, String firstName, String mail, String university, String role, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); writeLectureRights_call method_call = new writeLectureRights_call(lecturename, username, lastName, firstName, mail, university, role, resultHandler, this, ___protocolFactory, ___transport); @@ -2291,82 +2422,79 @@ public class Server { } } - public void getAllOtherSatelliteUsers(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void writeAdditionalLectureRights(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getAllOtherSatelliteUsers_call method_call = new getAllOtherSatelliteUsers_call(userID, resultHandler, this, ___protocolFactory, ___transport); + writeAdditionalLectureRights_call method_call = new writeAdditionalLectureRights_call(lectureName, userID, isRead, isWrite, isAdmin, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class getAllOtherSatelliteUsers_call extends org.apache.thrift.async.TAsyncMethodCall { + public static class writeAdditionalLectureRights_call extends org.apache.thrift.async.TAsyncMethodCall { + private String lectureName; private String userID; - public getAllOtherSatelliteUsers_call(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + private boolean isRead; + private boolean isWrite; + private boolean isAdmin; + public writeAdditionalLectureRights_call(String lectureName, String userID, boolean isRead, boolean isWrite, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); + this.lectureName = lectureName; this.userID = userID; + this.isRead = isRead; + this.isWrite = isWrite; + this.isAdmin = isAdmin; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllOtherSatelliteUsers", org.apache.thrift.protocol.TMessageType.CALL, 0)); - getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("writeAdditionalLectureRights", org.apache.thrift.protocol.TMessageType.CALL, 0)); + writeAdditionalLectureRights_args args = new writeAdditionalLectureRights_args(); + args.setLectureName(lectureName); args.setUserID(userID); + args.setIsRead(isRead); + args.setIsWrite(isWrite); + args.setIsAdmin(isAdmin); args.write(prot); prot.writeMessageEnd(); } - public List<Person> getResult() throws org.apache.thrift.TException { + public boolean getResult() throws org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_getAllOtherSatelliteUsers(); + return (new Client(prot)).recv_writeAdditionalLectureRights(); } } - public void writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getAllOtherSatelliteUsers(List<String> userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - writeAdditionalImageRights_call method_call = new writeAdditionalImageRights_call(imageName, userID, isRead, isWrite, isLinkAllowed, isAdmin, resultHandler, this, ___protocolFactory, ___transport); + getAllOtherSatelliteUsers_call method_call = new getAllOtherSatelliteUsers_call(userID, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class writeAdditionalImageRights_call extends org.apache.thrift.async.TAsyncMethodCall { - private String imageName; - private String userID; - private boolean isRead; - private boolean isWrite; - private boolean isLinkAllowed; - private boolean isAdmin; - public writeAdditionalImageRights_call(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + public static class getAllOtherSatelliteUsers_call extends org.apache.thrift.async.TAsyncMethodCall { + private List<String> userID; + public getAllOtherSatelliteUsers_call(List<String> userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { super(client, protocolFactory, transport, resultHandler, false); - this.imageName = imageName; this.userID = userID; - this.isRead = isRead; - this.isWrite = isWrite; - this.isLinkAllowed = isLinkAllowed; - this.isAdmin = isAdmin; } public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { - prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("writeAdditionalImageRights", org.apache.thrift.protocol.TMessageType.CALL, 0)); - writeAdditionalImageRights_args args = new writeAdditionalImageRights_args(); - args.setImageName(imageName); + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getAllOtherSatelliteUsers", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getAllOtherSatelliteUsers_args args = new getAllOtherSatelliteUsers_args(); args.setUserID(userID); - args.setIsRead(isRead); - args.setIsWrite(isWrite); - args.setIsLinkAllowed(isLinkAllowed); - args.setIsAdmin(isAdmin); args.write(prot); prot.writeMessageEnd(); } - public boolean getResult() throws org.apache.thrift.TException { + public List<Person> getResult() throws org.apache.thrift.TException { if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { throw new IllegalStateException("Method call not finished!"); } org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); - return (new Client(prot)).recv_writeAdditionalImageRights(); + return (new Client(prot)).recv_getAllOtherSatelliteUsers(); } } @@ -2405,6 +2533,41 @@ public class Server { } } + public void getPermissionForUserAndLecture(String userID, String lectureID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getPermissionForUserAndLecture_call method_call = new getPermissionForUserAndLecture_call(userID, lectureID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getPermissionForUserAndLecture_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + private String lectureID; + public getPermissionForUserAndLecture_call(String userID, String lectureID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.userID = userID; + this.lectureID = lectureID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPermissionForUserAndLecture", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getPermissionForUserAndLecture_args args = new getPermissionForUserAndLecture_args(); + args.setUserID(userID); + args.setLectureID(lectureID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Person> getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + return (new Client(prot)).recv_getPermissionForUserAndLecture(); + } + } + public void deleteAllAdditionalImagePermissions(String imageID, String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); deleteAllAdditionalImagePermissions_call method_call = new deleteAllAdditionalImagePermissions_call(imageID, userID, resultHandler, this, ___protocolFactory, ___transport); @@ -2440,6 +2603,41 @@ public class Server { } } + public void deleteAllAdditionalLecturePermissions(String lectureID, String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + deleteAllAdditionalLecturePermissions_call method_call = new deleteAllAdditionalLecturePermissions_call(lectureID, userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class deleteAllAdditionalLecturePermissions_call extends org.apache.thrift.async.TAsyncMethodCall { + private String lectureID; + private String userID; + public deleteAllAdditionalLecturePermissions_call(String lectureID, String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler, org.apache.thrift.async.TAsyncClient client, org.apache.thrift.protocol.TProtocolFactory protocolFactory, org.apache.thrift.transport.TNonblockingTransport transport) throws org.apache.thrift.TException { + super(client, protocolFactory, transport, resultHandler, false); + this.lectureID = lectureID; + this.userID = userID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("deleteAllAdditionalLecturePermissions", org.apache.thrift.protocol.TMessageType.CALL, 0)); + deleteAllAdditionalLecturePermissions_args args = new deleteAllAdditionalLecturePermissions_args(); + args.setLectureID(lectureID); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public void getResult() throws org.apache.thrift.TException { + if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) { + throw new IllegalStateException("Method call not finished!"); + } + org.apache.thrift.transport.TMemoryInputTransport memoryTransport = new org.apache.thrift.transport.TMemoryInputTransport(getFrameBuffer().array()); + org.apache.thrift.protocol.TProtocol prot = client.getProtocolFactory().getProtocol(memoryTransport); + (new Client(prot)).recv_deleteAllAdditionalLecturePermissions(); + } + } + } public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { @@ -2482,11 +2680,14 @@ public class Server { processMap.put("checkUser", new checkUser()); processMap.put("createUser", new createUser()); processMap.put("writeImageRights", new writeImageRights()); + processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); processMap.put("writeLectureRights", new writeLectureRights()); + processMap.put("writeAdditionalLectureRights", new writeAdditionalLectureRights()); processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); - processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); processMap.put("getPermissionForUserAndImage", new getPermissionForUserAndImage()); + processMap.put("getPermissionForUserAndLecture", new getPermissionForUserAndLecture()); processMap.put("deleteAllAdditionalImagePermissions", new deleteAllAdditionalImagePermissions()); + processMap.put("deleteAllAdditionalLecturePermissions", new deleteAllAdditionalLecturePermissions()); return processMap; } @@ -3083,6 +3284,27 @@ public class Server { } } + public static class writeAdditionalImageRights<I extends Iface> extends org.apache.thrift.ProcessFunction<I, writeAdditionalImageRights_args> { + public writeAdditionalImageRights() { + super("writeAdditionalImageRights"); + } + + public writeAdditionalImageRights_args getEmptyArgsInstance() { + return new writeAdditionalImageRights_args(); + } + + protected boolean isOneway() { + return false; + } + + public writeAdditionalImageRights_result getResult(I iface, writeAdditionalImageRights_args args) throws org.apache.thrift.TException { + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + result.success = iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin); + result.setSuccessIsSet(true); + return result; + } + } + public static class writeLectureRights<I extends Iface> extends org.apache.thrift.ProcessFunction<I, writeLectureRights_args> { public writeLectureRights() { super("writeLectureRights"); @@ -3104,43 +3326,43 @@ public class Server { } } - public static class getAllOtherSatelliteUsers<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllOtherSatelliteUsers_args> { - public getAllOtherSatelliteUsers() { - super("getAllOtherSatelliteUsers"); + public static class writeAdditionalLectureRights<I extends Iface> extends org.apache.thrift.ProcessFunction<I, writeAdditionalLectureRights_args> { + public writeAdditionalLectureRights() { + super("writeAdditionalLectureRights"); } - public getAllOtherSatelliteUsers_args getEmptyArgsInstance() { - return new getAllOtherSatelliteUsers_args(); + public writeAdditionalLectureRights_args getEmptyArgsInstance() { + return new writeAdditionalLectureRights_args(); } protected boolean isOneway() { return false; } - public getAllOtherSatelliteUsers_result getResult(I iface, getAllOtherSatelliteUsers_args args) throws org.apache.thrift.TException { - getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); - result.success = iface.getAllOtherSatelliteUsers(args.userID); + public writeAdditionalLectureRights_result getResult(I iface, writeAdditionalLectureRights_args args) throws org.apache.thrift.TException { + writeAdditionalLectureRights_result result = new writeAdditionalLectureRights_result(); + result.success = iface.writeAdditionalLectureRights(args.lectureName, args.userID, args.isRead, args.isWrite, args.isAdmin); + result.setSuccessIsSet(true); return result; } } - public static class writeAdditionalImageRights<I extends Iface> extends org.apache.thrift.ProcessFunction<I, writeAdditionalImageRights_args> { - public writeAdditionalImageRights() { - super("writeAdditionalImageRights"); + public static class getAllOtherSatelliteUsers<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getAllOtherSatelliteUsers_args> { + public getAllOtherSatelliteUsers() { + super("getAllOtherSatelliteUsers"); } - public writeAdditionalImageRights_args getEmptyArgsInstance() { - return new writeAdditionalImageRights_args(); + public getAllOtherSatelliteUsers_args getEmptyArgsInstance() { + return new getAllOtherSatelliteUsers_args(); } protected boolean isOneway() { return false; } - public writeAdditionalImageRights_result getResult(I iface, writeAdditionalImageRights_args args) throws org.apache.thrift.TException { - writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); - result.success = iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin); - result.setSuccessIsSet(true); + public getAllOtherSatelliteUsers_result getResult(I iface, getAllOtherSatelliteUsers_args args) throws org.apache.thrift.TException { + getAllOtherSatelliteUsers_result result = new getAllOtherSatelliteUsers_result(); + result.success = iface.getAllOtherSatelliteUsers(args.userID); return result; } } @@ -3165,6 +3387,26 @@ public class Server { } } + public static class getPermissionForUserAndLecture<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPermissionForUserAndLecture_args> { + public getPermissionForUserAndLecture() { + super("getPermissionForUserAndLecture"); + } + + public getPermissionForUserAndLecture_args getEmptyArgsInstance() { + return new getPermissionForUserAndLecture_args(); + } + + protected boolean isOneway() { + return false; + } + + public getPermissionForUserAndLecture_result getResult(I iface, getPermissionForUserAndLecture_args args) throws org.apache.thrift.TException { + getPermissionForUserAndLecture_result result = new getPermissionForUserAndLecture_result(); + result.success = iface.getPermissionForUserAndLecture(args.userID, args.lectureID); + return result; + } + } + public static class deleteAllAdditionalImagePermissions<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteAllAdditionalImagePermissions_args> { public deleteAllAdditionalImagePermissions() { super("deleteAllAdditionalImagePermissions"); @@ -3185,6 +3427,26 @@ public class Server { } } + public static class deleteAllAdditionalLecturePermissions<I extends Iface> extends org.apache.thrift.ProcessFunction<I, deleteAllAdditionalLecturePermissions_args> { + public deleteAllAdditionalLecturePermissions() { + super("deleteAllAdditionalLecturePermissions"); + } + + public deleteAllAdditionalLecturePermissions_args getEmptyArgsInstance() { + return new deleteAllAdditionalLecturePermissions_args(); + } + + protected boolean isOneway() { + return false; + } + + public deleteAllAdditionalLecturePermissions_result getResult(I iface, deleteAllAdditionalLecturePermissions_args args) throws org.apache.thrift.TException { + deleteAllAdditionalLecturePermissions_result result = new deleteAllAdditionalLecturePermissions_result(); + iface.deleteAllAdditionalLecturePermissions(args.lectureID, args.userID); + return result; + } + } + } public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { @@ -3227,11 +3489,14 @@ public class Server { processMap.put("checkUser", new checkUser()); processMap.put("createUser", new createUser()); processMap.put("writeImageRights", new writeImageRights()); + processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); processMap.put("writeLectureRights", new writeLectureRights()); + processMap.put("writeAdditionalLectureRights", new writeAdditionalLectureRights()); processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); - processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); processMap.put("getPermissionForUserAndImage", new getPermissionForUserAndImage()); + processMap.put("getPermissionForUserAndLecture", new getPermissionForUserAndLecture()); processMap.put("deleteAllAdditionalImagePermissions", new deleteAllAdditionalImagePermissions()); + processMap.put("deleteAllAdditionalLecturePermissions", new deleteAllAdditionalLecturePermissions()); return processMap; } @@ -4726,6 +4991,58 @@ public class Server { } } + public static class writeAdditionalImageRights<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, writeAdditionalImageRights_args, Boolean> { + public writeAdditionalImageRights() { + super("writeAdditionalImageRights"); + } + + public writeAdditionalImageRights_args getEmptyArgsInstance() { + return new writeAdditionalImageRights_args(); + } + + public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Boolean>() { + public void onComplete(Boolean o) { + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + result.success = o; + result.setSuccessIsSet(true); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, writeAdditionalImageRights_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin,resultHandler); + } + } + public static class writeLectureRights<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, writeLectureRights_args, Boolean> { public writeLectureRights() { super("writeLectureRights"); @@ -4778,6 +5095,58 @@ public class Server { } } + public static class writeAdditionalLectureRights<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, writeAdditionalLectureRights_args, Boolean> { + public writeAdditionalLectureRights() { + super("writeAdditionalLectureRights"); + } + + public writeAdditionalLectureRights_args getEmptyArgsInstance() { + return new writeAdditionalLectureRights_args(); + } + + public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Boolean>() { + public void onComplete(Boolean o) { + writeAdditionalLectureRights_result result = new writeAdditionalLectureRights_result(); + result.success = o; + result.setSuccessIsSet(true); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + writeAdditionalLectureRights_result result = new writeAdditionalLectureRights_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, writeAdditionalLectureRights_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { + iface.writeAdditionalLectureRights(args.lectureName, args.userID, args.isRead, args.isWrite, args.isAdmin,resultHandler); + } + } + public static class getAllOtherSatelliteUsers<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getAllOtherSatelliteUsers_args, List<Person>> { public getAllOtherSatelliteUsers() { super("getAllOtherSatelliteUsers"); @@ -4829,22 +5198,21 @@ public class Server { } } - public static class writeAdditionalImageRights<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, writeAdditionalImageRights_args, Boolean> { - public writeAdditionalImageRights() { - super("writeAdditionalImageRights"); + public static class getPermissionForUserAndImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPermissionForUserAndImage_args, List<Person>> { + public getPermissionForUserAndImage() { + super("getPermissionForUserAndImage"); } - public writeAdditionalImageRights_args getEmptyArgsInstance() { - return new writeAdditionalImageRights_args(); + public getPermissionForUserAndImage_args getEmptyArgsInstance() { + return new getPermissionForUserAndImage_args(); } - public AsyncMethodCallback<Boolean> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + public AsyncMethodCallback<List<Person>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; - return new AsyncMethodCallback<Boolean>() { - public void onComplete(Boolean o) { - writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + return new AsyncMethodCallback<List<Person>>() { + public void onComplete(List<Person> o) { + getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); result.success = o; - result.setSuccessIsSet(true); try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); return; @@ -4856,7 +5224,7 @@ public class Server { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - writeAdditionalImageRights_result result = new writeAdditionalImageRights_result(); + getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); @@ -4876,25 +5244,25 @@ public class Server { return false; } - public void start(I iface, writeAdditionalImageRights_args args, org.apache.thrift.async.AsyncMethodCallback<Boolean> resultHandler) throws TException { - iface.writeAdditionalImageRights(args.imageName, args.userID, args.isRead, args.isWrite, args.isLinkAllowed, args.isAdmin,resultHandler); + public void start(I iface, getPermissionForUserAndImage_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { + iface.getPermissionForUserAndImage(args.userID, args.imageID,resultHandler); } } - public static class getPermissionForUserAndImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPermissionForUserAndImage_args, List<Person>> { - public getPermissionForUserAndImage() { - super("getPermissionForUserAndImage"); + public static class getPermissionForUserAndLecture<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPermissionForUserAndLecture_args, List<Person>> { + public getPermissionForUserAndLecture() { + super("getPermissionForUserAndLecture"); } - public getPermissionForUserAndImage_args getEmptyArgsInstance() { - return new getPermissionForUserAndImage_args(); + public getPermissionForUserAndLecture_args getEmptyArgsInstance() { + return new getPermissionForUserAndLecture_args(); } public AsyncMethodCallback<List<Person>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<List<Person>>() { public void onComplete(List<Person> o) { - getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); + getPermissionForUserAndLecture_result result = new getPermissionForUserAndLecture_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -4907,7 +5275,7 @@ public class Server { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); + getPermissionForUserAndLecture_result result = new getPermissionForUserAndLecture_result(); { msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); @@ -4927,8 +5295,8 @@ public class Server { return false; } - public void start(I iface, getPermissionForUserAndImage_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { - iface.getPermissionForUserAndImage(args.userID, args.imageID,resultHandler); + public void start(I iface, getPermissionForUserAndLecture_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { + iface.getPermissionForUserAndLecture(args.userID, args.lectureID,resultHandler); } } @@ -4982,6 +5350,56 @@ public class Server { } } + public static class deleteAllAdditionalLecturePermissions<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, deleteAllAdditionalLecturePermissions_args, Void> { + public deleteAllAdditionalLecturePermissions() { + super("deleteAllAdditionalLecturePermissions"); + } + + public deleteAllAdditionalLecturePermissions_args getEmptyArgsInstance() { + return new deleteAllAdditionalLecturePermissions_args(); + } + + public AsyncMethodCallback<Void> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Void>() { + public void onComplete(Void o) { + deleteAllAdditionalLecturePermissions_result result = new deleteAllAdditionalLecturePermissions_result(); + try { + fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); + return; + } catch (Exception e) { + LOGGER.error("Exception writing to internal frame buffer", e); + } + fb.close(); + } + public void onError(Exception e) { + byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; + org.apache.thrift.TBase msg; + deleteAllAdditionalLecturePermissions_result result = new deleteAllAdditionalLecturePermissions_result(); + { + msgType = org.apache.thrift.protocol.TMessageType.EXCEPTION; + msg = (org.apache.thrift.TBase)new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.INTERNAL_ERROR, e.getMessage()); + } + try { + fcall.sendResponse(fb,msg,msgType,seqid); + return; + } catch (Exception ex) { + LOGGER.error("Exception writing to internal frame buffer", ex); + } + fb.close(); + } + }; + } + + protected boolean isOneway() { + return false; + } + + public void start(I iface, deleteAllAdditionalLecturePermissions_args args, org.apache.thrift.async.AsyncMethodCallback<Void> resultHandler) throws TException { + iface.deleteAllAdditionalLecturePermissions(args.lectureID, args.userID,resultHandler); + } + } + } public static class getFtpUser_args implements org.apache.thrift.TBase<getFtpUser_args, getFtpUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<getFtpUser_args> { @@ -33633,6 +34051,1194 @@ public class Server { } + public static class writeAdditionalImageRights_args implements org.apache.thrift.TBase<writeAdditionalImageRights_args, writeAdditionalImageRights_args._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_args"); + + private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField IS_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("isRead", org.apache.thrift.protocol.TType.BOOL, (short)3); + private static final org.apache.thrift.protocol.TField IS_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("isWrite", org.apache.thrift.protocol.TType.BOOL, (short)4); + private static final org.apache.thrift.protocol.TField IS_LINK_ALLOWED_FIELD_DESC = new org.apache.thrift.protocol.TField("isLinkAllowed", org.apache.thrift.protocol.TType.BOOL, (short)5); + private static final org.apache.thrift.protocol.TField IS_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("isAdmin", org.apache.thrift.protocol.TType.BOOL, (short)6); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new writeAdditionalImageRights_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalImageRights_argsTupleSchemeFactory()); + } + + public String imageName; // required + public String userID; // required + public boolean isRead; // required + public boolean isWrite; // required + public boolean isLinkAllowed; // required + public boolean isAdmin; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + IMAGE_NAME((short)1, "imageName"), + USER_ID((short)2, "userID"), + IS_READ((short)3, "isRead"), + IS_WRITE((short)4, "isWrite"), + IS_LINK_ALLOWED((short)5, "isLinkAllowed"), + IS_ADMIN((short)6, "isAdmin"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // IMAGE_NAME + return IMAGE_NAME; + case 2: // USER_ID + return USER_ID; + case 3: // IS_READ + return IS_READ; + case 4: // IS_WRITE + return IS_WRITE; + case 5: // IS_LINK_ALLOWED + return IS_LINK_ALLOWED; + case 6: // IS_ADMIN + return IS_ADMIN; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __ISREAD_ISSET_ID = 0; + private static final int __ISWRITE_ISSET_ID = 1; + private static final int __ISLINKALLOWED_ISSET_ID = 2; + private static final int __ISADMIN_ISSET_ID = 3; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.IMAGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("imageName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IS_READ, new org.apache.thrift.meta_data.FieldMetaData("isRead", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_WRITE, new org.apache.thrift.meta_data.FieldMetaData("isWrite", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_LINK_ALLOWED, new org.apache.thrift.meta_data.FieldMetaData("isLinkAllowed", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("isAdmin", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalImageRights_args.class, metaDataMap); + } + + public writeAdditionalImageRights_args() { + } + + public writeAdditionalImageRights_args( + String imageName, + String userID, + boolean isRead, + boolean isWrite, + boolean isLinkAllowed, + boolean isAdmin) + { + this(); + this.imageName = imageName; + this.userID = userID; + this.isRead = isRead; + setIsReadIsSet(true); + this.isWrite = isWrite; + setIsWriteIsSet(true); + this.isLinkAllowed = isLinkAllowed; + setIsLinkAllowedIsSet(true); + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalImageRights_args(writeAdditionalImageRights_args other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetImageName()) { + this.imageName = other.imageName; + } + if (other.isSetUserID()) { + this.userID = other.userID; + } + this.isRead = other.isRead; + this.isWrite = other.isWrite; + this.isLinkAllowed = other.isLinkAllowed; + this.isAdmin = other.isAdmin; + } + + public writeAdditionalImageRights_args deepCopy() { + return new writeAdditionalImageRights_args(this); + } + + @Override + public void clear() { + this.imageName = null; + this.userID = null; + setIsReadIsSet(false); + this.isRead = false; + setIsWriteIsSet(false); + this.isWrite = false; + setIsLinkAllowedIsSet(false); + this.isLinkAllowed = false; + setIsAdminIsSet(false); + this.isAdmin = false; + } + + public String getImageName() { + return this.imageName; + } + + public writeAdditionalImageRights_args setImageName(String imageName) { + this.imageName = imageName; + return this; + } + + public void unsetImageName() { + this.imageName = null; + } + + /** Returns true if field imageName is set (has been assigned a value) and false otherwise */ + public boolean isSetImageName() { + return this.imageName != null; + } + + public void setImageNameIsSet(boolean value) { + if (!value) { + this.imageName = null; + } + } + + public String getUserID() { + return this.userID; + } + + public writeAdditionalImageRights_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public boolean isIsRead() { + return this.isRead; + } + + public writeAdditionalImageRights_args setIsRead(boolean isRead) { + this.isRead = isRead; + setIsReadIsSet(true); + return this; + } + + public void unsetIsRead() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + /** Returns true if field isRead is set (has been assigned a value) and false otherwise */ + public boolean isSetIsRead() { + return EncodingUtils.testBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + public void setIsReadIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISREAD_ISSET_ID, value); + } + + public boolean isIsWrite() { + return this.isWrite; + } + + public writeAdditionalImageRights_args setIsWrite(boolean isWrite) { + this.isWrite = isWrite; + setIsWriteIsSet(true); + return this; + } + + public void unsetIsWrite() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + /** Returns true if field isWrite is set (has been assigned a value) and false otherwise */ + public boolean isSetIsWrite() { + return EncodingUtils.testBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + public void setIsWriteIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISWRITE_ISSET_ID, value); + } + + public boolean isIsLinkAllowed() { + return this.isLinkAllowed; + } + + public writeAdditionalImageRights_args setIsLinkAllowed(boolean isLinkAllowed) { + this.isLinkAllowed = isLinkAllowed; + setIsLinkAllowedIsSet(true); + return this; + } + + public void unsetIsLinkAllowed() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); + } + + /** Returns true if field isLinkAllowed is set (has been assigned a value) and false otherwise */ + public boolean isSetIsLinkAllowed() { + return EncodingUtils.testBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); + } + + public void setIsLinkAllowedIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID, value); + } + + public boolean isIsAdmin() { + return this.isAdmin; + } + + public writeAdditionalImageRights_args setIsAdmin(boolean isAdmin) { + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + return this; + } + + public void unsetIsAdmin() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + /** Returns true if field isAdmin is set (has been assigned a value) and false otherwise */ + public boolean isSetIsAdmin() { + return EncodingUtils.testBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + public void setIsAdminIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISADMIN_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case IMAGE_NAME: + if (value == null) { + unsetImageName(); + } else { + setImageName((String)value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + case IS_READ: + if (value == null) { + unsetIsRead(); + } else { + setIsRead((Boolean)value); + } + break; + + case IS_WRITE: + if (value == null) { + unsetIsWrite(); + } else { + setIsWrite((Boolean)value); + } + break; + + case IS_LINK_ALLOWED: + if (value == null) { + unsetIsLinkAllowed(); + } else { + setIsLinkAllowed((Boolean)value); + } + break; + + case IS_ADMIN: + if (value == null) { + unsetIsAdmin(); + } else { + setIsAdmin((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case IMAGE_NAME: + return getImageName(); + + case USER_ID: + return getUserID(); + + case IS_READ: + return Boolean.valueOf(isIsRead()); + + case IS_WRITE: + return Boolean.valueOf(isIsWrite()); + + case IS_LINK_ALLOWED: + return Boolean.valueOf(isIsLinkAllowed()); + + case IS_ADMIN: + return Boolean.valueOf(isIsAdmin()); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case IMAGE_NAME: + return isSetImageName(); + case USER_ID: + return isSetUserID(); + case IS_READ: + return isSetIsRead(); + case IS_WRITE: + return isSetIsWrite(); + case IS_LINK_ALLOWED: + return isSetIsLinkAllowed(); + case IS_ADMIN: + return isSetIsAdmin(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof writeAdditionalImageRights_args) + return this.equals((writeAdditionalImageRights_args)that); + return false; + } + + public boolean equals(writeAdditionalImageRights_args that) { + if (that == null) + return false; + + boolean this_present_imageName = true && this.isSetImageName(); + boolean that_present_imageName = true && that.isSetImageName(); + if (this_present_imageName || that_present_imageName) { + if (!(this_present_imageName && that_present_imageName)) + return false; + if (!this.imageName.equals(that.imageName)) + return false; + } + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + boolean this_present_isRead = true; + boolean that_present_isRead = true; + if (this_present_isRead || that_present_isRead) { + if (!(this_present_isRead && that_present_isRead)) + return false; + if (this.isRead != that.isRead) + return false; + } + + boolean this_present_isWrite = true; + boolean that_present_isWrite = true; + if (this_present_isWrite || that_present_isWrite) { + if (!(this_present_isWrite && that_present_isWrite)) + return false; + if (this.isWrite != that.isWrite) + return false; + } + + boolean this_present_isLinkAllowed = true; + boolean that_present_isLinkAllowed = true; + if (this_present_isLinkAllowed || that_present_isLinkAllowed) { + if (!(this_present_isLinkAllowed && that_present_isLinkAllowed)) + return false; + if (this.isLinkAllowed != that.isLinkAllowed) + return false; + } + + boolean this_present_isAdmin = true; + boolean that_present_isAdmin = true; + if (this_present_isAdmin || that_present_isAdmin) { + if (!(this_present_isAdmin && that_present_isAdmin)) + return false; + if (this.isAdmin != that.isAdmin) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(writeAdditionalImageRights_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetImageName()).compareTo(other.isSetImageName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageName, other.imageName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsRead()).compareTo(other.isSetIsRead()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsRead()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRead, other.isRead); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsWrite()).compareTo(other.isSetIsWrite()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsWrite()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isWrite, other.isWrite); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsLinkAllowed()).compareTo(other.isSetIsLinkAllowed()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsLinkAllowed()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isLinkAllowed, other.isLinkAllowed); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsAdmin()).compareTo(other.isSetIsAdmin()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsAdmin()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isAdmin, other.isAdmin); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("writeAdditionalImageRights_args("); + boolean first = true; + + sb.append("imageName:"); + if (this.imageName == null) { + sb.append("null"); + } else { + sb.append(this.imageName); + } + first = false; + if (!first) sb.append(", "); + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + if (!first) sb.append(", "); + sb.append("isRead:"); + sb.append(this.isRead); + first = false; + if (!first) sb.append(", "); + sb.append("isWrite:"); + sb.append(this.isWrite); + first = false; + if (!first) sb.append(", "); + sb.append("isLinkAllowed:"); + sb.append(this.isLinkAllowed); + first = false; + if (!first) sb.append(", "); + sb.append("isAdmin:"); + sb.append(this.isAdmin); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class writeAdditionalImageRights_argsStandardSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_argsStandardScheme getScheme() { + return new writeAdditionalImageRights_argsStandardScheme(); + } + } + + private static class writeAdditionalImageRights_argsStandardScheme extends StandardScheme<writeAdditionalImageRights_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // IMAGE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // IS_READ + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // IS_WRITE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IS_LINK_ALLOWED + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isLinkAllowed = iprot.readBool(); + struct.setIsLinkAllowedIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // IS_ADMIN + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.imageName != null) { + oprot.writeFieldBegin(IMAGE_NAME_FIELD_DESC); + oprot.writeString(struct.imageName); + oprot.writeFieldEnd(); + } + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(IS_READ_FIELD_DESC); + oprot.writeBool(struct.isRead); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_WRITE_FIELD_DESC); + oprot.writeBool(struct.isWrite); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_LINK_ALLOWED_FIELD_DESC); + oprot.writeBool(struct.isLinkAllowed); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_ADMIN_FIELD_DESC); + oprot.writeBool(struct.isAdmin); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class writeAdditionalImageRights_argsTupleSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_argsTupleScheme getScheme() { + return new writeAdditionalImageRights_argsTupleScheme(); + } + } + + private static class writeAdditionalImageRights_argsTupleScheme extends TupleScheme<writeAdditionalImageRights_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetImageName()) { + optionals.set(0); + } + if (struct.isSetUserID()) { + optionals.set(1); + } + if (struct.isSetIsRead()) { + optionals.set(2); + } + if (struct.isSetIsWrite()) { + optionals.set(3); + } + if (struct.isSetIsLinkAllowed()) { + optionals.set(4); + } + if (struct.isSetIsAdmin()) { + optionals.set(5); + } + oprot.writeBitSet(optionals, 6); + if (struct.isSetImageName()) { + oprot.writeString(struct.imageName); + } + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + if (struct.isSetIsRead()) { + oprot.writeBool(struct.isRead); + } + if (struct.isSetIsWrite()) { + oprot.writeBool(struct.isWrite); + } + if (struct.isSetIsLinkAllowed()) { + oprot.writeBool(struct.isLinkAllowed); + } + if (struct.isSetIsAdmin()) { + oprot.writeBool(struct.isAdmin); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(6); + if (incoming.get(0)) { + struct.imageName = iprot.readString(); + struct.setImageNameIsSet(true); + } + if (incoming.get(1)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + if (incoming.get(2)) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } + if (incoming.get(3)) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } + if (incoming.get(4)) { + struct.isLinkAllowed = iprot.readBool(); + struct.setIsLinkAllowedIsSet(true); + } + if (incoming.get(5)) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(true); + } + } + } + + } + + public static class writeAdditionalImageRights_result implements org.apache.thrift.TBase<writeAdditionalImageRights_result, writeAdditionalImageRights_result._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new writeAdditionalImageRights_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalImageRights_resultTupleSchemeFactory()); + } + + public boolean success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __SUCCESS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalImageRights_result.class, metaDataMap); + } + + public writeAdditionalImageRights_result() { + } + + public writeAdditionalImageRights_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalImageRights_result(writeAdditionalImageRights_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public writeAdditionalImageRights_result deepCopy() { + return new writeAdditionalImageRights_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public writeAdditionalImageRights_result setSuccess(boolean success) { + this.success = success; + setSuccessIsSet(true); + return this; + } + + public void unsetSuccess() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return Boolean.valueOf(isSuccess()); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof writeAdditionalImageRights_result) + return this.equals((writeAdditionalImageRights_result)that); + return false; + } + + public boolean equals(writeAdditionalImageRights_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(writeAdditionalImageRights_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("writeAdditionalImageRights_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class writeAdditionalImageRights_resultStandardSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_resultStandardScheme getScheme() { + return new writeAdditionalImageRights_resultStandardScheme(); + } + } + + private static class writeAdditionalImageRights_resultStandardScheme extends StandardScheme<writeAdditionalImageRights_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class writeAdditionalImageRights_resultTupleSchemeFactory implements SchemeFactory { + public writeAdditionalImageRights_resultTupleScheme getScheme() { + return new writeAdditionalImageRights_resultTupleScheme(); + } + } + + private static class writeAdditionalImageRights_resultTupleScheme extends TupleScheme<writeAdditionalImageRights_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeBool(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } + } + } + + } + public static class writeLectureRights_args implements org.apache.thrift.TBase<writeLectureRights_args, writeLectureRights_args._Fields>, java.io.Serializable, Cloneable, Comparable<writeLectureRights_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeLectureRights_args"); @@ -34941,10 +36547,1104 @@ public class Server { } + public static class writeAdditionalLectureRights_args implements org.apache.thrift.TBase<writeAdditionalLectureRights_args, writeAdditionalLectureRights_args._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalLectureRights_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalLectureRights_args"); + + private static final org.apache.thrift.protocol.TField LECTURE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("lectureName", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField IS_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("isRead", org.apache.thrift.protocol.TType.BOOL, (short)3); + private static final org.apache.thrift.protocol.TField IS_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("isWrite", org.apache.thrift.protocol.TType.BOOL, (short)4); + private static final org.apache.thrift.protocol.TField IS_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("isAdmin", org.apache.thrift.protocol.TType.BOOL, (short)5); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new writeAdditionalLectureRights_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalLectureRights_argsTupleSchemeFactory()); + } + + public String lectureName; // required + public String userID; // required + public boolean isRead; // required + public boolean isWrite; // required + public boolean isAdmin; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + LECTURE_NAME((short)1, "lectureName"), + USER_ID((short)2, "userID"), + IS_READ((short)3, "isRead"), + IS_WRITE((short)4, "isWrite"), + IS_ADMIN((short)5, "isAdmin"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // LECTURE_NAME + return LECTURE_NAME; + case 2: // USER_ID + return USER_ID; + case 3: // IS_READ + return IS_READ; + case 4: // IS_WRITE + return IS_WRITE; + case 5: // IS_ADMIN + return IS_ADMIN; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __ISREAD_ISSET_ID = 0; + private static final int __ISWRITE_ISSET_ID = 1; + private static final int __ISADMIN_ISSET_ID = 2; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.LECTURE_NAME, new org.apache.thrift.meta_data.FieldMetaData("lectureName", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.IS_READ, new org.apache.thrift.meta_data.FieldMetaData("isRead", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_WRITE, new org.apache.thrift.meta_data.FieldMetaData("isWrite", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IS_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("isAdmin", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalLectureRights_args.class, metaDataMap); + } + + public writeAdditionalLectureRights_args() { + } + + public writeAdditionalLectureRights_args( + String lectureName, + String userID, + boolean isRead, + boolean isWrite, + boolean isAdmin) + { + this(); + this.lectureName = lectureName; + this.userID = userID; + this.isRead = isRead; + setIsReadIsSet(true); + this.isWrite = isWrite; + setIsWriteIsSet(true); + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalLectureRights_args(writeAdditionalLectureRights_args other) { + __isset_bitfield = other.__isset_bitfield; + if (other.isSetLectureName()) { + this.lectureName = other.lectureName; + } + if (other.isSetUserID()) { + this.userID = other.userID; + } + this.isRead = other.isRead; + this.isWrite = other.isWrite; + this.isAdmin = other.isAdmin; + } + + public writeAdditionalLectureRights_args deepCopy() { + return new writeAdditionalLectureRights_args(this); + } + + @Override + public void clear() { + this.lectureName = null; + this.userID = null; + setIsReadIsSet(false); + this.isRead = false; + setIsWriteIsSet(false); + this.isWrite = false; + setIsAdminIsSet(false); + this.isAdmin = false; + } + + public String getLectureName() { + return this.lectureName; + } + + public writeAdditionalLectureRights_args setLectureName(String lectureName) { + this.lectureName = lectureName; + return this; + } + + public void unsetLectureName() { + this.lectureName = null; + } + + /** Returns true if field lectureName is set (has been assigned a value) and false otherwise */ + public boolean isSetLectureName() { + return this.lectureName != null; + } + + public void setLectureNameIsSet(boolean value) { + if (!value) { + this.lectureName = null; + } + } + + public String getUserID() { + return this.userID; + } + + public writeAdditionalLectureRights_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public boolean isIsRead() { + return this.isRead; + } + + public writeAdditionalLectureRights_args setIsRead(boolean isRead) { + this.isRead = isRead; + setIsReadIsSet(true); + return this; + } + + public void unsetIsRead() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + /** Returns true if field isRead is set (has been assigned a value) and false otherwise */ + public boolean isSetIsRead() { + return EncodingUtils.testBit(__isset_bitfield, __ISREAD_ISSET_ID); + } + + public void setIsReadIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISREAD_ISSET_ID, value); + } + + public boolean isIsWrite() { + return this.isWrite; + } + + public writeAdditionalLectureRights_args setIsWrite(boolean isWrite) { + this.isWrite = isWrite; + setIsWriteIsSet(true); + return this; + } + + public void unsetIsWrite() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + /** Returns true if field isWrite is set (has been assigned a value) and false otherwise */ + public boolean isSetIsWrite() { + return EncodingUtils.testBit(__isset_bitfield, __ISWRITE_ISSET_ID); + } + + public void setIsWriteIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISWRITE_ISSET_ID, value); + } + + public boolean isIsAdmin() { + return this.isAdmin; + } + + public writeAdditionalLectureRights_args setIsAdmin(boolean isAdmin) { + this.isAdmin = isAdmin; + setIsAdminIsSet(true); + return this; + } + + public void unsetIsAdmin() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + /** Returns true if field isAdmin is set (has been assigned a value) and false otherwise */ + public boolean isSetIsAdmin() { + return EncodingUtils.testBit(__isset_bitfield, __ISADMIN_ISSET_ID); + } + + public void setIsAdminIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISADMIN_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case LECTURE_NAME: + if (value == null) { + unsetLectureName(); + } else { + setLectureName((String)value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + case IS_READ: + if (value == null) { + unsetIsRead(); + } else { + setIsRead((Boolean)value); + } + break; + + case IS_WRITE: + if (value == null) { + unsetIsWrite(); + } else { + setIsWrite((Boolean)value); + } + break; + + case IS_ADMIN: + if (value == null) { + unsetIsAdmin(); + } else { + setIsAdmin((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case LECTURE_NAME: + return getLectureName(); + + case USER_ID: + return getUserID(); + + case IS_READ: + return Boolean.valueOf(isIsRead()); + + case IS_WRITE: + return Boolean.valueOf(isIsWrite()); + + case IS_ADMIN: + return Boolean.valueOf(isIsAdmin()); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case LECTURE_NAME: + return isSetLectureName(); + case USER_ID: + return isSetUserID(); + case IS_READ: + return isSetIsRead(); + case IS_WRITE: + return isSetIsWrite(); + case IS_ADMIN: + return isSetIsAdmin(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof writeAdditionalLectureRights_args) + return this.equals((writeAdditionalLectureRights_args)that); + return false; + } + + public boolean equals(writeAdditionalLectureRights_args that) { + if (that == null) + return false; + + boolean this_present_lectureName = true && this.isSetLectureName(); + boolean that_present_lectureName = true && that.isSetLectureName(); + if (this_present_lectureName || that_present_lectureName) { + if (!(this_present_lectureName && that_present_lectureName)) + return false; + if (!this.lectureName.equals(that.lectureName)) + return false; + } + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + boolean this_present_isRead = true; + boolean that_present_isRead = true; + if (this_present_isRead || that_present_isRead) { + if (!(this_present_isRead && that_present_isRead)) + return false; + if (this.isRead != that.isRead) + return false; + } + + boolean this_present_isWrite = true; + boolean that_present_isWrite = true; + if (this_present_isWrite || that_present_isWrite) { + if (!(this_present_isWrite && that_present_isWrite)) + return false; + if (this.isWrite != that.isWrite) + return false; + } + + boolean this_present_isAdmin = true; + boolean that_present_isAdmin = true; + if (this_present_isAdmin || that_present_isAdmin) { + if (!(this_present_isAdmin && that_present_isAdmin)) + return false; + if (this.isAdmin != that.isAdmin) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(writeAdditionalLectureRights_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetLectureName()).compareTo(other.isSetLectureName()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLectureName()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lectureName, other.lectureName); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsRead()).compareTo(other.isSetIsRead()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsRead()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRead, other.isRead); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsWrite()).compareTo(other.isSetIsWrite()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsWrite()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isWrite, other.isWrite); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetIsAdmin()).compareTo(other.isSetIsAdmin()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetIsAdmin()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isAdmin, other.isAdmin); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("writeAdditionalLectureRights_args("); + boolean first = true; + + sb.append("lectureName:"); + if (this.lectureName == null) { + sb.append("null"); + } else { + sb.append(this.lectureName); + } + first = false; + if (!first) sb.append(", "); + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + if (!first) sb.append(", "); + sb.append("isRead:"); + sb.append(this.isRead); + first = false; + if (!first) sb.append(", "); + sb.append("isWrite:"); + sb.append(this.isWrite); + first = false; + if (!first) sb.append(", "); + sb.append("isAdmin:"); + sb.append(this.isAdmin); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class writeAdditionalLectureRights_argsStandardSchemeFactory implements SchemeFactory { + public writeAdditionalLectureRights_argsStandardScheme getScheme() { + return new writeAdditionalLectureRights_argsStandardScheme(); + } + } + + private static class writeAdditionalLectureRights_argsStandardScheme extends StandardScheme<writeAdditionalLectureRights_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalLectureRights_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // LECTURE_NAME + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.lectureName = iprot.readString(); + struct.setLectureNameIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // IS_READ + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 4: // IS_WRITE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IS_ADMIN + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalLectureRights_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.lectureName != null) { + oprot.writeFieldBegin(LECTURE_NAME_FIELD_DESC); + oprot.writeString(struct.lectureName); + oprot.writeFieldEnd(); + } + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldBegin(IS_READ_FIELD_DESC); + oprot.writeBool(struct.isRead); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_WRITE_FIELD_DESC); + oprot.writeBool(struct.isWrite); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IS_ADMIN_FIELD_DESC); + oprot.writeBool(struct.isAdmin); + oprot.writeFieldEnd(); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class writeAdditionalLectureRights_argsTupleSchemeFactory implements SchemeFactory { + public writeAdditionalLectureRights_argsTupleScheme getScheme() { + return new writeAdditionalLectureRights_argsTupleScheme(); + } + } + + private static class writeAdditionalLectureRights_argsTupleScheme extends TupleScheme<writeAdditionalLectureRights_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalLectureRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetLectureName()) { + optionals.set(0); + } + if (struct.isSetUserID()) { + optionals.set(1); + } + if (struct.isSetIsRead()) { + optionals.set(2); + } + if (struct.isSetIsWrite()) { + optionals.set(3); + } + if (struct.isSetIsAdmin()) { + optionals.set(4); + } + oprot.writeBitSet(optionals, 5); + if (struct.isSetLectureName()) { + oprot.writeString(struct.lectureName); + } + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + if (struct.isSetIsRead()) { + oprot.writeBool(struct.isRead); + } + if (struct.isSetIsWrite()) { + oprot.writeBool(struct.isWrite); + } + if (struct.isSetIsAdmin()) { + oprot.writeBool(struct.isAdmin); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalLectureRights_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(5); + if (incoming.get(0)) { + struct.lectureName = iprot.readString(); + struct.setLectureNameIsSet(true); + } + if (incoming.get(1)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + if (incoming.get(2)) { + struct.isRead = iprot.readBool(); + struct.setIsReadIsSet(true); + } + if (incoming.get(3)) { + struct.isWrite = iprot.readBool(); + struct.setIsWriteIsSet(true); + } + if (incoming.get(4)) { + struct.isAdmin = iprot.readBool(); + struct.setIsAdminIsSet(true); + } + } + } + + } + + public static class writeAdditionalLectureRights_result implements org.apache.thrift.TBase<writeAdditionalLectureRights_result, writeAdditionalLectureRights_result._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalLectureRights_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalLectureRights_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new writeAdditionalLectureRights_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new writeAdditionalLectureRights_resultTupleSchemeFactory()); + } + + public boolean success; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + SUCCESS((short)0, "success"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 0: // SUCCESS + return SUCCESS; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + private static final int __SUCCESS_ISSET_ID = 0; + private byte __isset_bitfield = 0; + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalLectureRights_result.class, metaDataMap); + } + + public writeAdditionalLectureRights_result() { + } + + public writeAdditionalLectureRights_result( + boolean success) + { + this(); + this.success = success; + setSuccessIsSet(true); + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public writeAdditionalLectureRights_result(writeAdditionalLectureRights_result other) { + __isset_bitfield = other.__isset_bitfield; + this.success = other.success; + } + + public writeAdditionalLectureRights_result deepCopy() { + return new writeAdditionalLectureRights_result(this); + } + + @Override + public void clear() { + setSuccessIsSet(false); + this.success = false; + } + + public boolean isSuccess() { + return this.success; + } + + public writeAdditionalLectureRights_result setSuccess(boolean success) { + this.success = success; + setSuccessIsSet(true); + return this; + } + + public void unsetSuccess() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + } + + public void setSuccessIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((Boolean)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return Boolean.valueOf(isSuccess()); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case SUCCESS: + return isSetSuccess(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof writeAdditionalLectureRights_result) + return this.equals((writeAdditionalLectureRights_result)that); + return false; + } + + public boolean equals(writeAdditionalLectureRights_result that) { + if (that == null) + return false; + + boolean this_present_success = true; + boolean that_present_success = true; + if (this_present_success || that_present_success) { + if (!(this_present_success && that_present_success)) + return false; + if (this.success != that.success) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(writeAdditionalLectureRights_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetSuccess()).compareTo(other.isSetSuccess()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetSuccess()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.success, other.success); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("writeAdditionalLectureRights_result("); + boolean first = true; + + sb.append("success:"); + sb.append(this.success); + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. + __isset_bitfield = 0; + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class writeAdditionalLectureRights_resultStandardSchemeFactory implements SchemeFactory { + public writeAdditionalLectureRights_resultStandardScheme getScheme() { + return new writeAdditionalLectureRights_resultStandardScheme(); + } + } + + private static class writeAdditionalLectureRights_resultStandardScheme extends StandardScheme<writeAdditionalLectureRights_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalLectureRights_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 0: // SUCCESS + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalLectureRights_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.isSetSuccess()) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + oprot.writeBool(struct.success); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class writeAdditionalLectureRights_resultTupleSchemeFactory implements SchemeFactory { + public writeAdditionalLectureRights_resultTupleScheme getScheme() { + return new writeAdditionalLectureRights_resultTupleScheme(); + } + } + + private static class writeAdditionalLectureRights_resultTupleScheme extends TupleScheme<writeAdditionalLectureRights_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalLectureRights_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetSuccess()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + oprot.writeBool(struct.success); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalLectureRights_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.success = iprot.readBool(); + struct.setSuccessIsSet(true); + } + } + } + + } + public static class getAllOtherSatelliteUsers_args implements org.apache.thrift.TBase<getAllOtherSatelliteUsers_args, getAllOtherSatelliteUsers_args._Fields>, java.io.Serializable, Cloneable, Comparable<getAllOtherSatelliteUsers_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getAllOtherSatelliteUsers_args"); - private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.LIST, (short)1); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -34952,7 +37652,7 @@ public class Server { schemes.put(TupleScheme.class, new getAllOtherSatelliteUsers_argsTupleSchemeFactory()); } - public String userID; // required + public List<String> userID; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -35017,7 +37717,8 @@ public class Server { static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getAllOtherSatelliteUsers_args.class, metaDataMap); } @@ -35026,7 +37727,7 @@ public class Server { } public getAllOtherSatelliteUsers_args( - String userID) + List<String> userID) { this(); this.userID = userID; @@ -35037,7 +37738,8 @@ public class Server { */ public getAllOtherSatelliteUsers_args(getAllOtherSatelliteUsers_args other) { if (other.isSetUserID()) { - this.userID = other.userID; + List<String> __this__userID = new ArrayList<String>(other.userID); + this.userID = __this__userID; } } @@ -35050,11 +37752,26 @@ public class Server { this.userID = null; } - public String getUserID() { + public int getUserIDSize() { + return (this.userID == null) ? 0 : this.userID.size(); + } + + public java.util.Iterator<String> getUserIDIterator() { + return (this.userID == null) ? null : this.userID.iterator(); + } + + public void addToUserID(String elem) { + if (this.userID == null) { + this.userID = new ArrayList<String>(); + } + this.userID.add(elem); + } + + public List<String> getUserID() { return this.userID; } - public getAllOtherSatelliteUsers_args setUserID(String userID) { + public getAllOtherSatelliteUsers_args setUserID(List<String> userID) { this.userID = userID; return this; } @@ -35080,7 +37797,7 @@ public class Server { if (value == null) { unsetUserID(); } else { - setUserID((String)value); + setUserID((List<String>)value); } break; @@ -35228,8 +37945,18 @@ public class Server { } switch (schemeField.id) { case 1: // USER_ID - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.userID = iprot.readString(); + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list102 = iprot.readListBegin(); + struct.userID = new ArrayList<String>(_list102.size); + for (int _i103 = 0; _i103 < _list102.size; ++_i103) + { + String _elem104; + _elem104 = iprot.readString(); + struct.userID.add(_elem104); + } + iprot.readListEnd(); + } struct.setUserIDIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -35252,7 +37979,14 @@ public class Server { oprot.writeStructBegin(STRUCT_DESC); if (struct.userID != null) { oprot.writeFieldBegin(USER_ID_FIELD_DESC); - oprot.writeString(struct.userID); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.userID.size())); + for (String _iter105 : struct.userID) + { + oprot.writeString(_iter105); + } + oprot.writeListEnd(); + } oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -35278,7 +38012,13 @@ public class Server { } oprot.writeBitSet(optionals, 1); if (struct.isSetUserID()) { - oprot.writeString(struct.userID); + { + oprot.writeI32(struct.userID.size()); + for (String _iter106 : struct.userID) + { + oprot.writeString(_iter106); + } + } } } @@ -35287,7 +38027,16 @@ public class Server { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { - struct.userID = iprot.readString(); + { + org.apache.thrift.protocol.TList _list107 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.userID = new ArrayList<String>(_list107.size); + for (int _i108 = 0; _i108 < _list107.size; ++_i108) + { + String _elem109; + _elem109 = iprot.readString(); + struct.userID.add(_elem109); + } + } struct.setUserIDIsSet(true); } } @@ -35604,14 +38353,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list102 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list102.size); - for (int _i103 = 0; _i103 < _list102.size; ++_i103) + org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list110.size); + for (int _i111 = 0; _i111 < _list110.size; ++_i111) { - Person _elem104; - _elem104 = new Person(); - _elem104.read(iprot); - struct.success.add(_elem104); + Person _elem112; + _elem112 = new Person(); + _elem112.read(iprot); + struct.success.add(_elem112); } iprot.readListEnd(); } @@ -35639,9 +38388,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter105 : struct.success) + for (Person _iter113 : struct.success) { - _iter105.write(oprot); + _iter113.write(oprot); } oprot.writeListEnd(); } @@ -35672,9 +38421,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter106 : struct.success) + for (Person _iter114 : struct.success) { - _iter106.write(oprot); + _iter114.write(oprot); } } } @@ -35686,14 +38435,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list107 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list107.size); - for (int _i108 = 0; _i108 < _list107.size; ++_i108) + org.apache.thrift.protocol.TList _list115 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list115.size); + for (int _i116 = 0; _i116 < _list115.size; ++_i116) { - Person _elem109; - _elem109 = new Person(); - _elem109.read(iprot); - struct.success.add(_elem109); + Person _elem117; + _elem117 = new Person(); + _elem117.read(iprot); + struct.success.add(_elem117); } } struct.setSuccessIsSet(true); @@ -35703,37 +38452,25 @@ public class Server { } - public static class writeAdditionalImageRights_args implements org.apache.thrift.TBase<writeAdditionalImageRights_args, writeAdditionalImageRights_args._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_args> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_args"); + public static class getPermissionForUserAndImage_args implements org.apache.thrift.TBase<getPermissionForUserAndImage_args, getPermissionForUserAndImage_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndImage_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndImage_args"); - private static final org.apache.thrift.protocol.TField IMAGE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("imageName", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)2); - private static final org.apache.thrift.protocol.TField IS_READ_FIELD_DESC = new org.apache.thrift.protocol.TField("isRead", org.apache.thrift.protocol.TType.BOOL, (short)3); - private static final org.apache.thrift.protocol.TField IS_WRITE_FIELD_DESC = new org.apache.thrift.protocol.TField("isWrite", org.apache.thrift.protocol.TType.BOOL, (short)4); - private static final org.apache.thrift.protocol.TField IS_LINK_ALLOWED_FIELD_DESC = new org.apache.thrift.protocol.TField("isLinkAllowed", org.apache.thrift.protocol.TType.BOOL, (short)5); - private static final org.apache.thrift.protocol.TField IS_ADMIN_FIELD_DESC = new org.apache.thrift.protocol.TField("isAdmin", org.apache.thrift.protocol.TType.BOOL, (short)6); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField IMAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("imageID", org.apache.thrift.protocol.TType.STRING, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new writeAdditionalImageRights_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new writeAdditionalImageRights_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getPermissionForUserAndImage_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getPermissionForUserAndImage_argsTupleSchemeFactory()); } - public String imageName; // required public String userID; // required - public boolean isRead; // required - public boolean isWrite; // required - public boolean isLinkAllowed; // required - public boolean isAdmin; // required + public String imageID; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { - IMAGE_NAME((short)1, "imageName"), - USER_ID((short)2, "userID"), - IS_READ((short)3, "isRead"), - IS_WRITE((short)4, "isWrite"), - IS_LINK_ALLOWED((short)5, "isLinkAllowed"), - IS_ADMIN((short)6, "isAdmin"); + USER_ID((short)1, "userID"), + IMAGE_ID((short)2, "imageID"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -35748,18 +38485,10 @@ public class Server { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { - case 1: // IMAGE_NAME - return IMAGE_NAME; - case 2: // USER_ID + case 1: // USER_ID return USER_ID; - case 3: // IS_READ - return IS_READ; - case 4: // IS_WRITE - return IS_WRITE; - case 5: // IS_LINK_ALLOWED - return IS_LINK_ALLOWED; - case 6: // IS_ADMIN - return IS_ADMIN; + case 2: // IMAGE_ID + return IMAGE_ID; default: return null; } @@ -35800,118 +38529,56 @@ public class Server { } // isset id assignments - private static final int __ISREAD_ISSET_ID = 0; - private static final int __ISWRITE_ISSET_ID = 1; - private static final int __ISLINKALLOWED_ISSET_ID = 2; - private static final int __ISADMIN_ISSET_ID = 3; - private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); - tmpMap.put(_Fields.IMAGE_NAME, new org.apache.thrift.meta_data.FieldMetaData("imageName", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.IS_READ, new org.apache.thrift.meta_data.FieldMetaData("isRead", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - tmpMap.put(_Fields.IS_WRITE, new org.apache.thrift.meta_data.FieldMetaData("isWrite", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - tmpMap.put(_Fields.IS_LINK_ALLOWED, new org.apache.thrift.meta_data.FieldMetaData("isLinkAllowed", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); - tmpMap.put(_Fields.IS_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("isAdmin", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IMAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("imageID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalImageRights_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndImage_args.class, metaDataMap); } - public writeAdditionalImageRights_args() { + public getPermissionForUserAndImage_args() { } - public writeAdditionalImageRights_args( - String imageName, + public getPermissionForUserAndImage_args( String userID, - boolean isRead, - boolean isWrite, - boolean isLinkAllowed, - boolean isAdmin) + String imageID) { this(); - this.imageName = imageName; this.userID = userID; - this.isRead = isRead; - setIsReadIsSet(true); - this.isWrite = isWrite; - setIsWriteIsSet(true); - this.isLinkAllowed = isLinkAllowed; - setIsLinkAllowedIsSet(true); - this.isAdmin = isAdmin; - setIsAdminIsSet(true); + this.imageID = imageID; } /** * Performs a deep copy on <i>other</i>. */ - public writeAdditionalImageRights_args(writeAdditionalImageRights_args other) { - __isset_bitfield = other.__isset_bitfield; - if (other.isSetImageName()) { - this.imageName = other.imageName; - } + public getPermissionForUserAndImage_args(getPermissionForUserAndImage_args other) { if (other.isSetUserID()) { this.userID = other.userID; } - this.isRead = other.isRead; - this.isWrite = other.isWrite; - this.isLinkAllowed = other.isLinkAllowed; - this.isAdmin = other.isAdmin; + if (other.isSetImageID()) { + this.imageID = other.imageID; + } } - public writeAdditionalImageRights_args deepCopy() { - return new writeAdditionalImageRights_args(this); + public getPermissionForUserAndImage_args deepCopy() { + return new getPermissionForUserAndImage_args(this); } @Override public void clear() { - this.imageName = null; this.userID = null; - setIsReadIsSet(false); - this.isRead = false; - setIsWriteIsSet(false); - this.isWrite = false; - setIsLinkAllowedIsSet(false); - this.isLinkAllowed = false; - setIsAdminIsSet(false); - this.isAdmin = false; - } - - public String getImageName() { - return this.imageName; - } - - public writeAdditionalImageRights_args setImageName(String imageName) { - this.imageName = imageName; - return this; - } - - public void unsetImageName() { - this.imageName = null; - } - - /** Returns true if field imageName is set (has been assigned a value) and false otherwise */ - public boolean isSetImageName() { - return this.imageName != null; - } - - public void setImageNameIsSet(boolean value) { - if (!value) { - this.imageName = null; - } + this.imageID = null; } public String getUserID() { return this.userID; } - public writeAdditionalImageRights_args setUserID(String userID) { + public getPermissionForUserAndImage_args setUserID(String userID) { this.userID = userID; return this; } @@ -35931,108 +38598,32 @@ public class Server { } } - public boolean isIsRead() { - return this.isRead; - } - - public writeAdditionalImageRights_args setIsRead(boolean isRead) { - this.isRead = isRead; - setIsReadIsSet(true); - return this; - } - - public void unsetIsRead() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISREAD_ISSET_ID); - } - - /** Returns true if field isRead is set (has been assigned a value) and false otherwise */ - public boolean isSetIsRead() { - return EncodingUtils.testBit(__isset_bitfield, __ISREAD_ISSET_ID); - } - - public void setIsReadIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISREAD_ISSET_ID, value); - } - - public boolean isIsWrite() { - return this.isWrite; - } - - public writeAdditionalImageRights_args setIsWrite(boolean isWrite) { - this.isWrite = isWrite; - setIsWriteIsSet(true); - return this; - } - - public void unsetIsWrite() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISWRITE_ISSET_ID); - } - - /** Returns true if field isWrite is set (has been assigned a value) and false otherwise */ - public boolean isSetIsWrite() { - return EncodingUtils.testBit(__isset_bitfield, __ISWRITE_ISSET_ID); - } - - public void setIsWriteIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISWRITE_ISSET_ID, value); - } - - public boolean isIsLinkAllowed() { - return this.isLinkAllowed; - } - - public writeAdditionalImageRights_args setIsLinkAllowed(boolean isLinkAllowed) { - this.isLinkAllowed = isLinkAllowed; - setIsLinkAllowedIsSet(true); - return this; - } - - public void unsetIsLinkAllowed() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); - } - - /** Returns true if field isLinkAllowed is set (has been assigned a value) and false otherwise */ - public boolean isSetIsLinkAllowed() { - return EncodingUtils.testBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID); - } - - public void setIsLinkAllowedIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISLINKALLOWED_ISSET_ID, value); - } - - public boolean isIsAdmin() { - return this.isAdmin; + public String getImageID() { + return this.imageID; } - public writeAdditionalImageRights_args setIsAdmin(boolean isAdmin) { - this.isAdmin = isAdmin; - setIsAdminIsSet(true); + public getPermissionForUserAndImage_args setImageID(String imageID) { + this.imageID = imageID; return this; } - public void unsetIsAdmin() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISADMIN_ISSET_ID); + public void unsetImageID() { + this.imageID = null; } - /** Returns true if field isAdmin is set (has been assigned a value) and false otherwise */ - public boolean isSetIsAdmin() { - return EncodingUtils.testBit(__isset_bitfield, __ISADMIN_ISSET_ID); + /** Returns true if field imageID is set (has been assigned a value) and false otherwise */ + public boolean isSetImageID() { + return this.imageID != null; } - public void setIsAdminIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISADMIN_ISSET_ID, value); + public void setImageIDIsSet(boolean value) { + if (!value) { + this.imageID = null; + } } public void setFieldValue(_Fields field, Object value) { switch (field) { - case IMAGE_NAME: - if (value == null) { - unsetImageName(); - } else { - setImageName((String)value); - } - break; - case USER_ID: if (value == null) { unsetUserID(); @@ -36041,35 +38632,11 @@ public class Server { } break; - case IS_READ: - if (value == null) { - unsetIsRead(); - } else { - setIsRead((Boolean)value); - } - break; - - case IS_WRITE: - if (value == null) { - unsetIsWrite(); - } else { - setIsWrite((Boolean)value); - } - break; - - case IS_LINK_ALLOWED: - if (value == null) { - unsetIsLinkAllowed(); - } else { - setIsLinkAllowed((Boolean)value); - } - break; - - case IS_ADMIN: + case IMAGE_ID: if (value == null) { - unsetIsAdmin(); + unsetImageID(); } else { - setIsAdmin((Boolean)value); + setImageID((String)value); } break; @@ -36078,23 +38645,11 @@ public class Server { public Object getFieldValue(_Fields field) { switch (field) { - case IMAGE_NAME: - return getImageName(); - case USER_ID: return getUserID(); - case IS_READ: - return Boolean.valueOf(isIsRead()); - - case IS_WRITE: - return Boolean.valueOf(isIsWrite()); - - case IS_LINK_ALLOWED: - return Boolean.valueOf(isIsLinkAllowed()); - - case IS_ADMIN: - return Boolean.valueOf(isIsAdmin()); + case IMAGE_ID: + return getImageID(); } throw new IllegalStateException(); @@ -36107,18 +38662,10 @@ public class Server { } switch (field) { - case IMAGE_NAME: - return isSetImageName(); case USER_ID: return isSetUserID(); - case IS_READ: - return isSetIsRead(); - case IS_WRITE: - return isSetIsWrite(); - case IS_LINK_ALLOWED: - return isSetIsLinkAllowed(); - case IS_ADMIN: - return isSetIsAdmin(); + case IMAGE_ID: + return isSetImageID(); } throw new IllegalStateException(); } @@ -36127,24 +38674,15 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof writeAdditionalImageRights_args) - return this.equals((writeAdditionalImageRights_args)that); + if (that instanceof getPermissionForUserAndImage_args) + return this.equals((getPermissionForUserAndImage_args)that); return false; } - public boolean equals(writeAdditionalImageRights_args that) { + public boolean equals(getPermissionForUserAndImage_args that) { if (that == null) return false; - boolean this_present_imageName = true && this.isSetImageName(); - boolean that_present_imageName = true && that.isSetImageName(); - if (this_present_imageName || that_present_imageName) { - if (!(this_present_imageName && that_present_imageName)) - return false; - if (!this.imageName.equals(that.imageName)) - return false; - } - boolean this_present_userID = true && this.isSetUserID(); boolean that_present_userID = true && that.isSetUserID(); if (this_present_userID || that_present_userID) { @@ -36154,39 +38692,12 @@ public class Server { return false; } - boolean this_present_isRead = true; - boolean that_present_isRead = true; - if (this_present_isRead || that_present_isRead) { - if (!(this_present_isRead && that_present_isRead)) - return false; - if (this.isRead != that.isRead) - return false; - } - - boolean this_present_isWrite = true; - boolean that_present_isWrite = true; - if (this_present_isWrite || that_present_isWrite) { - if (!(this_present_isWrite && that_present_isWrite)) - return false; - if (this.isWrite != that.isWrite) - return false; - } - - boolean this_present_isLinkAllowed = true; - boolean that_present_isLinkAllowed = true; - if (this_present_isLinkAllowed || that_present_isLinkAllowed) { - if (!(this_present_isLinkAllowed && that_present_isLinkAllowed)) - return false; - if (this.isLinkAllowed != that.isLinkAllowed) - return false; - } - - boolean this_present_isAdmin = true; - boolean that_present_isAdmin = true; - if (this_present_isAdmin || that_present_isAdmin) { - if (!(this_present_isAdmin && that_present_isAdmin)) + boolean this_present_imageID = true && this.isSetImageID(); + boolean that_present_imageID = true && that.isSetImageID(); + if (this_present_imageID || that_present_imageID) { + if (!(this_present_imageID && that_present_imageID)) return false; - if (this.isAdmin != that.isAdmin) + if (!this.imageID.equals(that.imageID)) return false; } @@ -36199,23 +38710,13 @@ public class Server { } @Override - public int compareTo(writeAdditionalImageRights_args other) { + public int compareTo(getPermissionForUserAndImage_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; - lastComparison = Boolean.valueOf(isSetImageName()).compareTo(other.isSetImageName()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetImageName()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageName, other.imageName); - if (lastComparison != 0) { - return lastComparison; - } - } lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); if (lastComparison != 0) { return lastComparison; @@ -36226,42 +38727,12 @@ public class Server { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetIsRead()).compareTo(other.isSetIsRead()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetIsRead()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isRead, other.isRead); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetIsWrite()).compareTo(other.isSetIsWrite()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetIsWrite()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isWrite, other.isWrite); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetIsLinkAllowed()).compareTo(other.isSetIsLinkAllowed()); - if (lastComparison != 0) { - return lastComparison; - } - if (isSetIsLinkAllowed()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isLinkAllowed, other.isLinkAllowed); - if (lastComparison != 0) { - return lastComparison; - } - } - lastComparison = Boolean.valueOf(isSetIsAdmin()).compareTo(other.isSetIsAdmin()); + lastComparison = Boolean.valueOf(isSetImageID()).compareTo(other.isSetImageID()); if (lastComparison != 0) { return lastComparison; } - if (isSetIsAdmin()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isAdmin, other.isAdmin); + if (isSetImageID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageID, other.imageID); if (lastComparison != 0) { return lastComparison; } @@ -36283,17 +38754,9 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("writeAdditionalImageRights_args("); + StringBuilder sb = new StringBuilder("getPermissionForUserAndImage_args("); boolean first = true; - sb.append("imageName:"); - if (this.imageName == null) { - sb.append("null"); - } else { - sb.append(this.imageName); - } - first = false; - if (!first) sb.append(", "); sb.append("userID:"); if (this.userID == null) { sb.append("null"); @@ -36302,20 +38765,12 @@ public class Server { } first = false; if (!first) sb.append(", "); - sb.append("isRead:"); - sb.append(this.isRead); - first = false; - if (!first) sb.append(", "); - sb.append("isWrite:"); - sb.append(this.isWrite); - first = false; - if (!first) sb.append(", "); - sb.append("isLinkAllowed:"); - sb.append(this.isLinkAllowed); - first = false; - if (!first) sb.append(", "); - sb.append("isAdmin:"); - sb.append(this.isAdmin); + sb.append("imageID:"); + if (this.imageID == null) { + sb.append("null"); + } else { + sb.append(this.imageID); + } first = false; sb.append(")"); return sb.toString(); @@ -36336,23 +38791,21 @@ public class Server { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } - private static class writeAdditionalImageRights_argsStandardSchemeFactory implements SchemeFactory { - public writeAdditionalImageRights_argsStandardScheme getScheme() { - return new writeAdditionalImageRights_argsStandardScheme(); + private static class getPermissionForUserAndImage_argsStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_argsStandardScheme getScheme() { + return new getPermissionForUserAndImage_argsStandardScheme(); } } - private static class writeAdditionalImageRights_argsStandardScheme extends StandardScheme<writeAdditionalImageRights_args> { + private static class getPermissionForUserAndImage_argsStandardScheme extends StandardScheme<getPermissionForUserAndImage_args> { - public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -36362,15 +38815,7 @@ public class Server { break; } switch (schemeField.id) { - case 1: // IMAGE_NAME - if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.imageName = iprot.readString(); - struct.setImageNameIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 2: // USER_ID + case 1: // USER_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); @@ -36378,34 +38823,10 @@ public class Server { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 3: // IS_READ - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.isRead = iprot.readBool(); - struct.setIsReadIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 4: // IS_WRITE - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.isWrite = iprot.readBool(); - struct.setIsWriteIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 5: // IS_LINK_ALLOWED - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.isLinkAllowed = iprot.readBool(); - struct.setIsLinkAllowedIsSet(true); - } else { - org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); - } - break; - case 6: // IS_ADMIN - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.isAdmin = iprot.readBool(); - struct.setIsAdminIsSet(true); + case 2: // IMAGE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.imageID = iprot.readString(); + struct.setImageIDIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -36421,134 +38842,82 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.imageName != null) { - oprot.writeFieldBegin(IMAGE_NAME_FIELD_DESC); - oprot.writeString(struct.imageName); - oprot.writeFieldEnd(); - } if (struct.userID != null) { oprot.writeFieldBegin(USER_ID_FIELD_DESC); oprot.writeString(struct.userID); oprot.writeFieldEnd(); } - oprot.writeFieldBegin(IS_READ_FIELD_DESC); - oprot.writeBool(struct.isRead); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(IS_WRITE_FIELD_DESC); - oprot.writeBool(struct.isWrite); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(IS_LINK_ALLOWED_FIELD_DESC); - oprot.writeBool(struct.isLinkAllowed); - oprot.writeFieldEnd(); - oprot.writeFieldBegin(IS_ADMIN_FIELD_DESC); - oprot.writeBool(struct.isAdmin); - oprot.writeFieldEnd(); + if (struct.imageID != null) { + oprot.writeFieldBegin(IMAGE_ID_FIELD_DESC); + oprot.writeString(struct.imageID); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class writeAdditionalImageRights_argsTupleSchemeFactory implements SchemeFactory { - public writeAdditionalImageRights_argsTupleScheme getScheme() { - return new writeAdditionalImageRights_argsTupleScheme(); + private static class getPermissionForUserAndImage_argsTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_argsTupleScheme getScheme() { + return new getPermissionForUserAndImage_argsTupleScheme(); } } - private static class writeAdditionalImageRights_argsTupleScheme extends TupleScheme<writeAdditionalImageRights_args> { + private static class getPermissionForUserAndImage_argsTupleScheme extends TupleScheme<getPermissionForUserAndImage_args> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); - if (struct.isSetImageName()) { + if (struct.isSetUserID()) { optionals.set(0); } - if (struct.isSetUserID()) { + if (struct.isSetImageID()) { optionals.set(1); } - if (struct.isSetIsRead()) { - optionals.set(2); - } - if (struct.isSetIsWrite()) { - optionals.set(3); - } - if (struct.isSetIsLinkAllowed()) { - optionals.set(4); - } - if (struct.isSetIsAdmin()) { - optionals.set(5); - } - oprot.writeBitSet(optionals, 6); - if (struct.isSetImageName()) { - oprot.writeString(struct.imageName); - } + oprot.writeBitSet(optionals, 2); if (struct.isSetUserID()) { oprot.writeString(struct.userID); } - if (struct.isSetIsRead()) { - oprot.writeBool(struct.isRead); - } - if (struct.isSetIsWrite()) { - oprot.writeBool(struct.isWrite); - } - if (struct.isSetIsLinkAllowed()) { - oprot.writeBool(struct.isLinkAllowed); - } - if (struct.isSetIsAdmin()) { - oprot.writeBool(struct.isAdmin); + if (struct.isSetImageID()) { + oprot.writeString(struct.imageID); } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; - BitSet incoming = iprot.readBitSet(6); + BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { - struct.imageName = iprot.readString(); - struct.setImageNameIsSet(true); - } - if (incoming.get(1)) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); } - if (incoming.get(2)) { - struct.isRead = iprot.readBool(); - struct.setIsReadIsSet(true); - } - if (incoming.get(3)) { - struct.isWrite = iprot.readBool(); - struct.setIsWriteIsSet(true); - } - if (incoming.get(4)) { - struct.isLinkAllowed = iprot.readBool(); - struct.setIsLinkAllowedIsSet(true); - } - if (incoming.get(5)) { - struct.isAdmin = iprot.readBool(); - struct.setIsAdminIsSet(true); + if (incoming.get(1)) { + struct.imageID = iprot.readString(); + struct.setImageIDIsSet(true); } } } } - public static class writeAdditionalImageRights_result implements org.apache.thrift.TBase<writeAdditionalImageRights_result, writeAdditionalImageRights_result._Fields>, java.io.Serializable, Cloneable, Comparable<writeAdditionalImageRights_result> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("writeAdditionalImageRights_result"); + public static class getPermissionForUserAndImage_result implements org.apache.thrift.TBase<getPermissionForUserAndImage_result, getPermissionForUserAndImage_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndImage_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndImage_result"); - private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.BOOL, (short)0); + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new writeAdditionalImageRights_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new writeAdditionalImageRights_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getPermissionForUserAndImage_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getPermissionForUserAndImage_resultTupleSchemeFactory()); } - public boolean success; // required + public List<Person> success; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -36609,67 +38978,85 @@ public class Server { } // isset id assignments - private static final int __SUCCESS_ISSET_ID = 0; - private byte __isset_bitfield = 0; public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.SUCCESS, new org.apache.thrift.meta_data.FieldMetaData("success", org.apache.thrift.TFieldRequirementType.DEFAULT, - new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Person.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(writeAdditionalImageRights_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndImage_result.class, metaDataMap); } - public writeAdditionalImageRights_result() { + public getPermissionForUserAndImage_result() { } - public writeAdditionalImageRights_result( - boolean success) + public getPermissionForUserAndImage_result( + List<Person> success) { this(); this.success = success; - setSuccessIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ - public writeAdditionalImageRights_result(writeAdditionalImageRights_result other) { - __isset_bitfield = other.__isset_bitfield; - this.success = other.success; + public getPermissionForUserAndImage_result(getPermissionForUserAndImage_result other) { + if (other.isSetSuccess()) { + List<Person> __this__success = new ArrayList<Person>(other.success.size()); + for (Person other_element : other.success) { + __this__success.add(new Person(other_element)); + } + this.success = __this__success; + } } - public writeAdditionalImageRights_result deepCopy() { - return new writeAdditionalImageRights_result(this); + public getPermissionForUserAndImage_result deepCopy() { + return new getPermissionForUserAndImage_result(this); } @Override public void clear() { - setSuccessIsSet(false); - this.success = false; + this.success = null; } - public boolean isSuccess() { + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Person> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Person elem) { + if (this.success == null) { + this.success = new ArrayList<Person>(); + } + this.success.add(elem); + } + + public List<Person> getSuccess() { return this.success; } - public writeAdditionalImageRights_result setSuccess(boolean success) { + public getPermissionForUserAndImage_result setSuccess(List<Person> success) { this.success = success; - setSuccessIsSet(true); return this; } public void unsetSuccess() { - __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __SUCCESS_ISSET_ID); + this.success = null; } /** Returns true if field success is set (has been assigned a value) and false otherwise */ public boolean isSetSuccess() { - return EncodingUtils.testBit(__isset_bitfield, __SUCCESS_ISSET_ID); + return this.success != null; } public void setSuccessIsSet(boolean value) { - __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SUCCESS_ISSET_ID, value); + if (!value) { + this.success = null; + } } public void setFieldValue(_Fields field, Object value) { @@ -36678,7 +39065,7 @@ public class Server { if (value == null) { unsetSuccess(); } else { - setSuccess((Boolean)value); + setSuccess((List<Person>)value); } break; @@ -36688,7 +39075,7 @@ public class Server { public Object getFieldValue(_Fields field) { switch (field) { case SUCCESS: - return Boolean.valueOf(isSuccess()); + return getSuccess(); } throw new IllegalStateException(); @@ -36711,21 +39098,21 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof writeAdditionalImageRights_result) - return this.equals((writeAdditionalImageRights_result)that); + if (that instanceof getPermissionForUserAndImage_result) + return this.equals((getPermissionForUserAndImage_result)that); return false; } - public boolean equals(writeAdditionalImageRights_result that) { + public boolean equals(getPermissionForUserAndImage_result that) { if (that == null) return false; - boolean this_present_success = true; - boolean that_present_success = true; + boolean this_present_success = true && this.isSetSuccess(); + boolean that_present_success = true && that.isSetSuccess(); if (this_present_success || that_present_success) { if (!(this_present_success && that_present_success)) return false; - if (this.success != that.success) + if (!this.success.equals(that.success)) return false; } @@ -36738,7 +39125,7 @@ public class Server { } @Override - public int compareTo(writeAdditionalImageRights_result other) { + public int compareTo(getPermissionForUserAndImage_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -36772,11 +39159,15 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("writeAdditionalImageRights_result("); + StringBuilder sb = new StringBuilder("getPermissionForUserAndImage_result("); boolean first = true; sb.append("success:"); - sb.append(this.success); + if (this.success == null) { + sb.append("null"); + } else { + sb.append(this.success); + } first = false; sb.append(")"); return sb.toString(); @@ -36797,23 +39188,21 @@ public class Server { private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { try { - // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor. - __isset_bitfield = 0; read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); } catch (org.apache.thrift.TException te) { throw new java.io.IOException(te); } } - private static class writeAdditionalImageRights_resultStandardSchemeFactory implements SchemeFactory { - public writeAdditionalImageRights_resultStandardScheme getScheme() { - return new writeAdditionalImageRights_resultStandardScheme(); + private static class getPermissionForUserAndImage_resultStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_resultStandardScheme getScheme() { + return new getPermissionForUserAndImage_resultStandardScheme(); } } - private static class writeAdditionalImageRights_resultStandardScheme extends StandardScheme<writeAdditionalImageRights_result> { + private static class getPermissionForUserAndImage_resultStandardScheme extends StandardScheme<getPermissionForUserAndImage_result> { - public void read(org.apache.thrift.protocol.TProtocol iprot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -36824,8 +39213,19 @@ public class Server { } switch (schemeField.id) { case 0: // SUCCESS - if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { - struct.success = iprot.readBool(); + if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { + { + org.apache.thrift.protocol.TList _list118 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list118.size); + for (int _i119 = 0; _i119 < _list118.size; ++_i119) + { + Person _elem120; + _elem120 = new Person(); + _elem120.read(iprot); + struct.success.add(_elem120); + } + iprot.readListEnd(); + } struct.setSuccessIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); @@ -36842,13 +39242,20 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); - if (struct.isSetSuccess()) { + if (struct.success != null) { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); - oprot.writeBool(struct.success); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Person _iter121 : struct.success) + { + _iter121.write(oprot); + } + oprot.writeListEnd(); + } oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -36857,16 +39264,16 @@ public class Server { } - private static class writeAdditionalImageRights_resultTupleSchemeFactory implements SchemeFactory { - public writeAdditionalImageRights_resultTupleScheme getScheme() { - return new writeAdditionalImageRights_resultTupleScheme(); + private static class getPermissionForUserAndImage_resultTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_resultTupleScheme getScheme() { + return new getPermissionForUserAndImage_resultTupleScheme(); } } - private static class writeAdditionalImageRights_resultTupleScheme extends TupleScheme<writeAdditionalImageRights_result> { + private static class getPermissionForUserAndImage_resultTupleScheme extends TupleScheme<getPermissionForUserAndImage_result> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -36874,16 +39281,32 @@ public class Server { } oprot.writeBitSet(optionals, 1); if (struct.isSetSuccess()) { - oprot.writeBool(struct.success); + { + oprot.writeI32(struct.success.size()); + for (Person _iter122 : struct.success) + { + _iter122.write(oprot); + } + } } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, writeAdditionalImageRights_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { - struct.success = iprot.readBool(); + { + org.apache.thrift.protocol.TList _list123 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list123.size); + for (int _i124 = 0; _i124 < _list123.size; ++_i124) + { + Person _elem125; + _elem125 = new Person(); + _elem125.read(iprot); + struct.success.add(_elem125); + } + } struct.setSuccessIsSet(true); } } @@ -36891,25 +39314,25 @@ public class Server { } - public static class getPermissionForUserAndImage_args implements org.apache.thrift.TBase<getPermissionForUserAndImage_args, getPermissionForUserAndImage_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndImage_args> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndImage_args"); + public static class getPermissionForUserAndLecture_args implements org.apache.thrift.TBase<getPermissionForUserAndLecture_args, getPermissionForUserAndLecture_args._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndLecture_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndLecture_args"); private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)1); - private static final org.apache.thrift.protocol.TField IMAGE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("imageID", org.apache.thrift.protocol.TType.STRING, (short)2); + private static final org.apache.thrift.protocol.TField LECTURE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("lectureID", org.apache.thrift.protocol.TType.STRING, (short)2); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getPermissionForUserAndImage_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getPermissionForUserAndImage_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getPermissionForUserAndLecture_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getPermissionForUserAndLecture_argsTupleSchemeFactory()); } public String userID; // required - public String imageID; // required + public String lectureID; // required /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { USER_ID((short)1, "userID"), - IMAGE_ID((short)2, "imageID"); + LECTURE_ID((short)2, "lectureID"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -36926,8 +39349,8 @@ public class Server { switch(fieldId) { case 1: // USER_ID return USER_ID; - case 2: // IMAGE_ID - return IMAGE_ID; + case 2: // LECTURE_ID + return LECTURE_ID; default: return null; } @@ -36973,51 +39396,51 @@ public class Server { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); - tmpMap.put(_Fields.IMAGE_ID, new org.apache.thrift.meta_data.FieldMetaData("imageID", org.apache.thrift.TFieldRequirementType.DEFAULT, + tmpMap.put(_Fields.LECTURE_ID, new org.apache.thrift.meta_data.FieldMetaData("lectureID", org.apache.thrift.TFieldRequirementType.DEFAULT, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndImage_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndLecture_args.class, metaDataMap); } - public getPermissionForUserAndImage_args() { + public getPermissionForUserAndLecture_args() { } - public getPermissionForUserAndImage_args( + public getPermissionForUserAndLecture_args( String userID, - String imageID) + String lectureID) { this(); this.userID = userID; - this.imageID = imageID; + this.lectureID = lectureID; } /** * Performs a deep copy on <i>other</i>. */ - public getPermissionForUserAndImage_args(getPermissionForUserAndImage_args other) { + public getPermissionForUserAndLecture_args(getPermissionForUserAndLecture_args other) { if (other.isSetUserID()) { this.userID = other.userID; } - if (other.isSetImageID()) { - this.imageID = other.imageID; + if (other.isSetLectureID()) { + this.lectureID = other.lectureID; } } - public getPermissionForUserAndImage_args deepCopy() { - return new getPermissionForUserAndImage_args(this); + public getPermissionForUserAndLecture_args deepCopy() { + return new getPermissionForUserAndLecture_args(this); } @Override public void clear() { this.userID = null; - this.imageID = null; + this.lectureID = null; } public String getUserID() { return this.userID; } - public getPermissionForUserAndImage_args setUserID(String userID) { + public getPermissionForUserAndLecture_args setUserID(String userID) { this.userID = userID; return this; } @@ -37037,27 +39460,27 @@ public class Server { } } - public String getImageID() { - return this.imageID; + public String getLectureID() { + return this.lectureID; } - public getPermissionForUserAndImage_args setImageID(String imageID) { - this.imageID = imageID; + public getPermissionForUserAndLecture_args setLectureID(String lectureID) { + this.lectureID = lectureID; return this; } - public void unsetImageID() { - this.imageID = null; + public void unsetLectureID() { + this.lectureID = null; } - /** Returns true if field imageID is set (has been assigned a value) and false otherwise */ - public boolean isSetImageID() { - return this.imageID != null; + /** Returns true if field lectureID is set (has been assigned a value) and false otherwise */ + public boolean isSetLectureID() { + return this.lectureID != null; } - public void setImageIDIsSet(boolean value) { + public void setLectureIDIsSet(boolean value) { if (!value) { - this.imageID = null; + this.lectureID = null; } } @@ -37071,11 +39494,11 @@ public class Server { } break; - case IMAGE_ID: + case LECTURE_ID: if (value == null) { - unsetImageID(); + unsetLectureID(); } else { - setImageID((String)value); + setLectureID((String)value); } break; @@ -37087,8 +39510,8 @@ public class Server { case USER_ID: return getUserID(); - case IMAGE_ID: - return getImageID(); + case LECTURE_ID: + return getLectureID(); } throw new IllegalStateException(); @@ -37103,8 +39526,8 @@ public class Server { switch (field) { case USER_ID: return isSetUserID(); - case IMAGE_ID: - return isSetImageID(); + case LECTURE_ID: + return isSetLectureID(); } throw new IllegalStateException(); } @@ -37113,12 +39536,12 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getPermissionForUserAndImage_args) - return this.equals((getPermissionForUserAndImage_args)that); + if (that instanceof getPermissionForUserAndLecture_args) + return this.equals((getPermissionForUserAndLecture_args)that); return false; } - public boolean equals(getPermissionForUserAndImage_args that) { + public boolean equals(getPermissionForUserAndLecture_args that) { if (that == null) return false; @@ -37131,12 +39554,12 @@ public class Server { return false; } - boolean this_present_imageID = true && this.isSetImageID(); - boolean that_present_imageID = true && that.isSetImageID(); - if (this_present_imageID || that_present_imageID) { - if (!(this_present_imageID && that_present_imageID)) + boolean this_present_lectureID = true && this.isSetLectureID(); + boolean that_present_lectureID = true && that.isSetLectureID(); + if (this_present_lectureID || that_present_lectureID) { + if (!(this_present_lectureID && that_present_lectureID)) return false; - if (!this.imageID.equals(that.imageID)) + if (!this.lectureID.equals(that.lectureID)) return false; } @@ -37149,7 +39572,7 @@ public class Server { } @Override - public int compareTo(getPermissionForUserAndImage_args other) { + public int compareTo(getPermissionForUserAndLecture_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -37166,12 +39589,12 @@ public class Server { return lastComparison; } } - lastComparison = Boolean.valueOf(isSetImageID()).compareTo(other.isSetImageID()); + lastComparison = Boolean.valueOf(isSetLectureID()).compareTo(other.isSetLectureID()); if (lastComparison != 0) { return lastComparison; } - if (isSetImageID()) { - lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageID, other.imageID); + if (isSetLectureID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lectureID, other.lectureID); if (lastComparison != 0) { return lastComparison; } @@ -37193,7 +39616,7 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getPermissionForUserAndImage_args("); + StringBuilder sb = new StringBuilder("getPermissionForUserAndLecture_args("); boolean first = true; sb.append("userID:"); @@ -37204,11 +39627,11 @@ public class Server { } first = false; if (!first) sb.append(", "); - sb.append("imageID:"); - if (this.imageID == null) { + sb.append("lectureID:"); + if (this.lectureID == null) { sb.append("null"); } else { - sb.append(this.imageID); + sb.append(this.lectureID); } first = false; sb.append(")"); @@ -37236,15 +39659,15 @@ public class Server { } } - private static class getPermissionForUserAndImage_argsStandardSchemeFactory implements SchemeFactory { - public getPermissionForUserAndImage_argsStandardScheme getScheme() { - return new getPermissionForUserAndImage_argsStandardScheme(); + private static class getPermissionForUserAndLecture_argsStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndLecture_argsStandardScheme getScheme() { + return new getPermissionForUserAndLecture_argsStandardScheme(); } } - private static class getPermissionForUserAndImage_argsStandardScheme extends StandardScheme<getPermissionForUserAndImage_args> { + private static class getPermissionForUserAndLecture_argsStandardScheme extends StandardScheme<getPermissionForUserAndLecture_args> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndLecture_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -37262,10 +39685,10 @@ public class Server { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; - case 2: // IMAGE_ID + case 2: // LECTURE_ID if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { - struct.imageID = iprot.readString(); - struct.setImageIDIsSet(true); + struct.lectureID = iprot.readString(); + struct.setLectureIDIsSet(true); } else { org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -37281,7 +39704,7 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndLecture_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -37290,9 +39713,9 @@ public class Server { oprot.writeString(struct.userID); oprot.writeFieldEnd(); } - if (struct.imageID != null) { - oprot.writeFieldBegin(IMAGE_ID_FIELD_DESC); - oprot.writeString(struct.imageID); + if (struct.lectureID != null) { + oprot.writeFieldBegin(LECTURE_ID_FIELD_DESC); + oprot.writeString(struct.lectureID); oprot.writeFieldEnd(); } oprot.writeFieldStop(); @@ -37301,35 +39724,35 @@ public class Server { } - private static class getPermissionForUserAndImage_argsTupleSchemeFactory implements SchemeFactory { - public getPermissionForUserAndImage_argsTupleScheme getScheme() { - return new getPermissionForUserAndImage_argsTupleScheme(); + private static class getPermissionForUserAndLecture_argsTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndLecture_argsTupleScheme getScheme() { + return new getPermissionForUserAndLecture_argsTupleScheme(); } } - private static class getPermissionForUserAndImage_argsTupleScheme extends TupleScheme<getPermissionForUserAndImage_args> { + private static class getPermissionForUserAndLecture_argsTupleScheme extends TupleScheme<getPermissionForUserAndLecture_args> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndLecture_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetUserID()) { optionals.set(0); } - if (struct.isSetImageID()) { + if (struct.isSetLectureID()) { optionals.set(1); } oprot.writeBitSet(optionals, 2); if (struct.isSetUserID()) { oprot.writeString(struct.userID); } - if (struct.isSetImageID()) { - oprot.writeString(struct.imageID); + if (struct.isSetLectureID()) { + oprot.writeString(struct.lectureID); } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndLecture_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(2); if (incoming.get(0)) { @@ -37337,23 +39760,23 @@ public class Server { struct.setUserIDIsSet(true); } if (incoming.get(1)) { - struct.imageID = iprot.readString(); - struct.setImageIDIsSet(true); + struct.lectureID = iprot.readString(); + struct.setLectureIDIsSet(true); } } } } - public static class getPermissionForUserAndImage_result implements org.apache.thrift.TBase<getPermissionForUserAndImage_result, getPermissionForUserAndImage_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndImage_result> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndImage_result"); + public static class getPermissionForUserAndLecture_result implements org.apache.thrift.TBase<getPermissionForUserAndLecture_result, getPermissionForUserAndLecture_result._Fields>, java.io.Serializable, Cloneable, Comparable<getPermissionForUserAndLecture_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getPermissionForUserAndLecture_result"); private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.LIST, (short)0); private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getPermissionForUserAndImage_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getPermissionForUserAndImage_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getPermissionForUserAndLecture_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getPermissionForUserAndLecture_resultTupleSchemeFactory()); } public List<Person> success; // required @@ -37424,13 +39847,13 @@ public class Server { new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Person.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndImage_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getPermissionForUserAndLecture_result.class, metaDataMap); } - public getPermissionForUserAndImage_result() { + public getPermissionForUserAndLecture_result() { } - public getPermissionForUserAndImage_result( + public getPermissionForUserAndLecture_result( List<Person> success) { this(); @@ -37440,7 +39863,7 @@ public class Server { /** * Performs a deep copy on <i>other</i>. */ - public getPermissionForUserAndImage_result(getPermissionForUserAndImage_result other) { + public getPermissionForUserAndLecture_result(getPermissionForUserAndLecture_result other) { if (other.isSetSuccess()) { List<Person> __this__success = new ArrayList<Person>(other.success.size()); for (Person other_element : other.success) { @@ -37450,8 +39873,8 @@ public class Server { } } - public getPermissionForUserAndImage_result deepCopy() { - return new getPermissionForUserAndImage_result(this); + public getPermissionForUserAndLecture_result deepCopy() { + return new getPermissionForUserAndLecture_result(this); } @Override @@ -37478,7 +39901,7 @@ public class Server { return this.success; } - public getPermissionForUserAndImage_result setSuccess(List<Person> success) { + public getPermissionForUserAndLecture_result setSuccess(List<Person> success) { this.success = success; return this; } @@ -37537,12 +39960,12 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getPermissionForUserAndImage_result) - return this.equals((getPermissionForUserAndImage_result)that); + if (that instanceof getPermissionForUserAndLecture_result) + return this.equals((getPermissionForUserAndLecture_result)that); return false; } - public boolean equals(getPermissionForUserAndImage_result that) { + public boolean equals(getPermissionForUserAndLecture_result that) { if (that == null) return false; @@ -37564,7 +39987,7 @@ public class Server { } @Override - public int compareTo(getPermissionForUserAndImage_result other) { + public int compareTo(getPermissionForUserAndLecture_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -37598,7 +40021,7 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getPermissionForUserAndImage_result("); + StringBuilder sb = new StringBuilder("getPermissionForUserAndLecture_result("); boolean first = true; sb.append("success:"); @@ -37633,15 +40056,15 @@ public class Server { } } - private static class getPermissionForUserAndImage_resultStandardSchemeFactory implements SchemeFactory { - public getPermissionForUserAndImage_resultStandardScheme getScheme() { - return new getPermissionForUserAndImage_resultStandardScheme(); + private static class getPermissionForUserAndLecture_resultStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndLecture_resultStandardScheme getScheme() { + return new getPermissionForUserAndLecture_resultStandardScheme(); } } - private static class getPermissionForUserAndImage_resultStandardScheme extends StandardScheme<getPermissionForUserAndImage_result> { + private static class getPermissionForUserAndLecture_resultStandardScheme extends StandardScheme<getPermissionForUserAndLecture_result> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getPermissionForUserAndLecture_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -37654,14 +40077,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list110 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list110.size); - for (int _i111 = 0; _i111 < _list110.size; ++_i111) + org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list126.size); + for (int _i127 = 0; _i127 < _list126.size; ++_i127) { - Person _elem112; - _elem112 = new Person(); - _elem112.read(iprot); - struct.success.add(_elem112); + Person _elem128; + _elem128 = new Person(); + _elem128.read(iprot); + struct.success.add(_elem128); } iprot.readListEnd(); } @@ -37681,7 +40104,7 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getPermissionForUserAndLecture_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -37689,9 +40112,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); - for (Person _iter113 : struct.success) + for (Person _iter129 : struct.success) { - _iter113.write(oprot); + _iter129.write(oprot); } oprot.writeListEnd(); } @@ -37703,16 +40126,16 @@ public class Server { } - private static class getPermissionForUserAndImage_resultTupleSchemeFactory implements SchemeFactory { - public getPermissionForUserAndImage_resultTupleScheme getScheme() { - return new getPermissionForUserAndImage_resultTupleScheme(); + private static class getPermissionForUserAndLecture_resultTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndLecture_resultTupleScheme getScheme() { + return new getPermissionForUserAndLecture_resultTupleScheme(); } } - private static class getPermissionForUserAndImage_resultTupleScheme extends TupleScheme<getPermissionForUserAndImage_result> { + private static class getPermissionForUserAndLecture_resultTupleScheme extends TupleScheme<getPermissionForUserAndLecture_result> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndLecture_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -37722,28 +40145,28 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter114 : struct.success) + for (Person _iter130 : struct.success) { - _iter114.write(oprot); + _iter130.write(oprot); } } } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getPermissionForUserAndLecture_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list115 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list115.size); - for (int _i116 = 0; _i116 < _list115.size; ++_i116) + org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list131.size); + for (int _i132 = 0; _i132 < _list131.size; ++_i132) { - Person _elem117; - _elem117 = new Person(); - _elem117.read(iprot); - struct.success.add(_elem117); + Person _elem133; + _elem133 = new Person(); + _elem133.read(iprot); + struct.success.add(_elem133); } } struct.setSuccessIsSet(true); @@ -38453,4 +40876,704 @@ public class Server { } + public static class deleteAllAdditionalLecturePermissions_args implements org.apache.thrift.TBase<deleteAllAdditionalLecturePermissions_args, deleteAllAdditionalLecturePermissions_args._Fields>, java.io.Serializable, Cloneable, Comparable<deleteAllAdditionalLecturePermissions_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteAllAdditionalLecturePermissions_args"); + + private static final org.apache.thrift.protocol.TField LECTURE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("lectureID", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField USER_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("userID", org.apache.thrift.protocol.TType.STRING, (short)2); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new deleteAllAdditionalLecturePermissions_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new deleteAllAdditionalLecturePermissions_argsTupleSchemeFactory()); + } + + public String lectureID; // required + public String userID; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { + LECTURE_ID((short)1, "lectureID"), + USER_ID((short)2, "userID"); + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + case 1: // LECTURE_ID + return LECTURE_ID; + case 2: // USER_ID + return USER_ID; + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + + // isset id assignments + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + tmpMap.put(_Fields.LECTURE_ID, new org.apache.thrift.meta_data.FieldMetaData("lectureID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + tmpMap.put(_Fields.USER_ID, new org.apache.thrift.meta_data.FieldMetaData("userID", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteAllAdditionalLecturePermissions_args.class, metaDataMap); + } + + public deleteAllAdditionalLecturePermissions_args() { + } + + public deleteAllAdditionalLecturePermissions_args( + String lectureID, + String userID) + { + this(); + this.lectureID = lectureID; + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public deleteAllAdditionalLecturePermissions_args(deleteAllAdditionalLecturePermissions_args other) { + if (other.isSetLectureID()) { + this.lectureID = other.lectureID; + } + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public deleteAllAdditionalLecturePermissions_args deepCopy() { + return new deleteAllAdditionalLecturePermissions_args(this); + } + + @Override + public void clear() { + this.lectureID = null; + this.userID = null; + } + + public String getLectureID() { + return this.lectureID; + } + + public deleteAllAdditionalLecturePermissions_args setLectureID(String lectureID) { + this.lectureID = lectureID; + return this; + } + + public void unsetLectureID() { + this.lectureID = null; + } + + /** Returns true if field lectureID is set (has been assigned a value) and false otherwise */ + public boolean isSetLectureID() { + return this.lectureID != null; + } + + public void setLectureIDIsSet(boolean value) { + if (!value) { + this.lectureID = null; + } + } + + public String getUserID() { + return this.userID; + } + + public deleteAllAdditionalLecturePermissions_args setUserID(String userID) { + this.userID = userID; + return this; + } + + public void unsetUserID() { + this.userID = null; + } + + /** Returns true if field userID is set (has been assigned a value) and false otherwise */ + public boolean isSetUserID() { + return this.userID != null; + } + + public void setUserIDIsSet(boolean value) { + if (!value) { + this.userID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case LECTURE_ID: + if (value == null) { + unsetLectureID(); + } else { + setLectureID((String)value); + } + break; + + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case LECTURE_ID: + return getLectureID(); + + case USER_ID: + return getUserID(); + + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + case LECTURE_ID: + return isSetLectureID(); + case USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof deleteAllAdditionalLecturePermissions_args) + return this.equals((deleteAllAdditionalLecturePermissions_args)that); + return false; + } + + public boolean equals(deleteAllAdditionalLecturePermissions_args that) { + if (that == null) + return false; + + boolean this_present_lectureID = true && this.isSetLectureID(); + boolean that_present_lectureID = true && that.isSetLectureID(); + if (this_present_lectureID || that_present_lectureID) { + if (!(this_present_lectureID && that_present_lectureID)) + return false; + if (!this.lectureID.equals(that.lectureID)) + return false; + } + + boolean this_present_userID = true && this.isSetUserID(); + boolean that_present_userID = true && that.isSetUserID(); + if (this_present_userID || that_present_userID) { + if (!(this_present_userID && that_present_userID)) + return false; + if (!this.userID.equals(that.userID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(deleteAllAdditionalLecturePermissions_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetLectureID()).compareTo(other.isSetLectureID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLectureID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lectureID, other.lectureID); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetUserID()).compareTo(other.isSetUserID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetUserID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.userID, other.userID); + if (lastComparison != 0) { + return lastComparison; + } + } + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("deleteAllAdditionalLecturePermissions_args("); + boolean first = true; + + sb.append("lectureID:"); + if (this.lectureID == null) { + sb.append("null"); + } else { + sb.append(this.lectureID); + } + first = false; + if (!first) sb.append(", "); + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class deleteAllAdditionalLecturePermissions_argsStandardSchemeFactory implements SchemeFactory { + public deleteAllAdditionalLecturePermissions_argsStandardScheme getScheme() { + return new deleteAllAdditionalLecturePermissions_argsStandardScheme(); + } + } + + private static class deleteAllAdditionalLecturePermissions_argsStandardScheme extends StandardScheme<deleteAllAdditionalLecturePermissions_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, deleteAllAdditionalLecturePermissions_args struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // LECTURE_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.lectureID = iprot.readString(); + struct.setLectureIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 2: // USER_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, deleteAllAdditionalLecturePermissions_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.lectureID != null) { + oprot.writeFieldBegin(LECTURE_ID_FIELD_DESC); + oprot.writeString(struct.lectureID); + oprot.writeFieldEnd(); + } + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class deleteAllAdditionalLecturePermissions_argsTupleSchemeFactory implements SchemeFactory { + public deleteAllAdditionalLecturePermissions_argsTupleScheme getScheme() { + return new deleteAllAdditionalLecturePermissions_argsTupleScheme(); + } + } + + private static class deleteAllAdditionalLecturePermissions_argsTupleScheme extends TupleScheme<deleteAllAdditionalLecturePermissions_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, deleteAllAdditionalLecturePermissions_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetLectureID()) { + optionals.set(0); + } + if (struct.isSetUserID()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetLectureID()) { + oprot.writeString(struct.lectureID); + } + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, deleteAllAdditionalLecturePermissions_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.lectureID = iprot.readString(); + struct.setLectureIDIsSet(true); + } + if (incoming.get(1)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class deleteAllAdditionalLecturePermissions_result implements org.apache.thrift.TBase<deleteAllAdditionalLecturePermissions_result, deleteAllAdditionalLecturePermissions_result._Fields>, java.io.Serializable, Cloneable, Comparable<deleteAllAdditionalLecturePermissions_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("deleteAllAdditionalLecturePermissions_result"); + + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new deleteAllAdditionalLecturePermissions_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new deleteAllAdditionalLecturePermissions_resultTupleSchemeFactory()); + } + + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +; + + private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); + + static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { + byName.put(field.getFieldName(), field); + } + } + + /** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ + public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { + default: + return null; + } + } + + /** + * Find the _Fields constant that matches fieldId, throwing an exception + * if it is not found. + */ + public static _Fields findByThriftIdOrThrow(int fieldId) { + _Fields fields = findByThriftId(fieldId); + if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!"); + return fields; + } + + /** + * Find the _Fields constant that matches name, or null if its not found. + */ + public static _Fields findByName(String name) { + return byName.get(name); + } + + private final short _thriftId; + private final String _fieldName; + + _Fields(short thriftId, String fieldName) { + _thriftId = thriftId; + _fieldName = fieldName; + } + + public short getThriftFieldId() { + return _thriftId; + } + + public String getFieldName() { + return _fieldName; + } + } + public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap; + static { + Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(deleteAllAdditionalLecturePermissions_result.class, metaDataMap); + } + + public deleteAllAdditionalLecturePermissions_result() { + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public deleteAllAdditionalLecturePermissions_result(deleteAllAdditionalLecturePermissions_result other) { + } + + public deleteAllAdditionalLecturePermissions_result deepCopy() { + return new deleteAllAdditionalLecturePermissions_result(this); + } + + @Override + public void clear() { + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + } + throw new IllegalStateException(); + } + + /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */ + public boolean isSet(_Fields field) { + if (field == null) { + throw new IllegalArgumentException(); + } + + switch (field) { + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof deleteAllAdditionalLecturePermissions_result) + return this.equals((deleteAllAdditionalLecturePermissions_result)that); + return false; + } + + public boolean equals(deleteAllAdditionalLecturePermissions_result that) { + if (that == null) + return false; + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(deleteAllAdditionalLecturePermissions_result other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + return 0; + } + + public _Fields fieldForId(int fieldId) { + return _Fields.findByThriftId(fieldId); + } + + public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException { + schemes.get(iprot.getScheme()).getScheme().read(iprot, this); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException { + schemes.get(oprot.getScheme()).getScheme().write(oprot, this); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder("deleteAllAdditionalLecturePermissions_result("); + boolean first = true; + + sb.append(")"); + return sb.toString(); + } + + public void validate() throws org.apache.thrift.TException { + // check for required fields + // check for sub-struct validity + } + + private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException { + try { + write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException { + try { + read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in))); + } catch (org.apache.thrift.TException te) { + throw new java.io.IOException(te); + } + } + + private static class deleteAllAdditionalLecturePermissions_resultStandardSchemeFactory implements SchemeFactory { + public deleteAllAdditionalLecturePermissions_resultStandardScheme getScheme() { + return new deleteAllAdditionalLecturePermissions_resultStandardScheme(); + } + } + + private static class deleteAllAdditionalLecturePermissions_resultStandardScheme extends StandardScheme<deleteAllAdditionalLecturePermissions_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, deleteAllAdditionalLecturePermissions_result struct) throws org.apache.thrift.TException { + org.apache.thrift.protocol.TField schemeField; + iprot.readStructBegin(); + while (true) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + default: + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + iprot.readFieldEnd(); + } + iprot.readStructEnd(); + + // check for required fields of primitive type, which can't be checked in the validate method + struct.validate(); + } + + public void write(org.apache.thrift.protocol.TProtocol oprot, deleteAllAdditionalLecturePermissions_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class deleteAllAdditionalLecturePermissions_resultTupleSchemeFactory implements SchemeFactory { + public deleteAllAdditionalLecturePermissions_resultTupleScheme getScheme() { + return new deleteAllAdditionalLecturePermissions_resultTupleScheme(); + } + } + + private static class deleteAllAdditionalLecturePermissions_resultTupleScheme extends TupleScheme<deleteAllAdditionalLecturePermissions_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, deleteAllAdditionalLecturePermissions_result struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, deleteAllAdditionalLecturePermissions_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + } + } + + } + } diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 20dad27e..c95d874c 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -458,10 +458,10 @@ public class SQL { Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet res = stm
- .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ .executeQuery("SELECT DISTINCT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
+ "WHERE i.GUID_imageID=l.imageID AND pml.rec_read=true AND u.userID=pml.userID AND u.userID='"
- + userID + ";");
+ + userID + "';");
while (res.next()) {
list.add(new Lecture(res.getString("lectureID"), res
@@ -488,10 +488,11 @@ public class SQL { Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet res = stm
- .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ .executeQuery("SELECT DISTINCT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
- + "WHERE i.GUID_imageID=l.imageID AND pml.rec_write=true AND u.userID=pml.userID AND u.userID='"
- + userID + ";");
+ + "WHERE pml.userID='"
+ + userID
+ + "' AND u.userID=pml.userID AND pml.rec_write=1 AND i.GUID_imageID=l.imageID AND l.lectureID=pml.lectureID;");
while (res.next()) {
list.add(new Lecture(res.getString("lectureID"), res
@@ -518,10 +519,10 @@ public class SQL { Connection con = getConnection();
Statement stm = con.createStatement();
ResultSet res = stm
- .executeQuery("SELECT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ .executeQuery("SELECT DISTINCT l.lectureID, l.name, l.isActive, l.startTime, l.endTime, l.lastUsed, l.description, i.image_name, concat(u.Nachname,' ',u.Vorname) as user "
+ "FROM bwLehrpool.m_VLData_lecture l, bwLehrpool.m_VLData_imageInfo i, bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u "
+ "WHERE i.GUID_imageID=l.imageID AND pml.rec_admin=true AND u.userID=pml.userID AND u.userID='"
- + userID + ";");
+ + userID + "';");
while (res.next()) {
list.add(new Lecture(res.getString("lectureID"), res
@@ -1188,7 +1189,7 @@ public class SQL { // get all users from satellite -- temp, tb replaced by allUsers bwLehrpool
// does -NOT- return the user himself
- public List<Person> getAllOtherSatelliteUsers(String userID) {
+ public List<Person> getAllOtherSatelliteUsers(List<String> userID) {
Connection con = getConnection();
Statement stm = null;
ResultSet res = null;
@@ -1202,9 +1203,18 @@ public class SQL { e.printStackTrace();
}
try {
- res = stm
- .executeQuery("SELECT userID, Nachname, Vorname FROM m_user WHERE userID !='"
- + userID + "' ORDER BY Nachname ASC;");
+ String query = "SELECT userID, Nachname, Vorname, mail FROM m_user WHERE userID NOT IN ('"
+ + userID.get(0) + "";
+
+ for (int i = 1; i < userID.size(); i++) {
+ query = query + "','" + userID.get(i);
+ }
+ query = query + "') ORDER BY Nachname ASC;";
+
+ // res =
+ // stm.executeQuery("SELECT userID, Nachname, Vorname, mail FROM m_user WHERE userID !='"+
+ // userID + "' ORDER BY Nachname ASC;");
+ res = stm.executeQuery(query);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
@@ -1214,8 +1224,9 @@ public class SQL { // fill the list with users - permissions are all false because
// the image is new
list.add(new Person(res.getString("userID"), res
- .getString("Nachname"), res.getString("Vorname"),
- false, false, false, false, false, false, false));
+ .getString("Nachname"), res.getString("Vorname"), res
+ .getString("mail"), false, false, false, false, false,
+ false, false));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
@@ -1224,14 +1235,15 @@ public class SQL { return list;
}// end getAllOtherSatelliteUsers()
+
// get the permissions of an image for all other registered users -EXCEPT-
// the logged on user
public List<Person> getPermissionForUserAndImage(String userID,
String imageID) {
+
Connection con = getConnection();
Statement stm = null;
ResultSet res = null;
-
List<Person> list = new ArrayList<Person>();
try {
@@ -1242,13 +1254,13 @@ public class SQL { }
try {
res = stm
- .executeQuery("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ .executeQuery("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, u.mail, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ userID
+ "' AND pmi.GUID_imageID='"
+ imageID
+ "' AND pmi.userID=u.userID ORDER BY u.Nachname ASC;");
System.out
- .println("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ .println("SELECT DISTINCT pmi.GUID_imageID, pmi.userID, u.userID, u.Nachname, u.Vorname, u.mail, pmi.image_read, pmi.image_write, pmi.image_admin, pmi.link_allowed FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_user u WHERE pmi.userID!='"
+ userID
+ "' AND pmi.GUID_imageID='"
+ imageID
@@ -1286,10 +1298,9 @@ public class SQL { // fill the list with users - permissions are all false because
// the image is new
list.add(new Person(res.getString("userID"), res
- .getString("Nachname"), res.getString("Vorname"),
- // Boolean.parseBoolean(Integer.parseInt(res.getString("image_read"))),
- image_read, image_write, link_allowed, image_admin,
- false, // lecture_read
+ .getString("Nachname"), res.getString("Vorname"), res
+ .getString("mail"), image_read, image_write,
+ link_allowed, image_admin, false, // lecture_read
false, // lecture_write
false) // lecture_admin
);
@@ -1301,6 +1312,89 @@ public class SQL { }
return list;
}// end getPermissionFOrUserAndImage()
+
+
+
+ // get the permissions of a lecture for all other registered users -EXCEPT- the logged on user
+ public List<Person> getPermissionForUserAndLecture(String userID,
+ String lectureID) {
+
+ Connection con = getConnection();
+ Statement stm = null;
+ ResultSet res = null;
+ List<Person> list = new ArrayList<Person>();
+
+
+ try {
+ stm = con.createStatement();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ res = stm
+ .executeQuery("SELECT DISTINCT pml.lectureID, pml.userID, u.userID, u.Nachname, u.Vorname, u.mail, pml.rec_read, pml.rec_write, pml.rec_admin " +
+ "FROM bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u WHERE pml.userID!='"+userID+"' AND pml.lectureID='"+lectureID+"' AND pml.userID=u.userID ORDER BY u.Nachname ASC;");
+ System.out
+ .println("SELECT DISTINCT pml.lectureID, pml.userID, u.userID, u.Nachname, u.Vorname, u.mail, pml.rec_read, pml.rec_write, pml.rec_admin " +
+ "FROM bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u WHERE pml.userID!='"+userID+"' AND pml.lectureID='"+lectureID+"' AND pml.userID=u.userID ORDER BY u.Nachname ASC;");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ boolean image_read, image_write, link_allowed, image_admin, lecture_read, lecture_write, lecture_admin;
+
+ while (res.next()) {
+ // reset old values and set the correct new values
+ image_read = false;
+ image_write = false;
+ link_allowed = false;
+ image_admin = false;
+ lecture_read = false;
+ lecture_write = false;
+ lecture_admin = false;
+
+ if (Integer.parseInt(res.getString("rec_read")) != 0) {
+ lecture_read = true;
+ }
+ if (Integer.parseInt(res.getString("rec_write")) != 0) {
+ lecture_write = true;
+ }
+ if (Integer.parseInt(res.getString("rec_admin")) != 0) {
+ lecture_admin = true;
+ }
+
+ // fill the list with users - permissions are all false because
+ // the image is new
+ list.add(new Person(
+ res.getString("userID"),
+ res.getString("Nachname"),
+ res.getString("Vorname"),
+ res.getString("mail"),
+ false, //image read
+ false, //image write
+ false, //image link
+ false, //image admin
+ lecture_read, // lecture_read
+ lecture_write, // lecture_write
+ lecture_admin) // lecture_admin
+ );
+ // System.out.println(res.getString("Nachname")+" "+Boolean.parseBoolean(res.getString("image_read"))+" "+Boolean.parseBoolean(res.getString("image_write"))+" "+Boolean.parseBoolean(res.getString("image_admin")));
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }// end getPermissionForUserAndLecture
+
+
+
+
+
+
+
public boolean updateImagePermissions() {
boolean success = true;
@@ -1336,11 +1430,11 @@ public class SQL { public int setImageRights(String pk_person, String pk_image, int role,
int read, int write, int linkallowed, int admin) {
-
+
try {
Connection con = getConnection();
Statement stm = con.createStatement();
-
+
String uid = UUID.randomUUID().toString();
stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_image`(`GUID`,`GUID_imageID`,`roleID`,`userID`,`image_read`,`image_write`,`image_admin`,`link_allowed`)VALUES('"
+ uid
@@ -1406,45 +1500,36 @@ public class SQL { return success;
}// end writeAdditionalImageRights
-
public int setLectureRights(String pk_person, String pk_lecture, int role,
- int read, int write, int changePermission, int admin) {
-
+ int read, int write, int admin) {
+
try {
Connection con = getConnection();
Statement stm = con.createStatement();
-
+
String uid = UUID.randomUUID().toString();
- stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_lecture`(`GUID`,`lectureID`,`roleID`,`userID`,`rec_read`,`rec_write`,`rec_admin`,`rec_changePermission`)VALUES('"
+
+ stm.executeUpdate("INSERT INTO `bwLehrpool`.`pm_VLData_lecture`(`GUID`,`lectureID`,`userID`,`rec_read`,`rec_write`,`rec_admin`)VALUES('"
+ uid
+ "','"
+ pk_lecture
+ "','"
- + role
- + "','"
+ pk_person
+ "','"
- + read
- + "','"
- + write
- + "','"
- + admin
- + "','" + changePermission + "');");
+ + read + "','" + write + "','" + admin + "');");
con.commit();
+ log.info("Written lecture rights for " + pk_lecture);
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
- log.info(new Date() + " - Failed to setLectureRights.");
+ log.info(new Date() + "Failed to setLectureRights.");
e.printStackTrace();
}
return 0;
} // end setLectureRights
-
-
-
- public boolean writeAdditionalLectureRights(String imageID, String userID,
- boolean isRead, boolean isWrite, boolean isLinkAllowed,
- boolean isAdmin) {
+
+ public boolean writeAdditionalLectureRights(String lectureID,
+ String userID, boolean isRead, boolean isWrite, boolean isAdmin) {
boolean success = true;
String uid = UUID.randomUUID().toString();
@@ -1454,33 +1539,23 @@ public class SQL { try {
stm = con.createStatement();
- log.info(new Date() + " - INSERT INTO pm_VLData_image (" + "GUID, "
- + "GUID_imageID, " + "roleID, " + "userID, "
- + "image_read, " + "image_write, " + "Image_admin, "
- + "link_allowed)" + "VALUES(" + "'" + uid + "'," + "'"
- + imageID + "'," + "1," + "'" + userID + "'," + isRead
- + "," + isWrite + "," + isLinkAllowed + "," + isAdmin + ""
- + ")");
-
- stm.executeUpdate("INSERT INTO pm_VLData_image (" + "GUID, "
- + "GUID_imageID, " + "roleID, " + "userID, "
- + "image_read, " + "image_write, " + "Image_admin, "
- + "link_allowed)" + "VALUES(" + "'" + uid + "'," + "'"
- + imageID + "'," + "1," + "'" + userID + "'," + isRead
- + "," + isWrite + "," + isLinkAllowed + "," + isAdmin + ""
- + ");");
+ stm.executeUpdate("INSERT INTO pm_VLData_lecture (" + "GUID, "
+ + "lectureID, " + "userID, " + "rec_read, " + "rec_write, "
+ + "rec_admin )" + "VALUES('" + uid + "'," + "'" + lectureID
+ + "'," + "'" + userID + "'," + isRead + "," + isWrite + ","
+ + isAdmin + ");");
con.commit();
con.close();
- log.info(new Date() + " - Written additional lecture rights.");
+ log.info(new Date() + " - Written additional lecture rights for '"
+ + userID + "'.");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
- log.info(new Date() + " - Failed to write additional lecture rights.");
+ log.info(new Date()
+ + " - Failed to write additional lecture rights.");
}
return success;
}// end writeAdditionalLectureRights
-
-
public void deleteAllAdditionalImagePermissions(String imageID,
String userID) {
@@ -1512,6 +1587,38 @@ public class SQL { // TODO Auto-generated catch block
e.printStackTrace();
}
- }
+ }// end deleteAllAdditionalImagePermissions
+
+
+
+ public void deleteAllAdditionalLecturePermissions(String lectureID, String userID) {
+ Connection con = getConnection();
+ Statement stm = null;
+
+ try {
+
+ stm = con.createStatement();
+ int ret = stm
+ .executeUpdate("DELETE FROM pm_VLData_lecture WHERE lectureID = '"
+ + lectureID + "' AND userID != '" + userID + "';");
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ try {
+
+ stm = con.createStatement();
+ int ret = stm
+ .executeUpdate("DELETE FROM pm_VLData_lecture WHERE lectureID = '"
+ + lectureID + "' AND userID != '" + userID + "';");
+
+ con.commit();
+
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }// end deleteAllAdditionalImagePermissions
+
}// end class
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift index 0f060808..d636d1ad 100644 --- a/dozentenmodulserver/thrift/server.thrift +++ b/dozentenmodulserver/thrift/server.thrift @@ -37,13 +37,14 @@ struct Person{ 1: string userID, 2: string Nachname, 3: string Vorname, - 4: bool image_read - 5: bool image_write - 6: bool image_admin - 7: bool image_link - 8: bool lecture_read - 9: bool lecture_write - 10: bool lecture_admin + 4: string mail, + 5: bool image_read + 6: bool image_write + 7: bool image_admin + 8: bool image_link + 9: bool lecture_read + 10: bool lecture_write + 11: bool lecture_admin } service Server{ User getFtpUser(), @@ -75,9 +76,12 @@ service Server{ bool checkUser(1: string username), bool createUser(1: string loginName, 2: string lastName, 3: string firstName, 4: string mail, 5: string university), bool writeImageRights(1: string imagename, 2: string username, 3: string lastName, 4: string firstName, 5: string mail, 6: string university, 7: string role), - bool writeLectureRights(1: string lecturename, 2: string username, 3: string lastName, 4: string firstName, 5: string mail, 6: string university, 7: string role), - list<Person>getAllOtherSatelliteUsers(1: string userID), bool writeAdditionalImageRights(1: string imageName, 2: string userID, 3: bool isRead, 4: bool isWrite, 5: bool isLinkAllowed, 6: bool isAdmin), + bool writeLectureRights(1: string lecturename, 2: string username, 3: string lastName, 4: string firstName, 5: string mail, 6: string university, 7: string role), + bool writeAdditionalLectureRights(1: string lectureName, 2: string userID, 3: bool isRead, 4: bool isWrite, 5: bool isAdmin), + list<Person>getAllOtherSatelliteUsers(1: list<string> userID), list<Person>getPermissionForUserAndImage(1: string userID, 2: string imageID), + list<Person>getPermissionForUserAndLecture(1: string userID, 2: string lectureID), void deleteAllAdditionalImagePermissions(1: string imageID, 2:string userID), + void deleteAllAdditionalLecturePermissions(1: string lectureID, 2: string userID) } |
