From: Vásáry Dániel Date: Wed, 16 Sep 2020 14:15:29 +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=f42cb814e7df2a1f4b6c3e993cca8514524317ae;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C31957 --- diff --git a/server/-configuration/run-mediacube-server-hirtv.launch b/server/-configuration/run-mediacube-server-hirtv.launch index 835b327e..462450a6 100644 --- a/server/-configuration/run-mediacube-server-hirtv.launch +++ b/server/-configuration/run-mediacube-server-hirtv.launch @@ -19,7 +19,7 @@ - + diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/MediaBaseTest.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/MediaBaseTest.java index e5d1917b..845799d5 100644 --- a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/MediaBaseTest.java +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/MediaBaseTest.java @@ -1,7 +1,5 @@ package hu.user.mediacube.executors.tests; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; import java.time.Duration; import java.time.Instant; import java.util.Arrays; @@ -12,9 +10,6 @@ import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.commons.net.ftp.FTPClient; import org.junit.Test; -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; import user.commons.RemoteFile; import user.commons.StoreUri; @@ -28,7 +23,6 @@ import user.commons.nexio.server.protocol.Xid; import user.commons.remotestore.FtpDirectoryLister; import user.commons.remotestore.IDirectoryLister; import user.commons.remotestore.RemoteStoreProtocol; -import user.jobengine.server.steps.EscortFiles; public class MediaBaseTest { @@ -64,26 +58,40 @@ public class MediaBaseTest { nexioUri.setUserName("ftp"); nexioUri.setPassword("ftp"); byte[] content = nexioUri.getFileWithContent("test-dani.xml").getContent(); - System.out.println(new String(content)); - - Document document = EscortFiles.createNEXIOMeta(content); - Node firstChild = document.getFirstChild(); - NodeList list = firstChild.getChildNodes(); - for (int i = 0; i < list.getLength(); i++) { - Node item = list.item(i); - //System.out.println(item.getNodeName()); - if (item.getNodeName().equals("ModifiedTimeStamp")) { - System.out.println(item.getTextContent()); - SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy (HH:mm:ss)"); - System.out.println(Timestamp.from(df.parse(item.getTextContent()).toInstant())); - break; - } - } + System.out.println("Content " + new String(content).length()); + + // Document document = EscortFiles.createNEXIOMeta(content); + // Node firstChild = document.getFirstChild(); + // NodeList list = firstChild.getChildNodes(); + // for (int i = 0; i < list.getLength(); i++) { + // Node item = list.item(i); + // //System.out.println(item.getNodeName()); + // if (item.getNodeName().equals("ModifiedTimeStamp")) { + // System.out.println(item.getTextContent()); + // SimpleDateFormat df = new SimpleDateFormat("MM-dd-yyyy (HH:mm:ss)"); + // System.out.println(Timestamp.from(df.parse(item.getTextContent()).toInstant())); + // break; + // } + // } // if (elementsByTagName.getLength() == 1) { // // } + + nexioUri.cleanUp(); + + StoreUri localUri = new StoreUri(); + localUri.setProtocol(RemoteStoreProtocol.LOCAL); + localUri.setUri("/_video"); + + String fileName = "test-dani.mxf"; + nexioUri.transferFrom(localUri, fileName, fileName); + + content = nexioUri.getFileWithContent("test-dani.xml").getContent(); + System.out.println("Content " + new String(content).length()); + nexioUri.cleanUp(); + localUri.cleanUp(); } @Test @@ -177,26 +185,26 @@ public class MediaBaseTest { * 19. oldal C8 B1 00 00 00 02 00 00 00 02 If not already established, sets up the interchange of data to be in Unicode, where appropriate - + C1 4C 21 Retrieves the first ID in the system. Mode 21 retrieves both the 8-byte ID handle and the extended ID at the same time. More traditional methods of ID retrieval use A0 14 to get the first 8-byte ID handle followed by C8 C3 to get its matching extended ID. C8 4A 25 30 30 30 30 31 32 33 - + Retrieves the normal set of metadata associated with the specified 8-byte ID handle retrieved in the previous command C9 C3 25 30 30 30 30 31 32 33 00 - + Retrieves the metadata for the specified clip in the first extended field C9 C3 25 30 30 30 30 31 32 33 nn - + Retrieves the metadata for the specified clip in each of the remaining extended fields C8 84 25 30 30 30 30 31 32 33 - + Retrieves the special attributes associated with the specified clip C0 4D - + Retrieves the next ID in the system including its 8-byte ID handle and extended ID C8 4A 25 30 30 30 30 31 32 34 - + Retrieves the normal set of metadata associated with the next ID in the list … Continue this cycle of retrieving the next ID in the list and its associated metadata until the server returns no more IDs * */ diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java index cf9d0358..dae68860 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/CancelableStep.java @@ -29,9 +29,8 @@ public class CancelableStep extends JobStep { // getJobRuntime().setDescription(String.valueOf(param)); try { - //getJobRuntime().setRelated("xxx"); //logger.info(new MediaCubeMarker("vasary@elgekko.net", "TESZT"), "Heloka"); - //logger.error(getSessionMarker(), "Heloka"); + logger.error(getSessionMarker(), "Heloka"); for (int i = 0; i < count; i++) { if (getJobRuntime().isWaitingCancel()) break; diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java index 101c66bd..c3b51c8c 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/FileValidatorStep.java @@ -34,7 +34,7 @@ public class FileValidatorStep extends JobStep { if (getJobRuntime().isWaitingCancel()) { EscortFiles.remove(filePath); - EscortFiles.remove(escortFilePath); + //EscortFiles.remove(escortFilePath); EscortFiles.remove(Paths.get(escortFile + EscortFiles.DOT_CATCHED)); Message msg = new ParameterizedMessage("A {} fájl visszatöltése kezelői beavatkozás miatt megszakadt.", fileName); @@ -110,6 +110,7 @@ public class FileValidatorStep extends JobStep { EscortFiles.remove(filePath); EscortFiles.remove(Paths.get(escortFile)); + //200911 a kommentet kivettem, mert ezeket is torolni kell EscortFiles.remove(Paths.get(escortFile + EscortFiles.DOT_CATCHED)); throw new Exception("Length mismatch in " + filePath + ". Expected: " + expectedFrameNumber + ", found: " + frames); } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkDownloadStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkDownloadStep.java index addb9f75..58378efb 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkDownloadStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkDownloadStep.java @@ -120,8 +120,9 @@ public class ForkDownloadStep extends JobStep { StoreUri sourceStoreUri = getManager().getStoreUri(downloadable.getLong("sourceStoreUriId")); StoreUri targetStoreUri = getManager().getStoreUri(downloadable.getLong("targetStoreUriId")); - Store targetStore = getManager().getStore(targetStoreUri.getStoreId()); - template = targetStore.getName() + "-" + template; + Store sourceStore = getManager().getStore(sourceStoreUri.getStoreId()); + String sourceStoreName = sourceStore.getName(); + template = sourceStoreName + "-" + template; logger.info(getMarker(), "Starting {} for {}", template, escortFileName); String sourceFileName = downloadable.getString("fileName"); @@ -143,14 +144,16 @@ public class ForkDownloadStep extends JobStep { //parameterek: IJobRuntime parent, String template, String name, int priority, Map parameters IJobRuntime child = getEngine().submit(null, e -> { - if (e.getStatus().equals(JobStatus.CANCELED)) + if (e.getStatus().equals(JobStatus.CANCELED) || e.getStatus().equals(JobStatus.SUSPENDED)) EscortFiles.removeCatchedFile(escortFile); }, template, "Archiválás", priority, IJobEngine.DEFAULT_OWNER, parameters); if (child == null) throw new Exception("Submit error."); child.setDescription(sourceFileName); - child.setRelated(downloadable.getString("title")); + + child.setRelated(downloadable.getString("title") + " / " + sourceStoreName); + EscortFiles.createCatchedFile(escortFile); } catch (Exception e) { diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java index 70da7b5e..68398fcf 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ForkUploadStep.java @@ -175,7 +175,7 @@ public class ForkUploadStep extends JobStep { child.setDescription(escortFileName); - child.setRelated(downloadable.getString("title")); + child.setRelated(downloadable.getString("title") + " / " + targetStore.getName()); EscortFiles.createCatchedFile(escortFile); } catch (Exception e) { logger.error(getSessionMarker(), e.getMessage()); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java index 2d7b596c..f089605c 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO1TransferToStep.java @@ -1,11 +1,33 @@ package user.jobengine.server.steps; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import user.commons.RemoteFile; import user.commons.StoreUri; public class NEXIO1TransferToStep extends TransferStep { + private static final Logger logger = LogManager.getLogger(); + @Override @StepEntry public Object[] execute(StoreUri sourceStoreUri, String sourceFileName, StoreUri targetStoreUri, String targetFileName) throws Exception { + + try { + String title = targetFileName; + if (title.contains(".")) + title = title.substring(0, title.lastIndexOf(".")); + RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); + if (remoteFile != null && remoteFile.getContent() != null) { + logger.info("File already exists on NEXIO1 {}", targetFileName); + return null; + } + } catch (Exception e) { + logger.error(e.getMessage()); + } finally { + targetStoreUri.cleanUp(); + } + return super.execute(sourceStoreUri, sourceFileName, targetStoreUri, targetFileName); } } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java index 179c9d96..a5374e27 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIO2TransferToStep.java @@ -1,11 +1,32 @@ package user.jobengine.server.steps; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import user.commons.RemoteFile; import user.commons.StoreUri; public class NEXIO2TransferToStep extends TransferStep { + private static final Logger logger = LogManager.getLogger(); + @Override @StepEntry public Object[] execute(StoreUri sourceStoreUri, String sourceFileName, StoreUri targetStoreUri, String targetFileName) throws Exception { + try { + String title = targetFileName; + if (title.contains(".")) + title = title.substring(0, title.lastIndexOf(".")); + RemoteFile remoteFile = targetStoreUri.getFileWithContent(title + ".xml"); + if (remoteFile != null && remoteFile.getContent() != null) { + logger.info("File already exists on NEXIO2 {}", targetFileName); + return null; + } + } catch (Exception e) { + logger.error(e.getMessage()); + } finally { + targetStoreUri.cleanUp(); + } + return super.execute(sourceStoreUri, sourceFileName, targetStoreUri, targetFileName); } } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java index c4a97867..231af2a0 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOArchiveCheckerStep.java @@ -32,7 +32,7 @@ public class NEXIOArchiveCheckerStep extends JobStep { //formatum if (!(videoFormat == 3 || videoFormat == 19)) { - logger.info(getMarker(), "{} unsupported video format", videoFormat); + logger.debug(getMarker(), "{} unsupported video format", videoFormat); return false; } @@ -44,7 +44,7 @@ public class NEXIOArchiveCheckerStep extends JobStep { return false; } if (modifiedHours < lastModifiedHours) { - logger.info(getMarker(), "{} modification time is too cloose for now", title); + logger.debug(getMarker(), "{} modification time is too cloose for now", title); return false; } diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOMetadataPersisterStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOMetadataPersisterStep.java index bf202481..ec9565f1 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOMetadataPersisterStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/NEXIOMetadataPersisterStep.java @@ -46,6 +46,7 @@ public class NEXIOMetadataPersisterStep extends JobStep { //TODO mediafile lastmodified = feltoltott file nexio xml lastmodified Timestamp lastModified = getLastModified(remoteFile); + logger.info("Setting last modification time on {} to {}", downloadable.getString("title"), lastModified); mediaFile.setLastModified(lastModified); getManager().modify(mediaFile); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/PeableBeachMissingMaterialCheckerStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/PeableBeachMissingMaterialCheckerStep.java index a99e9abb..e580fa0d 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/PeableBeachMissingMaterialCheckerStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/PeableBeachMissingMaterialCheckerStep.java @@ -74,7 +74,6 @@ public class PeableBeachMissingMaterialCheckerStep extends JobStep { if (medias != null && medias.size() > 0) { count = medias.size(); - for (MMMedia media : medias) { logger.info(getMarker(), "API response contains {}", media.getName()); } @@ -110,11 +109,13 @@ public class PeableBeachMissingMaterialCheckerStep extends JobStep { for (RemoteFile rf : remoteFiles) { try { String name = rf.getName(); - int pos = name.lastIndexOf("."); - if (pos > -1) { - name = name.substring(0, pos); - //logger.info(getMarker(), "Adding {}", name); - poolContent.add(name); + if (name.toLowerCase().endsWith(".mxf")) { + int pos = name.lastIndexOf("."); + if (pos > -1) { + name = name.substring(0, pos); + //logger.info(getMarker(), "Adding {}", name); + poolContent.add(name); + } } } catch (Exception e) { logger.error(e.getMessage()); diff --git a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/FtpDirectoryLister.java b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/FtpDirectoryLister.java index 57eea5dc..e2256c76 100644 --- a/server/user.jobengine.osgi.commons/src/user/commons/remotestore/FtpDirectoryLister.java +++ b/server/user.jobengine.osgi.commons/src/user/commons/remotestore/FtpDirectoryLister.java @@ -184,6 +184,7 @@ public class FtpDirectoryLister implements IDirectoryLister { RemoteFile result = null; connect(); if (ftpClient != null) { + //TODO eleg a try? try (InputStream input = ftpClient.retrieveFileStream(name)) { checkCompletePending = true; if (input != null) { diff --git a/server/user.jobengine.osgi.db/migrations/scripts/011_create_temp_and_nexio_stores.sql b/server/user.jobengine.osgi.db/migrations/scripts/011_create_temp_and_nexio_stores.sql new file mode 100644 index 00000000..b5dec9f1 --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/011_create_temp_and_nexio_stores.sql @@ -0,0 +1,37 @@ +-- // Creates MediaCube local temporary and NEXIO stores +-- Migration SQL that makes the change goes here. + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('NEXIO1','N','N'), +('NEXIO2','N','N'), +('MEDIACUBE_DOWNLOADS','N','N'), +('MEDIACUBE_UPLOADS','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='NEXIO1'),'FTP',null,'192.168.0.98','N','Y','Y','pasa','999',null,null), +((SELECT ID FROM STORE WHERE NAME='NEXIO1'),'NEXIO',null,'192.168.0.98','N','Y','N',null,null,null,null), +((SELECT ID FROM STORE WHERE NAME='NEXIO2'),'FTP',null,'192.168.0.99','N','Y','Y','pasa','999',null,null), +((SELECT ID FROM STORE WHERE NAME='NEXIO2'),'NEXIO',null,'192.168.0.99','N','Y','N',null,null,null,null), +((SELECT ID FROM STORE WHERE NAME='MEDIACUBE_DOWNLOADS'),'LOCAL',null,'/mediacube/downloads','N','Y','Y',null,null,null,null), +((SELECT ID FROM STORE WHERE NAME='MEDIACUBE_UPLOADS'),'LOCAL',null,'/mediacube/uploads','N','Y','Y',null,null,null,null) +@ + +-- //@UNDO +-- SQL to undo the change goes here. +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='NEXIO1') +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='NEXIO2') +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='MEDIACUBE_DOWNLOADS') +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='MEDIACUBE_UPLOADS') +@ +DELETE FROM STORE WHERE NAME='NEXIO1' +@ +DELETE FROM STORE WHERE NAME='NEXIO2' +@ +DELETE FROM STORE WHERE NAME='MEDIACUBE_DOWNLOADS' +@ +DELETE FROM STORE WHERE NAME='MEDIACUBE_UPLOADS' +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/012_ensure_tsm_store.sql b/server/user.jobengine.osgi.db/migrations/scripts/012_ensure_tsm_store.sql new file mode 100644 index 00000000..0974c2aa --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/012_ensure_tsm_store.sql @@ -0,0 +1,24 @@ +-- // Ensure existance of TSM store with TSM protocol +-- Migration SQL that makes the change goes here. + +MERGE INTO STORE store USING ( + VALUES ('TSM','Y','N') + ) AS merge (NAME,ISSYSTEM,ISLOWRES) + ON store.NAME = merge.NAME + WHEN NOT MATCHED THEN + INSERT (NAME,ISSYSTEM,ISLOWRES) VALUES (merge.NAME, merge.ISSYSTEM, merge.ISLOWRES) + ELSE IGNORE +@ + +MERGE INTO STOREURI storeuri USING ( + VALUES ((SELECT ID FROM STORE WHERE NAME='TSM'),'TSM',null,'','N','Y','Y','','',null,null) + ) AS merge (STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) + ON (storeuri.PROTOCOL = merge.PROTOCOL AND storeuri.STOREID = merge.STOREID) + WHEN NOT MATCHED THEN + INSERT (STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) + VALUES (merge.STOREID,merge.PROTOCOL,merge.DELIVERY,merge.URI,merge.ISSTREAM,merge.ISSOURCE,merge.ISTARGET,merge.USERNAME,merge.PASSWORD,merge.ROOTPATH,merge.PORTNUMBER) + ELSE IGNORE +@ +-- //@UNDO +-- SQL to undo the change goes here. +--Nem kell undo \ No newline at end of file diff --git a/server/user.jobengine.osgi.db/migrations/scripts/013_modify_ft_triggers.sql b/server/user.jobengine.osgi.db/migrations/scripts/013_modify_ft_triggers.sql new file mode 100644 index 00000000..69e9b2c2 --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/013_modify_ft_triggers.sql @@ -0,0 +1,44 @@ +-- // Modify ft triggers, use real tsm store to filter +-- Migration SQL that makes the change goes here. + + +CREATE OR REPLACE TRIGGER TRG_MEDIAFILE_AFTER_INSERT after insert +on mediafile +referencing new as n +for each row + +begin atomic + DECLARE storeid BIGINT; + SET storeid = (SELECT ID FROM STORE WHERE NAME='TSM'); + + IF n.storeid = storeid THEN + insert into mediadescription (itemid, mediaid, mediafileid, description) + select + itemid, + mediaid, + mediafileid, + fulldesc(itemid, mediaid, mediafileid) + from vw_items + where mediafileid = n.id; + END IF; +end +@ + +CREATE OR REPLACE TRIGGER TRG_MEDIAFILE_AFTER_DELETE after delete +on mediafile +referencing old as o +for each row +begin atomic + DECLARE storeid BIGINT; + SET storeid = (SELECT ID FROM STORE WHERE NAME='TSM'); + + IF o.storeid = storeid THEN + delete from mediadescription where mediafileid = o.id; + END IF; +end +@ + +-- //@UNDO +-- SQL to undo the change goes here. + +--nincs undo \ No newline at end of file diff --git a/server/user.jobengine.osgi.db/migrations/scripts/014_create_peablebeach_beechpool_store.sql b/server/user.jobengine.osgi.db/migrations/scripts/014_create_peablebeach_beechpool_store.sql new file mode 100644 index 00000000..36c8bc7d --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/014_create_peablebeach_beechpool_store.sql @@ -0,0 +1,17 @@ +-- // Creates PeableBeach local BeachPool as mounted store +-- Migration SQL that makes the change goes here. + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('PEABLEBEACH','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='PEABLEBEACH'),'LOCAL',null,'/mnt/PEABLEBEACH/BEACHPOOL','N','Y','Y','pasa','999',null,null) +@ + +-- //@UNDO +-- SQL to undo the change goes here. +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='PEABLEBEACH') +@ +DELETE FROM STORE WHERE NAME='PEABLEBEACH' +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/016_modify_tsm_storeuri.sql b/server/user.jobengine.osgi.db/migrations/scripts/016_modify_tsm_storeuri.sql new file mode 100644 index 00000000..83cbe97d --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/016_modify_tsm_storeuri.sql @@ -0,0 +1,8 @@ +-- // Modify TSM storeuri username/password +-- Migration SQL that makes the change goes here. + +UPDATE STOREURI storeuri SET USERNAME=NULL, PASSWORD=NULL WHERE PROTOCOL='TSM' +@ +-- //@UNDO +-- SQL to undo the change goes here. +--Nem kell undo \ No newline at end of file diff --git a/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql b/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql new file mode 100644 index 00000000..97bc1a0d --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/017_add_filezize_mediafile.sql @@ -0,0 +1,15 @@ +-- // Add filesize column to mediafile +-- Migration SQL that makes the change goes here. + +ALTER TABLE MEDIAFILE ADD COLUMN FILESIZE BIGINT default 0 +@ +CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) +@ + + +-- //@UNDO +-- SQL to undo the change goes here. +ALTER TABLE MEDIAFILE DROP COLUMN FILESIZE +@ +CALL SYSPROC.ADMIN_CMD ( 'REORG TABLE DB2ADMIN.MEDIAFILE' ) +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql b/server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql new file mode 100644 index 00000000..fddbea58 --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/018_add_related_to_job.sql @@ -0,0 +1,39 @@ +-- +-- Copyright 2010-2016 the original author or authors. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- // Alter JOB table, add RELATED column +-- Migration SQL that makes the change goes here. + +ALTER TABLE JOB ADD COLUMN RELATED VARCHAR(255) +@ + +CREATE INDEX IDX_JOB_RELATED ON JOB ("RELATED") +@ + +CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.JOB') +@ + +-- //@UNDO +-- SQL to undo the change goes here. + +DROP INDEX IDX_JOB_RELATED +@ + +ALTER TABLE JOB DROP COLUMN RELATED +@ + +CALL SYSPROC.ADMIN_CMD('REORG TABLE DB2ADMIN.JOB') +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql b/server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql new file mode 100644 index 00000000..ef93c831 --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/019_add_lookup_related.sql @@ -0,0 +1,30 @@ +-- +-- Copyright 2010-2016 the original author or authors. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- // Add LOOKUP function for use dynamic like from sqlj +-- Migration SQL that makes the change goes here. + +CREATE OR REPLACE FUNCTION LOOKUP(col VARCHAR(255), search VARCHAR(255)) + RETURNS int + RETURN +SELECT LOCATE(search, LOWER(col)) FROM SYSIBM.SYSDUMMY1 +@ + +-- //@UNDO +-- SQL to undo the change goes here. + +DROP FUNCTION LOOKUP +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/020_create_peablebeach_stores.sql b/server/user.jobengine.osgi.db/migrations/scripts/020_create_peablebeach_stores.sql new file mode 100644 index 00000000..b65d7e5c --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/020_create_peablebeach_stores.sql @@ -0,0 +1,78 @@ +-- // Creates PASAPOOL as mounted store +-- Migration SQL that makes the change goes here. + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('PASAPOOL','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='PASAPOOL'),'LOCAL',null,'/mnt/PEABLEBEACH/PASAPOOL','N','Y','Y',null,null,null,null) +@ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('SELENIOPOOL','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='SELENIOPOOL'),'LOCAL',null,'/mnt/PEABLEBEACH/SELENIOPOOL','N','Y','N',null,null,null,null) +@ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('SELENIOPOOL_16_9','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_16_9'),'LOCAL',null,'/mnt/PEABLEBEACH/SELENIOPOOL/16_9','N','Y','N',null,null,null,null) +@ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('SELENIOPOOL_16_9_PROCESSING','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_16_9_PROCESSING'),'LOCAL',null,'/mnt/PEABLEBEACH/SELENIOPOOL/16_9/PROCESSING','N','Y','N',null,null,null,null) +@ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('SELENIOPOOL_4_3','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_4_3'),'LOCAL',null,'/mnt/PEABLEBEACH/SELENIOPOOL/4_3','N','Y','N',null,null,null,null) +@ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('SELENIOPOOL_4_3_PROCESSING','N','N') +@ + +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_4_3_PROCESSING'),'LOCAL',null,'/mnt/PEABLEBEACH/SELENIOPOOL/4_3/PROCESSING','N','Y','N',null,null,null,null) +@ + + +-- //@UNDO +-- SQL to undo the change goes here. +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='PASAPOOL') +@ +DELETE FROM STORE WHERE NAME='PASAPOOL' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='SELENIOPOOL') +@ +DELETE FROM STORE WHERE NAME='SELENIOPOOL' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_16_9') +@ +DELETE FROM STORE WHERE NAME='SELENIOPOOL_16_9' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_16_9_PROCESSING') +@ +DELETE FROM STORE WHERE NAME='SELENIOPOOL_16_9_PROCESSING' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_4_3') +@ +DELETE FROM STORE WHERE NAME='SELENIOPOOL_4_3' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='SELENIOPOOL_4_3_PROCESSING') +@ +DELETE FROM STORE WHERE NAME='SELENIOPOOL_4_3_PROCESSING' +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/021_create_filezilla_store.sql b/server/user.jobengine.osgi.db/migrations/scripts/021_create_filezilla_store.sql new file mode 100644 index 00000000..c7895ca7 --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/021_create_filezilla_store.sql @@ -0,0 +1,33 @@ +-- // Creates PASAPOOL as mounted store +-- Migration SQL that makes the change goes here. + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('FILEZILLA_PASARESTORE','N','N') +@ + +-- @DELIMITER $ +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='FILEZILLA_PASARESTORE'),'FTP',null,'192.168.0.101','N','N','Y','ftpuser','FtPVs3r@1','/Input/Pasa_Restore',null) +$ +-- @DELIMITER @ + +INSERT INTO STORE(NAME,ISSYSTEM,ISLOWRES) VALUES +('FILEZILLA_AVID','N','N') +@ + +-- @DELIMITER $ +INSERT INTO STOREURI(STOREID,PROTOCOL,DELIVERY,URI,ISSTREAM,ISSOURCE,ISTARGET,USERNAME,PASSWORD,ROOTPATH,PORTNUMBER) VALUES +((SELECT ID FROM STORE WHERE NAME='FILEZILLA_AVID'),'FTP',null,'192.168.0.101','N','N','Y','ftpuser','FtPVs3r@1','/Input/HD_to_DNxHD_MXF',null) +$ +-- @DELIMITER @ + +-- //@UNDO +-- SQL to undo the change goes here. +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='FILEZILLA_PASARESTORE') +@ +DELETE FROM STORE WHERE NAME='FILEZILLA_PASARESTORE' +@ +DELETE FROM STOREURI WHERE STOREID=(SELECT ID FROM STORE WHERE NAME='FILEZILLA_AVID') +@ +DELETE FROM STORE WHERE NAME='FILEZILLA_AVID' +@ diff --git a/server/user.jobengine.osgi.db/migrations/scripts/011_add_lastmodified_to_mediafile.sql b/server/user.jobengine.osgi.db/migrations/scripts/022_add_lastmodified_to_mediafile.sql similarity index 100% rename from server/user.jobengine.osgi.db/migrations/scripts/011_add_lastmodified_to_mediafile.sql rename to server/user.jobengine.osgi.db/migrations/scripts/022_add_lastmodified_to_mediafile.sql diff --git a/server/user.jobengine.osgi.db/migrations/scripts/023_create_dropitem_sp.sql b/server/user.jobengine.osgi.db/migrations/scripts/023_create_dropitem_sp.sql new file mode 100644 index 00000000..19ef07df --- /dev/null +++ b/server/user.jobengine.osgi.db/migrations/scripts/023_create_dropitem_sp.sql @@ -0,0 +1,38 @@ +-- +-- Copyright 2010-2016 the original author or authors. +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +-- // Create DROPITEM stored procedure +-- Migration SQL that makes the change goes here. + +CREATE PROCEDURE DROPITEM(vITEMID BIGINT) +LANGUAGE SQL +BEGIN + DECLARE vMEDIAFILEID BIGINT; + DECLARE vMEDIAID BIGINT; + SELECT ID INTO vMEDIAID FROM MEDIA WHERE ITEMID = vITEMID; + SELECT ID INTO vMEDIAFILEID FROM MEDIAFILE WHERE MEDIAID = vMEDIAID; + + delete from mediafile where id = vMEDIAFILEID; + delete from media where id = vMEDIAID; + delete from item where id = vITEMID; +END +@ + +-- //@UNDO +-- SQL to undo the change goes here. + +DROP PROCEDURE DROPITEM +@ diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java index a2041947..3b94e594 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/SearchOptions.java @@ -8,6 +8,7 @@ public class SearchOptions { final private List filters; final private Date searchFrom; final private Date searchTo; + final private int descLength; final private String orderBy; final private boolean orderAscending; final private boolean missingProxy; @@ -15,12 +16,14 @@ public class SearchOptions { private int fromResult; private int toResult; - public SearchOptions(String text, List filters, Date searchFrom, Date searchTo, boolean missingProxy, String orderBy, boolean orderAscending) { + public SearchOptions(String text, List filters, Date searchFrom, Date searchTo, boolean missingProxy, int descLength, String orderBy, + boolean orderAscending) { this.text = text; this.filters = filters; this.searchFrom = searchFrom; this.searchTo = searchTo; this.missingProxy = missingProxy; + this.descLength = descLength; this.orderBy = orderBy; this.orderAscending = orderAscending; } @@ -57,6 +60,10 @@ public class SearchOptions { return toResult; } + public boolean isMissingProxy() { + return missingProxy; + } + public boolean isOrderAscending() { return orderAscending; } @@ -73,8 +80,8 @@ public class SearchOptions { this.toResult = toResult; } - public boolean isMissingProxy() { - return missingProxy; + public int getDescLength() { + return descLength; } } diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java b/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java index 1f7bf393..b4abceb6 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/search/MediaFinder.java @@ -22,6 +22,7 @@ public class MediaFinder implements IMediaFinder { private static final Logger logger = LogManager.getLogger(); private ItemManager manager = null; private SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + private boolean simpleSearch = "true".equals(System.getProperty("mediacube.simplesearch", "false")); public MediaFinder(ItemManager manager) { this.manager = manager; @@ -41,39 +42,44 @@ public class MediaFinder implements IMediaFinder { sql.append("m.length,"); sql.append("m.itemtypeid mediaitemtypeid,"); sql.append(String.format("HIGHLIGHT(md.description, '', '', '%s') description,", criteriasPattern)); - // sql.append("'blabla' description,"); sql.append("it.name mediaitemtypename,"); sql.append("m.houseid mediahouseid,"); sql.append("mf.houseid mediafilehouseid,"); sql.append("vw_mf.mediafilecount"); - sql.append( - " FROM ITEM i, MEDIA m, MEDIAFILE mf, MEDIADESCRIPTION md, VW_MEDIAFILES vw_mf, ITEMTYPE it WHERE i.id = md.itemid AND m.id = md.mediaid AND mf.id = md.mediafileid AND m.id=vw_mf.mediaid AND m.itemTypeId = it.id"); + sql.append(" FROM ITEM i"); + sql.append(" LEFT OUTER JOIN MEDIADESCRIPTION md ON (md.itemid = i.id)"); + sql.append(" LEFT OUTER JOIN MEDIA m ON (m.id = md.mediaid)"); + sql.append(" LEFT OUTER JOIN MEDIAFILE mf ON (mf.id = md.mediafileid)"); + sql.append(" LEFT OUTER JOIN VW_MEDIAFILES vw_mf ON (vw_mf.mediaid=m.id)"); + sql.append(" LEFT OUTER JOIN ITEMTYPE it ON (it.id = m.itemTypeId)"); if (typeIDs != null) { sql.append(" AND m.itemtypeid IN "); sql.append(typeCriteria.toString()); } - // Ha csak LIKE van media.title-re, nem kell (AMC) - // String criteria = formatSearchValue(criteria); - - // if (criteria != null && criteria.trim().length() > 0) - // sql.append(" AND CONTAINS(md.description, '" + criteria + "') >= 1"); - - if (criteria.endsWith("*")) - criteria = criteria.replace("*", ""); - if (criteria != null && criteria.trim().length() > 0) - sql.append(" AND m.title LIKE('%" + criteria + "%')"); + if (simpleSearch) { + if (criteria.endsWith("*")) + criteria = criteria.replace("*", ""); + if (criteria != null && criteria.trim().length() > 0) + sql.append(" AND m.title LIKE('%" + criteria + "%')"); + } else { + criteria = formatSearchValue(criteria); + if (criteria != null && criteria.trim().length() > 0) + sql.append(" AND CONTAINS(md.description, '" + criteria + "') >= 1"); + } - if (options.getSearchFrom() != null) { + if (options.getSearchFrom() != null) sql.append(String.format(" AND m.archived > '%s'", df.format(options.getSearchFrom()))); - } - if (options.getSearchTo() != null) { + + if (options.getSearchTo() != null) sql.append(String.format(" AND m.archived < '%s'", df.format(options.getSearchTo()))); - } if (options.isMissingProxy()) sql.append(" AND vw_mf.mediafilecount=1"); + if (options.getDescLength() > 0) + sql.append(" AND LENGTH(m.description) < " + options.getDescLength()); + sql.append(" ORDER BY "); if (options.getOrderBy() == null) { sql.append("itemtitle desc, mediaitemtypeid"); @@ -246,36 +252,36 @@ public class MediaFinder implements IMediaFinder { return result; } - private void setRelevant(String[] criterias, ArchivedMedia am, String content) { - if (content == null) - return; - for (String c : criterias) { - if (c != null && c.length() > 2) { - - int pos = content.toLowerCase().indexOf(c.toLowerCase()); - if (pos > -1) { - int start = 0; - if (pos > 100) - start = pos - 100; - else - start = 0; - int end = pos + 200; - if (end > content.length() - 1) - end = content.length() - 1; - - String relevant = content.substring(start, pos) + "" + content.substring(pos, pos + c.length()) + "" - + content.substring(pos + c.length(), end); - - if (start > 0) - relevant = "..." + relevant; - if (end < content.length() - 1) - relevant = relevant + "..."; - - am.setRelevant(relevant); - break; - } - - } - } - } + // private void setRelevant(String[] criterias, ArchivedMedia am, String content) { + // if (content == null) + // return; + // for (String c : criterias) { + // if (c != null && c.length() > 2) { + // + // int pos = content.toLowerCase().indexOf(c.toLowerCase()); + // if (pos > -1) { + // int start = 0; + // if (pos > 100) + // start = pos - 100; + // else + // start = 0; + // int end = pos + 200; + // if (end > content.length() - 1) + // end = content.length() - 1; + // + // String relevant = content.substring(start, pos) + "" + content.substring(pos, pos + c.length()) + "" + // + content.substring(pos + c.length(), end); + // + // if (start > 0) + // relevant = "..." + relevant; + // if (end < content.length() - 1) + // relevant = relevant + "..."; + // + // am.setRelevant(relevant); + // break; + // } + // + // } + // } + // } } diff --git a/server/user.jobengine.osgi.server/pages/joblist.zul b/server/user.jobengine.osgi.server/pages/joblist.zul index 919e5c31..0eb013fe 100644 --- a/server/user.jobengine.osgi.server/pages/joblist.zul +++ b/server/user.jobengine.osgi.server/pages/joblist.zul @@ -37,6 +37,9 @@ +
+ +
diff --git a/server/user.jobengine.osgi.server/pages/searchitems/details.zul b/server/user.jobengine.osgi.server/pages/searchitems/details.zul index af5aed5e..e0069a44 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems/details.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems/details.zul @@ -63,11 +63,11 @@
- - - +
+ +
- +
\ No newline at end of file diff --git a/server/user.jobengine.osgi.server/pages/searchitems/filters.zul b/server/user.jobengine.osgi.server/pages/searchitems/filters.zul index 107845fc..a2c6163c 100644 --- a/server/user.jobengine.osgi.server/pages/searchitems/filters.zul +++ b/server/user.jobengine.osgi.server/pages/searchitems/filters.zul @@ -31,6 +31,7 @@ + diff --git a/server/user.jobengine.osgi.server/resources/i3-label_hu.properties b/server/user.jobengine.osgi.server/resources/i3-label_hu.properties index aaf04ca2..d29d6ef0 100644 --- a/server/user.jobengine.osgi.server/resources/i3-label_hu.properties +++ b/server/user.jobengine.osgi.server/resources/i3-label_hu.properties @@ -1,4 +1,4 @@ -version=2.6.2 +version=2.6.4 footer=2016-2020 © Copyright User Rendszerház Kft. login_info=Információ diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java index 27487b97..71af0cce 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/JobListModel.java @@ -3,6 +3,7 @@ package user.jobengine.zk.model; import static java.util.stream.Collectors.toList; import java.util.Arrays; +import java.util.Calendar; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -11,13 +12,24 @@ import java.util.Set; import org.apache.commons.lang.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.zkoss.bind.annotation.AfterCompose; import org.zkoss.bind.annotation.BindingParam; import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.ContextParam; +import org.zkoss.bind.annotation.ContextType; import org.zkoss.bind.annotation.Init; import org.zkoss.bind.annotation.NotifyChange; +import org.zkoss.chart.Charts; +import org.zkoss.chart.Options; +import org.zkoss.chart.PlotLine; +import org.zkoss.chart.Point; +import org.zkoss.chart.Series; +import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.select.Selectors; +import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zul.ListModelList; import org.zkoss.zul.Messagebox; import org.zkoss.zul.Window; @@ -50,6 +62,46 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener private String searchText; private JobStatus searchStatus; private List searchStatuses; + @Wire + Charts chart; + + @AfterCompose + public void afterCompose(@ContextParam(ContextType.VIEW) Component view) { + Selectors.wireComponents(view, this, false); + Options options = new Options(); + + options.getGlobal().setUseUTC(false); + chart.setHeight(150); + chart.setOptions(options); + chart.setAnimation(false); + + chart.getXAxis().setType("datetime"); + chart.getXAxis().setTickPixelInterval(150); + + chart.getYAxis().setTitle("Darab"); + PlotLine plotLine = new PlotLine(); + plotLine.setValue(0); + plotLine.setWidth(1); + plotLine.setColor("#808080"); + chart.getYAxis().setMin(0); + chart.getYAxis().addPlotLine(plotLine); + + chart.getTooltip().setHeaderFormat("{series.name}
"); + chart.getTooltip().setPointFormat("{point.x:%Y-%m-%d %H:%M:%S}
{point.y}"); + + chart.getLegend().setEnabled(false); + chart.getExporting().setEnabled(false); + + Series series = chart.getSeries(); + series.setName("Feladatok"); + //updateJobsChart(); + + int size = jobList.size(); + for (int i = -19; i <= 0; i++) { + Point point = new Point(Calendar.getInstance().getTimeInMillis() + i * 1000, size); + series.addPoint(point); + } + } @Command public void cancelAllJobs() { @@ -157,8 +209,6 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener jobList.clear(); Map jobMap = jobEngine.getJobs(); jobList.addAll(jobMap.values()); - - //Collections.sort(jobList, (o1, o2) -> compare(o1, o2)); } public boolean isAllExecutionDisabled() { @@ -207,6 +257,7 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener private void onJobCreated(IJobRuntime job) { jobList.add(job); notifyChange("jobList"); + updateJobsChart(); } private void onJobDeleted(IJobRuntime job) { @@ -219,6 +270,12 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener onSelect(); notifyChange("jobList"); + updateJobsChart(); + } + + private void onJobUpdated(IJobRuntime job) { + //List savedSelectedJobs = new ArrayList<>(selectedJobs); + jobList.notifyChange(job); } // @Command @@ -232,14 +289,8 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener // initializeList(); // } - private void onJobUpdated(IJobRuntime job) { - //List savedSelectedJobs = new ArrayList<>(selectedJobs); - jobList.notifyChange(job); - } - @Command public void onSelect() { - logger.info("Selection changed!"); notifyChange("updatePriorityDisabled"); } @@ -422,4 +473,8 @@ public class JobListModel extends AsyncBaseModel implements IJobChangedListener setShutdownDisabled(false); initializeList(); } + + private void updateJobsChart() { + chart.getSeries().addPoint(new Point(Calendar.getInstance().getTimeInMillis(), jobList.size()), true, true, true); + } } diff --git a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/SearchModel.java b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/SearchModel.java index 20395506..f61d57e3 100644 --- a/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/SearchModel.java +++ b/server/user.jobengine.osgi.server/src/user/jobengine/zk/model/SearchModel.java @@ -92,6 +92,7 @@ public class SearchModel extends AsyncBaseModel { private boolean rowsExpanded = true; private boolean allSelected; private boolean itemSelected; + private int descLength; protected IItemManager itemManager = null; @Wire Timer timer; @@ -200,17 +201,6 @@ public class SearchModel extends AsyncBaseModel { } - @Command - public void setPageSize(@BindingParam("source") Menuitem source) { - if (source.isChecked()) - return; - int pageSize = Integer.parseInt(source.getValue()); - setSettingsPageSize(pageSize); - itemsGrid.setPageSize(pageSize); - itemsGrid.setActivePage(0); - SessionUtil.putUserPageSize(pageSize); - } - private void clearAllFilters() { for (String filter : typeFilters.keySet()) { typeFilters.get(filter).setChecked(false); @@ -303,7 +293,7 @@ public class SearchModel extends AsyncBaseModel { throw new Exception("Legalább 3 karakter keresőszöveg, a 'hiányzó proxy' beállítás vagy egy dátum kitöltése szükséges!"); } - SearchOptions options = new SearchOptions(searchValue, searchFilters, searchFrom, searchTo, missingProxy, orderBy, orderAscending); + SearchOptions options = new SearchOptions(searchValue, searchFilters, searchFrom, searchTo, missingProxy, descLength, orderBy, orderAscending); searchResult = new CachedListModel(options); searchResult.addEventListener(e -> { if (e.getName().equals(Events.ON_ERROR)) { @@ -319,11 +309,6 @@ public class SearchModel extends AsyncBaseModel { } } - private void handleSearchError(Exception e) { - Clients.showNotification(e.getMessage(), "error", search, "start_center", 2000); - logger.error(e); - } - public void doSort(Event event) throws Exception { itemsGrid.getColumns().getChildren().forEach(c -> ((Column) c).setSortDirection("natural")); SortEvent evt = (SortEvent) event; @@ -384,6 +369,10 @@ public class SearchModel extends AsyncBaseModel { return bottomTypeFilters; } + public int getDescLength() { + return descLength; + } + public boolean getHasLowresMediaFile() { boolean ret = false; if (selectedObject != null) { @@ -507,6 +496,11 @@ public class SearchModel extends AsyncBaseModel { return typeFilters; } + private void handleSearchError(Exception e) { + Clients.showNotification(e.getMessage(), "error", search, "start_center", 2000); + logger.error(e); + } + private void highlight(ArchivedMedia am, boolean highlight) { if (am == null) return; @@ -758,6 +752,10 @@ public class SearchModel extends AsyncBaseModel { } } + public void setDescLength(int descLength) { + this.descLength = descLength; + } + public void setItemSelected(boolean itemSelected) { this.itemSelected = itemSelected; } @@ -770,6 +768,17 @@ public class SearchModel extends AsyncBaseModel { this.missingProxy = missingProxy; } + @Command + public void setPageSize(@BindingParam("source") Menuitem source) { + if (source.isChecked()) + return; + int pageSize = Integer.parseInt(source.getValue()); + setSettingsPageSize(pageSize); + itemsGrid.setPageSize(pageSize); + itemsGrid.setActivePage(0); + SessionUtil.putUserPageSize(pageSize); + } + public void setRowsExpanded(boolean rowsExpanded) { this.rowsExpanded = rowsExpanded; } @@ -852,7 +861,7 @@ public class SearchModel extends AsyncBaseModel { private void showExternalMediaID() { String mediaID = SessionUtil.getQueryParameter(MEDIA_ID); if (mediaID != null) { - SearchOptions options = new SearchOptions(searchValue, null, searchFrom, searchTo, false, orderBy, orderAscending); + SearchOptions options = new SearchOptions(searchValue, null, searchFrom, searchTo, false, 0, orderBy, orderAscending); options.setMediaId(Long.parseLong(mediaID)); searchResult = new InitializedCachedListModel(options); }