From: vasary.daniel Date: Thu, 5 May 2022 07:20:50 +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=a4190630c28061768ece0c3ed3ccabc1e3392b4b;p=mediacube.git git-tfs-id: [tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube;C33291 --- diff --git a/server/-product/production/LOCAL/settings/application-htv.yaml b/server/-product/production/LOCAL/settings/application-htv.yaml deleted file mode 100644 index b579b23e..00000000 --- a/server/-product/production/LOCAL/settings/application-htv.yaml +++ /dev/null @@ -1,45 +0,0 @@ -datasource: - mediacube: - url: jdbc:db2://10.10.1.27:50000/mc - user: db2admin - password: password - external-indexer: false - simple-search: true - login-timeout: 3 - pool-size: 10 - mediacube-nosql: - url: jdbc:db2://10.10.1.27:50000/mc - user: db2admin - password: password - schema: test - login-timeout: 3 - hsm: - url: jdbc:db2://10.11.1.89:51500/tsmdb1 - user: tsminst1 - password: tsminst1 - planair: - url: jdbc:sqlserver://10.11.254.86;databaseName=PA_Vivantis; - user: MAM - password: VDani -services: - ffmpeg: - execurable-location: /opt/ffmpeg/ffmpeg - mediacube: - proxy-root: /mediacube/data/lowres - nexio: -# host: 10.10.1.55 -# collection-name: nexioclips -# use-mos-gateway: true - disabled: true -jobs: - validate-transfers: false - copy-buffer-size: 32768 - scheduled-execution-disabled: true -tsm: - randomize-archives: false - delimiter: / - node-name: JOBENGINE - fs-name: /JOBENGINE - alternate-fs-name: /JOBENGINE - hl-name: /JOBENGINE - \ No newline at end of file diff --git a/server/-product/production/LOCAL/settings/application-mv.yaml b/server/-product/production/LOCAL/settings/application-mv.yaml deleted file mode 100644 index 8a94fef7..00000000 --- a/server/-product/production/LOCAL/settings/application-mv.yaml +++ /dev/null @@ -1,45 +0,0 @@ -datasource: - mediacube: - url: jdbc:db2://10.11.1.90:50000/mc - user: db2admin - password: password - external-indexer: false - simple-search: true - login-timeout: 3 - pool-size: 10 - mediacube-nosql: - url: jdbc:db2://10.11.1.90:50000/mc - user: db2admin - password: password - schema: test - login-timeout: 3 - hsm: - url: jdbc:db2://10.11.1.89:51500/tsmdb1 - user: tsminst1 - password: tsminst1 - planair: - url: jdbc:sqlserver://10.11.254.86;databaseName=PA_Vivantis; - user: MAM - password: VDani -services: - ffmpeg: - execurable-location: /opt/ffmpeg/ffmpeg - mediacube: - proxy-root: /mediacube/data/lowres - nexio: -# host: 10.10.1.55 -# collection-name: nexioclips -# use-mos-gateway: true - disabled: true -jobs: - validate-transfers: false - copy-buffer-size: 32768 - scheduled-execution-disabled: true -tsm: - randomize-archives: false - delimiter: / - node-name: JOBENGINE - fs-name: /JOBENGINE - alternate-fs-name: /JOBENGINE - hl-name: /JOBENGINE - \ No newline at end of file diff --git a/server/-product/production/LOCAL/settings/application.yaml b/server/-product/production/LOCAL/settings/application.yaml index 64f6b872..7b51132e 100644 --- a/server/-product/production/LOCAL/settings/application.yaml +++ b/server/-product/production/LOCAL/settings/application.yaml @@ -1,6 +1,6 @@ datasource: mediacube: - url: jdbc:db2://localhost:50000/mc + url: jdbc:db2://localvm:50000/mc user: db2admin password: password external-indexer: true @@ -8,7 +8,7 @@ datasource: login-timeout: 3 pool-size: 10 mediacube-nosql: - url: jdbc:db2://localhost:50000/mc + url: jdbc:db2://localvm:50000/mc user: db2admin password: password schema: test diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java index f50a10e3..07d9501d 100644 --- a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/SmallTests.java @@ -250,9 +250,8 @@ public class SmallTests { Integer nexioPort = 2098; String nexioUserName = "administrator"; String nexioPassword = "system"; - Object[] inputs = { mediaCubeMedia, targetPath, targetNamePattern, successRecipient, killDateDays, - localRetrievePath, globalRetrievePath, useNexioTarget, nexioAgency, nexioPort, nexioUserName, - nexioPassword }; + Object[] inputs = { mediaCubeMedia, targetPath, targetNamePattern, successRecipient, killDateDays, localRetrievePath, globalRetrievePath, + useNexioTarget, nexioAgency, nexioPort, nexioUserName, nexioPassword }; // Object[] inputs = { null, null, null, null, 0, null, null, false, null, 0, // null, null }; sut.run(null, null, inputs); @@ -322,8 +321,8 @@ public class SmallTests { @Test public void test9() throws Exception { - List files = Arrays.asList(Paths.get("/opt/20200101100000.xxx.json"), Paths.get("/opt/xxx.json"), - Paths.get("/opt/yyy.json"), Paths.get("/opt/20200202200000.xxx.json")); + List files = Arrays.asList(Paths.get("/opt/20200101100000.xxx.json"), Paths.get("/opt/xxx.json"), Paths.get("/opt/yyy.json"), + Paths.get("/opt/20200202200000.xxx.json")); files.sort((a, b) -> { return a.compareTo(b); @@ -512,8 +511,7 @@ public class SmallTests { @Test public void test99() throws Exception { System.setProperty("jobengine.ffmpeg.location", "/Programs/ffmpeg/bin/ffmpeg.exe"); - System.setProperty("java.library.path", - System.getProperty("java.library.path") + ";/_workspace/USER/MediaCube/server/-dependencies/libs"); + System.setProperty("java.library.path", System.getProperty("java.library.path") + ";/_workspace/USER/MediaCube/server/-dependencies/libs"); Path input = Paths.get("/_XDCAM/Sub/0410_1006_DEMO_mariagyud_mixS01.MXF"); Path output = Paths.get("/_XDCAM/out"); @@ -566,8 +564,7 @@ public class SmallTests { public void test992() throws Exception { Timestamp nexio = Timestamp.from(Instant.now().minus(2, ChronoUnit.HOURS)); LocalDateTime ldt = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.systemDefault()); - LocalDateTime ldn = LocalDateTime.ofInstant(Instant.now().minus(2, ChronoUnit.HOURS), - ZoneOffset.systemDefault()); + LocalDateTime ldn = LocalDateTime.ofInstant(Instant.now().minus(2, ChronoUnit.HOURS), ZoneOffset.systemDefault()); long modifiedHours = Duration.between(ldt, ldn).toHours(); System.out.println(modifiedHours); System.out.println(DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(ldt)); @@ -631,8 +628,7 @@ public class SmallTests { } } System.out.println(String.format("TSM hiány %d, polcon van %d, omben van %d", fCount, pCount, oCount)); - System.out.println(String.format("Egyéb %d, Reklám %d, Promó %d, Anyag %d, Adásban volt %d", other, ad, promo, - material, inrd)); + System.out.println(String.format("Egyéb %d, Reklám %d, Promó %d, Anyag %d, Adásban volt %d", other, ad, promo, material, inrd)); // Files.write(Paths.get("/opt/AMC/mcmissing.txt"), mcmissing); } @@ -689,8 +685,7 @@ public class SmallTests { errorCount++; } float archivePercent = archivedCount * 100 / omCount; - System.out.println(String.format("Archiválandó %d, archivált %d, nem archivált %d, százalék %f", omCount, - archivedCount, errorCount, archivePercent)); + System.out.println(String.format("Archiválandó %d, archivált %d, nem archivált %d, százalék %f", omCount, archivedCount, errorCount, archivePercent)); // Files.write(Paths.get("/opt/AMC/mcmissing.txt"), mcmissing); } @@ -760,8 +755,7 @@ public class SmallTests { } } - String excludedReport = String.format("Kihagyva %d db, összméret %s", omExcludeCount, - readableFileSize(omExcludeSizeSum)); + String excludedReport = String.format("Kihagyva %d db, összméret %s", omExcludeCount, readableFileSize(omExcludeSizeSum)); System.out.println(excludedReport); Files.write(Paths.get("/opt/mv-excluded-parlament-byid.txt"), out); @@ -795,8 +789,7 @@ public class SmallTests { } } - String excludedReport = String.format("%d db, összméret %s", omExcludeCount, - readableFileSize(omExcludeSizeSum)); + String excludedReport = String.format("%d db, összméret %s", omExcludeCount, readableFileSize(omExcludeSizeSum)); System.out.println(excludedReport); Files.write(Paths.get("/opt/mv-excluded-parlament-name.txt"), out); @@ -873,8 +866,7 @@ public class SmallTests { continue; } } - System.out.println( - "All (no PTV) " + omcount + " missing " + count + " completed " + ((count * 100) / omcount) + "%"); + System.out.println("All (no PTV) " + omcount + " missing " + count + " completed " + ((count * 100) / omcount) + "%"); // String excludedReport = String.format("Kihagyva %d db, összméret %s", // omExcludeCount, readableFileSize(omExcludeSizeSum)); // System.out.println(excludedReport); @@ -985,10 +977,8 @@ public class SmallTests { vchecked++; - if (!df.format(mcdate).substring(0, 10).equals(df.format(tsmdate).substring(0, 10)) - && tsmdate.before(mcdate)) { - System.out.println( - "Old version in TSM " + id + " mc " + df.format(mcdate) + " tsm " + df.format(tsmdate)); + if (!df.format(mcdate).substring(0, 10).equals(df.format(tsmdate).substring(0, 10)) && tsmdate.before(mcdate)) { + System.out.println("Old version in TSM " + id + " mc " + df.format(mcdate) + " tsm " + df.format(tsmdate)); vreport.add(id); vmissings++; } @@ -999,8 +989,7 @@ public class SmallTests { } } - System.out.println( - tsm.size() + " " + mc.size() + " " + missings + " vchecked" + vchecked + " vmissing" + vmissings); + System.out.println(tsm.size() + " " + mc.size() + " " + missings + " vchecked" + vchecked + " vmissing" + vmissings); Files.write(Paths.get("/opt/AMC/mreport.txt"), mreport); Files.write(Paths.get("/opt/AMC/vreport.txt"), vreport); } @@ -1010,8 +999,8 @@ public class SmallTests { GroovyClassLoader cl = new GroovyClassLoader(this.getClass().getClassLoader()) { @Override - public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, - boolean resolve) throws ClassNotFoundException, CompilationFailedException { + public Class loadClass(String name, boolean lookupScriptFiles, boolean preferClassOverScript, boolean resolve) + throws ClassNotFoundException, CompilationFailedException { return super.loadClass(name, lookupScriptFiles, preferClassOverScript, resolve); } @@ -1036,14 +1025,16 @@ public class SmallTests { @Test public void test9996() throws Exception { - String className = "TestStep1"; - String root = "/opt/steps"; + String className = "Test2"; + String root = "/opt/"; try (GroovyClassLoader cl = new GroovyClassLoader(this.getClass().getClassLoader())) { Path path = Paths.get(root, className + ".java"); - cl.addURL(path.toUri().toURL()); - Class myClass = cl.loadClass("user.jobengine.server.steps.TestStep1", true, true); + // cl.addURL(path.toUri().toURL()); + + Class myClass = cl.parseClass(path.toFile()); System.out.println(myClass.getCanonicalName()); + System.out.println(myClass.getResource("Test2.class")); Method method = myClass.getMethod("execute"); method.invoke(myClass.newInstance()); } catch (Exception e) { @@ -1227,10 +1218,8 @@ public class SmallTests { public void test99997() throws Exception { System.setProperty("jna.library.path", "/users/elgekko"); - List files = Arrays.asList("c:\\opt\\AMC\\2021\\ISSUES\\#203\\IFL000000071_43.mxf", - "c:\\opt\\AMC\\2021\\ISSUES\\#203\\MX_12290041.mxf", - "c:\\opt\\AMC\\2021\\ISSUES\\#203\\DK_20344100_02_high_16_9.mxf", - "c:\\opt\\AMC\\2021\\ISSUES\\#203\\IPR000011027_169.mxf"); + List files = Arrays.asList("c:\\opt\\AMC\\2021\\ISSUES\\#203\\IFL000000071_43.mxf", "c:\\opt\\AMC\\2021\\ISSUES\\#203\\MX_12290041.mxf", + "c:\\opt\\AMC\\2021\\ISSUES\\#203\\DK_20344100_02_high_16_9.mxf", "c:\\opt\\AMC\\2021\\ISSUES\\#203\\IPR000011027_169.mxf"); for (String file : files) { try (user.commons.mediaarea.MediaInfo mi = new user.commons.mediaarea.MediaInfo(file)) { // Display aspect ratio diff --git a/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Test1.java b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Test1.java new file mode 100644 index 00000000..15b8de2d --- /dev/null +++ b/server/hu.user.mediacube.executors.tests/src/hu/user/mediacube/executors/tests/Test1.java @@ -0,0 +1,8 @@ +package hu.user.mediacube.executors.tests; + +public class Test1 { + + public void execute() { + System.out.println("Execute..."); + } +} diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ImportStatisticsStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ImportStatisticsStep.java index d0978b1d..7a34a4df 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ImportStatisticsStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ImportStatisticsStep.java @@ -135,7 +135,8 @@ public class ImportStatisticsStep extends JobStep { throw e; } current++; - setProgress(current * 100 / overall); + int progress = current * 100 / overall; + setProgress(progress); } return result; } @@ -152,7 +153,7 @@ public class ImportStatisticsStep extends JobStep { String channel = NoSQLUtils.asString(NoSQLUtils.asDBObject(rundown, IOctopusAPI.CHANNEL), IOctopusAPI.NAME); Date scheduledStart = rundown.getDate(IOctopusAPI.SCHEDULED_START); String start = CalendarUtils.toString(CalendarUtils.createCalendar(scheduledStart), SCHEDULED_FORMAT); - //String rundownName = NoSQLUtils.asString(rundown, IOctopusAPI.NAME); + // String rundownName = NoSQLUtils.asString(rundown, IOctopusAPI.NAME); rundownName = String.format("%s %s %s", start, name, channel); List stories = octopusAPI.getRundownStories(rundownID, createFieldsObject()); if (stories != null) @@ -164,7 +165,8 @@ public class ImportStatisticsStep extends JobStep { throw e; } current++; - setProgress(current * 100 / overall); + int progress = current * 100 / overall; + setProgress(progress); } return result; } @@ -199,7 +201,7 @@ public class ImportStatisticsStep extends JobStep { BasicDBObject clip = (BasicDBObject) clipCollection.findOne(new BasicDBObject(LONGNAMEID, clipName)); if (clip != null) { long duration = NoSQLUtils.asLong(clip, DURATION); - //az ures klipp 1 kocka hosszu + // az ures klipp 1 kocka hosszu if (duration > 1) { mosObject.put("duration", duration); foundAnyClip = true; @@ -334,7 +336,7 @@ public class ImportStatisticsStep extends JobStep { NoSQLUtils.addLong(perReporterStat, "archive_duration", archiveDuration); } - //skipped + // skipped if (sfCount > 0 && rdCount == 0) { NoSQLUtils.addLong(planStat, "skip_count", 1); NoSQLUtils.addLong(planStat, "skip_duration", duration); @@ -344,7 +346,7 @@ public class ImportStatisticsStep extends JobStep { NoSQLUtils.addLong(perReporterStat, "skip_duration", duration); } - //onair + // onair if (rdCount > 0) { NoSQLUtils.addLong(planStat, "onair_count", 1); NoSQLUtils.addLong(planStat, "onair_duration", duration); diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/ProjectCleanupMountedLocationStep.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/ProjectCleanupMountedLocationStep.java index e46bfaa3..ce9c3c09 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/ProjectCleanupMountedLocationStep.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/ProjectCleanupMountedLocationStep.java @@ -174,7 +174,8 @@ public class ProjectCleanupMountedLocationStep extends JobStep implements FileVi private boolean processPathItem(Path filePath) { currentCount[0]++; - setProgress(currentCount[0] * 100 / allCount[0]); + int progress = currentCount[0] * 100 / allCount[0]; + setProgress(progress); if (filePath.toFile().isDirectory() || !filePath.toString().toUpperCase().endsWith(".EZP")) return false; diff --git a/server/user.jobengine.executors/src/user/jobengine/server/steps/shared/PBQuery.java b/server/user.jobengine.executors/src/user/jobengine/server/steps/shared/PBQuery.java index 2b50e30d..7218c1a7 100644 --- a/server/user.jobengine.executors/src/user/jobengine/server/steps/shared/PBQuery.java +++ b/server/user.jobengine.executors/src/user/jobengine/server/steps/shared/PBQuery.java @@ -79,7 +79,7 @@ public class PBQuery { public static final String GETCUSTOMVIEW = "/getCustomView"; private static final Path subtitleRoot = Paths.get("X:\\PB_ARCH"); - private static final Path missingSubsRoot = Paths.get("R:\\BeachPool"); + private static final Path missingSubsRoot = Paths.get("R:\\BeachPoolSubs"); private Set subsDirectoriesList; private static Document toDocument(String xml) { @@ -139,8 +139,8 @@ public class PBQuery { return Paths.get(configDir, viewName); } - public void init(String primaryEndPoint, String primaryUserName, String primaryPassword, String secondaryEndPoint, - String secondaryUserName, String secondaryPassword, int rangeForwardHours) throws Exception { + public void init(String primaryEndPoint, String primaryUserName, String primaryPassword, String secondaryEndPoint, String secondaryUserName, + String secondaryPassword, int rangeForwardHours) throws Exception { this.primaryEndPoint = primaryEndPoint; this.primaryUserName = primaryUserName; this.primaryPassword = primaryPassword; @@ -173,8 +173,7 @@ public class PBQuery { DataInputStream is = null; try { URL url = new URL(endPoint); - httpclient.getCredentialsProvider().setCredentials( - new AuthScope(url.getHost(), url.getPort(), null, "Digest"), + httpclient.getCredentialsProvider().setCredentials(new AuthScope(url.getHost(), url.getPort(), null, "Digest"), new UsernamePasswordCredentials(user, pwd)); HttpPost httppost = new HttpPost(url.toURI()); diff --git a/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java b/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java index 4806a072..e9149678 100644 --- a/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java +++ b/server/user.jobengine.osgi.db/src/user/jobengine/db/ItemManager.java @@ -157,8 +157,7 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public FileType createFileType(String name, String description, String videoCodec, String audioCodec, - int videoTracks, int audioTracks, float frameRate) { + public FileType createFileType(String name, String description, String videoCodec, String audioCodec, int videoTracks, int audioTracks, float frameRate) { traceIn(); FileType entity = new FileType(); entity.setPersister(this); @@ -176,11 +175,12 @@ public class ItemManager extends MemoryCache implements IItemManager { private IMediaFinder createFinder() { IMediaFinder finder = null; boolean externalIndexer = systemConfig.value("datasource.mediacube.external-indexer", false); - if (externalIndexer) { +// if (externalIndexer) { // finder = new LuceneMediaFinder(this); - } else { - finder = new MediaFinder(this); - } +// } else { +// finder = new MediaFinder(this); +// } + finder = new MediaFinder(this); return finder; } @@ -269,8 +269,8 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public Metadata createMetadata(MetadataElement mde, ListType listType, GuiType guiType, String sqlField, - StaticTables staticTable, String pojoField, MdType... flags) { + public Metadata createMetadata(MetadataElement mde, ListType listType, GuiType guiType, String sqlField, StaticTables staticTable, String pojoField, + MdType... flags) { traceIn(); Metadata entity = new Metadata(); int values = MdType.getValues(flags); @@ -325,8 +325,7 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public MetadataType createMetadataType(String name, BaseType baseType, String javaType, String dataType, - int length) { + public MetadataType createMetadataType(String name, BaseType baseType, String javaType, String dataType, int length) { traceIn(); MetadataType entity = new MetadataType(); entity.setPersister(this); @@ -392,8 +391,8 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public StoreUri createStoreUri(RemoteStoreProtocol protocol, String uri, int portNumber, boolean isStream, - boolean isSource, boolean isTarget, String userName, String password, String rootPath) { + public StoreUri createStoreUri(RemoteStoreProtocol protocol, String uri, int portNumber, boolean isStream, boolean isSource, boolean isTarget, + String userName, String password, String rootPath) { traceIn(); StoreUri entity = new StoreUri(); entity.setPersister(this); @@ -410,8 +409,7 @@ public class ItemManager extends MemoryCache implements IItemManager { @Override public StoreUri createStoreUri(URI uri) { - StoreUri result = createStoreUri(RemoteStoreProtocol.fromString(uri.toString()), uri.getHost(), uri.getPort(), - false, false, false, null, null, null); + StoreUri result = createStoreUri(RemoteStoreProtocol.fromString(uri.toString()), uri.getHost(), uri.getPort(), false, false, false, null, null, null); result.setCurrentPath(uri.getPath()); return result; } @@ -432,9 +430,8 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public WorkflowAction createWorkflowAction(Timestamp touched, Timestamp started, Timestamp finished, - boolean successful, String houseId, String description, String source, String destination, String tag, - long size) { + public WorkflowAction createWorkflowAction(Timestamp touched, Timestamp started, Timestamp finished, boolean successful, String houseId, String description, + String source, String destination, String tag, long size) { traceIn(); WorkflowAction entity = new WorkflowAction(); @@ -474,8 +471,7 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public StoreUri ensureUri(String storeName, String uri, boolean isSystem, boolean isLowres, - RemoteStoreProtocol protocol) { + public StoreUri ensureUri(String storeName, String uri, boolean isSystem, boolean isLowres, RemoteStoreProtocol protocol) { Store store = getStore(storeName); StoreUri result = null; if (store == null) { @@ -496,8 +492,7 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public void executeQuery(Connection connection, String query, IResultSetConsumer consumer, - IStatementDecorator decorator) { + public void executeQuery(Connection connection, String query, IResultSetConsumer consumer, IStatementDecorator decorator) { ResultSet rs = null; PreparedStatement st = null; try { @@ -559,8 +554,7 @@ public class ItemManager extends MemoryCache implements IItemManager { } @Override - public int executeUpdate(Connection connection, String query, IStatementDecorator decorator, - IResultSetConsumer keysConsumer) { + public int executeUpdate(Connection connection, String query, IStatementDecorator decorator, IResultSetConsumer keysConsumer) { int result = -1; PreparedStatement st = null; ResultSet rs = null; @@ -800,8 +794,8 @@ public class ItemManager extends MemoryCache implements IItemManager { try { String date = df.format(scheduleDate.getTime()); String query = String.format( - "SELECT COUNT(*) as count, SUM(size) as duration FROM VW_RD_INGEST WHERE houseid='%s' AND finished LIKE '%s%%' GROUP BY houseid", - houseId, date); + "SELECT COUNT(*) as count, SUM(size) as duration FROM VW_RD_INGEST WHERE houseid='%s' AND finished LIKE '%s%%' GROUP BY houseid", houseId, + date); st = connection.prepareStatement(query); rs = st.executeQuery(); if (rs.next()) { @@ -1135,8 +1129,7 @@ public class ItemManager extends MemoryCache implements IItemManager { Calendar end = CalendarUtils.createZeroCalendar(date); end.add(Calendar.DAY_OF_YEAR, 1); WorkflowActionDAO dao = (WorkflowActionDAO) getBaseDAO(WorkflowAction.class); - return (List) (List) dao.getWorkflowActions(new Timestamp(begin.getTimeInMillis()), - new Timestamp(end.getTimeInMillis())); + return (List) (List) dao.getWorkflowActions(new Timestamp(begin.getTimeInMillis()), new Timestamp(end.getTimeInMillis())); } void initialize() { @@ -1347,10 +1340,9 @@ public class ItemManager extends MemoryCache implements IItemManager { StoreUri result = null; List uris = store.getStoreUris(); if (uris != null && uris.size() > 1) { - uris = uris.stream().filter(u -> u.getProtocol() == RemoteStoreProtocol.LOCAL && u.isTarget()) - .sorted((u1, u2) -> { - return Integer.compare(u1.getPriority(), u2.getPriority()); - }).collect(Collectors.toList()); + uris = uris.stream().filter(u -> u.getProtocol() == RemoteStoreProtocol.LOCAL && u.isTarget()).sorted((u1, u2) -> { + return Integer.compare(u1.getPriority(), u2.getPriority()); + }).collect(Collectors.toList()); for (StoreUri uri : uris) { // min 5GB diff --git a/server/user.mediacube.gui/pages/searchitems.zul b/server/user.mediacube.gui/pages/searchitems.zul index 245e4a63..ea01b2ab 100644 --- a/server/user.mediacube.gui/pages/searchitems.zul +++ b/server/user.mediacube.gui/pages/searchitems.zul @@ -3,7 +3,7 @@ - + @@ -39,7 +39,7 @@ -
+
diff --git a/server/user.mediacube.gui/pages/searchitems/filters.zul b/server/user.mediacube.gui/pages/searchitems/filters.zul index 35014d94..1650b0a9 100644 --- a/server/user.mediacube.gui/pages/searchitems/filters.zul +++ b/server/user.mediacube.gui/pages/searchitems/filters.zul @@ -2,11 +2,11 @@ - - - - - + + + + + diff --git a/server/user.mediacube.gui/pages/searchitems/tabulatorresult.zul b/server/user.mediacube.gui/pages/searchitems/tabulatorresults.zul similarity index 100% rename from server/user.mediacube.gui/pages/searchitems/tabulatorresult.zul rename to server/user.mediacube.gui/pages/searchitems/tabulatorresults.zul diff --git a/server/user.mediacube.gui/src/user/jobengine/zk/model/CachedListModel.java b/server/user.mediacube.gui/src/user/jobengine/zk/model/CachedListModel.java index b5388a8a..dcb1e72d 100644 --- a/server/user.mediacube.gui/src/user/jobengine/zk/model/CachedListModel.java +++ b/server/user.mediacube.gui/src/user/jobengine/zk/model/CachedListModel.java @@ -174,6 +174,27 @@ public class CachedListModel extends ListModelList { } } + public List loadPage(int forIndex, int pageSize) { + List result = null; + try { + logger.info("Loading page {}", forIndex); + int startPos = forIndex * pageSize; + int endPos = startPos + pageSize; + + SearchResult sr = createSearchResult(startPos, endPos); + + if (sr != null) { + this.resultSetSize = (int) sr.getItemCount(); + result = sr.getItems(); + } + } catch (Exception e) { + fireCacheEvent(new Event(Events.ON_ERROR, null, e)); + // ki kell nullazni, egyebkent tobbszeros lekerdezes van + resultSetSize = 0; + } + return result; + } + // kintrol is hivhatjak public void reinit() { logger.info("reinit()"); diff --git a/server/user.mediacube.gui/src/user/jobengine/zk/model/TabulatorSearchModel.java b/server/user.mediacube.gui/src/user/jobengine/zk/model/TabulatorSearchModel.java index 1764da68..d7af8b0a 100644 --- a/server/user.mediacube.gui/src/user/jobengine/zk/model/TabulatorSearchModel.java +++ b/server/user.mediacube.gui/src/user/jobengine/zk/model/TabulatorSearchModel.java @@ -42,20 +42,14 @@ import org.zkoss.zk.ui.select.Selectors; import org.zkoss.zk.ui.select.annotation.Wire; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zul.Button; -import org.zkoss.zul.Checkbox; import org.zkoss.zul.Column; import org.zkoss.zul.Combobox; -import org.zkoss.zul.Detail; -import org.zkoss.zul.Grid; import org.zkoss.zul.Hbox; -import org.zkoss.zul.Hlayout; import org.zkoss.zul.ListModelList; import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menupopup; import org.zkoss.zul.Messagebox; -import org.zkoss.zul.Paging; import org.zkoss.zul.Panel; -import org.zkoss.zul.Row; import org.zkoss.zul.Timer; import org.zkoss.zul.Toolbar; import org.zkoss.zul.Toolbarbutton; @@ -111,8 +105,6 @@ public class TabulatorSearchModel extends AsyncBaseModel { @Wire Timer timer; @Wire - Grid itemsGrid; - @Wire Button backToVideoButton; @Wire Combobox search; @@ -232,23 +224,32 @@ public class TabulatorSearchModel extends AsyncBaseModel { setColumnOrder(); showExternalMediaID(); - if (itemsGrid != null) { - configureSearchResultGrid(); - if (SessionUtil.getUserPageSize() != 0) - itemsGrid.setPageSize(SessionUtil.getUserPageSize()); - setSettingsPageSize(itemsGrid.getPageSize()); - } + // TODO grid beallitasa mentett adatokbol +// if (itemsGrid != null) { +// Paging paging = itemsGrid.getPagingChild(); +// paging.setAutohide(false); +// +// for (Component child : itemsGrid.getColumns().getChildren()) { +// Column column = (Column) child; +// if (columnOrder != null) +// if (column.getLabel().equals(columnOrder.entrySet().iterator().next().getKey())) +// column.setSortDirection(columnOrder.entrySet().iterator().next().getValue()); +// column.addEventListener("onSort", evt -> doSort(evt)); +// } +// if (SessionUtil.getUserPageSize() != 0) +// itemsGrid.setPageSize(SessionUtil.getUserPageSize()); +// setSettingsPageSize(itemsGrid.getPageSize()); +// } + int pageSize = SessionUtil.getUserPageSize(); + if (pageSize != 0) + setSettingsPageSize(pageSize); + else + setSettingsPageSize(25); if (!allChecked) showSearchTypeWarning(); - tags = itemManager.getAllTags(); - // lekerdezesi hiba - if (tags == null) - Clients.showNotification("A cimkék inicializálása sikertelen!", "error", tagsToolbar, "start_center", - 3000); - else - setSearchTags(); + initSearchTags(); } catch (Exception e) { handleSearchError(e); @@ -256,6 +257,15 @@ public class TabulatorSearchModel extends AsyncBaseModel { } + private void initSearchTags() { + tags = itemManager.getAllTags(); + // lekerdezesi hiba + if (tags == null) + Clients.showNotification("A cimkék inicializálása sikertelen!", "error", tagsToolbar, "start_center", 3000); + else + setSearchTags(); + } + private void clearAllFilters() { for (String filter : typeFilters.keySet()) { typeFilters.get(filter).setChecked(false); @@ -269,28 +279,13 @@ public class TabulatorSearchModel extends AsyncBaseModel { SessionUtil.putUserSearchHistory(searchHistory); } - private void configureSearchResultGrid() { - Paging paging = itemsGrid.getPagingChild(); - paging.setAutohide(false); - - for (Component child : itemsGrid.getColumns().getChildren()) { - Column column = (Column) child; - if (columnOrder != null) - if (column.getLabel().equals(columnOrder.entrySet().iterator().next().getKey())) - column.setSortDirection(columnOrder.entrySet().iterator().next().getValue()); - column.addEventListener("onSort", evt -> doSort(evt)); - } - } - @Command public void copyMediaIdToClipboard() { - String port = (Executions.getCurrent().getServerPort() == 80) ? "" - : (":" + Executions.getCurrent().getServerPort()); + String port = (Executions.getCurrent().getServerPort() == 80) ? "" : (":" + Executions.getCurrent().getServerPort()); String baseURL = Executions.getCurrent().getScheme() + "://" + Executions.getCurrent().getServerName() + port + Executions.getCurrent().getContextPath(); String url = String.format("%s/?%s=%d", baseURL, MEDIA_ID, selectedObject.getMedia().getId()); - String email = String.format("mailto:?subject=Média címe: %s &body=A média itt tekinthető meg: %s", - selectedObject.getMedia().getTitle(), url); + String email = String.format("mailto:?subject=Média címe: %s &body=A média itt tekinthető meg: %s", selectedObject.getMedia().getTitle(), url); Executions.getCurrent().sendRedirect(email); } @@ -307,14 +302,12 @@ public class TabulatorSearchModel extends AsyncBaseModel { parameters.put("successRecipient", SessionUtil.getUserPrincipal().getEmail()); try { - jobEngine.submit(CREATE_LOWRES_TEMPLATE, scheduledJob.getJobName(), parameters, - SessionUtil.getUserPrincipal().getDisplayName()); - Messagebox.show("A proxy pótlása elindult, emailben értesíti a rendszer a folyamat végeztével.", - "Információ", Messagebox.OK, Messagebox.INFORMATION); + jobEngine.submit(CREATE_LOWRES_TEMPLATE, scheduledJob.getJobName(), parameters, SessionUtil.getUserPrincipal().getDisplayName()); + Messagebox.show("A proxy pótlása elindult, emailben értesíti a rendszer a folyamat végeztével.", "Információ", Messagebox.OK, + Messagebox.INFORMATION); } catch (JobEngineException e) { logger.info("Hiba a feladat indításakor", e); - Messagebox.show("Hiba a feladat indításakor. A rendszer üzenete: " + e.getMessage(), "Hiba", Messagebox.OK, - Messagebox.ERROR); + Messagebox.show("Hiba a feladat indításakor. A rendszer üzenete: " + e.getMessage(), "Hiba", Messagebox.OK, Messagebox.ERROR); } } @@ -328,7 +321,9 @@ public class TabulatorSearchModel extends AsyncBaseModel { search.close(); search.select(); searchResult = null; - itemsGrid.setActivePage(0); + + // TODO reset page to 0 + // itemsGrid.setActivePage(0); setSelectedObject(null); String searchValue = search.getText(); @@ -350,13 +345,15 @@ public class TabulatorSearchModel extends AsyncBaseModel { List selectedTypeIds = getTypeIDs(searchFilters); - SearchOptions options = SearchOptions.create().setText(searchValue).setTypes(selectedTypeIds) - .setTags(searchTags).setFrom(searchFrom).setTo(searchTo).setMissingProxy(missingProxy) - .setDescLength(descLength).setOrder(orderBy, orderAscending); + SearchOptions options = SearchOptions.create().setText(searchValue).setTypes(selectedTypeIds).setTags(searchTags).setFrom(searchFrom) + .setTo(searchTo).setMissingProxy(missingProxy).setDescLength(descLength).setOrder(orderBy, orderAscending); if (!options.isValid()) - throw new Exception( - "Legalább egy keresési opció használata kötelező: 3 karakter, hiányzó proxy, dátum, típus, cimke!"); + throw new Exception("Legalább egy keresési opció használata kötelező: 3 karakter, hiányzó proxy, dátum, típus, cimke!"); + + if (!allChecked) + showSearchTypeWarning(); + searchResult = new CachedListModel(options); searchResult.addEventListener(e -> { if (e.getName().equals(Events.ON_ERROR)) { @@ -365,8 +362,8 @@ public class TabulatorSearchModel extends AsyncBaseModel { } }); - if (!allChecked) - showSearchTypeWarning(); + int pageSize = SessionUtil.getUserPageSize(); + List page = searchResult.loadPage(0, pageSize); } catch (Exception e) { handleSearchError(e); @@ -374,7 +371,9 @@ public class TabulatorSearchModel extends AsyncBaseModel { } public void doSort(Event event) throws Exception { - itemsGrid.getColumns().getChildren().forEach(c -> ((Column) c).setSortDirection("natural")); + // TODO hande sort + // itemsGrid.getColumns().getChildren().forEach(c -> ((Column) + // c).setSortDirection("natural")); SortEvent evt = (SortEvent) event; Column column = (Column) evt.getTarget(); column.setSortDirection(evt.isAscending() ? "ascending" : "descending"); @@ -407,25 +406,25 @@ public class TabulatorSearchModel extends AsyncBaseModel { } void ensureVisible(int pos) { - - registerTask(() -> { - logger.info("Scrolling to pos {} begin", pos); - List children = itemsGrid.getRows().getChildren(); - if (children.size() > 0) { - Component top = children.get(pos); - Clients.scrollIntoView(top); - logger.info("Scrolled into the {}. row on the page.", pos); - } - - if (positionToScroll > -1) { - highlight(selectedObject, true); - positionToScroll = -1; - } - - logger.info("Scrolling to pos {} end", pos); - preventAfterRender = false; - }); - timer.start(); + // TODO show selected row +// registerTask(() -> { +// logger.info("Scrolling to pos {} begin", pos); +// List children = itemsGrid.getRows().getChildren(); +// if (children.size() > 0) { +// Component top = children.get(pos); +// Clients.scrollIntoView(top); +// logger.info("Scrolled into the {}. row on the page.", pos); +// } +// +// if (positionToScroll > -1) { +// highlight(selectedObject, true); +// positionToScroll = -1; +// } +// +// logger.info("Scrolling to pos {} end", pos); +// preventAfterRender = false; +// }); +// timer.start(); } public Validator getAllFilterCheckedValidator() { @@ -591,25 +590,27 @@ public class TabulatorSearchModel extends AsyncBaseModel { private void highlight(ArchivedMedia am, boolean highlight) { if (am == null) return; - List components = itemsGrid.getRows().getChildren(); - for (int i = 0; i < components.size(); i++) { - Row row = (Row) components.get(i); - ArchivedMedia archivedMedia = (ArchivedMedia) row.getValue(); - if (archivedMedia != null && am.getMedia().getId() == archivedMedia.getMedia().getId()) { - Detail detail = (Detail) row.getChildren().get(0); - Hlayout hlayout = (Hlayout) detail.getChildren().get(0); - if (highlight) { - selectedRowIndex = i; - row.setStyle("background: #F1F8E9;"); - hlayout.setStyle("border-bottom: 1px solid #C5E1A5; background: #F1F8E9;"); - } else { - row.setStyle("background: none;"); - hlayout.setStyle("border-bottom: 1px solid #ebebeb; background: none;"); - } - break; - } - } + // TODO higlight selected row + // List components = itemsGrid.getRows().getChildren(); +// for (int i = 0; i < components.size(); i++) { +// Row row = (Row) components.get(i); +// ArchivedMedia archivedMedia = (ArchivedMedia) row.getValue(); +// if (archivedMedia != null && am.getMedia().getId() == archivedMedia.getMedia().getId()) { +// Detail detail = (Detail) row.getChildren().get(0); +// Hlayout hlayout = (Hlayout) detail.getChildren().get(0); +// if (highlight) { +// selectedRowIndex = i; +// row.setStyle("background: #F1F8E9;"); +// hlayout.setStyle("border-bottom: 1px solid #C5E1A5; background: #F1F8E9;"); +// } else { +// row.setStyle("background: none;"); +// hlayout.setStyle("border-bottom: 1px solid #ebebeb; background: none;"); +// } +// break; +// +// } +// } } public boolean isAllChecked() { @@ -703,8 +704,7 @@ public class TabulatorSearchModel extends AsyncBaseModel { doubleVar = (Double) jsObject.get("meta"); } - if (doubleVar.floatValue() >= ((selectedObject.getTcOut() == null) ? 9999999999999999999999.9 - : selectedObject.getTcOut())) { + if (doubleVar.floatValue() >= ((selectedObject.getTcOut() == null) ? 9999999999999999999999.9 : selectedObject.getTcOut())) { throw new Exception("A kilépés időpontjának későbbinek kell lennie mint a belépés időpontja!"); } else { selectedObject.setTcIn(new Float(doubleVar.floatValue())); @@ -751,8 +751,7 @@ public class TabulatorSearchModel extends AsyncBaseModel { metaWindow = null; }; - metaWindow = (Window) Executions.createComponents(template, null, - ListUtils.asMap("selectedObject", selectedObject, "listener", listener)); + metaWindow = (Window) Executions.createComponents(template, null, ListUtils.asMap("selectedObject", selectedObject, "listener", listener)); metaWindow.doOverlapped(); metaWindow.addEventListener("onClose", listener); } @@ -817,8 +816,7 @@ public class TabulatorSearchModel extends AsyncBaseModel { case TAGTYPE_REMOVE: mediaTags.remove(tagText.toLowerCase()); if (id == 0) { - Messagebox.show("A cimke már nem található az adatbázisban: " + tagText, "Belső hiba!", Messagebox.OK, - Messagebox.EXCLAMATION); + Messagebox.show("A cimke már nem található az adatbázisban: " + tagText, "Belső hiba!", Messagebox.OK, Messagebox.EXCLAMATION); return; } itemManager.removeMediaTag(id, selectedObject.getMedia().getId()); @@ -840,8 +838,7 @@ public class TabulatorSearchModel extends AsyncBaseModel { @Command @NotifyChange({ "selectedObject", "hasLowresMediaFile", "hasTSMMediaFile", "lowresMediaFilePath" }) - public void select(@BindingParam("selectedObject") ArchivedMedia selectedObject, - @ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) { + public void select(@BindingParam("selectedObject") ArchivedMedia selectedObject, @ContextParam(ContextType.BIND_CONTEXT) BindContext ctx) { Event event = ctx.getTriggerEvent(); // Nem mindig a row a target, ha a kepre kattintunk akkor az image // selectedRowIndex = ((Row) event.getTarget()).getIndex(); @@ -867,25 +864,25 @@ public class TabulatorSearchModel extends AsyncBaseModel { this.allFilterCheckedValidator = allFilterCheckedValidator; } - public void setAllSelected(boolean allSelected) { - this.allSelected = allSelected; - // itemsGrid.renderAll(); - List components = itemsGrid.getRows().getChildren(); - for (Component obj : components) { - Row row = (Row) obj; - List children = row.getChildren(); - if (children.size() < 2) - continue; - Component component = children.get(1); - if (!(component instanceof Checkbox)) - continue; - Checkbox ck = (Checkbox) component; - ck.setChecked(allSelected); - MenuModel model = (MenuModel) SessionUtil.getAttribute(SessionUtil.MENUMODEL); - model.selectArchivedMedia(row.getValue(), allSelected); - } - - } +// public void setAllSelected(boolean allSelected) { +// this.allSelected = allSelected; +// // itemsGrid.renderAll(); +// List components = itemsGrid.getRows().getChildren(); +// for (Component obj : components) { +// Row row = (Row) obj; +// List children = row.getChildren(); +// if (children.size() < 2) +// continue; +// Component component = children.get(1); +// if (!(component instanceof Checkbox)) +// continue; +// Checkbox ck = (Checkbox) component; +// ck.setChecked(allSelected); +// MenuModel model = (MenuModel) SessionUtil.getAttribute(SessionUtil.MENUMODEL); +// model.selectArchivedMedia(row.getValue(), allSelected); +// } +// +// } public void setBottomTypeFilters(List bottomTypeFilters) { this.bottomTypeFilters = bottomTypeFilters; @@ -997,9 +994,8 @@ public class TabulatorSearchModel extends AsyncBaseModel { return; int pageSize = Integer.parseInt(source.getValue()); setSettingsPageSize(pageSize); - itemsGrid.setPageSize(pageSize); - itemsGrid.setActivePage(0); SessionUtil.putUserPageSize(pageSize); + logger.info("Result list page size set to {}", pageSize); } public void setRowsExpanded(boolean rowsExpanded) { @@ -1132,25 +1128,25 @@ public class TabulatorSearchModel extends AsyncBaseModel { public void showInResults() { if (selectedObject == null) return; - int activePageIndex = selectedRowIndex / itemsGrid.getPageSize(); - positionToScroll = selectedRowIndex - itemsGrid.getPageSize() * activePageIndex; - // preventAfterRender = true; - if (activePageIndex != itemsGrid.getActivePage()) { - itemsGrid.setActivePage(activePageIndex); - logger.info( - "Selected media is shown in the results, which can be found on {} page and also it will be highlighted.", - activePageIndex + 1); - } else { - // TODO for debug purposes - // onAfterRenderGrid(); - logger.info("Selected media is shown in the results, which can be found on opened page."); - } + + // TODO show selected item in list +// int activePageIndex = selectedRowIndex / itemsGrid.getPageSize(); +// positionToScroll = selectedRowIndex - itemsGrid.getPageSize() * activePageIndex; +// // preventAfterRender = true; +// if (activePageIndex != itemsGrid.getActivePage()) { +// itemsGrid.setActivePage(activePageIndex); +// logger.info("Selected media is shown in the results, which can be found on {} page and also it will be highlighted.", activePageIndex + 1); +// } else { +// // TODO for debug purposes +// // onAfterRenderGrid(); +// logger.info("Selected media is shown in the results, which can be found on opened page."); +// } } private void showSearchTypeWarning() { - Clients.showNotification(String.format( - "Figyelem!

A keresés eredménye nem tartalmazza az összes típust."), - "warning", toggleShowTypeFilters, "end_center", 3000); + Clients.showNotification( + String.format("Figyelem!

A keresés eredménye nem tartalmazza az összes típust."), "warning", + toggleShowTypeFilters, "end_center", 3000); } @Command