summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
diff options
context:
space:
mode:
authorSimon Rettberg2015-09-03 18:41:00 +0200
committerSimon Rettberg2015-09-03 18:41:00 +0200
commit8e6d9a0f347a258538d3a84ecb9123f39a7a9154 (patch)
treecffcfb2382cadc0023f0af4440833e683a6fab30 /dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
parentMerge branch 'v1.1' of git.openslx.org:openslx-ng/tutor-module into v1.1 (diff)
downloadtutor-module-8e6d9a0f347a258538d3a84ecb9123f39a7a9154.tar.gz
tutor-module-8e6d9a0f347a258538d3a84ecb9123f39a7a9154.tar.xz
tutor-module-8e6d9a0f347a258538d3a84ecb9123f39a7a9154.zip
[client] Don't go crazy on lectures without an image
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java49
1 files changed, 29 insertions, 20 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 ca13e4c6..9022534c 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -524,12 +524,14 @@ public class ThriftActions {
}
/**
- * Helper to generate a directory name for the given imageName and imageVersionId.
- * Uses the given parameters to build a hopefully unique name as it takes the first 8
+ * Helper to generate a directory name for the given imageName and
+ * imageVersionId.
+ * Uses the given parameters to build a hopefully unique name as it takes
+ * the first 8
* chars of the version id...
*
* @param imageName name of the image
- * @param imageVersionId version id
+ * @param imageVersionId version id
* @return generated directory name as String
*/
private static String generateDirname(String imageName, String imageVersionId) {
@@ -555,7 +557,8 @@ public class ThriftActions {
}
/**
- * BLOCKING Gets the image details (w/o permissions) of the given imageBaseID
+ * BLOCKING Gets the image details (w/o permissions) of the given
+ * imageBaseID
*
* @param frame to display user feedback on
* @param imageBaseId image's id to get the details of
@@ -572,8 +575,10 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING Gets the image details (without permissions) of the given imageBaseId.
- * Will return the details (or null if fetching failed) back to the gui-thread
+ * NON-BLOCKING Gets the image details (without permissions) of the given
+ * imageBaseId.
+ * Will return the details (or null if fetching failed) back to the
+ * gui-thread
* through the given callback
*
* @param frame to display user feedback on
@@ -601,7 +606,8 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING Gets the image details and the user-specific permission list of
+ * NON-BLOCKING Gets the image details and the user-specific permission list
+ * of
* the given imageBaseId. Will return the objects through the given callback
*
* @param frame to display user feedback on
@@ -631,7 +637,8 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING Gets the user-specific permission list for the given imageBaseId
+ * NON-BLOCKING Gets the user-specific permission list for the given
+ * imageBaseId
*
* @param frame to display user feedback on
* @param imageBaseId image's id to get the permission list of
@@ -719,7 +726,7 @@ public class ThriftActions {
*
* @param frame to display user feedback on
* @param imageBaseId image base id to delete
- * @param callback interface to report the outcome to the gui
+ * @param callback interface to report the outcome to the gui
*/
public static void deleteImageBase(final Frame frame, final String imageBaseId,
final DeleteCallback callback) {
@@ -907,8 +914,6 @@ public class ThriftActions {
*
* *******************************************************************************/
-
-
/**
* Interface for GUI-classes running async lecture meta calls
*/
@@ -917,7 +922,10 @@ public class ThriftActions {
}
/**
- * NON-BLOCKING Gets the lecture and image details of the given lectureId
+ * NON-BLOCKING Gets the lecture and image details of the given lectureId.
+ * IF the lecture does not exist, both fields returned will be null. If the
+ * lecture exists, the image can still be null, since not all lectures link
+ * to an image at all times.
*
* @param frame to display user feedback on
* @param lectureId lecture to get the full details of
@@ -929,13 +937,12 @@ public class ThriftActions {
@Override
public void fire() {
final LectureRead lecture = ThriftActions.getLectureDetails(frame, lectureId);
- ImageDetailsRead image = null;
- if (lecture != null) {
- image = ThriftActions.getImageDetails(frame, lecture.getImageBaseId());
+ final ImageDetailsRead fImage;
+ if (lecture != null && lecture.imageBaseId != null) {
+ fImage = ThriftActions.getImageDetails(frame, lecture.getImageBaseId());
+ } else {
+ fImage = null;
}
- if (image == null)
- return;
- final ImageDetailsRead fImage = image;
Gui.asyncExec(new Runnable() {
@Override
public void run() {
@@ -985,12 +992,14 @@ public class ThriftActions {
}
/**
- * BLOCKING Gets the list of user-specific permission for the lecture with the
+ * BLOCKING Gets the list of user-specific permission for the lecture with
+ * the
* given lectureId
*
* @param frame to display user feedback on
* @param lectureId lecture's id to get the permission list of
- * @return the map of the userid-permissions if fetching worked, null otherwise
+ * @return the map of the userid-permissions if fetching worked, null
+ * otherwise
*/
public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame,
final String lectureId) {