git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorvasary.daniel <TFS\vasary.daniel>
Mon, 9 Aug 2021 09:18:37 +0000 (09:18 +0000)
committervasary.daniel <TFS\vasary.daniel>
Mon, 9 Aug 2021 09:18:37 +0000 (09:18 +0000)
server/user.jobengine.executors/src/user/jobengine/server/steps/DeleteNEXIOMaterialsStep.java

index d6e06d5d8276f847ca3be73948ba356037675f95..d13b3afd64f4d7b008e08f2878a8ffb9e095bcf8 100644 (file)
@@ -2,7 +2,6 @@ package user.jobengine.server.steps;
 \r
 import java.text.SimpleDateFormat;\r
 import java.util.Calendar;\r
-import java.util.Date;\r
 import java.util.List;\r
 \r
 import org.apache.commons.lang.StringUtils;\r
@@ -28,8 +27,10 @@ import user.jobengine.server.IJobRuntime;
 \r
 public class DeleteNEXIOMaterialsStep extends JobStep {\r
        private static final Logger logger = LogManager.getLogger(DeleteNEXIOMaterialsStep.class);\r
-       private static final String NEXIOCLIPS = "nexioclips";\r
+       //"nexioclips"\r
+       private static final String NEXIOCLIPS = SystemConfiguration.getInstance().value("services.nexio.collection-name");\r
        private static final String KILLDATE = "killdate";\r
+       private static final String RECORDDATE = "recorddate";\r
        private static final String LONGNAMEID = "longnameid";\r
        private static final String EXTAGENCY = "extagency";\r
        private static String NEXIO_HOST = SystemConfiguration.getInstance().value("services.nexio.host");\r
@@ -42,23 +43,28 @@ public class DeleteNEXIOMaterialsStep extends JobStep {
                        remoteFile = sourceUri.getRemoteFile(name);\r
                        if (remoteFile == null) {\r
                                logger.warn(jobRuntime.getSessionMarker(), "A '{}' fájl már nem található meg a NEXIO szerveren", name);\r
+                               logger.warn(getMarker(), "A '{}' fájl már nem található meg a NEXIO szerveren", name);\r
                                return;\r
                        }\r
                        sourceUri.delete(remoteFile);\r
                        logger.info(jobRuntime.getSessionMarker(), "A '{}' fájl törlése sikeres volt.", name);\r
+                       logger.info(getMarker(), "A '{}' fájl törlése sikeres volt.", name);\r
                } catch (Exception e) {\r
-                       logger.error(jobRuntime.getSessionMarker(), "A '{}' fájl nem törölhető. A rendszer hibaüzenete: {}", name, e.getMessage());\r
+                       logger.error(jobRuntime.getSessionMarker(), "A '{}' fájl nem törölhető. A rendszer hibaüzenete: {}", name,\r
+                                       e.getMessage());\r
+                       logger.error(getMarker(), "A '{}' fájl nem törölhető. A rendszer hibaüzenete: {}", name, e.getMessage());\r
                }\r
        }\r
 \r
        @StepEntry\r
-       public Object[] execute(int port, String userName, String password, String filterAgencies, int gracePeriodDays, boolean notificationOnly,\r
-                       IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+       public Object[] execute(int port, String userName, String password, String filterAgencies, int gracePeriodDays,\r
+                       boolean notificationOnly, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
                this.jobRuntime = jobRuntime;\r
-               logger.info("TESZT");\r
+               logger.info(getMarker(), "TESZT");\r
                if (StringUtils.isBlank(NEXIO_HOST)) {\r
                        logger.error(jobRuntime.getSessionMarker(), "A 'nexio.host' rendszer paraméter nem található.");\r
-                       throw new NullPointerException("System is not configured properly, 'nexio.host' startup parameter missing.");\r
+                       throw new NullPointerException(\r
+                                       "System is not configured properly, 'nexio.host' startup parameter missing.");\r
                }\r
 \r
                if (StringUtils.isBlank(filterAgencies)) {\r
@@ -90,16 +96,20 @@ public class DeleteNEXIOMaterialsStep extends JobStep {
                sourceUri.setPassword(password);\r
 \r
                List<BasicDBObject> clips = ListUtils.cast(cursor.toArray());\r
-               SimpleDateFormat df = new SimpleDateFormat("yyyy.MM.dd");\r
-\r
+               SimpleDateFormat dffull = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");\r
+               logger.info(getMarker(), "{} fájl vizsgálata elindul a {} lista alapján", clips.size(), NEXIOCLIPS);\r
                int i = 0;\r
                for (BasicDBObject clip : clips) {\r
                        String name = String.valueOf(clip.get(LONGNAMEID));\r
-                       Date killdate = clip.getDate(KILLDATE);\r
-                       if (notificationOnly)\r
-                               logger.info(jobRuntime.getSessionMarker(), "Az {} fájl törölhető. Lejárt: {} ", name, df.format(killdate));\r
-                       else\r
+                       //logger.info(getMarker(), name);\r
+                       String agency = String.valueOf(clip.get(EXTAGENCY));\r
+\r
+                       logger.info(getMarker(), "Az {} fájl törölhető. Rögzítve: {}, Lejárt: {}, Agency: {} ", name,\r
+                                       dffull.format(clip.getDate(RECORDDATE)), dffull.format(clip.getDate(KILLDATE)), agency);\r
+\r
+                       if (!notificationOnly)\r
                                delete(name);\r
+\r
                        i++;\r
                        int progress = i * 100 / clips.size();\r
                        setProgress(progress);\r