git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorSweidan Omar <TFS\sweidan.omar>
Mon, 2 May 2022 09:59:52 +0000 (09:59 +0000)
committerSweidan Omar <TFS\sweidan.omar>
Mon, 2 May 2022 09:59:52 +0000 (09:59 +0000)
server/user.jobengine.executors/src/user/jobengine/server/steps/CleanupMountedLocationStep.java

index 3ed0e4f407e052b00bf7768c9cd1a74e7455ba52..d674c61e6bf3b1ca991cb04651618b2690a09f3c 100644 (file)
@@ -44,8 +44,9 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
                        final int[] specialCount = new int[] { 0 };\r
                        dirStream.forEach(p -> {\r
                                count[0]++;\r
-                               //                              if (p.getFileName().toString().toLowerCase().equals(PROJECTFOLDER.toLowerCase()))\r
-                               //                                      specialCount[0]++;\r
+                               // if\r
+                               // (p.getFileName().toString().toLowerCase().equals(PROJECTFOLDER.toLowerCase()))\r
+                               // specialCount[0]++;\r
                                if (p.getFileName().toString().toLowerCase().equals(STATUSFOLDER.toLowerCase()))\r
                                        specialCount[0]++;\r
 \r
@@ -85,12 +86,13 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
                DirectoryStream<Path> directoryStream = null;\r
                if (StringUtils.isBlank(sourcePath.toString())) {\r
                        logger.error(marker, "A folyamat 'sourcePath' bemeneti paramétere üres.");\r
-                       throw new NullPointerException("System is not configured properly, 'sourceFolder' input parameter missing.");\r
+                       throw new NullPointerException(\r
+                                       "System is not configured properly, 'sourceFolder' input parameter missing.");\r
                }\r
 \r
                if (!sourcePath.toFile().exists() || !sourcePath.toFile().isDirectory()) {\r
-                       logger.error(marker, "A {} mappa nem létezik.", sourceFolder);\r
-                       throw new NullPointerException(String.format("Directory %s not exists.", sourceFolder));\r
+                       logger.error(marker, "A(z) {} mappa nem létezik.", sourceFolder);\r
+                       throw new NullPointerException(String.format("Directory %s does not exist.", sourceFolder));\r
                }\r
 \r
                try {\r
@@ -107,7 +109,8 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
                        Files.walkFileTree(sourcePath, this);\r
                } catch (Exception e) {\r
                        logger.catching(e);\r
-                       logger.error(marker, "Hiba a '{}' mappa feldolgozásában. A rendszer hibaüzenete: {}", sourcePath, e.getMessage());\r
+                       logger.error(marker, "Hiba a '{}' mappa feldolgozásában. A rendszer hibaüzenete: {}", sourcePath,\r
+                                       e.getMessage());\r
                        throw e;\r
                } finally {\r
                        if (directoryStream != null) {\r
@@ -134,11 +137,14 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
                        try {\r
                                result = dateFormat.parse(strKillDate);\r
                        } catch (ParseException e) {\r
-                               logger.error(marker, "A {} fájl 'killdate' állománya hibás formátumú, a {} karaktersorozat nem konvertálható dátummá.", fileName, strKillDate);\r
+                               logger.error(marker,\r
+                                               "A {} fájl 'killdate' állománya hibás formátumú, a {} karaktersorozat nem konvertálható dátummá.",\r
+                                               fileName, strKillDate);\r
                                return null;\r
                        }\r
                } else\r
-                       logger.error(marker, "A {} fájl 'killdate' állománya hibás formátumú, az dátum helyett ez áll: '{}'.", fileName, strKillDate);\r
+                       logger.error(marker, "A {} fájl 'killdate' állománya hibás formátumú, az dátum helyett ez áll: '{}'.",\r
+                                       fileName, strKillDate);\r
                return result;\r
        }\r
 \r
@@ -181,7 +187,7 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
        @Override\r
        public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {\r
 \r
-               //A .-al kezdodo mappakat kihagyjuk\r
+               // A .-al kezdodo mappakat kihagyjuk\r
                if (dir.getFileName().toString().startsWith("."))\r
                        return FileVisitResult.SKIP_SUBTREE;\r
 \r
@@ -205,7 +211,9 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
                }\r
 \r
                if (killDateFiles.size() != 1)\r
-                       logger.warn(marker, "A {} fájlhoz több 'killdate' állomány található, a legújabb dátum határozza meg a törlés időpontját.", filePath);\r
+                       logger.warn(marker,\r
+                                       "A {} fájlhoz több 'killdate' állomány található, a legújabb dátum határozza meg a törlés időpontját.",\r
+                                       filePath);\r
 \r
                Date killDate = checkExpiration(killDateFiles);\r
                if (killDate == null)\r
@@ -213,16 +221,19 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
 \r
                if (!skipArchiveCheck && filePath.toFile().length() > 0) {\r
                        if (!ItemManagerExtensions.isArchived(getManager(), filePath)) {\r
-                               logger.error(marker, "A(z) {} anyag törlésre van kijelölve, de nem található az archívumban.", filePath);\r
+                               logger.error(marker, "A(z) {} anyag törlésre van kijelölve, de nem található az archívumban.",\r
+                                               filePath);\r
                                return;\r
                        }\r
                }\r
 \r
                if (removeFiles(filePath, killDateFiles))\r
-                       logger.info(marker, "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján sikeresen törlődtek.", filePath.getFileName(),\r
-                                       dateFormat.format(killDate));\r
+                       logger.info(marker,\r
+                                       "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján sikeresen törlődtek.",\r
+                                       filePath.getFileName(), dateFormat.format(killDate));\r
                else\r
-                       logger.warn(marker, "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján csak részlegesen vagy egyáltalán nem törlődtek.",\r
+                       logger.warn(marker,\r
+                                       "A {} fájl és kapcsolódó állományai a {} killdate bejegyzés alapján csak részlegesen vagy egyáltalán nem törlődtek.",\r
                                        filePath.getFileName(), dateFormat.format(killDate));\r
        }\r
 \r
@@ -241,7 +252,7 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
        private boolean removeFile(Path filePath) {\r
                boolean result = false;\r
                try {\r
-                       //logger.error("REMOVE {}", filePath);\r
+                       // logger.error("REMOVE {}", filePath);\r
                        File file = filePath.toFile();\r
                        if (file.exists())\r
                                result = file.delete();\r
@@ -257,8 +268,10 @@ public class CleanupMountedLocationStep extends JobStep implements FileVisitor<P
 \r
                removeFile(Paths.get(filePath.toString() + EWC2EXT));\r
                removeFile(Paths.get(filePath.toString() + XMPEXT));\r
-               removeFile(Paths.get(filePath.getParent().toString(), STATUSFOLDER, filePath.getFileName().toString() + CATCHEDEXT));\r
-               removeFile(Paths.get(filePath.getParent().toString(), STATUSFOLDER, filePath.getFileName().toString() + JSONEXT));\r
+               removeFile(Paths.get(filePath.getParent().toString(), STATUSFOLDER,\r
+                               filePath.getFileName().toString() + CATCHEDEXT));\r
+               removeFile(\r
+                               Paths.get(filePath.getParent().toString(), STATUSFOLDER, filePath.getFileName().toString() + JSONEXT));\r
 \r
                boolean result = true;\r
                for (Path killDateFile : killDateFiles) {\r