diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/ContentViewerHelperIntegrationTest.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/ContentViewerHelperIntegrationTest.java
index 2fd1c2a846..4a4a254894 100644
--- a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/ContentViewerHelperIntegrationTest.java
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/ContentViewerHelperIntegrationTest.java
@@ -22,10 +22,13 @@
import com.agiletec.aps.system.services.page.IPage;
import com.agiletec.aps.system.services.page.IPageManager;
import com.agiletec.aps.system.services.page.Widget;
+import com.agiletec.aps.system.services.user.UserDetails;
import com.agiletec.aps.util.ApsProperties;
import com.agiletec.plugins.jacms.aps.system.JacmsSystemConstants;
import com.agiletec.plugins.jacms.aps.system.services.Jdk11CompatibleDateFormatter;
+import com.agiletec.plugins.jacms.aps.system.services.content.IContentManager;
+import com.agiletec.plugins.jacms.aps.system.services.content.model.Content;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel;
import com.agiletec.plugins.jacms.aps.system.services.contentmodel.IContentModelManager;
import com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo;
@@ -109,6 +112,18 @@ void testGetRenderedContentWithoutCurrentFrame() throws Throwable {
private void executeGetRenderedContent(boolean useExtraTitle, int frame,
String contentId, String expected, boolean nullExtraParam, boolean intoWidget) throws Throwable {
+ this.initRequestContext(useExtraTitle, frame, contentId, intoWidget);
+ String renderedContent = this._helper.getRenderedContent(null, null, true, _requestContext);
+ assertEquals(replaceNewLine(expected.trim()), replaceNewLine(renderedContent.trim()));
+ if (intoWidget) {
+ assertEquals(nullExtraParam, null != this._requestContext.getExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES));
+ } else {
+ Assertions.assertNull(this._requestContext.getExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES));
+ }
+ }
+
+ private void initRequestContext(boolean useExtraTitle, int frame,
+ String contentId, boolean intoWidget) throws Throwable {
this._requestContext.removeExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES); //clean
((MockHttpServletRequest) this._requestContext.getRequest()).removeParameter(SystemConstants.K_CONTENT_ID_PARAM); //clean
IPage page = this.pageManager.getOnlineRoot();
@@ -122,13 +137,6 @@ private void executeGetRenderedContent(boolean useExtraTitle, int frame,
this._requestContext.removeExtraParam(SystemConstants.EXTRAPAR_CURRENT_FRAME);
this._requestContext.removeExtraParam(SystemConstants.EXTRAPAR_CURRENT_WIDGET);
}
- String renderedContent = this._helper.getRenderedContent(null, null, true, _requestContext);
- assertEquals(replaceNewLine(expected.trim()), replaceNewLine(renderedContent.trim()));
- if (intoWidget) {
- assertEquals(nullExtraParam, null != this._requestContext.getExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES));
- } else {
- Assertions.assertNull(this._requestContext.getExtraParam(SystemConstants.EXTRAPAR_EXTRA_PAGE_TITLES));
- }
}
void testGetRenderedByModel(String contentId, String modelId, String expected) throws Throwable {
@@ -212,8 +220,47 @@ private void addNewContentModel(int id, String shape, String contentTypeCode) th
this._contentModelManager.addContentModel(model);
}
+ @Test
+ void testGetRenderedContent() throws Throwable {
+ Content content = this.contentManager.loadContent("ART1", true);
+ content.setId(null);
+ String newContentId = null;
+ try {
+ RequestContext reqCtx = getRequestContext();
+ setUserOnSession("admin");
+ UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
+ assertEquals("admin", currentUser.getUsername());
+ newContentId = this.contentManager.insertOnLineContent(content);
+ this.initRequestContext(false, 0, newContentId, true);
+
+ ContentRenderizationInfo info = this._helper.getRenderizationInfo(null, null, true, reqCtx);
+ Assertions.assertNotNull(info);
+
+ this.contentManager.removeOnLineContent(content);
+ info = this._helper.getRenderizationInfo(null, null, true, reqCtx);
+ Assertions.assertNull(info);
+
+ this.contentManager.insertOnLineContent(content);
+ info = this._helper.getRenderizationInfo(null, null, true, reqCtx);
+ Assertions.assertNotNull(info);
+
+ this.contentManager.removeOnLineContent(content);
+ info = this._helper.getRenderizationInfo(null, null, true, reqCtx);
+ Assertions.assertNull(info);
+
+ } catch (Throwable t) {
+ throw t;
+ } finally {
+ if (null != newContentId) {
+ Content newContent = this.contentManager.loadContent(newContentId, false);
+ this.contentManager.removeOnLineContent(newContent);
+ this.contentManager.deleteContent(newContent);
+ }
+ }
+ }
+
@BeforeEach
- private void init() throws Exception {
+ void init() throws Exception {
try {
this._requestContext = this.getRequestContext();
Lang lang = new Lang();
@@ -222,6 +269,7 @@ private void init() throws Exception {
this._requestContext.addExtraParam(SystemConstants.EXTRAPAR_CURRENT_LANG, lang);
this.configureCurrentWidget(null, null);
this._helper = (IContentViewerHelper) this.getApplicationContext().getBean("jacmsContentViewerHelper");
+ this.contentManager = this.getApplicationContext().getBean(IContentManager.class);
} catch (Throwable t) {
throw new Exception(t);
}
@@ -248,6 +296,7 @@ private void configureCurrentWidget(String contentId, String modelId) {
private RequestContext _requestContext;
private IPageManager pageManager;
private IContentViewerHelper _helper;
+ private IContentManager contentManager;
private IContentModelManager _contentModelManager = null;
}
diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/UserFilterOptionBeanTest.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/UserFilterOptionBeanTest.java
new file mode 100644
index 0000000000..da2aecbf96
--- /dev/null
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/content/widget/UserFilterOptionBeanTest.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright 2023-Present Entando Inc. (http://www.entando.com) All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 2.1 of the License, or (at your option)
+ * any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ */
+package com.agiletec.plugins.jacms.aps.system.services.content.widget;
+
+import com.agiletec.aps.system.common.entity.model.EntitySearchFilter;
+import com.agiletec.aps.system.common.entity.model.IApsEntity;
+import com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute;
+import com.agiletec.aps.system.common.entity.model.attribute.DateAttribute;
+import com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute;
+import com.agiletec.aps.system.common.entity.model.attribute.TextAttribute;
+import com.agiletec.aps.system.services.lang.Lang;
+import com.agiletec.aps.util.DateConverter;
+import com.agiletec.plugins.jacms.aps.system.services.content.widget.UserFilterOptionBean.AttributeFormFieldError;
+import java.math.BigDecimal;
+import java.util.Properties;
+import javax.servlet.http.HttpServletRequest;
+import org.entando.entando.aps.system.services.searchengine.SearchEngineFilter;
+import org.entando.entando.ent.exception.EntException;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class UserFilterOptionBeanTest {
+
+ @Mock
+ private IApsEntity prototype;
+
+ @Test
+ void shouldReturnErrorOnInvalidAttribute() {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "textAttribute");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "text");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ Mockito.when(prototype.getAttribute("textAttribute")).thenReturn(null);
+ Assertions.assertThrows(EntException.class, () -> {
+ new UserFilterOptionBean(prop, prototype);
+ });
+ }
+
+ @Test
+ void shouldExtractTextFilter() throws Throwable {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "textAttribute");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "text");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ TextAttribute textAttribute = Mockito.mock(TextAttribute.class);
+ Mockito.when(textAttribute.getType()).thenReturn("Text");
+ Mockito.when(textAttribute.getName()).thenReturn("textAttribute");
+ Mockito.when(prototype.getAttribute("textAttribute")).thenReturn(textAttribute);
+ Lang lang = new Lang();
+ lang.setCode("en");
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+ // String[] fieldsSuffix = {"_textFieldName"};
+ // String fieldName = paramName + fieldSuffix + frameIdSuffix;
+ Mockito.when(request.getParameter("textAttribute_textFieldName_frame8")).thenReturn("text");
+ UserFilterOptionBean ubof = new UserFilterOptionBean(prop, prototype, 8, lang, "yyyy-MM-dd", request);
+ EntitySearchFilter ef = ubof.getEntityFilter();
+ Assertions.assertEquals("textAttribute", ef.getKey());
+ Assertions.assertEquals("text", ef.getValue());
+ Assertions.assertEquals(true, ef.isAttributeFilter());
+ SearchEngineFilter filter = ubof.extractFilter();
+ Assertions.assertEquals("Text:textAttribute", filter.getKey());
+ Assertions.assertEquals("text", filter.getValue());
+ Assertions.assertEquals(SearchEngineFilter.TextSearchOption.EXACT, filter.getTextSearchOption());
+ }
+
+ @Test
+ void shouldExtractDateFilter() throws Throwable {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "dateAttribute");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "date");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ DateAttribute dateAttribute = Mockito.mock(DateAttribute.class);
+ Mockito.when(dateAttribute.getType()).thenReturn("Date");
+ Mockito.when(dateAttribute.getName()).thenReturn("dateAttribute");
+ Mockito.when(prototype.getAttribute("dateAttribute")).thenReturn(dateAttribute);
+ Lang lang = new Lang();
+ lang.setCode("it");
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+ // String[] fieldsSuffix = {"_dateStartFieldName", "_dateEndFieldName"};
+ Mockito.when(request.getParameter("dateAttribute_dateStartFieldName_frame7")).thenReturn("2023-10-23");
+ Mockito.when(request.getParameter("dateAttribute_dateEndFieldName_frame7")).thenReturn("2023-11-17");
+ UserFilterOptionBean ubof = new UserFilterOptionBean(prop, prototype, 7, lang, "yyyy-MM-dd", request);
+ Assertions.assertNull(ubof.getFormFieldErrors());
+ EntitySearchFilter ef = ubof.getEntityFilter();
+ Assertions.assertEquals("dateAttribute", ef.getKey());
+ Assertions.assertNull(ef.getValue());
+ Assertions.assertEquals(true, ef.isAttributeFilter());
+ Assertions.assertEquals(DateConverter.parseDate("2023-10-23", "yyyy-MM-dd"), ef.getStart());
+ Assertions.assertEquals(DateConverter.parseDate("2023-11-17", "yyyy-MM-dd"), ef.getEnd());
+ SearchEngineFilter filter = ubof.extractFilter();
+ Assertions.assertEquals("Date:dateAttribute", filter.getKey());
+ Assertions.assertNull(filter.getValue());
+ Assertions.assertEquals(DateConverter.parseDate("2023-10-23", "yyyy-MM-dd"), filter.getStart());
+ Assertions.assertEquals(DateConverter.parseDate("2023-11-17", "yyyy-MM-dd"), filter.getEnd());
+ Assertions.assertNull(filter.getTextSearchOption());
+ }
+
+ @Test
+ void shouldReturnErrorWithWrongDateRange() throws Throwable {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "dateAttr");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "date");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ DateAttribute dateAttribute = Mockito.mock(DateAttribute.class);
+ Mockito.when(dateAttribute.getType()).thenReturn("Date");
+ Mockito.when(dateAttribute.getName()).thenReturn("dateAttr");
+ Mockito.when(prototype.getAttribute("dateAttr")).thenReturn(dateAttribute);
+ Lang lang = new Lang();
+ lang.setCode("it");
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+ // String[] fieldsSuffix = {"_dateStartFieldName", "_dateEndFieldName"};
+ Mockito.when(request.getParameter("dateAttr_dateStartFieldName_frame7")).thenReturn("2023-10-23");
+ Mockito.when(request.getParameter("dateAttr_dateEndFieldName_frame7")).thenReturn("2023-07-17");
+ UserFilterOptionBean ubof = new UserFilterOptionBean(prop, prototype, 7, lang, "yyyy-MM-dd", request);
+ Assertions.assertEquals(1, ubof.getFormFieldErrors().size());
+ AttributeFormFieldError error = ubof.getFormFieldErrors().get("dateAttr_dateEndFieldName_frame7");
+ Assertions.assertEquals("dateAttr", error.getAttributeName());
+ Assertions.assertEquals("dateAttr_dateEndFieldName_frame7", error.getFieldName());
+ Assertions.assertEquals(AttributeFormFieldError.INVALID_RANGE_KEY, error.getErrorKey());
+ }
+
+ @Test
+ void shouldExtractNumberFilter() throws Throwable {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "numberAttribute");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "number");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ NumberAttribute numberAttribute = Mockito.mock(NumberAttribute.class);
+ Mockito.when(numberAttribute.getType()).thenReturn("Number");
+ Mockito.when(numberAttribute.getName()).thenReturn("numberAttribute");
+ Mockito.when(prototype.getAttribute("numberAttribute")).thenReturn(numberAttribute);
+ Lang lang = new Lang();
+ lang.setCode("it");
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+ // String[] fieldsSuffix = {"_numberStartFieldName", "_numberEndFieldName"};
+ Mockito.when(request.getParameter("numberAttribute_numberStartFieldName_frame3")).thenReturn("19");
+ Mockito.when(request.getParameter("numberAttribute_numberEndFieldName_frame3")).thenReturn("128");
+ UserFilterOptionBean ubof = new UserFilterOptionBean(prop, prototype, 3, lang, "yyyy-MM-dd", request);
+ Assertions.assertNull(ubof.getFormFieldErrors());
+ EntitySearchFilter ef = ubof.getEntityFilter();
+ Assertions.assertEquals("numberAttribute", ef.getKey());
+ Assertions.assertNull(ef.getValue());
+ Assertions.assertEquals(true, ef.isAttributeFilter());
+ Assertions.assertEquals(19, ((BigDecimal) ef.getStart()).intValue());
+ Assertions.assertEquals(128, ((BigDecimal) ef.getEnd()).intValue());
+ SearchEngineFilter filter = ubof.extractFilter();
+ Assertions.assertEquals("Number:numberAttribute", filter.getKey());
+ Assertions.assertNull(filter.getValue());
+ Assertions.assertEquals(19, ((BigDecimal) filter.getStart()).intValue());
+ Assertions.assertEquals(128, ((BigDecimal) filter.getEnd()).intValue());
+ Assertions.assertNull(filter.getTextSearchOption());
+ }
+
+ @Test
+ void shouldExtractBooleanFilter() throws Throwable {
+ Properties prop = new Properties();
+ prop.setProperty(UserFilterOptionBean.PARAM_KEY, "booleanAttribute");
+ prop.setProperty(UserFilterOptionBean.TYPE_ATTRIBUTE, "boolean");
+ prop.setProperty(UserFilterOptionBean.PARAM_IS_ATTRIBUTE_FILTER, "true");
+ BooleanAttribute booleanAttribute = Mockito.mock(BooleanAttribute.class);
+ Mockito.when(booleanAttribute.getType()).thenReturn("Boolean");
+ Mockito.when(booleanAttribute.getName()).thenReturn("booleanAttribute");
+ Mockito.when(prototype.getAttribute("booleanAttribute")).thenReturn(booleanAttribute);
+ Lang lang = new Lang();
+ lang.setCode("en");
+ HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+ // String[] fieldsSuffix = {"_booleanFieldName", "_booleanFieldName_ignore", "_booleanFieldName_control"};
+ Mockito.when(request.getParameter("booleanAttribute_booleanFieldName_frame9")).thenReturn("true");
+ Mockito.when(request.getParameter("booleanAttribute_booleanFieldName_ignore_frame9")).thenReturn(null);
+ Mockito.when(request.getParameter("booleanAttribute_booleanFieldName_control_frame9")).thenReturn("true");
+ UserFilterOptionBean ubof = new UserFilterOptionBean(prop, prototype, 9, lang, "yyyy-MM-dd", request);
+ Assertions.assertNull(ubof.getFormFieldErrors());
+ EntitySearchFilter ef = ubof.getEntityFilter();
+ Assertions.assertEquals("booleanAttribute", ef.getKey());
+ Assertions.assertEquals("true", ef.getValue());
+ Assertions.assertEquals(true, ef.isAttributeFilter());
+ Assertions.assertNull(ef.getStart());
+ Assertions.assertNull(ef.getEnd());
+ }
+
+}
diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/dispenser/TestContentDispenser.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/dispenser/TestContentDispenser.java
index 300f143999..7e0c471de9 100644
--- a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/dispenser/TestContentDispenser.java
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/aps/system/services/dispenser/TestContentDispenser.java
@@ -32,6 +32,9 @@
import static org.junit.jupiter.api.Assertions.assertNull;
import com.agiletec.aps.system.services.user.IUserManager;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -41,6 +44,9 @@
* @author W.Ambu - E.Santoboni
*/
class TestContentDispenser extends BaseTestCase {
+
+ private static final List
usernamesForTest = List.of("supervisorCoach", "mainEditor", "pageManagerCoach",
+ "supervisorCustomers", "pageManagerCustomers", "editorCustomers", "editorCoach", "admin");
@Test
void testGetRenderedContent_1() throws Throwable {
@@ -115,43 +121,30 @@ void testGetRenderedContent_2() throws Throwable {
@Test
void testGetRenderedContent_3_1() throws Throwable {
- this.executeTestGetRenderedContent_3(Boolean.FALSE, false);
- this.executeTestGetRenderedContent_3(Boolean.FALSE, true);
- }
-
- @Test
- void testGetRenderedContent_3_2() throws Throwable {
- this.executeTestGetRenderedContent_3(Boolean.TRUE, false);
- this.executeTestGetRenderedContent_3(Boolean.TRUE, true);
- }
-
- @Test
- void testGetRenderedContent_3_3() throws Throwable {
- this.executeTestGetRenderedContent_3(null, false);
+ for (String username : usernamesForTest) {
+ this.executeTestGetRenderedContent_3(Boolean.FALSE, username);
+ this.executeTestGetRenderedContent_3(Boolean.TRUE, username);
+ this.executeTestGetRenderedContent_3(null, username);
+ }
+ this.executeTestGetRenderedContent_3(Boolean.TRUE, null);
}
- protected void executeTestGetRenderedContent_3(Boolean cached, boolean useCurrentUser) throws Throwable {
+ protected void executeTestGetRenderedContent_3(Boolean cached, String username) throws Throwable {
Content content = this._contentManager.loadContent("ART120", true);
content.setId(null);
try {
+ String id = this._contentManager.insertOnLineContent(content);
RequestContext reqCtx = this.getRequestContext();
- this.setUserOnSession("admin");
+ this.setUserOnSession(username);
UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
- assertEquals("admin", currentUser.getUsername());
- this._contentManager.insertOnLineContent(content);
- String cacheKey = (useCurrentUser) ?
- BaseContentDispenser.getRenderizationInfoCacheKey(content.getId(), 2, "it", reqCtx) :
- BaseContentDispenser.getRenderizationInfoCacheKey(content.getId(), 2, "it", currentUser);
+ Optional.ofNullable(username).ifPresent(notNull -> assertEquals(username, currentUser.getUsername()));
+ String cacheKey = BaseContentDispenser.getRenderizationInfoCacheKey(id, 2, "it", reqCtx);
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, cacheKey));
ContentRenderizationInfo outputInfo = null;
if (null == cached) {
- outputInfo = this._contentDispenser.getRenderizationInfo(content.getId(), 2, "it", reqCtx);
+ outputInfo = this._contentDispenser.getRenderizationInfo(id, 2, "it", reqCtx);
} else {
- if (useCurrentUser) {
- outputInfo = this._contentDispenser.getRenderizationInfo(content.getId(), 2, "it", currentUser, cached);
- } else {
- outputInfo = this._contentDispenser.getRenderizationInfo(content.getId(), 2, "it", reqCtx, cached);
- }
+ outputInfo = this._contentDispenser.getRenderizationInfo(id, 2, "it", reqCtx, cached);
}
assertNotNull(outputInfo);
this.waitNotifyingThread();
@@ -164,6 +157,7 @@ protected void executeTestGetRenderedContent_3(Boolean cached, boolean useCurren
assertNotNull(renderedInfoInCache);
assertNotNull(contentAuthInfoInCache);
}
+ content.setId(id);
this._contentManager.insertOnLineContent(content);
this.waitNotifyingThread();
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, cacheKey));
@@ -177,6 +171,38 @@ protected void executeTestGetRenderedContent_3(Boolean cached, boolean useCurren
}
}
+ @Test
+ void testGetRenderedContent_3_2() throws Throwable {
+ RequestContext reqCtx = this.getRequestContext();
+ Content content = this._contentManager.loadContent("ART120", true);
+ content.setId(null);
+ try {
+ String id = this._contentManager.insertOnLineContent(content);
+ List cacheKeys = new ArrayList<>();
+ for (String username : usernamesForTest) {
+ setUserOnSession(username);
+ UserDetails currentUser = (UserDetails) reqCtx.getRequest().getSession().getAttribute(SystemConstants.SESSIONPARAM_CURRENT_USER);
+ assertEquals(username, currentUser.getUsername());
+ String cacheKey = BaseContentDispenser.getRenderizationInfoCacheKey(id, 2, "it", reqCtx);
+ assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, cacheKey));
+ ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(id, 2, "it", reqCtx);
+ assertNotNull(outputInfo);
+ cacheKeys.add(cacheKey);
+ }
+ cacheKeys.stream().forEach(key -> assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, key)));
+ content.setId(id);
+ this._contentManager.insertOnLineContent(content);
+ this.waitNotifyingThread();
+ cacheKeys.stream().forEach(key -> assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, key)));
+ } catch (Throwable t) {
+ throw t;
+ } finally {
+ if (null != content.getId()) {
+ this._contentManager.deleteContent(content);
+ }
+ }
+ }
+
@Test
void testGetRenderedContent_4() throws Throwable {
String contentId = "ART120";
diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestMultipleResourceAction.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionIntegrationTest.java
similarity index 98%
rename from cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestMultipleResourceAction.java
rename to cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionIntegrationTest.java
index 4b2e01875d..a6e9082af7 100644
--- a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestMultipleResourceAction.java
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionIntegrationTest.java
@@ -39,7 +39,7 @@
/**
* @author E.Santoboni
*/
-class TestMultipleResourceAction extends ApsAdminBaseTestCase {
+class MultipleResourceActionIntegrationTest extends ApsAdminBaseTestCase {
private IResourceManager resourceManager = null;
@@ -106,6 +106,7 @@ void testSaveNewResourceMultipleResourceValidation() throws Throwable {
this.addParameter("resourceTypeCode", "Image");
this.addParameter("mainGroup", "test");
this.addParameter("descr_0", "test");
+ this.addParameter("fileUploadName_0", "test".repeat(100));
String result = this.executeAction();
ActionSupport action = this.getAction();
Map> actionFieldErrors = action.getFieldErrors();
diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionTest.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionTest.java
new file mode 100644
index 0000000000..8f472b7f1b
--- /dev/null
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/MultipleResourceActionTest.java
@@ -0,0 +1,156 @@
+/*
+* Copyright 2024-Present Entando Inc. (http://www.entando.com) All rights reserved.
+*
+* This library is free software; you can redistribute it and/or modify it under
+* the terms of the GNU Lesser General Public License as published by the Free
+* Software Foundation; either version 2.1 of the License, or (at your option)
+* any later version.
+*
+* This library is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+* details.
+ */
+package com.agiletec.plugins.jacms.apsadmin.resource;
+
+import com.agiletec.aps.system.services.category.ICategoryManager;
+import com.agiletec.aps.system.services.group.Group;
+import com.agiletec.aps.system.services.group.IGroupManager;
+import com.agiletec.apsadmin.system.ApsAdminSystemConstants;
+import com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager;
+import com.agiletec.plugins.jacms.apsadmin.resource.helper.IResourceActionHelper;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.mockito.junit.jupiter.MockitoExtension;
+
+@ExtendWith(MockitoExtension.class)
+class MultipleResourceActionTest {
+
+ @Mock
+ private HttpServletRequest request;
+
+ @Mock
+ private IGroupManager groupManager;
+
+ @Mock
+ private IResourceManager resourceManager;
+
+ @Mock
+ private ICategoryManager categoryManager;
+
+ @Mock
+ private IResourceActionHelper resourceActionHelper;
+
+ @InjectMocks
+ @Spy
+ private MultipleResourceAction action;
+
+ @BeforeEach
+ void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ action.setServletRequest(this.request);
+ action.setGroupManager(this.groupManager);
+ action.setResourceManager(this.resourceManager);
+ action.setCategoryManager(this.categoryManager);
+ action.setResourceActionHelper(this.resourceActionHelper);
+ Mockito.lenient().doReturn("text").when(action).getText(Mockito.anyString());
+ }
+
+ @Test
+ void validateRightForm() {
+ action.setMainGroup(Group.FREE_GROUP_NAME);
+ action.setStrutsAction(ApsAdminSystemConstants.ADD);
+ Map parameterMap = Map.of(
+ MultipleResourceAction.FILE_DESCR_FIELD + "0", new String[]{"Descrizione file"},
+ MultipleResourceAction.FILE_UPLOAD_ID_FIELD + "0", new String[]{"0"},
+ MultipleResourceAction.FILE_NAME_FIELD + "0", new String[]{"file.txt"},
+ MultipleResourceAction.FILE_CONTENT_TYPE_FIELD + "0", new String[]{"text/plain"}
+ );
+ Mockito.when(this.request.getParameterMap()).thenReturn(parameterMap);
+ action.validate();
+ Assertions.assertTrue(action.getFieldErrors().isEmpty());
+ }
+
+ @Test
+ void validateLongDescription() {
+ action.setMainGroup(Group.FREE_GROUP_NAME);
+ action.setStrutsAction(ApsAdminSystemConstants.ADD);
+ Map parameterMap = Map.of(
+ MultipleResourceAction.FILE_DESCR_FIELD + "0", new String[]{"Descrizione file"},
+ MultipleResourceAction.FILE_UPLOAD_ID_FIELD + "0", new String[]{"0"},
+ MultipleResourceAction.FILE_NAME_FIELD + "0", new String[]{"file".repeat(200)+".txt"},
+ MultipleResourceAction.FILE_CONTENT_TYPE_FIELD + "0", new String[]{"text/plain"}
+ );
+ Mockito.doReturn("text").when(action).getText(Mockito.anyString(), Mockito.anyList());
+ Mockito.when(this.request.getParameterMap()).thenReturn(parameterMap);
+ action.validate();
+ Assertions.assertFalse(action.getFieldErrors().isEmpty());
+ Assertions.assertEquals(1, action.getFieldErrors().get(MultipleResourceAction.FILE_NAME_FIELD + "0").size());
+ }
+
+ @Test
+ void validateFileAlreadyPresentOnAddExecution() throws Throwable {
+ action.setMainGroup(Group.FREE_GROUP_NAME);
+ action.setStrutsAction(ApsAdminSystemConstants.ADD);
+ Map parameterMap = Map.of(
+ MultipleResourceAction.FILE_DESCR_FIELD + "0", new String[]{"Descrizione file"},
+ MultipleResourceAction.FILE_UPLOAD_ID_FIELD + "0", new String[]{"0"},
+ MultipleResourceAction.FILE_NAME_FIELD + "0", new String[]{"file.txt"},
+ MultipleResourceAction.FILE_CONTENT_TYPE_FIELD + "0", new String[]{"text/plain"}
+ );
+ Mockito.when(this.resourceManager.searchResourcesId(Mockito.any(), Mockito.anyList())).thenReturn(List.of("21"));
+ Mockito.doReturn("text").when(action).getText(Mockito.anyString(), Mockito.any(String[].class));
+ Mockito.when(this.request.getParameterMap()).thenReturn(parameterMap);
+ action.validate();
+ Assertions.assertFalse(action.getFieldErrors().isEmpty());
+ Assertions.assertEquals(1, action.getFieldErrors().get(MultipleResourceAction.FILE_NAME_FIELD + "0").size());
+ }
+
+ @Test
+ void validateFileAlreadyPresentOnEditExecution() throws Throwable {
+ action.setMainGroup(Group.FREE_GROUP_NAME);
+ action.setStrutsAction(ApsAdminSystemConstants.EDIT);
+ action.setResourceId("100");
+ Map parameterMap = Map.of(
+ MultipleResourceAction.FILE_DESCR_FIELD + "0", new String[]{"Descrizione file"},
+ MultipleResourceAction.FILE_UPLOAD_ID_FIELD + "0", new String[]{"0"},
+ MultipleResourceAction.FILE_NAME_FIELD + "0", new String[]{"file.txt"},
+ MultipleResourceAction.FILE_CONTENT_TYPE_FIELD + "0", new String[]{"text/plain"}
+ );
+ Mockito.when(this.request.getParameterMap()).thenReturn(parameterMap);
+ Mockito.doReturn("text").when(action).getText(Mockito.anyString(), Mockito.any(String[].class));
+
+ Mockito.when(this.resourceManager.searchResourcesId(Mockito.any(), Mockito.anyList())).thenReturn(List.of("37"));
+ action.validate();
+ Assertions.assertFalse(action.getFieldErrors().isEmpty());
+ Assertions.assertEquals(1, action.getFieldErrors().get(MultipleResourceAction.FILE_NAME_FIELD + "0").size());
+ }
+
+ @Test
+ void validateFileNotPresentOnEditExecution() throws Throwable {
+ action.setMainGroup(Group.FREE_GROUP_NAME);
+ action.setStrutsAction(ApsAdminSystemConstants.EDIT);
+ action.setResourceId("120");
+ Map parameterMap = Map.of(
+ MultipleResourceAction.FILE_DESCR_FIELD + "0", new String[]{"Descrizione file"},
+ MultipleResourceAction.FILE_UPLOAD_ID_FIELD + "0", new String[]{"0"},
+ MultipleResourceAction.FILE_NAME_FIELD + "0", new String[]{"file.txt"},
+ MultipleResourceAction.FILE_CONTENT_TYPE_FIELD + "0", new String[]{"text/plain"}
+ );
+ Mockito.when(this.request.getParameterMap()).thenReturn(parameterMap);
+ Mockito.when(this.resourceManager.searchResourcesId(Mockito.any(), Mockito.anyList())).thenReturn(List.of("120"));
+ action.validate();
+ Assertions.assertTrue(action.getFieldErrors().isEmpty());
+ }
+
+}
diff --git a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestResourceFinderAction.java b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestResourceFinderAction.java
index fd9281c0ab..19da2c3b96 100644
--- a/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestResourceFinderAction.java
+++ b/cms-plugin/src/test/java/com/agiletec/plugins/jacms/apsadmin/resource/TestResourceFinderAction.java
@@ -17,6 +17,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult;
import com.agiletec.aps.system.services.category.Category;
import com.agiletec.aps.system.services.group.Group;
import com.agiletec.apsadmin.ApsAdminBaseTestCase;
@@ -24,6 +25,8 @@
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
@@ -37,6 +40,7 @@ void testViewImageResources() throws Throwable {
assertEquals(Action.SUCCESS, result);
ResourceFinderAction action = (ResourceFinderAction) this.getAction();
String resourceTypeCode = action.getResourceTypeCode();
+ Assertions.assertFalse(action.isOpenCollapsed());
assertNotNull(resourceTypeCode);
assertEquals("Image", resourceTypeCode);
assertEquals(3, action.getResources().size());
@@ -86,6 +90,19 @@ private String executeShowList(String userName, String resourceTypeCode) throws
return this.executeAction();
}
+ @Test
+ void testSearchResourcesById() throws Throwable {
+ String result = this.executeSearchResources("admin", "Image", Map.of("searchedResourceId", "2"));
+ assertEquals(Action.SUCCESS, result);
+ ResourceFinderAction action = (ResourceFinderAction) this.getAction();
+ Assertions.assertFalse(action.getResources().isEmpty());
+ Assertions.assertTrue(action.isOpenCollapsed());
+ SearcherDaoPaginatedResult pagination = action.getPaginatedResourcesId(10);
+ assertEquals(2, pagination.getCount());
+ assertTrue(pagination.getList().contains("82"));
+ assertTrue(pagination.getList().contains("22"));
+ }
+
@Test
void testSearchResources_1() throws Throwable {
String result = this.executeSearchResource("admin", "Attach", "WrongDescription", null, null, null);
@@ -239,4 +256,12 @@ private String executeSearchResourceWithOrder(String username, String resourceTy
return this.executeAction();
}
+ private String executeSearchResources(String username,
+ String resourceTypeCode, Map parameters) throws Throwable {
+ this.setUserOnSession(username);
+ this.initAction("/do/jacms/Resource", "search");
+ this.addParameters(parameters);
+ return this.executeAction();
+ }
+
}
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/aps/system/services/content/ContentServiceTest.java b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/aps/system/services/content/ContentServiceTest.java
index 9021434891..732ea50a48 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/aps/system/services/content/ContentServiceTest.java
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/aps/system/services/content/ContentServiceTest.java
@@ -525,6 +525,23 @@ private RestContentListRequest prepareGetContentTest(UserDetails user) throws En
return requestList;
}
+ @Test
+ void shouldFindReferences() throws Exception {
+ ContentServiceUtilizer utilizer = Mockito.mock(ContentServiceUtilizer.class);
+ List components = new ArrayList<>();
+ for (int i = 0; i < 5; i++) {
+ IComponentDto dto = Mockito.mock(IComponentDto.class);
+ components.add(dto);
+ }
+ when(utilizer.getManagerName()).thenReturn("service");
+ when(utilizer.getContentUtilizer(Mockito.anyString())).thenReturn(components);
+ when(this.applicationContext.getBeansOfType(ContentServiceUtilizer.class)).thenReturn(Map.of("service", utilizer));
+ when(this.contentManager.loadContent("ART123", false)).thenReturn(Mockito.mock(Content.class));
+ PagedMetadata> result = contentService.getContentReferences("ART123",
+ "service", Mockito.mock(UserDetails.class), new RestListRequest());
+ Assertions.assertEquals(5, result.getBody().size());
+ }
+
@Test
void shouldFindComponentDto() throws Exception {
this.addMockedContent("ART123", "ART", null, null);
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_POST_valid_with_some_links.json b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_POST_valid_with_some_links.json
index 3908d27764..cb59587872 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_POST_valid_with_some_links.json
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_POST_valid_with_some_links.json
@@ -16,7 +16,7 @@
"urlDest": "https://myurl.com",
"rel": "rel",
"target": "_blank",
- "hreflang": "it"
+ "hrefLang": "it"
},
"values": {
"it": "My URL Link"
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_PUT_valid_with_link.json b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_PUT_valid_with_link.json
index 9c30a101fe..ee00481ccc 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_PUT_valid_with_link.json
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/1_PUT_valid_with_link.json
@@ -15,7 +15,7 @@
"pageDest":"pagina_11",
"target": "_blank",
"rel": "alternate",
- "hreflang": "it"
+ "hrefLang": "it"
},
"values":{
"it":"pagina_11"
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerIntegrationTest.java b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerIntegrationTest.java
index e4400fdb98..d9ea92bb54 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerIntegrationTest.java
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerIntegrationTest.java
@@ -59,6 +59,7 @@
import com.agiletec.plugins.jacms.aps.system.services.content.model.ContentDto;
import com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink;
import com.agiletec.plugins.jacms.aps.system.services.content.model.attribute.ImageAttribute;
+import com.agiletec.plugins.jacms.aps.system.services.content.model.attribute.LinkAttribute;
import com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager;
import com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface;
import com.agiletec.plugins.jacms.aps.system.services.searchengine.ICmsSearchEngineManager;
@@ -397,7 +398,6 @@ void testAddUpdateContentWithLinkAttribute() throws Exception {
.andExpect(jsonPath("$.payload.size()", is(1)))
.andExpect(jsonPath("$.errors.size()", is(0)))
.andExpect(jsonPath("$.metaData.size()", is(0)))
-
.andExpect(jsonPath("$.payload[0].id", Matchers.anything()))
.andExpect(jsonPath("$.payload[0].attributes[0].code", is("link1")))
.andExpect(jsonPath("$.payload[0].attributes[0].value", Matchers.isEmptyOrNullString()));
@@ -412,7 +412,6 @@ void testAddUpdateContentWithLinkAttribute() throws Exception {
.andExpect(jsonPath("$.payload.size()", is(1)))
.andExpect(jsonPath("$.errors.size()", is(0)))
.andExpect(jsonPath("$.metaData.size()", is(0)))
-
.andExpect(jsonPath("$.payload[0].id", Matchers.anything()))
.andExpect(jsonPath("$.payload[0].attributes[0].code", is("link1")))
.andExpect(jsonPath("$.payload[0].attributes[0].value.destType", is(SymbolicLink.PAGE_TYPE)))
@@ -420,8 +419,7 @@ void testAddUpdateContentWithLinkAttribute() throws Exception {
.andExpect(jsonPath("$.payload[0].attributes[0].value.symbolicDestination", is("#!P;pagina_11!#")))
.andExpect(jsonPath("$.payload[0].attributes[0].value.rel", is("alternate")))
.andExpect(jsonPath("$.payload[0].attributes[0].value.target", is("_blank")))
- .andExpect(jsonPath("$.payload[0].attributes[0].value.hreflang", is("it")))
-
+ .andExpect(jsonPath("$.payload[0].attributes[0].value.hrefLang", is("it")))
.andExpect(jsonPath("$.payload[0].attributes[0].values.it", is("pagina_11")));
this.executeContentPut("1_PUT_invalid_with_link.json", newContentId, accessToken, status().isBadRequest())
@@ -522,7 +520,7 @@ void testAddUpdateContentWithLinksAttributeThenRemoveIt() throws Exception {
.andExpect(jsonPath("$.payload[0].attributes[0].value.urlDest", is("https://myurl.com")))
.andExpect(jsonPath("$.payload[0].attributes[0].value.rel", is("rel")))
.andExpect(jsonPath("$.payload[0].attributes[0].value.target", is("_blank")))
- .andExpect(jsonPath("$.payload[0].attributes[0].value.hreflang", is("it")))
+ .andExpect(jsonPath("$.payload[0].attributes[0].value.hrefLang", is("it")))
.andExpect(jsonPath("$.payload[0].attributes[1].code", is("link2")))
.andExpect(jsonPath("$.payload[0].attributes[1].value.pageDest", is("pagina_11")))
.andExpect(jsonPath("$.payload[0].attributes[2].code", is("link3")))
@@ -535,9 +533,13 @@ void testAddUpdateContentWithLinksAttributeThenRemoveIt() throws Exception {
String bodyResult = result.andReturn().getResponse().getContentAsString();
newContentId = JsonPath.read(bodyResult, "$.payload[0].id");
Content newContent = this.contentManager.loadContent(newContentId, false);
-
Assertions.assertNotNull(newContent);
-
+ LinkAttribute linkAttribute = (LinkAttribute) newContent.getAttribute("link1");
+ Assertions.assertNotNull(linkAttribute);
+ Assertions.assertEquals("_blank", linkAttribute.getTarget());
+ Assertions.assertEquals("rel", linkAttribute.getRel());
+ Assertions.assertEquals("it", linkAttribute.getHrefLang());
+
this.executeContentPut("1_PUT_valid_with_some_more_links.json", newContentId, accessToken, status().isOk())
.andExpect(jsonPath("$.payload.size()", is(1)))
.andExpect(jsonPath("$.errors.size()", is(0)))
@@ -1103,19 +1105,27 @@ void testAddContentWithAttachAndImageAttribute() throws Exception {
String bodyResult = result.andReturn().getResponse().getContentAsString();
newContentId1 = JsonPath.read(bodyResult, "$.payload[0].id");
+ newContentId2 = JsonPath.read(bodyResult, "$.payload[1].id");
+
Content newContent1 = this.contentManager.loadContent(newContentId1, false);
Assertions.assertNotNull(newContent1);
-
- newContentId2 = JsonPath.read(bodyResult, "$.payload[1].id");
+ ImageAttribute imageAttribute1 = (ImageAttribute) newContent1.getAttribute("img1");
+ Assertions.assertNotNull(imageAttribute1);
+ Assertions.assertEquals("alt img en1", imageAttribute1.getMetadataForLang(IResourceManager.ALT_METADATA_KEY, "en"));
+ Assertions.assertEquals("legend img en1", imageAttribute1.getMetadataForLang(IResourceManager.LEGEND_METADATA_KEY, "en"));
+ Assertions.assertNull(imageAttribute1.getMetadataForLang(IResourceManager.DESCRIPTION_METADATA_KEY, "it"));
+ Assertions.assertEquals("alt img it1", imageAttribute1.getMetadataForLang(IResourceManager.ALT_METADATA_KEY, "it"));
+ Assertions.assertEquals("legend img it1", imageAttribute1.getMetadataForLang(IResourceManager.LEGEND_METADATA_KEY, "it"));
+
Content newContent2 = this.contentManager.loadContent(newContentId2, false);
Assertions.assertNotNull(newContent2);
-
+ ImageAttribute imageAttribute2 = (ImageAttribute) newContent2.getAttribute("img1");
+ Assertions.assertNotNull(imageAttribute2);
+ Assertions.assertEquals("legend img it2", imageAttribute2.getMetadataForLang(IResourceManager.LEGEND_METADATA_KEY, "it"));
+ Assertions.assertEquals("alt img it2", imageAttribute2.getMetadataForLang(IResourceManager.ALT_METADATA_KEY, "it"));
+
} finally {
- if (null != imageResourceId) {
- performDeleteResource(accessToken, "image", imageResourceId)
- .andExpect(status().isOk());
- }
if (null != newContentId1) {
Content newContent = this.contentManager.loadContent(newContentId1, false);
if (null != newContent) {
@@ -1131,6 +1141,10 @@ void testAddContentWithAttachAndImageAttribute() throws Exception {
if (null != this.contentManager.getEntityPrototype("IAT")) {
((IEntityTypesConfigurer) this.contentManager).removeEntityPrototype("IAT");
}
+ if (null != imageResourceId) {
+ performDeleteResource(accessToken, "image", imageResourceId)
+ .andExpect(status().isOk());
+ }
}
}
@@ -2649,9 +2663,31 @@ private ResultActions performDeleteResource(String accessToken, String type, Str
delete(path)
.header("Authorization", "Bearer " + accessToken));
}
-
+
+ @Test
+ void testGetAllPaginatedContents() throws Exception {
+ UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
+ String accessToken = mockOAuthInterceptor(user);
+ this.executeTestGetAllPaginatedContents(accessToken, IContentService.STATUS_DRAFT, 25);
+ this.executeTestGetAllPaginatedContents(accessToken, IContentService.STATUS_ONLINE, 24);
+ }
+
+ void executeTestGetAllPaginatedContents(String accessToken, String status, int expected) throws Exception {
+ ResultActions result = mockMvc
+ .perform(get("/plugins/cms/contents?page=1&pageSize=100")
+ .param("sort", IContentManager.CONTENT_CREATION_DATE_FILTER_KEY)
+ .param("direction", FieldSearchFilter.DESC_ORDER)
+ .param("status", status)
+ .header("Authorization", "Bearer " + accessToken));
+ String bodyResult = result.andReturn().getResponse().getContentAsString();
+ Integer payloadSize = JsonPath.read(bodyResult, "$.payload.size()");
+ Assertions.assertEquals(expected, payloadSize.intValue());
+ result.andExpect(status().isOk());
+ result.andExpect(jsonPath("$.metaData.totalItems", is(payloadSize)));
+ }
+
@Test
- void testGetContentsPaginated() throws Exception {
+ void testGetEvnContentsPaginated() throws Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
ResultActions result = mockMvc
@@ -2662,9 +2698,7 @@ void testGetContentsPaginated() throws Exception {
.param("filter[0].operator", "eq")
.param("filter[0].value", "EVN")
.header("Authorization", "Bearer " + accessToken));
- result
- .andDo(resultPrint())
- .andExpect(status().isOk())
+ result.andExpect(status().isOk())
.andExpect(jsonPath("$.payload.size()", is(2)))
.andExpect(jsonPath("$.metaData.page", is(1)))
.andExpect(jsonPath("$.metaData.pageSize", is(2)))
@@ -5029,4 +5063,45 @@ accessToken, status().isOk()) :
}
}
+ @Test
+ void testGetImageAttributeWithMetadata() throws Exception {
+ String newContentId = null;
+ String accessToken = this.createAccessToken();
+ try {
+ Content content = this.contentManager.loadContent("ART1", true);
+ content.setId(null);
+ ImageAttribute picture = (ImageAttribute) content.getAttribute("Foto");
+ picture.setMetadata(IResourceManager.ALT_METADATA_KEY, "it", "Alt ita Value");
+ picture.setMetadata(IResourceManager.LEGEND_METADATA_KEY, "it", "Legend Ita Value");
+ newContentId = this.contentManager.addContent(content);
+ this.contentManager.insertOnLineContent(content);
+ Content addedContent = this.contentManager.loadContent(newContentId, true);
+ ImageAttribute addedPicture = (ImageAttribute) addedContent.getAttribute("Foto");
+ Assertions.assertEquals("Alt ita Value", addedPicture.getResourceAltForLang("it"));
+ Assertions.assertEquals("Legend Ita Value", addedPicture.getResourceLegendForLang("it"));
+ ResultActions result = mockMvc
+ .perform(get("/plugins/cms/contents/{code}", newContentId)
+ .param("status", IContentService.STATUS_DRAFT)
+ .header("Authorization", "Bearer " + accessToken));
+ String bodyResult = result.andReturn().getResponse().getContentAsString();
+ result.andExpect(jsonPath("$.payload.size()", is(20)))
+ .andExpect(jsonPath("$.errors.size()", is(0)))
+ .andExpect(jsonPath("$.metaData.size()", is(0)))
+ .andExpect(jsonPath("$.payload.id", is(newContentId)));
+ int attributeSize = JsonPath.read(bodyResult, "$.payload.attributes.size()");
+ Assertions.assertEquals(7, attributeSize);
+ for (int i = 0; i < attributeSize; i++) {
+ String attributeName = JsonPath.read(bodyResult, "$.payload.attributes[" + i + "].code");
+ if (attributeName.equals("Foto")) {
+ result.andExpect(jsonPath("$.payload.attributes[" + i + "].values.it.metadata.legend", is("Legend Ita Value")));
+ result.andExpect(jsonPath("$.payload.attributes[" + i + "].values.it.metadata.alt", is("Alt ita Value")));
+ }
+ }
+ } finally {
+ Content onlineContent = this.contentManager.loadContent(newContentId, false);
+ this.contentManager.removeOnLineContent(onlineContent);
+ this.contentManager.deleteContent(newContentId);
+ }
+ }
+
}
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerTest.java b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerTest.java
index b11ccad1c9..3ee44c4b95 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerTest.java
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/content/ContentControllerTest.java
@@ -13,6 +13,8 @@
*/
package org.entando.entando.plugins.jacms.web.content;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
@@ -30,6 +32,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -38,6 +42,7 @@
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.validation.BindingResult;
+import org.springframework.validation.Errors;
@ExtendWith(MockitoExtension.class)
class ContentControllerTest extends AbstractControllerTest {
@@ -93,7 +98,6 @@ void testAddContent() throws Exception {
ResultActions result = this.performPostContent(mockJson, user);
result.andExpect(status().isOk());
}
-
@Test
void testUpdateContent() throws Exception {
UserDetails user = this.createUser(true);
@@ -110,6 +114,27 @@ void testUpdateContent() throws Exception {
result.andExpect(status().isOk());
}
+ @Test
+ void shouldReturn422OnInvalidTypeCode() throws Exception {
+ UserDetails user = this.createUser(true);
+
+ doAnswer(invocation -> {
+ Errors errors = invocation.getArgument(1);
+ errors.reject("5", "entity.typeCode.invalid");
+ return null;
+ }).when(contentValidator).validateTypeCode(any(), any(Errors.class));
+
+ String mockJson = "[{\n"
+ + " \"id\": \"ART123\",\n"
+ + " \"typeCode\": \"XXX\",\n"
+ + " \"attributes\": [\n"
+ + " {\"code\": \"code1\", \"value\": \"value1\"},\n"
+ + " {\"code\": \"code2\", \"value\": \"value2\"}\n"
+ + " ]}]";
+ ResultActions result = this.performPostContent(mockJson, user);
+ result.andExpect(status().isUnprocessableEntity());
+ }
+
private ResultActions performGetContent(String code, String modelId,
boolean online, String langCode, UserDetails user) throws Exception {
String accessToken = mockOAuthInterceptor(user);
diff --git a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/resource/ResourcesControllerIntegrationTest.java b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/resource/ResourcesControllerIntegrationTest.java
index bfd272cb33..a31b5d20e5 100644
--- a/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/resource/ResourcesControllerIntegrationTest.java
+++ b/cms-plugin/src/test/java/org/entando/entando/plugins/jacms/web/resource/ResourcesControllerIntegrationTest.java
@@ -55,6 +55,7 @@
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import com.agiletec.aps.system.services.category.Category;
+import com.agiletec.plugins.jacms.aps.system.services.resource.IResourceManager;
import org.junit.jupiter.api.Test;
class ResourcesControllerIntegrationTest extends AbstractControllerIntegrationTest {
@@ -71,6 +72,9 @@ class ResourcesControllerIntegrationTest extends AbstractControllerIntegrationTe
@Autowired
private ResourcesService resourcesService;
+ @Autowired
+ private IResourceManager resourceManager;
+
private static final ObjectMapper MAPPER = new ObjectMapper();
private DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH.mm.ss");
@@ -1096,7 +1100,6 @@ void testCreateFileResourceWithInvalidMimeType() throws Exception {
.andExpect(jsonPath("$.errors.size()", is(1)))
.andExpect(jsonPath("$.errors[0].code", is("4")))
.andExpect(jsonPath("$.errors[0].message", is("File type not allowed")));
-
performGetResources(user, "file", null)
.andDo(resultPrint())
.andExpect(status().isOk());
@@ -1107,10 +1110,8 @@ void testCreateCloneDeleteFileResource() throws Exception {
UserDetails user = createAccessToken();
String createdId = null;
String clonedId = null;
-
try {
ResultActions result = performCreateResource(user, "file", "free", Arrays.stream(new String[]{"resCat1", "resCat2"}).collect(Collectors.toList()), "application/pdf")
- .andDo(resultPrint())
.andExpect(status().isOk())
.andExpect(jsonPath("$.payload.id", Matchers.anything()))
.andExpect(jsonPath("$.payload.categories.size()", is(2)))
@@ -1120,11 +1121,9 @@ void testCreateCloneDeleteFileResource() throws Exception {
.andExpect(jsonPath("$.payload.description", is("file_test.jpeg")))
.andExpect(jsonPath("$.payload.size", is("2 Kb")))
.andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/file_test")));
-
createdId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
-
+
ResultActions result2 = performCloneResource(user, createdId)
- .andDo(resultPrint())
.andExpect(status().isOk())
.andExpect(jsonPath("$.payload.id", not(createdId)))
.andExpect(jsonPath("$.payload.categories.size()", is(2)))
@@ -1134,9 +1133,7 @@ void testCreateCloneDeleteFileResource() throws Exception {
.andExpect(jsonPath("$.payload.description", is("file_test.jpeg")))
.andExpect(jsonPath("$.payload.size", is("2 Kb")))
.andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/file_test")));
-
clonedId = JsonPath.read(result2.andReturn().getResponse().getContentAsString(), "$.payload.id");
-
} finally {
if (clonedId != null) {
performDeleteResource(user, "file", clonedId)
@@ -1148,8 +1145,9 @@ void testCreateCloneDeleteFileResource() throws Exception {
.andDo(resultPrint())
.andExpect(status().isOk());
}
- performGetResources(user, "file", null)
- .andDo(resultPrint())
+ Assertions.assertNull(this.resourceManager.loadResource(clonedId));
+ Assertions.assertNull(this.resourceManager.loadResource(createdId));
+ this.performGetResources(user, "file", null)
.andExpect(status().isOk())
.andExpect(jsonPath("$.payload.size()", is(2)));
}
@@ -1599,7 +1597,7 @@ void testCreateDeleteImageResourceWithPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/abc/image_test")));
createdId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1644,7 +1642,7 @@ void testCreateEditDeleteImageResourceWithPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is("abc")))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/abc/image_test")));
createdId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1661,7 +1659,7 @@ void testCreateEditDeleteImageResourceWithPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is("abcd")))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/abcd/image_test")));
} finally {
@@ -1705,7 +1703,7 @@ void testCreateCloneDeleteImageResourceWithPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/folderPath123/image_test")));
createdId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1722,7 +1720,7 @@ void testCreateCloneDeleteImageResourceWithPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/folderPath123/image_test")));
clonedId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1777,7 +1775,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
String createdId5 = null;
try {
-
+
String type = "image";
String group = "free";
String folderPath = null;
@@ -1798,9 +1796,9 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
.andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
-
+
createdId = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
-
+
performGetResourcesFolder(user, folderPath)
.andDo(resultPrint())
.andExpect(status().isOk())
@@ -1809,7 +1807,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.metaData.subfolders.size()", is(0)));
folderPath = "abc";
-
+
result = performCreateResource(user, type, group, categories, folderPath, mimeType)
.andDo(resultPrint())
.andExpect(status().isOk())
@@ -1823,7 +1821,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
.andExpect(jsonPath("$.payload.versions.size()", is(4)))
.andExpect(jsonPath("$.payload.versions[0].size", is("2 Kb")))
- .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/image_test")));
+ .andExpect(jsonPath("$.payload.versions[0].path", startsWith("/Entando/resources/cms/images/abc/image_test")));
createdId2 = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1857,7 +1855,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.payload.description", is("file_test.jpeg")))
.andExpect(jsonPath("$.payload.owner", is("jack_bauer")))
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
- .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/file_test")));
+ .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/abc/def/file_test")));
createdId3 = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1897,7 +1895,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.payload.description", is("file_test.jpeg")))
.andExpect(jsonPath("$.payload.owner", is("jack_bauer")))
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
- .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/file_test")));
+ .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/abc/ghi/file_test")));
createdId4 = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1938,7 +1936,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.payload.description", is("file_test.jpeg")))
.andExpect(jsonPath("$.payload.owner", is("jack_bauer")))
.andExpect(jsonPath("$.payload.folderPath", is(folderPath)))
- .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/file_test")));
+ .andExpect(jsonPath("$.payload.path", startsWith("/Entando/resources/cms/documents/abc/def/ghi/file_test")));
createdId5 = JsonPath.read(result.andReturn().getResponse().getContentAsString(), "$.payload.id");
@@ -1973,7 +1971,7 @@ void testSubfoldersOnListAssetsFolderPath() throws Exception {
.andExpect(jsonPath("$.metaData.folderPath", is("abc/def")))
.andExpect(jsonPath("$.metaData.subfolders.size()", is(1)))
.andExpect(jsonPath("$.metaData.subfolders[0]", is("abc/def/ghi")));
-
+
} finally {
if (createdId5 != null) {
diff --git a/contentscheduler-plugin/pom.xml b/contentscheduler-plugin/pom.xml
index 647c48cae2..ea81e3d2cb 100644
--- a/contentscheduler-plugin/pom.xml
+++ b/contentscheduler-plugin/pom.xml
@@ -4,7 +4,7 @@
org.entando
app-engine
- 7.3.0
+ 7.3.1
entando-plugin-jpcontentscheduler
org.entando.entando.plugins
diff --git a/engine/pom.xml b/engine/pom.xml
index eb7b506457..cf0ec487bb 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -4,7 +4,7 @@
org.entando
app-engine
- 7.3.0
+ 7.3.1
org.entando.entando
entando-engine
@@ -500,6 +500,10 @@
org.junit.jupiter
junit-jupiter-api
+
+ uk.org.webcompere
+ system-stubs-jupiter
+
org.mockito
mockito-core
diff --git a/engine/src/main/java/com/agiletec/aps/system/SystemConstants.java b/engine/src/main/java/com/agiletec/aps/system/SystemConstants.java
index 9f02747047..5d070030ba 100644
--- a/engine/src/main/java/com/agiletec/aps/system/SystemConstants.java
+++ b/engine/src/main/java/com/agiletec/aps/system/SystemConstants.java
@@ -13,12 +13,9 @@
*/
package com.agiletec.aps.system;
-import com.agiletec.aps.system.services.page.IPageManager;
-import com.agiletec.aps.system.services.user.IUserManager;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
-import org.entando.entando.aps.system.services.guifragment.IGuiFragmentManager;
/**
* Interfaccia con le principali costanti di sistema.
@@ -299,11 +296,6 @@ private SystemConstants(){}
public static final String USER_PROFILE_ATTRIBUTE_DISABLING_CODE_ON_EDIT = "userprofile:onEdit";
- /**
- * The name of the role for attribute attribute that contains the profile picture file name
- */
- public static final String USER_PROFILE_ATTRIBUTE_ROLE_PROFILE_PICTURE = "userprofile:profilepicture";
-
public static final String ENTANDO_THREAD_NAME_PREFIX = "EntandoThread_";
public static final String API_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
diff --git a/engine/src/main/java/com/agiletec/aps/system/services/category/CategoryUtilizer.java b/engine/src/main/java/com/agiletec/aps/system/services/category/CategoryUtilizer.java
index 77bb00ec17..318f1edc19 100644
--- a/engine/src/main/java/com/agiletec/aps/system/services/category/CategoryUtilizer.java
+++ b/engine/src/main/java/com/agiletec/aps/system/services/category/CategoryUtilizer.java
@@ -23,7 +23,7 @@
*
* @author E.Santoboni
*/
-public interface CategoryUtilizer {
+public interface CategoryUtilizer {
/**
* Restituisce l'identificativo del servizio utilizzatore.
@@ -41,7 +41,7 @@ public interface CategoryUtilizer {
* dal codice specificato.
* @throws EntException In caso di errore.
*/
- public List getCategoryUtilizers(String categoryCode) throws EntException;
+ public List getCategoryUtilizers(String categoryCode) throws EntException;
/**
* Reload the category references.
@@ -64,6 +64,6 @@ public interface CategoryUtilizer {
* @return
* @throws EntException In case of error
*/
- public List getCategoryUtilizersForReloadReferences(String categoryCode) throws EntException;
+ public List getCategoryUtilizersForReloadReferences(String categoryCode) throws EntException;
}
diff --git a/engine/src/main/java/com/agiletec/aps/system/services/lang/LangManager.java b/engine/src/main/java/com/agiletec/aps/system/services/lang/LangManager.java
index c166b84a7d..74cac9b3a6 100644
--- a/engine/src/main/java/com/agiletec/aps/system/services/lang/LangManager.java
+++ b/engine/src/main/java/com/agiletec/aps/system/services/lang/LangManager.java
@@ -57,7 +57,8 @@ public void init() throws Exception {
@Override
public void initTenantAware() throws Exception {
String xmlConfig = this.getConfigManager().getConfigItem(SystemConstants.CONFIG_ITEM_LANGS);
- this.getCacheWrapper().initCache(xmlConfig);
+ List assignableLanguages = getAssignableLangs();
+ this.getCacheWrapper().initCache(xmlConfig, assignableLanguages);
}
/**
diff --git a/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/ILangManagerCacheWrapper.java b/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/ILangManagerCacheWrapper.java
index 3f3ae93471..8766e297ae 100644
--- a/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/ILangManagerCacheWrapper.java
+++ b/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/ILangManagerCacheWrapper.java
@@ -13,9 +13,9 @@
*/
package com.agiletec.aps.system.services.lang.cache;
-import org.entando.entando.ent.exception.EntException;
import com.agiletec.aps.system.services.lang.Lang;
import java.util.List;
+import org.entando.entando.ent.exception.EntException;
/**
* @author E.Santoboni
@@ -28,7 +28,7 @@ public interface ILangManagerCacheWrapper {
public static final String LANG_CODES_CACHE_NAME = "LangManager_codes";
public static final String LANG_DEFAULT_CACHE_NAME = "LangManager_default";
- public void initCache(String xmlConfig) throws EntException;
+ void initCache(String xmlConfig, List assignableLanguages) throws EntException;
public List getLangs();
diff --git a/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/LangManagerCacheWrapper.java b/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/LangManagerCacheWrapper.java
index 4e6eefb3b8..b151e69357 100644
--- a/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/LangManagerCacheWrapper.java
+++ b/engine/src/main/java/com/agiletec/aps/system/services/lang/cache/LangManagerCacheWrapper.java
@@ -16,6 +16,8 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.springframework.cache.Cache;
@@ -35,13 +37,17 @@ public class LangManagerCacheWrapper extends AbstractGenericCacheWrapper i
private static final EntLogger logger = EntLogFactory.getSanitizedLogger(LangManagerCacheWrapper.class);
@Override
- public void initCache(String xmlConfig) throws EntException {
+ public void initCache(String xmlConfig, List assignableLanguages) throws EntException {
try {
Cache cache = this.getCache();
LangDOM langDom = new LangDOM(xmlConfig);
Map langMap = new HashMap<>();
List systemLangs = langDom.getLangs();
+ // Builds a map of assignable languages in order to speed up the search by language code
+ Map assignableLangMap = computeAssignableLangMap(assignableLanguages);
for (Lang lang : systemLangs) {
+ // replace custom description with the official one from ISO 639-1
+ replaceDescription(assignableLangMap, lang);
if (lang.isDefault()) {
cache.put(LANG_DEFAULT_CACHE_NAME, lang);
}
@@ -112,4 +118,14 @@ protected String getCacheName() {
return LANG_MANAGER_CACHE_NAME;
}
+ private static Map computeAssignableLangMap(List assignableLanguages) {
+ return assignableLanguages.stream()
+ .collect(Collectors.toMap(Lang::getCode, Function.identity()));
+ }
+
+ private static void replaceDescription(Map assignableLangMap, Lang lang) {
+ if (assignableLangMap.containsKey(lang.getCode())) {
+ lang.setDescr(assignableLangMap.get(lang.getCode()).getDescr());
+ }
+ }
}
diff --git a/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseManager.java b/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseManager.java
index ed6e1af35e..af843252d8 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseManager.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseManager.java
@@ -70,6 +70,7 @@
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.springframework.beans.factory.ListableBeanFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.web.context.ServletContextAware;
@@ -96,6 +97,9 @@ public class DatabaseManager extends AbstractInitializerManager
private int lockFallbackMinutes;
private ServletContext servletContext;
+
+ @Autowired
+ private ITenantManager tenantManager;
public void init() {
logger.debug("DatabaseManager ready");
@@ -568,7 +572,7 @@ public boolean dropAndRestoreBackup(String subFolderName) throws EntException {
return false;
}
//TODO future improvement - execute 'lifeline' backup
- this.getDatabaseRestorer().dropAndRestoreBackup(subFolderName);
+ this.getDatabaseRestorer().dropAndRestoreBackup(subFolderName, this.tenantManager);
ApsWebApplicationUtils.executeSystemRefresh(this.getServletContext());
return true;
} catch (Throwable t) {
@@ -586,7 +590,7 @@ private boolean restoreBackup(String subFolderName) throws EntException {
logger.error("backup not available - subfolder '{}'", subFolderName);
return false;
}
- this.getDatabaseRestorer().restoreBackup(subFolderName);
+ this.getDatabaseRestorer().restoreBackup(subFolderName, this.tenantManager);
return true;
} catch (Throwable t) {
logger.error("Error while restoring local backup", t);
@@ -594,10 +598,16 @@ private boolean restoreBackup(String subFolderName) throws EntException {
}
}
- private String[] extractBeanNames(Class beanClass) {
+ private String[] extractBeanNames(Class> beanClass) {
ListableBeanFactory factory = (ListableBeanFactory) this.getBeanFactory();
return factory.getBeanNamesForType(beanClass);
}
+
+
+
+
+
+
@Override
public InputStream getTableDump(String tableName, String dataSourceName, String subFolderName) throws EntException {
diff --git a/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseRestorer.java b/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseRestorer.java
index 5d127bb04e..94963851dd 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseRestorer.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/init/DatabaseRestorer.java
@@ -13,6 +13,7 @@
*/
package org.entando.entando.aps.system.init;
+import com.agiletec.aps.util.ApsTenantApplicationUtils;
import org.entando.entando.ent.exception.EntException;
import com.agiletec.aps.util.FileTextReader;
@@ -26,6 +27,7 @@
import org.entando.entando.aps.system.init.model.Component;
import org.entando.entando.aps.system.init.util.QueryExtractor;
import org.entando.entando.aps.system.init.util.TableDataUtils;
+import org.entando.entando.aps.system.services.tenants.ITenantManager;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
@@ -50,22 +52,24 @@ protected void initOracleSchema(DataSource dataSource) throws Throwable {
}
}
- protected void dropAndRestoreBackup(String backupSubFolder) throws EntException {
+ protected void dropAndRestoreBackup(String backupSubFolder,
+ ITenantManager tenantManager) throws EntException {
try {
List components = this.getComponents();
int size = components.size();
for (int i = 0; i < components.size(); i++) {
Component componentConfiguration = components.get(size - i - 1);
- this.dropTables(componentConfiguration.getTableNames());
+ this.dropTables(componentConfiguration.getTableNames(), tenantManager);
}
- this.restoreBackup(backupSubFolder);
+ this.restoreBackup(backupSubFolder, tenantManager);
} catch (Throwable t) {
_logger.error("Error while restoring backup: {}", backupSubFolder, t);
throw new EntException("Error while restoring backup", t);
}
}
- private void dropTables(Map> tableMapping) throws EntException {
+ private void dropTables(Map> tableMapping,
+ ITenantManager tenantManager) throws EntException {
if (null == tableMapping) {
return;
}
@@ -77,7 +81,7 @@ private void dropTables(Map> tableMapping) throws EntExcept
if (null == tableNames || tableNames.isEmpty()) {
continue;
}
- DataSource dataSource = (DataSource) this.getBeanFactory().getBean(dataSourceName);
+ DataSource dataSource = this.fetchDataSource(dataSourceName, tenantManager);
int size = tableNames.size();
for (int j = 0; j < tableNames.size(); j++) {
String tableName = tableNames.get(size - j - 1);
@@ -91,49 +95,54 @@ private void dropTables(Map> tableMapping) throws EntExcept
}
}
- protected void restoreBackup(String backupSubFolder) throws EntException {
+ protected void restoreBackup(String backupSubFolder,
+ ITenantManager tenantManager) throws EntException {
try {
List components = this.getComponents();
for (int i = 0; i < components.size(); i++) {
Component componentConfiguration = components.get(i);
- this.restoreLocalDump(componentConfiguration.getTableNames(), backupSubFolder);
+ this.restoreLocalDump(componentConfiguration.getTableNames(), backupSubFolder, tenantManager);
}
} catch (Throwable t) {
_logger.error("Error while restoring local backup", t);
throw new EntException("Error while restoring local backup", t);
}
}
-
- private void restoreLocalDump(Map> tableMapping, String backupSubFolder) throws EntException {
+
+ private void restoreLocalDump(Map> tableMapping,
+ String backupSubFolder, ITenantManager tenantManager) throws EntException {
if (null == tableMapping) {
return;
}
try {
- StringBuilder folder = new StringBuilder(this.getLocalBackupsFolder())
- .append(backupSubFolder).append(File.separator);
+ String folder = this.getLocalBackupsFolder() + backupSubFolder + File.separator;
String[] dataSourceNames = this.extractBeanNames(DataSource.class);
- for (int i = 0; i < dataSourceNames.length; i++) {
- String dataSourceName = dataSourceNames[i];
- List tableNames = tableMapping.get(dataSourceName);
- if (null == tableNames || tableNames.isEmpty()) {
- continue;
- }
- DataSource dataSource = (DataSource) this.getBeanFactory().getBean(dataSourceName);
- this.initOracleSchema(dataSource);
- for (int j = 0; j < tableNames.size(); j++) {
- String tableName = tableNames.get(j);
- String fileName = folder.toString() + dataSourceName + File.separator + tableName + ".sql";
- InputStream is = this.getStorageManager().getStream(fileName, true);
- if (null != is) {
- this.restoreTableData(is, dataSource);
- }
- }
- }
+ for (String dataSourceName : dataSourceNames) {
+ List tableNames = tableMapping.get(dataSourceName);
+ if (null == tableNames || tableNames.isEmpty()) {
+ continue;
+ }
+ DataSource dataSource = this.fetchDataSource(dataSourceName, tenantManager);
+ this.initOracleSchema(dataSource);
+ for (int j = 0; j < tableNames.size(); j++) {
+ String tableName = tableNames.get(j);
+ String fileName = folder + dataSourceName + File.separator + tableName + ".sql";
+ InputStream is = this.getStorageManager().getStream(fileName, true);
+ if (null != is) {
+ this.restoreTableData(is, dataSource);
+ }
+ }
+ }
} catch (Throwable t) {
_logger.error("Error while restoring local dump", t);
throw new RuntimeException("Error while restoring local dump", t);
}
}
+
+ private DataSource fetchDataSource(String dataSourceName, ITenantManager tenantManager) {
+ return ApsTenantApplicationUtils.getTenant().map(tenantManager::getDatasource)
+ .orElse((DataSource) this.getBeanFactory().getBean(dataSourceName));
+ }
private void restoreTableData(InputStream is, DataSource dataSource) {
try {
diff --git a/engine/src/main/java/org/entando/entando/aps/system/services/cache/CacheInfoManager.java b/engine/src/main/java/org/entando/entando/aps/system/services/cache/CacheInfoManager.java
index 4d61f984ef..a58a1e9a6c 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/services/cache/CacheInfoManager.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/services/cache/CacheInfoManager.java
@@ -137,70 +137,58 @@ public void putInCache(String targetCache, String key, Object obj) {
Cache cache = this.getCache(targetCache);
cache.put(key, obj);
}
+
@Override
public void putInCache(String targetCache, String key, Object obj, String[] groups) {
- Cache cache = this.getCache(targetCache);
- cache.put(key, obj);
- this.accessOnGroupMapping(targetCache, 1, groups, key);
+ this.putInCache(targetCache, key, obj);
+ this.accessOnGroupMapping(targetCache, true, groups, key);
}
@Override
public void putInGroup(String targetCache, String key, String[] groups) {
- this.accessOnGroupMapping(targetCache, 1, groups, key);
+ this.accessOnGroupMapping(targetCache, true, groups, key);
}
@Override
public void flushGroup(String targetCache, String group) {
String[] groups = {group};
- this.accessOnGroupMapping(targetCache, -1, groups, null);
+ this.accessOnGroupMapping(targetCache, false, groups, null);
}
-
- protected synchronized void accessOnGroupMapping(String targetCache, int operationId, String[] groups, String key) {
+
+ protected synchronized void accessOnGroupMapping(String targetCache, boolean addInGroup, String[] groups, String key) {
Cache cache = this.getCache(CACHE_INFO_MANAGER_CACHE_NAME);
- Map> objectsByGroup = this.get(cache, GROUP_CACHE_NAME_PREFIX + targetCache, Map.class);
- if (objectsByGroup != null) {
- objectsByGroup = new HashMap<>(objectsByGroup);
+ if (groups == null) {
+ return;
}
- boolean updateMapInCache = false;
- if (operationId > 0) {
- //add
- if (null == objectsByGroup) {
- objectsByGroup = new HashMap<>();
- }
- for (String group : groups) {
- List objectKeys = objectsByGroup.get(group);
- if (null == objectKeys) {
- objectKeys = new ArrayList<>();
- objectsByGroup.put(group, objectKeys);
+ for (String group : groups) {
+ String groupKey = GROUP_CACHE_NAME_PREFIX + targetCache + "__GR__" + group;
+ List keysByGroup = this.get(cache, groupKey, List.class);
+ if (addInGroup) {
+ if (null == keysByGroup) {
+ keysByGroup = new ArrayList<>();
}
- if (!objectKeys.contains(key)) {
- objectKeys.add(key);
- updateMapInCache = true;
+ boolean updateListInCache = false;
+ if (!keysByGroup.contains(key)) {
+ keysByGroup.add(key);
+ updateListInCache = true;
}
- }
- } else {
- //remove
- if (null == objectsByGroup) {
- return;
- }
- for (String group : groups) {
- List objectKeys = objectsByGroup.get(group);
- if (null != objectKeys) {
- for (String extractedKey : objectKeys) {
- this.flushEntry(targetCache, extractedKey);
- }
- objectsByGroup.remove(group);
- updateMapInCache = true;
+ if (updateListInCache) {
+ cache.put(groupKey, keysByGroup);
+ }
+ } else {
+ if (null == keysByGroup) {
+ continue;
+ }
+ for (String extractedKey : keysByGroup) {
+ this.flushEntry(targetCache, extractedKey);
}
+ cache.evict(groupKey);
}
}
- if (updateMapInCache) {
- cache.put(GROUP_CACHE_NAME_PREFIX + targetCache, objectsByGroup);
- }
}
-
+
protected Collection getCaches() {
- Collection caches = new ArrayList();
+ Collection caches = new ArrayList<>();
Iterator iter = this.getSpringCacheManager().getCacheNames().iterator();
while (iter.hasNext()) {
String cacheName = iter.next();
diff --git a/engine/src/main/java/org/entando/entando/aps/system/services/database/DatabaseService.java b/engine/src/main/java/org/entando/entando/aps/system/services/database/DatabaseService.java
index 57c797c24a..3c52cce826 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/services/database/DatabaseService.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/services/database/DatabaseService.java
@@ -38,6 +38,11 @@
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
+import lombok.AccessLevel;
+import lombok.Getter;
+import lombok.Setter;
+import org.entando.entando.web.common.exceptions.ValidationGenericException;
+import org.springframework.validation.BindException;
/**
* @author E.Santoboni
@@ -45,9 +50,15 @@
public class DatabaseService implements IDatabaseService {
private final EntLogger logger = EntLogFactory.getSanitizedLogger(this.getClass());
+
+ private static final String REPORT_CODE_FIELD_NAME = "reportCode";
+ @Getter(AccessLevel.PROTECTED)@Setter
private IDatabaseManager databaseManager;
+ @Getter(AccessLevel.PROTECTED)@Setter
private IComponentManager componentManager;
+ @Getter(AccessLevel.PROTECTED)@Setter
+ private boolean restoreEnabled;
@Override
public int getStatus() {
@@ -82,7 +93,7 @@ public DumpReportDto getDumpReportDto(String reportCode) {
DataSourceDumpReport report = this.getDatabaseManager().getBackupReport(reportCode);
if (null == report) {
logger.warn("no dump found with code {}", reportCode);
- throw new ResourceNotFoundException(DatabaseValidator.ERRCODE_NO_DUMP_FOUND, "reportCode", reportCode);
+ throw new ResourceNotFoundException(DatabaseValidator.ERRCODE_NO_DUMP_FOUND, REPORT_CODE_FIELD_NAME, reportCode);
}
dtos = new DumpReportDto(report, this.getComponentManager());
} catch (ResourceNotFoundException r) {
@@ -121,17 +132,22 @@ public void startDatabaseBackup() {
throw new RestServerError("error starting backup", t);
}
}
-
+
@Override
public void startDatabaseRestore(String reportCode) {
try {
+ if (!this.isRestoreEnabled()) {
+ BindException bindException = new BindException(this, REPORT_CODE_FIELD_NAME);
+ bindException.reject(DatabaseValidator.ERRCODE_RESTORE_NO_ACTIVE, new String[]{}, "database.restore.disabled");
+ throw new ValidationGenericException(bindException);
+ }
DataSourceDumpReport report = this.getDatabaseManager().getBackupReport(reportCode);
if (null == report) {
logger.warn("no dump found with code {}", reportCode);
- throw new ResourceNotFoundException(DatabaseValidator.ERRCODE_NO_DUMP_FOUND, "reportCode", reportCode);
+ throw new ResourceNotFoundException(DatabaseValidator.ERRCODE_NO_DUMP_FOUND, REPORT_CODE_FIELD_NAME, reportCode);
}
this.getDatabaseManager().dropAndRestoreBackup(reportCode);
- } catch (ResourceNotFoundException r) {
+ } catch (ValidationGenericException | ResourceNotFoundException r) {
throw r;
} catch (Throwable t) {
logger.error("error starting restore", t);
@@ -173,20 +189,4 @@ public byte[] getTableDump(String reportCode, String dataSource, String tableNam
return bytes;
}
- public IDatabaseManager getDatabaseManager() {
- return databaseManager;
- }
-
- public void setDatabaseManager(IDatabaseManager databaseManager) {
- this.databaseManager = databaseManager;
- }
-
- public IComponentManager getComponentManager() {
- return componentManager;
- }
-
- public void setComponentManager(IComponentManager componentManager) {
- this.componentManager = componentManager;
- }
-
}
diff --git a/engine/src/main/java/org/entando/entando/aps/system/services/entity/model/EntityAttributeDto.java b/engine/src/main/java/org/entando/entando/aps/system/services/entity/model/EntityAttributeDto.java
index 4290bd2777..95c8ba2c0c 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/services/entity/model/EntityAttributeDto.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/services/entity/model/EntityAttributeDto.java
@@ -17,19 +17,17 @@
import com.agiletec.aps.system.common.entity.model.attribute.*;
import com.agiletec.aps.util.DateConverter;
import com.fasterxml.jackson.annotation.JsonProperty;
-import org.entando.entando.ent.util.EntLogging.EntLogFactory;
-import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.springframework.validation.BindingResult;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
+import org.entando.entando.aps.system.common.entity.model.attribute.EnumeratorMapAttribute;
/**
* @author E.Santoboni
*/
public class EntityAttributeDto {
- private final EntLogger logger = EntLogFactory.getSanitizedLogger(getClass());
private String code;
@@ -57,6 +55,9 @@ public EntityAttributeDto(AttributeInterface src) {
if (src.isSimple()) {
if ((value instanceof String) || (value instanceof Number)) {
this.setValue(value.toString());
+ if (EnumeratorMapAttribute.class.isAssignableFrom(src.getClass())) {
+ this.setValues(Map.of("mapKey", value, "mapValue", ((EnumeratorMapAttribute) src).getMapValue()));
+ }
} else if (value instanceof Boolean) {
this.setValue(value);
} else if (value instanceof Date) {
diff --git a/engine/src/main/java/org/entando/entando/aps/system/services/page/PageService.java b/engine/src/main/java/org/entando/entando/aps/system/services/page/PageService.java
index 29afe8e446..7d02dd0bf1 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/services/page/PageService.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/services/page/PageService.java
@@ -368,11 +368,13 @@ public PageDto updatePageStatus(String pageCode, String status) {
try {
IPage newPage = null;
if (status.equals(STATUS_ONLINE)) {
- IPage publicParent = this.getPageManager().getOnlinePage(currentPage.getParentCode());
- if (null == publicParent) {
- bindingResult.reject(PageValidator.ERRCODE_PAGE_WITH_NO_PUBLIC_PARENT,
- new String[]{pageCode, currentPage.getParentCode()}, "page.status.parent.unpublished");
- throw new ValidationGenericException(bindingResult);
+ if (!currentPage.isRoot()) {
+ IPage publicParent = this.getPageManager().getOnlinePage(currentPage.getParentCode());
+ if (null == publicParent) {
+ bindingResult.reject(PageValidator.ERRCODE_PAGE_WITH_NO_PUBLIC_PARENT,
+ new String[]{pageCode, currentPage.getParentCode()}, "page.status.parent.unpublished");
+ throw new ValidationGenericException(bindingResult);
+ }
}
this.getPageManager().setPageOnline(pageCode);
newPage = this.getPageManager().getOnlinePage(pageCode);
diff --git a/engine/src/main/java/org/entando/entando/aps/system/services/page/serializer/WidgetConfigPropertiesSerializer.java b/engine/src/main/java/org/entando/entando/aps/system/services/page/serializer/WidgetConfigPropertiesSerializer.java
index f7bd3c88dc..ca093bf2f4 100644
--- a/engine/src/main/java/org/entando/entando/aps/system/services/page/serializer/WidgetConfigPropertiesSerializer.java
+++ b/engine/src/main/java/org/entando/entando/aps/system/services/page/serializer/WidgetConfigPropertiesSerializer.java
@@ -13,6 +13,7 @@
import java.util.Map.Entry;
import java.util.Optional;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
@@ -136,36 +137,30 @@ private List