From 7e007bf3e87b66e0b7eaa061c3066abb8792a416 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Tue, 29 Oct 2024 18:12:27 +0100 Subject: [PATCH] fix: Adapt Portal MOP Services API changes - MEED-7663 - Meeds-io/MIPs#165 --- .../portal/clouddrive/navigation.xml | 1 - .../wcm/webui/search/UISearchForm.java | 4 +- .../fckeditor/PortalLinkConnector.java | 44 ++--- .../conf/wcm-core/wcm-configuration.xml | 6 +- .../ui/UIPublicationPagesContainer.java | 4 +- .../wcm/test-publication-configuration.xml | 10 -- .../wcm/publication/PublicationUtil.java | 4 +- .../publication/DumpPublicationPlugin.java | 4 +- .../TestWCMPublicationService.java | 20 +-- .../wcm/test-publication-configuration.xml | 16 +- .../DocumentSearchServiceConnector.java | 12 +- .../wcm/search/DumpPublicationPlugin.java | 4 +- .../wcm/search/TestSearchService.java | 18 +- .../conf/wcm/test-search-configuration.xml | 6 +- .../impl/LivePortalManagerServiceImpl.java | 9 +- .../conf/standalone/wcm-configuration.xml | 6 +- .../portal/template/empty/navigation.xml | 5 - .../SpaceCustomizationService.java | 167 +++--------------- .../authoring/AuthoringPublicationPlugin.java | 4 +- .../TestWCMPublicationService.java | 26 ++- .../wcm/test-publication-configuration.xml | 10 -- .../conf/portal/portal/classic/navigation.xml | 5 - 22 files changed, 109 insertions(+), 276 deletions(-) diff --git a/apps/portlet-clouddrives/src/main/webapp/WEB-INF/conf/clouddrive/portal/clouddrive/navigation.xml b/apps/portlet-clouddrives/src/main/webapp/WEB-INF/conf/clouddrive/portal/clouddrive/navigation.xml index 1d57fbabfc9..a628b7caaf4 100644 --- a/apps/portlet-clouddrives/src/main/webapp/WEB-INF/conf/clouddrive/portal/clouddrive/navigation.xml +++ b/apps/portlet-clouddrives/src/main/webapp/WEB-INF/conf/clouddrive/portal/clouddrive/navigation.xml @@ -25,7 +25,6 @@ 1 - home home portal::clouddrive::homepage diff --git a/apps/portlet-search/src/main/java/org/exoplatform/wcm/webui/search/UISearchForm.java b/apps/portlet-search/src/main/java/org/exoplatform/wcm/webui/search/UISearchForm.java index 27d8eb02e5a..dc0133093dc 100644 --- a/apps/portlet-search/src/main/java/org/exoplatform/wcm/webui/search/UISearchForm.java +++ b/apps/portlet-search/src/main/java/org/exoplatform/wcm/webui/search/UISearchForm.java @@ -18,7 +18,7 @@ import javax.portlet.PortletPreferences; import org.exoplatform.portal.application.PortalRequestContext; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.model.PortalConfig; import org.exoplatform.portal.webui.util.Util; @@ -170,7 +170,7 @@ public ResourceResolver getTemplateResourceResolver(WebuiRequestContext context, @SuppressWarnings("unchecked") private List getPortalList() throws Exception { List> portals = new ArrayList>(); - DataStorage service = getApplicationComponent(DataStorage.class); + LayoutService service = getApplicationComponent(LayoutService.class); Query query = new Query(null, null, null, null, PortalConfig.class); List list = service.find(query, null).getAll(); portals.add(new SelectItemOption(ALL_OPTION, ALL_OPTION)); diff --git a/core/connector/src/main/java/org/exoplatform/wcm/connector/fckeditor/PortalLinkConnector.java b/core/connector/src/main/java/org/exoplatform/wcm/connector/fckeditor/PortalLinkConnector.java index 54b07f8f5ca..a7367a1d2a0 100644 --- a/core/connector/src/main/java/org/exoplatform/wcm/connector/fckeditor/PortalLinkConnector.java +++ b/core/connector/src/main/java/org/exoplatform/wcm/connector/fckeditor/PortalLinkConnector.java @@ -43,7 +43,7 @@ import org.exoplatform.container.PortalContainer; import org.exoplatform.container.component.RequestLifeCycle; import org.exoplatform.container.xml.InitParams; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.UserACL; import org.exoplatform.portal.config.UserPortalConfig; @@ -67,29 +67,28 @@ * Returns a page URI for a given location. * * @LevelAPI Provisional - * * @anchor PortalLinkConnector */ @Path("/portalLinks/") public class PortalLinkConnector implements ResourceContainer { /** The RESOURC e_ type. */ - final private String RESOURCE_TYPE = "PortalPageURI"; + final private String RESOURCE_TYPE = "PortalPageURI"; /** The portal data storage. */ - private DataStorage portalDataStorage; + private LayoutService portalDataStorage; /** The portal user acl. */ - private UserACL portalUserACL; + private UserACL portalUserACL; /** The servlet context. */ - private ServletContext servletContext; + private ServletContext servletContext; /** The log. */ - private static final Log LOG = ExoLogger.getLogger(PortalLinkConnector.class.getName()); + private static final Log LOG = ExoLogger.getLogger(PortalLinkConnector.class.getName()); /** The Constant LAST_MODIFIED_PROPERTY. */ - private static final String LAST_MODIFIED_PROPERTY = "Last-Modified"; + private static final String LAST_MODIFIED_PROPERTY = "Last-Modified"; /** The Constant IF_MODIFIED_SINCE_DATE_FORMAT. */ private static final String IF_MODIFIED_SINCE_DATE_FORMAT = "EEE, dd MMM yyyy HH:mm:ss z"; @@ -101,13 +100,13 @@ public class PortalLinkConnector implements ResourceContainer { * @param dataStorage The data storage. * @param userACL The user ACL. * @param servletContext The servlet context. - * * @throws Exception the exception */ public PortalLinkConnector(InitParams params, - DataStorage dataStorage, + LayoutService dataStorage, UserACL userACL, - ServletContext servletContext) throws Exception { + ServletContext servletContext) + throws Exception { this.portalDataStorage = dataStorage; this.portalUserACL = userACL; this.servletContext = servletContext; @@ -121,15 +120,17 @@ public PortalLinkConnector(InitParams params, * @param type The file type. * @return The page URI. * @throws Exception The exception - * * @anchor PortalLinkConnector.getFoldersAndFiles */ @GET @Path("/getFoldersAndFiles/") // @OutputTransformer(XMLOutputTransformer.class) - public Response getPageURI(@QueryParam("currentFolder") String currentFolder, - @QueryParam("command") String command, - @QueryParam("type") String type) throws Exception { + public Response getPageURI(@QueryParam("currentFolder") + String currentFolder, + @QueryParam("command") + String command, + @QueryParam("type") + String type) throws Exception { try { String userId = getCurrentUser(); return buildReponse(currentFolder, command, userId); @@ -165,9 +166,7 @@ private String getCurrentUser() { * @param currentFolder The current folder. * @param command The command. * @param userId The user Id - * * @return the response - * * @throws Exception the exception */ private Response buildReponse(String currentFolder, String command, String userId) throws Exception { @@ -193,9 +192,7 @@ private Response buildReponse(String currentFolder, String command, String userI * @param currentFolder The current folder. * @param command The command. * @param userId The user Id. - * * @return The document - * * @throws Exception the exception */ private Document buildPortalXMLResponse(String currentFolder, String command, String userId) throws Exception { @@ -232,9 +229,7 @@ public int compare(PortalConfig pconfig1, PortalConfig pconfig2) { * @param currentFolder The current folder. * @param command The command. * @param userId The user Id. - * * @return The document. - * * @throws Exception the exception */ private Document buildNavigationXMLResponse(String currentFolder, String command, String userId) throws Exception { @@ -290,9 +285,7 @@ private Document buildNavigationXMLResponse(String currentFolder, String command * * @param commandStr The command str. * @param currentPath The current path. - * * @return The element. - * * @throws ParserConfigurationException the parser configuration exception */ private Element initRootElement(String commandStr, String currentPath) throws ParserConfigurationException { @@ -320,7 +313,6 @@ private Element initRootElement(String commandStr, String currentPath) throws Pa * @param filesElement * @param userId The user Id. * @param portalConfigService The portal config service. - * * @throws Exception the exception */ private void processPageNode(String portalName, @@ -333,8 +325,8 @@ private void processPageNode(String portalName, PageContext page = portalConfigService.getPage(pageRef); String pageUri = ""; if (page == null) { - pageUri = "/"; - Element folderElement = foldersElement.getOwnerDocument().createElement("Folder"); + pageUri = "/"; + Element folderElement = foldersElement.getOwnerDocument().createElement("Folder"); folderElement.setAttribute("name", userNode.getName()); folderElement.setAttribute("folderType", ""); folderElement.setAttribute("url", pageUri); diff --git a/core/core-configuration/src/main/webapp/WEB-INF/conf/wcm-core/wcm-configuration.xml b/core/core-configuration/src/main/webapp/WEB-INF/conf/wcm-core/wcm-configuration.xml index 61b4b7afe4f..27060f3cd6f 100644 --- a/core/core-configuration/src/main/webapp/WEB-INF/conf/wcm-core/wcm-configuration.xml +++ b/core/core-configuration/src/main/webapp/WEB-INF/conf/wcm-core/wcm-configuration.xml @@ -162,7 +162,7 @@ org.exoplatform.services.listener.ListenerService - org.exoplatform.portal.config.DataStorage.portalConfigCreated + org.exoplatform.portal.mop.service.LayoutService.portalConfigCreated addListener org.exoplatform.services.wcm.portal.listener.CreateLivePortalEventListener this listener create new live portal content storage @@ -174,13 +174,13 @@ - org.exoplatform.portal.config.DataStorage.portalConfigRemoved + org.exoplatform.portal.mop.service.LayoutService.portalConfigRemoved addListener org.exoplatform.services.wcm.portal.listener.RemoveLivePortalEventListener this listener new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigUpdated + org.exoplatform.portal.mop.service.LayoutService.portalConfigUpdated addListener org.exoplatform.services.wcm.portal.listener.UpdateLivePortalEventListener this listener new live portal content storage diff --git a/core/publication-plugins/src/main/java/org/exoplatform/services/wcm/publication/lifecycle/stageversion/ui/UIPublicationPagesContainer.java b/core/publication-plugins/src/main/java/org/exoplatform/services/wcm/publication/lifecycle/stageversion/ui/UIPublicationPagesContainer.java index 9554ddd6923..c59749c3fe9 100644 --- a/core/publication-plugins/src/main/java/org/exoplatform/services/wcm/publication/lifecycle/stageversion/ui/UIPublicationPagesContainer.java +++ b/core/publication-plugins/src/main/java/org/exoplatform/services/wcm/publication/lifecycle/stageversion/ui/UIPublicationPagesContainer.java @@ -22,7 +22,7 @@ import javax.jcr.Node; import org.exoplatform.commons.utils.PageList; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.UserACL; import org.exoplatform.portal.config.model.PortalConfig; @@ -74,7 +74,7 @@ public void init(Node node) throws Exception { */ private List getRunningPortals(String userId) throws Exception { List listPortalName = new ArrayList(); - DataStorage service = WCMCoreUtils.getService(DataStorage.class); + LayoutService service = WCMCoreUtils.getService(LayoutService.class); Query query = new Query(null, null, null, null, PortalConfig.class) ; PageList pageList = service.find(query, null) ; UserACL userACL = WCMCoreUtils.getService(UserACL.class); diff --git a/core/publication-plugins/src/test/resources/conf/wcm/test-publication-configuration.xml b/core/publication-plugins/src/test/resources/conf/wcm/test-publication-configuration.xml index 72c8f5b59eb..e4272e1e6ca 100644 --- a/core/publication-plugins/src/test/resources/conf/wcm/test-publication-configuration.xml +++ b/core/publication-plugins/src/test/resources/conf/wcm/test-publication-configuration.xml @@ -325,16 +325,6 @@ - - user.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.UserPortalConfigListener - - - group.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.GroupPortalConfigListener - diff --git a/core/publication/src/main/java/org/exoplatform/services/wcm/publication/PublicationUtil.java b/core/publication/src/main/java/org/exoplatform/services/wcm/publication/PublicationUtil.java index c5d6de36463..b18efe7864a 100644 --- a/core/publication/src/main/java/org/exoplatform/services/wcm/publication/PublicationUtil.java +++ b/core/publication/src/main/java/org/exoplatform/services/wcm/publication/PublicationUtil.java @@ -114,7 +114,7 @@ private static void findAppInstancesByContainerAndName(Container container, Stri if(chidren == null) return ; for(ModelObject object: chidren) { if(object instanceof Application) { - Application application = Application.class.cast(object); + Application application = Application.class.cast(object); if(application.getId().contains(applicationName)) { results.add(application.getId()); } @@ -139,7 +139,7 @@ private static void removedAppInstancesInContainerByNames(Container container, return; for (ModelObject object : chidren) { if (object instanceof Application) { - Application application = Application.class.cast(object); + Application application = Application.class.cast(object); if(!removingApplicationIds.contains(application.getId())) { childrenTmp.add(object); } diff --git a/core/publication/src/test/java/org/exoplatform/services/wcm/publication/DumpPublicationPlugin.java b/core/publication/src/test/java/org/exoplatform/services/wcm/publication/DumpPublicationPlugin.java index b17ee595d0d..47fa8450461 100644 --- a/core/publication/src/test/java/org/exoplatform/services/wcm/publication/DumpPublicationPlugin.java +++ b/core/publication/src/test/java/org/exoplatform/services/wcm/publication/DumpPublicationPlugin.java @@ -38,7 +38,7 @@ import org.exoplatform.commons.utils.ListAccess; import org.exoplatform.portal.application.PortalRequestContext; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.UserACL; import org.exoplatform.portal.config.UserPortalConfig; @@ -239,7 +239,7 @@ public String getUserInfo(Node node, Locale locale) throws Exception { */ private List getRunningPortals(String userId) throws Exception { List listPortalName = new ArrayList(); - DataStorage service = WCMCoreUtils.getService(DataStorage.class); + LayoutService service = WCMCoreUtils.getService(LayoutService.class); Query query = new Query(null, null, null, null, PortalConfig.class) ; ListAccess pageList = service.find2(query, null) ; List portalConfigs = WCMCoreUtils.getAllElementsOfListAccess(pageList); diff --git a/core/publication/src/test/java/org/exoplatform/services/wcm/publication/TestWCMPublicationService.java b/core/publication/src/test/java/org/exoplatform/services/wcm/publication/TestWCMPublicationService.java index 6f032c48eec..a1ceb87fdc5 100644 --- a/core/publication/src/test/java/org/exoplatform/services/wcm/publication/TestWCMPublicationService.java +++ b/core/publication/src/test/java/org/exoplatform/services/wcm/publication/TestWCMPublicationService.java @@ -22,11 +22,11 @@ import org.exoplatform.container.PortalContainer; import org.exoplatform.container.component.RequestLifeCycle; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.model.Page; import org.exoplatform.portal.config.model.PortalConfig; import org.exoplatform.portal.mop.EventType; -import org.exoplatform.portal.mop.navigation.NavigationService; +import org.exoplatform.portal.mop.service.NavigationService; import org.exoplatform.portal.pom.spi.portlet.Portlet; import org.exoplatform.services.listener.Event; import org.exoplatform.services.listener.Listener; @@ -64,7 +64,7 @@ public class TestWCMPublicationService extends BasePublicationTestCase { private final String testPortletPreferences = "portal#classic:/web/BannerPortlet/testPortletPreferences"; /** . */ - private DataStorage storage_; + private LayoutService storage_; /** . */ private NavigationService navService; @@ -105,22 +105,22 @@ public void onEvent(Event event) throws Exception }; PortalContainer container = PortalContainer.getInstance(); - storage_ = (DataStorage)container.getComponentInstanceOfType(DataStorage.class); + storage_ = (LayoutService)container.getComponentInstanceOfType(LayoutService.class); navService = (NavigationService)container.getComponentInstanceOfType(NavigationService.class); events = new LinkedList(); listenerService = (ListenerService)container.getComponentInstanceOfType(ListenerService.class); org = WCMCoreUtils.getService(OrganizationService.class); - listenerService.addListener(DataStorage.PAGE_CREATED, listener); - listenerService.addListener(DataStorage.PAGE_REMOVED, listener); - listenerService.addListener(DataStorage.PAGE_UPDATED, listener); + listenerService.addListener(LayoutService.PAGE_CREATED, listener); + listenerService.addListener(LayoutService.PAGE_REMOVED, listener); + listenerService.addListener(LayoutService.PAGE_UPDATED, listener); listenerService.addListener(EventType .NAVIGATION_CREATED, listener); listenerService.addListener(EventType.NAVIGATION_DESTROYED, listener); listenerService.addListener(EventType.NAVIGATION_UPDATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_CREATED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_UPDATED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_REMOVED, listener); } public void tearDown() throws Exception { diff --git a/core/publication/src/test/resources/conf/wcm/test-publication-configuration.xml b/core/publication/src/test/resources/conf/wcm/test-publication-configuration.xml index 50b15a3002f..0370b2ec7bd 100644 --- a/core/publication/src/test/resources/conf/wcm/test-publication-configuration.xml +++ b/core/publication/src/test/resources/conf/wcm/test-publication-configuration.xml @@ -358,19 +358,19 @@ org.exoplatform.services.listener.ListenerService - org.exoplatform.portal.config.DataStorage.portalConfigCreated + org.exoplatform.portal.mop.service.LayoutService.portalConfigCreated addListener org.exoplatform.services.wcm.portal.listener.CreateLivePortalEventListener this listener create new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigRemoved + org.exoplatform.portal.mop.service.LayoutService.portalConfigRemoved addListener org.exoplatform.services.wcm.portal.listener.RemoveLivePortalEventListener this listener new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigUpdated + org.exoplatform.portal.mop.service.LayoutService.portalConfigUpdated addListener org.exoplatform.services.wcm.portal.listener.UpdateLivePortalEventListener this listener new live portal content storage @@ -424,16 +424,6 @@ - - user.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.UserPortalConfigListener - - - group.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.GroupPortalConfigListener - diff --git a/core/search/src/main/java/org/exoplatform/services/wcm/search/connector/DocumentSearchServiceConnector.java b/core/search/src/main/java/org/exoplatform/services/wcm/search/connector/DocumentSearchServiceConnector.java index 23ebc15094a..da01a7ffce5 100644 --- a/core/search/src/main/java/org/exoplatform/services/wcm/search/connector/DocumentSearchServiceConnector.java +++ b/core/search/src/main/java/org/exoplatform/services/wcm/search/connector/DocumentSearchServiceConnector.java @@ -29,14 +29,14 @@ import org.exoplatform.container.xml.InitParams; import org.exoplatform.ecms.legacy.search.data.SearchContext; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.model.Application; import org.exoplatform.portal.config.model.Container; import org.exoplatform.portal.config.model.ModelObject; import org.exoplatform.portal.mop.SiteKey; import org.exoplatform.portal.mop.SiteType; import org.exoplatform.portal.mop.navigation.NavigationContext; -import org.exoplatform.portal.mop.navigation.NavigationService; +import org.exoplatform.portal.mop.service.NavigationService; import org.exoplatform.portal.mop.navigation.NodeContext; import org.exoplatform.portal.mop.navigation.NodeModel; import org.exoplatform.portal.mop.navigation.Scope; @@ -197,7 +197,7 @@ private String getPageName(SiteKey siteKey) throws Exception { private boolean hasPortlet(NodeContext pageCt, String plName) { if (plName == null) return false; - DataStorage ds = WCMCoreUtils.getService(DataStorage.class); + LayoutService ds = WCMCoreUtils.getService(LayoutService.class); try { for (ModelObject mo : ds.getPage(pageCt.getState().getPageRef().format()).getChildren()) { if (containApp(mo, plName)) { @@ -211,10 +211,10 @@ private boolean hasPortlet(NodeContext pageCt, String plName) { } private boolean containApp(ModelObject mo, String plName) { - DataStorage ds = WCMCoreUtils.getService(DataStorage.class); - if (mo instanceof Application) { + LayoutService ds = WCMCoreUtils.getService(LayoutService.class); + if (mo instanceof Application) { try { - if (ds.getId(((Application)mo).getState()).contains(plName)) { + if (ds.getId(((Application)mo).getState()).contains(plName)) { return true; } } catch (Exception e) { diff --git a/core/search/src/test/java/org/exoplatform/services/wcm/search/DumpPublicationPlugin.java b/core/search/src/test/java/org/exoplatform/services/wcm/search/DumpPublicationPlugin.java index bf404f962f7..ed504411c96 100644 --- a/core/search/src/test/java/org/exoplatform/services/wcm/search/DumpPublicationPlugin.java +++ b/core/search/src/test/java/org/exoplatform/services/wcm/search/DumpPublicationPlugin.java @@ -37,7 +37,7 @@ import javax.jcr.version.VersionException; import org.exoplatform.commons.utils.ListAccess; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.UserACL; import org.exoplatform.portal.config.UserPortalConfig; @@ -243,7 +243,7 @@ public String getUserInfo(Node node, Locale locale) throws Exception { */ private List getRunningPortals(String userId) throws Exception { List listPortalName = new ArrayList(); - DataStorage service = WCMCoreUtils.getService(DataStorage.class); + LayoutService service = WCMCoreUtils.getService(LayoutService.class); Query query = new Query(null, null, null, null, PortalConfig.class) ; ListAccess pageList = service.find2(query, null) ; List portalConfigs = WCMCoreUtils.getAllElementsOfListAccess(pageList); diff --git a/core/search/src/test/java/org/exoplatform/services/wcm/search/TestSearchService.java b/core/search/src/test/java/org/exoplatform/services/wcm/search/TestSearchService.java index 4a473aba15b..0a692e5bd87 100755 --- a/core/search/src/test/java/org/exoplatform/services/wcm/search/TestSearchService.java +++ b/core/search/src/test/java/org/exoplatform/services/wcm/search/TestSearchService.java @@ -16,12 +16,21 @@ */ package org.exoplatform.services.wcm.search; -import java.util.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import javax.jcr.Node; import javax.jcr.RepositoryException; import org.apache.commons.lang3.StringUtils; + import org.exoplatform.commons.search.domain.Document; import org.exoplatform.component.test.ConfigurationUnit; import org.exoplatform.component.test.ConfiguredBy; @@ -29,8 +38,8 @@ import org.exoplatform.portal.mop.SiteKey; import org.exoplatform.portal.mop.page.PageContext; import org.exoplatform.portal.mop.page.PageKey; -import org.exoplatform.portal.mop.page.PageService; import org.exoplatform.portal.mop.page.PageState; +import org.exoplatform.portal.mop.storage.PageStorage; import org.exoplatform.services.cms.CmsService; import org.exoplatform.services.cms.JcrInputProperty; import org.exoplatform.services.cms.templates.TemplateService; @@ -43,9 +52,6 @@ import org.exoplatform.services.wcm.search.connector.FileindexingConnector; import org.exoplatform.services.wcm.utils.WCMCoreUtils; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - /** * Created by The eXo Platform SAS * Author : eXoPlatform @@ -145,7 +151,7 @@ public void testSearchFileInContent() throws Exception { } protected void addChildNodes(Node parentNode)throws Exception{ - PageService pageService = getService(PageService.class); + PageStorage pageService = getService(PageStorage.class); PageContext page = pageService.loadPage(new PageKey(new SiteKey("portal", "classic"), "testpage")); if(page == null){ PageState pageState = new PageState("testpage", "test page", true, diff --git a/core/search/src/test/resources/conf/wcm/test-search-configuration.xml b/core/search/src/test/resources/conf/wcm/test-search-configuration.xml index 893b14dbc4d..ed6b7b5f4e5 100644 --- a/core/search/src/test/resources/conf/wcm/test-search-configuration.xml +++ b/core/search/src/test/resources/conf/wcm/test-search-configuration.xml @@ -490,19 +490,19 @@ org.exoplatform.services.listener.ListenerService - org.exoplatform.portal.config.DataStorage.portalConfigCreated + org.exoplatform.portal.mop.service.LayoutService.portalConfigCreated addListener org.exoplatform.services.wcm.portal.listener.CreateLivePortalEventListener this listener create new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigRemoved + org.exoplatform.portal.mop.service.LayoutService.portalConfigRemoved addListener org.exoplatform.services.wcm.portal.listener.RemoveLivePortalEventListener this listener new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigUpdated + org.exoplatform.portal.mop.service.LayoutService.portalConfigUpdated addListener org.exoplatform.services.wcm.portal.listener.UpdateLivePortalEventListener this listener new live portal content storage diff --git a/core/services/src/main/java/org/exoplatform/services/wcm/portal/impl/LivePortalManagerServiceImpl.java b/core/services/src/main/java/org/exoplatform/services/wcm/portal/impl/LivePortalManagerServiceImpl.java index 2c3e07024fc..7feaa77b372 100644 --- a/core/services/src/main/java/org/exoplatform/services/wcm/portal/impl/LivePortalManagerServiceImpl.java +++ b/core/services/src/main/java/org/exoplatform/services/wcm/portal/impl/LivePortalManagerServiceImpl.java @@ -31,7 +31,8 @@ import org.exoplatform.container.PortalContainer; import org.exoplatform.container.component.RequestLifeCycle; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.SiteType; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.UserPortalConfigService; import org.exoplatform.portal.config.model.PortalConfig; import org.exoplatform.services.jcr.RepositoryService; @@ -315,8 +316,8 @@ public String getPortalPathByName(String portalName) throws Exception { private void checkAllPortalSitesCreated() throws Exception { RequestLifeCycle.begin(PortalContainer.getInstance()); try { - DataStorage dataStorage = portalConfigService.getDataStorage(); - List allPortalNames = dataStorage.getAllPortalNames(); + LayoutService dataStorage = portalConfigService.getDataStorage(); + List allPortalNames = dataStorage.getSiteNames(SiteType.PORTAL, 0, 1000); if (allPortalNames != null) { for (String portalName : allPortalNames) { // Global site shouldn't have a folder @@ -338,7 +339,7 @@ private void checkAllPortalSitesCreated() throws Exception { if (portalConfig == null) { continue; } - listenerService.broadcast("org.exoplatform.portal.config.DataStorage.portalConfigCreated", dataStorage, portalConfig);; + listenerService.broadcast("org.exoplatform.portal.mop.service.LayoutService.portalConfigCreated", dataStorage, portalConfig);; } } } finally { diff --git a/core/services/src/test/resources/conf/standalone/wcm-configuration.xml b/core/services/src/test/resources/conf/standalone/wcm-configuration.xml index 7737d24ea82..4da6084eb4f 100644 --- a/core/services/src/test/resources/conf/standalone/wcm-configuration.xml +++ b/core/services/src/test/resources/conf/standalone/wcm-configuration.xml @@ -115,19 +115,19 @@ org.exoplatform.services.listener.ListenerService - org.exoplatform.portal.config.DataStorage.portalConfigCreated + org.exoplatform.portal.mop.service.LayoutService.portalConfigCreated addListener org.exoplatform.services.wcm.portal.listener.CreateLivePortalEventListener this listener create new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigRemoved + org.exoplatform.portal.mop.service.LayoutService.portalConfigRemoved addListener org.exoplatform.services.wcm.portal.listener.RemoveLivePortalEventListener this listener new live portal content storage - org.exoplatform.portal.config.DataStorage.portalConfigUpdated + org.exoplatform.portal.mop.service.LayoutService.portalConfigUpdated addListener org.exoplatform.services.wcm.portal.listener.UpdateLivePortalEventListener this listener new live portal content storage diff --git a/ecm-wcm-extension/src/main/webapp/WEB-INF/conf/wcm-extension/portal/portal/template/empty/navigation.xml b/ecm-wcm-extension/src/main/webapp/WEB-INF/conf/wcm-extension/portal/portal/template/empty/navigation.xml index 8c627b57d07..1e505e1c719 100644 --- a/ecm-wcm-extension/src/main/webapp/WEB-INF/conf/wcm-extension/portal/portal/template/empty/navigation.xml +++ b/ecm-wcm-extension/src/main/webapp/WEB-INF/conf/wcm-extension/portal/portal/template/empty/navigation.xml @@ -27,14 +27,12 @@ 1 - overview overview portal::@owner@::overview - detail detail SYSTEM @@ -42,7 +40,6 @@ - printviewer printviewer SYSTEM @@ -50,7 +47,6 @@ - searchResult searchResult HIDDEN @@ -58,7 +54,6 @@ - newAccount newAccount HIDDEN diff --git a/ecms-social-integration/src/main/java/org/exoplatform/social/space/customization/SpaceCustomizationService.java b/ecms-social-integration/src/main/java/org/exoplatform/social/space/customization/SpaceCustomizationService.java index 82cc5368368..55d3e04ca69 100644 --- a/ecms-social-integration/src/main/java/org/exoplatform/social/space/customization/SpaceCustomizationService.java +++ b/ecms-social-integration/src/main/java/org/exoplatform/social/space/customization/SpaceCustomizationService.java @@ -10,19 +10,9 @@ import javax.jcr.RepositoryException; import javax.jcr.Session; -import org.exoplatform.commons.utils.ExoProperties; import org.exoplatform.container.PortalContainer; import org.exoplatform.container.configuration.ConfigurationManager; -import org.exoplatform.portal.config.DataStorage; import org.exoplatform.portal.config.UserACL; -import org.exoplatform.portal.config.UserPortalConfigService; -import org.exoplatform.portal.config.model.Application; -import org.exoplatform.portal.config.model.ApplicationType; -import org.exoplatform.portal.config.model.Container; -import org.exoplatform.portal.config.model.ModelObject; -import org.exoplatform.portal.mop.page.PageService; -import org.exoplatform.portal.pom.spi.portlet.Portlet; -import org.exoplatform.portal.pom.spi.portlet.Preference; import org.exoplatform.services.cms.BasePath; import org.exoplatform.services.cms.impl.DMSConfiguration; import org.exoplatform.services.cms.impl.DMSRepositoryConfiguration; @@ -39,62 +29,44 @@ import org.exoplatform.services.log.Log; import org.exoplatform.services.security.IdentityConstants; import org.exoplatform.services.wcm.core.NodetypeConstant; -import org.exoplatform.social.core.space.SpaceUtils; import org.exoplatform.social.core.space.spi.SpaceService; public class SpaceCustomizationService { - final static private Log LOG = ExoLogger.getExoLogger(SpaceCustomizationService.class); - final static private String GROUPS_PATH = "groupsPath"; + private static final Log LOG = ExoLogger.getExoLogger(SpaceCustomizationService.class); - private static final String SPACE_GROUP_ID_PREFERENCE = "{spaceGroupId}"; + private static final String GROUPS_PATH = "groupsPath"; - private static final String SPACE_NEW_HOME_PAGE_TEMPLATE = "custom space"; + private static final String ACTIVITY_FOLDER_UPLOAD_NAME = "Activity Stream Documents"; - private static final String SCV_PORTLEt_NAME = "SingleContentViewer"; + private SessionProviderService sessionProviderService; - private static final String ACTIVITY_FOLDER_UPLOAD_NAME = "Activity Stream Documents"; + private NodeHierarchyCreator nodeHierarchyCreator = null; - private SessionProviderService sessionProviderService; + private DMSConfiguration dmsConfiguration = null; - private NodeHierarchyCreator nodeHierarchyCreator = null; + private RepositoryService repositoryService = null; - private DMSConfiguration dmsConfiguration = null; + private ConfigurationManager configurationManager = null; - private RepositoryService repositoryService = null; + private SpaceService spaceService = null; - private ConfigurationManager configurationManager = null; + private UserACL userACL = null; - private DataStorage dataStorageService = null; + private String groupsPath; - PageService pageService = null; - - private UserPortalConfigService userPortalConfigService = null; - - private SpaceService spaceService = null; - - private UserACL userACL = null; - - private String groupsPath; - - public SpaceCustomizationService(DataStorage dataStorageService_, - PageService pageService_, - UserPortalConfigService userPortalConfigService_, - SessionProviderService sessionProviderService_, - NodeHierarchyCreator nodeHierarchyCreator_, - DMSConfiguration dmsConfiguration_, - RepositoryService repositoryService_, - ConfigurationManager configurationManager_, - UserACL userACL_) { - this.nodeHierarchyCreator = nodeHierarchyCreator_; - this.dmsConfiguration = dmsConfiguration_; - this.repositoryService = repositoryService_; - this.userACL = userACL_; - this.configurationManager = configurationManager_; - this.sessionProviderService = sessionProviderService_; - this.dataStorageService = dataStorageService_; - this.pageService = pageService_; - this.userPortalConfigService = userPortalConfigService_; + public SpaceCustomizationService(SessionProviderService sessionProviderService, + NodeHierarchyCreator nodeHierarchyCreator, + DMSConfiguration dmsConfiguration, + RepositoryService repositoryService, + ConfigurationManager configurationManager, + UserACL userAcl) { + this.nodeHierarchyCreator = nodeHierarchyCreator; + this.dmsConfiguration = dmsConfiguration; + this.repositoryService = repositoryService; + this.userACL = userAcl; + this.configurationManager = configurationManager; + this.sessionProviderService = sessionProviderService; groupsPath = nodeHierarchyCreator.getJcrPath(GROUPS_PATH); if (groupsPath.lastIndexOf("/") == groupsPath.length() - 1) { groupsPath = groupsPath.substring(0, groupsPath.lastIndexOf("/")); @@ -258,97 +230,4 @@ public void createSpaceDefaultFolders(String groupId) throws Exception { } } - private void editSCVPreference(Application selectedPortlet, - String prefValue, - ExoProperties welcomeSCVCustomPreferences) - throws Exception { - // loads the scv preferences - Portlet prefs = dataStorageService.load(selectedPortlet.getState(), ApplicationType.PORTLET); - if (prefs == null) { - if (LOG.isDebugEnabled()) { - LOG.debug("The portlet prefs == null : portlet application " + selectedPortlet.getId()); - } - prefs = new Portlet(); - } - // edits the nodeIdentifier preference - for (String preferenceName : welcomeSCVCustomPreferences.keySet()) { - String preferenceValue = welcomeSCVCustomPreferences.get(preferenceName); - if (preferenceValue.contains(SPACE_GROUP_ID_PREFERENCE)) { - preferenceValue = preferenceValue.replace(SPACE_GROUP_ID_PREFERENCE, prefValue); - } - prefs.putPreference(new Preference(preferenceName, preferenceValue, false)); - } - } - - @SuppressWarnings("unchecked") - private void editSpaceURLPreference(List children, String prefValue) throws Exception { - if (children == null || children.size() == 0) { - if (LOG.isDebugEnabled()) { - LOG.debug("Can not get a portlet application from children.\nChildren == null or have no items"); - } - } - // parses the children list - for (ModelObject modelObject : children) { - // if a container, check for its children - if (modelObject instanceof Container) { - editSpaceURLPreference(((Container) modelObject).getChildren(), prefValue); - } else { - // if a portlet application, set the preference value - if (modelObject instanceof Application && ((Application) modelObject).getType().equals(ApplicationType.PORTLET)) { - Application application = (Application) modelObject; - Portlet portletPreference = dataStorageService.load(application.getState(), ApplicationType.PORTLET); - if (portletPreference == null) { - portletPreference = new Portlet(); - } - portletPreference.putPreference(new Preference(SpaceUtils.SPACE_URL, prefValue, false)); - - } - } - } - } - - @SuppressWarnings("unchecked") - private Application getPortletApplication(List children, String portletName) throws Exception { - if (children == null || children.size() == 0) { - if (LOG.isDebugEnabled()) { - LOG.debug("Can not get a portlet application from children.\nChildren == null or have no items"); - } - } - for (ModelObject modelObject : children) { - Application selectedApplication = null; - if (modelObject instanceof Container) { - selectedApplication = getPortletApplication(((Container) modelObject).getChildren(), portletName); - } else { - if (modelObject instanceof Application && ((Application) modelObject).getType().equals(ApplicationType.PORTLET)) { - Application application = (Application) modelObject; - String portletId = this.dataStorageService.getId(application.getState()); - if (portletId.endsWith("/" + portletName)) { - selectedApplication = application; - } - } - } - if (selectedApplication != null) { - return selectedApplication; - } - } - return null; - } - - @SuppressWarnings("unchecked") - private void editChildrenAccesPermisions(List children, String[] accessPermissions) { - if (children != null && children.size() > 0) { - for (ModelObject modelObject : children) { - if (modelObject instanceof Container) { - ((Container) modelObject).setAccessPermissions(accessPermissions); - editChildrenAccesPermisions(((Container) modelObject).getChildren(), accessPermissions); - } else { - if (modelObject instanceof Application && ((Application) modelObject).getType().equals(ApplicationType.PORTLET)) { - Application application = (Application) modelObject; - application.setAccessPermissions(accessPermissions); - } - } - } - } - } - } diff --git a/ext/authoring/services/src/main/java/org/exoplatform/services/wcm/extensions/publication/lifecycle/authoring/AuthoringPublicationPlugin.java b/ext/authoring/services/src/main/java/org/exoplatform/services/wcm/extensions/publication/lifecycle/authoring/AuthoringPublicationPlugin.java index c746919749b..d38f254afef 100644 --- a/ext/authoring/services/src/main/java/org/exoplatform/services/wcm/extensions/publication/lifecycle/authoring/AuthoringPublicationPlugin.java +++ b/ext/authoring/services/src/main/java/org/exoplatform/services/wcm/extensions/publication/lifecycle/authoring/AuthoringPublicationPlugin.java @@ -24,7 +24,7 @@ import org.exoplatform.container.PortalContainer; import org.exoplatform.ecm.webui.utils.Utils; import org.exoplatform.portal.application.PortalRequestContext; -import org.exoplatform.portal.config.DataStorage; +import org.exoplatform.portal.mop.service.LayoutService; import org.exoplatform.portal.config.Query; import org.exoplatform.portal.config.UserACL; import org.exoplatform.portal.config.UserPortalConfig; @@ -649,7 +649,7 @@ public String getLocalizedAndSubstituteMessage(Locale locale, String key, String private List getRunningPortals(String userId) throws Exception { List listPortalName = new ArrayList(); - DataStorage service = WCMCoreUtils.getService(DataStorage.class); + LayoutService service = WCMCoreUtils.getService(LayoutService.class); Query query = new Query(null, null, null, null, PortalConfig.class) ; PageList pageList = service.find(query, null) ; UserACL userACL = WCMCoreUtils.getService(UserACL.class); diff --git a/ext/authoring/services/src/test/java/exo/exoplatform/services/wcm/extensions/publication/TestWCMPublicationService.java b/ext/authoring/services/src/test/java/exo/exoplatform/services/wcm/extensions/publication/TestWCMPublicationService.java index 9746c543606..e3acc79460a 100644 --- a/ext/authoring/services/src/test/java/exo/exoplatform/services/wcm/extensions/publication/TestWCMPublicationService.java +++ b/ext/authoring/services/src/test/java/exo/exoplatform/services/wcm/extensions/publication/TestWCMPublicationService.java @@ -7,13 +7,9 @@ import org.exoplatform.container.PortalContainer; import org.exoplatform.container.component.RequestLifeCycle; -import org.exoplatform.portal.config.DataStorage; -import org.exoplatform.portal.config.model.Page; -import org.exoplatform.portal.config.model.PortalConfig; import org.exoplatform.portal.mop.EventType; -import org.exoplatform.portal.mop.navigation.NavigationService; -import org.exoplatform.portal.pom.spi.portlet.Portlet; -import org.exoplatform.services.ecm.publication.PublicationPlugin; +import org.exoplatform.portal.mop.service.LayoutService; +import org.exoplatform.portal.mop.service.NavigationService; import org.exoplatform.services.listener.Event; import org.exoplatform.services.listener.Listener; import org.exoplatform.services.listener.ListenerService; @@ -21,10 +17,10 @@ import org.exoplatform.services.security.ConversationState; import org.exoplatform.services.security.Identity; import org.exoplatform.services.wcm.core.NodetypeConstant; +import org.exoplatform.services.wcm.extensions.publication.lifecycle.authoring.AuthoringPublicationPlugin; import org.exoplatform.services.wcm.publication.PublicationDefaultStates; import org.exoplatform.services.wcm.publication.WCMPublicationService; import org.exoplatform.services.wcm.publication.WebpagePublicationPlugin; -import org.exoplatform.services.wcm.extensions.publication.lifecycle.authoring.AuthoringPublicationPlugin; import org.exoplatform.services.wcm.utils.WCMCoreUtils; public class TestWCMPublicationService extends BasePublicationTestCase { @@ -47,7 +43,7 @@ public class TestWCMPublicationService extends BasePublicationTestCase { private final String testPortletPreferences = "portal#classic:/web/BannerPortlet/testPortletPreferences"; /** . */ - private DataStorage storage_; + private LayoutService storage_; /** . */ private NavigationService navService; @@ -88,21 +84,21 @@ public void onEvent(Event event) throws Exception { }; PortalContainer container = PortalContainer.getInstance(); - storage_ = (DataStorage) container.getComponentInstanceOfType(DataStorage.class); + storage_ = container.getComponentInstanceOfType(LayoutService.class); navService = (NavigationService) container.getComponentInstanceOfType(NavigationService.class); events = new LinkedList(); listenerService = (ListenerService) container.getComponentInstanceOfType(ListenerService.class); org = WCMCoreUtils.getService(OrganizationService.class); - listenerService.addListener(DataStorage.PAGE_CREATED, listener); - listenerService.addListener(DataStorage.PAGE_REMOVED, listener); - listenerService.addListener(DataStorage.PAGE_UPDATED, listener); + listenerService.addListener(LayoutService.PAGE_CREATED, listener); + listenerService.addListener(LayoutService.PAGE_REMOVED, listener); + listenerService.addListener(LayoutService.PAGE_UPDATED, listener); listenerService.addListener(EventType.NAVIGATION_CREATED, listener); listenerService.addListener(EventType.NAVIGATION_DESTROYED, listener); listenerService.addListener(EventType.NAVIGATION_UPDATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_CREATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_UPDATED, listener); - listenerService.addListener(DataStorage.PORTAL_CONFIG_REMOVED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_CREATED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_UPDATED, listener); + listenerService.addListener(LayoutService.PORTAL_CONFIG_REMOVED, listener); } public void tearDown() throws Exception { diff --git a/ext/authoring/services/src/test/resources/conf/wcm/test-publication-configuration.xml b/ext/authoring/services/src/test/resources/conf/wcm/test-publication-configuration.xml index 34715861307..33d20e6df8c 100644 --- a/ext/authoring/services/src/test/resources/conf/wcm/test-publication-configuration.xml +++ b/ext/authoring/services/src/test/resources/conf/wcm/test-publication-configuration.xml @@ -283,16 +283,6 @@ - - user.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.UserPortalConfigListener - - - group.portal.config.listener - addListenerPlugin - org.exoplatform.portal.config.GroupPortalConfigListener - diff --git a/testsuite/test/src/main/resources/conf/portal/portal/classic/navigation.xml b/testsuite/test/src/main/resources/conf/portal/portal/classic/navigation.xml index a69bcf5ce6c..f23bbaf2faa 100644 --- a/testsuite/test/src/main/resources/conf/portal/portal/classic/navigation.xml +++ b/testsuite/test/src/main/resources/conf/portal/portal/classic/navigation.xml @@ -27,7 +27,6 @@ 1 - home home @@ -38,7 +37,6 @@ portal::classic::homepage - detail detail @@ -49,7 +47,6 @@ portal::classic::detail - printviewer printviewer @@ -60,7 +57,6 @@ portal::classic::printviewer - searchResult searchResult @@ -72,7 +68,6 @@ - newAccount newAccount