From 458717e9b85bf9ef00c3ac0316da98f88fcfe7e0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?M=C3=A1rk=20M=C3=A9r=C3=A9sz?= Date: Fri, 20 Jul 2018 10:58:45 +0000 Subject: [PATCH] git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31201 --- server/-configuration/scheduledjobs.json | 6 +- .../jobtemplates/retrieve-ondemand.xml | 16 ++++ .../server/steps/TSMExtendedRetrieveStep.java | 82 ++++++++++++++---- .../server/steps/TSMRestoreStep.java | 17 ++-- .../pages/searchitems.zul | 35 ++++---- .../user/jobengine/zk/model/SearchModel.java | 84 +++++++++++++++---- .../user/jobengine/zk/util/SessionUtil.java | 50 ++++++++++- 7 files changed, 230 insertions(+), 60 deletions(-) diff --git a/server/-configuration/scheduledjobs.json b/server/-configuration/scheduledjobs.json index 8368e843..b39af791 100644 --- a/server/-configuration/scheduledjobs.json +++ b/server/-configuration/scheduledjobs.json @@ -25,7 +25,11 @@ {"name": "octopusOutputFolder", "value": "OCTOPUS", "type": "java.lang.String"}, {"name": "genericOutputFolder", "value": "ARCHIVE_RESTORE", "type": "java.lang.String"}, {"name": "onlineOutputFolder", "value": "ONLINE", "type": "java.lang.String"}, - {"name": "killDateDays", "value": 7, "type": "java.lang.Integer"} + {"name": "killDateDays", "value": 7, "type": "java.lang.Integer"}, + {"name": "nexioAgency", "value": "ARCHIVE_RESTORE", "type": "java.lang.String"}, + {"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"}, + {"name": "nexioUserName", "value": "administrator", "type": "java.lang.String"}, + {"name": "nexioPassword", "value": "system", "type": "java.lang.String"} ] }, { diff --git a/server/user.jobengine.executors/jobtemplates/retrieve-ondemand.xml b/server/user.jobengine.executors/jobtemplates/retrieve-ondemand.xml index be4d957a..79756820 100644 --- a/server/user.jobengine.executors/jobtemplates/retrieve-ondemand.xml +++ b/server/user.jobengine.executors/jobtemplates/retrieve-ondemand.xml @@ -15,6 +15,10 @@ + + + + @@ -91,6 +95,18 @@ + + + + + + + + + + + + diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMExtendedRetrieveStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMExtendedRetrieveStep.java index 9d1d5fd7..b8242447 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMExtendedRetrieveStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMExtendedRetrieveStep.java @@ -1,6 +1,14 @@ package user.jobengine.server.steps; +import java.io.OutputStream; +import java.util.Calendar; +import java.util.Date; + +import org.apache.commons.net.ftp.FTPClient; + +import user.commons.CalendarUtils; import user.commons.StoreUri; +import user.commons.remotestore.FtpDirectoryLister; import user.commons.remotestore.RemoteStoreProtocol; import user.jobengine.db.IItemManager; import user.jobengine.db.Media; @@ -9,26 +17,46 @@ import user.jobengine.server.IJobRuntime; public class TSMExtendedRetrieveStep extends TSMRestoreStep { private boolean useNexioTarget; + private int nexioPort; + private String nexioUserName, nexioPassword; + private String nexioHost; + private String nexioAgency; + + @Override + protected void afterRestore(StoreUri targetUri, String targetPath, int killDateDays, String targetFileName) throws Exception { + if (useNexioTarget) { + OutputStream outStream = null; + try { + FTPClient targetFTP = ((FtpDirectoryLister) targetUri.getLister()).connect(); + Calendar killDate = CalendarUtils.createCalendar(new Date()); + killDate.add(Calendar.DAY_OF_YEAR, killDateDays); + byte[] killDateFile = EscortFiles.createNEXIOKillDateFile(targetFileName, killDate.getTime(), null, nexioAgency); + outStream = targetFTP.storeFileStream(targetFileName + ".xml"); + if (outStream == null) { + throw new NullPointerException("Can not open: " + targetFileName + ".xml" + " Reply:" + targetFTP.getReplyString()); + } + outStream.write(killDateFile); + outStream.flush(); + } catch (Exception e) { + throw e; + } finally { + if (outStream != null) + outStream.close(); + targetUri.cleanUp(); + } + } + } + + @Override + protected void checkTargetPath(String targetPath) { + if (!useNexioTarget) + super.checkTargetPath(targetPath); + } @Override protected StoreUri createTargetUri(IItemManager manager, String targetPath) throws NullPointerException { StoreUri result = null; if (useNexioTarget) { - String nexioHost = System.getProperty("nexio.host"), nexioPassword = System.getProperty("nexioPassword"), - nexioUserName = System.getProperty("nexioUserName"); - Integer nexioPort = Integer.parseInt(System.getProperty("nexioPort")); - if (nexioHost == null) { - throw new NullPointerException("Missing system property on 'nexio.host' name"); - } - if (nexioPassword == null) { - throw new NullPointerException("Missing system property on 'nexioPassword' name"); - } - if (nexioPort == 0) { - throw new NullPointerException("Missing system property on 'nexioPort' name"); - } - if (nexioUserName == null) { - throw new NullPointerException("Missing system property on 'nexioUserName' name"); - } result = manager.createStoreUri(RemoteStoreProtocol.FTP, nexioHost); result.setPortNumber(nexioPort); result.setUserName(nexioUserName); @@ -41,8 +69,30 @@ public class TSMExtendedRetrieveStep extends TSMRestoreStep { @StepEntry public Object[] execute(Media mediaCubeMedia, String targetPath, String targetNamePattern, String successRecipient, int killDateDays, - String localRetrievePath, String globalRetrievePath, boolean useNexioTarget, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { + String localRetrievePath, String globalRetrievePath, boolean useNexioTarget, String nexioAgency, Integer nexioPort, String nexioUserName, + String nexioPassword, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception { this.useNexioTarget = useNexioTarget; + this.nexioAgency = nexioAgency; + this.nexioPort = nexioPort; + this.nexioUserName = nexioUserName; + this.nexioPassword = nexioPassword; + nexioHost = System.getProperty("nexio.host"); + + if (nexioHost == null) { + throw new NullPointerException("Missing system property on 'nexio.host' name"); + } + if (nexioPort == 0) { + throw new NullPointerException("System is not configured properly, 'nexioPort' input parameter missing."); + } + if (nexioUserName == null) { + throw new NullPointerException("System is not configured properly, 'nexioUserName' input parameter missing."); + } + if (nexioPassword == null) { + throw new NullPointerException("System is not configured properly, 'nexioPassword' input parameter missing."); + } + if (nexioAgency == null) { + throw new NullPointerException("System is not configured properly, 'nexioAgency' input parameter missing."); + } return super.execute(mediaCubeMedia, targetPath, targetNamePattern, successRecipient, killDateDays, localRetrievePath, globalRetrievePath, jobEngine, jobRuntime); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMRestoreStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMRestoreStep.java index 98a956ac..9b81e0e7 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMRestoreStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/TSMRestoreStep.java @@ -34,11 +34,18 @@ public class TSMRestoreStep extends JobStep { private String sourceFileName; private Marker marker; - protected void afterRestore(String targetPath, int killDateDays, String targetFileName) throws IOException { + protected void afterRestore(StoreUri targetUri, String targetPath, int killDateDays, String targetFileName) throws IOException, Exception { if (killDateDays > 0) EscortFiles.createUNCKillDate(targetPath, targetFileName, killDateDays, marker); } + protected void checkTargetPath(String targetPath) { + if (StringUtils.isBlank(targetPath)) { + logger.error(marker, "A folyamat 'targetPath' bemeneti paramétere üres."); + throw new NullPointerException("System is not configured properly, 'targetPath' input parameter missing."); + } + } + protected StoreUri createTargetUri(IItemManager manager, String targetPath) { return manager.createStoreUri(RemoteStoreProtocol.LOCAL, targetPath); } @@ -76,8 +83,7 @@ public class TSMRestoreStep extends JobStep { if (StringUtils.isNotBlank(successRecipient)) logger.info(new MediaCubeMarker(successRecipient), msg); logger.info(marker, msg); - - afterRestore(targetPath, killDateDays, targetFileName); + afterRestore(targetUri, targetPath, killDateDays, targetFileName); } catch (Exception e) { Message msg = LogUtils.format("Az '{}' állomány visszatöltése sikertelen. A rendszer hibaüzenete: {}", sourceFileName, e.getMessage()); @@ -116,10 +122,7 @@ public class TSMRestoreStep extends JobStep { logger.error(marker, "A folyamat 'mediaCubeMedia' bemeneti paramétere üres."); throw new NullPointerException("System is not configured properly, 'mediaCubeMedia' input parameter missing."); } - if (StringUtils.isBlank(targetPath)) { - logger.error(marker, "A folyamat 'targetPath' bemeneti paramétere üres."); - throw new NullPointerException("System is not configured properly, 'targetPath' input parameter missing."); - } + checkTargetPath(targetPath); if (StringUtils.isBlank(targetNamePattern)) { logger.error(marker, "A folyamat 'targetNamePattern' bemeneti paramétere üres."); throw new NullPointerException("System is not configured properly, 'targetNamePattern' input parameter missing."); diff --git a/server/user.jobengine.osgi.server/pages/searchitems.zul b/server/user.jobengine.osgi.server/pages/searchitems.zul index 933ee50b..d0cb6670 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems.zul @@ -16,26 +16,35 @@ .z-row:hover > .z-row-inner, .z-row:hover > .z-cell { background: none; } .z-row:hover>.z-row-inner>.z-row-content{ text-color: black; } - .RED100 { border-color: #FFCDD2; } + .RED100.type-inlist { border-color: #FFCDD2!important; } .RED100 .z-toolbarbutton-content { background: #FFCDD2; } - + + .RED200.type-inlist { border-color: #EF9A9A!important; } .RED200 .z-toolbarbutton-content { background: #EF9A9A; border-color: #EF9A9A;; } + .BROWN100.type-inlist { border-color: #D7CCC8!important; } .BROWN100 .z-toolbarbutton-content { background: #D7CCC8; border-color: #D7CCC8; } + .YELLOW200.type-inlist { border-color: #FFF59D!important; } .YELLOW200 .z-toolbarbutton-content { background: #FFF59D; } + .INDIGO100.type-inlist { border-color: #C5CAE9!important; } .INDIGO100 .z-toolbarbutton-content { background: #C5CAE9; } - + + .INDIGO200.type-inlist { border-color: #9FA8DA!important; } .INDIGO200 .z-toolbarbutton-content { background: #9FA8DA; } - + + .BLUE100.type-inlist { border-color: #BBDEFB!important; } .BLUE100 .z-toolbarbutton-content { background: #BBDEFB; } - + + .BLUE200.type-inlist { border-color: #90CAF9!important; } .BLUE200 .z-toolbarbutton-content { background: #90CAF9; } - + + .TEAL100.type-inlist { border-color: #B2DFDB!important; } .TEAL100 .z-toolbarbutton-content { background: #B2DFDB; } - + + .TEAL200.type-inlist { border-color: #80CBC4!important; } .TEAL200 .z-toolbarbutton-content { background: #80CBC4; } .z-toolbarbutton-content { text-shadow: none; background: transparent; border: 1px solid transparent; border-radius: 3px; margin: 1px; } @@ -99,7 +108,7 @@ - + @@ -121,15 +130,15 @@ - + - - + + @@ -145,7 +154,7 @@ onClick="@command('selectMediaArchive', selectedObject=each)" />
-
+