diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/IndexingForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/IndexingForm.java index 34e883ea90d..082071e8073 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/IndexingForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/IndexingForm.java @@ -11,8 +11,8 @@ package org.kitodo.production.forms; -import java.io.IOException; import java.time.LocalDateTime; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -25,16 +25,8 @@ import javax.json.JsonArray; import javax.json.JsonArrayBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.kitodo.data.database.exceptions.DAOException; -import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; -import org.kitodo.data.exceptions.DataException; import org.kitodo.production.enums.IndexStates; import org.kitodo.production.enums.ObjectType; -import org.kitodo.production.helper.Helper; -import org.kitodo.production.services.ServiceManager; -import org.kitodo.production.services.index.IndexingService; import org.omnifaces.util.Ajax; @Named @@ -42,7 +34,6 @@ public class IndexingForm { private static final List objectTypes = ObjectType.getIndexableObjectTypes(); - private static final Logger logger = LogManager.getLogger(IndexingForm.class); private static final String POLLING_CHANNEL_NAME = "togglePollingChannel"; private String indexingStartedUser = ""; private LocalDateTime indexingStartedTime = null; @@ -65,11 +56,7 @@ public String getIndexingStartedUser() { * click. */ public void countDatabaseObjects() { - try { - ServiceManager.getIndexingService().countDatabaseObjects(); - } catch (DAOException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - } + throw new UnsupportedOperationException("currently not implemented"); } /** @@ -87,7 +74,7 @@ public LocalDateTime getIndexingStartedTime() { * @return value of countDatabaseObjects */ public Map getCountDatabaseObjects() { - return ServiceManager.getIndexingService().getCountDatabaseObjects(); + return Collections.emptyMap(); } /** @@ -96,7 +83,7 @@ public Map getCountDatabaseObjects() { * @return long number of all items that can be written to the index */ public long getTotalCount() { - return ServiceManager.getIndexingService().getTotalCount(); + return 0; } /** @@ -108,12 +95,7 @@ public long getTotalCount() { * @return number of indexed objects */ public long getNumberOfIndexedObjects(ObjectType objectType) { - try { - return ServiceManager.getIndexingService().getNumberOfIndexedObjects(objectType); - } catch (DataException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - return 0; - } + return 0; } /** @@ -123,12 +105,7 @@ public long getNumberOfIndexedObjects(ObjectType objectType) { * @return long number of all currently indexed objects */ public long getAllIndexed() { - try { - return ServiceManager.getIndexingService().getAllIndexed(); - } catch (DataException | ArithmeticException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - return 0; - } + return 0; } /** @@ -138,13 +115,7 @@ public long getAllIndexed() { * type objects that get indexed */ public void callIndexing(ObjectType type) { - indexingStartedTime = LocalDateTime.now(); - indexingStartedUser = ServiceManager.getUserService().getAuthenticatedUser().getFullName(); - try { - ServiceManager.getIndexingService().startIndexing(pollingChannel, type); - } catch (IllegalStateException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - } + throw new UnsupportedOperationException("currently not implemented"); } /** @@ -154,29 +125,21 @@ public void callIndexing(ObjectType type) { * type objects that get indexed */ public void callIndexingRemaining(ObjectType type) { - indexingStartedTime = LocalDateTime.now(); - indexingStartedUser = ServiceManager.getUserService().getAuthenticatedUser().getFullName(); - try { - ServiceManager.getIndexingService().startIndexingRemaining(pollingChannel, type); - } catch (IllegalStateException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - } + throw new UnsupportedOperationException("currently not implemented"); } /** * Starts the process of indexing all objects to the ElasticSearch index. */ public void startAllIndexing() { - indexingStartedTime = LocalDateTime.now(); - indexingStartedUser = ServiceManager.getUserService().getAuthenticatedUser().getFullName(); - ServiceManager.getIndexingService().startAllIndexing(pollingChannel); + throw new UnsupportedOperationException("currently not implemented"); } /** * Starts the process of indexing all objects to the ElasticSearch index. */ public void startAllIndexingRemaining() { - ServiceManager.getIndexingService().startAllIndexingRemaining(pollingChannel); + throw new UnsupportedOperationException("currently not implemented"); } /** @@ -196,7 +159,7 @@ public int getAllIndexingProgress() { * progress or not */ public boolean indexingInProgress() { - return ServiceManager.getIndexingService().indexingInProgress(); + return false; } /** @@ -208,30 +171,14 @@ public boolean indexingInProgress() { * or not. */ public void createMapping(boolean updatePollingChannel) { - try { - if (updatePollingChannel) { - pollingChannel.send(IndexingService.MAPPING_STARTED_MESSAGE); - } - String mappingStateMessage = ServiceManager.getIndexingService().createMapping(); - if (updatePollingChannel) { - pollingChannel.send(mappingStateMessage); - } - } catch (IOException | CustomResponseException e) { - ServiceManager.getIndexingService().setIndexState(IndexStates.CREATING_MAPPING_FAILED); - if (updatePollingChannel) { - pollingChannel.send(IndexingService.MAPPING_FAILED_MESSAGE); - } - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - } + throw new UnsupportedOperationException("currently not implemented"); } /** * Delete whole ElasticSearch index. */ public void deleteIndex() { - pollingChannel.send(IndexingService.DELETION_STARTED_MESSAGE); - String updateMessage = ServiceManager.getIndexingService().deleteIndex(); - pollingChannel.send(updateMessage); + throw new UnsupportedOperationException("currently not implemented"); } /** @@ -241,12 +188,7 @@ public void deleteIndex() { * @return String information about the server */ public String getServerInformation() { - try { - return ServiceManager.getIndexingService().getServerInformation(); - } catch (IOException e) { - Helper.setErrorMessage("elasticSearchNotRunning", logger, e); - return ""; - } + return ""; } /** @@ -258,12 +200,7 @@ public String getServerInformation() { * @return the progress of the current indexing process in percent */ public int getProgress(ObjectType currentType) { - try { - return ServiceManager.getIndexingService().getProgress(currentType, pollingChannel); - } catch (DataException e) { - Helper.setErrorMessage(e.getLocalizedMessage(), logger, e); - return 0; - } + return 0; } /** @@ -272,7 +209,7 @@ public int getProgress(ObjectType currentType) { * @return true if mapping is empty, otherwise false */ public boolean isMappingEmpty() { - return ServiceManager.getIndexingService().isMappingEmpty(); + return false; } /** @@ -281,11 +218,7 @@ public boolean isMappingEmpty() { * @return whether the Elastic Search index exists or not */ public boolean indexExists() { - try { - return ServiceManager.getIndexingService().indexExists(); - } catch (IOException | CustomResponseException ignored) { - return false; - } + return false; } /** @@ -296,7 +229,7 @@ public boolean indexExists() { * @return state of ES index */ public IndexStates getIndexState() { - return ServiceManager.getIndexingService().getIndexState(); + return IndexStates.NO_STATE; } /** @@ -308,7 +241,7 @@ public IndexStates getIndexState() { * @return indexing state of the given object type. */ public IndexStates getObjectIndexState(ObjectType objectType) { - return ServiceManager.getIndexingService().getObjectIndexState(objectType); + return IndexStates.NO_STATE; } /** @@ -320,7 +253,7 @@ public IndexStates getObjectIndexState(ObjectType objectType) { * @return static variable for global indexing state */ public IndexStates getAllObjectsIndexingState() { - return ServiceManager.getIndexingService().getAllObjectsIndexingState(); + return IndexStates.NO_STATE; } /** @@ -359,20 +292,13 @@ public ObjectType getNoneType() { * Update the view. */ public void updateView() { - try { - if (ServiceManager.getIndexingService().isIndexCorrupted()) { - Helper.setErrorMessage("indexOutOfDate"); - } - Ajax.update("@all"); - } catch (DataException | DAOException e) { - Helper.setErrorMessage(e.getMessage()); - } + Ajax.update("@all"); } /** * Cancel indexing upon user request. */ public void cancelIndexing() { - ServiceManager.getIndexingService().cancelIndexing(); + throw new UnsupportedOperationException("currently not implemented"); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java b/Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java index 32aab0b3fee..6ad7026791b 100644 --- a/Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java +++ b/Kitodo/src/main/java/org/kitodo/production/forms/LoginForm.java @@ -20,6 +20,9 @@ import javax.faces.context.FacesContext; import javax.inject.Named; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.kitodo.data.database.beans.Client; import org.kitodo.data.database.beans.User; import org.kitodo.data.database.exceptions.DAOException; import org.kitodo.data.exceptions.DataException; @@ -32,9 +35,9 @@ @Named("LoginForm") @SessionScoped public class LoginForm implements Serializable { + private static final Logger logger = LogManager.getLogger(LoginForm.class); private User loggedUser; private boolean firstVisit = true; - private static final String INDEXING_PAGE = "system.jsf?tabIndex="; private static final String DESKTOP_VIEW = "desktop.jsf"; private final SecurityAccessService securityAccessService = ServiceManager.getSecurityAccessService(); @@ -99,26 +102,12 @@ public void performPostLoginChecks() throws DataException, DAOException, IOExcep ExternalContext context = FacesContext.getCurrentInstance().getExternalContext(); SessionClientController controller = new SessionClientController(); - PrimeFaces.current().executeScript("PF('indexWarningDialog').hide();"); - if (ServiceManager.getSecurityAccessService().hasAuthorityToEditIndex()) { - if (controller.getAvailableClientsOfCurrentUser().size() > 1 - && Objects.isNull(controller.getCurrentSessionClient())) { - controller.showClientSelectDialog(); - } else if (ServiceManager.getIndexingService().isIndexCorrupted()) { - context.redirect(INDEXING_PAGE + determineIndexingTab()); - } else { - redirect(context); - } + if (controller.getAvailableClientsOfCurrentUser().size() > 1 + && Objects.isNull(controller.getCurrentSessionClient())) { + controller.showClientSelectDialog(); } else { - if (ServiceManager.getIndexingService().isIndexCorrupted()) { - PrimeFaces.current().executeScript("PF('indexWarningDialog').show();"); - } else if (controller.getAvailableClientsOfCurrentUser().size() > 1 - && Objects.isNull(controller.getCurrentSessionClient())) { - controller.showClientSelectDialog(); - } else { - redirect(context); - } + redirect(context); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/security/CustomLoginSuccessHandler.java b/Kitodo/src/main/java/org/kitodo/production/security/CustomLoginSuccessHandler.java index c8f8dfbf6e3..3e85052c03c 100644 --- a/Kitodo/src/main/java/org/kitodo/production/security/CustomLoginSuccessHandler.java +++ b/Kitodo/src/main/java/org/kitodo/production/security/CustomLoginSuccessHandler.java @@ -45,22 +45,17 @@ public class CustomLoginSuccessHandler implements AuthenticationSuccessHandler { public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException { - try { - SessionClientController controller = new SessionClientController(); - if (ServiceManager.getIndexingService().isIndexCorrupted() - || controller.getAvailableClientsOfCurrentUser().size() > 1) { - // redirect to empty landing page, where dialogs are displayed depending on both checks! - redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, EMPTY_LANDING_PAGE); - } else { - if (Objects.nonNull(httpServletRequest.getSession())) { - // calling showClientSelectDialog automatically sets the only one available client here - controller.showClientSelectDialog(); - redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, - getOriginalRequest(httpServletRequest.getSession().getAttribute(SAVED_REQUEST))); - } + SessionClientController controller = new SessionClientController(); + if (controller.getAvailableClientsOfCurrentUser().size() > 1) { + // redirect to empty landing page, where dialogs are displayed depending on both checks! + redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, EMPTY_LANDING_PAGE); + } else { + if (Objects.nonNull(httpServletRequest.getSession())) { + // calling showClientSelectDialog automatically sets the only one available client here + controller.showClientSelectDialog(); + redirectStrategy.sendRedirect(httpServletRequest, httpServletResponse, + getOriginalRequest(httpServletRequest.getSession().getAttribute(SAVED_REQUEST))); } - } catch (DataException | DAOException e) { - logger.error(e.getLocalizedMessage()); } } diff --git a/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java b/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java index 547614e0f51..134e83f8290 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/index/IndexingService.java @@ -182,11 +182,6 @@ public Map getCountDatabaseObjects() { return countDatabaseObjects; } - public boolean isIndexCorrupted() throws DAOException, DataException { - updateCounts(); - return getTotalCount() != getAllIndexed(); - } - /** * Return the number of all objects processed during the current indexing * progress. diff --git a/Kitodo/src/main/resources/messages/messages_de.properties b/Kitodo/src/main/resources/messages/messages_de.properties index 90d592319a5..41552d09a55 100644 --- a/Kitodo/src/main/resources/messages/messages_de.properties +++ b/Kitodo/src/main/resources/messages/messages_de.properties @@ -651,7 +651,6 @@ imprint=Impressum imprintDefaultText=Das Impressum f\u00FCr dieses System wurde noch nicht hinterlegt. indexedEntries=Indexierte Eintr\u00E4ge indexing=Indexierung -indexOutOfDate=Der Index muss aktualisiert werden! insert=Einf\u00FCgen insertAsUncounted=Als unnummeriert einf\u00FCgen insertHere=hier einf\u00FCgen @@ -1093,12 +1092,6 @@ structuralElement=Strukturelement structureElementAdd=Strukturelement hinzuf\u00FCgen structureElementDelete=Strukturelement l\u00F6schen system=System -systemComeBackLaterMessage=Bitte versuchen Sie es sp\u00E4ter erneut! -systemErrorHeader=Systemfehler -systemErrorInformAdminMessage=Bitte informieren Sie einen Administrator! -systemErrorMessage=Es ist ein Fehler im System aufgetreten. -systemMaintenanceHeader=Systemwartung -systemMaintenanceMessage=Das System wird derzeit gewartet. table=Tabelle tableSize=Tabellengr\u00F6\u00DFe task=Aufgabe diff --git a/Kitodo/src/main/resources/messages/messages_en.properties b/Kitodo/src/main/resources/messages/messages_en.properties index a12c156c25f..2a8d58a3c7c 100644 --- a/Kitodo/src/main/resources/messages/messages_en.properties +++ b/Kitodo/src/main/resources/messages/messages_en.properties @@ -652,7 +652,6 @@ imprint=Imprint imprintDefaultText=Imprint information have not been configured for this system. indexedEntries=Indexed entries indexing=Indexing -indexOutOfDate=The search index needs to be updated! insert=Insert insertAsUncounted=Insert as uncounted insertHere=insert here @@ -1094,12 +1093,6 @@ structuralElement=Structural element structureElementAdd=Add docstruct structureElementDelete=Delete docstruct system=System -systemComeBackLaterMessage=Please try again later! -systemErrorHeader=System error -systemErrorInformAdminMessage=Please inform an administrator! -systemErrorMessage=A system error occurred. -systemMaintenanceHeader=System maintenance -systemMaintenanceMessage=The system is currently under maintenance. table=Table tableSize=Table size task=Task diff --git a/Kitodo/src/main/resources/messages/messages_es.properties b/Kitodo/src/main/resources/messages/messages_es.properties index 0effd29d4bc..bde18535888 100644 --- a/Kitodo/src/main/resources/messages/messages_es.properties +++ b/Kitodo/src/main/resources/messages/messages_es.properties @@ -645,7 +645,6 @@ imprint=Pie de imprenta imprintDefaultText=La huella de este sistema aún no se ha almacenado. indexedEntries=Entradas indexadas indexing=Indexación -indexOutOfDate=Hay que actualizar el índice. insert=Insertar insertAsUncounted=Insertar como no numerado insertHere=Insertar aquí @@ -1079,12 +1078,6 @@ structuralElement=Elemento de la estructura structureElementAdd=Añadir elemento estructural structureElementDelete=Borrar el elemento estructural system=Sistema -systemComeBackLaterMessage=Por favor, inténtelo más tarde. -systemErrorHeader=Error del sistema -systemErrorInformAdminMessage=Por favor, informe a un administrador. -systemErrorMessage=Se ha producido un error en el sistema. -systemMaintenanceHeader=Mantenimiento del sistema -systemMaintenanceMessage=El sistema se encuentra actualmente en fase de mantenimiento. table=Tabla tableSize=Tamaño de la tabla task=Tarea diff --git a/Kitodo/src/main/webapp/WEB-INF/templates/includes/base/indexWarningDialog.xhtml b/Kitodo/src/main/webapp/WEB-INF/templates/includes/base/indexWarningDialog.xhtml deleted file mode 100644 index ad3307d63db..00000000000 --- a/Kitodo/src/main/webapp/WEB-INF/templates/includes/base/indexWarningDialog.xhtml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - -

#{msgs.systemMaintenanceHeader}

-
- #{msgs.systemMaintenanceMessage}
- #{msgs.systemComeBackLaterMessage} -
-
- -

#{msgs.systemErrorHeader}

-
- #{msgs.systemErrorMessage}
- #{msgs.systemErrorInformAdminMessage} -
-
-
- - - - - - - - - - - -
-
diff --git a/Kitodo/src/main/webapp/pages/checks.xhtml b/Kitodo/src/main/webapp/pages/checks.xhtml index ad043f715cf..63b22e67e28 100644 --- a/Kitodo/src/main/webapp/pages/checks.xhtml +++ b/Kitodo/src/main/webapp/pages/checks.xhtml @@ -27,7 +27,6 @@ - diff --git a/Kitodo/src/test/java/org/kitodo/production/forms/IndexingFormIT.java b/Kitodo/src/test/java/org/kitodo/production/forms/IndexingFormIT.java index 14fbec25d0c..ec142b5b1e6 100644 --- a/Kitodo/src/test/java/org/kitodo/production/forms/IndexingFormIT.java +++ b/Kitodo/src/test/java/org/kitodo/production/forms/IndexingFormIT.java @@ -55,6 +55,7 @@ public static void tearDown() throws Exception { } @Test + @Ignore("currently not implemented") public void shouldCreateMapping() { Assert.assertFalse(indexingForm.indexExists()); indexingForm.createMapping(false); diff --git a/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java b/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java deleted file mode 100644 index d3d27b7b836..00000000000 --- a/Kitodo/src/test/java/org/kitodo/selenium/LoginST.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (c) Kitodo. Key to digital objects e. V. - * - * This file is part of the Kitodo project. - * - * It is licensed under GNU General Public License version 3 or later. - * - * For the full copyright and license information, please read the - * GPL3-License.txt file that was distributed with this source code. - */ - -package org.kitodo.selenium; - -import org.junit.Assert; -import org.junit.BeforeClass; -import org.junit.Test; -import org.kitodo.data.elasticsearch.exceptions.CustomResponseException; -import org.kitodo.data.exceptions.DataException; -import org.kitodo.production.services.ServiceManager; -import org.kitodo.selenium.testframework.BaseTestSelenium; -import org.kitodo.selenium.testframework.Browser; -import org.kitodo.selenium.testframework.Pages; - -public class LoginST extends BaseTestSelenium { - - @BeforeClass - public static void manipulateIndex() throws DataException, CustomResponseException { - // remove one process from index but not from DB to provoke index warning - ServiceManager.getProcessService().removeFromIndex(1, true); - } - - @Test - public void indexWarningTest() throws Exception { - // log into Kitodo with non-admin user to be redirected to 'checks' page - Pages.getLoginPage().goTo().performLogin(ServiceManager.getUserService().getById(2)); - Assert.assertEquals("http://localhost:8080/kitodo/pages/checks.jsf", Browser.getCurrentUrl()); - Pages.getPostLoginChecksPage().logout(); - - // log into kitodo with admin user to be redirected to 'system' page - Pages.getLoginPage().goTo().performLoginAsAdmin(); - Assert.assertEquals("http://localhost:8080/kitodo/pages/system.jsf?tabIndex=2", Browser.getCurrentUrl()); - Pages.getTopNavigation().logout(); - } -}