diff options
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/LectureWizard.java | 23 |
1 files changed, 12 insertions, 11 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 c008dbfe..c57018e5 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 @@ -3,6 +3,7 @@ package org.openslx.dozmod.gui.wizard; import java.awt.Window; import org.apache.log4j.Logger; +import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.ImageSummaryRead; import org.openslx.bwlp.thrift.iface.LectureWrite; import org.openslx.dozmod.gui.Gui; @@ -16,6 +17,7 @@ import org.openslx.dozmod.gui.wizard.page.LectureOptionsPage; import org.openslx.dozmod.state.LectureWizardState; import org.openslx.dozmod.thrift.LectureCache; import org.openslx.dozmod.thrift.Session; +import org.openslx.dozmod.thrift.ThriftError; import org.openslx.thrifthelper.ThriftManager; @SuppressWarnings("serial") @@ -72,32 +74,31 @@ public class LectureWizard extends Wizard implements UiFeedback { // since we only started the upload and created a "blank" image entry // we can here do all the sanity checks on the fields of UploadWizardState // and react accordingly. - return isStateValid(); - } - - @Override - public void performFinish() { - // TODO evaluate table state and create the map of permissions - // TODO run the actually request over external threaded class + if (!isStateValid()) + return false; + // Now try to submit 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; + return true; } // ok, lets create it try { // push to sat state.uuid = ThriftManager.getSatClient().createLecture(Session.getSatelliteToken(), lectureWriteFromState()); - } catch (Exception e) { - Gui.showMessageBox(this, "Fail to create lecture: ", MessageType.ERROR, LOGGER, e); - return; + } catch (TException e) { + ThriftError.showMessage(this, LOGGER, e, "Fail to create lecture"); + return false; } if (Gui.showMessageBox(this, "Veranstaltung erstellt! Wollen Sie zur Übersicht wechseln?", MessageType.QUESTION_YESNO, null, null)) { LectureCache.get(true); MainWindow.showPage(LectureListWindow.class); } + // TODO evaluate table state and create the map of permissions + // TODO run the actually request over external threaded class + return true; } private boolean isStateValid() { |