summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx
diff options
context:
space:
mode:
authorJonathan Bauer2015-09-03 13:31:43 +0200
committerJonathan Bauer2015-09-03 13:31:43 +0200
commit16380040737534ff837c53a8bbd6515646feea5f (patch)
tree546749d6504d6592975362fe42dcc9c8ff71cd1f /dozentenmodul/src/main/java/org/openslx
parent[client] add close hooks in LectureDetails (diff)
downloadtutor-module-16380040737534ff837c53a8bbd6515646feea5f.tar.gz
tutor-module-16380040737534ff837c53a8bbd6515646feea5f.tar.xz
tutor-module-16380040737534ff837c53a8bbd6515646feea5f.zip
[client] removed unusued interface function and filled some missing comments
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java159
1 files changed, 92 insertions, 67 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 2900ee20..8c0dd0ab 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/thrift/ThriftActions.java
@@ -522,6 +522,15 @@ 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
+ * chars of the version id...
+ *
+ * @param imageName name of the image
+ * @param imageVersionId version id
+ * @return generated directory name as String
+ */
private static String generateDirname(String imageName, String imageVersionId) {
String fileName = imageName.replaceAll("[^a-zA-Z0-9_\\.\\-]+", "_");
if (fileName.length() > 50) {
@@ -535,18 +544,22 @@ public class ThriftActions {
*
* IMAGE METADATA
*
- * Fetches image details or permissions
- *
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
+
/**
- * TODO
+ * Callback interface for image meta calls
*/
public interface ImageMetaCallback {
void fetchedImageDetails(ImageDetailsRead details, Map<String, ImagePermissions> permissions);
}
+ /**
+ * 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
+ * @return details as ImageDetailsRead if fetching worked, null otherwise
+ */
public static ImageDetailsRead getImageDetails(final Frame frame, final String imageBaseId) {
ImageDetailsRead details = null;
try {
@@ -558,9 +571,13 @@ public class ThriftActions {
}
/**
- * @param frame
- * @param imageBaseId
- * @param callback
+ * 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
+ * @param imageBaseId image's id to get the details of
+ * @param callback interface to return the details back to the gui
*/
public static void getImageDetails(final Frame frame, final String imageBaseId,
final ImageMetaCallback callback) {
@@ -582,6 +599,14 @@ public class ThriftActions {
});
}
+ /**
+ * 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
+ * @param imageBaseId image's id to get the full details of
+ * @param callback interface called to return the details back to the gui
+ */
public static void getImageFullDetails(final Frame frame, final String imageBaseId,
final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
@@ -590,7 +615,6 @@ public class ThriftActions {
@Override
public void fire() {
- // sync calls
details = ThriftActions.getImageDetails(frame, imageBaseId);
permissions = ThriftActions.getImagePermissions(frame, imageBaseId);
Gui.asyncExec(new Runnable() {
@@ -605,7 +629,13 @@ public class ThriftActions {
});
}
- // async
+ /**
+ * 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
+ * @param callback interface to return the permission list back to the gui
+ */
public static void getImagePermissions(final Frame frame, final String imageBaseId,
final ImageMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
@@ -626,7 +656,13 @@ public class ThriftActions {
});
}
- // sync
+ /**
+ * BLOCKING Gets the user-specific permission list for the given imageBaseId
+ *
+ * @param frame to display user feedback on
+ * @param imageBaseId image's base id to get the user permissions of
+ * @return the map userid-permissions if fetching worked, null otherwise
+ */
public static Map<String, ImagePermissions> getImagePermissions(final Frame frame,
final String imageBaseId) {
Map<String, ImagePermissions> permissionMap = null;
@@ -640,7 +676,7 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING Sets the owner of the given lectureId to newOwner
+ * 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
@@ -662,13 +698,9 @@ public class ThriftActions {
*
* IMAGE / VERSION DELETION
*
- * Deletes a specific image version
- *
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
/**
- * Delete callback interface to be implemented by callers of
+ * Callback interface to be implemented by callers of
* ThriftActions.deleteImageVersion(..)
*/
public interface DeleteCallback {
@@ -680,6 +712,14 @@ public class ThriftActions {
void isDeleted(boolean success);
}
+ /**
+ * BLOCKING Deletes the base image with the given id. Will call the given
+ * callback to report about the status of this operation
+ *
+ * @param frame to display user feedback on
+ * @param imageBaseId image base id to delete
+ * @param callback interface to report the outcome to the gui
+ */
public static void deleteImageBase(final Frame frame, final String imageBaseId,
final DeleteCallback callback) {
if (imageBaseId == null || imageBaseId.isEmpty())
@@ -740,14 +780,13 @@ public class ThriftActions {
try {
ThriftManager.getSatClient().deleteImageBase(Session.getSatelliteToken(), imageBaseId);
} catch (TException e) {
- // TODO Auto-generated catch block
ThriftError.showMessage(frame, LOGGER, e, "Konnte Basis-Image nicht löschen!");
}
}
/**
- * NON-BLOCKING Deletes either an image base or an image version depending
+ * 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
@@ -761,7 +800,6 @@ public class ThriftActions {
*/
public static void deleteImageVersion(final Frame frame, final String imageVersionId,
final DeleteCallback callback) {
- // TODO async?
if (imageVersionId == null || imageVersionId.isEmpty())
return;
boolean success = false;
@@ -821,13 +859,9 @@ public class ThriftActions {
*
* LECTURE CREATION
*
- * Methods to create lectures
- *
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
/**
- * Creates a lecture with the given meta data
+ * BLOCKING Creates a lecture with the given meta data
*
* @param frame to show user feedback on
* @param meta actual meta data as LectureWrite
@@ -847,7 +881,7 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING Writes custom lecture permissions (permissions param) for
+ * BLOCKING Writes custom lecture permissions (permissions param) for
* the given lectureId.
*
* @param frame to show user feedback on
@@ -870,29 +904,25 @@ public class ThriftActions {
*
* LECTURE METADATA
*
- * Methods to push metadata of lectures
- *
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
+
+
+
/**
- * @author joe
- *
+ * Interface for GUI-classes running async lecture meta calls
*/
public interface LectureMetaCallback {
- void fetchedLectureDetails(LectureRead lecture, ImageDetailsRead image);
-
- void fetchedLecturePermissions(Map<String, LecturePermissions> permissions);
+ void fetchedLectureAndImageDetails(LectureRead lecture, ImageDetailsRead image);
}
/**
- * NON-BLOCKING
+ * NON-BLOCKING Gets the lecture and image details of the given lectureId
*
- * @param frame
- * @param lectureId
- * @param callback
+ * @param frame to display user feedback on
+ * @param lectureId lecture to get the full details of
+ * @param callback interface to return the details to the gui
*/
- public static void getLectureWithImageDetails(final Frame frame, final String lectureId,
+ public static void getLectureAndImageDetails(final Frame frame, final String lectureId,
final LectureMetaCallback callback) {
QuickTimer.scheduleOnce(new Task() {
@Override
@@ -909,7 +939,7 @@ public class ThriftActions {
@Override
public void run() {
if (callback != null) {
- callback.fetchedLectureDetails(lecture, fImage);
+ callback.fetchedLectureAndImageDetails(lecture, fImage);
}
}
});
@@ -918,11 +948,11 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
+ * BLOCKING Gets the lecture details of the lecture with given lectureId
*
- * @param frame
- * @param lectureId
- * @param callback
+ * @param frame to display user feedback on
+ * @param lectureId lecture to get the details of
+ * @return LectureRead if fetching details worked, null otherwise
*/
public static LectureRead getLectureDetails(final Frame frame, final String lectureId) {
LectureRead lecture = null;
@@ -935,8 +965,7 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING Updates the lecture with given lectureId to the given
- * lecture
+ * 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
@@ -955,11 +984,12 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING
+ * BLOCKING Gets the list of user-specific permission for the lecture with the
+ * given lectureId
*
- * @param frame
- * @param lectureId
- * @param callback
+ * @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
*/
public static Map<String, LecturePermissions> getLecturePermissions(final Frame frame,
final String lectureId) {
@@ -976,7 +1006,7 @@ public class ThriftActions {
}
/**
- * GUI-BLOCKING Sets the owner of the given lectureId to newOwner
+ * 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
@@ -998,11 +1028,7 @@ public class ThriftActions {
*
* LECTURE DELETION
*
- * Methods to delete lectures
- *
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
/**
* Callback interface reporting the status of the deletion back to the gui
*/
@@ -1013,9 +1039,9 @@ public class ThriftActions {
/**
* NON-BLOCKING Deletes the lecture with the given lectureId
*
- * @param frame
- * @param lectureId
- * @param callback
+ * @param frame to display user feedback on
+ * @param lectureId id of the lecture to delete
+ * @param callback interface to report the status back to the gui
*/
public static void deleteLecture(final Frame frame, final String lectureId,
final DeleteLectureCallback callback) {
@@ -1050,9 +1076,8 @@ public class ThriftActions {
*
* PRIVATE HELPERS
*
- * **************************************************************************
- * ****
- */
+ * *******************************************************************************/
+
/**
* Helper to ask the user for confirmation. Returns his choice.
*