diff options
| author | Jonathan Bauer | 2015-08-21 15:32:18 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-08-21 15:32:18 +0200 |
| commit | ca8502df5d32baf0a47fc2eddde3cca7b00a0617 (patch) | |
| tree | 8e13ae3d30b821f9aaf3ba01d28143fd7cfa6d57 /dozentenmodul/src/main/java/org/openslx | |
| parent | Merge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff) | |
| download | tutor-module-ca8502df5d32baf0a47fc2eddde3cca7b00a0617.tar.gz tutor-module-ca8502df5d32baf0a47fc2eddde3cca7b00a0617.tar.xz tutor-module-ca8502df5d32baf0a47fc2eddde3cca7b00a0617.zip | |
[client] ThriftActions & calls in LectureWizard
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx')
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java | 21 | ||||
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java | 7 |
2 files changed, 15 insertions, 13 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java index b29fe91f..f156ee48 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java @@ -2,6 +2,8 @@ package org.openslx.dozmod.gui.wizard; import java.awt.Window; +import javax.swing.JOptionPane; + import org.apache.log4j.Logger; import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; @@ -16,6 +18,7 @@ import org.openslx.dozmod.gui.wizard.page.LectureCustomPermissionPage; import org.openslx.dozmod.gui.wizard.page.LectureOptionsPage; import org.openslx.dozmod.state.LectureWizardState; import org.openslx.dozmod.thrift.Session; +import org.openslx.dozmod.thrift.ThriftActions; import org.openslx.dozmod.thrift.ThriftError; import org.openslx.dozmod.thrift.cache.LectureCache; import org.openslx.thrifthelper.ThriftManager; @@ -80,25 +83,21 @@ public class LectureWizard extends Wizard implements UiFeedback { if (state.uuid != null) { // already got a uuid, this is bad as we were about to do it! LOGGER.error("UUID for new lecture already present, something's bad..."); - return true; + return false; } // ok, lets create it - try { - // push to sat - state.uuid = ThriftManager.getSatClient().createLecture(Session.getSatelliteToken(), - lectureWriteFromState()); - if(state.permissionMap != null && !state.permissionMap.isEmpty()) - ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), state.uuid, state.permissionMap); - } catch (TException e) { - ThriftError.showMessage(this, LOGGER, e, "Failed to create lecture"); + if (ThriftActions.createLecture(JOptionPane.getFrameForComponent(this), lectureWriteFromState()) == null) return false; - } + if(state.permissionMap != null && !state.permissionMap.isEmpty()) + if (!ThriftActions.writeLecturePermissions(JOptionPane.getFrameForComponent(this), state.uuid, state.permissionMap)) + return false; + + // all good, feedback if (Gui.showMessageBox(this, "Veranstaltung erstellt! Wollen Sie zur Übersicht wechseln?", MessageType.QUESTION_YESNO, null, null)) { LectureCache.get(true); MainWindow.showPage(LectureListWindow.class); } - // TODO run the actually request over external threaded class return true; } diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java index 5b2a931b..19ada0f2 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java @@ -518,18 +518,21 @@ public class ThriftActions { return uuid; } /** + * GUI-BLOCKING * Writes custom lecture permissions (permissions param) for the given lectureId. * * @param frame to show user feedback on * @param lectureId lecture's id to write custom permissions for * @param permissions actual permission map to push */ - public static void writeLecturePermissions(final Frame frame, final String lectureId, final Map<String, LecturePermissions> permissions) { + public static boolean writeLecturePermissions(final Frame frame, final String lectureId, final Map<String, LecturePermissions> permissions) { try { - ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId, permissions); + ThriftManager.getSatClient().writeLecturePermissions(Session.getSatelliteToken(), lectureId, permissions); } catch (TException e) { ThriftError.showMessage(frame, LOGGER, e, "Failed to write lecture permissions"); + return false; } + return true; } /* ******************************************************************************* |
