summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
new file mode 100644
index 00000000..1b83fdfc
--- /dev/null
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java
@@ -0,0 +1,32 @@
+package org.openslx.dozmod.util;
+
+import org.openslx.bwlp.thrift.iface.ImageSummaryRead;
+import org.openslx.bwlp.thrift.iface.LectureSummary;
+import org.openslx.dozmod.thrift.cache.LectureCache;
+import org.openslx.thrifthelper.TConst;
+
+import java.util.List;
+
+/**
+ * Class with some temporally Helper Functions.
+ */
+public class ContainerUtils {
+
+ /**
+ * Checks ImageBaseId of image if already linked with existing Lectures in LectureCache.
+ *
+ * @param image The image to check.
+ * @return true if the images imageBaseId is already linked with a lecture.
+ */
+ public static boolean isContainerImageLinked(ImageSummaryRead image) {
+ if (image != null && image.getVirtId().equals(TConst.VIRT_DOCKER)) {
+ List<LectureSummary> lectureSummaries = LectureCache.get(true);
+ for (LectureSummary lecture : lectureSummaries) {
+ if (lecture.imageBaseId.equals(image.imageBaseId)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}