Class MenuImportExportService

    • Constructor Detail

      • MenuImportExportService

        public MenuImportExportService()
    • Method Detail

      • exportMenu

        public FileFieldValue exportMenu​(EnumerationMapField menusForExport,
                                         java.lang.String groupId,
                                         FileField fileField)
                                  throws java.io.IOException
        Method which performs export of selected menu entries with their filters into xml file. Method finds all cases by provided ids, transform them into FilterImportExportList object and serialize them into xml file on path: storage/filterExport//filters.xml
        Specified by:
        exportMenu in interface IMenuImportExportService
        Parameters:
        menusForExport - - EnumerationMapField with Ids (delimited by ",") of menu entries as keys and identifier of menu they belong to as value
        groupId - case Id of active group
        Returns:
        FileFieldValue - file field value of active group file field used to store exported file
        Throws:
        java.io.IOException - - if file which contains exported menus cannot be created
      • importMenu

        public java.util.List<java.lang.String> importMenu​(java.util.List<Case> menuItemCases,
                                                           FileFieldValue ffv,
                                                           java.lang.String parentId)
                                                    throws java.io.IOException,
                                                           IllegalMenuFileException,
                                                           TransitionNotExecutableException
        Method which performs import of menus from uploaded xml file. Method firstly loads xml file from file field and validates it against xml schema for menusWithFilters located on path: menu_export_schema.xml. Then it calls import of filters provided in uploaded xml file. Method then deletes any Preference filter item cases of active group case with same menu identifier as any of the menus imported. If the file is correct, method creates new instance of Preference filter item cases for each menu entry by calling method "createMenuItemCase".
        Specified by:
        importMenu in interface IMenuImportExportService
        Parameters:
        menuItemCases - - list of Preference filter item cases in active group
        ffv - - file field from active group case containing uploaded xml file.
        parentId - - id of active group case
        Returns:
        List - list of values delimited by "," containing preferenceItem case Id, filter case Id, boolean value determining if Icon should be displayed
        Throws:
        java.io.IOException - - if imported file is not found
        IllegalMenuFileException - - if uploaded xml is not in correct xml format and invalidate against schema
        TransitionNotExecutableException
      • createMenuItemCase

        public java.lang.String createMenuItemCase​(java.lang.StringBuilder resultMessage,
                                                   MenuEntry item,
                                                   java.lang.String menuIdentifier,
                                                   java.lang.String parentId,
                                                   java.lang.String filterTaskId)
        Method which creates new Preference filter item case from imported menuEntry class. Before case creation method prepares allowed and banned roles data for the entry while performing checks for imported filter and role nets in engine.
        Specified by:
        createMenuItemCase in interface IMenuImportExportService
        Parameters:
        item - - imported MenuEntry item
        menuIdentifier - - Identifier of new imported menu.
        parentId - - id of active group case
        filterTaskId - - task id of imported filter belonging to men item case being created
        Returns:
        String - values delimited by "," containing case Id of newly created Preference filter item case, Id of its filter case, boolean value determining if Preference filter item case should display icon.
      • createXML

        @Transactional
        protected FileFieldValue createXML​(MenuAndFilters menuAndFilters,
                                           java.lang.String parentId,
                                           FileField fileField)
                                    throws java.io.IOException
        Throws:
        java.io.IOException