diff options
| author | Jonathan Bauer | 2015-03-02 13:22:44 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2015-03-02 13:22:44 +0100 |
| commit | ea9f9848a6e7a68dc90decc2e38bd3e1081ebf8a (patch) | |
| tree | 1e252164aa23b6b74d30c6185fda06ceddcd6041 /dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java | |
| parent | pom.xml (diff) | |
| download | tutor-module-ea9f9848a6e7a68dc90decc2e38bd3e1081ebf8a.tar.gz tutor-module-ea9f9848a6e7a68dc90decc2e38bd3e1081ebf8a.tar.xz tutor-module-ea9f9848a6e7a68dc90decc2e38bd3e1081ebf8a.zip | |
ThriftManager class: use getSatClient() and getMasterClient() to get the singleton instances of the thrift clients to satellite and master servers
DO NOT CREATE NEW THRIFT OBJECTS!!!
Diffstat (limited to 'dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java')
| -rw-r--r-- | dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java index 438e817f..0dd68697 100644 --- a/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java +++ b/dozentenmodul/src/main/java/gui/lecture/DeleteLecture_GUI.java @@ -59,9 +59,8 @@ import models.person; import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.sat.thrift.iface.Lecture; -import org.openslx.sat.thrift.iface.Server.Client; -import thrift.ThriftConnection; +import thrift.ThriftManager; import util.OpenLinks; @SuppressWarnings("serial") @@ -90,9 +89,6 @@ public class DeleteLecture_GUI extends JFrame { "Gültigkeitsdatum", "Aktiv", "Letzte Benutzung", "Verantwortlicher", "Image", "Schlagwort", "ID" }; - ThriftConnection con = new ThriftConnection(); - Client client = models.Client.clientcon.getClient(); - final DefaultTableModel modelMyLectures = new DefaultTableModel(titles, 0){ public boolean isCellEditable(int rowIndex, int mColIndex) { return false; @@ -106,7 +102,6 @@ public class DeleteLecture_GUI extends JFrame { modelMyLectures); private JButton button; - private JTextField textField; Component c = null; private static final String HELP_MESSAGE = "<html><div align=\"center\">" @@ -115,7 +110,7 @@ public class DeleteLecture_GUI extends JFrame { + "Veraltet bedeutet, dass Veranstaltungen, die drei Monate lang nicht augerufen wurden, vorerst deaktiviert werden." + "</div></html>"; - RowFilter rf = null; + RowFilter<Object, Object> rf = null; List<RowFilter<Object, Object>> filters = new ArrayList<RowFilter<Object, Object>>(2); /** @@ -132,12 +127,11 @@ public class DeleteLecture_GUI extends JFrame { public void windowClosing(WindowEvent arg0) { // Beendet die Anwendung nach klick auf X try { - client.setSessionInvalid(SessionData.session.getAuthToken()); + ThriftManager.getSatClient().setSessionInvalid(SessionData.session.getAuthToken()); } catch (TException e) { // TODO Auto-generated catch block e.printStackTrace(); } - con.closeThriftConnection(); System.exit(0); } @@ -376,8 +370,6 @@ public class DeleteLecture_GUI extends JFrame { String lectureID = ""; int eingabe; - String username = person.verantwortlicher.getName() + " " - + person.verantwortlicher.getVorname(); // check if a row is selected if (tablemyLectures.getSelectedRowCount() != 0) { // a row is selected @@ -401,7 +393,7 @@ public class DeleteLecture_GUI extends JFrame { // LOGGER.info("Lösche Veranstaltung: " + lectureID); try { - if (client.deleteLecture( + if (ThriftManager.getSatClient().deleteLecture( lectureID, SessionData.session.getAuthToken(), person.verantwortlicher.getHochschule() @@ -568,14 +560,11 @@ public class DeleteLecture_GUI extends JFrame { mntmFaq.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - URI windows; try { windows = new URI(Links.getFAQ()); - open.openWebpage(windows); + OpenLinks.openWebpage(windows); } catch (URISyntaxException e) { @@ -589,14 +578,11 @@ public class DeleteLecture_GUI extends JFrame { mntmOtrs.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent arg0) { - - OpenLinks open = new OpenLinks(); - URI windows; try { windows = new URI(Links.getOTRS()); - open.openWebpage(windows); + OpenLinks.openWebpage(windows); } catch (URISyntaxException e) { @@ -641,12 +627,12 @@ public class DeleteLecture_GUI extends JFrame { if(person.verantwortlicher.getRole()=="Admin") { //get complete list - lectures = client.getLectureList(SessionData.session.getAuthToken()); + lectures = ThriftManager.getSatClient().getLectureList(SessionData.session.getAuthToken()); } else { //get permitted list - lectures = client.getLectureListPermissionAdmin(SessionData.session.getAuthToken()); + lectures = ThriftManager.getSatClient().getLectureListPermissionAdmin(SessionData.session.getAuthToken()); } Iterator<Lecture> i = lectures.iterator(); @@ -704,7 +690,7 @@ public class DeleteLecture_GUI extends JFrame { SimpleDateFormat in = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat out = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss"); - Map<String, String> res = client.getLectureData(id,SessionData.session.getAuthToken()); + Map<String, String> res = ThriftManager.getSatClient().getLectureData(id,SessionData.session.getAuthToken()); labelName.setText(res.get("name")); labelAktiv.setText(res.get("isActive")); labeldesc.setText(res.get("desc")); |
