git-tfs-id: [http://tfs.userrendszerhaz.hu:8080/tfs/DefaultCollection]$/MediaCube...
authorMárk Mérész <USER\mark.meresz>
Fri, 20 Jul 2018 10:58:45 +0000 (10:58 +0000)
committerMárk Mérész <USER\mark.meresz>
Fri, 20 Jul 2018 10:58:45 +0000 (10:58 +0000)
server/-configuration/scheduledjobs.json
server/user.jobengine.executors/jobtemplates/retrieve-ondemand.xml
server/user.jobengine.executors/src/user/jobengine/server/steps/TSMExtendedRetrieveStep.java
server/user.jobengine.executors/src/user/jobengine/server/steps/TSMRestoreStep.java
server/user.jobengine.osgi.server/pages/searchitems.zul
server/user.jobengine.osgi.server/src/user/jobengine/zk/model/SearchModel.java
server/user.jobengine.osgi.server/src/user/jobengine/zk/util/SessionUtil.java

index 8368e843de9063668fb3b8da008e2d3edea3477a..b39af79174bcc4c4c5ee9e65081cb29fc0d8a9b0 100644 (file)
        {"name": "octopusOutputFolder", "value": "OCTOPUS", "type": "java.lang.String"},\r
        {"name": "genericOutputFolder", "value": "ARCHIVE_RESTORE", "type": "java.lang.String"},\r
        {"name": "onlineOutputFolder", "value": "ONLINE", "type": "java.lang.String"},\r
-       {"name": "killDateDays", "value": 7, "type": "java.lang.Integer"}\r
+       {"name": "killDateDays", "value": 7, "type": "java.lang.Integer"},\r
+       {"name": "nexioAgency", "value": "ARCHIVE_RESTORE", "type": "java.lang.String"},\r
+       {"name": "nexioPort", "value": 2098, "type": "java.lang.Integer"},\r
+       {"name": "nexioUserName", "value": "administrator", "type": "java.lang.String"},\r
+       {"name": "nexioPassword", "value": "system", "type": "java.lang.String"}\r
       ]\r
        },\r
        {\r
index be4d957a9ded9b08709c36f4d9768365b27f74fb..79756820025d37350c9d729a80b98920333d5b21 100644 (file)
                        <parameter name="successRecipient" type="java.lang.String" />\r
                        <parameter name="targetPathType" type="java.lang.String" />\r
                        <parameter name="killDateDays" type="java.lang.Integer"/>\r
+                       <parameter name="nexioAgency" type="java.lang.String"/>\r
+                       <parameter name="nexioPort" type="java.lang.Integer"/>\r
+                       <parameter name="nexioUserName" type="java.lang.String"/>\r
+                       <parameter name="nexioPassword" type="java.lang.String"/>\r
                </parameters>\r
                <variables>\r
                        <variable name="targetPath" type="java.lang.String" />\r
                                <input>\r
                                        <variable name="useNexioTarget" />\r
                                </input>\r
+                               <input>\r
+                                       <parameter name="nexioAgency" />\r
+                               </input>\r
+                               <input>\r
+                                       <parameter name="nexioPort" />\r
+                               </input>\r
+                               <input>\r
+                                       <parameter name="nexioUserName" />\r
+                               </input>\r
+                               <input>\r
+                                       <parameter name="nexioPassword" />\r
+                               </input>\r
                        </inputs>\r
                </calljobstep>\r
        </commands>\r
index 9d1d5fd7000413ea13bc75503cf6faa0126ecd64..b8242447cc3ad505c26ba34e3b2bedb5276c274a 100644 (file)
@@ -1,6 +1,14 @@
 package user.jobengine.server.steps;\r
 \r
+import java.io.OutputStream;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
+\r
+import org.apache.commons.net.ftp.FTPClient;\r
+\r
+import user.commons.CalendarUtils;\r
 import user.commons.StoreUri;\r
+import user.commons.remotestore.FtpDirectoryLister;\r
 import user.commons.remotestore.RemoteStoreProtocol;\r
 import user.jobengine.db.IItemManager;\r
 import user.jobengine.db.Media;\r
@@ -9,26 +17,46 @@ import user.jobengine.server.IJobRuntime;
 \r
 public class TSMExtendedRetrieveStep extends TSMRestoreStep {\r
        private boolean useNexioTarget;\r
+       private int nexioPort;\r
+       private String nexioUserName, nexioPassword;\r
+       private String nexioHost;\r
+       private String nexioAgency;\r
+\r
+       @Override\r
+       protected void afterRestore(StoreUri targetUri, String targetPath, int killDateDays, String targetFileName) throws Exception {\r
+               if (useNexioTarget) {\r
+                       OutputStream outStream = null;\r
+                       try {\r
+                               FTPClient targetFTP = ((FtpDirectoryLister) targetUri.getLister()).connect();\r
+                               Calendar killDate = CalendarUtils.createCalendar(new Date());\r
+                               killDate.add(Calendar.DAY_OF_YEAR, killDateDays);\r
+                               byte[] killDateFile = EscortFiles.createNEXIOKillDateFile(targetFileName, killDate.getTime(), null, nexioAgency);\r
+                               outStream = targetFTP.storeFileStream(targetFileName + ".xml");\r
+                               if (outStream == null) {\r
+                                       throw new NullPointerException("Can not open: " + targetFileName + ".xml" + " Reply:" + targetFTP.getReplyString());\r
+                               }\r
+                               outStream.write(killDateFile);\r
+                               outStream.flush();\r
+                       } catch (Exception e) {\r
+                               throw e;\r
+                       } finally {\r
+                               if (outStream != null)\r
+                                       outStream.close();\r
+                               targetUri.cleanUp();\r
+                       }\r
+               }\r
+       }\r
+\r
+       @Override\r
+       protected void checkTargetPath(String targetPath) {\r
+               if (!useNexioTarget)\r
+                       super.checkTargetPath(targetPath);\r
+       }\r
 \r
        @Override\r
        protected StoreUri createTargetUri(IItemManager manager, String targetPath) throws NullPointerException {\r
                StoreUri result = null;\r
                if (useNexioTarget) {\r
-                       String nexioHost = System.getProperty("nexio.host"), nexioPassword = System.getProperty("nexioPassword"),\r
-                                       nexioUserName = System.getProperty("nexioUserName");\r
-                       Integer nexioPort = Integer.parseInt(System.getProperty("nexioPort"));\r
-                       if (nexioHost == null) {\r
-                               throw new NullPointerException("Missing system property on 'nexio.host' name");\r
-                       }\r
-                       if (nexioPassword == null) {\r
-                               throw new NullPointerException("Missing system property on 'nexioPassword' name");\r
-                       }\r
-                       if (nexioPort == 0) {\r
-                               throw new NullPointerException("Missing system property on 'nexioPort' name");\r
-                       }\r
-                       if (nexioUserName == null) {\r
-                               throw new NullPointerException("Missing system property on 'nexioUserName' name");\r
-                       }\r
                        result = manager.createStoreUri(RemoteStoreProtocol.FTP, nexioHost);\r
                        result.setPortNumber(nexioPort);\r
                        result.setUserName(nexioUserName);\r
@@ -41,8 +69,30 @@ public class TSMExtendedRetrieveStep extends TSMRestoreStep {
 \r
        @StepEntry\r
        public Object[] execute(Media mediaCubeMedia, String targetPath, String targetNamePattern, String successRecipient, int killDateDays,\r
-                       String localRetrievePath, String globalRetrievePath, boolean useNexioTarget, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
+                       String localRetrievePath, String globalRetrievePath, boolean useNexioTarget, String nexioAgency, Integer nexioPort, String nexioUserName,\r
+                       String nexioPassword, IJobEngine jobEngine, IJobRuntime jobRuntime) throws Exception {\r
                this.useNexioTarget = useNexioTarget;\r
+               this.nexioAgency = nexioAgency;\r
+               this.nexioPort = nexioPort;\r
+               this.nexioUserName = nexioUserName;\r
+               this.nexioPassword = nexioPassword;\r
+               nexioHost = System.getProperty("nexio.host");\r
+\r
+               if (nexioHost == null) {\r
+                       throw new NullPointerException("Missing system property on 'nexio.host' name");\r
+               }\r
+               if (nexioPort == 0) {\r
+                       throw new NullPointerException("System is not configured properly, 'nexioPort' input parameter missing.");\r
+               }\r
+               if (nexioUserName == null) {\r
+                       throw new NullPointerException("System is not configured properly, 'nexioUserName' input parameter missing.");\r
+               }\r
+               if (nexioPassword == null) {\r
+                       throw new NullPointerException("System is not configured properly, 'nexioPassword' input parameter missing.");\r
+               }\r
+               if (nexioAgency == null) {\r
+                       throw new NullPointerException("System is not configured properly, 'nexioAgency' input parameter missing.");\r
+               }\r
                return super.execute(mediaCubeMedia, targetPath, targetNamePattern, successRecipient, killDateDays, localRetrievePath, globalRetrievePath, jobEngine,\r
                                jobRuntime);\r
        }\r
index 98a956ac6958e09153d8c2a8e73ff5d66dfcbe94..9b81e0e783056aaaa0106d947ffe2f2d4a1a6a8b 100644 (file)
@@ -34,11 +34,18 @@ public class TSMRestoreStep extends JobStep {
        private String sourceFileName;\r
        private Marker marker;\r
 \r
-       protected void afterRestore(String targetPath, int killDateDays, String targetFileName) throws IOException {\r
+       protected void afterRestore(StoreUri targetUri, String targetPath, int killDateDays, String targetFileName) throws IOException, Exception {\r
                if (killDateDays > 0)\r
                        EscortFiles.createUNCKillDate(targetPath, targetFileName, killDateDays, marker);\r
        }\r
 \r
+       protected void checkTargetPath(String targetPath) {\r
+               if (StringUtils.isBlank(targetPath)) {\r
+                       logger.error(marker, "A folyamat 'targetPath' bemeneti paramétere üres.");\r
+                       throw new NullPointerException("System is not configured properly, 'targetPath' input parameter missing.");\r
+               }\r
+       }\r
+\r
        protected StoreUri createTargetUri(IItemManager manager, String targetPath) {\r
                return manager.createStoreUri(RemoteStoreProtocol.LOCAL, targetPath);\r
        }\r
@@ -76,8 +83,7 @@ public class TSMRestoreStep extends JobStep {
                        if (StringUtils.isNotBlank(successRecipient))\r
                                logger.info(new MediaCubeMarker(successRecipient), msg);\r
                        logger.info(marker, msg);\r
-\r
-                       afterRestore(targetPath, killDateDays, targetFileName);\r
+                       afterRestore(targetUri, targetPath, killDateDays, targetFileName);\r
 \r
                } catch (Exception e) {\r
                        Message msg = LogUtils.format("Az '{}' állomány visszatöltése sikertelen. A rendszer hibaüzenete: {}", sourceFileName, e.getMessage());\r
@@ -116,10 +122,7 @@ public class TSMRestoreStep extends JobStep {
                        logger.error(marker, "A folyamat 'mediaCubeMedia' bemeneti paramétere üres.");\r
                        throw new NullPointerException("System is not configured properly, 'mediaCubeMedia' input parameter missing.");\r
                }\r
-               if (StringUtils.isBlank(targetPath)) {\r
-                       logger.error(marker, "A folyamat 'targetPath' bemeneti paramétere üres.");\r
-                       throw new NullPointerException("System is not configured properly, 'targetPath' input parameter missing.");\r
-               }\r
+               checkTargetPath(targetPath);\r
                if (StringUtils.isBlank(targetNamePattern)) {\r
                        logger.error(marker, "A folyamat 'targetNamePattern' bemeneti paramétere üres.");\r
                        throw new NullPointerException("System is not configured properly, 'targetNamePattern' input parameter missing.");\r
index 933ee50baa3d2fccc5b64ed6d3428d225f1a2977..d0cb667050133815b2fa4efc36464d50c86d8b26 100644 (file)
 \r
                .z-row:hover > .z-row-inner, .z-row:hover > .z-cell { background: none; } .z-row:hover>.z-row-inner>.z-row-content{ text-color: black; }\r
 \r
-               .RED100 { border-color: #FFCDD2; }\r
+               .RED100.type-inlist { border-color: #FFCDD2!important; }\r
 \r
                .RED100 .z-toolbarbutton-content { background: #FFCDD2; }\r
-\r
+       \r
+               .RED200.type-inlist { border-color: #EF9A9A!important; }\r
                .RED200 .z-toolbarbutton-content { background: #EF9A9A; border-color: #EF9A9A;; }\r
 \r
+               .BROWN100.type-inlist {  border-color: #D7CCC8!important; }\r
                .BROWN100 .z-toolbarbutton-content { background: #D7CCC8; border-color: #D7CCC8; }\r
 \r
+               .YELLOW200.type-inlist {  border-color: #FFF59D!important; }\r
                .YELLOW200 .z-toolbarbutton-content { background: #FFF59D; }\r
 \r
+               .INDIGO100.type-inlist {  border-color: #C5CAE9!important; }\r
                .INDIGO100 .z-toolbarbutton-content { background: #C5CAE9; }\r
-\r
+               \r
+               .INDIGO200.type-inlist {  border-color: #9FA8DA!important; }\r
                .INDIGO200 .z-toolbarbutton-content { background: #9FA8DA; }\r
-\r
+               \r
+               .BLUE100.type-inlist {  border-color: #BBDEFB!important; }\r
                .BLUE100 .z-toolbarbutton-content { background: #BBDEFB; }\r
-\r
+               \r
+               .BLUE200.type-inlist {  border-color: #90CAF9!important; }\r
                .BLUE200 .z-toolbarbutton-content { background: #90CAF9; }\r
-\r
+               \r
+               .TEAL100.type-inlist {  border-color: #B2DFDB!important; }\r
                .TEAL100 .z-toolbarbutton-content { background: #B2DFDB; }\r
-\r
+               \r
+               .TEAL200.type-inlist {  border-color: #80CBC4!important; }\r
                .TEAL200 .z-toolbarbutton-content { background: #80CBC4; }\r
 \r
                .z-toolbarbutton-content { text-shadow: none; background: transparent; border: 1px solid transparent; border-radius: 3px; margin: 1px; }\r
                                                        <button hflex="min" image="/img/ic_search_black_18dp.png" onClick="@command('doSearch')" />\r
                                                        <button dir="reverse" image="/img/baseline_expand_more_black_18dp.png" popup="searchSettings, after_start" iconSclass="caret">\r
                                                        </button>\r
-                                                       <menupopup id="searchSettings">\r
+                                                       <menupopup id="searchSettings" >\r
                                                                <menuitem label="10 találat oldalanként" value="10" checked="true" onClick="@command('setPageSize', source=self)" />\r
                                                                <menuitem label="25 találat oldalanként" value="25" checked="true" onClick="@command('setPageSize', source=self)" />\r
                                                                <menuitem label="50 találat oldalanként" value="50" checked="true" onClick="@command('setPageSize', source=self)" />\r
                                                <grid id="itemsGrid" sizedByContent="false" span="true" vflex="true" hflex="true" mold="paging" autopaging="false"\r
                                                        model="@load(vm.searchResult)" emptyMessage="Nincs találat!" pageSize="50" onAfterRender="@command('onAfterRenderGrid')"\r
                                                        style="border: none; background: white !important;" oddRowSclass="listbox-odd-style">\r
-                                                       <columns>\r
+                                                       <columns id="orderColumns">\r
                                                                <column hflex="min">\r
                                                                        <checkbox checked="@bind(vm.rowsExpanded)" />\r
                                                                </column>\r
                                                                <column hflex="min">\r
                                                                        <checkbox checked="@bind(vm.allSelected)" />\r
                                                                </column>\r
-                                                               <column label="ID" sort="auto" hflex="1" align="left" />\r
-                                                               <column label="Cím" sort="auto" hflex="2" align="left" />\r
+                                                               <column label="ID" sort="auto" hflex="1" align="left"/>\r
+                                                               <column label="Cím" sort="auto" hflex="2" align="left"/>\r
                                                                <column label="Fájlnév" sort="auto" hflex="5" align="left" />\r
                                                                <column label="Hossz" sort="auto" hflex="2" align="right" />\r
                                                                <!--                                                            <column width="20px" align="right" style="cursor: pointer" popup="sortOther" /> -->\r
                                                                                                        onClick="@command('selectMediaArchive', selectedObject=each)" />\r
                                                                                                <div sclass="details">\r
                                                                                                        <hlayout>\r
-                                                                                                               <div class="RED100 type-inlist">\r
+                                                                                                               <div class="${c:cat(vm.typeFilters[each.media.itemType.name].color,' type-inlist')}">\r
                                                                                                                        <label style="font-size: 10px;" value="@load(each.media.itemType.name)" />\r
                                                                                                                </div>\r
                                                                                                                <label style="font:20px Century Gothic; color:#008AC8;" value="@load(each.item.title)" />\r
                        </west>\r
                        <!-- media player -->\r
                        <center border="none">\r
-\r
                                <borderlayout height="100%" width="100%">\r
-\r
                                        <north border="none" size="60%" splittable="true" minsize="250" collapsible="true">\r
                                                <div align="center" height="100%" width="100%">\r
                                                        <iframe id="mediaPlayer" height="100%" width="100%" autohide="false" src="@load(vm.lowresMediaFilePath)"></iframe>\r
index 36579eddb62005fd60ac7805564829bfb629f5a8..155790d0d9b2b969bb974bedd3618bb120a87c67 100644 (file)
@@ -1,11 +1,9 @@
 package user.jobengine.zk.model;\r
 \r
-import java.awt.Toolkit;\r
-import java.awt.datatransfer.Clipboard;\r
-import java.awt.datatransfer.StringSelection;\r
 import java.net.URL;\r
 import java.nio.file.Paths;\r
 import java.util.ArrayList;\r
+import java.util.HashMap;\r
 import java.util.LinkedHashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
@@ -52,12 +50,13 @@ import user.commons.StoreUri;
 import user.commons.remotestore.RemoteStoreProtocol;\r
 import user.jobengine.db.ArchivedMedia;\r
 import user.jobengine.db.IItemManager;\r
-import user.jobengine.db.ItemManager;\r
 import user.jobengine.db.MediaFile;\r
 import user.jobengine.db.Store;\r
 import user.jobengine.zk.util.SessionUtil;\r
 \r
 public class SearchModel extends AsyncBaseModel {\r
+\r
+       private static final String GENERIC_ORIGINAL = "Generic";\r
        private static final String ARG = "arg";\r
        private static final String MEDIA_ID = "showMediaID";\r
        private static final String GENERIC = "Egyéb";\r
@@ -94,23 +93,23 @@ public class SearchModel extends AsyncBaseModel {
        Button backToVideoButton;\r
        @Wire\r
        Combobox search;\r
+\r
        @Wire\r
        Menupopup searchSettings;\r
        @Wire\r
        Div mediaDetails;\r
-\r
        private String orderBy;\r
-       private boolean orderAscending;\r
 \r
+       private boolean orderAscending;\r
        private Map<String, String> topColorClasses;\r
        private int selectedRowIndex = -1;\r
        private volatile boolean preventAfterRender;\r
        private int positionToScroll = -1;\r
        private ListModelList<String> searchHistory;\r
 \r
-       public SearchModel() {\r
-               this.itemManager = ItemManager.getInstance();\r
+       private Map<String, String> columnOrder;\r
 \r
+       public SearchModel() {\r
                typeFilters = new LinkedHashMap<>();\r
                addTypeFilter(TypeFilter.as(NEWS_MATERIAL, "RED200", "ic_language_black_18dp.png"));\r
                addTypeFilter(TypeFilter.as(RAW_NEWS_MATERIAL, "RED100", "ic_perm_camera_mic_black_18dp.png"));\r
@@ -122,6 +121,7 @@ public class SearchModel extends AsyncBaseModel {
                addTypeFilter(TypeFilter.as(RAW_AD, "BLUE100", "ic_settings_brightness_black_18dp.png"));\r
                addTypeFilter(TypeFilter.as(RECORDING, "BROWN100", "ic_group_work_black_18dp.png"));\r
                addTypeFilter(TypeFilter.as(GENERIC, "YELLOW200", "ic_view_quilt_black_18dp.png"));\r
+               addTypeFilter(TypeFilter.as(GENERIC_ORIGINAL, "YELLOW200", "ic_view_quilt_black_18dp.png"));\r
                topTypeFilterNames = new String[] { NEWS_MATERIAL, RAW_NEWS_MATERIAL, RECORDING, GENERIC };\r
                bottomTypeFilterNames = new String[] { MATERIAL, RAW_MATERIAL, PROMO, RAW_PROMO, AD, RAW_AD };\r
 \r
@@ -161,6 +161,10 @@ public class SearchModel extends AsyncBaseModel {
                                }\r
                        }\r
                };\r
+\r
+               searchHistory = new ListModelList<>(SessionUtil.getUserSearchHistory());\r
+               setColumnOrder();\r
+               setUserSelectedFilters();\r
        }\r
 \r
        private void addTypeFilter(TypeFilter typeFilter) {\r
@@ -173,10 +177,16 @@ public class SearchModel extends AsyncBaseModel {
                Selectors.wireEventListeners(view, this);\r
                configureSearchResultGrid();\r
                showExternalMediaID();\r
-\r
                searchHistory = new ListModelList<>(SessionUtil.getUserSearchHistory());\r
+               if (SessionUtil.getUserPageSize() != 0)\r
+                       itemsGrid.setPageSize(SessionUtil.getUserPageSize());\r
                setSettingsPageSize(itemsGrid.getPageSize());\r
-               //TODO rendezés\r
+       }\r
+\r
+       private void clearAllFilters() {\r
+               for (String filter : typeFilters.keySet()) {\r
+                       typeFilters.get(filter).setChecked(false);\r
+               }\r
        }\r
 \r
        @Command\r
@@ -192,6 +202,9 @@ public class SearchModel extends AsyncBaseModel {
 \r
                for (Component child : itemsGrid.getColumns().getChildren()) {\r
                        Column column = (Column) child;\r
+                       if (columnOrder != null)\r
+                               if (column.getLabel().equals(columnOrder.entrySet().iterator().next().getKey()))\r
+                                       column.setSortDirection(columnOrder.entrySet().iterator().next().getValue());\r
                        column.addEventListener("onSort", evt -> doSort(evt));\r
                }\r
        }\r
@@ -202,11 +215,11 @@ public class SearchModel extends AsyncBaseModel {
                String baseURL = Executions.getCurrent().getScheme() + "://" + Executions.getCurrent().getServerName() + port\r
                                + Executions.getCurrent().getContextPath();\r
                String url = String.format("%s/?%s=%d", baseURL, MEDIA_ID, selectedObject.getMedia().getId());\r
-               Toolkit toolkit = Toolkit.getDefaultToolkit();\r
-               Clipboard clipboard = toolkit.getSystemClipboard();\r
-               StringSelection strSel = new StringSelection(url);\r
-               clipboard.setContents(strSel, null);\r
                String email = String.format("mailto:?subject=Média címe: %s &body=A média itt tekinthető meg: %s", selectedObject.getMedia().getTitle(), url);\r
+               // Toolkit toolkit = Toolkit.getDefaultToolkit();\r
+               // Clipboard clipboard = toolkit.getSystemClipboard();\r
+               // StringSelection strSel = new StringSelection(url);\r
+               // clipboard.setContents(strSel, null);\r
                // Messagebox.show("A médiához szükséges URL a vágólapra másolva, az URL a következő:\n" + email, "", Messagebox.OK, Messagebox.NONE);\r
                Executions.getCurrent().sendRedirect(email);\r
        }\r
@@ -215,7 +228,6 @@ public class SearchModel extends AsyncBaseModel {
        @NotifyChange({ "searchResult", "selectedObject", "hasTSMMediaFile", "hasLowresMediaFile", "lowresMediaFilePath" })\r
        public void doSearch() {\r
                try {\r
-\r
                        searchResult = null;\r
                        itemsGrid.setActivePage(0);\r
                        searchValue = search.getText();\r
@@ -224,13 +236,21 @@ public class SearchModel extends AsyncBaseModel {
                                throw new Exception("Legalább 3 karakter megadása kötelező!");\r
 \r
                        List<String> searchFilters = getSelectedFilters();\r
+                       if (SessionUtil.getUserColumnOrder() != null) {\r
+                               orderBy = columnHeaders.get(columnOrder.entrySet().iterator().next().getKey());\r
+                               orderAscending = columnOrder.entrySet().iterator().next().getValue().equals("ascending");\r
+                       }\r
+\r
                        searchResult = new CachedListModel(searchValue, searchFilters, orderBy, orderAscending);\r
+                       setSelectedObject(null);\r
 \r
                        if (!searchHistory.contains(searchValue)) {\r
                                searchHistory.add(0, searchValue);\r
                                SessionUtil.putUserSearchHistory(searchHistory);\r
                        }\r
 \r
+                       SessionUtil.putUserSearchFilter(searchFilters);\r
+\r
                } catch (Exception e) {\r
                        Messagebox.show(e.getMessage(), "Hiba", Messagebox.OK, Messagebox.ERROR);\r
                        logger.catching(e);\r
@@ -244,11 +264,14 @@ public class SearchModel extends AsyncBaseModel {
                column.setSortDirection(evt.isAscending() ? "ascending" : "descending");\r
                logger.info("{} {}", column.getLabel(), evt.isAscending());\r
 \r
+               columnOrder = new HashMap<>();\r
+               columnOrder.put(column.getLabel(), column.getSortDirection());\r
+               SessionUtil.putUserColumnOrder(columnOrder);\r
+\r
                orderBy = columnHeaders.get(column.getLabel());\r
                orderAscending = evt.isAscending();\r
                doSearch();\r
                notifyChange("searchResult", "selectedObject", "hasLowresMediaFile", "lowresMediaFilePath");\r
-\r
                evt.stopPropagation();\r
        }\r
 \r
@@ -442,6 +465,7 @@ public class SearchModel extends AsyncBaseModel {
                        return;\r
                preventAfterRender = true;\r
                logger.info("onAfterRenderGrid");\r
+\r
                if (positionToScroll != -1) {\r
                        ensureVisible(positionToScroll);\r
                } else\r
@@ -480,7 +504,6 @@ public class SearchModel extends AsyncBaseModel {
                setSelectedObject(selectedObject);\r
                highlight(this.selectedObject, true);\r
                Clients.scrollIntoView(mediaDetails.getFirstChild());\r
-\r
                logger.info("Media was selected. Selected media archive:{}", selectedObject.getMedia().getId());\r
        }\r
 \r
@@ -515,6 +538,14 @@ public class SearchModel extends AsyncBaseModel {
 \r
        }\r
 \r
+       private void setColumnOrder() {\r
+               if (SessionUtil.getUserColumnOrder() != null) {\r
+                       columnOrder = new HashMap<>();\r
+                       columnOrder.put(SessionUtil.getUserColumnOrder().entrySet().iterator().next().getKey(),\r
+                                       (String) SessionUtil.getUserColumnOrder().entrySet().iterator().next().getValue());\r
+               }\r
+       }\r
+\r
        public void setItemSelected(boolean itemSelected) {\r
                this.itemSelected = itemSelected;\r
        }\r
@@ -531,6 +562,7 @@ public class SearchModel extends AsyncBaseModel {
                setSettingsPageSize(pageSize);\r
                itemsGrid.setPageSize(pageSize);\r
                itemsGrid.setActivePage(0);\r
+               SessionUtil.putUserPageSize(pageSize);\r
        }\r
 \r
        public void setRowsExpanded(boolean rowsExpanded) {\r
@@ -543,11 +575,11 @@ public class SearchModel extends AsyncBaseModel {
 \r
        @NotifyChange({ "selectedObject", "hasLowresMediaFile", "hasTSMMediaFile", "lowresMediaFilePath" })\r
        public void setSelectedObject(ArchivedMedia selectedObject) {\r
+               this.selectedObject = selectedObject;\r
                if (selectedObject != null) {\r
                        selectedObject.setMedia(itemManager.getMedia(selectedObject.getMedia().getId()));\r
                        selectedObject.setItem(itemManager.getItem(selectedObject.getMedia().getItemId()));\r
                }\r
-               this.selectedObject = selectedObject;\r
        }\r
 \r
        private void setSettingsPageSize(int pageSize) {\r
@@ -564,6 +596,22 @@ public class SearchModel extends AsyncBaseModel {
                }\r
        }\r
 \r
+       private void setUserSelectedFilters() {\r
+               List<String> selectedFilters = SessionUtil.getUserSearchFilter();\r
+               if (selectedFilters != null) {\r
+                       clearAllFilters();\r
+                       for (String filter : selectedFilters) {\r
+                               if (typeFilters.containsKey(filter)) {\r
+                                       TypeFilter typeFilter = typeFilters.get(filter);\r
+                                       typeFilter.setChecked(true);\r
+                                       typeFilters.put(filter, typeFilter);\r
+                               }\r
+                       }\r
+                       if (typeFilters.size() != selectedFilters.size())\r
+                               allChecked = false;\r
+               }\r
+       }\r
+\r
        private void showExternalMediaID() {\r
                String mediaID = SessionUtil.getQueryParameter(MEDIA_ID);\r
                if (mediaID != null)\r
index 6b9ec0cbd79d17d7986163e31e0e6cc65a010631..32a96217af0d32217fe420ea6c153a784839b927 100644 (file)
@@ -28,6 +28,9 @@ import user.jobengine.server.JobEngine;
 import user.jobengine.zk.model.IndexModel;\r
 \r
 public class SessionUtil {\r
+       private static final String SEARCH_FILTER = "searchFilter";\r
+       private static final String COLUMN_ORDERS = "columnOrders";\r
+       private static final String PAGE_SIZE = "pageSize";\r
        private static final String SEARCH_HISTORY = "searchHistory";\r
        private static final String USER_NAME = "userName";\r
        private static final String USER_SETTINGS = "userSettings";\r
@@ -61,8 +64,8 @@ public class SessionUtil {
                        JobEngine.getInstance().removeJobChangedEventListener(listener);\r
                        setAttribute(SessionUtil.JOBLISTENER, null);\r
                }\r
-               //setAttribute(SessionUtil.MENUMODEL, null);\r
-               //setAttribute(SessionUtil.USERPRINCIPAL, null);\r
+               // setAttribute(SessionUtil.MENUMODEL, null);\r
+               // setAttribute(SessionUtil.USERPRINCIPAL, null);\r
        }\r
 \r
        static public void dumpQueryString() {\r
@@ -71,7 +74,7 @@ public class SessionUtil {
        }\r
 \r
        static public Object getAttribute(String name) {\r
-               //HttpSession session = (HttpSession) (Executions.getCurrent()).getDesktop().getSession().getNativeSession();\r
+               // HttpSession session = (HttpSession) (Executions.getCurrent()).getDesktop().getSession().getNativeSession();\r
                Session zkSession = Sessions.getCurrent();\r
                if (zkSession == null)\r
                        return null;\r
@@ -132,10 +135,25 @@ public class SessionUtil {
                return result;\r
        }\r
 \r
+       public static Map<String, Object> getUserColumnOrder() {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               return (Map<String, Object>) userSettings.get(COLUMN_ORDERS);\r
+       }\r
+\r
+       public static int getUserPageSize() {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               return userSettings.get(PAGE_SIZE) == null ? 0 : (int) userSettings.get(PAGE_SIZE);\r
+       }\r
+\r
        static public UserPrincipal getUserPrincipal() {\r
                return (UserPrincipal) getAttribute(USERPRINCIPAL);\r
        }\r
 \r
+       public static List<String> getUserSearchFilter() {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               return (List<String>) userSettings.get(SEARCH_FILTER);\r
+       }\r
+\r
        public static List<String> getUserSearchHistory() {\r
                BasicDBObject userSettings = getUserSettings();\r
                BasicDBList history = (BasicDBList) userSettings.get(SEARCH_HISTORY);\r
@@ -220,6 +238,30 @@ public class SessionUtil {
                history.add(new BasicDBObject("action", action).append("query", query));\r
        }\r
 \r
+       public static void putUserColumnOrder(Map<String, String> columnOrder) {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               userSettings.put(COLUMN_ORDERS, columnOrder);\r
+               putUserSettings();\r
+       }\r
+\r
+       public static void putUserPageSize(int size) {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               userSettings.put(PAGE_SIZE, size);\r
+               putUserSettings();\r
+       }\r
+\r
+       public static void putUserSearchFilter(List<String> searchFilter) {\r
+               BasicDBObject userSettings = getUserSettings();\r
+               if (searchFilter != null) {\r
+                       BasicDBList filter = new BasicDBList();\r
+                       filter.addAll(searchFilter);\r
+                       userSettings.put(SEARCH_FILTER, filter);\r
+               } else\r
+                       userSettings.put(SEARCH_FILTER, null);\r
+\r
+               putUserSettings();\r
+       }\r
+\r
        public static void putUserSearchHistory(List<String> searchHistory) {\r
                BasicDBObject userSettings = getUserSettings();\r
                BasicDBList history = new BasicDBList();\r
@@ -246,7 +288,7 @@ public class SessionUtil {
        }\r
 \r
        static public void setAttribute(String name, Object obj) {\r
-               //HttpSession session = (HttpSession) (Executions.getCurrent()).getDesktop().getSession().getNativeSession();\r
+               // HttpSession session = (HttpSession) (Executions.getCurrent()).getDesktop().getSession().getNativeSession();\r
                Session zkSession = Sessions.getCurrent();\r
                if (zkSession == null)\r
                        return;\r