diff options
author | Jonathan Bauer | 2015-08-21 14:36:41 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-08-21 14:36:41 +0200 |
commit | d60450ab1d9338f335663e41e5818395f962d56f (patch) | |
tree | 76da0fb5625111df27581e0d89bcc80a47492275 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java | |
parent | [client] ThriftActions for Image Metadata (details + permissions) and use the... (diff) | |
download | tutor-module-d60450ab1d9338f335663e41e5818395f962d56f.tar.gz tutor-module-d60450ab1d9338f335663e41e5818395f962d56f.tar.xz tutor-module-d60450ab1d9338f335663e41e5818395f962d56f.zip |
[client] ThriftActions & calls in ImageWizard.performFinish
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageWizard.java | 51 |
1 files changed, 19 insertions, 32 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 b1b077ee..87ba4db2 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 @@ -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.ImageBaseWrite; @@ -14,6 +16,7 @@ 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.thrifthelper.ThriftManager; @SuppressWarnings("serial") @@ -57,39 +60,22 @@ public class ImageWizard extends Wizard implements UiFeedback { @Override public void performFinish() { - // TODO run the actually request over external threaded class - try { - // push to sat - ThriftManager.getSatClient().updateImageBase(Session.getSatelliteToken(), - uploadWizardState.uuid.toString(), imageBaseWriteFromState()); - } catch (TException e) { - Gui.showMessageBox(this, "Fail to push image metadata to satellite: ", MessageType.ERROR, LOGGER, - e); - return; - } + // TODO run the actually request over external threaded class? + + // push image base to satellite + ThriftActions.updateImageBase(JOptionPane.getFrameForComponent(this), + uploadWizardState.uuid, imageBaseWriteFromState()); - // push permissions to satellite server + // push permissions to satellite if we have custom permissions if (uploadWizardState.permissionMap != null) { - // user skipped permission list stuff - try { - ThriftManager.getSatClient().writeImagePermissions(Session.getSatelliteToken(), - uploadWizardState.uuid, uploadWizardState.permissionMap); - } catch (TException e) { - Gui.showMessageBox(this, "Could not write permissions list to satellite: ", - MessageType.ERROR, LOGGER, e); - return; - } - } - try { - // push to sat - ThriftManager.getSatClient().updateImageVersion(Session.getSatelliteToken(), - uploadWizardState.transferInformation.getToken(), - new ImageVersionWrite(uploadWizardState.isRestricted)); - } catch (TException e) { - Gui.showMessageBox(this, "Could not set active/restricted flags to satellite: ", - MessageType.ERROR, LOGGER, e); - return; + + ThriftActions.writeImagePermissions(JOptionPane.getFrameForComponent(this), + uploadWizardState.uuid, uploadWizardState.permissionMap); } + // push version metadata to satellite + ThriftActions.updateImageVersion(JOptionPane.getFrameForComponent(this), + uploadWizardState.transferInformation.getToken(), + new ImageVersionWrite(uploadWizardState.isRestricted)); } private boolean isStateValid() { @@ -164,8 +150,9 @@ public class ImageWizard extends Wizard implements UiFeedback { // 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 - //ThriftActions.deleteImageBase() + // 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) { // we started an upload, thus we have a image version |