diff options
| author | Jonathan Bauer | 2015-08-25 14:59:00 +0200 |
|---|---|---|
| committer | Jonathan Bauer | 2015-08-25 14:59:00 +0200 |
| commit | 3db9afec1b2cd98108ccaad11f6dcf6de3a8244f (patch) | |
| tree | 1ffd8f7b2f750b8598a6908f4d847fb72ea01538 | |
| parent | [client] check maxValidity for lecture when creating them (diff) | |
| download | tutor-module-3db9afec1b2cd98108ccaad11f6dcf6de3a8244f.tar.gz tutor-module-3db9afec1b2cd98108ccaad11f6dcf6de3a8244f.tar.xz tutor-module-3db9afec1b2cd98108ccaad11f6dcf6de3a8244f.zip | |
[client] reworked image deletion in iamgeList
| -rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java index 05964235..ebad4dbe 100644 --- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java @@ -5,8 +5,12 @@ import java.awt.Window; import javax.swing.JOptionPane; import org.apache.log4j.Logger; +import org.apache.thrift.TException; import org.openslx.bwlp.thrift.iface.ImageBaseWrite; import org.openslx.bwlp.thrift.iface.ImageVersionWrite; +import org.openslx.bwlp.thrift.iface.TAuthorizationException; +import org.openslx.bwlp.thrift.iface.TInternalServerError; +import org.openslx.bwlp.thrift.iface.TNotFoundException; import org.openslx.dozmod.gui.Gui; import org.openslx.dozmod.gui.helper.MessageType; import org.openslx.dozmod.gui.helper.UiFeedback; @@ -14,7 +18,10 @@ import org.openslx.dozmod.gui.wizard.page.ImageCustomPermissionPage; import org.openslx.dozmod.gui.wizard.page.ImageMetaDataPage; import org.openslx.dozmod.gui.wizard.page.ImageUploadPage; import org.openslx.dozmod.state.UploadWizardState; +import org.openslx.dozmod.thrift.Session; import org.openslx.dozmod.thrift.ThriftActions; +import org.openslx.dozmod.thrift.ThriftError; +import org.openslx.thrifthelper.ThriftManager; @SuppressWarnings("serial") public class ImageWizard extends Wizard implements UiFeedback { @@ -142,20 +149,15 @@ public class ImageWizard extends Wizard implements UiFeedback { boolean confirmed = Gui.showMessageBox(this, "Möchten Sie den Vorgang wirklich abbrechen?", MessageType.QUESTION_YESNO, null, null); if (confirmed) { - // TODO: Lösch-Calls am Sat - // check the state to see what we did: - if (uploadWizardState.uuid != null) { - // we created the image, so delete the image base. NOTE: user feedback is done by ThriftActions - ThriftActions.deleteImageBaseOrVersion(JOptionPane.getFrameForComponent(this), - uploadWizardState.uuid, null, null); - } - if (uploadWizardState.transferInformation != null) { - // TODO possible that transferInfo exists but no token? - // we started an upload, thus we have a image version - ThriftActions.deleteImageBaseOrVersion(JOptionPane.getFrameForComponent(this), - uploadWizardState.uuid, - uploadWizardState.transferInformation.getToken(), - null); + try { + if (uploadWizardState.uuid != null) { + ThriftManager.getSatClient().deleteImageBase(Session.getSatelliteToken(), uploadWizardState.uuid); + if (uploadWizardState.transferInformation != null) + ThriftManager.getSatClient().deleteImageVersion(Session.getSatelliteToken(), uploadWizardState.transferInformation.getToken()); + } + } catch (TException e) { + ThriftError.showMessage(this, LOGGER, e, "Fehler beim Abbruch!"); + return false; } if (uploadWizardState.uploadTask != null) { uploadWizardState.uploadTask.cancel(); |
