From 5e37c5e9da403b9c375664b9f7f2202d6584aecb Mon Sep 17 00:00:00 2001 From: car031 Date: Fri, 23 Aug 2024 11:01:32 +0200 Subject: [PATCH] wertwrt --- .../core/communication/SystemMessage.java | 4 +--- .../core/conversion/FormatConverterManager.java | 10 +++++----- .../java/com/logicaldoc/core/folder/Folder.java | 4 +--- .../core/searchengine/saved/SavedSearch.java | 4 +--- .../core/security/user/PasswordHistory.java | 4 +--- .../syndication/SyndicationStandardProperties.java | 10 ++++++---- .../src/main/java/com/logicaldoc/util/Context.java | 13 +++++++++++++ .../web/service/TemplateServiceImplTest.java | 2 +- 8 files changed, 29 insertions(+), 22 deletions(-) diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/communication/SystemMessage.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/communication/SystemMessage.java index 4fe24d1bf..d722de17a 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/communication/SystemMessage.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/communication/SystemMessage.java @@ -136,8 +136,6 @@ public boolean equals(Object obj) { if (getClass() != obj.getClass()) return false; SystemMessage other = (SystemMessage) obj; - if (status != other.status) - return false; - return true; + return status == other.status; } } \ No newline at end of file diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/conversion/FormatConverterManager.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/conversion/FormatConverterManager.java index aa1901c6f..224169192 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/conversion/FormatConverterManager.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/conversion/FormatConverterManager.java @@ -441,7 +441,7 @@ public FormatConverter getConverter(String inFileName, String outFileName) { return new NoConversionConverter(); String inOutkey = composeKey(inFileName, outFileName); - + List formatConverters = getConverters().get(inOutkey); if (formatConverters == null || formatConverters.isEmpty()) formatConverters = getConverters().get("*-pdf"); @@ -522,14 +522,14 @@ public synchronized void init() { if (!converters.isEmpty()) return; - // Acquire the 'ThumbnailBuilder' extensions of the core plugin + // Acquire the 'FormatConverter' extensions of the core plugin PluginRegistry registry = PluginRegistry.getInstance(); Collection exts = registry.getExtensions("logicaldoc-core", "FormatConverter"); for (Extension ext : exts) { String className = ext.getParameter("class").valueAsString(); - // Try to instantiate the builder + // Try to instantiate the converter Object converter; try { Class clazz = Class.forName(className); @@ -539,8 +539,8 @@ public synchronized void init() { "The specified converter %s doesn't implement FormatConverter interface", className)); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - log.error(e.getMessage(), e); - break; + log.warn(e.getMessage(), e); + continue; } FormatConverter cnvrt = (FormatConverter) converter; diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/folder/Folder.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/folder/Folder.java index bbfba7534..d0e6e31d5 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/folder/Folder.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/folder/Folder.java @@ -597,8 +597,6 @@ public boolean equals(Object obj) { return false; } else if (!name.equals(other.name)) return false; - if (parentId != other.parentId) - return false; - return true; + return parentId == other.parentId; } } \ No newline at end of file diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/searchengine/saved/SavedSearch.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/searchengine/saved/SavedSearch.java index dabc2e02f..a59cddab7 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/searchengine/saved/SavedSearch.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/searchengine/saved/SavedSearch.java @@ -138,8 +138,6 @@ public boolean equals(Object obj) { return false; } else if (!name.equals(other.name)) return false; - if (userId != other.userId) - return false; - return true; + return userId == other.userId; } } \ No newline at end of file diff --git a/logicaldoc-core/src/main/java/com/logicaldoc/core/security/user/PasswordHistory.java b/logicaldoc-core/src/main/java/com/logicaldoc/core/security/user/PasswordHistory.java index 46f1cc160..b5426804a 100644 --- a/logicaldoc-core/src/main/java/com/logicaldoc/core/security/user/PasswordHistory.java +++ b/logicaldoc-core/src/main/java/com/logicaldoc/core/security/user/PasswordHistory.java @@ -79,8 +79,6 @@ public boolean equals(Object obj) { return false; } else if (!password.equals(other.password)) return false; - if (userId != other.userId) - return false; - return true; + return userId == other.userId; } } \ No newline at end of file diff --git a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/syndication/SyndicationStandardProperties.java b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/syndication/SyndicationStandardProperties.java index 33702860f..3c01ec9b7 100644 --- a/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/syndication/SyndicationStandardProperties.java +++ b/logicaldoc-gui/src/main/java/com/logicaldoc/gui/frontend/client/impex/syndication/SyndicationStandardProperties.java @@ -26,6 +26,8 @@ * @since 8.1.2 */ public class SyndicationStandardProperties extends SyndicationDetailsTab { + private static final String NODISPLAY = "nodisplay"; + private static final String APIKEY = "apikey"; private static final String REPLICATECUSTOMID = "replicatecustomid"; @@ -98,16 +100,16 @@ private void refresh() { * and prevent it to auto-fill the username and password we really use. */ TextItem fakeUsername = ItemFactory.newTextItem("prevent_autofill", syndication.getUsername()); - fakeUsername.setCellStyle("nodisplay"); + fakeUsername.setCellStyle(NODISPLAY); TextItem hiddenPassword = ItemFactory.newTextItem("password_hidden", syndication.getPassword()); - hiddenPassword.setCellStyle("nodisplay"); + hiddenPassword.setCellStyle(NODISPLAY); hiddenPassword.addChangedHandler(changedHandler); FormItem password = ItemFactory.newSafePasswordItem(PASSWORD, I18N.message(PASSWORD), syndication.getPassword(), hiddenPassword, changedHandler); password.addChangedHandler(changedHandler); - + TextItem hiddenApiKey = ItemFactory.newTextItem("apikey_hidden", syndication.getApiKey()); - hiddenApiKey.setCellStyle("nodisplay"); + hiddenApiKey.setCellStyle(NODISPLAY); hiddenApiKey.addChangedHandler(changedHandler); FormItem apiKey = ItemFactory.newSafePasswordItem(APIKEY, I18N.message(APIKEY), syndication.getApiKey(), hiddenApiKey, changedHandler); diff --git a/logicaldoc-util/src/main/java/com/logicaldoc/util/Context.java b/logicaldoc-util/src/main/java/com/logicaldoc/util/Context.java index 8549f163d..3fcf36dfd 100644 --- a/logicaldoc-util/src/main/java/com/logicaldoc/util/Context.java +++ b/logicaldoc-util/src/main/java/com/logicaldoc/util/Context.java @@ -82,6 +82,19 @@ public Object getBean(String id) { : applicationContext.getBean(Character.toLowerCase(id.charAt(0)) + id.substring(1)); } + /** + * Says if a bean is or not available + * + * @param id identifier of the bean + * + * @return true if the bean is available + */ + public boolean containsBean(String id) { + // If not found with give ID try to lowercase the first char + return applicationContext.containsBean(id) + || applicationContext.containsBean(Character.toLowerCase(id.charAt(0)) + id.substring(1)); + } + /** * Retrieves the collection of all the bean ids * diff --git a/logicaldoc-webapp/src/test/java/com/logicaldoc/web/service/TemplateServiceImplTest.java b/logicaldoc-webapp/src/test/java/com/logicaldoc/web/service/TemplateServiceImplTest.java index 157563353..a90f78ecd 100644 --- a/logicaldoc-webapp/src/test/java/com/logicaldoc/web/service/TemplateServiceImplTest.java +++ b/logicaldoc-webapp/src/test/java/com/logicaldoc/web/service/TemplateServiceImplTest.java @@ -52,7 +52,7 @@ public void testDelete() throws ServerException, PersistenceException { } @Test - public void testCountDocuments() throws ServerException, PersistenceException { + public void testCountDocuments() throws ServerException { assertEquals(0L, testSubject.countDocuments(-1L)); assertEquals(0L, testSubject.countDocuments(99L)); }