diff options
12 files changed, 1371 insertions, 356 deletions
diff --git a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java index 778fbed1..28dae62b 100644 --- a/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/EditImageAllgemein_GUI.java @@ -37,6 +37,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import models.Image; +import models.ItemOwner; import models.Links; import models.person; @@ -104,7 +105,6 @@ public class EditImageAllgemein_GUI extends JFrame { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block e.printStackTrace(); } // Setzt den Fenstertitel @@ -159,8 +159,8 @@ public class EditImageAllgemein_GUI extends JFrame { Vorname.setEditable(false); Vorname.setEnabled(false); Vorname.setBackground(Color.WHITE); - Vorname.setText(person.verantwortlicher.getVorname()); - //Vorname.setText(Image.image.get); + //Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setText(ItemOwner.itemOwner.getVorname()); Vorname.setColumns(10); Vorname.setBounds(145, 245, 350, 20); panel_1.add(Vorname); @@ -174,7 +174,8 @@ public class EditImageAllgemein_GUI extends JFrame { Nachname.setEnabled(false); Nachname.setEditable(false); Nachname.setBackground(Color.WHITE); - Nachname.setText(person.verantwortlicher.getName()); + //Nachname.setText(person.verantwortlicher.getName()); + Nachname.setText(ItemOwner.itemOwner.getNachname()); Nachname.setColumns(10); Nachname.setBounds(145, 276, 350, 20); panel_1.add(Nachname); @@ -188,7 +189,8 @@ public class EditImageAllgemein_GUI extends JFrame { Hochschule.setEnabled(false); Hochschule.setEditable(false); Hochschule.setBackground(Color.WHITE); - Hochschule.setText(person.verantwortlicher.getHochschule()); + //Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setText(ItemOwner.itemOwner.getHochschule()); Hochschule.setColumns(10); Hochschule.setBounds(145, 307, 350, 20); panel_1.add(Hochschule); @@ -202,7 +204,8 @@ public class EditImageAllgemein_GUI extends JFrame { EMail.setEnabled(false); EMail.setEditable(false); EMail.setBackground(Color.WHITE); - EMail.setText(person.verantwortlicher.getEMail()); + //EMail.setText(person.verantwortlicher.getEMail()); + EMail.setText(ItemOwner.itemOwner.getEmail()); EMail.setColumns(10); EMail.setBounds(145, 338, 350, 20); panel_1.add(EMail); @@ -385,11 +388,8 @@ public class EditImageAllgemein_GUI extends JFrame { URI windows; try { windows = new URI(Links.getFAQ()); - open.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -407,11 +407,8 @@ public class EditImageAllgemein_GUI extends JFrame { URI windows; try { windows = new URI(Links.getOTRS()); - open.openWebpage(windows); - } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -427,14 +424,7 @@ public class EditImageAllgemein_GUI extends JFrame { } }); mnNewMenu_1.add(menuItem); - // setFocusTraversalPolicy(new FocusTraversalOnArray(new - // Component[]{getContentPane(), panel_2, lblNewLabel, - // txtpnBitteWhlenSie, contentPanel, panel_1, label, Vorname, label_7, - // Nachname, label_8, Hochschule, label_9, EMail, lblImagename, - // imagename, txtrGebenSieBitte, panel, lblPflichtfelder, lblHauptmen, - // label_1, lblVlimage, label_2, lblNewLabel_1, buttonPane, backButton, - // okButton, separator, separator_1, menuBar, mnNewMenu_1, mntmFaq, - // mntmOtrs})); + JMenu mnNewMenu_Info = new JMenu("Info"); mnNewMenu_Info.addMouseListener(new MouseAdapter() { @Override @@ -484,7 +474,6 @@ public class EditImageAllgemein_GUI extends JFrame { Image.image.setShareMode(mode); Image.image.setOS(map.get("os")); } catch (TException e) { - // TODO Auto-generated catch block e.printStackTrace(); JOptionPane.showMessageDialog(c, e.getCause() + "\n" + e.getStackTrace(), "Debug-Message", diff --git a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java index 95f261c2..348828fe 100644 --- a/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/FTPEditUploader_GUI.java @@ -659,7 +659,6 @@ public class FTPEditUploader_GUI extends JFrame implements Image.image.getDesc(), //Image.image.getImagepath(), "temp/"+Image.image.getNewName(), - Image.image.isLicensed(), Image.image.isInternet(), Image.image.getRam(), @@ -681,15 +680,18 @@ public class FTPEditUploader_GUI extends JFrame implements Image.image.getImagename(), Image.image.getImagename(), Image.image.getDesc(), - //"temp/" + Image.image.getNewName(), //wrong Image.image.getImagepath(), - - Image.image.isLicensed(), Image.image.isInternet(), - Image.image.getRam(), Image.image.getCpu(), - Image.image.getImageId(), Image.image.getVersion(), - Image.image.isVorlage(), Image.image.getFilesize(), - Image.image.getShareMode(), Image.image.getOS()); + Image.image.isLicensed(), + Image.image.isInternet(), + Image.image.getRam(), + Image.image.getCpu(), + Image.image.getImageId(), + Image.image.getVersion(), + Image.image.isVorlage(), + Image.image.getFilesize(), + Image.image.getShareMode(), + Image.image.getOS()); if (fileupload == true) { client.startFileCopy(Image.image.getNewName()); @@ -697,7 +699,6 @@ public class FTPEditUploader_GUI extends JFrame implements } } - // set additional user rights - quick and dirty TODO refactor // remove all additional user permissions on first stage diff --git a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java index cfb83308..197068e8 100644 --- a/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java +++ b/dozentenmodul/src/main/java/gui/image/SearchEditImage_GUI.java @@ -21,6 +21,7 @@ import java.net.URISyntaxException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -53,6 +54,7 @@ import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; import models.Image; +import models.ItemOwner; import models.Links; import models.person; @@ -442,7 +444,12 @@ public class SearchEditImage_GUI extends JFrame { .convertRowIndexToModel(tablemyImages .getSelectedRow()), 7).toString(); + + //write the values into the information pane on the right hand side writeImageData(imageid, version); + + //fill the itemOwnder model with information from selected item + setItemOwnerInformation(imageid); } } }); @@ -673,7 +680,6 @@ public class SearchEditImage_GUI extends JFrame { open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } } @@ -694,7 +700,6 @@ public class SearchEditImage_GUI extends JFrame { open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -775,7 +780,6 @@ public class SearchEditImage_GUI extends JFrame { return model; } catch (TException | ParseException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); JOptionPane.showMessageDialog(c, e1.getCause() + "\n" + e1.getStackTrace(), "Debug-Message", @@ -846,10 +850,32 @@ public class SearchEditImage_GUI extends JFrame { } catch (TException | ParseException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } - } + }//end writeImageData + + + public void setItemOwnerInformation(String imageid){ + Map<String, String> map = new HashMap<String, String>(); + + try { + //get values from server and set them in model + map=client.getItemOwner(imageid); + + ItemOwner.itemOwner.setUserID(map.get("userID")); + ItemOwner.itemOwner.setUsername(map.get("loginName")); + ItemOwner.itemOwner.setNachname(map.get("Nachname")); + ItemOwner.itemOwner.setVorname(map.get("Vorname")); + ItemOwner.itemOwner.setEmail(map.get("mail")); + ItemOwner.itemOwner.setHochschule(map.get("institution")); + + + } catch (TException e) { + e.printStackTrace(); + } + + }//end setItemInformation + public static String byteToGigabyte(long bytes, boolean si) { int unit = si ? 1000 : 1024; @@ -857,5 +883,5 @@ public class SearchEditImage_GUI extends JFrame { int exp = (int) (Math.log(bytes) / Math.log(unit)); String pre = (si ? "kMGTPE" : "KMGTPE").charAt(exp-1) + (si ? "" : "i"); return String.format("%.1f %sB", bytes / Math.pow(unit, exp), pre); - } -} + }//end byteToGigabyte +}// 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 0f68de44..fa98d193 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.Image; import models.ImageRights; +import models.ItemOwner; import models.Lecture; import models.Links; import models.RightsManagement; @@ -139,12 +140,16 @@ public class MainMenue_GUI extends JFrame { panel.add(txtpnBitteWhlenSie); } - //reset the list of permissions every time the user goes back to the main menu + + + //reset the list of permissions and models + //every time the user goes back to the main menu RightsManagement.rightsManagement.getPermittedUserList().clear(); - //reset model Image.image.reset(); - //Lecture.lecture.reset(); + ItemOwner.itemOwner.reset(); + + setResizable(false); // window is not resizable contentPanel.setBounds(10, 104, 567, 502); diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java index 98e2d513..45d4b0e2 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureAllgemein_GUI.java @@ -40,6 +40,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import models.Image; +import models.ItemOwner; import models.Lecture; import models.Links; import models.person; @@ -101,7 +102,7 @@ public class EditLectureAllgemein_GUI extends JFrame { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } setTitle("bwLehrpool Suite - Veranstaltung bearbeiten"); @@ -153,7 +154,8 @@ public class EditLectureAllgemein_GUI extends JFrame { Vorname = new JTextField(); Vorname.setEditable(false); Vorname.setEnabled(false); - Vorname.setText(person.verantwortlicher.getVorname()); + //Vorname.setText(person.verantwortlicher.getVorname()); + Vorname.setText(ItemOwner.itemOwner.getVorname()); Vorname.setBackground(Color.WHITE); Vorname.setColumns(10); Vorname.setBounds(145, 33, 350, 20); @@ -167,7 +169,8 @@ public class EditLectureAllgemein_GUI extends JFrame { Nachname = new JTextField(); Nachname.setEnabled(false); Nachname.setEditable(false); - Nachname.setText(person.verantwortlicher.getName()); + //Nachname.setText(person.verantwortlicher.getName()); + Nachname.setText(ItemOwner.itemOwner.getNachname()); Nachname.setBackground(Color.WHITE); Nachname.setColumns(10); Nachname.setBounds(145, 64, 350, 20); @@ -181,7 +184,8 @@ public class EditLectureAllgemein_GUI extends JFrame { Hochschule = new JTextField(); Hochschule.setEnabled(false); Hochschule.setEditable(false); - Hochschule.setText(person.verantwortlicher.getHochschule()); + //Hochschule.setText(person.verantwortlicher.getHochschule()); + Hochschule.setText(ItemOwner.itemOwner.getHochschule()); Hochschule.setBackground(Color.WHITE); Hochschule.setColumns(10); Hochschule.setBounds(145, 95, 350, 20); @@ -195,7 +199,8 @@ public class EditLectureAllgemein_GUI extends JFrame { EMail = new JTextField(); EMail.setEnabled(false); EMail.setEditable(false); - EMail.setText(person.verantwortlicher.getEMail()); + //EMail.setText(person.verantwortlicher.getEMail()); + EMail.setText(ItemOwner.itemOwner.getEmail()); EMail.setBackground(Color.WHITE); EMail.setColumns(10); EMail.setBounds(145, 126, 350, 20); @@ -526,7 +531,7 @@ public class EditLectureAllgemein_GUI extends JFrame { windows = new URI(Links.getFAQ()); open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } } @@ -543,7 +548,7 @@ public class EditLectureAllgemein_GUI extends JFrame { windows = new URI(Links.getOTRS()); open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } } diff --git a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java index ca33dc3c..b6cb5f10 100644 --- a/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/EditLectureSearch_GUI.java @@ -22,6 +22,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -52,6 +53,7 @@ import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import models.ItemOwner; import models.Lecture; import models.Links; import models.person; @@ -135,7 +137,7 @@ public class EditLectureSearch_GUI extends JFrame { //initTableModel(modelAll); } catch (ParseException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } @@ -175,7 +177,7 @@ public class EditLectureSearch_GUI extends JFrame { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } // Setzt den Fenstertitel @@ -307,19 +309,25 @@ public class EditLectureSearch_GUI extends JFrame { if(tablemyLectures.getSelectedRow() != -1) { - String imageid = modelMyLectures.getValueAt( + String lectureid = modelMyLectures.getValueAt( tablemyLectures .convertRowIndexToModel(tablemyLectures .getSelectedRow()), 8) .toString(); try { - writeLectureData(imageid); + + //write the values into the information pane on the right hand side + writeLectureData(lectureid); + + //fill the itemOwnder model with information from selected item + setItemOwnerInformation(lectureid); + } catch (TException e1) { - // TODO Auto-generated catch block + e1.printStackTrace(); } catch (ParseException e1) { - // TODO Auto-generated catch block + e1.printStackTrace(); } } @@ -414,7 +422,7 @@ public class EditLectureSearch_GUI extends JFrame { enddate = out.format(in.parse(enddate)); startdate = out.format(in.parse(startdate)); } catch (ParseException e2) { - // TODO Auto-generated catch block + e2.printStackTrace(); } @@ -427,7 +435,7 @@ public class EditLectureSearch_GUI extends JFrame { Lecture.lecture.setStartdate(df .parse(startdate)); } catch (ParseException e1) { - // TODO Auto-generated catch block + e1.printStackTrace(); } if (modelMyLectures @@ -447,98 +455,7 @@ public class EditLectureSearch_GUI extends JFrame { el.setVisible(true); dispose(); } - /*else if (tableAllLectures.getSelectedRow() != -1 - && tableAllLectures - .getValueAt( - tableAllLectures - .getSelectedRow(), 5) - .toString().equals(username)) { - - // a row is selected, do operations - - Lecture.lecture.setid(modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 8).toString()); - Lecture.lecture.setName(modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 0).toString()); - Lecture.lecture.setDesc(modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 1).toString()); - String date = modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 2).toString(); - - Lecture.lecture.setLinkedImagename(modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 6).toString()); - - int zweitesLeerzeichen = date.indexOf(" ", - date.indexOf(" ") + 1); - - String startdate = date.substring(0, - zweitesLeerzeichen); - String enddate = date.substring(zweitesLeerzeichen); - SimpleDateFormat out = new SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat in = new SimpleDateFormat( - "dd.MM.yyyy HH:mm:ss"); - try { - enddate = out.format(in.parse(enddate)); - startdate = out.format(in.parse(startdate)); - } catch (ParseException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - DateFormat df = new SimpleDateFormat( - "yyyy-MM-dd HH:mm:ss"); - - try { - // Format has to be "yyyy-MM-dd HH:mm:ss" - Lecture.lecture.setEnddate(df.parse(enddate)); - Lecture.lecture.setStartdate(df - .parse(startdate)); - } catch (ParseException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - if (modelAll - .getValueAt( - tableAllLectures - .convertRowIndexToModel(tableAllLectures - .getSelectedRow()), - 3).toString().equals("1")) { - Lecture.lecture.setActive(true); - } else { - Lecture.lecture.setActive(false); - } - - EditLectureAllgemein_GUI el = new EditLectureAllgemein_GUI(); - el.setVisible(true); - dispose(); - } else { - JOptionPane - .showMessageDialog( - null, - "Bitte wählen Sie ein eigenes Image aus.", - "Message", - JOptionPane.INFORMATION_MESSAGE); - } // End Else */ + } // end action }); @@ -667,7 +584,7 @@ public class EditLectureSearch_GUI extends JFrame { open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } } @@ -688,7 +605,7 @@ public class EditLectureSearch_GUI extends JFrame { open.openWebpage(windows); } catch (URISyntaxException e) { - // TODO Auto-generated catch block + e.printStackTrace(); } @@ -754,7 +671,7 @@ public class EditLectureSearch_GUI extends JFrame { return model; } catch (TException e1) { - // TODO Auto-generated catch block + e1.printStackTrace(); } return model; @@ -790,6 +707,29 @@ public class EditLectureSearch_GUI extends JFrame { res.get("imagepath").indexOf("/") + 1)); labelimageversion.setText(res.get("imageversion")); - } + }//end writeLectureData + + public void setItemOwnerInformation(String lectureid){ + Map<String, String> map = new HashMap<String, String>(); + + try { + //get values from server and set them in model + map=client.getItemOwner(lectureid); + + ItemOwner.itemOwner.setUserID(map.get("userID")); + ItemOwner.itemOwner.setUsername(map.get("loginName")); + ItemOwner.itemOwner.setNachname(map.get("Nachname")); + ItemOwner.itemOwner.setVorname(map.get("Vorname")); + ItemOwner.itemOwner.setEmail(map.get("mail")); + ItemOwner.itemOwner.setHochschule(map.get("institution")); + + + + } catch (TException e) { + e.printStackTrace(); + } + + }//end setItemInformation + -} +}//end class diff --git a/dozentenmodul/src/main/java/models/ItemOwner.java b/dozentenmodul/src/main/java/models/ItemOwner.java new file mode 100644 index 00000000..3afb20d2 --- /dev/null +++ b/dozentenmodul/src/main/java/models/ItemOwner.java @@ -0,0 +1,74 @@ +package models; + +public class ItemOwner { + + private String userID; + private String username; + private String nachname; + private String vorname; + private String hochschule; + private String email; + + + public static ItemOwner itemOwner = new ItemOwner(); + + public String getUserID() { + return userID; + } + + public void setUserID(String userID) { + this.userID = userID; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getNachname() { + return nachname; + } + + public void setNachname(String nachname) { + this.nachname = nachname; + } + + public String getVorname() { + return vorname; + } + + public void setVorname(String vorname) { + this.vorname = vorname; + } + + public String getHochschule() { + return hochschule; + } + + public void setHochschule(String hochschule) { + this.hochschule = hochschule; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + + public void reset(){ + userID=null; + username=null; + nachname=null; + vorname=null; + hochschule=null; + email=null; + } + + +} diff --git a/dozentenmodul/src/main/java/models/person.java b/dozentenmodul/src/main/java/models/person.java index d1621d00..7bb48da2 100644 --- a/dozentenmodul/src/main/java/models/person.java +++ b/dozentenmodul/src/main/java/models/person.java @@ -64,13 +64,6 @@ public class person { this.image_write = image_write; } - /* - * public boolean isChangePermission() { return changePermission;} - * - * public void setChangePermission(boolean changePermission) { - * this.changePermission = changePermission;} - */ - public boolean isImageAdmin() { return image_admin; } diff --git a/dozentenmodulserver/src/main/java/server/ServerHandler.java b/dozentenmodulserver/src/main/java/server/ServerHandler.java index 179c2c1c..5676339a 100644 --- a/dozentenmodulserver/src/main/java/server/ServerHandler.java +++ b/dozentenmodulserver/src/main/java/server/ServerHandler.java @@ -84,7 +84,6 @@ public class ServerHandler implements Server.Iface { try { Runtime.getRuntime().exec("chmod 777 " + path); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } log.info("folder '" + path + "' successfully created"); @@ -119,7 +118,6 @@ public class ServerHandler implements Server.Iface { try { Runtime.getRuntime().exec("chmod 777 " + path); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } log.info("folder '" + path @@ -194,7 +192,6 @@ public class ServerHandler implements Server.Iface { imagePath, filesize, mode, pk_os); log.info("written VLdata"); - // TODO Auto-generated method stub return true; } @@ -271,13 +268,10 @@ public class ServerHandler implements Server.Iface { xml.create(name); log.info("XML created."); } catch (SQLException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { - // TODO Auto-generated catch block e.printStackTrace(); } catch (TransformerException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -303,7 +297,6 @@ public class ServerHandler implements Server.Iface { } } catch (IOException e) { - // TODO Auto-generated catch block log.info("Failed to move file."); e.printStackTrace(); } @@ -383,7 +376,6 @@ public class ServerHandler implements Server.Iface { try { FileUtils.forceDelete(tmpFile); } catch (IOException e1) { - // TODO Auto-generated catch block e1.printStackTrace(); } XMLCreator xml = new XMLCreator(sql.getConnection(), newName); @@ -391,7 +383,6 @@ public class ServerHandler implements Server.Iface { xml.create(newName); } catch (SQLException | ParserConfigurationException | TransformerException e) { - // TODO Auto-generated catch block e.printStackTrace(); } @@ -436,7 +427,6 @@ public class ServerHandler implements Server.Iface { @Override public boolean connectedToLecture(String id, String version) throws TException { - // TODO Auto-generated method stub return sql.connectedToLecture(id, version); } @@ -678,5 +668,10 @@ public class ServerHandler implements Server.Iface { return sql.getOsNameForGuestOs(guestOS); } + @Override + public Map<String, String> getItemOwner(String itemID) throws TException { + return sql.getItemOwner(itemID); + } + }// end class diff --git a/dozentenmodulserver/src/main/java/server/generated/Server.java b/dozentenmodulserver/src/main/java/server/generated/Server.java index fc1e7dae..b4458cc2 100644 --- a/dozentenmodulserver/src/main/java/server/generated/Server.java +++ b/dozentenmodulserver/src/main/java/server/generated/Server.java @@ -72,6 +72,8 @@ public class Server { public Map<String,String> getPersonData(String Vorname, String Nachname) throws org.apache.thrift.TException; + public Map<String,String> getItemOwner(String itemID) throws org.apache.thrift.TException; + public void setPerson(String login, String lastname, String firstname, String mail, String Institution) throws org.apache.thrift.TException; public boolean writeLecturedata(String name, String shortdesc, String desc, String startDate, String endDate, boolean isActive, String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak) throws org.apache.thrift.TException; @@ -160,6 +162,8 @@ public class Server { public void getPersonData(String Vorname, String Nachname, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void getItemOwner(String itemID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void setPerson(String login, String lastname, String firstname, String mail, String Institution, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void writeLecturedata(String name, String shortdesc, String desc, String startDate, String endDate, boolean isActive, String imagename, String login, String firstname, String lastname, String university, String Mail, String Tel, String Fak, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -658,6 +662,29 @@ public class Server { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getPersonData failed: unknown result"); } + public Map<String,String> getItemOwner(String itemID) throws org.apache.thrift.TException + { + send_getItemOwner(itemID); + return recv_getItemOwner(); + } + + public void send_getItemOwner(String itemID) throws org.apache.thrift.TException + { + getItemOwner_args args = new getItemOwner_args(); + args.setItemID(itemID); + sendBase("getItemOwner", args); + } + + public Map<String,String> recv_getItemOwner() throws org.apache.thrift.TException + { + getItemOwner_result result = new getItemOwner_result(); + receiveBase(result, "getItemOwner"); + if (result.isSetSuccess()) { + return result.success; + } + throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "getItemOwner failed: unknown result"); + } + public void setPerson(String login, String lastname, String firstname, String mail, String Institution) throws org.apache.thrift.TException { send_setPerson(login, lastname, firstname, mail, Institution); @@ -1918,6 +1945,38 @@ public class Server { } } + public void getItemOwner(String itemID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { + checkReady(); + getItemOwner_call method_call = new getItemOwner_call(itemID, resultHandler, this, ___protocolFactory, ___transport); + this.___currentMethod = method_call; + ___manager.call(method_call); + } + + public static class getItemOwner_call extends org.apache.thrift.async.TAsyncMethodCall { + private String itemID; + public getItemOwner_call(String itemID, 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.itemID = itemID; + } + + public void write_args(org.apache.thrift.protocol.TProtocol prot) throws org.apache.thrift.TException { + prot.writeMessageBegin(new org.apache.thrift.protocol.TMessage("getItemOwner", org.apache.thrift.protocol.TMessageType.CALL, 0)); + getItemOwner_args args = new getItemOwner_args(); + args.setItemID(itemID); + args.write(prot); + prot.writeMessageEnd(); + } + + public Map<String,String> 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_getItemOwner(); + } + } + public void setPerson(String login, String lastname, String firstname, String mail, String Institution, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException { checkReady(); setPerson_call method_call = new setPerson_call(login, lastname, firstname, mail, Institution, resultHandler, this, ___protocolFactory, ___transport); @@ -2960,6 +3019,7 @@ public class Server { processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); processMap.put("getPersonData", new getPersonData()); + processMap.put("getItemOwner", new getItemOwner()); processMap.put("setPerson", new setPerson()); processMap.put("writeLecturedata", new writeLecturedata()); processMap.put("startFileCopy", new startFileCopy()); @@ -3349,6 +3409,26 @@ public class Server { } } + public static class getItemOwner<I extends Iface> extends org.apache.thrift.ProcessFunction<I, getItemOwner_args> { + public getItemOwner() { + super("getItemOwner"); + } + + public getItemOwner_args getEmptyArgsInstance() { + return new getItemOwner_args(); + } + + protected boolean isOneway() { + return false; + } + + public getItemOwner_result getResult(I iface, getItemOwner_args args) throws org.apache.thrift.TException { + getItemOwner_result result = new getItemOwner_result(); + result.success = iface.getItemOwner(args.itemID); + return result; + } + } + public static class setPerson<I extends Iface> extends org.apache.thrift.ProcessFunction<I, setPerson_args> { public setPerson() { super("setPerson"); @@ -3874,6 +3954,7 @@ public class Server { processMap.put("getAllOS", new getAllOS()); processMap.put("getAllUniversities", new getAllUniversities()); processMap.put("getPersonData", new getPersonData()); + processMap.put("getItemOwner", new getItemOwner()); processMap.put("setPerson", new setPerson()); processMap.put("writeLecturedata", new writeLecturedata()); processMap.put("startFileCopy", new startFileCopy()); @@ -4821,6 +4902,57 @@ public class Server { } } + public static class getItemOwner<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, getItemOwner_args, Map<String,String>> { + public getItemOwner() { + super("getItemOwner"); + } + + public getItemOwner_args getEmptyArgsInstance() { + return new getItemOwner_args(); + } + + public AsyncMethodCallback<Map<String,String>> getResultHandler(final AsyncFrameBuffer fb, final int seqid) { + final org.apache.thrift.AsyncProcessFunction fcall = this; + return new AsyncMethodCallback<Map<String,String>>() { + public void onComplete(Map<String,String> o) { + getItemOwner_result result = new getItemOwner_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; + getItemOwner_result result = new getItemOwner_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, getItemOwner_args args, org.apache.thrift.async.AsyncMethodCallback<Map<String,String>> resultHandler) throws TException { + iface.getItemOwner(args.itemID,resultHandler); + } + } + public static class setPerson<I extends AsyncIface> extends org.apache.thrift.AsyncProcessFunction<I, setPerson_args, Void> { public setPerson() { super("setPerson"); @@ -20819,6 +20951,766 @@ public class Server { } + public static class getItemOwner_args implements org.apache.thrift.TBase<getItemOwner_args, getItemOwner_args._Fields>, java.io.Serializable, Cloneable, Comparable<getItemOwner_args> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getItemOwner_args"); + + private static final org.apache.thrift.protocol.TField ITEM_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("itemID", 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 getItemOwner_argsStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getItemOwner_argsTupleSchemeFactory()); + } + + public String itemID; // 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 { + ITEM_ID((short)1, "itemID"); + + 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: // ITEM_ID + return ITEM_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.ITEM_ID, new org.apache.thrift.meta_data.FieldMetaData("itemID", 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(getItemOwner_args.class, metaDataMap); + } + + public getItemOwner_args() { + } + + public getItemOwner_args( + String itemID) + { + this(); + this.itemID = itemID; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getItemOwner_args(getItemOwner_args other) { + if (other.isSetItemID()) { + this.itemID = other.itemID; + } + } + + public getItemOwner_args deepCopy() { + return new getItemOwner_args(this); + } + + @Override + public void clear() { + this.itemID = null; + } + + public String getItemID() { + return this.itemID; + } + + public getItemOwner_args setItemID(String itemID) { + this.itemID = itemID; + return this; + } + + public void unsetItemID() { + this.itemID = null; + } + + /** Returns true if field itemID is set (has been assigned a value) and false otherwise */ + public boolean isSetItemID() { + return this.itemID != null; + } + + public void setItemIDIsSet(boolean value) { + if (!value) { + this.itemID = null; + } + } + + public void setFieldValue(_Fields field, Object value) { + switch (field) { + case ITEM_ID: + if (value == null) { + unsetItemID(); + } else { + setItemID((String)value); + } + break; + + } + } + + public Object getFieldValue(_Fields field) { + switch (field) { + case ITEM_ID: + return getItemID(); + + } + 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 ITEM_ID: + return isSetItemID(); + } + throw new IllegalStateException(); + } + + @Override + public boolean equals(Object that) { + if (that == null) + return false; + if (that instanceof getItemOwner_args) + return this.equals((getItemOwner_args)that); + return false; + } + + public boolean equals(getItemOwner_args that) { + if (that == null) + return false; + + boolean this_present_itemID = true && this.isSetItemID(); + boolean that_present_itemID = true && that.isSetItemID(); + if (this_present_itemID || that_present_itemID) { + if (!(this_present_itemID && that_present_itemID)) + return false; + if (!this.itemID.equals(that.itemID)) + return false; + } + + return true; + } + + @Override + public int hashCode() { + return 0; + } + + @Override + public int compareTo(getItemOwner_args other) { + if (!getClass().equals(other.getClass())) { + return getClass().getName().compareTo(other.getClass().getName()); + } + + int lastComparison = 0; + + lastComparison = Boolean.valueOf(isSetItemID()).compareTo(other.isSetItemID()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetItemID()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.itemID, other.itemID); + 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("getItemOwner_args("); + boolean first = true; + + sb.append("itemID:"); + if (this.itemID == null) { + sb.append("null"); + } else { + sb.append(this.itemID); + } + 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 getItemOwner_argsStandardSchemeFactory implements SchemeFactory { + public getItemOwner_argsStandardScheme getScheme() { + return new getItemOwner_argsStandardScheme(); + } + } + + private static class getItemOwner_argsStandardScheme extends StandardScheme<getItemOwner_args> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getItemOwner_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: // ITEM_ID + if (schemeField.type == org.apache.thrift.protocol.TType.STRING) { + struct.itemID = iprot.readString(); + struct.setItemIDIsSet(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, getItemOwner_args struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.itemID != null) { + oprot.writeFieldBegin(ITEM_ID_FIELD_DESC); + oprot.writeString(struct.itemID); + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getItemOwner_argsTupleSchemeFactory implements SchemeFactory { + public getItemOwner_argsTupleScheme getScheme() { + return new getItemOwner_argsTupleScheme(); + } + } + + private static class getItemOwner_argsTupleScheme extends TupleScheme<getItemOwner_args> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getItemOwner_args struct) throws org.apache.thrift.TException { + TTupleProtocol oprot = (TTupleProtocol) prot; + BitSet optionals = new BitSet(); + if (struct.isSetItemID()) { + optionals.set(0); + } + oprot.writeBitSet(optionals, 1); + if (struct.isSetItemID()) { + oprot.writeString(struct.itemID); + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getItemOwner_args struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + struct.itemID = iprot.readString(); + struct.setItemIDIsSet(true); + } + } + } + + } + + public static class getItemOwner_result implements org.apache.thrift.TBase<getItemOwner_result, getItemOwner_result._Fields>, java.io.Serializable, Cloneable, Comparable<getItemOwner_result> { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("getItemOwner_result"); + + private static final org.apache.thrift.protocol.TField SUCCESS_FIELD_DESC = new org.apache.thrift.protocol.TField("success", org.apache.thrift.protocol.TType.MAP, (short)0); + + private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>(); + static { + schemes.put(StandardScheme.class, new getItemOwner_resultStandardSchemeFactory()); + schemes.put(TupleScheme.class, new getItemOwner_resultTupleSchemeFactory()); + } + + public Map<String,String> 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.MapMetaData(org.apache.thrift.protocol.TType.MAP, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING), + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)))); + metaDataMap = Collections.unmodifiableMap(tmpMap); + org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(getItemOwner_result.class, metaDataMap); + } + + public getItemOwner_result() { + } + + public getItemOwner_result( + Map<String,String> success) + { + this(); + this.success = success; + } + + /** + * Performs a deep copy on <i>other</i>. + */ + public getItemOwner_result(getItemOwner_result other) { + if (other.isSetSuccess()) { + Map<String,String> __this__success = new HashMap<String,String>(other.success); + this.success = __this__success; + } + } + + public getItemOwner_result deepCopy() { + return new getItemOwner_result(this); + } + + @Override + public void clear() { + this.success = null; + } + + public int getSuccessSize() { + return (this.success == null) ? 0 : this.success.size(); + } + + public void putToSuccess(String key, String val) { + if (this.success == null) { + this.success = new HashMap<String,String>(); + } + this.success.put(key, val); + } + + public Map<String,String> getSuccess() { + return this.success; + } + + public getItemOwner_result setSuccess(Map<String,String> 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((Map<String,String>)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 getItemOwner_result) + return this.equals((getItemOwner_result)that); + return false; + } + + public boolean equals(getItemOwner_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(getItemOwner_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("getItemOwner_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 getItemOwner_resultStandardSchemeFactory implements SchemeFactory { + public getItemOwner_resultStandardScheme getScheme() { + return new getItemOwner_resultStandardScheme(); + } + } + + private static class getItemOwner_resultStandardScheme extends StandardScheme<getItemOwner_result> { + + public void read(org.apache.thrift.protocol.TProtocol iprot, getItemOwner_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.MAP) { + { + org.apache.thrift.protocol.TMap _map106 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map106.size); + for (int _i107 = 0; _i107 < _map106.size; ++_i107) + { + String _key108; + String _val109; + _key108 = iprot.readString(); + _val109 = iprot.readString(); + struct.success.put(_key108, _val109); + } + iprot.readMapEnd(); + } + 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, getItemOwner_result struct) throws org.apache.thrift.TException { + struct.validate(); + + oprot.writeStructBegin(STRUCT_DESC); + if (struct.success != null) { + 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> _iter110 : struct.success.entrySet()) + { + oprot.writeString(_iter110.getKey()); + oprot.writeString(_iter110.getValue()); + } + oprot.writeMapEnd(); + } + oprot.writeFieldEnd(); + } + oprot.writeFieldStop(); + oprot.writeStructEnd(); + } + + } + + private static class getItemOwner_resultTupleSchemeFactory implements SchemeFactory { + public getItemOwner_resultTupleScheme getScheme() { + return new getItemOwner_resultTupleScheme(); + } + } + + private static class getItemOwner_resultTupleScheme extends TupleScheme<getItemOwner_result> { + + @Override + public void write(org.apache.thrift.protocol.TProtocol prot, getItemOwner_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 (Map.Entry<String, String> _iter111 : struct.success.entrySet()) + { + oprot.writeString(_iter111.getKey()); + oprot.writeString(_iter111.getValue()); + } + } + } + } + + @Override + public void read(org.apache.thrift.protocol.TProtocol prot, getItemOwner_result struct) throws org.apache.thrift.TException { + TTupleProtocol iprot = (TTupleProtocol) prot; + BitSet incoming = iprot.readBitSet(1); + if (incoming.get(0)) { + { + org.apache.thrift.protocol.TMap _map112 = 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*_map112.size); + for (int _i113 = 0; _i113 < _map112.size; ++_i113) + { + String _key114; + String _val115; + _key114 = iprot.readString(); + _val115 = iprot.readString(); + struct.success.put(_key114, _val115); + } + } + struct.setSuccessIsSet(true); + } + } + } + + } + public static class setPerson_args implements org.apache.thrift.TBase<setPerson_args, setPerson_args._Fields>, java.io.Serializable, Cloneable, Comparable<setPerson_args> { private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("setPerson_args"); @@ -25290,15 +26182,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map106 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map106.size); - for (int _i107 = 0; _i107 < _map106.size; ++_i107) + org.apache.thrift.protocol.TMap _map116 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map116.size); + for (int _i117 = 0; _i117 < _map116.size; ++_i117) { - String _key108; - String _val109; - _key108 = iprot.readString(); - _val109 = iprot.readString(); - struct.success.put(_key108, _val109); + String _key118; + String _val119; + _key118 = iprot.readString(); + _val119 = iprot.readString(); + struct.success.put(_key118, _val119); } iprot.readMapEnd(); } @@ -25326,10 +26218,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> _iter110 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter120 : struct.success.entrySet()) { - oprot.writeString(_iter110.getKey()); - oprot.writeString(_iter110.getValue()); + oprot.writeString(_iter120.getKey()); + oprot.writeString(_iter120.getValue()); } oprot.writeMapEnd(); } @@ -25360,10 +26252,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter111 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter121 : struct.success.entrySet()) { - oprot.writeString(_iter111.getKey()); - oprot.writeString(_iter111.getValue()); + oprot.writeString(_iter121.getKey()); + oprot.writeString(_iter121.getValue()); } } } @@ -25375,15 +26267,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map112 = 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*_map112.size); - for (int _i113 = 0; _i113 < _map112.size; ++_i113) + org.apache.thrift.protocol.TMap _map122 = 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*_map122.size); + for (int _i123 = 0; _i123 < _map122.size; ++_i123) { - String _key114; - String _val115; - _key114 = iprot.readString(); - _val115 = iprot.readString(); - struct.success.put(_key114, _val115); + String _key124; + String _val125; + _key124 = iprot.readString(); + _val125 = iprot.readString(); + struct.success.put(_key124, _val125); } } struct.setSuccessIsSet(true); @@ -26050,15 +26942,15 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.MAP) { { - org.apache.thrift.protocol.TMap _map116 = iprot.readMapBegin(); - struct.success = new HashMap<String,String>(2*_map116.size); - for (int _i117 = 0; _i117 < _map116.size; ++_i117) + org.apache.thrift.protocol.TMap _map126 = iprot.readMapBegin(); + struct.success = new HashMap<String,String>(2*_map126.size); + for (int _i127 = 0; _i127 < _map126.size; ++_i127) { - String _key118; - String _val119; - _key118 = iprot.readString(); - _val119 = iprot.readString(); - struct.success.put(_key118, _val119); + String _key128; + String _val129; + _key128 = iprot.readString(); + _val129 = iprot.readString(); + struct.success.put(_key128, _val129); } iprot.readMapEnd(); } @@ -26086,10 +26978,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> _iter120 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter130 : struct.success.entrySet()) { - oprot.writeString(_iter120.getKey()); - oprot.writeString(_iter120.getValue()); + oprot.writeString(_iter130.getKey()); + oprot.writeString(_iter130.getValue()); } oprot.writeMapEnd(); } @@ -26120,10 +27012,10 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Map.Entry<String, String> _iter121 : struct.success.entrySet()) + for (Map.Entry<String, String> _iter131 : struct.success.entrySet()) { - oprot.writeString(_iter121.getKey()); - oprot.writeString(_iter121.getValue()); + oprot.writeString(_iter131.getKey()); + oprot.writeString(_iter131.getValue()); } } } @@ -26135,15 +27027,15 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TMap _map122 = 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*_map122.size); - for (int _i123 = 0; _i123 < _map122.size; ++_i123) + org.apache.thrift.protocol.TMap _map132 = 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*_map132.size); + for (int _i133 = 0; _i133 < _map132.size; ++_i133) { - String _key124; - String _val125; - _key124 = iprot.readString(); - _val125 = iprot.readString(); - struct.success.put(_key124, _val125); + String _key134; + String _val135; + _key134 = iprot.readString(); + _val135 = iprot.readString(); + struct.success.put(_key134, _val135); } } struct.setSuccessIsSet(true); @@ -40781,13 +41673,13 @@ public class Server { case 1: // USER_ID if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list126 = iprot.readListBegin(); - struct.userID = new ArrayList<String>(_list126.size); - for (int _i127 = 0; _i127 < _list126.size; ++_i127) + org.apache.thrift.protocol.TList _list136 = iprot.readListBegin(); + struct.userID = new ArrayList<String>(_list136.size); + for (int _i137 = 0; _i137 < _list136.size; ++_i137) { - String _elem128; - _elem128 = iprot.readString(); - struct.userID.add(_elem128); + String _elem138; + _elem138 = iprot.readString(); + struct.userID.add(_elem138); } iprot.readListEnd(); } @@ -40815,9 +41707,9 @@ public class Server { oprot.writeFieldBegin(USER_ID_FIELD_DESC); { oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, struct.userID.size())); - for (String _iter129 : struct.userID) + for (String _iter139 : struct.userID) { - oprot.writeString(_iter129); + oprot.writeString(_iter139); } oprot.writeListEnd(); } @@ -40848,9 +41740,9 @@ public class Server { if (struct.isSetUserID()) { { oprot.writeI32(struct.userID.size()); - for (String _iter130 : struct.userID) + for (String _iter140 : struct.userID) { - oprot.writeString(_iter130); + oprot.writeString(_iter140); } } } @@ -40862,13 +41754,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list131 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.userID = new ArrayList<String>(_list131.size); - for (int _i132 = 0; _i132 < _list131.size; ++_i132) + org.apache.thrift.protocol.TList _list141 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.userID = new ArrayList<String>(_list141.size); + for (int _i142 = 0; _i142 < _list141.size; ++_i142) { - String _elem133; - _elem133 = iprot.readString(); - struct.userID.add(_elem133); + String _elem143; + _elem143 = iprot.readString(); + struct.userID.add(_elem143); } } struct.setUserIDIsSet(true); @@ -41187,14 +42079,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list134 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list134.size); - for (int _i135 = 0; _i135 < _list134.size; ++_i135) + org.apache.thrift.protocol.TList _list144 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list144.size); + for (int _i145 = 0; _i145 < _list144.size; ++_i145) { - Person _elem136; - _elem136 = new Person(); - _elem136.read(iprot); - struct.success.add(_elem136); + Person _elem146; + _elem146 = new Person(); + _elem146.read(iprot); + struct.success.add(_elem146); } iprot.readListEnd(); } @@ -41222,9 +42114,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 _iter137 : struct.success) + for (Person _iter147 : struct.success) { - _iter137.write(oprot); + _iter147.write(oprot); } oprot.writeListEnd(); } @@ -41255,9 +42147,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter138 : struct.success) + for (Person _iter148 : struct.success) { - _iter138.write(oprot); + _iter148.write(oprot); } } } @@ -41269,14 +42161,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list139.size); - for (int _i140 = 0; _i140 < _list139.size; ++_i140) + org.apache.thrift.protocol.TList _list149 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list149.size); + for (int _i150 = 0; _i150 < _list149.size; ++_i150) { - Person _elem141; - _elem141 = new Person(); - _elem141.read(iprot); - struct.success.add(_elem141); + Person _elem151; + _elem151 = new Person(); + _elem151.read(iprot); + struct.success.add(_elem151); } } struct.setSuccessIsSet(true); @@ -42049,14 +42941,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list142 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list142.size); - for (int _i143 = 0; _i143 < _list142.size; ++_i143) + org.apache.thrift.protocol.TList _list152 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list152.size); + for (int _i153 = 0; _i153 < _list152.size; ++_i153) { - Person _elem144; - _elem144 = new Person(); - _elem144.read(iprot); - struct.success.add(_elem144); + Person _elem154; + _elem154 = new Person(); + _elem154.read(iprot); + struct.success.add(_elem154); } iprot.readListEnd(); } @@ -42084,9 +42976,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 _iter145 : struct.success) + for (Person _iter155 : struct.success) { - _iter145.write(oprot); + _iter155.write(oprot); } oprot.writeListEnd(); } @@ -42117,9 +43009,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter146 : struct.success) + for (Person _iter156 : struct.success) { - _iter146.write(oprot); + _iter156.write(oprot); } } } @@ -42131,14 +43023,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list147 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list147.size); - for (int _i148 = 0; _i148 < _list147.size; ++_i148) + org.apache.thrift.protocol.TList _list157 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list157.size); + for (int _i158 = 0; _i158 < _list157.size; ++_i158) { - Person _elem149; - _elem149 = new Person(); - _elem149.read(iprot); - struct.success.add(_elem149); + Person _elem159; + _elem159 = new Person(); + _elem159.read(iprot); + struct.success.add(_elem159); } } struct.setSuccessIsSet(true); @@ -42808,13 +43700,13 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list150 = iprot.readListBegin(); - struct.success = new ArrayList<String>(_list150.size); - for (int _i151 = 0; _i151 < _list150.size; ++_i151) + org.apache.thrift.protocol.TList _list160 = iprot.readListBegin(); + struct.success = new ArrayList<String>(_list160.size); + for (int _i161 = 0; _i161 < _list160.size; ++_i161) { - String _elem152; - _elem152 = iprot.readString(); - struct.success.add(_elem152); + String _elem162; + _elem162 = iprot.readString(); + struct.success.add(_elem162); } iprot.readListEnd(); } @@ -42842,9 +43734,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 _iter153 : struct.success) + for (String _iter163 : struct.success) { - oprot.writeString(_iter153); + oprot.writeString(_iter163); } oprot.writeListEnd(); } @@ -42875,9 +43767,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (String _iter154 : struct.success) + for (String _iter164 : struct.success) { - oprot.writeString(_iter154); + oprot.writeString(_iter164); } } } @@ -42889,13 +43781,13 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list155 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); - struct.success = new ArrayList<String>(_list155.size); - for (int _i156 = 0; _i156 < _list155.size; ++_i156) + org.apache.thrift.protocol.TList _list165 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRING, iprot.readI32()); + struct.success = new ArrayList<String>(_list165.size); + for (int _i166 = 0; _i166 < _list165.size; ++_i166) { - String _elem157; - _elem157 = iprot.readString(); - struct.success.add(_elem157); + String _elem167; + _elem167 = iprot.readString(); + struct.success.add(_elem167); } } struct.setSuccessIsSet(true); @@ -43668,14 +44560,14 @@ public class Server { case 0: // SUCCESS if (schemeField.type == org.apache.thrift.protocol.TType.LIST) { { - org.apache.thrift.protocol.TList _list158 = iprot.readListBegin(); - struct.success = new ArrayList<Person>(_list158.size); - for (int _i159 = 0; _i159 < _list158.size; ++_i159) + org.apache.thrift.protocol.TList _list168 = iprot.readListBegin(); + struct.success = new ArrayList<Person>(_list168.size); + for (int _i169 = 0; _i169 < _list168.size; ++_i169) { - Person _elem160; - _elem160 = new Person(); - _elem160.read(iprot); - struct.success.add(_elem160); + Person _elem170; + _elem170 = new Person(); + _elem170.read(iprot); + struct.success.add(_elem170); } iprot.readListEnd(); } @@ -43703,9 +44595,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 _iter161 : struct.success) + for (Person _iter171 : struct.success) { - _iter161.write(oprot); + _iter171.write(oprot); } oprot.writeListEnd(); } @@ -43736,9 +44628,9 @@ public class Server { if (struct.isSetSuccess()) { { oprot.writeI32(struct.success.size()); - for (Person _iter162 : struct.success) + for (Person _iter172 : struct.success) { - _iter162.write(oprot); + _iter172.write(oprot); } } } @@ -43750,14 +44642,14 @@ public class Server { BitSet incoming = iprot.readBitSet(1); if (incoming.get(0)) { { - org.apache.thrift.protocol.TList _list163 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); - struct.success = new ArrayList<Person>(_list163.size); - for (int _i164 = 0; _i164 < _list163.size; ++_i164) + org.apache.thrift.protocol.TList _list173 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32()); + struct.success = new ArrayList<Person>(_list173.size); + for (int _i174 = 0; _i174 < _list173.size; ++_i174) { - Person _elem165; - _elem165 = new Person(); - _elem165.read(iprot); - struct.success.add(_elem165); + Person _elem175; + _elem175 = new Person(); + _elem175.read(iprot); + struct.success.add(_elem175); } } struct.setSuccessIsSet(true); diff --git a/dozentenmodulserver/src/main/java/sql/SQL.java b/dozentenmodulserver/src/main/java/sql/SQL.java index 10afee96..dd40c774 100644 --- a/dozentenmodulserver/src/main/java/sql/SQL.java +++ b/dozentenmodulserver/src/main/java/sql/SQL.java @@ -36,7 +36,7 @@ public class SQL { Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (InstantiationException | IllegalAccessException
| ClassNotFoundException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
try {
@@ -48,7 +48,7 @@ public class SQL { return con;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to return connection to Client.");
e.printStackTrace();
}
@@ -78,7 +78,7 @@ public class SQL { + ".");
return ret;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to writeFTPUser.");
e.printStackTrace();
}
@@ -113,7 +113,7 @@ public class SQL { log.info("FTPUser " + user + " deleted.");
return ret;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to DeleteUser.");
e.printStackTrace();
}
@@ -136,7 +136,7 @@ public class SQL { return rs;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getImage.");
e.printStackTrace();
}
@@ -177,7 +177,7 @@ public class SQL { return path;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getPathOfImage.");
e.printStackTrace();
}
@@ -251,7 +251,7 @@ public class SQL { }
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setInstitution.");
e.printStackTrace();
}
@@ -378,7 +378,7 @@ public class SQL { }
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setPerson.");
e.printStackTrace();
}
@@ -507,7 +507,7 @@ public class SQL { //con.commit();
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setImageData.");
e.printStackTrace();
}
@@ -563,7 +563,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -618,7 +618,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -661,7 +661,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -722,7 +722,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -779,7 +779,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -824,7 +824,7 @@ public class SQL { }
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -870,7 +870,7 @@ public class SQL { con.close();
return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getLectureListPermissionRead.");
e.printStackTrace();
}
@@ -920,7 +920,7 @@ public class SQL { con.close();
return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getLectureListPermissionWrite.");
e.printStackTrace();
}
@@ -969,7 +969,7 @@ public class SQL { con.close();
return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getLectureListPermissionAdmin.");
e.printStackTrace();
}
@@ -1005,7 +1005,7 @@ public class SQL { con.close();
return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getLectureList.");
e.printStackTrace();
}
@@ -1030,7 +1030,7 @@ public class SQL { return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getAllOS.");
e.printStackTrace();
}
@@ -1081,15 +1081,104 @@ public class SQL { con.close();
return map;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getPersonData.");
e.printStackTrace();
}
return null;
- }
+ }//end getPersonData
+
+
+
+
+ public Map<String, String> getPersonData(String userID) {
+ Map<String, String> map = new HashMap<String, String>();
+ try {
+ Connection con = getConnection();
+ String sql = "SELECT userID, loginName, Nachname, Vorname, mail, m_institution.name as institution FROM bwLehrpool.m_user, m_institution WHERE userID=? AND m_user.institution=m_institution.institutionID;";
+
+ PreparedStatement prest = con.prepareStatement(sql);
+ prest.setString(1, userID);
+
+ ResultSet rs = prest.executeQuery();
+ con.commit();
+ while (rs.next())
+ {
+ map.put("userID", rs.getString("userID"));
+ map.put("loginName", rs.getString("loginName"));
+ map.put("Nachname", rs.getString("Nachname"));
+ map.put("Vorname", rs.getString("Vorname"));
+ map.put("mail", rs.getString("mail"));
+ map.put("institution", rs.getString("institution"));
+
+ }
+ con.close();
+ return map;
+ } catch (SQLException e) {
+ log.info("Failed to getPersonData with userID='"+userID+"'.");
+ e.printStackTrace();
+ }
+ return null;
+ }//end getPersonData
+
+
+
+ public Map<String, String> getItemOwner(String itemID) {
+
+ Map<String, String> map = new HashMap<String, String>();
+ Connection con = getConnection();
+ PreparedStatement prest;
+ String userID;
+
+ try {
+ //find out if the itemID belongs to an image
+ String sql = "SELECT image_owner FROM bwLehrpool.m_VLData_imageInfo WHERE GUID_imageID=?;";
+ prest = con.prepareStatement(sql);
+ prest.setString(1, itemID);
+
+ ResultSet rs = prest.executeQuery();
+ while (rs.next()){
+ map.put("userID",rs.getString("image_owner"));
+ }
+
+ //if map is empty, then itemID does not belong to an image -> must be a lecture
+ if(map.isEmpty()==true){
+ //check if itemID belongs to a lecture
+ sql = "SELECT admin_owner FROM bwLehrpool.m_VLData_lecture WHERE lectureID=?;";
+ prest = con.prepareStatement(sql);
+ prest.setString(1, itemID);
+
+ rs = prest.executeQuery();
+ while(rs.next()){
+ map.put("userID", rs.getString("admin_owner"));
+ }
+ }
+
+ //if map is still empty, then the itemID could not be found
+ if(map.isEmpty()==true){
+ log.error("ERROR: getItemOwner could not find the item with the ID '"+itemID+"'.");
+ } else {
+
+ //now that we have the userID for this item, get the user information and put it in the map
+ userID = map.get("userID"); //extract the userID
+ map = getPersonData(userID); //get all the rest of his information
+
+ //return this map with all the infos
+ return map;
+
+ }
+
+ } catch (SQLException e) {
+ e.printStackTrace();
+ }
+
+ //something went horribly wrong...
+ return null;
+ }//end getItemOwner
+
@@ -1191,7 +1280,7 @@ public class SQL { //con.commit();
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setLectureData.");
e.printStackTrace();
}
@@ -1229,7 +1318,7 @@ public class SQL { con.close();
return map;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getImageIDandVersion.");
e.printStackTrace();
}
@@ -1284,7 +1373,7 @@ public class SQL { con.close();
return map;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getImageData.");
e.printStackTrace();
}
@@ -1437,7 +1526,7 @@ public class SQL { con.close();
return 0;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to UpdateImageData.");
e.printStackTrace();
}
@@ -1475,7 +1564,7 @@ public class SQL { return true;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to deleteImage and permissions.");
e.printStackTrace();
}
@@ -1556,7 +1645,7 @@ public class SQL { log.info("Succeeded to updateLectureData.");
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to updateLectureData.");
e.printStackTrace();
}
@@ -1586,7 +1675,7 @@ public class SQL { return ret;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to execute method connectedToLecture.");
e.printStackTrace();
}
@@ -1619,7 +1708,7 @@ public class SQL { con.close();
return true;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to deleteLecture and permissions.");
e.printStackTrace();
}
@@ -1663,7 +1752,7 @@ public class SQL { return path;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getFile.");
e.printStackTrace();
}
@@ -1698,7 +1787,7 @@ public class SQL { return map;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getDeleteXMLData.");
e.printStackTrace();
}
@@ -1733,7 +1822,7 @@ public class SQL { log.info("Succesfully updated image path");
return 0;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to UpdateImagePath.");
e.printStackTrace();
}
@@ -1755,7 +1844,7 @@ public class SQL { return list;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getAllUniversities.");
e.printStackTrace();
}
@@ -1788,7 +1877,7 @@ public class SQL { return pkos;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getOSpk.");
e.printStackTrace();
}
@@ -1821,7 +1910,7 @@ public class SQL { return os;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getOS.");
e.printStackTrace();
}
@@ -1859,7 +1948,7 @@ public class SQL { con.close();
return map;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getLectureData.");
e.printStackTrace();
}
@@ -1896,7 +1985,7 @@ public class SQL { con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
@@ -1928,7 +2017,7 @@ public class SQL { return rs.getInt("roleID");
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to getRoleID.");
e.printStackTrace();
}
@@ -1958,7 +2047,7 @@ public class SQL { con.close();
return id;
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to LectureID.");
e.printStackTrace();
}
@@ -1980,7 +2069,7 @@ public class SQL { try {
stm = con.createStatement();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
String query = "SELECT userID, Nachname, Vorname, mail FROM m_user WHERE userID NOT IN ('"
@@ -1994,7 +2083,7 @@ public class SQL { try {
res = stm.executeQuery(query);
} catch (SQLException e1) {
- // TODO Auto-generated catch block
+
e1.printStackTrace();
}
@@ -2008,7 +2097,7 @@ public class SQL { false, false));
}
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -2034,7 +2123,7 @@ public class SQL { try {
stm = con.createStatement();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
try {
@@ -2067,7 +2156,7 @@ public class SQL { + imageID
+ "' AND pmi.userID=u.userID ORDER BY u.Nachname ASC;");*/
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
try {
@@ -2108,7 +2197,7 @@ public class SQL { // System.out.println(res.getString("Nachname")+" "+Boolean.parseBoolean(res.getString("image_read"))+" "+Boolean.parseBoolean(res.getString("image_write"))+" "+Boolean.parseBoolean(res.getString("image_admin")));
}
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -2150,7 +2239,7 @@ public class SQL { "FROM bwLehrpool.pm_VLData_lecture pml, bwLehrpool.m_user u WHERE pml.userID!='"+userID+"' AND pml.lectureID='"+lectureID+"' AND pml.userID=u.userID ORDER BY u.Nachname ASC;");
*/
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
try {
@@ -2195,7 +2284,7 @@ public class SQL { // System.out.println(res.getString("Nachname")+" "+Boolean.parseBoolean(res.getString("image_read"))+" "+Boolean.parseBoolean(res.getString("image_write"))+" "+Boolean.parseBoolean(res.getString("image_admin")));
}
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return list;
@@ -2251,7 +2340,7 @@ public class SQL { con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setImageRights.");
e.printStackTrace();
}
@@ -2304,7 +2393,7 @@ public class SQL { log.info("Written additional image rights.");
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
log.info("Failed to write additional image rights.");
}
@@ -2349,7 +2438,7 @@ public class SQL { log.info("Written lecture rights for " + pk_lecture);
con.close();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
log.info("Failed to setLectureRights.");
e.printStackTrace();
}
@@ -2397,7 +2486,7 @@ public class SQL { log.info("Written additional lecture rights for '"
+ userID + "'.");
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
log.info("Failed to write additional lecture rights.");
}
@@ -2425,7 +2514,7 @@ public class SQL { prest.executeUpdate();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
@@ -2437,7 +2526,7 @@ public class SQL { con.commit();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}// end deleteAllAdditionalImagePermissions
@@ -2471,7 +2560,7 @@ public class SQL { con.commit();
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}// end deleteAllAdditionalImagePermissions
@@ -2504,7 +2593,7 @@ public class SQL { }
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
@@ -2534,13 +2623,18 @@ public class SQL { return rs.getString("name") + " " + rs.getString("architecture") + " bit";
} catch (SQLException e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
return null;
}
+
+
+
+
+
}// end class
diff --git a/dozentenmodulserver/thrift/server.thrift b/dozentenmodulserver/thrift/server.thrift index eb9719fb..79fae5ee 100644 --- a/dozentenmodulserver/thrift/server.thrift +++ b/dozentenmodulserver/thrift/server.thrift @@ -67,6 +67,7 @@ service Server{ list<string> getAllOS(), list<string> getAllUniversities(), map<string,string> getPersonData(1: string Vorname, 2: string Nachname), + map<string,string> getItemOwner(1: string itemID), void setPerson(1: string login, 2:string lastname, 3: string firstname, 4: string mail, 5: string Institution), bool writeLecturedata(1: string name, 2: string shortdesc, 3: string desc, 4: string startDate, 5: string endDate, 6: bool isActive, 7: string imagename, 8: string login, 9: string firstname, 10: string lastname, 11: string university, 12: string Mail, 13: string Tel, 14: string Fak), bool startFileCopy(1: string file), |
