summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java
diff options
context:
space:
mode:
authorSimon Rettberg2015-08-31 23:40:19 +0200
committerSimon Rettberg2015-08-31 23:40:19 +0200
commit7af896f8023ff9fc2bc92b006781c13917c8f8b3 (patch)
treeb4f4c9bfff8e0f31393fa9f8080c64bdc94b53f7 /dozentenmodul/src/main/java
parent[client] Fix Wizard moving around when entering image selection page (diff)
downloadtutor-module-7af896f8023ff9fc2bc92b006781c13917c8f8b3.tar.gz
tutor-module-7af896f8023ff9fc2bc92b006781c13917c8f8b3.tar.xz
tutor-module-7af896f8023ff9fc2bc92b006781c13917c8f8b3.zip
[client] Don't show any error messages if session resume fails
Diffstat (limited to 'dozentenmodul/src/main/java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java468
1 files changed, 250 insertions, 218 deletions
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 cc86de07..f15e6e6c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -54,16 +54,20 @@ public class ThriftActions {
private static final long SIZE_CHECK_EXTRA_DL = 50l * 1024l * 1024l;
private static final long SIZE_CHECK_EXTRA_UL = 150l * 1024l * 1024l;
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * LOGIN
*
- * LOGIN
- *
* Login methods
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
- * @param frame to show user feedback on
- * @param data AuthenticationData as received from a successfull login, or
+ * @param frame
+ * to show user feedback on
+ * @param data
+ * AuthenticationData as received from a successfull login, or
* null if trying to resume a saved sessions
* @return true if initiliazing the session worked, false otherwise
*/
@@ -107,57 +111,65 @@ public class ThriftActions {
return false;
}
if (remoteVersion != Version.VERSION) {
- Gui.showMessageBox(frame,
- "Das von Ihnen verwendete Dozentenmodul ist nicht mit dem Satelliten-Server kompatibel.\n"
- + "Ihre Version: " + Version.VERSION + "\n" + "Satelliten-Version: "
- + remoteVersion, MessageType.ERROR, LOGGER, null);
+ if (data != null) {
+ Gui.showMessageBox(frame,
+ "Das von Ihnen verwendete Dozentenmodul ist nicht mit dem Satelliten-Server kompatibel.\n"
+ + "Ihre Version: " + Version.VERSION + "\n" + "Satelliten-Version: " + remoteVersion,
+ MessageType.ERROR, LOGGER, null);
+ }
return false;
}
// all good, try to get the whoami info
try {
whoami = client.whoami(satToken);
} catch (TAuthorizationException e) {
- Gui.showMessageBox(frame,
- "Authentifizierung erfolgreich, der Satellit verweigert jedoch die Verbindung.\n\n"
- + "Grund: " + e.number.toString() + " (" + e.message + ")", MessageType.ERROR,
- null, null);
+ if (data != null) {
+ Gui.showMessageBox(frame,
+ "Authentifizierung erfolgreich, der Satellit verweigert jedoch die Verbindung.\n\n" + "Grund: "
+ + e.number.toString() + " (" + e.message + ")", MessageType.ERROR, null, null);
+ }
return false;
} catch (TInvocationException e) {
- Gui.showMessageBox(
- frame,
- "Authentifizierung erfolgreich, bei der Kommunikation mit dem Satelliten trat jedoch ein interner Server-Fehler auf.",
- MessageType.ERROR, LOGGER, e);
+ if (data != null) {
+ Gui.showMessageBox(
+ frame,
+ "Authentifizierung erfolgreich, bei der Kommunikation mit dem Satelliten trat jedoch ein interner Server-Fehler auf.",
+ MessageType.ERROR, LOGGER, e);
+ }
return false;
} catch (Exception e) {
- Gui.showMessageBox(frame,
- "Authentifizierung erfolgreich, aber der Satellit akzeptiert das Sitzungstoken nicht.",
- MessageType.ERROR, LOGGER, e);
+ if (data != null) {
+ Gui.showMessageBox(frame,
+ "Authentifizierung erfolgreich, aber der Satellit akzeptiert das Sitzungstoken nicht.",
+ MessageType.ERROR, LOGGER, e);
+ }
return false;
}
if (whoami != null) {
Session.initialize(whoami, address, satToken, masterToken);
- ThriftManager.setSatelliteAddress(
- GraphicalCertHandler.getSslContext(Session.getSatelliteAddress()),
+ ThriftManager.setSatelliteAddress(GraphicalCertHandler.getSslContext(Session.getSatelliteAddress()),
Session.getSatelliteAddress(), App.THRIFT_SSL_PORT, App.THRIFT_TIMEOUT_MS);
return true;
}
return false;
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * IMAGE CREATION
*
- * IMAGE CREATION
- *
* Creates a base image with the given name
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
- * GUI-BLOCKING
- * Creates the image with the given name. Returns the uuid returned by the
- * server
+ * GUI-BLOCKING Creates the image with the given name. Returns the uuid
+ * returned by the server
*
- * @param frame calling this action
+ * @param frame
+ * calling this action
* @return uuid as String, or null if the creation failed
*/
public static String createImage(final Frame frame, final String name) {
@@ -167,23 +179,23 @@ public class ThriftActions {
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Erstellen des Images fehlgeschlagen");
} catch (Exception e) {
- Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR, LOGGER,
- e);
+ Gui.showMessageBox(frame, "Unbekannter Fehler beim Erstellen der VM", MessageType.ERROR, LOGGER, e);
}
return uuid;
}
/**
- * GUI-BLOCKING
- * Pushes a new image base to the server with the given imageBaseId and the
- * meta information in meta
+ * GUI-BLOCKING Pushes a new image base to the server with the given
+ * imageBaseId and the meta information in meta
*
- * @param frame to show user feedback on
- * @param imageBaseId image's id we are writing meta information of
- * @param meta actual meta information as ImageBaseWrite
+ * @param frame
+ * to show user feedback on
+ * @param imageBaseId
+ * image's id we are writing meta information of
+ * @param meta
+ * actual meta information as ImageBaseWrite
*/
- public static boolean updateImageBase(final Frame frame, final String imageBaseId,
- final ImageBaseWrite meta) {
+ public static boolean updateImageBase(final Frame frame, final String imageBaseId, final ImageBaseWrite meta) {
try {
ThriftManager.getSatClient().updateImageBase(Session.getSatelliteToken(), imageBaseId, meta);
} catch (TException e) {
@@ -194,42 +206,47 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Pushes the given permission map as custom permission for the given
- * imageBaseId
+ * GUI-BLOCKING Pushes the given permission map as custom permission for the
+ * given imageBaseId
*
- * @param frame to show user feedback on
- * @param imageBaseId image's id we are writing permissions of
- * @param permissions actual permissions map to write
+ * @param frame
+ * to show user feedback on
+ * @param imageBaseId
+ * image's id we are writing permissions of
+ * @param permissions
+ * actual permissions map to write
*/
public static void writeImagePermissions(final Frame frame, final String imageBaseId,
final Map<String, ImagePermissions> permissions) {
try {
- ThriftManager.getSatClient().writeImagePermissions(Session.getSatelliteToken(), imageBaseId,
- permissions);
+ ThriftManager.getSatClient().writeImagePermissions(Session.getSatelliteToken(), imageBaseId, permissions);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Konnte Berechtigungen nicht übertragen");
}
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * IMAGE VERSION UPLOAD
*
- * IMAGE VERSION UPLOAD
- *
- * Methods to upload an image version. This is compromised of two distinct steps:
- * - requestVersionUpload(..) to request the upload at the server
- * - initUpload(..) to actually start the upload of the file
+ * Methods to upload an image version. This is compromised of two distinct
+ * steps: - requestVersionUpload(..) to request the upload at the server -
+ * initUpload(..) to actually start the upload of the file
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
- * GUI-BLOCKING
- * Request the upload of an image version. Returns the TransferInformation
- * received by the server
- * or null if the request failed. Will give user feedback about failures.
+ * GUI-BLOCKING Request the upload of an image version. Returns the
+ * TransferInformation received by the server or null if the request failed.
+ * Will give user feedback about failures.
*
- * @param frame caller of this method
- * @param imageBaseId uuid of the image to upload a version of
- * @param fileSize size in bytes(?) of the uploaded file
+ * @param frame
+ * caller of this method
+ * @param imageBaseId
+ * uuid of the image to upload a version of
+ * @param fileSize
+ * size in bytes(?) of the uploaded file
* @param blockHashes
* @param machineDescription
* @param callback
@@ -239,8 +256,7 @@ public class ThriftActions {
public static TransferInformation requestVersionUpload(final Frame frame, final String imageBaseId,
final long fileSize, final List<ByteBuffer> blockHashes, final ByteBuffer machineDescription) {
try {
- if (ThriftManager.getSatClient().getStatus().getAvailableStorageBytes() < fileSize
- + SIZE_CHECK_EXTRA_UL) {
+ if (ThriftManager.getSatClient().getStatus().getAvailableStorageBytes() < fileSize + SIZE_CHECK_EXTRA_UL) {
Gui.showMessageBox(
frame,
"Nicht genügend Speicherplatz Satelliten. Löschen Sie nicht verwendete Imageversionen oder kontaktieren sie den Administrator.",
@@ -253,8 +269,8 @@ public class ThriftActions {
}
TransferInformation ti = null;
try {
- ti = ThriftManager.getSatClient().requestImageVersionUpload(Session.getSatelliteToken(),
- imageBaseId, fileSize, null, // TODO remove deprecated parameter
+ ti = ThriftManager.getSatClient().requestImageVersionUpload(Session.getSatelliteToken(), imageBaseId,
+ fileSize, null, // TODO remove deprecated parameter
machineDescription);
LOGGER.info("Version upload granted, versionId: '" + ti.toString());
} catch (TAuthorizationException e) {
@@ -266,19 +282,22 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Starts uploading the given diskFile using the transferInformation and
- * hashGen
+ * GUI-BLOCKING Starts uploading the given diskFile using the
+ * transferInformation and hashGen
*
- * @param frame caller of this method
- * @param transferInformation transfer information to use for the upload
- * @param hashGen hash generator for this file
- * @param diskFile the file to upload
+ * @param frame
+ * caller of this method
+ * @param transferInformation
+ * transfer information to use for the upload
+ * @param hashGen
+ * hash generator for this file
+ * @param diskFile
+ * the file to upload
* @return UploadTask if the uploading initialized, or null if uploading
* failed
*/
- public static InitUploadStatus initUpload(final Frame frame,
- final TransferInformation transferInformation, final File diskFile) {
+ public static InitUploadStatus initUpload(final Frame frame, final TransferInformation transferInformation,
+ final File diskFile) {
UploadTask uploadTask = null;
// do actually start the upload now
LOGGER.debug("Starting upload for: " + diskFile.toPath());
@@ -286,8 +305,7 @@ public class ThriftActions {
uploadTask = new UploadTask(Session.getSatelliteAddress(), transferInformation.getPlainPort(),
transferInformation.getToken(), diskFile);
} catch (FileNotFoundException e) {
- Gui.asyncMessageBox(
- "Kann VM nicht hochladen: Datei nicht gefunden\n\n" + diskFile.getAbsolutePath(),
+ Gui.asyncMessageBox("Kann VM nicht hochladen: Datei nicht gefunden\n\n" + diskFile.getAbsolutePath(),
MessageType.ERROR, LOGGER, e);
return null;
}
@@ -295,7 +313,8 @@ public class ThriftActions {
try {
hashGen = new AsyncHashGenerator(transferInformation.token, diskFile);
hashGen.start();
- Util.sleep(50);// A little ugly... Give the hash generator a head start
+ Util.sleep(50);// A little ugly... Give the hash generator a head
+ // start
} catch (FileNotFoundException | NoSuchAlgorithmException e) {
Gui.showMessageBox(frame, "Kann keine Block-Hashes für den Upload berechnen, "
+ "automatische Fehlerkorrektur deaktiviert.", MessageType.WARNING, LOGGER, e);
@@ -304,14 +323,13 @@ public class ThriftActions {
Thread uploadThread = new Thread(uploadTask);
uploadThread.setDaemon(true);
uploadThread.start();
- do { // Even more ugly - block the GUI thread so we know whether the upload started, and only then switch to the next page
+ do { // Even more ugly - block the GUI thread so we know whether the
+ // upload started, and only then switch to the next page
Util.sleep(5);
- } while (uploadTask.getFailCount() == 0 && uploadTask.getTransferCount() == 0
- && !uploadTask.isCanceled());
+ } while (uploadTask.getFailCount() == 0 && uploadTask.getTransferCount() == 0 && !uploadTask.isCanceled());
if (uploadTask.getTransferCount() == 0) {
- Gui.asyncMessageBox("Aufbau der Verbindung zum Hochladen fehlgeschlagen", MessageType.ERROR,
- LOGGER, null);
+ Gui.asyncMessageBox("Aufbau der Verbindung zum Hochladen fehlgeschlagen", MessageType.ERROR, LOGGER, null);
hashGen.cancel();
uploadTask.cancel();
uploadTask = null;
@@ -320,9 +338,7 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Gives user feedback
- * TODO
+ * GUI-BLOCKING Gives user feedback TODO
*
* @param frame
* @param transferInformation
@@ -331,8 +347,7 @@ public class ThriftActions {
public static boolean updateImageVersion(final Frame frame, final String versionId,
final ImageVersionWrite versionInfo) {
try {
- ThriftManager.getSatClient().updateImageVersion(Session.getSatelliteToken(), versionId,
- versionInfo);
+ ThriftManager.getSatClient().updateImageVersion(Session.getSatelliteToken(), versionId, versionInfo);
} catch (TException e) {
Gui.showMessageBox(frame, "Konnte neue Version nicht erstellen!", MessageType.ERROR, LOGGER, e);
return false;
@@ -340,14 +355,17 @@ public class ThriftActions {
return true;
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * IMAGE VERSION DOWNLOAD
*
- * IMAGE VERSION DOWNLOAD
- *
- * Download image version action composed of the interface 'DownloadCallback'
- * and the actual static method 'initDownload' to start the download.
+ * Download image version action composed of the interface
+ * 'DownloadCallback' and the actual static method 'initDownload' to start
+ * the download.
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
* The callback interface to inform the GUI about the status of the
* operation
@@ -357,18 +375,22 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING
- * Initialises the download of the given imageVersionId saving it to the
- * given
- * imageName
+ * NON-BLOCKING Initialises the download of the given imageVersionId saving
+ * it to the given imageName
*
- * @param frame caller of this method
- * @param imageVersionId image version id to download
- * @param imageName destination file name
- * @param virtualizerId id of the virtualizer
- * @param imageSize size in bytes of the image to download
- * @param callback callback function to return status of this operation to
- * the GUI
+ * @param frame
+ * caller of this method
+ * @param imageVersionId
+ * image version id to download
+ * @param imageName
+ * destination file name
+ * @param virtualizerId
+ * id of the virtualizer
+ * @param imageSize
+ * size in bytes of the image to download
+ * @param callback
+ * callback function to return status of this operation to the
+ * GUI
*/
public static void initDownload(final Frame frame, final String imageVersionId, final String imageName,
final String virtualizerId, final long imageSize, final DownloadCallback callback) {
@@ -389,8 +411,7 @@ public class ThriftActions {
if (diskFile.exists()) {
boolean ret = Gui.showMessageBox(frame, "Datei '" + diskFile.getAbsolutePath()
- + "' existiert bereits, wollen Sie sie überschreiben?", MessageType.QUESTION_YESNO,
- LOGGER, null);
+ + "' existiert bereits, wollen Sie sie überschreiben?", MessageType.QUESTION_YESNO, LOGGER, null);
if (!ret) {
// user aborted
if (callback != null)
@@ -399,8 +420,7 @@ public class ThriftActions {
}
// delete it
if (!diskFile.delete() && diskFile.exists()) {
- Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR,
- LOGGER, null);
+ Gui.showMessageBox(frame, "Datei konnte nicht überschrieben werden!", MessageType.ERROR, LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -410,9 +430,8 @@ public class ThriftActions {
// Check the free space on disk
if (destDir.getUsableSpace() < imageSize + SIZE_CHECK_EXTRA_DL) {
Gui.showMessageBox(frame, "Nicht genügend Speicherplatz im ausgewählten Verzeichnis verfügbar.\n"
- + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n"
- + "Habe: " + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR,
- LOGGER, null);
+ + "Brauche: " + FormatHelper.bytes(imageSize + SIZE_CHECK_EXTRA_DL, false) + "\n" + "Habe: "
+ + FormatHelper.bytes(destDir.getUsableSpace(), false), MessageType.ERROR, LOGGER, null);
if (callback != null)
callback.downloadInitialized(false);
return;
@@ -435,8 +454,8 @@ public class ThriftActions {
public void fire() {
TransferInformation transInf;
try {
- transInf = ThriftManager.getSatClient().requestDownload(Session.getSatelliteToken(),
- imageVersionId);
+ transInf = ThriftManager.getSatClient()
+ .requestDownload(Session.getSatelliteToken(), imageVersionId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Die Download-Anfrage ist gescheitert");
if (callback != null)
@@ -446,8 +465,8 @@ public class ThriftActions {
final DownloadTask dlTask;
try {
- dlTask = new DownloadTask(Session.getSatelliteAddress(), transInf.getPlainPort(),
- transInf.getToken(), tmpFile, imageSize, null);
+ dlTask = new DownloadTask(Session.getSatelliteAddress(), transInf.getPlainPort(), transInf
+ .getToken(), tmpFile, imageSize, null);
} catch (FileNotFoundException e) {
Gui.asyncMessageBox(
"Konnte Download nicht vorbereiten: Der gewählte Zielort ist nicht beschreibbar",
@@ -483,8 +502,7 @@ public class ThriftActions {
/**
* Generates a filename based on the given imageName and with the proper
- * extension
- * depending on the virtualizer
+ * extension depending on the virtualizer
*
* @param imageName
* @param virtualizerId
@@ -505,13 +523,15 @@ public class ThriftActions {
return fileName;
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * IMAGE METADATA
*
- * IMAGE METADATA
- *
* Fetches image details or permissions
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
* TODO
*/
@@ -534,8 +554,7 @@ public class ThriftActions {
* @param imageBaseId
* @param callback
*/
- public static void getImageDetails(final Frame frame, final String imageBaseId,
- final ImageMetaCallback callback) {
+ public static void getImageDetails(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
ImageDetailsRead details = null;
@@ -554,8 +573,7 @@ public class ThriftActions {
});
}
- public static void getImageFullDetails(final Frame frame, final String imageBaseId,
- final ImageMetaCallback callback) {
+ public static void getImageFullDetails(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
ImageDetailsRead details = null;
Map<String, ImagePermissions> permissions = null;
@@ -578,8 +596,7 @@ public class ThriftActions {
}
// async
- public static void getImagePermissions(final Frame frame, final String imageBaseId,
- final ImageMetaCallback callback) {
+ public static void getImagePermissions(final Frame frame, final String imageBaseId, final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
Map<String, ImagePermissions> permissionMap = null;
@@ -599,12 +616,10 @@ public class ThriftActions {
}
// sync
- public static Map<String, ImagePermissions> getImagePermissions(final Frame frame,
- final String imageBaseId) {
+ public static Map<String, ImagePermissions> getImagePermissions(final Frame frame, final String imageBaseId) {
Map<String, ImagePermissions> permissionMap = null;
try {
- permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(),
- imageBaseId);
+ permissionMap = ThriftManager.getSatClient().getImagePermissions(Session.getSatelliteToken(), imageBaseId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Lesen der Metadaten");
}
@@ -612,18 +627,19 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Sets the owner of the given lectureId to newOwner
+ * GUI-BLOCKING Sets the owner of the given lectureId to newOwner
*
- * @param frame to display user feedback on
- * @param lectureId lecture's id to set the new owner of
- * @param newOwner as UserInfo
+ * @param frame
+ * to display user feedback on
+ * @param lectureId
+ * lecture's id to set the new owner of
+ * @param newOwner
+ * as UserInfo
* @return true if it worked, false otherwise
*/
public static boolean setImageOwner(final Frame frame, final String lectureId, final UserInfo newOwner) {
try {
- ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId,
- newOwner.getUserId());
+ ThriftManager.getSatClient().setImageOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId());
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
return false;
@@ -631,13 +647,15 @@ public class ThriftActions {
return true;
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * IMAGE / VERSION DELETION
*
- * IMAGE / VERSION DELETION
- *
* Deletes a specific image version
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
* Delete callback interface to be implemented by callers of
* ThriftActions.deleteImageVersion(..)
@@ -646,13 +664,13 @@ public class ThriftActions {
/**
* Called once the status of a delete operation is determined
*
- * @param success true if deleted successfully, false otherwise
+ * @param success
+ * true if deleted successfully, false otherwise
*/
void isDeleted(boolean success);
}
- public static void deleteImageBase(final Frame frame, final String imageBaseId,
- final DeleteCallback callback) {
+ public static void deleteImageBase(final Frame frame, final String imageBaseId, final DeleteCallback callback) {
if (imageBaseId == null || imageBaseId.isEmpty())
return;
// first look if we have versions
@@ -662,8 +680,8 @@ public class ThriftActions {
List<ImageVersionDetails> versionToBeDeleted = null;
try {
details = ThriftManager.getSatClient().getImageDetails(Session.getSatelliteToken(), imageBaseId);
- List<LectureSummary> lectureList = ThriftManager.getSatClient().getLectureList(
- Session.getSatelliteToken(), 100);
+ List<LectureSummary> lectureList = ThriftManager.getSatClient().getLectureList(Session.getSatelliteToken(),
+ 100);
for (LectureSummary lecture : lectureList) {
if (lecture.getImageBaseId().equals(imageBaseId)) {
if (lecturesToBeDeleted == null)
@@ -680,7 +698,8 @@ public class ThriftActions {
}
} catch (TException e) {
- ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Holen der Versionen/Veranstaltung zu folgendes Image: " + imageBaseId);
+ ThriftError.showMessage(frame, LOGGER, e,
+ "Fehler beim Holen der Versionen/Veranstaltung zu folgendes Image: " + imageBaseId);
return;
}
String questionText = "";
@@ -717,23 +736,23 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING
- * Deletes either an image base or an image version depending on the
- * parameters.
- * To delete an image base, give the imageBaseId and let imageVersionId be
- * null.
- * To delete an image version, set both imageBaseId and imageVersionId.
- * The success of the operation will be forwarded to the GUI through the
- * DeleteCallback.
+ * NON-BLOCKING Deletes either an image base or an image version depending
+ * on the parameters. To delete an image base, give the imageBaseId and let
+ * imageVersionId be null. To delete an image version, set both imageBaseId
+ * and imageVersionId. The success of the operation will be forwarded to the
+ * GUI through the DeleteCallback.
*
- * @param frame next parent frame of the caller of this method
- * @param imageBaseId uuid of the image that belongs to the version
- * @param imageVersionId id of the image version to be deleted
- * @param callback called to inform the GUI about the deletion status (see
+ * @param frame
+ * next parent frame of the caller of this method
+ * @param imageBaseId
+ * uuid of the image that belongs to the version
+ * @param imageVersionId
+ * id of the image version to be deleted
+ * @param callback
+ * called to inform the GUI about the deletion status (see
* DeleteCallback interface)
*/
- public static void deleteImageVersion(final Frame frame, final String imageVersionId,
- final DeleteCallback callback) {
+ public static void deleteImageVersion(final Frame frame, final String imageVersionId, final DeleteCallback callback) {
// TODO async?
if (imageVersionId == null || imageVersionId.isEmpty())
return;
@@ -749,7 +768,8 @@ public class ThriftActions {
return;
}
String questionText = "";
- // represents if we found matches of not, needed to make a proper message
+ // represents if we found matches of not, needed to make a proper
+ // message
boolean matches = false;
if (lectureList != null && !lectureList.isEmpty()) {
for (LectureSummary lecture : lectureList) {
@@ -789,18 +809,22 @@ public class ThriftActions {
});
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * LECTURE CREATION
*
- * LECTURE CREATION
- *
- * Methods to create lectures
+ * Methods to create lectures
*
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
* Creates a lecture with the given meta data
*
- * @param frame to show user feedback on
- * @param meta actual meta data as LectureWrite
+ * @param frame
+ * to show user feedback on
+ * @param meta
+ * actual meta data as LectureWrite
* @return the created lecture's id if it worked, null otherwise
*/
public static String createLecture(final Frame frame, final LectureWrite meta) {
@@ -817,19 +841,20 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Writes custom lecture permissions (permissions param) for the given
- * lectureId.
+ * 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
+ * @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 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;
@@ -837,13 +862,15 @@ public class ThriftActions {
return true;
}
- /* *******************************************************************************
+ /* *******************************************************************************
*
- * LECTURE METADATA
- *
- * Methods to push metadata of lectures
+ * LECTURE METADATA
*
- ********************************************************************************/
+ * Methods to push metadata of lectures
+ *
+ * **************************************************************************
+ * ****
+ */
/**
* @author joe
*
@@ -904,16 +931,18 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Updates the lecture with given lectureId to the given lecture
+ * GUI-BLOCKING Updates the lecture with given lectureId to the given
+ * lecture
*
- * @param frame to show user feedback on
- * @param lectureId lecture's is to update
- * @param lecture LectureWrite data to update the lecture with
+ * @param frame
+ * to show user feedback on
+ * @param lectureId
+ * lecture's is to update
+ * @param lecture
+ * LectureWrite data to update the lecture with
* @return
*/
- public static boolean updateLecture(final Frame frame, final String lectureId,
- final LectureWrite lectureWrite) {
+ public static boolean updateLecture(final Frame frame, final String lectureId, final LectureWrite lectureWrite) {
try {
ThriftManager.getSatClient().updateLecture(Session.getSatelliteToken(), lectureId, lectureWrite);
} catch (TException e) {
@@ -930,13 +959,11 @@ public class ThriftActions {
* @param lectureId
* @param callback
*/
- public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame,
- final String lectureId) {
+ public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame, final String lectureId) {
Map<String, LecturePermissions> permissions = null;
try {
- permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(),
- lectureId);
+ permissions = ThriftManager.getSatClient().getLecturePermissions(Session.getSatelliteToken(), lectureId);
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Konnte Veranstaltungdaten nicht abrufen");
}
@@ -945,18 +972,19 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
- * Sets the owner of the given lectureId to newOwner
+ * GUI-BLOCKING Sets the owner of the given lectureId to newOwner
*
- * @param frame to display user feedback on
- * @param lectureId lecture's id to set the new owner of
- * @param newOwner as UserInfo
+ * @param frame
+ * to display user feedback on
+ * @param lectureId
+ * lecture's id to set the new owner of
+ * @param newOwner
+ * as UserInfo
* @return true if it worked, false otherwise
*/
public static boolean setLectureOwner(final Frame frame, final String lectureId, final UserInfo newOwner) {
try {
- ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId,
- newOwner.getUserId());
+ ThriftManager.getSatClient().setLectureOwner(Session.getSatelliteToken(), lectureId, newOwner.getUserId());
} catch (TException e) {
ThriftError.showMessage(frame, LOGGER, e, "Fehler beim Übertragen der Besitzrechte");
return false;
@@ -964,13 +992,15 @@ public class ThriftActions {
return true;
}
- /* *******************************************************************************
+ /* *******************************************************************************
*
- * LECTURE DELETION
- *
- * Methods to delete lectures
+ * LECTURE DELETION
*
- ********************************************************************************/
+ * Methods to delete lectures
+ *
+ * **************************************************************************
+ * ****
+ */
/**
* Callback interface reporting the status of the deletion back to the gui
*/
@@ -979,15 +1009,13 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING
- * Deletes the lecture with the given lectureId
+ * NON-BLOCKING Deletes the lecture with the given lectureId
*
* @param frame
* @param lectureId
* @param callback
*/
- public static void deleteLecture(final Frame frame, final String lectureId,
- final DeleteLectureCallback callback) {
+ public static void deleteLecture(final Frame frame, final String lectureId, final DeleteLectureCallback callback) {
if (lectureId == null)
return;
if (!userConfirmed(frame, "Wollen Sie diese Veranstaltung wirklick löschen?"))
@@ -1015,16 +1043,20 @@ public class ThriftActions {
});
}
- /* *******************************************************************************
+ /* *******************************************************************************
+ *
+ * PRIVATE HELPERS
*
- * PRIVATE HELPERS
- *
- ********************************************************************************/
+ * **************************************************************************
+ * ****
+ */
/**
* Helper to ask the user for confirmation. Returns his choice.
*
- * @param frame frame to show this message box on
- * @param message question message to display to the user
+ * @param frame
+ * frame to show this message box on
+ * @param message
+ * question message to display to the user
* @return true if the user confirmed (clicked yes), false otherwise
*/
private static boolean userConfirmed(final Frame frame, final String message) {