diff options
author | ralph isenmann | 2021-03-11 08:22:36 +0100 |
---|---|---|
committer | Manuel Bentele | 2021-03-11 10:05:59 +0100 |
commit | d85ee0495619121d263d722fb5546237696f0e3c (patch) | |
tree | 15377400cd7de16763b6816d86b585236da079c6 /dozentenmodul/src/main/java/org/openslx/dozmod/util/ContainerUtils.java | |
parent | [client] Disable VM configuration for Docker containers (diff) | |
download | tutor-module-d85ee0495619121d263d722fb5546237696f0e3c.tar.gz tutor-module-d85ee0495619121d263d722fb5546237696f0e3c.tar.xz tutor-module-d85ee0495619121d263d722fb5546237696f0e3c.zip |
[client] Fix switch between container and vm in lecture
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.java | 32 |
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; + } +} |