diff options
| author | Nino Breuer | 2014-10-15 14:10:11 +0200 |
|---|---|---|
| committer | Nino Breuer | 2014-10-15 14:10:11 +0200 |
| commit | 788c8fbeac35999a0d7308439a00cbbb97c91ac6 (patch) | |
| tree | 8fe0cd0d938043dec601e13b20303696978c07e1 | |
| parent | added functionality: klick on table header also handles all sub-rights (diff) | |
| parent | [client] Login_GUI: oops, reactivate the Login by pressing Enter on either th... (diff) | |
| download | tutor-module-788c8fbeac35999a0d7308439a00cbbb97c91ac6.tar.gz tutor-module-788c8fbeac35999a0d7308439a00cbbb97c91ac6.tar.xz tutor-module-788c8fbeac35999a0d7308439a00cbbb97c91ac6.zip | |
Merge branch 'master' of ssh://git.openslx.org/openslx-ng/tutor-module
Conflicts:
dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java
g
17 files changed, 4877 insertions, 725 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java b/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java index 595a97d0..54dda92b 100644 --- a/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/DeleteImage_GUI.java @@ -906,7 +906,7 @@ public class DeleteImage_GUI extends JFrame { List<server.generated.Image> images; try { // Hole eine Liste der Images - images = client.getImageList(); + images = client.getImageListPermissionWrite(person.verantwortlicher.getUserID()); Iterator<server.generated.Image> i = images.iterator(); diff --git a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java index 9d65d42e..4e5ce376 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPCreateUploader_GUI.java @@ -115,7 +115,7 @@ public class FTPCreateUploader_GUI extends JFrame implements /** * Create the frame. */ - public FTPCreateUploader_GUI(final Component formerGUI) { + public FTPCreateUploader_GUI(Component formerGUI) { final Object[] options = { "Beenden", "Abbrechen" }; @@ -466,13 +466,12 @@ public class FTPCreateUploader_GUI extends JFrame implements "Abbrechen und zurück", JOptionPane.YES_NO_OPTION); if (selectedOption == JOptionPane.YES_OPTION) { - System.out.println("CreateUploader X:"+formerGUI.getLocation().getX()); - System.out.println("CreateUploader X:"+formerGUI.getLocation().getY()); - dispose(); - PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(formerGUI); - m.setLocationRelativeTo(formerGUI); - + //System.out.println("CreateUploader X:"+formerGUI.getLocation().getX()); + //System.out.println("CreateUploader X:"+formerGUI.getLocation().getY()); + PermissionCreateImage_GUI m = new PermissionCreateImage_GUI(c); + //m.setLocationRelativeTo(formerGUI); m.setVisible(true); + dispose(); } else { // for actions if "no" is selected. tbd. @@ -685,15 +684,15 @@ public class FTPCreateUploader_GUI extends JFrame implements person.verantwortlicher.getRole() ); - for(int i=0; i< RightsManagement.rightsManagement.getPmImageCreateList().size(); i++){ - System.out.println("Writing additional rights for user "+RightsManagement.rightsManagement.getPmImageCreateList().get(i).getUserID()+", User "+i+"/"+RightsManagement.rightsManagement.getPmImageCreateList().size()); + 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.writeAdditionalImageRights( Image.image.getImagename(), - RightsManagement.rightsManagement.getPmImageCreateList().get(i).getUserID(), - RightsManagement.rightsManagement.getPmImageCreateList().get(i).isRead(), - RightsManagement.rightsManagement.getPmImageCreateList().get(i).isWrite(), - RightsManagement.rightsManagement.getPmImageCreateList().get(i).isLinkAllowed(), - RightsManagement.rightsManagement.getPmImageCreateList().get(i).isAdmin() + RightsManagement.rightsManagement.getPermittedUserList().get(i).getUserID(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isRead(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isWrite(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isLinkAllowed(), + RightsManagement.rightsManagement.getPermittedUserList().get(i).isAdmin() ); }//end for diff --git a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java index a51912c4..cc96bc5a 100644 --- a/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/PermissionCreateImage_GUI.java @@ -67,14 +67,15 @@ import util.OpenLinks; @SuppressWarnings("serial") public class PermissionCreateImage_GUI extends JFrame { - private final static Logger LOGGER = Logger.getLogger(PermissionCreateImage_GUI.class); + 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 = null; private Class[] classes; Object[] titles = { "Name", "Read", "Write", "Link", "Admin", "userID" }; - private List<Person> map = null; + private List<Person> map = null; // List of people who have rights Component c = null; // Map<String,String> ogUsers = new HashMap(); @@ -107,13 +108,13 @@ public class PermissionCreateImage_GUI extends JFrame { private JLabel lblWriteDesc; private JLabel lblAdminDesc; private JLabel lblLinkallowedDesc; - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "Legen Sie fest, welche Personen welche Rechte an Ihrem Image haben.<br />" + - "Sie können die Rechte read, write, link und admin vergeben.<br />" + - "Link bedeutet, dass diese Person Veranstaltungen auf Ihr Image verlinken darf und dieses somit<br />" + - "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 static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "Legen Sie fest, welche Personen welche Rechte an Ihrem Image haben.<br />" + + "Sie können die Rechte read, write, link und admin vergeben.<br />" + + "Link bedeutet, dass diese Person Veranstaltungen auf Ihr Image verlinken darf und dieses somit<br />" + + "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>"; public PermissionCreateImage_GUI(Component formerGUI) { addWindowListener(new WindowAdapter() { @@ -135,8 +136,6 @@ public class PermissionCreateImage_GUI extends JFrame { setBounds(0, 0, 603, 722); setLocationRelativeTo(formerGUI); - - getContentPane().setLayout(null); { @@ -182,35 +181,28 @@ public class PermissionCreateImage_GUI extends JFrame { panel_1.add(scrollPane); table = new JTable(); - table.addMouseListener(new MouseAdapter() - { + table.addMouseListener(new MouseAdapter() { @Override - public void mouseClicked(MouseEvent e) - { + public void mouseClicked(MouseEvent e) { checkIntegrity(-1); } }); - + table.setModel(model); table.setSelectionForeground(Color.WHITE); - // invisible attribute userID for identifying selected user 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 (RightsManagement.rightsManagement.getPmImageCreateList().size() <= 0) { + 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()); + map = client.getAllOtherSatelliteUsers(person.verantwortlicher + .getUserID()); Iterator<server.generated.Person> i = map.iterator(); int x = 0; @@ -231,7 +223,6 @@ public class PermissionCreateImage_GUI extends JFrame { x++; } - //System.out.println("Number of returned users in permission list: "+ map.size()); } catch (TException e1) { // TODO Auto-generated catch block @@ -239,18 +230,19 @@ public class PermissionCreateImage_GUI extends JFrame { } } else // read from model { + System.out.println("reading from model"); System.out - .println("RightsManagement.rightsManagement.getPmImageCreateList().size() " + .println("RightsManagement.rightsManagement.getPermittedUserList().size() = " + RightsManagement.rightsManagement - .getPmImageCreateList().size()); - System.out.println("reading from model"); + .getPermittedUserList().size()); + List<person> listt = RightsManagement.rightsManagement - .getPmImageCreateList(); + .getPermittedUserList(); Iterator<person> i = listt.iterator(); int x = 0; while (i.hasNext()) { - //System.out.println("current pos=" + x); + // System.out.println("current pos=" + x); // erzeuge Objekte fuer die Tabelle person temp = i.next(); @@ -268,9 +260,8 @@ public class PermissionCreateImage_GUI extends JFrame { // Fuege diese Objekte der Tabelle hinzu model.addRow(obj); x++; - } - } + }// end set list of permitted users TableCellRenderer rend = table.getTableHeader().getDefaultRenderer(); @@ -279,8 +270,7 @@ public class PermissionCreateImage_GUI extends JFrame { tc1.setCellRenderer(table.getDefaultRenderer(Boolean.class)); tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(), (String) titles[1])); - //tc1.setCellRenderer(cellRenderer) - + // tc1.setCellRenderer(cellRenderer) TableColumn tc2 = table.getColumnModel().getColumn(2); tc2.setCellEditor(table.getDefaultEditor(Boolean.class)); @@ -300,7 +290,6 @@ public class PermissionCreateImage_GUI extends JFrame { tc4.setHeaderRenderer(new CheckBoxHeader(new MyItemListener4(), (String) titles[4])); - scrollPane.setViewportView(table); JPanel panel = new JPanel(); @@ -429,8 +418,8 @@ public class PermissionCreateImage_GUI extends JFrame { cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - CreateImageTechnisch_GUI ci = new CreateImageTechnisch_GUI(c); + CreateImageTechnisch_GUI ci = new CreateImageTechnisch_GUI( + c); ci.setVisible(true); dispose(); } @@ -443,11 +432,12 @@ public class PermissionCreateImage_GUI extends JFrame { JButton continueButton = new JButton("Weiter"); continueButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - //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 + + // 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"); } @@ -531,62 +521,49 @@ public class PermissionCreateImage_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; - //System.out.println("formergui unten X:"+formerGUI.getLocation().getX()); - //System.out.println("formergui unten Y:"+formerGUI.getLocation().getY()); - - //System.out.println("this unten X: "+this.getLocation().getX()); - //System.out.println("this unten Y: "+this.getLocation().getY()); - - + this.setLocationRelativeTo(formerGUI); - - //this.setLocation(1238, 53); - this.setVisible(true); - - //System.out.println("this on screen unten X: "+this.getLocationOnScreen().getX()); - //System.out.println("this on screen unten Y: "+this.getLocationOnScreen().getY()); - } - - private void checkIntegrity(int row) - { - + }// end constructor + + private void checkIntegrity(int row) { + int selectedRow; - - if(row == -1) - { + + if (row == -1) { selectedRow = table.getSelectedRow(); - } - else - { + } else { selectedRow = row; } - + boolean isRead, isWrite, isLink, isAdmin; - - //collect all row data - isRead = (boolean) table.getValueAt(selectedRow, 1); + + // collect all row data + isRead = (boolean) table.getValueAt(selectedRow, 1); isWrite = (boolean) table.getValueAt(selectedRow, 2); - isLink = (boolean) table.getValueAt(selectedRow, 3); + isLink = (boolean) table.getValueAt(selectedRow, 3); isAdmin = (boolean) table.getValueAt(selectedRow, 4); - - boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite, isLink, isAdmin); - + + boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite, + isLink, isAdmin); + table.setValueAt(checkedVals[0], selectedRow, 1); table.setValueAt(checkedVals[1], selectedRow, 2); table.setValueAt(checkedVals[2], selectedRow, 3); table.setValueAt(checkedVals[3], selectedRow, 4); - } + }// end checkIntegrity() // Read column class MyItemListener1 implements ItemListener { @@ -601,7 +578,7 @@ public class PermissionCreateImage_GUI extends JFrame { } } - //Write column + // Write column class MyItemListener2 implements ItemListener { public void itemStateChanged(ItemEvent e) { Object source = e.getSource(); @@ -615,7 +592,7 @@ public class PermissionCreateImage_GUI extends JFrame { } } - //Link column + // Link column class MyItemListener3 implements ItemListener { public void itemStateChanged(ItemEvent e) { Object source = e.getSource(); @@ -629,7 +606,7 @@ public class PermissionCreateImage_GUI extends JFrame { } } - //Admin column + // Admin column class MyItemListener4 implements ItemListener { public void itemStateChanged(ItemEvent e) { Object source = e.getSource(); @@ -644,8 +621,8 @@ public class PermissionCreateImage_GUI extends JFrame { } } } - - //invisible userID column + + // invisible userID column class MyItemListener5 implements ItemListener { public void itemStateChanged(ItemEvent e) { Object source = e.getSource(); @@ -658,10 +635,12 @@ public class PermissionCreateImage_GUI extends JFrame { } } - public void createRightsList() { - // ///// - } + // public void createRightsList() { + // ///// + // } + // 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"); @@ -670,11 +649,12 @@ public class PermissionCreateImage_GUI extends JFrame { int seperatorIndex = 0; // get values from table and save the checkbox values - if(map==null) System.out.println("Fuck: map is null"); - - //for (int i = 0; i < map.size(); i++) { + if (map == null) + System.out.println("Error: map is null"); + + // for (int i = 0; i < map.size(); i++) { for (int i = 0; i < table.getRowCount(); i++) { - //System.out.println("in for, rowcount="+table.getRowCount()); + // System.out.println("in for, rowcount="+table.getRowCount()); person temp = new person(); // table.getModel().setValueAt(map.get, i, 5); @@ -696,33 +676,28 @@ public class PermissionCreateImage_GUI extends JFrame { 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.isAdmin() || temp.isLinkAllowed() || temp.isWrite() || temp.isRead() ){ - //save entry + // check if at least one checkbox is checked. If yes, save this + // entry into list, if not ignore this entry + if (temp.isAdmin() || temp.isLinkAllowed() || temp.isWrite() + || temp.isRead()) { + // save entry list.add(temp); } else { - //do nothing + // do nothing } - - - /* - System.out.println(temp.getName() + ", " + temp.getVorname() + ", " - + temp.getUserID() + ", " + temp.isAdmin() + ", " - + temp.isLinkAllowed() + ", " + temp.isWrite() + ", " - + temp.isRead()); - */ } - - System.out.println("Setting list information.\tTable size: "+table.getRowCount()+"\t List length (=selected users): "+ list.size()); + + System.out.println("Setting list information.\tTable size: " + + table.getRowCount() + "\t List length (=selected users): " + + list.size()); for (int y = 0; y < list.size(); y++) { System.out.println("" + list.get(y).getName()); } - - RightsManagement.rightsManagement.setPmImageCreateList(list); - } + RightsManagement.rightsManagement.setPermittedUserList(list); + }// end saveTableToList() -} +} // end class class CheckBoxHeader extends JCheckBox implements TableCellRenderer, MouseListener { @@ -735,9 +710,6 @@ class CheckBoxHeader extends JCheckBox implements TableCellRenderer, rendererComponent.addItemListener(itemListener); rendererComponent.setText(text); } - - - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { @@ -753,7 +725,6 @@ class CheckBoxHeader extends JCheckBox implements TableCellRenderer, } setColumn(column); - return rendererComponent; } diff --git a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java index de7e4129..a584c0ff 100644 --- a/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/PermissionEditImage_GUI.java @@ -18,6 +18,8 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.net.URI; import java.net.URISyntaxException; +import java.util.Iterator; +import java.util.List; import javax.swing.AbstractButton; import javax.swing.DefaultComboBoxModel; @@ -45,19 +47,27 @@ 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 server.generated.Person; +import server.generated.Server.Client; import util.GuiOrganizer; import util.OpenLinks; @SuppressWarnings("serial") public class PermissionEditImage_GUI extends JFrame { + 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", "Link","Admin"}; + Object[] titles = { "Name", "Read", "Write", "Link", "Admin", "userID" }; + private List<Person> map = null; // List of people who have rights Component c = null; final DefaultTableModel model = new DefaultTableModel(titles, 0) { @@ -84,13 +94,13 @@ public class PermissionEditImage_GUI extends JFrame { private JLabel label_5; private JLabel label_6; private JLabel lblvolleRechteRead; - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "Verändern Sie die Berechtigungen für Ihr Image.<br />" + - "Sie können die Rechte read, write, link und admin vergeben.<br />" + - "Link bedeutet, dass diese Person Veranstaltungen auf Ihr Image verlinken darf und dieses somit<br />" + - "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 static final String HELP_MESSAGE = "<html><div align=\"center\">" + + "Verändern Sie die Berechtigungen für Ihr Image.<br />" + + "Sie können die Rechte read, write, link und admin vergeben.<br />" + + "Link bedeutet, dass diese Person Veranstaltungen auf Ihr Image verlinken darf und dieses somit<br />" + + "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>"; public PermissionEditImage_GUI(Component formerGUI) { addWindowListener(new WindowAdapter() { @@ -159,9 +169,102 @@ public class PermissionEditImage_GUI extends JFrame { 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); + + // invisible attribute userID for identifying selected user + 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 (RightsManagement.rightsManagement.getPermittedUserList().size() <= 0) { + System.out.println("Loading data from db"); + try { + //map = client.getAllOtherSatelliteUsers(person.verantwortlicher.getUserID()); + + + /* + * + * + * + * + * Hier gehts weiter. Problem: wie greifen wir auf die Rechte zu???? + * + * + * + * + * + * */ + + + + + + map = client.getPermissionForUserAndImage(person.verantwortlicher.getUserID(), Image.image.getImageId()); + 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++; + + } + + } 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.isRead(), // Read + temp.isWrite(), // Write + temp.isLinkAllowed(), // Link + temp.isAdmin(), // Admin + temp.getUserID() // userID + }; + System.out.println("Processing: " + temp.getName() + ", " + + temp.getVorname() + ", " + temp.isRead() + ", " + + temp.isWrite() + ", " + temp.isLinkAllowed() + ", " + + temp.isAdmin() + ", " + 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(); @@ -189,27 +292,31 @@ public class PermissionEditImage_GUI extends JFrame { tc4.setHeaderRenderer(new CheckBoxHeader(new MyItemListener4(), (String) titles[4])); /* - TableColumn tc5 = table.getColumnModel().getColumn(5); - tc5.setCellEditor(table.getDefaultEditor(Boolean.class)); - tc5.setCellRenderer(table.getDefaultRenderer(Boolean.class)); - tc5.setHeaderRenderer(new CheckBoxHeader(new MyItemListener5(), - (String) titles[5])); - */ + * TableColumn tc5 = table.getColumnModel().getColumn(5); + * tc5.setCellEditor(table.getDefaultEditor(Boolean.class)); + * tc5.setCellRenderer(table.getDefaultRenderer(Boolean.class)); + * tc5.setHeaderRenderer(new CheckBoxHeader(new MyItemListener5(), + * (String) titles[5])); + */ scrollPane.setViewportView(table); - + JPanel panel_2 = new JPanel(); panel_2.setLayout(null); - panel_2.setBorder(new TitledBorder(null, "Freigabe", TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel_2.setBorder(new TitledBorder(null, "Freigabe", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_2.setBackground(SystemColor.menu); panel_2.setBounds(10, 227, 537, 80); panel_1.add(panel_2); - + JLabel label_7 = new JLabel("Freigabemodus:"); label_7.setBounds(10, 30, 250, 20); panel_2.add(label_7); - + final JComboBox comboBox_1 = new JComboBox(); - comboBox_1.setModel(new DefaultComboBoxModel(new String[] {"Lokal (Eigene Hochschule)", "Öffentlich (Alle Hochschulen)"})); + comboBox_1 + .setModel(new DefaultComboBoxModel(new String[] { + "Lokal (Eigene Hochschule)", + "Öffentlich (Alle Hochschulen)" })); comboBox_1.setSelectedIndex(Image.image.getShareMode()); comboBox_1.setBounds(270, 30, 250, 20); panel_2.add(comboBox_1); @@ -290,20 +397,22 @@ public class PermissionEditImage_GUI extends JFrame { "Image anpassen und überschreiben, jedoch nicht löschen."); lblImageAnpassenUnd.setBounds(120, 38, 380, 20); panel.add(lblImageAnpassenUnd); - + lblLinkAllowed = new JLabel("Link"); lblLinkAllowed.setBounds(20, 58, 90, 20); panel.add(lblLinkAllowed); - + label_5 = new JLabel("Admin"); label_5.setBounds(20, 78, 90, 20); panel.add(label_5); - - label_6 = new JLabel("Erzeugung einer Veranstaltung auf ein Image ist erlaubt."); + + label_6 = new JLabel( + "Erzeugung einer Veranstaltung auf ein Image ist erlaubt."); label_6.setBounds(120, 58, 380, 20); panel.add(label_6); - - lblvolleRechteRead = new JLabel("<HTML>Volle Rechte: read, write, löschen, Link und<br>Berechtigungen für andere Benutzer festlegen.</HTML>"); + + lblvolleRechteRead = new JLabel( + "<HTML>Volle Rechte: read, write, löschen, Link und<br>Berechtigungen für andere Benutzer festlegen.</HTML>"); lblvolleRechteRead.setBounds(120, 78, 380, 40); panel.add(lblvolleRechteRead); { @@ -317,8 +426,10 @@ public class PermissionEditImage_GUI extends JFrame { cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - //EditImageFreigabe_GUI sr = new EditImageFreigabe_GUI(); - EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI(c); + // EditImageFreigabe_GUI sr = new + // EditImageFreigabe_GUI(); + EditImageTechnisch_GUI ei = new EditImageTechnisch_GUI( + c); ei.setVisible(true); dispose(); } @@ -331,7 +442,7 @@ public class PermissionEditImage_GUI extends JFrame { JButton continueButton = new JButton("Weiter"); continueButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - + Image.image.setShareMode(comboBox_1.getSelectedIndex()); FTPEditUploader_GUI ea = new FTPEditUploader_GUI(c); ea.setVisible(true); @@ -410,12 +521,14 @@ public class PermissionEditImage_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); diff --git a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java index f295a1c4..e92b04b0 100644 --- a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java @@ -98,6 +98,7 @@ public class SearchEditImage_GUI extends JFrame { boolean activeSearch = false; private JTextField textFieldName; Component c = null; + int requiredPermission = 1; // 0=Read, 1= Write, 2=LinkAllowed, 3=Admin String[] titles = { "Name", "Lizenzpflichtig", "OS", "Veranstaltung", "Verantwortlicher", "Letztes Update", "ID", "Version", "Template" };// Angezeigt // werden @@ -108,6 +109,7 @@ public class SearchEditImage_GUI extends JFrame { // Verantwortlicher (4), // Letztes // Update (5) + private static final String HELP_MESSAGE = "<html><div align=\"center\">" + "Suchen Sie Images und laden Sie sie direkt herunter.<br />" + "Sie können die Volltextsuche nutzen und nach Betriebssystemen filtern.<br />" + @@ -890,8 +892,10 @@ public class SearchEditImage_GUI extends JFrame { public DefaultTableModel initTableModel(DefaultTableModel model) { List<server.generated.Image> images; try { - // Hole eine Liste der Images - images = client.getImageList(); + // Hole eine Liste der passenden Images + images = client.getImageListPermissionWrite(person.verantwortlicher.getUserID()); + System.out.println("User is: "+person.verantwortlicher.getUserID()); + //images = client.getImageList(person.verantwortlicher.getUserID(), requiredPermission); Iterator<server.generated.Image> i = images.iterator(); SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -937,7 +941,7 @@ public class SearchEditImage_GUI extends JFrame { labelName.setText(res.get("name")); labelOS.setText(res.get("os")); labelUpdate.setText(out.format(in.parse(res.get("lastupdate")))); - labelVerantwortlicher.setText(res.get("owner")); + labelVerantwortlicher.setText(res.get("owner") + " (" + res.get("mail") + ")"); labelWeitereVerantwortliche.setText("Noch nicht Verfügbar"); if (res.get("template").equals("true")) { labelVorlage.setText("Ja"); diff --git a/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java index 97128318..3a5e6ccf 100644 --- a/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/SearchImage_GUI.java @@ -894,7 +894,7 @@ public class SearchImage_GUI extends JFrame { List<server.generated.Image> images;
try {
// Hole eine Liste der Images
- images = client.getImageList();
+ images = client.getImageListPermissionRead(person.verantwortlicher.getUserID());
Iterator<server.generated.Image> i = images.iterator();
SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
diff --git a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java index 3f0b99c5..035710e8 100644 --- a/dozentenmodul/src/main/java/gui/intro/Login_GUI.java +++ b/dozentenmodul/src/main/java/gui/intro/Login_GUI.java @@ -1,5 +1,6 @@ package gui.intro; +import java.awt.CardLayout; import java.awt.Color; import java.awt.Component; import java.awt.Image; @@ -10,6 +11,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.Arrays; +import javax.swing.ButtonGroup; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -38,6 +40,11 @@ import util.GuiOrganizer; import util.ResourceLoader; import config.Config; +import java.awt.Choice; + +import javax.swing.border.TitledBorder; +import javax.swing.JRadioButton; + @SuppressWarnings("serial") public class Login_GUI extends JFrame { @@ -46,6 +53,11 @@ public class Login_GUI extends JFrame { */ private final static Logger LOGGER = Logger.getLogger(Login_GUI.class); + // String constants representing the different login methods + private final static String LOGIN_TYPE_BWIDM = "bwidm"; + private final static String LOGIN_TYPE_BWLEHRPOOL = "bwlp"; + private final static String LOGIN_TYPE_SATLLITE = "sat"; + private JPanel contentPane; private JTextField lblusername; private JPasswordField lblpass; @@ -55,6 +67,27 @@ public class Login_GUI extends JFrame { private static final String HELP_MESSAGE = ""; Component c = null; + private JPanel panel; + private JPanel panel_1; + private JLabel LabelUser; + private JLabel LabelPass; + + // radio button and group for login types. + private ButtonGroup bgLoginType; + private JRadioButton rdbtnBwIDM; + private JRadioButton rdbtnDirekteVerbindung; + private JRadioButton rdbtnMasterserver; + // its action listener + private ActionListener loginTypeActionListener; + + // bwIDM label and dropdown + private Choice choice; + private JLabel lblIdp; + + // Satellite IP label and text field + private JLabel lblSatellitenIp; + private JTextField lblSatIP; + /** * Create the frame. */ @@ -83,7 +116,7 @@ public class Login_GUI extends JFrame { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Größe setzen und mittig ausrichten - setBounds(0, 0, 603, 400); + setBounds(0, 0, 785, 430); GuiOrganizer.centerGUI(this); // Erzeugen eines Panels @@ -98,7 +131,7 @@ public class Login_GUI extends JFrame { // Label fuer das Logo erzeugen JLabel imgLabel = new JLabel(); // Groesse und Position des Logos festelegen - imgLabel.setBounds(150, 11, 350, 142); + imgLabel.setBounds(231, 11, 350, 142); // Pfadangabe des Logos ImageIcon icon = ResourceLoader.getIcon("/img/Logo_bwLehrpool.png", @@ -109,51 +142,8 @@ public class Login_GUI extends JFrame { // Hinzufuegen des Logos in das Fenster contentPane.add(imgLabel); - chckbxBenutzernameSpeichern = new JCheckBox("Benutzername speichern"); - chckbxBenutzernameSpeichern.setBounds(292, 222, 237, 23); - contentPane.add(chckbxBenutzernameSpeichern); - - // Erzeugen und Hinzufuegen des Labels - JLabel LabelUser = new JLabel("bwIDM-Benutzername:"); - LabelUser.setBounds(111, 164, 134, 20); - contentPane.add(LabelUser); - - // Erzeugen und Hinzufuegen des Passwortfeldes - lblpass = new JPasswordField(); - lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein."); - lblpass.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - performLogin(); - } - }); - lblpass.setBounds(292, 195, 237, 20); - contentPane.add(lblpass); - - // Erzeugen und Hinzufuegen des Textfeldes - lblusername = new JTextField(); - lblusername - .setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein."); - - // Lese Information aus der Konfigurationsdatei - lblusername.setText(Config.getUsername()); - chckbxBenutzernameSpeichern.setSelected(Config.getSaveUsername()); - - lblusername.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent arg0) { - performLogin(); - } - }); - lblusername.setBounds(292, 164, 237, 20); - contentPane.add(lblusername); - lblusername.setColumns(10); - - // Erzeugen und Hinzufuegen des Labels - JLabel LabelPass = new JLabel("bwIDM-Passwort:"); - LabelPass.setBounds(111, 195, 134, 20); - contentPane.add(LabelPass); - lblConnectionInfo.setHorizontalAlignment(SwingConstants.LEFT); - lblConnectionInfo.setBounds(111, 290, 418, 20); + lblConnectionInfo.setBounds(10, 359, 449, 20); lblConnectionInfo.setEnabled(true); lblConnectionInfo.setText("Info: Bereit für Login"); @@ -163,30 +153,143 @@ public class Login_GUI extends JFrame { JButton BtnLogin = new JButton("Login"); BtnLogin.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { - - performLogin(); + performLogin(bgLoginType.getSelection().getActionCommand()); }// end actionPerformed }); - BtnLogin.setBounds(292, 252, 237, 23); + BtnLogin.setBounds(488, 358, 239, 23); contentPane.add(BtnLogin); + // Start of the actual content of the right panel + panel = new JPanel(); + panel.setLayout(null); + panel.setBorder(new TitledBorder(null, "Zugangsdaten", + TitledBorder.LEADING, TitledBorder.TOP, null, null)); + panel.setBackground(SystemColor.menu); + panel.setBounds(354, 143, 400, 181); + contentPane.add(panel); + + chckbxBenutzernameSpeichern = new JCheckBox("Benutzername speichern"); + chckbxBenutzernameSpeichern.setBounds(135, 137, 237, 23); + chckbxBenutzernameSpeichern.setSelected(Config.getSaveUsername()); + panel.add(chckbxBenutzernameSpeichern); + + // Erzeugen und Hinzufuegen des Labels + LabelUser = new JLabel("Benutzername:"); + LabelUser.setBounds(25, 60, 82, 20); + panel.add(LabelUser); + + // Erzeugen und Hinzufuegen des Textfeldes + lblusername = new JTextField(); + lblusername.setBounds(135, 60, 237, 20); + lblusername.setToolTipText("Bitte geben Sie Ihren bwIDM-Benutzernamen ein."); + lblusername.setColumns(10); + // Lese Benutzername aus der Konfigurationsdatei + lblusername.setText(Config.getUsername()); + lblusername.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + performLogin(bgLoginType.getSelection().getActionCommand()); + } + }); + panel.add(lblusername); + + // Erzeugen und Hinzufuegen des Labels + LabelPass = new JLabel("Passwort:"); + LabelPass.setBounds(25, 85, 82, 20); + panel.add(LabelPass); + + // Erzeugen und Hinzufuegen des Passwortfeldes + lblpass = new JPasswordField(); + lblpass.setBounds(135, 85, 237, 20); + lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein."); + lblpass.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + performLogin(bgLoginType.getSelection().getActionCommand()); + } + }); + panel.add(lblpass); + + lblSatellitenIp = new JLabel("Satelliten IP:"); + lblSatellitenIp.setBounds(25, 105, 82, 20); + //panel.add(lblSatellitenIp); + + lblSatIP = new JTextField(); + lblSatIP.setBounds(135, 110, 237, 20); + lblSatIP.setToolTipText("Bitte geben Sie die IP-Adresse des Satelliten ein."); + //panel.add(lblSatIP); + + choice = new Choice(); + choice.setBounds(135, 35, 237, 20); + //panel.add(choice); + + lblIdp = new JLabel("IDP:"); + lblIdp.setBounds(25, 35, 82, 20); + //panel.add(lblIdp); + + // action listener for the radio buttons to + // toggle the gui elements depending on the login type + loginTypeActionListener = new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + toggleLoginType(e.getActionCommand()); + } + }; + + panel_1 = new JPanel(); + panel_1.setLayout(null); + panel_1.setBorder(new TitledBorder( + UIManager.getBorder("TitledBorder.border"), "Zugangsart", + TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); + panel_1.setBackground(SystemColor.menu); + panel_1.setBounds(10, 143, 334, 181); + contentPane.add(panel_1); + + // group radio button for the login type together + bgLoginType = new ButtonGroup(); + + rdbtnBwIDM = new JRadioButton("bwIDM"); + rdbtnBwIDM.setBounds(32, 35, 244, 23); + rdbtnBwIDM.setActionCommand(LOGIN_TYPE_BWIDM); + rdbtnBwIDM.addActionListener(loginTypeActionListener); + bgLoginType.add(rdbtnBwIDM); + panel_1.add(rdbtnBwIDM); + + rdbtnMasterserver = new JRadioButton("bwLehrpool-Masterserver"); + rdbtnMasterserver.setSelected(true); + rdbtnMasterserver.setActionCommand(LOGIN_TYPE_BWLEHRPOOL); + rdbtnMasterserver.addActionListener(loginTypeActionListener); + rdbtnMasterserver.setBounds(32, 60, 244, 23); + bgLoginType.add(rdbtnMasterserver); + panel_1.add(rdbtnMasterserver); + + rdbtnDirekteVerbindung = new JRadioButton("Lokales Satellit"); + rdbtnDirekteVerbindung.setBounds(32, 85, 244, 23); + rdbtnDirekteVerbindung.setActionCommand(LOGIN_TYPE_SATLLITE); + rdbtnDirekteVerbindung.addActionListener(loginTypeActionListener); + bgLoginType.add(rdbtnDirekteVerbindung); + panel_1.add(rdbtnDirekteVerbindung); + + panel.setVisible(true); + panel_1.setVisible(true); + contentPane.setVisible(true); + GuiOrganizer.centerGUI(this); c = this; }// end LoginGUI() // Versuche den Benutzer einzuloggen - public void performLogin() { + public void performLogin(final String loginType) { + LOGGER.info("Trying login of type: " + loginType); org.openslx.imagemaster.thrift.iface.SessionData result = null; // Connect to Master MasterThriftConnection thrift = new MasterThriftConnection(); Client client = thrift.getMasterThriftConnection(); - if (client == null) { // Thrift connection to master could not be established setStatus(Color.red, "Fehler: Masterserver nicht erreichbar.", null); + LOGGER.info("Thrift client could not be initialized, is the masterserver up and running?"); return; } @@ -244,7 +347,6 @@ public class Login_GUI extends JFrame { String hochschule = user.eMail.substring(user.eMail.indexOf("@") + 1); - //person.verantwortlicher.setUsername(lblusername.getText().substring(0,lblusername.getText().indexOf("@"))); person.verantwortlicher.setUsername(lblusername.getText().trim()); person.verantwortlicher.setUserID(lblusername.getText().trim()); person.verantwortlicher.setName(user.lastName); @@ -254,9 +356,6 @@ public class Login_GUI extends JFrame { // Spaeter ueber result.getRole zum Beispiel die Rolle holen person.verantwortlicher.setRole("Dozent"); - // person.verantwortlicher.setRole("Admin"); - // person.verantwortlicher.setRole("Student"); - // person.verantwortlicher.setRole("GetToTheChopper!"); if (chckbxBenutzernameSpeichern.isSelected()) { Config.setUsername(lblusername.getText()); @@ -313,5 +412,64 @@ public class Login_GUI extends JFrame { JOptionPane.showMessageDialog(c, longMessage, "Anmeldung fehlgeschlagen", JOptionPane.ERROR_MESSAGE); } - + + /** + * Toggle the elements needed for the different login types. + * + * @param type + * Type of the login to toggle. Valid are: + * 'bwidm', 'bwlp', 'sat' + */ + private void toggleLoginType(String type) { + LOGGER.info("Toggling to login method to: " + type); + panel.setVisible(false); + switch(type) { + case LOGIN_TYPE_BWIDM: + panel.remove(lblSatIP); + panel.remove(lblSatellitenIp); + panel.add(lblIdp); + panel.add(choice); + panel.add(LabelPass); + lblpass.setText(""); + lblpass.setToolTipText("Bitte geben Sie Ihr bwIDM-Passwort ein."); + panel.add(lblpass); + lblusername.setToolTipText("Bitte geben Sie Ihr bwIDM-Benutzername ein."); + panel.revalidate(); + panel.repaint(); + panel.setVisible(true); + break; + case LOGIN_TYPE_BWLEHRPOOL: + panel.remove(choice); + panel.remove(lblIdp); + panel.remove(lblSatIP); + panel.remove(lblSatellitenIp); + panel.add(LabelPass); + lblpass.setToolTipText("Bitte geben Sie Ihr bwLehrpool-Passwort ein."); + panel.add(lblpass); + lblusername.setToolTipText("Bitte geben Sie Ihr bwLehrpool-Benutzername ein."); + panel.revalidate(); + panel.repaint(); + panel.setVisible(true); + break; + case LOGIN_TYPE_SATLLITE: + panel.remove(choice); + panel.remove(lblIdp); + panel.remove(LabelPass); + panel.remove(lblpass); + lblSatIP.setBounds(135, 85, 237, 20); + lblSatIP.setText(""); + panel.add(lblSatIP); + lblSatellitenIp.setBounds(25, 85, 82, 20); + panel.add(lblSatellitenIp); + panel.revalidate(); + panel.repaint(); + panel.setVisible(true); + break; + default: + LOGGER.error("Unknown action '" + type + "'. Ignoring."); + panel.setVisible(true); + return; + } + + } }// end class diff --git a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java index fe49ef06..072ef196 100644 --- a/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java +++ b/dozentenmodul/src/main/java/gui/intro/MainMenue_GUI.java @@ -47,6 +47,7 @@ import javax.swing.border.TitledBorder; import models.GUIRights; import models.ImageRights; import models.Links; +import models.RightsManagement; import models.SessionData; import models.person; @@ -132,6 +133,10 @@ public class MainMenue_GUI extends JFrame { 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); diff --git a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java index 5205c41c..3f1e5dfa 100644 --- a/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/CreateLectureLink_GUI.java @@ -949,7 +949,7 @@ public class CreateLectureLink_GUI extends JFrame { List<server.generated.Image> images; // Hole eine Liste der Images - images = client.getImageList(); + images = client.getImageListPermissionLink(person.verantwortlicher.getUserID()); Iterator<server.generated.Image> i = images.iterator(); SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java index dbacf997..ce2130ad 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureLink_GUI.java @@ -954,7 +954,7 @@ public class EditLectureLink_GUI extends JFrame { List<server.generated.Image> images; // Hole eine Liste der Images - images = client.getImageList(); + images = client.getImageListPermissionLink(person.verantwortlicher.getUserID()); Iterator<server.generated.Image> i = images.iterator(); SimpleDateFormat in=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); diff --git a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java index 8f51d17a..a37b2e9c 100644 --- a/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/PermissionCreateLecture_GUI.java @@ -1,6 +1,5 @@ package gui.lecture; - import gui.intro.About_GUI; import gui.intro.MainMenue_GUI; @@ -20,6 +19,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.ButtonGroup; @@ -51,44 +53,56 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; +import org.apache.log4j.Logger; +import org.apache.thrift.TException; + import models.Links; +import models.RightsManagement; +import models.person; +import server.generated.Person; +import server.generated.Server.Client; +import util.CheckIntegrity; import util.OpenLinks; @SuppressWarnings("serial") public class PermissionCreateLecture_GUI extends JFrame { + // Logger for this class + private final static Logger LOGGER = Logger + .getLogger(PermissionCreateLecture_GUI.class); + private final JPanel contentPanel = new JPanel(); + Client client = models.Client.clientcon.getClient(); String[] result; private Class[] classes; - private JTable table; - Object[] titles = { "Name","Read", "Write","Admin"}; + private JTable table = null; + Object[] titles = { "Name", "Read", "Write", "Admin", "userID" }; + // Object[] titles = { "Name", "Read", "Write", "Link", "Admin", "userID" }; Component c = null; - private static final String HELP_MESSAGE = "<html><div align=\"center\">" + - "Hier können Sie die Berechtigungen für Ihre Veranstaltung ändern.<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 ändern.<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>"; + private List<Person> map = null; // List of people who have rights + + 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 JTextField textField; @@ -102,7 +116,7 @@ public class PermissionCreateLecture_GUI extends JFrame { } }); setResizable(false); - + try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException @@ -123,16 +137,18 @@ public class PermissionCreateLecture_GUI extends JFrame { getContentPane().add(panel); panel.setLayout(null); { - JLabel lblNewLabel = new JLabel("Veranstaltung - Berechtigungen (Nur zur Veranschaulichung)"); + JLabel lblNewLabel = new JLabel( + "Veranstaltung - Berechtigungen (Nur zur Veranschaulichung)"); 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); } @@ -141,168 +157,278 @@ public class PermissionCreateLecture_GUI extends JFrame { contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel); contentPanel.setLayout(null); - Object[] rowdata={"Max Mustermann", new Boolean(false),new Boolean(false),new Boolean(false),new Boolean(false)}; + Object[] rowdata = { "Max Mustermann", new Boolean(false), + new Boolean(false), new Boolean(false), new Boolean(false) }; model.addRow(rowdata); - - - 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])); - - tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(),(String) titles[1])); - tc2.setHeaderRenderer(new CheckBoxHeader(new MyItemListener2(),(String) titles[2])); - tc3.setHeaderRenderer(new CheckBoxHeader(new MyItemListener3(),(String) titles[3])); - + + table = new JTable(); + table.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + checkIntegrity(-1); + } + + }); + + table.setModel(model); + table.setSelectionForeground(Color.WHITE); + + // 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"); + // 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"); + 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.isRead(), // Read + temp.isWrite(), // Write + temp.isLinkAllowed(), // Link + temp.isAdmin(), // Admin + temp.getUserID() // userID + }; + System.out.println("Processing: " + temp.getName() + ", " + + temp.getVorname() + ", " + temp.isRead() + ", " + + temp.isWrite() + ", " + temp.isLinkAllowed() + ", " + + temp.isAdmin() + ", " + temp.getUserID()); + // Fuege diese Objekte der Tabelle hinzu + model.addRow(obj); + x++; + } + }// end set list of permitted users + + // table wird hier nie initialisiert und ist entsprechend null + if (table == null) + LOGGER.error("NPE incoming..."); + 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])); + + tc1.setHeaderRenderer(new CheckBoxHeader(new MyItemListener1(), + (String) titles[1])); + tc2.setHeaderRenderer(new CheckBoxHeader(new MyItemListener2(), + (String) titles[2])); + tc3.setHeaderRenderer(new CheckBoxHeader(new MyItemListener3(), + (String) titles[3])); + JLabel lblHauptmen = new JLabel("Hauptmenü"); lblHauptmen.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { - + PermissionCreateLecture_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("Berechtigungen"); lblNewLabel_1.setBounds(194, 11, 95, 14); contentPanel.add(lblNewLabel_1); - + JLabel lblName = new JLabel("Name:"); lblName.setBounds(10, 36, 46, 20); contentPanel.add(lblName); - + textField = new JTextField(); textField.setBounds(69, 36, 171, 20); contentPanel.add(textField); textField.setColumns(10); - + JLabel lblHochschule = new JLabel("Hochschule:"); lblHochschule.setBounds(275, 36, 80, 20); contentPanel.add(lblHochschule); - + JComboBox comboBox = new JComboBox(); - comboBox.setModel(new DefaultComboBoxModel(new String[] {"Hochschule Offenburg", "Hochschule Reutlingen", "Universität Freiburg"})); + comboBox.setModel(new DefaultComboBoxModel(new String[] { + "Hochschule Offenburg", "Hochschule Reutlingen", + "Universität Freiburg" })); comboBox.setBounds(365, 36, 202, 20); contentPanel.add(comboBox); - + JPanel panel = new JPanel(); panel.setBounds(10, 67, 557, 148); contentPanel.add(panel); 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); - + JLabel label = new JLabel("Read"); label.setBounds(20, 18, 90, 20); panel.add(label); - + JLabel label_3 = new JLabel("Write"); label_3.setBounds(20, 38, 90, 20); panel.add(label_3); - + JLabel label_5 = new JLabel("Admin"); label_5.setBounds(20, 78, 90, 20); panel.add(label_5); - - JLabel label_7 = new JLabel("Image darf gelesen und gestartet werden und ist in Suchfenster sichtbar."); + + JLabel label_7 = new JLabel( + "Image darf gelesen und gestartet werden und ist in Suchfenster sichtbar."); label_7.setBounds(120, 18, 380, 20); panel.add(label_7); - - JLabel lblimageDarfAngepasst = new JLabel("<HTML>Image darf angepasst und überschrieben, jedoch nicht gelöscht werden. Berechtigungen für andere Benutzer festlegen</HTML>"); + + JLabel lblimageDarfAngepasst = new JLabel( + "<HTML>Image darf angepasst und überschrieben, jedoch nicht gelöscht werden. Berechtigungen für andere Benutzer festlegen</HTML>"); lblimageDarfAngepasst.setBounds(120, 38, 380, 45); panel.add(lblimageDarfAngepasst); - - JLabel lblvolleRechteRead = new JLabel("<HTML>Volle Rechte: read, write, löschen und Berechtigungen für andere Benutzer festlegen.</HTML>"); + + JLabel lblvolleRechteRead = new JLabel( + "<HTML>Volle Rechte: read, write, löschen und Berechtigungen für andere Benutzer festlegen.</HTML>"); lblvolleRechteRead.setBounds(120, 78, 380, 40); panel.add(lblvolleRechteRead); - + JCheckBox checkBox = new JCheckBox(""); checkBox.setBounds(115, 118, 21, 23); panel.add(checkBox); - + JLabel label_4 = new JLabel("Für alle sichtbar"); label_4.setBounds(20, 119, 90, 20); panel.add(label_4); - + JPanel panel_1 = new JPanel(); panel_1.setLayout(null); - 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.setBackground(SystemColor.menu); panel_1.setBounds(10, 226, 311, 294); contentPanel.add(panel_1); - + JScrollPane scrollPane = new JScrollPane(); - scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); + scrollPane + .setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBounds(10, 28, 291, 223); panel_1.add(scrollPane); - + JButton button = new JButton("Hinzufügen"); button.setEnabled(false); button.setBounds(10, 260, 89, 23); panel_1.add(button); - + JButton button_1 = new JButton("Löschen"); button_1.setEnabled(false); button_1.setBounds(109, 260, 89, 23); panel_1.add(button_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, 226, 236, 294); contentPanel.add(panel_2); - + 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(23, 88, 203, 161); panel_2.add(scrollPane_1); - + JRadioButton radioButton = new JRadioButton("Sichtbar für alle"); radioButton.setSelected(true); radioButton.setEnabled(false); radioButton.setBounds(6, 32, 109, 23); panel_2.add(radioButton); - + JRadioButton radioButton_1 = new JRadioButton("Individuell"); radioButton_1.setEnabled(false); radioButton_1.setBounds(6, 58, 109, 23); panel_2.add(radioButton_1); - + JButton button_2 = new JButton("Hinzufügen"); button_2.setEnabled(false); button_2.setBounds(23, 260, 89, 23); panel_2.add(button_2); - + JButton button_3 = new JButton("Löschen"); button_3.setEnabled(false); button_3.setBounds(122, 260, 89, 23); @@ -317,26 +443,26 @@ public class PermissionCreateLecture_GUI extends JFrame { JButton cancelButton = new JButton("Zurück"); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - - - CreateLectureAllgemein_GUI sr=new CreateLectureAllgemein_GUI(c); + + CreateLectureAllgemein_GUI sr = new CreateLectureAllgemein_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) { - - CreateLectureLink_GUI ea=new CreateLectureLink_GUI(c); + + CreateLectureLink_GUI ea = new CreateLectureLink_GUI(c); ea.setVisible(true); dispose(); - + } }); continueButton.setActionCommand("Cancel"); @@ -344,34 +470,34 @@ public class PermissionCreateLecture_GUI extends JFrame { getRootPane().setDefaultButton(continueButton); } } - + JSeparator separator = new JSeparator(); separator.setBounds(0, 78, 597, 2); getContentPane().add(separator); - + JSeparator separator_1 = new JSeparator(); separator_1.setBounds(0, 627, 597, 2); getContentPane().add(separator_1); - + JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); - + JMenu mnNewMenu_1 = new JMenu("Hilfe"); menuBar.add(mnNewMenu_1); - + JMenuItem mntmFaq = new JMenuItem("FAQ"); 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(); @@ -379,7 +505,6 @@ public class PermissionCreateLecture_GUI extends JFrame { } }); mnNewMenu_1.add(mntmFaq); - JMenuItem mntmOtrs = new JMenuItem("OTRS"); mntmOtrs.addMouseListener(new MouseAdapter() { @@ -387,22 +512,22 @@ public class PermissionCreateLecture_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) { @@ -411,131 +536,233 @@ public class PermissionCreateLecture_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, isLink, isAdmin; + + // collect all row data + isRead = (boolean) table.getValueAt(selectedRow, 1); + isWrite = (boolean) table.getValueAt(selectedRow, 2); + isLink = (boolean) table.getValueAt(selectedRow, 3); + isAdmin = (boolean) table.getValueAt(selectedRow, 4); + + boolean[] checkedVals = CheckIntegrity.isIntegre(isRead, isWrite, + isLink, isAdmin); + + table.setValueAt(checkedVals[0], selectedRow, 1); + table.setValueAt(checkedVals[1], selectedRow, 2); + table.setValueAt(checkedVals[2], selectedRow, 3); + table.setValueAt(checkedVals[3], selectedRow, 4); + }// end checkIntegrity() + + // Column 0 == Concat user name + + // Read column + 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); + } + } + } + + // Write column + 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); + } + } + } + + // Admin column + 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); + } + } + } + + // Invisible userID column + 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); + } + } + } + + // 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 + if (map == null) + System.out.println("Error: map is null"); + + // 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(); + + // table.getModel().setValueAt(map.get, i, 5); + + temp.setUserID(table.getModel().getValueAt(i, 5).toString()); // get + // userID + temp.setAdmin(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 4).toString())); // get Admin + temp.setLinkAllowed(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 3).toString()));// get Link + temp.setWrite(Boolean.parseBoolean(table.getModel() + .getValueAt(i, 2).toString()));// get Write + temp.setRead(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.isAdmin() || temp.isLinkAllowed() || temp.isWrite() + || temp.isRead()) { + // save entry + list.add(temp); + } else { + // do nothing + } + } + + System.out.println("Setting list information.\tTable size: " + + table.getRowCount() + "\t List length (=selected users): " + + list.size()); + for (int y = 0; y < list.size(); y++) { + System.out.println("" + list.get(y).getName()); + } + + RightsManagement.rightsManagement.setPermittedUserList(list); + }// end saveTableToList() + +}// end class + +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 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) { -} -} diff --git a/dozentenmodul/src/main/java/models/RightsManagement.java b/dozentenmodul/src/main/java/models/RightsManagement.java index 38661870..d2de8e8c 100644 --- a/dozentenmodul/src/main/java/models/RightsManagement.java +++ b/dozentenmodul/src/main/java/models/RightsManagement.java @@ -10,22 +10,19 @@ public class RightsManagement { // } + //list which holds all selected users and permissions for this session and type (either for image or lecture, depending on + private List<person> permittedUserList = new ArrayList<person>(); - - //list which holds all users and (non-)selected values of the table rightstable in permissionCreateImage - private List<person> pmImageCreateList = new ArrayList<person>(); - - - + public static RightsManagement rightsManagement = new RightsManagement(); - public List<person> getPmImageCreateList() { - return pmImageCreateList; + public List<person> getPermittedUserList() { + return permittedUserList; } - public void setPmImageCreateList(List<person> list) { - this.pmImageCreateList = list; + public void setPermittedUserList(List<person> list) { + this.permittedUserList = list; } } diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index a66083c5..af2734df 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -198,23 +198,32 @@ public class ServerHandler implements Server.Iface { } @Override - public List<Image> getImageList() throws TException { - return sql.getImageList(); - + public List<Image> getImageListPermissionWrite(String userID) throws TException { + return sql.getImageListPermissionWrite(userID); + } + + @Override + public List<Image> getImageListPermissionRead(String userID) throws TException { + return sql.getImageListPermissionWrite(userID); + } + + + @Override + public List<Image> getImageListPermissionLink(String userID) throws TException { + return sql.getImageListPermissionWrite(userID); } @Override public List<String> getAllOS() throws TException { return sql.getAllOS(); - } @Override public Map<String, String> getPersonData(String Vorname, String Nachname) throws TException { return sql.getPersonData(Vorname, Nachname); - } + @Override public boolean writeLecturedata(String name, String shortdesc, String desc, @@ -566,5 +575,10 @@ public class ServerHandler implements Server.Iface { log.info(new Date() + " - written additional image rights for "+userID); return success; } + + @Override + public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws TException { + return sql.getPermissionForUserAndImage(userID, imageID); + } }// end class diff --git a/dozentenmodulserver/src/main/java/server/generated/Person.java b/dozentenmodulserver/src/main/java/server/generated/Person.java index 19084ac9..8129579b 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Person.java +++ b/dozentenmodulserver/src/main/java/server/generated/Person.java @@ -38,6 +38,13 @@ 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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { @@ -48,12 +55,26 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, public String userID; // required public String Nachname; // required public String Vorname; // required + public boolean image_read; // required + public boolean image_write; // required + public boolean image_admin; // required + public boolean image_link; // required + public boolean lecture_read; // required + public boolean lecture_write; // required + public boolean lecture_admin; // 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"), NACHNAME((short)2, "Nachname"), - VORNAME((short)3, "Vorname"); + 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"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -74,6 +95,20 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return NACHNAME; case 3: // VORNAME return VORNAME; + case 4: // IMAGE_READ + return IMAGE_READ; + case 5: // IMAGE_WRITE + return IMAGE_WRITE; + case 6: // IMAGE_ADMIN + return IMAGE_ADMIN; + case 7: // IMAGE_LINK + return IMAGE_LINK; + case 8: // LECTURE_READ + return LECTURE_READ; + case 9: // LECTURE_WRITE + return LECTURE_WRITE; + case 10: // LECTURE_ADMIN + return LECTURE_ADMIN; default: return null; } @@ -114,6 +149,14 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } // isset id assignments + private static final int __IMAGE_READ_ISSET_ID = 0; + private static final int __IMAGE_WRITE_ISSET_ID = 1; + private static final int __IMAGE_ADMIN_ISSET_ID = 2; + private static final int __IMAGE_LINK_ISSET_ID = 3; + private static final int __LECTURE_READ_ISSET_ID = 4; + private static final int __LECTURE_WRITE_ISSET_ID = 5; + private static final int __LECTURE_ADMIN_ISSET_ID = 6; + 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); @@ -123,6 +166,20 @@ 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.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, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IMAGE_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("image_admin", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.IMAGE_LINK, new org.apache.thrift.meta_data.FieldMetaData("image_link", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.LECTURE_READ, new org.apache.thrift.meta_data.FieldMetaData("lecture_read", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.LECTURE_WRITE, new org.apache.thrift.meta_data.FieldMetaData("lecture_write", org.apache.thrift.TFieldRequirementType.DEFAULT, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL))); + tmpMap.put(_Fields.LECTURE_ADMIN, new org.apache.thrift.meta_data.FieldMetaData("lecture_admin", 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(Person.class, metaDataMap); } @@ -133,18 +190,40 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, public Person( String userID, String Nachname, - String Vorname) + String Vorname, + boolean image_read, + boolean image_write, + boolean image_admin, + boolean image_link, + boolean lecture_read, + boolean lecture_write, + boolean lecture_admin) { this(); this.userID = userID; this.Nachname = Nachname; this.Vorname = Vorname; + this.image_read = image_read; + setImage_readIsSet(true); + this.image_write = image_write; + setImage_writeIsSet(true); + this.image_admin = image_admin; + setImage_adminIsSet(true); + this.image_link = image_link; + setImage_linkIsSet(true); + this.lecture_read = lecture_read; + setLecture_readIsSet(true); + this.lecture_write = lecture_write; + setLecture_writeIsSet(true); + this.lecture_admin = lecture_admin; + setLecture_adminIsSet(true); } /** * Performs a deep copy on <i>other</i>. */ public Person(Person other) { + __isset_bitfield = other.__isset_bitfield; if (other.isSetUserID()) { this.userID = other.userID; } @@ -154,6 +233,13 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (other.isSetVorname()) { this.Vorname = other.Vorname; } + this.image_read = other.image_read; + this.image_write = other.image_write; + this.image_admin = other.image_admin; + this.image_link = other.image_link; + this.lecture_read = other.lecture_read; + this.lecture_write = other.lecture_write; + this.lecture_admin = other.lecture_admin; } public Person deepCopy() { @@ -165,6 +251,20 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, this.userID = null; this.Nachname = null; this.Vorname = null; + setImage_readIsSet(false); + this.image_read = false; + setImage_writeIsSet(false); + this.image_write = false; + setImage_adminIsSet(false); + this.image_admin = false; + setImage_linkIsSet(false); + this.image_link = false; + setLecture_readIsSet(false); + this.lecture_read = false; + setLecture_writeIsSet(false); + this.lecture_write = false; + setLecture_adminIsSet(false); + this.lecture_admin = false; } public String getUserID() { @@ -239,6 +339,167 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } } + public boolean isImage_read() { + return this.image_read; + } + + public Person setImage_read(boolean image_read) { + this.image_read = image_read; + setImage_readIsSet(true); + return this; + } + + public void unsetImage_read() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGE_READ_ISSET_ID); + } + + /** Returns true if field image_read is set (has been assigned a value) and false otherwise */ + public boolean isSetImage_read() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGE_READ_ISSET_ID); + } + + public void setImage_readIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGE_READ_ISSET_ID, value); + } + + public boolean isImage_write() { + return this.image_write; + } + + public Person setImage_write(boolean image_write) { + this.image_write = image_write; + setImage_writeIsSet(true); + return this; + } + + public void unsetImage_write() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGE_WRITE_ISSET_ID); + } + + /** Returns true if field image_write is set (has been assigned a value) and false otherwise */ + public boolean isSetImage_write() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGE_WRITE_ISSET_ID); + } + + public void setImage_writeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGE_WRITE_ISSET_ID, value); + } + + public boolean isImage_admin() { + return this.image_admin; + } + + public Person setImage_admin(boolean image_admin) { + this.image_admin = image_admin; + setImage_adminIsSet(true); + return this; + } + + public void unsetImage_admin() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGE_ADMIN_ISSET_ID); + } + + /** Returns true if field image_admin is set (has been assigned a value) and false otherwise */ + public boolean isSetImage_admin() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGE_ADMIN_ISSET_ID); + } + + public void setImage_adminIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGE_ADMIN_ISSET_ID, value); + } + + public boolean isImage_link() { + return this.image_link; + } + + public Person setImage_link(boolean image_link) { + this.image_link = image_link; + setImage_linkIsSet(true); + return this; + } + + public void unsetImage_link() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __IMAGE_LINK_ISSET_ID); + } + + /** Returns true if field image_link is set (has been assigned a value) and false otherwise */ + public boolean isSetImage_link() { + return EncodingUtils.testBit(__isset_bitfield, __IMAGE_LINK_ISSET_ID); + } + + public void setImage_linkIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __IMAGE_LINK_ISSET_ID, value); + } + + public boolean isLecture_read() { + return this.lecture_read; + } + + public Person setLecture_read(boolean lecture_read) { + this.lecture_read = lecture_read; + setLecture_readIsSet(true); + return this; + } + + public void unsetLecture_read() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LECTURE_READ_ISSET_ID); + } + + /** Returns true if field lecture_read is set (has been assigned a value) and false otherwise */ + public boolean isSetLecture_read() { + return EncodingUtils.testBit(__isset_bitfield, __LECTURE_READ_ISSET_ID); + } + + public void setLecture_readIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LECTURE_READ_ISSET_ID, value); + } + + public boolean isLecture_write() { + return this.lecture_write; + } + + public Person setLecture_write(boolean lecture_write) { + this.lecture_write = lecture_write; + setLecture_writeIsSet(true); + return this; + } + + public void unsetLecture_write() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LECTURE_WRITE_ISSET_ID); + } + + /** Returns true if field lecture_write is set (has been assigned a value) and false otherwise */ + public boolean isSetLecture_write() { + return EncodingUtils.testBit(__isset_bitfield, __LECTURE_WRITE_ISSET_ID); + } + + public void setLecture_writeIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LECTURE_WRITE_ISSET_ID, value); + } + + public boolean isLecture_admin() { + return this.lecture_admin; + } + + public Person setLecture_admin(boolean lecture_admin) { + this.lecture_admin = lecture_admin; + setLecture_adminIsSet(true); + return this; + } + + public void unsetLecture_admin() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LECTURE_ADMIN_ISSET_ID); + } + + /** Returns true if field lecture_admin is set (has been assigned a value) and false otherwise */ + public boolean isSetLecture_admin() { + return EncodingUtils.testBit(__isset_bitfield, __LECTURE_ADMIN_ISSET_ID); + } + + public void setLecture_adminIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LECTURE_ADMIN_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case USER_ID: @@ -265,6 +526,62 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, } break; + case IMAGE_READ: + if (value == null) { + unsetImage_read(); + } else { + setImage_read((Boolean)value); + } + break; + + case IMAGE_WRITE: + if (value == null) { + unsetImage_write(); + } else { + setImage_write((Boolean)value); + } + break; + + case IMAGE_ADMIN: + if (value == null) { + unsetImage_admin(); + } else { + setImage_admin((Boolean)value); + } + break; + + case IMAGE_LINK: + if (value == null) { + unsetImage_link(); + } else { + setImage_link((Boolean)value); + } + break; + + case LECTURE_READ: + if (value == null) { + unsetLecture_read(); + } else { + setLecture_read((Boolean)value); + } + break; + + case LECTURE_WRITE: + if (value == null) { + unsetLecture_write(); + } else { + setLecture_write((Boolean)value); + } + break; + + case LECTURE_ADMIN: + if (value == null) { + unsetLecture_admin(); + } else { + setLecture_admin((Boolean)value); + } + break; + } } @@ -279,6 +596,27 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, case VORNAME: return getVorname(); + case IMAGE_READ: + return Boolean.valueOf(isImage_read()); + + case IMAGE_WRITE: + return Boolean.valueOf(isImage_write()); + + case IMAGE_ADMIN: + return Boolean.valueOf(isImage_admin()); + + case IMAGE_LINK: + return Boolean.valueOf(isImage_link()); + + case LECTURE_READ: + return Boolean.valueOf(isLecture_read()); + + case LECTURE_WRITE: + return Boolean.valueOf(isLecture_write()); + + case LECTURE_ADMIN: + return Boolean.valueOf(isLecture_admin()); + } throw new IllegalStateException(); } @@ -296,6 +634,20 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return isSetNachname(); case VORNAME: return isSetVorname(); + case IMAGE_READ: + return isSetImage_read(); + case IMAGE_WRITE: + return isSetImage_write(); + case IMAGE_ADMIN: + return isSetImage_admin(); + case IMAGE_LINK: + return isSetImage_link(); + case LECTURE_READ: + return isSetLecture_read(); + case LECTURE_WRITE: + return isSetLecture_write(); + case LECTURE_ADMIN: + return isSetLecture_admin(); } throw new IllegalStateException(); } @@ -340,6 +692,69 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return false; } + boolean this_present_image_read = true; + boolean that_present_image_read = true; + if (this_present_image_read || that_present_image_read) { + if (!(this_present_image_read && that_present_image_read)) + return false; + if (this.image_read != that.image_read) + return false; + } + + boolean this_present_image_write = true; + boolean that_present_image_write = true; + if (this_present_image_write || that_present_image_write) { + if (!(this_present_image_write && that_present_image_write)) + return false; + if (this.image_write != that.image_write) + return false; + } + + boolean this_present_image_admin = true; + boolean that_present_image_admin = true; + if (this_present_image_admin || that_present_image_admin) { + if (!(this_present_image_admin && that_present_image_admin)) + return false; + if (this.image_admin != that.image_admin) + return false; + } + + boolean this_present_image_link = true; + boolean that_present_image_link = true; + if (this_present_image_link || that_present_image_link) { + if (!(this_present_image_link && that_present_image_link)) + return false; + if (this.image_link != that.image_link) + return false; + } + + boolean this_present_lecture_read = true; + boolean that_present_lecture_read = true; + if (this_present_lecture_read || that_present_lecture_read) { + if (!(this_present_lecture_read && that_present_lecture_read)) + return false; + if (this.lecture_read != that.lecture_read) + return false; + } + + boolean this_present_lecture_write = true; + boolean that_present_lecture_write = true; + if (this_present_lecture_write || that_present_lecture_write) { + if (!(this_present_lecture_write && that_present_lecture_write)) + return false; + if (this.lecture_write != that.lecture_write) + return false; + } + + boolean this_present_lecture_admin = true; + boolean that_present_lecture_admin = true; + if (this_present_lecture_admin || that_present_lecture_admin) { + if (!(this_present_lecture_admin && that_present_lecture_admin)) + return false; + if (this.lecture_admin != that.lecture_admin) + return false; + } + return true; } @@ -386,6 +801,76 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, return lastComparison; } } + lastComparison = Boolean.valueOf(isSetImage_read()).compareTo(other.isSetImage_read()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImage_read()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image_read, other.image_read); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImage_write()).compareTo(other.isSetImage_write()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImage_write()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image_write, other.image_write); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImage_admin()).compareTo(other.isSetImage_admin()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImage_admin()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image_admin, other.image_admin); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetImage_link()).compareTo(other.isSetImage_link()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImage_link()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.image_link, other.image_link); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLecture_read()).compareTo(other.isSetLecture_read()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLecture_read()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lecture_read, other.lecture_read); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLecture_write()).compareTo(other.isSetLecture_write()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLecture_write()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lecture_write, other.lecture_write); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetLecture_admin()).compareTo(other.isSetLecture_admin()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetLecture_admin()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lecture_admin, other.lecture_admin); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -429,6 +914,34 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, sb.append(this.Vorname); } first = false; + if (!first) sb.append(", "); + sb.append("image_read:"); + sb.append(this.image_read); + first = false; + if (!first) sb.append(", "); + sb.append("image_write:"); + sb.append(this.image_write); + first = false; + if (!first) sb.append(", "); + sb.append("image_admin:"); + sb.append(this.image_admin); + first = false; + if (!first) sb.append(", "); + sb.append("image_link:"); + sb.append(this.image_link); + first = false; + if (!first) sb.append(", "); + sb.append("lecture_read:"); + sb.append(this.lecture_read); + first = false; + if (!first) sb.append(", "); + sb.append("lecture_write:"); + sb.append(this.lecture_write); + first = false; + if (!first) sb.append(", "); + sb.append("lecture_admin:"); + sb.append(this.lecture_admin); + first = false; sb.append(")"); return sb.toString(); } @@ -448,6 +961,8 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, 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); @@ -496,6 +1011,62 @@ 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 + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.image_read = iprot.readBool(); + struct.setImage_readIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 5: // IMAGE_WRITE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.image_write = iprot.readBool(); + struct.setImage_writeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 6: // IMAGE_ADMIN + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.image_admin = iprot.readBool(); + struct.setImage_adminIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 7: // IMAGE_LINK + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.image_link = iprot.readBool(); + struct.setImage_linkIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 8: // LECTURE_READ + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.lecture_read = iprot.readBool(); + struct.setLecture_readIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 9: // LECTURE_WRITE + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.lecture_write = iprot.readBool(); + struct.setLecture_writeIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 10: // LECTURE_ADMIN + if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) { + struct.lecture_admin = iprot.readBool(); + struct.setLecture_adminIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -526,6 +1097,27 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, oprot.writeString(struct.Vorname); oprot.writeFieldEnd(); } + oprot.writeFieldBegin(IMAGE_READ_FIELD_DESC); + oprot.writeBool(struct.image_read); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IMAGE_WRITE_FIELD_DESC); + oprot.writeBool(struct.image_write); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IMAGE_ADMIN_FIELD_DESC); + oprot.writeBool(struct.image_admin); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(IMAGE_LINK_FIELD_DESC); + oprot.writeBool(struct.image_link); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(LECTURE_READ_FIELD_DESC); + oprot.writeBool(struct.lecture_read); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(LECTURE_WRITE_FIELD_DESC); + oprot.writeBool(struct.lecture_write); + oprot.writeFieldEnd(); + oprot.writeFieldBegin(LECTURE_ADMIN_FIELD_DESC); + oprot.writeBool(struct.lecture_admin); + oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -553,7 +1145,28 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (struct.isSetVorname()) { optionals.set(2); } - oprot.writeBitSet(optionals, 3); + if (struct.isSetImage_read()) { + optionals.set(3); + } + if (struct.isSetImage_write()) { + optionals.set(4); + } + if (struct.isSetImage_admin()) { + optionals.set(5); + } + if (struct.isSetImage_link()) { + optionals.set(6); + } + if (struct.isSetLecture_read()) { + optionals.set(7); + } + if (struct.isSetLecture_write()) { + optionals.set(8); + } + if (struct.isSetLecture_admin()) { + optionals.set(9); + } + oprot.writeBitSet(optionals, 10); if (struct.isSetUserID()) { oprot.writeString(struct.userID); } @@ -563,12 +1176,33 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, if (struct.isSetVorname()) { oprot.writeString(struct.Vorname); } + if (struct.isSetImage_read()) { + oprot.writeBool(struct.image_read); + } + if (struct.isSetImage_write()) { + oprot.writeBool(struct.image_write); + } + if (struct.isSetImage_admin()) { + oprot.writeBool(struct.image_admin); + } + if (struct.isSetImage_link()) { + oprot.writeBool(struct.image_link); + } + if (struct.isSetLecture_read()) { + oprot.writeBool(struct.lecture_read); + } + if (struct.isSetLecture_write()) { + oprot.writeBool(struct.lecture_write); + } + if (struct.isSetLecture_admin()) { + oprot.writeBool(struct.lecture_admin); + } } @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(3); + BitSet incoming = iprot.readBitSet(10); if (incoming.get(0)) { struct.userID = iprot.readString(); struct.setUserIDIsSet(true); @@ -581,6 +1215,34 @@ public class Person implements org.apache.thrift.TBase<Person, Person._Fields>, struct.Vorname = iprot.readString(); struct.setVornameIsSet(true); } + if (incoming.get(3)) { + struct.image_read = iprot.readBool(); + struct.setImage_readIsSet(true); + } + if (incoming.get(4)) { + struct.image_write = iprot.readBool(); + struct.setImage_writeIsSet(true); + } + if (incoming.get(5)) { + struct.image_admin = iprot.readBool(); + struct.setImage_adminIsSet(true); + } + if (incoming.get(6)) { + struct.image_link = iprot.readBool(); + struct.setImage_linkIsSet(true); + } + if (incoming.get(7)) { + struct.lecture_read = iprot.readBool(); + struct.setLecture_readIsSet(true); + } + if (incoming.get(8)) { + struct.lecture_write = iprot.readBool(); + struct.setLecture_writeIsSet(true); + } + if (incoming.get(9)) { + 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 65bd34e3..364331a5 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -44,7 +44,11 @@ public class Server { 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 org.apache.thrift.TException; - public List<Image> getImageList() throws org.apache.thrift.TException; + public List<Image> getImageListPermissionWrite(String userID) throws org.apache.thrift.TException; + + public List<Image> getImageListPermissionRead(String userID) throws org.apache.thrift.TException; + + public List<Image> getImageListPermissionLink(String userID) throws org.apache.thrift.TException; public List<Lecture> getLectureList() throws org.apache.thrift.TException; @@ -86,6 +90,8 @@ public class Server { public boolean writeAdditionalImageRights(String imageName, String userID, boolean isRead, boolean isWrite, boolean isLinkAllowed, boolean isAdmin) throws org.apache.thrift.TException; + public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws org.apache.thrift.TException; + } public interface AsyncIface { @@ -98,7 +104,11 @@ public class Server { public void 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, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; - public void getImageList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getImageListPermissionWrite(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getImageListPermissionRead(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + + public void getImageListPermissionLink(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getLectureList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -140,6 +150,8 @@ 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; + public void getPermissionForUserAndImage(String userID, String imageID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + } public static class Client extends org.apache.thrift.TServiceClient implements Iface { @@ -271,26 +283,73 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeVLdata failed: unknown result"); } - public List<Image> getImageList() throws org.apache.thrift.TException + public List<Image> getImageListPermissionWrite(String userID) throws org.apache.thrift.TException + { + send_getImageListPermissionWrite(userID); + return recv_getImageListPermissionWrite(); + } + + public void send_getImageListPermissionWrite(String userID) throws org.apache.thrift.TException + { + getImageListPermissionWrite_args args = new getImageListPermissionWrite_args(); + args.setUserID(userID); + sendBase("getImageListPermissionWrite", args); + } + + public List<Image> recv_getImageListPermissionWrite() throws org.apache.thrift.TException + { + getImageListPermissionWrite_result result = new getImageListPermissionWrite_result(); + receiveBase(result, "getImageListPermissionWrite"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageListPermissionWrite failed: unknown result"); + } + + public List<Image> getImageListPermissionRead(String userID) throws org.apache.thrift.TException + { + send_getImageListPermissionRead(userID); + return recv_getImageListPermissionRead(); + } + + public void send_getImageListPermissionRead(String userID) throws org.apache.thrift.TException + { + getImageListPermissionRead_args args = new getImageListPermissionRead_args(); + args.setUserID(userID); + sendBase("getImageListPermissionRead", args); + } + + public List<Image> recv_getImageListPermissionRead() throws org.apache.thrift.TException + { + getImageListPermissionRead_result result = new getImageListPermissionRead_result(); + receiveBase(result, "getImageListPermissionRead"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageListPermissionRead failed: unknown result"); + } + + public List<Image> getImageListPermissionLink(String userID) throws org.apache.thrift.TException { - send_getImageList(); - return recv_getImageList(); + send_getImageListPermissionLink(userID); + return recv_getImageListPermissionLink(); } - public void send_getImageList() throws org.apache.thrift.TException + public void send_getImageListPermissionLink(String userID) throws org.apache.thrift.TException { - getImageList_args args = new getImageList_args(); - sendBase("getImageList", args); + getImageListPermissionLink_args args = new getImageListPermissionLink_args(); + args.setUserID(userID); + sendBase("getImageListPermissionLink", args); } - public List<Image> recv_getImageList() throws org.apache.thrift.TException + public List<Image> recv_getImageListPermissionLink() throws org.apache.thrift.TException { - getImageList_result result = new getImageList_result(); - receiveBase(result, "getImageList"); + getImageListPermissionLink_result result = new getImageListPermissionLink_result(); + receiveBase(result, "getImageListPermissionLink"); if (result.isSetSuccess()) { return result.success; } - throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageList failed: unknown result"); + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getImageListPermissionLink failed: unknown result"); } public List<Lecture> getLectureList() throws org.apache.thrift.TException @@ -820,6 +879,30 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "writeAdditionalImageRights failed: unknown result"); } + public List<Person> getPermissionForUserAndImage(String userID, String imageID) throws org.apache.thrift.TException + { + send_getPermissionForUserAndImage(userID, imageID); + return recv_getPermissionForUserAndImage(); + } + + public void send_getPermissionForUserAndImage(String userID, String imageID) throws org.apache.thrift.TException + { + getPermissionForUserAndImage_args args = new getPermissionForUserAndImage_args(); + args.setUserID(userID); + args.setImageID(imageID); + sendBase("getPermissionForUserAndImage", args); + } + + public List<Person> recv_getPermissionForUserAndImage() throws org.apache.thrift.TException + { + getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); + receiveBase(result, "getPermissionForUserAndImage"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPermissionForUserAndImage failed: unknown result"); + } + } public static class AsyncClient extends org.apache.thrift.async.TAsyncClient implements AsyncIface { public static class Factory implements org.apache.thrift.async.TAsyncClientFactory<AsyncClient> { @@ -1017,21 +1100,88 @@ public class Server { } } - public void getImageList(org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + public void getImageListPermissionWrite(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getImageListPermissionWrite_call method_call = new getImageListPermissionWrite_call(userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getImageListPermissionWrite_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getImageListPermissionWrite_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 { + super(client, protocolFactory, transport, resultHandler, false); + 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("getImageListPermissionWrite", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getImageListPermissionWrite_args args = new getImageListPermissionWrite_args(); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Image> 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_getImageListPermissionWrite(); + } + } + + public void getImageListPermissionRead(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getImageListPermissionRead_call method_call = new getImageListPermissionRead_call(userID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getImageListPermissionRead_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getImageListPermissionRead_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 { + super(client, protocolFactory, transport, resultHandler, false); + 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("getImageListPermissionRead", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getImageListPermissionRead_args args = new getImageListPermissionRead_args(); + args.setUserID(userID); + args.write(prot); + prot.writeMessageEnd(); + } + + public List<Image> 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_getImageListPermissionRead(); + } + } + + public void getImageListPermissionLink(String userID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); - getImageList_call method_call = new getImageList_call(resultHandler, this, ___protocolFactory, ___transport); + getImageListPermissionLink_call method_call = new getImageListPermissionLink_call(userID, resultHandler, this, ___protocolFactory, ___transport); this.___currentMethod = method_call; ___manager.call(method_call); } - public static class getImageList_call extends org.apache.thrift.async.TAsyncMethodCall { - public getImageList_call(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 getImageListPermissionLink_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + public getImageListPermissionLink_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 { super(client, protocolFactory, transport, resultHandler, false); + 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("getImageList", org.apache.thrift.protocol.TMessageType.CALL, 0)); - getImageList_args args = new getImageList_args(); + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getImageListPermissionLink", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getImageListPermissionLink_args args = new getImageListPermissionLink_args(); + args.setUserID(userID); args.write(prot); prot.writeMessageEnd(); } @@ -1042,7 +1192,7 @@ public class Server { } 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_getImageList(); + return (new Client(prot)).recv_getImageListPermissionLink(); } } @@ -1887,6 +2037,41 @@ public class Server { } } + public void getPermissionForUserAndImage(String userID, String imageID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getPermissionForUserAndImage_call method_call = new getPermissionForUserAndImage_call(userID, imageID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getPermissionForUserAndImage_call extends org.apache.thrift.async.TAsyncMethodCall { + private String userID; + private String imageID; + public getPermissionForUserAndImage_call(String userID, String imageID, 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.imageID = imageID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getPermissionForUserAndImage", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getPermissionForUserAndImage_args args = new getPermissionForUserAndImage_args(); + args.setUserID(userID); + args.setImageID(imageID); + 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_getPermissionForUserAndImage(); + } + } + } public static class Processor<I extends Iface> extends org.apache.thrift.TBaseProcessor<I> implements org.apache.thrift.TProcessor { @@ -1904,7 +2089,9 @@ public class Server { processMap.put("DeleteFtpUser", new DeleteFtpUser()); processMap.put("getPathOfImage", new getPathOfImage()); processMap.put("writeVLdata", new writeVLdata()); - processMap.put("getImageList", new getImageList()); + processMap.put("getImageListPermissionWrite", new getImageListPermissionWrite()); + processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); + processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getLectureList", new getLectureList()); processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); @@ -1925,6 +2112,7 @@ public class Server { processMap.put("writeLectureRights", new writeLectureRights()); processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); + processMap.put("getPermissionForUserAndImage", new getPermissionForUserAndImage()); return processMap; } @@ -2010,22 +2198,62 @@ public class Server { } } - public static class getImageList<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getImageList_args> { - public getImageList() { - super("getImageList"); + public static class getImageListPermissionWrite<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getImageListPermissionWrite_args> { + public getImageListPermissionWrite() { + super("getImageListPermissionWrite"); + } + + public getImageListPermissionWrite_args getEmptyArgsInstance() { + return new getImageListPermissionWrite_args(); + } + + protected boolean isOneway() { + return false; + } + + public getImageListPermissionWrite_result getResult(I iface, getImageListPermissionWrite_args args) throws org.apache.thrift.TException { + getImageListPermissionWrite_result result = new getImageListPermissionWrite_result(); + result.success = iface.getImageListPermissionWrite(args.userID); + return result; + } + } + + public static class getImageListPermissionRead<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getImageListPermissionRead_args> { + public getImageListPermissionRead() { + super("getImageListPermissionRead"); + } + + public getImageListPermissionRead_args getEmptyArgsInstance() { + return new getImageListPermissionRead_args(); + } + + protected boolean isOneway() { + return false; + } + + public getImageListPermissionRead_result getResult(I iface, getImageListPermissionRead_args args) throws org.apache.thrift.TException { + getImageListPermissionRead_result result = new getImageListPermissionRead_result(); + result.success = iface.getImageListPermissionRead(args.userID); + return result; + } + } + + public static class getImageListPermissionLink<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getImageListPermissionLink_args> { + public getImageListPermissionLink() { + super("getImageListPermissionLink"); } - public getImageList_args getEmptyArgsInstance() { - return new getImageList_args(); + public getImageListPermissionLink_args getEmptyArgsInstance() { + return new getImageListPermissionLink_args(); } protected boolean isOneway() { return false; } - public getImageList_result getResult(I iface, getImageList_args args) throws org.apache.thrift.TException { - getImageList_result result = new getImageList_result(); - result.success = iface.getImageList(); + public getImageListPermissionLink_result getResult(I iface, getImageListPermissionLink_args args) throws org.apache.thrift.TException { + getImageListPermissionLink_result result = new getImageListPermissionLink_result(); + result.success = iface.getImageListPermissionLink(args.userID); return result; } } @@ -2443,6 +2671,26 @@ public class Server { } } + public static class getPermissionForUserAndImage<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getPermissionForUserAndImage_args> { + public getPermissionForUserAndImage() { + super("getPermissionForUserAndImage"); + } + + public getPermissionForUserAndImage_args getEmptyArgsInstance() { + return new getPermissionForUserAndImage_args(); + } + + protected boolean isOneway() { + return false; + } + + public getPermissionForUserAndImage_result getResult(I iface, getPermissionForUserAndImage_args args) throws org.apache.thrift.TException { + getPermissionForUserAndImage_result result = new getPermissionForUserAndImage_result(); + result.success = iface.getPermissionForUserAndImage(args.userID, args.imageID); + return result; + } + } + } public static class AsyncProcessor<I extends AsyncIface> extends org.apache.thrift.TBaseAsyncProcessor<I> { @@ -2460,7 +2708,9 @@ public class Server { processMap.put("DeleteFtpUser", new DeleteFtpUser()); processMap.put("getPathOfImage", new getPathOfImage()); processMap.put("writeVLdata", new writeVLdata()); - processMap.put("getImageList", new getImageList()); + processMap.put("getImageListPermissionWrite", new getImageListPermissionWrite()); + processMap.put("getImageListPermissionRead", new getImageListPermissionRead()); + processMap.put("getImageListPermissionLink", new getImageListPermissionLink()); processMap.put("getLectureList", new getLectureList()); processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); @@ -2481,6 +2731,7 @@ public class Server { processMap.put("writeLectureRights", new writeLectureRights()); processMap.put("getAllOtherSatelliteUsers", new getAllOtherSatelliteUsers()); processMap.put("writeAdditionalImageRights", new writeAdditionalImageRights()); + processMap.put("getPermissionForUserAndImage", new getPermissionForUserAndImage()); return processMap; } @@ -2690,20 +2941,20 @@ public class Server { } } - public static class getImageList<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImageList_args, List<Image>> { - public getImageList() { - super("getImageList"); + public static class getImageListPermissionWrite<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImageListPermissionWrite_args, List<Image>> { + public getImageListPermissionWrite() { + super("getImageListPermissionWrite"); } - public getImageList_args getEmptyArgsInstance() { - return new getImageList_args(); + public getImageListPermissionWrite_args getEmptyArgsInstance() { + return new getImageListPermissionWrite_args(); } public AsyncMethodCallback<List<Image>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<List<Image>>() { public void onComplete(List<Image> o) { - getImageList_result result = new getImageList_result(); + getImageListPermissionWrite_result result = new getImageListPermissionWrite_result(); result.success = o; try { fcall.sendResponse(fb,result, org.apache.thrift.protocol.TMessageType.REPLY,seqid); @@ -2716,7 +2967,7 @@ public class Server { public void onError(Exception e) { byte msgType = org.apache.thrift.protocol.TMessageType.REPLY; org.apache.thrift.TBase msg; - getImageList_result result = new getImageList_result(); + getImageListPermissionWrite_result result = new getImageListPermissionWrite_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()); @@ -2736,8 +2987,110 @@ public class Server { return false; } - public void start(I iface, getImageList_args args, org.apache.thrift.async.AsyncMethodCallback<List<Image>> resultHandler) throws TException { - iface.getImageList(resultHandler); + public void start(I iface, getImageListPermissionWrite_args args, org.apache.thrift.async.AsyncMethodCallback<List<Image>> resultHandler) throws TException { + iface.getImageListPermissionWrite(args.userID,resultHandler); + } + } + + public static class getImageListPermissionRead<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImageListPermissionRead_args, List<Image>> { + public getImageListPermissionRead() { + super("getImageListPermissionRead"); + } + + public getImageListPermissionRead_args getEmptyArgsInstance() { + return new getImageListPermissionRead_args(); + } + + public AsyncMethodCallback<List<Image>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Image>>() { + public void onComplete(List<Image> o) { + getImageListPermissionRead_result result = new getImageListPermissionRead_result(); + result.success = o; + 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; + getImageListPermissionRead_result result = new getImageListPermissionRead_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, getImageListPermissionRead_args args, org.apache.thrift.async.AsyncMethodCallback<List<Image>> resultHandler) throws TException { + iface.getImageListPermissionRead(args.userID,resultHandler); + } + } + + public static class getImageListPermissionLink<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getImageListPermissionLink_args, List<Image>> { + public getImageListPermissionLink() { + super("getImageListPermissionLink"); + } + + public getImageListPermissionLink_args getEmptyArgsInstance() { + return new getImageListPermissionLink_args(); + } + + public AsyncMethodCallback<List<Image>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<List<Image>>() { + public void onComplete(List<Image> o) { + getImageListPermissionLink_result result = new getImageListPermissionLink_result(); + result.success = o; + 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; + getImageListPermissionLink_result result = new getImageListPermissionLink_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, getImageListPermissionLink_args args, org.apache.thrift.async.AsyncMethodCallback<List<Image>> resultHandler) throws TException { + iface.getImageListPermissionLink(args.userID,resultHandler); } } @@ -3774,6 +4127,57 @@ public class Server { } } + public static class getPermissionForUserAndImage<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getPermissionForUserAndImage_args, List<Person>> { + public getPermissionForUserAndImage() { + super("getPermissionForUserAndImage"); + } + + public getPermissionForUserAndImage_args getEmptyArgsInstance() { + return new getPermissionForUserAndImage_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(); + result.success = o; + 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; + 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()); + } + 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, getPermissionForUserAndImage_args args, org.apache.thrift.async.AsyncMethodCallback<List<Person>> resultHandler) throws TException { + iface.getPermissionForUserAndImage(args.userID, args.imageID,resultHandler); + } + } + } public static class getFtpUser_args implements org.apache.thrift.TBase<getFtpUser_args, getFtpUser_args._Fields>, java.io.Serializable, Cloneable, Comparable<getFtpUser_args> { @@ -8267,20 +8671,22 @@ public class Server { } - public static class getImageList_args implements org.apache.thrift.TBase<getImageList_args, getImageList_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImageList_args> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageList_args"); + public static class getImageListPermissionWrite_args implements org.apache.thrift.TBase<getImageListPermissionWrite_args, getImageListPermissionWrite_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionWrite_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionWrite_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); static { - schemes.put(StandardScheme.class, new getImageList_argsStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getImageList_argsTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getImageListPermissionWrite_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionWrite_argsTupleSchemeFactory()); } + 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 { -; + USER_ID((short)1, "userID"); private static final Map<String, _Fields> byName = new HashMap<String, _Fields>(); @@ -8295,6 +8701,8 @@ public class Server { */ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { + case 1: // USER_ID + return USER_ID; default: return null; } @@ -8333,37 +8741,87 @@ public class Server { 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.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(getImageList_args.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListPermissionWrite_args.class, metaDataMap); } - public getImageList_args() { + public getImageListPermissionWrite_args() { + } + + public getImageListPermissionWrite_args( + String userID) + { + this(); + this.userID = userID; } /** * Performs a deep copy on <i>other</i>. */ - public getImageList_args(getImageList_args other) { + public getImageListPermissionWrite_args(getImageListPermissionWrite_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } } - public getImageList_args deepCopy() { - return new getImageList_args(this); + public getImageListPermissionWrite_args deepCopy() { + return new getImageListPermissionWrite_args(this); } @Override public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getImageListPermissionWrite_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 USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + } } public Object getFieldValue(_Fields field) { switch (field) { + case USER_ID: + return getUserID(); + } throw new IllegalStateException(); } @@ -8375,6 +8833,8 @@ public class Server { } switch (field) { + case USER_ID: + return isSetUserID(); } throw new IllegalStateException(); } @@ -8383,15 +8843,24 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getImageList_args) - return this.equals((getImageList_args)that); + if (that instanceof getImageListPermissionWrite_args) + return this.equals((getImageListPermissionWrite_args)that); return false; } - public boolean equals(getImageList_args that) { + public boolean equals(getImageListPermissionWrite_args that) { if (that == null) 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; } @@ -8401,13 +8870,23 @@ public class Server { } @Override - public int compareTo(getImageList_args other) { + public int compareTo(getImageListPermissionWrite_args other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } int lastComparison = 0; + 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; } @@ -8425,9 +8904,16 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getImageList_args("); + StringBuilder sb = new StringBuilder("getImageListPermissionWrite_args("); boolean first = true; + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; sb.append(")"); return sb.toString(); } @@ -8453,15 +8939,15 @@ public class Server { } } - private static class getImageList_argsStandardSchemeFactory implements SchemeFactory { - public getImageList_argsStandardScheme getScheme() { - return new getImageList_argsStandardScheme(); + private static class getImageListPermissionWrite_argsStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionWrite_argsStandardScheme getScheme() { + return new getImageListPermissionWrite_argsStandardScheme(); } } - private static class getImageList_argsStandardScheme extends StandardScheme<getImageList_args> { + private static class getImageListPermissionWrite_argsStandardScheme extends StandardScheme<getImageListPermissionWrite_args> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getImageList_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionWrite_args struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -8471,6 +8957,14 @@ public class Server { break; } switch (schemeField.id) { + case 1: // 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); } @@ -8482,46 +8976,64 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getImageList_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getImageListPermissionWrite_args struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } } - private static class getImageList_argsTupleSchemeFactory implements SchemeFactory { - public getImageList_argsTupleScheme getScheme() { - return new getImageList_argsTupleScheme(); + private static class getImageListPermissionWrite_argsTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionWrite_argsTupleScheme getScheme() { + return new getImageListPermissionWrite_argsTupleScheme(); } } - private static class getImageList_argsTupleScheme extends TupleScheme<getImageList_args> { + private static class getImageListPermissionWrite_argsTupleScheme extends TupleScheme<getImageListPermissionWrite_args> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getImageList_args struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionWrite_args struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getImageList_args struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionWrite_args struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } } } } - public static class getImageList_result implements org.apache.thrift.TBase<getImageList_result, getImageList_result._Fields>, java.io.Serializable, Cloneable, Comparable<getImageList_result> { - private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageList_result"); + public static class getImageListPermissionWrite_result implements org.apache.thrift.TBase<getImageListPermissionWrite_result, getImageListPermissionWrite_result._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionWrite_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionWrite_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 getImageList_resultStandardSchemeFactory()); - schemes.put(TupleScheme.class, new getImageList_resultTupleSchemeFactory()); + schemes.put(StandardScheme.class, new getImageListPermissionWrite_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionWrite_resultTupleSchemeFactory()); } public List<Image> success; // required @@ -8592,13 +9104,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, Image.class)))); metaDataMap = Collections.unmodifiableMap(tmpMap); - org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageList_result.class, metaDataMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListPermissionWrite_result.class, metaDataMap); } - public getImageList_result() { + public getImageListPermissionWrite_result() { } - public getImageList_result( + public getImageListPermissionWrite_result( List<Image> success) { this(); @@ -8608,7 +9120,7 @@ public class Server { /** * Performs a deep copy on <i>other</i>. */ - public getImageList_result(getImageList_result other) { + public getImageListPermissionWrite_result(getImageListPermissionWrite_result other) { if (other.isSetSuccess()) { List<Image> __this__success = new ArrayList<Image>(other.success.size()); for (Image other_element : other.success) { @@ -8618,8 +9130,8 @@ public class Server { } } - public getImageList_result deepCopy() { - return new getImageList_result(this); + public getImageListPermissionWrite_result deepCopy() { + return new getImageListPermissionWrite_result(this); } @Override @@ -8646,7 +9158,7 @@ public class Server { return this.success; } - public getImageList_result setSuccess(List<Image> success) { + public getImageListPermissionWrite_result setSuccess(List<Image> success) { this.success = success; return this; } @@ -8705,12 +9217,12 @@ public class Server { public boolean equals(Object that) { if (that == null) return false; - if (that instanceof getImageList_result) - return this.equals((getImageList_result)that); + if (that instanceof getImageListPermissionWrite_result) + return this.equals((getImageListPermissionWrite_result)that); return false; } - public boolean equals(getImageList_result that) { + public boolean equals(getImageListPermissionWrite_result that) { if (that == null) return false; @@ -8732,7 +9244,7 @@ public class Server { } @Override - public int compareTo(getImageList_result other) { + public int compareTo(getImageListPermissionWrite_result other) { if (!getClass().equals(other.getClass())) { return getClass().getName().compareTo(other.getClass().getName()); } @@ -8766,7 +9278,7 @@ public class Server { @Override public String toString() { - StringBuilder sb = new StringBuilder("getImageList_result("); + StringBuilder sb = new StringBuilder("getImageListPermissionWrite_result("); boolean first = true; sb.append("success:"); @@ -8801,15 +9313,15 @@ public class Server { } } - private static class getImageList_resultStandardSchemeFactory implements SchemeFactory { - public getImageList_resultStandardScheme getScheme() { - return new getImageList_resultStandardScheme(); + private static class getImageListPermissionWrite_resultStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionWrite_resultStandardScheme getScheme() { + return new getImageListPermissionWrite_resultStandardScheme(); } } - private static class getImageList_resultStandardScheme extends StandardScheme<getImageList_result> { + private static class getImageListPermissionWrite_resultStandardScheme extends StandardScheme<getImageListPermissionWrite_result> { - public void read(org.apache.thrift.protocol.TProtocol iprot, getImageList_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionWrite_result struct) throws org.apache.thrift.TException { org.apache.thrift.protocol.TField schemeField; iprot.readStructBegin(); while (true) @@ -8849,7 +9361,7 @@ public class Server { struct.validate(); } - public void write(org.apache.thrift.protocol.TProtocol oprot, getImageList_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol oprot, getImageListPermissionWrite_result struct) throws org.apache.thrift.TException { struct.validate(); oprot.writeStructBegin(STRUCT_DESC); @@ -8871,16 +9383,16 @@ public class Server { } - private static class getImageList_resultTupleSchemeFactory implements SchemeFactory { - public getImageList_resultTupleScheme getScheme() { - return new getImageList_resultTupleScheme(); + private static class getImageListPermissionWrite_resultTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionWrite_resultTupleScheme getScheme() { + return new getImageListPermissionWrite_resultTupleScheme(); } } - private static class getImageList_resultTupleScheme extends TupleScheme<getImageList_result> { + private static class getImageListPermissionWrite_resultTupleScheme extends TupleScheme<getImageListPermissionWrite_result> { @Override - public void write(org.apache.thrift.protocol.TProtocol prot, getImageList_result struct) throws org.apache.thrift.TException { + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionWrite_result struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; BitSet optionals = new BitSet(); if (struct.isSetSuccess()) { @@ -8899,7 +9411,7 @@ public class Server { } @Override - public void read(org.apache.thrift.protocol.TProtocol prot, getImageList_result struct) throws org.apache.thrift.TException { + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionWrite_result struct) throws org.apache.thrift.TException { TTupleProtocol iprot = (TTupleProtocol) prot; BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { @@ -8921,6 +9433,1530 @@ public class Server { } + public static class getImageListPermissionRead_args implements org.apache.thrift.TBase<getImageListPermissionRead_args, getImageListPermissionRead_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionRead_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionRead_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getImageListPermissionRead_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionRead_argsTupleSchemeFactory()); + } + + 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 { + USER_ID((short)1, "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: // 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.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(getImageListPermissionRead_args.class, metaDataMap); + } + + public getImageListPermissionRead_args() { + } + + public getImageListPermissionRead_args( + String userID) + { + this(); + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListPermissionRead_args(getImageListPermissionRead_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public getImageListPermissionRead_args deepCopy() { + return new getImageListPermissionRead_args(this); + } + + @Override + public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getImageListPermissionRead_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 USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + 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 USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getImageListPermissionRead_args) + return this.equals((getImageListPermissionRead_args)that); + return false; + } + + public boolean equals(getImageListPermissionRead_args that) { + if (that == null) + 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(getImageListPermissionRead_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("getImageListPermissionRead_args("); + boolean first = true; + + 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 getImageListPermissionRead_argsStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionRead_argsStandardScheme getScheme() { + return new getImageListPermissionRead_argsStandardScheme(); + } + } + + private static class getImageListPermissionRead_argsStandardScheme extends StandardScheme<getImageListPermissionRead_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionRead_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: // 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, getImageListPermissionRead_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListPermissionRead_argsTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionRead_argsTupleScheme getScheme() { + return new getImageListPermissionRead_argsTupleScheme(); + } + } + + private static class getImageListPermissionRead_argsTupleScheme extends TupleScheme<getImageListPermissionRead_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionRead_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionRead_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class getImageListPermissionRead_result implements org.apache.thrift.TBase<getImageListPermissionRead_result, getImageListPermissionRead_result._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionRead_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionRead_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 getImageListPermissionRead_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionRead_resultTupleSchemeFactory()); + } + + public List<Image> 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 + 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.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Image.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListPermissionRead_result.class, metaDataMap); + } + + public getImageListPermissionRead_result() { + } + + public getImageListPermissionRead_result( + List<Image> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListPermissionRead_result(getImageListPermissionRead_result other) { + if (other.isSetSuccess()) { + List<Image> __this__success = new ArrayList<Image>(other.success.size()); + for (Image other_element : other.success) { + __this__success.add(new Image(other_element)); + } + this.success = __this__success; + } + } + + public getImageListPermissionRead_result deepCopy() { + return new getImageListPermissionRead_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Image> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Image elem) { + if (this.success == null) { + this.success = new ArrayList<Image>(); + } + this.success.add(elem); + } + + public List<Image> getSuccess() { + return this.success; + } + + public getImageListPermissionRead_result setSuccess(List<Image> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Image>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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 getImageListPermissionRead_result) + return this.equals((getImageListPermissionRead_result)that); + return false; + } + + public boolean equals(getImageListPermissionRead_result that) { + if (that == null) + return false; + + 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.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getImageListPermissionRead_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("getImageListPermissionRead_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + 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 { + 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 getImageListPermissionRead_resultStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionRead_resultStandardScheme getScheme() { + return new getImageListPermissionRead_resultStandardScheme(); + } + } + + private static class getImageListPermissionRead_resultStandardScheme extends StandardScheme<getImageListPermissionRead_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionRead_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.LIST) { + { + org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); + struct.success = new ArrayList<Image>(_list8.size); + for (int _i9 = 0; _i9 < _list8.size; ++_i9) + { + Image _elem10; + _elem10 = new Image(); + _elem10.read(iprot); + struct.success.add(_elem10); + } + iprot.readListEnd(); + } + 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, getImageListPermissionRead_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Image _iter11 : struct.success) + { + _iter11.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListPermissionRead_resultTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionRead_resultTupleScheme getScheme() { + return new getImageListPermissionRead_resultTupleScheme(); + } + } + + private static class getImageListPermissionRead_resultTupleScheme extends TupleScheme<getImageListPermissionRead_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionRead_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.writeI32(struct.success.size()); + for (Image _iter12 : struct.success) + { + _iter12.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionRead_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 _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Image>(_list13.size); + for (int _i14 = 0; _i14 < _list13.size; ++_i14) + { + Image _elem15; + _elem15 = new Image(); + _elem15.read(iprot); + struct.success.add(_elem15); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + + public static class getImageListPermissionLink_args implements org.apache.thrift.TBase<getImageListPermissionLink_args, getImageListPermissionLink_args._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionLink_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionLink_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 Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getImageListPermissionLink_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionLink_argsTupleSchemeFactory()); + } + + 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 { + USER_ID((short)1, "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: // 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.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(getImageListPermissionLink_args.class, metaDataMap); + } + + public getImageListPermissionLink_args() { + } + + public getImageListPermissionLink_args( + String userID) + { + this(); + this.userID = userID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListPermissionLink_args(getImageListPermissionLink_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + } + + public getImageListPermissionLink_args deepCopy() { + return new getImageListPermissionLink_args(this); + } + + @Override + public void clear() { + this.userID = null; + } + + public String getUserID() { + return this.userID; + } + + public getImageListPermissionLink_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 USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + 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 USER_ID: + return isSetUserID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getImageListPermissionLink_args) + return this.equals((getImageListPermissionLink_args)that); + return false; + } + + public boolean equals(getImageListPermissionLink_args that) { + if (that == null) + 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(getImageListPermissionLink_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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("getImageListPermissionLink_args("); + boolean first = true; + + 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 getImageListPermissionLink_argsStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionLink_argsStandardScheme getScheme() { + return new getImageListPermissionLink_argsStandardScheme(); + } + } + + private static class getImageListPermissionLink_argsStandardScheme extends StandardScheme<getImageListPermissionLink_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionLink_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: // 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, getImageListPermissionLink_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListPermissionLink_argsTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionLink_argsTupleScheme getScheme() { + return new getImageListPermissionLink_argsTupleScheme(); + } + } + + private static class getImageListPermissionLink_argsTupleScheme extends TupleScheme<getImageListPermissionLink_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionLink_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetUserID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionLink_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + } + } + + } + + public static class getImageListPermissionLink_result implements org.apache.thrift.TBase<getImageListPermissionLink_result, getImageListPermissionLink_result._Fields>, java.io.Serializable, Cloneable, Comparable<getImageListPermissionLink_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getImageListPermissionLink_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 getImageListPermissionLink_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getImageListPermissionLink_resultTupleSchemeFactory()); + } + + public List<Image> 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 + 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.ListMetaData(org.apache.thrift.protocol.TType.LIST, + new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, Image.class)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getImageListPermissionLink_result.class, metaDataMap); + } + + public getImageListPermissionLink_result() { + } + + public getImageListPermissionLink_result( + List<Image> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getImageListPermissionLink_result(getImageListPermissionLink_result other) { + if (other.isSetSuccess()) { + List<Image> __this__success = new ArrayList<Image>(other.success.size()); + for (Image other_element : other.success) { + __this__success.add(new Image(other_element)); + } + this.success = __this__success; + } + } + + public getImageListPermissionLink_result deepCopy() { + return new getImageListPermissionLink_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public java.util.Iterator<Image> getSuccessIterator() { + return (this.success == null) ? null : this.success.iterator(); + } + + public void addToSuccess(Image elem) { + if (this.success == null) { + this.success = new ArrayList<Image>(); + } + this.success.add(elem); + } + + public List<Image> getSuccess() { + return this.success; + } + + public getImageListPermissionLink_result setSuccess(List<Image> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Image>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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 getImageListPermissionLink_result) + return this.equals((getImageListPermissionLink_result)that); + return false; + } + + public boolean equals(getImageListPermissionLink_result that) { + if (that == null) + return false; + + 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.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getImageListPermissionLink_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("getImageListPermissionLink_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + 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 { + 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 getImageListPermissionLink_resultStandardSchemeFactory implements SchemeFactory { + public getImageListPermissionLink_resultStandardScheme getScheme() { + return new getImageListPermissionLink_resultStandardScheme(); + } + } + + private static class getImageListPermissionLink_resultStandardScheme extends StandardScheme<getImageListPermissionLink_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getImageListPermissionLink_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.LIST) { + { + org.apache.thrift.protocol.TList _list16 = iprot.readListBegin(); + struct.success = new ArrayList<Image>(_list16.size); + for (int _i17 = 0; _i17 < _list16.size; ++_i17) + { + Image _elem18; + _elem18 = new Image(); + _elem18.read(iprot); + struct.success.add(_elem18); + } + iprot.readListEnd(); + } + 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, getImageListPermissionLink_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Image _iter19 : struct.success) + { + _iter19.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getImageListPermissionLink_resultTupleSchemeFactory implements SchemeFactory { + public getImageListPermissionLink_resultTupleScheme getScheme() { + return new getImageListPermissionLink_resultTupleScheme(); + } + } + + private static class getImageListPermissionLink_resultTupleScheme extends TupleScheme<getImageListPermissionLink_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionLink_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.writeI32(struct.success.size()); + for (Image _iter20 : struct.success) + { + _iter20.write(oprot); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getImageListPermissionLink_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 _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Image>(_list21.size); + for (int _i22 = 0; _i22 < _list21.size; ++_i22) + { + Image _elem23; + _elem23 = new Image(); + _elem23.read(iprot); + struct.success.add(_elem23); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + public static class getLectureList_args implements org.apache.thrift.TBase<getLectureList_args, getLectureList_args._Fields>, java.io.Serializable, Cloneable, Comparable<getLectureList_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getLectureList_args"); @@ -9476,14 +11512,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list8 = iprot.readListBegin(); - struct.success = new ArrayList<Lecture>(_list8.size); - for (int _i9 = 0; _i9 < _list8.size; ++_i9) + org.apache.thrift.protocol.TList _list24 = iprot.readListBegin(); + struct.success = new ArrayList<Lecture>(_list24.size); + for (int _i25 = 0; _i25 < _list24.size; ++_i25) { - Lecture _elem10; - _elem10 = new Lecture(); - _elem10.read(iprot); - struct.success.add(_elem10); + Lecture _elem26; + _elem26 = new Lecture(); + _elem26.read(iprot); + struct.success.add(_elem26); } iprot.readListEnd(); } @@ -9511,9 +11547,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 (Lecture _iter11 : struct.success) + for (Lecture _iter27 : struct.success) { - _iter11.write(oprot); + _iter27.write(oprot); } oprot.writeListEnd(); } @@ -9544,9 +11580,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Lecture _iter12 : struct.success) + for (Lecture _iter28 : struct.success) { - _iter12.write(oprot); + _iter28.write(oprot); } } } @@ -9558,14 +11594,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list13 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Lecture>(_list13.size); - for (int _i14 = 0; _i14 < _list13.size; ++_i14) + org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Lecture>(_list29.size); + for (int _i30 = 0; _i30 < _list29.size; ++_i30) { - Lecture _elem15; - _elem15 = new Lecture(); - _elem15.read(iprot); - struct.success.add(_elem15); + Lecture _elem31; + _elem31 = new Lecture(); + _elem31.read(iprot); + struct.success.add(_elem31); } } struct.setSuccessIsSet(true); @@ -10127,13 +12163,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list16 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list16.size); - for (int _i17 = 0; _i17 < _list16.size; ++_i17) + org.apache.thrift.protocol.TList _list32 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list32.size); + for (int _i33 = 0; _i33 < _list32.size; ++_i33) { - String _elem18; - _elem18 = iprot.readString(); - struct.success.add(_elem18); + String _elem34; + _elem34 = iprot.readString(); + struct.success.add(_elem34); } iprot.readListEnd(); } @@ -10161,9 +12197,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter19 : struct.success) + for (String _iter35 : struct.success) { - oprot.writeString(_iter19); + oprot.writeString(_iter35); } oprot.writeListEnd(); } @@ -10194,9 +12230,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter20 : struct.success) + for (String _iter36 : struct.success) { - oprot.writeString(_iter20); + oprot.writeString(_iter36); } } } @@ -10208,13 +12244,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list21 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list21.size); - for (int _i22 = 0; _i22 < _list21.size; ++_i22) + org.apache.thrift.protocol.TList _list37 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list37.size); + for (int _i38 = 0; _i38 < _list37.size; ++_i38) { - String _elem23; - _elem23 = iprot.readString(); - struct.success.add(_elem23); + String _elem39; + _elem39 = iprot.readString(); + struct.success.add(_elem39); } } struct.setSuccessIsSet(true); @@ -10776,13 +12812,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list24 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list24.size); - for (int _i25 = 0; _i25 < _list24.size; ++_i25) + org.apache.thrift.protocol.TList _list40 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list40.size); + for (int _i41 = 0; _i41 < _list40.size; ++_i41) { - String _elem26; - _elem26 = iprot.readString(); - struct.success.add(_elem26); + String _elem42; + _elem42 = iprot.readString(); + struct.success.add(_elem42); } iprot.readListEnd(); } @@ -10810,9 +12846,9 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (String _iter27 : struct.success) + for (String _iter43 : struct.success) { - oprot.writeString(_iter27); + oprot.writeString(_iter43); } oprot.writeListEnd(); } @@ -10843,9 +12879,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter28 : struct.success) + for (String _iter44 : struct.success) { - oprot.writeString(_iter28); + oprot.writeString(_iter44); } } } @@ -10857,13 +12893,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list29 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list29.size); - for (int _i30 = 0; _i30 < _list29.size; ++_i30) + org.apache.thrift.protocol.TList _list45 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list45.size); + for (int _i46 = 0; _i46 < _list45.size; ++_i46) { - String _elem31; - _elem31 = iprot.readString(); - struct.success.add(_elem31); + String _elem47; + _elem47 = iprot.readString(); + struct.success.add(_elem47); } } struct.setSuccessIsSet(true); @@ -11630,15 +13666,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map32 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map32.size); - for (int _i33 = 0; _i33 < _map32.size; ++_i33) + org.apache.thrift.protocol.TMap _map48 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map48.size); + for (int _i49 = 0; _i49 < _map48.size; ++_i49) { - String _key34; - String _val35; - _key34 = iprot.readString(); - _val35 = iprot.readString(); - struct.success.put(_key34, _val35); + String _key50; + String _val51; + _key50 = iprot.readString(); + _val51 = iprot.readString(); + struct.success.put(_key50, _val51); } iprot.readMapEnd(); } @@ -11666,10 +13702,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter36 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter52 : struct.success.entrySet()) { - oprot.writeString(_iter36.getKey()); - oprot.writeString(_iter36.getValue()); + oprot.writeString(_iter52.getKey()); + oprot.writeString(_iter52.getValue()); } oprot.writeMapEnd(); } @@ -11700,10 +13736,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter37 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter53 : struct.success.entrySet()) { - oprot.writeString(_iter37.getKey()); - oprot.writeString(_iter37.getValue()); + oprot.writeString(_iter53.getKey()); + oprot.writeString(_iter53.getValue()); } } } @@ -11715,15 +13751,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map38 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map38.size); - for (int _i39 = 0; _i39 < _map38.size; ++_i39) + org.apache.thrift.protocol.TMap _map54 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map54.size); + for (int _i55 = 0; _i55 < _map54.size; ++_i55) { - String _key40; - String _val41; - _key40 = iprot.readString(); - _val41 = iprot.readString(); - struct.success.put(_key40, _val41); + String _key56; + String _val57; + _key56 = iprot.readString(); + _val57 = iprot.readString(); + struct.success.put(_key56, _val57); } } struct.setSuccessIsSet(true); @@ -15204,15 +17240,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map42 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map42.size); - for (int _i43 = 0; _i43 < _map42.size; ++_i43) + org.apache.thrift.protocol.TMap _map58 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map58.size); + for (int _i59 = 0; _i59 < _map58.size; ++_i59) { - String _key44; - String _val45; - _key44 = iprot.readString(); - _val45 = iprot.readString(); - struct.success.put(_key44, _val45); + String _key60; + String _val61; + _key60 = iprot.readString(); + _val61 = iprot.readString(); + struct.success.put(_key60, _val61); } iprot.readMapEnd(); } @@ -15240,10 +17276,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter46 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter62 : struct.success.entrySet()) { - oprot.writeString(_iter46.getKey()); - oprot.writeString(_iter46.getValue()); + oprot.writeString(_iter62.getKey()); + oprot.writeString(_iter62.getValue()); } oprot.writeMapEnd(); } @@ -15274,10 +17310,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter47 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter63 : struct.success.entrySet()) { - oprot.writeString(_iter47.getKey()); - oprot.writeString(_iter47.getValue()); + oprot.writeString(_iter63.getKey()); + oprot.writeString(_iter63.getValue()); } } } @@ -15289,15 +17325,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map48 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map48.size); - for (int _i49 = 0; _i49 < _map48.size; ++_i49) + org.apache.thrift.protocol.TMap _map64 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map64.size); + for (int _i65 = 0; _i65 < _map64.size; ++_i65) { - String _key50; - String _val51; - _key50 = iprot.readString(); - _val51 = iprot.readString(); - struct.success.put(_key50, _val51); + String _key66; + String _val67; + _key66 = iprot.readString(); + _val67 = iprot.readString(); + struct.success.put(_key66, _val67); } } struct.setSuccessIsSet(true); @@ -15964,15 +18000,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map52 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map52.size); - for (int _i53 = 0; _i53 < _map52.size; ++_i53) + org.apache.thrift.protocol.TMap _map68 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map68.size); + for (int _i69 = 0; _i69 < _map68.size; ++_i69) { - String _key54; - String _val55; - _key54 = iprot.readString(); - _val55 = iprot.readString(); - struct.success.put(_key54, _val55); + String _key70; + String _val71; + _key70 = iprot.readString(); + _val71 = iprot.readString(); + struct.success.put(_key70, _val71); } iprot.readMapEnd(); } @@ -16000,10 +18036,10 @@ public class Server { oprot.writeFieldBegin(SUCCESS_FIELD_DESC); { oprot.writeMapBegin(new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, struct.success.size())); - for (Map.Entry<String, String> _iter56 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter72 : struct.success.entrySet()) { - oprot.writeString(_iter56.getKey()); - oprot.writeString(_iter56.getValue()); + oprot.writeString(_iter72.getKey()); + oprot.writeString(_iter72.getValue()); } oprot.writeMapEnd(); } @@ -16034,10 +18070,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter57 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter73 : struct.success.entrySet()) { - oprot.writeString(_iter57.getKey()); - oprot.writeString(_iter57.getValue()); + oprot.writeString(_iter73.getKey()); + oprot.writeString(_iter73.getValue()); } } } @@ -16049,15 +18085,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map58 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new HashMap<String,String>(2*_map58.size); - for (int _i59 = 0; _i59 < _map58.size; ++_i59) + org.apache.thrift.protocol.TMap _map74 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new HashMap<String,String>(2*_map74.size); + for (int _i75 = 0; _i75 < _map74.size; ++_i75) { - String _key60; - String _val61; - _key60 = iprot.readString(); - _val61 = iprot.readString(); - struct.success.put(_key60, _val61); + String _key76; + String _val77; + _key76 = iprot.readString(); + _val77 = iprot.readString(); + struct.success.put(_key76, _val77); } } struct.setSuccessIsSet(true); @@ -28770,14 +30806,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list62 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list62.size); - for (int _i63 = 0; _i63 < _list62.size; ++_i63) + org.apache.thrift.protocol.TList _list78 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list78.size); + for (int _i79 = 0; _i79 < _list78.size; ++_i79) { - Person _elem64; - _elem64 = new Person(); - _elem64.read(iprot); - struct.success.add(_elem64); + Person _elem80; + _elem80 = new Person(); + _elem80.read(iprot); + struct.success.add(_elem80); } iprot.readListEnd(); } @@ -28805,9 +30841,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 _iter65 : struct.success) + for (Person _iter81 : struct.success) { - _iter65.write(oprot); + _iter81.write(oprot); } oprot.writeListEnd(); } @@ -28838,9 +30874,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter66 : struct.success) + for (Person _iter82 : struct.success) { - _iter66.write(oprot); + _iter82.write(oprot); } } } @@ -28852,14 +30888,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list67 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list67.size); - for (int _i68 = 0; _i68 < _list67.size; ++_i68) + org.apache.thrift.protocol.TList _list83 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list83.size); + for (int _i84 = 0; _i84 < _list83.size; ++_i84) { - Person _elem69; - _elem69 = new Person(); - _elem69.read(iprot); - struct.success.add(_elem69); + Person _elem85; + _elem85 = new Person(); + _elem85.read(iprot); + struct.success.add(_elem85); } } struct.setSuccessIsSet(true); @@ -30057,4 +32093,866 @@ 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"); + + 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 getPermissionForUserAndImage_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getPermissionForUserAndImage_argsTupleSchemeFactory()); + } + + public String userID; // 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 { + USER_ID((short)1, "userID"), + IMAGE_ID((short)2, "imageID"); + + 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: // USER_ID + return USER_ID; + case 2: // IMAGE_ID + return IMAGE_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.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, + 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); + } + + public getPermissionForUserAndImage_args() { + } + + public getPermissionForUserAndImage_args( + String userID, + String imageID) + { + this(); + this.userID = userID; + this.imageID = imageID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getPermissionForUserAndImage_args(getPermissionForUserAndImage_args other) { + if (other.isSetUserID()) { + this.userID = other.userID; + } + if (other.isSetImageID()) { + this.imageID = other.imageID; + } + } + + public getPermissionForUserAndImage_args deepCopy() { + return new getPermissionForUserAndImage_args(this); + } + + @Override + public void clear() { + this.userID = null; + this.imageID = null; + } + + public String getUserID() { + return this.userID; + } + + public getPermissionForUserAndImage_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 String getImageID() { + return this.imageID; + } + + public getPermissionForUserAndImage_args setImageID(String imageID) { + this.imageID = imageID; + return this; + } + + public void unsetImageID() { + this.imageID = null; + } + + /** Returns true if field imageID is set (has been assigned a value) and false otherwise */ + public boolean isSetImageID() { + return this.imageID != null; + } + + public void setImageIDIsSet(boolean value) { + if (!value) { + this.imageID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case USER_ID: + if (value == null) { + unsetUserID(); + } else { + setUserID((String)value); + } + break; + + case IMAGE_ID: + if (value == null) { + unsetImageID(); + } else { + setImageID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case USER_ID: + return getUserID(); + + case IMAGE_ID: + return getImageID(); + + } + 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 USER_ID: + return isSetUserID(); + case IMAGE_ID: + return isSetImageID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getPermissionForUserAndImage_args) + return this.equals((getPermissionForUserAndImage_args)that); + return false; + } + + public boolean equals(getPermissionForUserAndImage_args that) { + if (that == null) + 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_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.imageID.equals(that.imageID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getPermissionForUserAndImage_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + 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(isSetImageID()).compareTo(other.isSetImageID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetImageID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.imageID, other.imageID); + 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("getPermissionForUserAndImage_args("); + boolean first = true; + + sb.append("userID:"); + if (this.userID == null) { + sb.append("null"); + } else { + sb.append(this.userID); + } + first = false; + if (!first) sb.append(", "); + sb.append("imageID:"); + if (this.imageID == null) { + sb.append("null"); + } else { + sb.append(this.imageID); + } + 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 getPermissionForUserAndImage_argsStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_argsStandardScheme getScheme() { + return new getPermissionForUserAndImage_argsStandardScheme(); + } + } + + private static class getPermissionForUserAndImage_argsStandardScheme extends StandardScheme<getPermissionForUserAndImage_args> { + + 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) + { + schemeField = iprot.readFieldBegin(); + if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { + break; + } + switch (schemeField.id) { + case 1: // 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 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); + } + 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, getPermissionForUserAndImage_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.userID != null) { + oprot.writeFieldBegin(USER_ID_FIELD_DESC); + oprot.writeString(struct.userID); + 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 getPermissionForUserAndImage_argsTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_argsTupleScheme getScheme() { + return new getPermissionForUserAndImage_argsTupleScheme(); + } + } + + private static class getPermissionForUserAndImage_argsTupleScheme extends TupleScheme<getPermissionForUserAndImage_args> { + + @Override + 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.isSetUserID()) { + optionals.set(0); + } + if (struct.isSetImageID()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetUserID()) { + oprot.writeString(struct.userID); + } + if (struct.isSetImageID()) { + oprot.writeString(struct.imageID); + } + } + + @Override + 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(2); + if (incoming.get(0)) { + struct.userID = iprot.readString(); + struct.setUserIDIsSet(true); + } + if (incoming.get(1)) { + struct.imageID = iprot.readString(); + struct.setImageIDIsSet(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"); + + 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()); + } + + 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 { + 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 + 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.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); + } + + public getPermissionForUserAndImage_result() { + } + + public getPermissionForUserAndImage_result( + List<Person> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + 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 getPermissionForUserAndImage_result deepCopy() { + return new getPermissionForUserAndImage_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + 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 getPermissionForUserAndImage_result setSuccess(List<Person> success) { + this.success = success; + return this; + } + + public void unsetSuccess() { + this.success = null; + } + + /** Returns true if field success is set (has been assigned a value) and false otherwise */ + public boolean isSetSuccess() { + return this.success != null; + } + + public void setSuccessIsSet(boolean value) { + if (!value) { + this.success = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case SUCCESS: + if (value == null) { + unsetSuccess(); + } else { + setSuccess((List<Person>)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case SUCCESS: + return getSuccess(); + + } + 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 getPermissionForUserAndImage_result) + return this.equals((getPermissionForUserAndImage_result)that); + return false; + } + + public boolean equals(getPermissionForUserAndImage_result that) { + if (that == null) + return false; + + 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.equals(that.success)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getPermissionForUserAndImage_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("getPermissionForUserAndImage_result("); + boolean first = true; + + sb.append("success:"); + if (this.success == null) { + sb.append("null"); + } else { + 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 { + 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 getPermissionForUserAndImage_resultStandardSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_resultStandardScheme getScheme() { + return new getPermissionForUserAndImage_resultStandardScheme(); + } + } + + private static class getPermissionForUserAndImage_resultStandardScheme extends StandardScheme<getPermissionForUserAndImage_result> { + + 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) + { + 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.LIST) { + { + org.apache.thrift.protocol.TList _list86 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list86.size); + for (int _i87 = 0; _i87 < _list86.size; ++_i87) + { + Person _elem88; + _elem88 = new Person(); + _elem88.read(iprot); + struct.success.add(_elem88); + } + iprot.readListEnd(); + } + 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, getPermissionForUserAndImage_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + oprot.writeFieldBegin(SUCCESS_FIELD_DESC); + { + oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.success.size())); + for (Person _iter89 : struct.success) + { + _iter89.write(oprot); + } + oprot.writeListEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getPermissionForUserAndImage_resultTupleSchemeFactory implements SchemeFactory { + public getPermissionForUserAndImage_resultTupleScheme getScheme() { + return new getPermissionForUserAndImage_resultTupleScheme(); + } + } + + private static class getPermissionForUserAndImage_resultTupleScheme extends TupleScheme<getPermissionForUserAndImage_result> { + + @Override + 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()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetSuccess()) { + { + oprot.writeI32(struct.success.size()); + for (Person _iter90 : struct.success) + { + _iter90.write(oprot); + } + } + } + } + + @Override + 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)) { + { + org.apache.thrift.protocol.TList _list91 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list91.size); + for (int _i92 = 0; _i92 < _list91.size; ++_i92) + { + Person _elem93; + _elem93 = new Person(); + _elem93.read(iprot); + struct.success.add(_elem93); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + } diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 93634bfe..80e19ea4 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -332,22 +332,20 @@ public class SQL { }
- public List<Image> getImageList() {
+ public List<Image> getImageListPermissionWrite(String userID) {
Connection con=getConnection();
Statement stm;
+
List<Image> list = new ArrayList<Image>();
try {
stm = con.createStatement();
- ResultSet res=stm
- .executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
-
-
- while (res.next()) {
-
-
+ //ResultSet res=stm.executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image as pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
+ ResultSet res = stm.executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"+userID+"' AND u.userID = pmi.userID AND pmi.image_write = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+
+ while (res.next()) {
list.add(new Image(res.getString("GUID_imageID"), res
.getString("imageVersion"),
res.getString("image_name"), res
@@ -355,19 +353,79 @@ public class SQL { .getString("name")+" "+res.getString("architecture")+" bit", res.getString("lecture"),
res.getString("image_update_time"), res
.getString("user"), res.getString("image_isTemplate")));
-
}
-
con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
-
return list;
+ }
+
+
+ public List<Image> getImageListPermissionRead(String userID) {
+
+ Connection con=getConnection();
+ Statement stm;
+
+ List<Image> list = new ArrayList<Image>();
+ try {
+
+ stm = con.createStatement();
+
+ //ResultSet res=stm.executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image as pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
+ ResultSet res = stm.executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"+userID+"' AND u.userID = pmi.userID AND pmi.image_read = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+
+ while (res.next()) {
+ list.add(new Image(res.getString("GUID_imageID"), res
+ .getString("imageVersion"),
+ res.getString("image_name"), res
+ .getString("cond_hasLicenseRestriction"), res
+ .getString("name")+" "+res.getString("architecture")+" bit", res.getString("lecture"),
+ res.getString("image_update_time"), res
+ .getString("user"), res.getString("image_isTemplate")));
+ }
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+
+public List<Image> getImageListPermissionLink(String userID) {
+
+ Connection con=getConnection();
+ Statement stm;
+
+ List<Image> list = new ArrayList<Image>();
+ try {
+
+ stm = con.createStatement();
+
+ //ResultSet res=stm.executeQuery("SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, '' as lecture,vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image as pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and vl.image_owner=u.userID and vl.image_name not in (SELECT vl.image_name FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID) union SELECT vl.GUID_imageID, vl.imageVersion,vl.image_name, vl.cond_hasLicenseRestriction, os.name,os.architecture, lect.name as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_VLData_lecture lect, bwLehrpool.m_user u Where vl.content_operatingSystem=os.operatingSystemID and lect.imageID=vl.GUID_imageID and vl.image_owner=u.userID;");
+ ResultSet res = stm.executeQuery("SELECT DISTINCT vl.GUID_imageID, vl.imageVersion, vl.image_name, vl.cond_hasLicenseRestriction, os.name, os.architecture, '' as lecture, vl.image_update_time, Concat(u.Nachname,' ',u.Vorname) as user, vl.image_isTemplate FROM bwLehrpool.pm_VLData_image pmi, bwLehrpool.m_VLData_imageInfo vl, bwLehrpool.m_operatingSystem os, bwLehrpool.m_user u WHERE pmi.userID='"+userID+"' AND u.userID = pmi.userID AND pmi.link_allowed = 1 AND pmi.GUID_imageID = vl.GUID_imageID AND vl.content_operatingSystem=os.operatingSystemID;");
+
+ while (res.next()) {
+ list.add(new Image(res.getString("GUID_imageID"), res
+ .getString("imageVersion"),
+ res.getString("image_name"), res
+ .getString("cond_hasLicenseRestriction"), res
+ .getString("name")+" "+res.getString("architecture")+" bit", res.getString("lecture"),
+ res.getString("image_update_time"), res
+ .getString("user"), res.getString("image_isTemplate")));
+ }
+ con.close();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
}
+
+
+
public List<Lecture> getLectureList() {
List<Lecture> list = new ArrayList<Lecture>();
@@ -1054,16 +1112,15 @@ public class SQL { return id;
}
- //get all users from HS OG -- temp, tb replaced by allUsers bwLehrpool
+ //get all users from satellite -- temp, tb replaced by allUsers bwLehrpool
//does -NOT- return the user himself
public List<Person> getAllOtherSatelliteUsers(String userID){
Connection con=getConnection();
Statement stm=null;
ResultSet res = null;
- //Map<String, String> map = new HashMap<String, String>();
+
List<Person> list = new ArrayList<Person>();
-
try {
stm = con.createStatement();
} catch (SQLException e) {
@@ -1076,26 +1133,64 @@ public class SQL { // TODO Auto-generated catch block
e.printStackTrace();
}
-
try {
while (res.next()) {
-
-
+ //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("Vorname"), false, false, false, false, false, false, false));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
-
return list;
-
- }
+ }//end getAllOtherSatelliteUsers()
+
+ // get the permissions of an image or a lecture 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 {
+ stm = con.createStatement();
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ 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!='"+userID+"' AND pmi.GUID_imageID='"+imageID+"' AND pmi.userID=u.userID AND pmi.image_write=1 ORDER BY u.Nachname ASC;");
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ try {
+ while (res.next()) {
+ //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(res.getString("image_read")),
+ Boolean.parseBoolean(res.getString("image_write")),
+ Boolean.parseBoolean(res.getString("image_admin")),
+ Boolean.parseBoolean(res.getString("link_allowed")),
+ false, //lecture_read
+ false, //lecture_write
+ false) //lecture_admin
+ );
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }//end getAllOtherSatelliteUsers()
+
+
public boolean updateImagePermissions(){
boolean success=true;
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift index 3ac11d68..2fd09762 100644 --- a/dozentenmodulserver/thrift/server.thrift +++ b/dozentenmodulserver/thrift/server.thrift @@ -37,14 +37,22 @@ 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 } - service Server{ User getFtpUser(), int DeleteFtpUser(1: string user), string getPathOfImage(1: string image_id, 2: string version), bool writeVLdata(1: string imagename, 2: string desc, 3: string login, 4: string firstname, 5: string lastname, 6: string university, 7: string Mail, 8: string Tel, 9: string Fak, 10: bool license, 11: bool internet, 12: int ram, 13: int cpu, 14: string imagePath, 15: bool isTemplate, 16: i64 filesize, 17: int shareMode, 18: string os), - list<Image> getImageList(), + list<Image> getImageListPermissionWrite(1: string userID), + list<Image> getImageListPermissionRead(1: string userID), + list<Image> getImageListPermissionLink(1: string userID), list<Lecture> getLectureList(), list<string> getAllOS(), list<string> getAllUniversities(), @@ -65,4 +73,5 @@ service Server{ 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), + list<Person>getPermissionForUserAndImage(1: string userID, 2: string imageID), } |
