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