diff --git a/dxa-bom-modules/pom.xml b/dxa-bom-modules/pom.xml index ca6872b1e..7f7be8802 100644 --- a/dxa-bom-modules/pom.xml +++ b/dxa-bom-modules/pom.xml @@ -12,7 +12,7 @@ com.sdl.dxa.modules dxa-bom-modules - 1.7.0-SNAPSHOT + 1.7.0 pom DXA Modules - Bill of Materials @@ -45,7 +45,7 @@ - 1.7.0-SNAPSHOT + 1.7.0 ${dxa-modules.version} ${dxa-modules.version} ${dxa-modules.version} diff --git a/dxa-bom/pom.xml b/dxa-bom/pom.xml index 70a7db029..2731b83c8 100644 --- a/dxa-bom/pom.xml +++ b/dxa-bom/pom.xml @@ -12,7 +12,7 @@ com.sdl.dxa dxa-bom - 1.7.0-SNAPSHOT + 1.7.0 pom DXA - Bill of Materials @@ -45,8 +45,8 @@ - 2.1.3-DXA17 - 8.5.0-1007 + 2.1.4-DXA17 + 8.5.0-1008 ${project.version} diff --git a/dxa-builder/build.gradle b/dxa-builder/build.gradle index 11018489a..ab204d96b 100644 --- a/dxa-builder/build.gradle +++ b/dxa-builder/build.gradle @@ -1,5 +1,5 @@ group 'com.sdl.dxa' -version '1.7.0-SNAPSHOT' +version '1.7.0' apply plugin: 'groovy' apply plugin: 'maven-publish' diff --git a/dxa-framework/dxa-common-api/pom.xml b/dxa-framework/dxa-common-api/pom.xml index 81b8c363c..e2485c4af 100644 --- a/dxa-framework/dxa-common-api/pom.xml +++ b/dxa-framework/dxa-common-api/pom.xml @@ -6,7 +6,7 @@ com.sdl.dxa dxa-framework - 1.7.0-SNAPSHOT + 1.7.0 dxa-common-api diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcData.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcData.java index 43b0a0042..42ba1fca7 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcData.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcData.java @@ -2,34 +2,26 @@ import lombok.Getter; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.CORE_AREA_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.ENTITY_ACTION_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.ENTITY_CONTROLLER_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.ERROR_ACTION_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.ERROR_CONTROLLER_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.PAGE_ACTION_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.PAGE_CONTROLLER_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.REGION_ACTION_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.REGION_CONTROLLER_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.SHARED_AREA_NAME; +import static com.sdl.webapp.common.controller.ControllerUtils.FRAMEWORK_CONTROLLER_MAPPING; +import static com.sdl.webapp.common.util.InitializationUtils.getConfiguration; @Getter -/** - *

DefaultsMvcData class.

- */ public enum DefaultsMvcData { - CORE_ENTITY("Core", CORE_AREA_NAME, ENTITY_CONTROLLER_NAME, ENTITY_ACTION_NAME), + CORE_ENTITY(FRAMEWORK_CONTROLLER_MAPPING, getDefaultAreaName(), "Entity", "Entity"), - CORE_PAGE("Core", CORE_AREA_NAME, PAGE_CONTROLLER_NAME, PAGE_ACTION_NAME), + CORE_PAGE(FRAMEWORK_CONTROLLER_MAPPING, getDefaultAreaName(), "Page", "Page"), - CORE_REGION("Core", CORE_AREA_NAME, REGION_CONTROLLER_NAME, REGION_ACTION_NAME), + CORE_REGION(FRAMEWORK_CONTROLLER_MAPPING, getDefaultAreaName(), "Region", "Region"), - ERROR_ENTITY("Shared", SHARED_AREA_NAME, ERROR_CONTROLLER_NAME, ERROR_ACTION_NAME); + ERROR_ENTITY("Shared", "Shared", "Error", "Entity"); private String controllerAreaName; + private String controllerName; + private String actionName; + private String areaName; DefaultsMvcData(String controllerAreaName, String areaName, String controllerName, String actionName) { @@ -39,28 +31,50 @@ public enum DefaultsMvcData { this.actionName = actionName; } - public interface CoreAreaConstants { - String CORE_AREA_NAME = "Core"; - - String SHARED_AREA_NAME = "Shared"; - - String PAGE_CONTROLLER_NAME = "Page"; - String PAGE_ACTION_NAME = "Page"; - String REGION_CONTROLLER_NAME = "Region"; - String REGION_ACTION_NAME = "Region"; + /** + * Returns the pre-configured area name with defaults to {@code Core}. + * + * @return pre-configured area name or default name + */ + public static String getDefaultAreaName() { + return getConfiguration("dxa.web.default.area.name", "Core"); + } - String ENTITY_CONTROLLER_NAME = "Entity"; - String ENTITY_ACTION_NAME = "Entity"; + /** + * Returns the pre-configured region name with defaults to {@code Main}. + * + * @return pre-configured region name or default name + */ + public static String getDefaultRegionName() { + return getConfiguration("dxa.web.default.region.name", "Main"); + } - String LIST_CONTROLLER_NAME = "List"; - String LIST_ACTION_NAME = "List"; + /** + * Returns the pre-configured controller name with defaults to {@code Entity}. + * + * @return pre-configured controller name or default name + */ + public static String getDefaultControllerName() { + return getConfiguration("dxa.web.default.controller.name", "Entity"); + } - String ERROR_CONTROLLER_NAME = "Error"; - String ERROR_ACTION_NAME = "Entity"; + /** + * Returns the pre-configured controller area name with defaults to {@code Core}. + * + * @return pre-configured controller area name or default name + */ + public static String getDefaultControllerAreaName() { + return getConfiguration("dxa.web.default.controller.area.name", "Core"); + } - String NAVIGATION_CONTROLLER_NAME = "Navigation"; - String NAVIGATION_ACTION_NAME = "Navigation"; - String SITEMAP_ACTION_NAME = "SiteMap"; + /** + * Returns the pre-configured action name with defaults to {@code Entity}. + * + * @return pre-configured action name or default name + */ + public static String getDefaultActionName() { + return getConfiguration("dxa.web.default.action.name", "Entity"); } + } diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataImpl.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataImpl.java index 733b135de..c060a8320 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataImpl.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataImpl.java @@ -3,6 +3,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; +import com.google.common.base.Splitter; import com.sdl.webapp.common.api.model.MvcData; import lombok.AccessLevel; import lombok.AllArgsConstructor; @@ -14,8 +15,11 @@ import lombok.experimental.Accessors; import java.util.HashMap; +import java.util.List; import java.util.Map; +import static com.sdl.webapp.common.controller.ControllerUtils.FRAMEWORK_CONTROLLER_MAPPING; + @JsonInclude(JsonInclude.Include.NON_NULL) @Getter @Setter(AccessLevel.PROTECTED) @@ -25,6 +29,9 @@ @AllArgsConstructor @NoArgsConstructor(access = AccessLevel.PROTECTED) public class MvcDataImpl implements MvcData { + + protected static final List INCLUDE_CONTROLLERS = Splitter.on(",").trimResults().splitToList("Entity, List, Navigation, Region"); + @JsonProperty("ControllerAreaName") private String controllerAreaName; @@ -54,11 +61,6 @@ public class MvcDataImpl implements MvcData { // todo dxa2 return a copy instead of real map private Map metadata = new HashMap<>(); - /** - *

Constructor for MvcDataImpl.

- * - * @param mvcData a {@link com.sdl.webapp.common.api.model.MvcData} object. - */ protected MvcDataImpl(MvcData mvcData) { this.controllerAreaName = mvcData.getControllerAreaName(); this.controllerName = mvcData.getControllerName(); @@ -75,10 +77,6 @@ public static MvcDataImplBuilder newBuilder() { return new MvcDataImplBuilder(); } - public void addMetadataValue(String key, Object obj) { - this.metadata.put(key, obj); - } - public Object getMetadataValue(String key) { return this.metadata.get(key); } @@ -87,18 +85,36 @@ public MvcDataImplBuilder toBuilder() { return MvcDataImplBuilder.toBuilder(this); } + @Override + public String getControllerAreaName() { + return INCLUDE_CONTROLLERS.contains(getControllerName()) ? FRAMEWORK_CONTROLLER_MAPPING : controllerAreaName; + } + + public void addMetadataValue(String key, Object obj) { + this.metadata.put(key, obj); + } + /** * Builder for MvcData. Lombok's implementation fails on Javadoc. */ public static class MvcDataImplBuilder { + private String controllerAreaName; + private String controllerName; + private String actionName; + private String areaName; + private String viewName; + private String regionAreaName; + private String regionName; + private Map routeValues = new HashMap<>(); + private Map metadata = new HashMap<>(); protected static MvcDataImplBuilder toBuilder(MvcData mvcData) { diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImpl.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImpl.java index 5f7b43324..9f1b75538 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImpl.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImpl.java @@ -9,6 +9,7 @@ import com.sdl.webapp.common.api.model.PageModel; import com.sdl.webapp.common.api.model.RegionModelSet; import com.sdl.webapp.common.api.model.region.RegionModelSetImpl; +import com.sdl.webapp.common.util.TcmUtils; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; @@ -35,7 +36,7 @@ public abstract class AbstractPageModelImpl extends AbstractViewModel implements private static final String XPM_PAGE_SCRIPT = ""; - @JsonProperty("Id") + @JsonIgnore protected String id; @JsonIgnore @@ -66,6 +67,19 @@ public AbstractPageModelImpl(PageModel pageModel) { addXpmMetadata(pageModel.getXpmMetadata()); } + /** + * Returns an ID of a page without TCM parts. Used as a workaround fix for TSI-2221. Usage of this method is not recommended. + * + * @return ID of a page + * @since 1.7 + * @deprecated since 1.7 + */ + @JsonProperty("Id") + @Deprecated + String getIdWithoutTcm() { + return String.valueOf(TcmUtils.getItemId(getId())); + } + /** * {@inheritDoc} */ diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/BaseController.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/BaseController.java index 8508758bb..aa46ff99f 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/BaseController.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/BaseController.java @@ -26,6 +26,10 @@ import java.util.Map; import java.util.Objects; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultActionName; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultControllerAreaName; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultControllerName; + /** * Abstract superclass for controllers with utility methods and exception handling. */ @@ -47,9 +51,9 @@ public abstract class BaseController { private RequestMappingHandlerMapping requestMappingHandlerMapping; private static Boolean isCustomAction(MvcData mvcData) { - return !Objects.equals(mvcData.getActionName(), "Entity") - || !Objects.equals(mvcData.getControllerName(), "Entity") - || !Objects.equals(mvcData.getControllerAreaName(), "Core"); + return !Objects.equals(mvcData.getActionName(), getDefaultActionName()) + || !Objects.equals(mvcData.getControllerName(), getDefaultControllerName()) + || !Objects.equals(mvcData.getControllerAreaName(), getDefaultControllerAreaName()); } RegionModel getRegionFromRequest(HttpServletRequest request, String regionName) { @@ -192,8 +196,8 @@ protected EntityModel enrichEntityModel(EntityModel entity, HttpServletRequest r MvcData mvcData = entity.getMvcData(); - String controllerName = mvcData.getControllerName() != null ? mvcData.getControllerName() : "Entity"; - String controllerAreaName = mvcData.getControllerAreaName() != null ? mvcData.getControllerAreaName() : "Core"; + String controllerName = mvcData.getControllerName() != null ? mvcData.getControllerName() : getDefaultControllerName(); + String controllerAreaName = mvcData.getControllerAreaName() != null ? mvcData.getControllerAreaName() : getDefaultControllerAreaName(); Map handlerMethods = this.requestMappingHandlerMapping.getHandlerMethods(); diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ControllerUtils.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ControllerUtils.java index f364b51fa..5ca6ce021 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ControllerUtils.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ControllerUtils.java @@ -13,6 +13,10 @@ public final class ControllerUtils { public static final String INCLUDE_PATH_PREFIX = "/system/mvc/"; + public static final String FRAMEWORK_CONTROLLER_MAPPING = "Framework"; + + public static final String INCLUDE_MAPPING = INCLUDE_PATH_PREFIX + FRAMEWORK_CONTROLLER_MAPPING; + public static final String SECTION_ERROR_VIEW = "Shared/Error/SectionError"; @Deprecated diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/EntityController.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/EntityController.java index fc6554da0..7477e5b32 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/EntityController.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/EntityController.java @@ -5,7 +5,6 @@ import com.sdl.webapp.common.api.model.MvcData; import com.sdl.webapp.common.api.model.ViewModel; import com.sdl.webapp.common.api.model.entity.RedirectEntity; -import com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -14,21 +13,20 @@ import javax.servlet.http.HttpServletRequest; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.CORE_AREA_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.ENTITY_CONTROLLER_NAME; -import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_PATH_PREFIX; +import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_MAPPING; import static com.sdl.webapp.common.controller.RequestAttributeNames.ENTITY_MODEL; /** - * Entity controller for the Core area that handles include requests to /system/mvc/Core/Entity/Entity/{entityId}. + * Entity controller for the Core area that handles include requests to /system/mvc/Framework/Entity/Entity/{entityId}. + * + * @see ControllerUtils */ @Controller -@RequestMapping(INCLUDE_PATH_PREFIX + CORE_AREA_NAME + '/' + ENTITY_CONTROLLER_NAME) +@RequestMapping(INCLUDE_MAPPING + "/Entity") public class EntityController extends BaseController { private static final Logger LOG = LoggerFactory.getLogger(EntityController.class); - /** * Handles a request for an entity. * @@ -38,7 +36,7 @@ public class EntityController extends BaseController { * @throws ContentProviderException If an error occurs so that the entity cannot not be retrieved. * @throws java.lang.Exception if any. */ - @RequestMapping(value = DefaultsMvcData.CoreAreaConstants.ENTITY_ACTION_NAME + "/{entityId}") + @RequestMapping(value = "Entity" + "/{entityId}") public String handleGetEntity(HttpServletRequest request, @PathVariable String entityId) throws Exception { diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ListController.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ListController.java index f995df622..c74ad4b2a 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ListController.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/ListController.java @@ -17,18 +17,17 @@ import javax.servlet.http.HttpServletRequest; import java.util.Objects; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.CORE_AREA_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.LIST_ACTION_NAME; -import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CoreAreaConstants.LIST_CONTROLLER_NAME; -import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_PATH_PREFIX; +import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_MAPPING; import static org.springframework.util.CollectionUtils.isEmpty; /** - * List controller for the Core area that handles include requests to /system/mvc/Core/List/{regionName}/{entityId}. + * List controller for the Core area that handles include requests to /system/mvc/Framework/List/{regionName}/{entityId}. + * + * @see ControllerUtils */ @Slf4j @Controller -@RequestMapping(INCLUDE_PATH_PREFIX + CORE_AREA_NAME + '/' + LIST_CONTROLLER_NAME) +@RequestMapping(INCLUDE_MAPPING + "/List") public class ListController extends EntityController { private final WebRequestContext webRequestContext; @@ -54,7 +53,7 @@ private static int getOrDefault(HttpServletRequest request, String parameterName * @return the name of the entity view that should be rendered for this request. * @throws java.lang.Exception exception in case view is not resolved for any reason */ - @RequestMapping(value = LIST_ACTION_NAME + "/{entityId}") + @RequestMapping(value = "List" + "/{entityId}") public String handleGetList(HttpServletRequest request, @PathVariable String entityId) throws Exception { log.trace("handleGetList: entityId={}", entityId); // The List action is effectively just an alias for the general Entity action (we keep it for backward compatibility). diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/NavigationController.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/NavigationController.java index 38e5c0858..69a14f874 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/NavigationController.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/NavigationController.java @@ -8,7 +8,6 @@ import com.sdl.webapp.common.api.model.entity.NavigationLinks; import com.sdl.webapp.common.api.model.entity.SitemapItem; import com.sdl.webapp.common.api.model.entity.TaxonomyNode; -import com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData; import com.sdl.webapp.common.api.navigation.NavigationProvider; import com.sdl.webapp.common.api.navigation.NavigationProviderException; import org.jetbrains.annotations.NotNull; @@ -25,19 +24,21 @@ import java.util.LinkedHashSet; import java.util.Set; -import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_PATH_PREFIX; +import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_MAPPING; import static com.sdl.webapp.common.controller.RequestAttributeNames.ENTITY_MODEL; /** * Navigation controller for the Core area. *

- * This handles include requests to /system/mvc/Core/Navigation/Navigation/{regionName}/{entityId} - * and /system/mvc/Core/Navigation/SiteMap/{regionName}/{entityId} + * This handles include requests to /system/mvc/Framework/Navigation/Navigation/{regionName}/{entityId} + * and /system/mvc/Framework/Navigation/SiteMap/{regionName}/{entityId} *

+ * + * @see ControllerUtils */ @Controller -@RequestMapping(INCLUDE_PATH_PREFIX + DefaultsMvcData.CoreAreaConstants.CORE_AREA_NAME + '/' + DefaultsMvcData.CoreAreaConstants.NAVIGATION_CONTROLLER_NAME) +@RequestMapping(INCLUDE_MAPPING + "/Navigation") public class NavigationController extends BaseController { private static final Logger LOG = LoggerFactory.getLogger(NavigationController.class); @@ -117,7 +118,7 @@ private static void moveHomeItemToTopLevelIfNeeded(@NotNull SitemapItem navigati * @throws NavigationProviderException If an error occurs so that the navigation data cannot be retrieved. * @throws java.lang.Exception if any. */ - @RequestMapping(value = DefaultsMvcData.CoreAreaConstants.NAVIGATION_ACTION_NAME + "/{entityId}") + @RequestMapping(value = "Navigation/{entityId}") public String handleGetNavigation(HttpServletRequest request, @PathVariable String entityId, @RequestParam String navType) throws Exception { @@ -172,7 +173,7 @@ public String handleGetNavigation(HttpServletRequest request, * @return The name of the entity view that should be rendered for this request. * @throws NavigationProviderException If an error occurs so that the navigation data cannot be retrieved. */ - @RequestMapping(value = DefaultsMvcData.CoreAreaConstants.SITEMAP_ACTION_NAME + "/{entityId}") + @RequestMapping(value = "SiteMap/{entityId}") public String handleGetSiteMap(HttpServletRequest request, @PathVariable String entityId) throws NavigationProviderException { LOG.trace("handleGetSiteMap: entityId={}", entityId); diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/RegionController.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/RegionController.java index 0aa0215b2..7291f48fe 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/RegionController.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/controller/RegionController.java @@ -3,7 +3,6 @@ import com.sdl.webapp.common.api.model.MvcData; import com.sdl.webapp.common.api.model.RegionModel; import com.sdl.webapp.common.api.model.ViewModel; -import com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Controller; @@ -12,18 +11,21 @@ import javax.servlet.http.HttpServletRequest; -import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_PATH_PREFIX; +import static com.sdl.webapp.common.controller.ControllerUtils.INCLUDE_MAPPING; import static com.sdl.webapp.common.controller.RequestAttributeNames.REGION_MODEL; /** * Region controller for the Core area. *

- * This handles include requests to /system/mvc/Core/Region/{regionName} + * This handles include requests to /system/mvc/Framework/Region/{regionName} *

+ * + * @see ControllerUtils */ @Controller -@RequestMapping(INCLUDE_PATH_PREFIX + DefaultsMvcData.CoreAreaConstants.CORE_AREA_NAME + '/' + DefaultsMvcData.CoreAreaConstants.REGION_CONTROLLER_NAME) +@RequestMapping(INCLUDE_MAPPING + "/Region") public class RegionController extends BaseController { + private static final Logger LOG = LoggerFactory.getLogger(RegionController.class); /** @@ -34,7 +36,7 @@ public class RegionController extends BaseController { * @return The name of the region view that should be rendered for this request. * @throws java.lang.Exception exception */ - @RequestMapping(value = DefaultsMvcData.CoreAreaConstants.REGION_ACTION_NAME + "/{regionName}") + @RequestMapping(value = "Region" + "/{regionName}") public String handleGetRegion(HttpServletRequest request, @PathVariable String regionName) throws Exception { LOG.trace("handleGetRegion: regionName={}", regionName); diff --git a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java index 1e59c9781..b7e35d9d0 100644 --- a/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java +++ b/dxa-framework/dxa-common-api/src/main/java/com/sdl/webapp/common/util/InitializationUtils.java @@ -5,6 +5,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.input.BOMInputStream; +import org.jetbrains.annotations.Nullable; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @@ -26,6 +27,8 @@ import java.util.List; import java.util.Properties; +import static org.apache.commons.lang3.StringUtils.defaultString; + @Slf4j public final class InitializationUtils { @@ -314,4 +317,19 @@ public static void registerListener(@NonNull ServletContext servletContext, @Non servletContext.addListener(listener); log.info(REGISTERED_LOG_MESSAGE, listener.getClass().getName()); } + + /** + * Returns the value from configuration by {@code key} specified or {@code defaultValue} if there is no property with such key. + * Empty values from configuration are treated as values meaning this method doesn't check if the value is blank. + * + * @param key key to look up + * @param defaultValue default value if configuration property doesn't exist + * @return value for key, or defaultValue + * @since 1.7 + */ + @Nullable + public static String getConfiguration(String key, String defaultValue) { + return defaultString(loadDxaProperties().getProperty(key), defaultValue); + } + } diff --git a/dxa-framework/dxa-common-api/src/main/resources/dxa.defaults.properties b/dxa-framework/dxa-common-api/src/main/resources/dxa.defaults.properties index da7ed50f2..b1a59c640 100644 --- a/dxa-framework/dxa-common-api/src/main/resources/dxa.defaults.properties +++ b/dxa-framework/dxa-common-api/src/main/resources/dxa.defaults.properties @@ -8,6 +8,12 @@ dxa.web.views.prefix=/WEB-INF/Views/ dxa.web.views.suffix=.jsp dxa.web.default.init=true +dxa.web.default.area.name=Core +dxa.web.default.region.name=Main +dxa.web.default.controller.name=Entity +dxa.web.default.controller.area.name=Framework +dxa.web.default.action.name=Entity + dxa.json.xpm.aware=true #DXA Tridion 2013 Provider diff --git a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcDataTest.java b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcDataTest.java new file mode 100644 index 000000000..b39a8efbe --- /dev/null +++ b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/DefaultsMvcDataTest.java @@ -0,0 +1,32 @@ +package com.sdl.webapp.common.api.model.mvcdata; + +import org.junit.Test; + +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CORE_ENTITY; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CORE_PAGE; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.CORE_REGION; +import static org.junit.Assert.assertEquals; + +public class DefaultsMvcDataTest { + + @Test + public void shouldReturnDefaultsFromConfiguration() { + assertEquals("AreaName", DefaultsMvcData.getDefaultAreaName()); + assertEquals("RegionName", DefaultsMvcData.getDefaultRegionName()); + assertEquals("ControllerName", DefaultsMvcData.getDefaultControllerName()); + assertEquals("ControllerAreaName", DefaultsMvcData.getDefaultControllerAreaName()); + assertEquals("ActionName", DefaultsMvcData.getDefaultActionName()); + } + + @Test + public void shouldSetDefaultForCoreEnums() { + assertEquals("AreaName", CORE_ENTITY.getAreaName()); + assertEquals("Framework", CORE_ENTITY.getControllerAreaName()); + + assertEquals("AreaName", CORE_PAGE.getAreaName()); + assertEquals("Framework", CORE_PAGE.getControllerAreaName()); + + assertEquals("AreaName", CORE_REGION.getAreaName()); + assertEquals("Framework", CORE_REGION.getControllerAreaName()); + } +} \ No newline at end of file diff --git a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataCreatorTest.java b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataCreatorTest.java index 6a470088d..fe3734e31 100644 --- a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataCreatorTest.java +++ b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/mvcdata/MvcDataCreatorTest.java @@ -22,7 +22,7 @@ private static void assertPartsAreSet(Parts parts, MvcData mvcData) { public void shouldShouldCorrectlyParseDifferentTypeOfInitNames() { //given String fullName = "Core:Entity:YouTubeVideo"; - String areaViewName = "Core:YouTubeVideo"; + String areaViewName = "Hello:YouTubeVideo"; String viewName = "YouTubeVideo"; //when @@ -40,16 +40,25 @@ public void shouldShouldCorrectlyParseDifferentTypeOfInitNames() { .create(); //then - Parts parts = new Parts() - .controllerAreaName("Core") + + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") .controllerName("Entity") .areaName("Core") .actionName("Entity") - .viewName(viewName); - - assertPartsAreSet(parts, mvcDataFull); - assertPartsAreSet(parts, mvcDataHalf); - assertPartsAreSet(parts, mvcDataShort); + .viewName(viewName), mvcDataFull); + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") + .controllerName("Entity") + .areaName("Hello") + .actionName("Entity") + .viewName(viewName), mvcDataHalf); + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") + .controllerName("Entity") + .areaName("AreaName") + .actionName("Entity") + .viewName(viewName), mvcDataShort); //when mvcDataFull = creator(mvcDataFull).defaults(DefaultsMvcData.CORE_ENTITY).create(); @@ -57,15 +66,24 @@ public void shouldShouldCorrectlyParseDifferentTypeOfInitNames() { mvcDataShort = creator(mvcDataShort).defaults(DefaultsMvcData.CORE_ENTITY).create(); //then - Parts fullParts = new Parts() - .controllerAreaName("Core") + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") .controllerName("Entity") .actionName("Entity") .areaName("Core") - .viewName(viewName); - assertPartsAreSet(fullParts, mvcDataFull); - assertPartsAreSet(fullParts, mvcDataHalf); - assertPartsAreSet(fullParts, mvcDataShort); + .viewName(viewName), mvcDataFull); + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") + .controllerName("Entity") + .actionName("Entity") + .areaName("Hello") + .viewName(viewName), mvcDataHalf); + assertPartsAreSet(new Parts() + .controllerAreaName("Framework") + .controllerName("Entity") + .actionName("Entity") + .areaName("AreaName") + .viewName(viewName), mvcDataShort); } @Test(expected = IllegalArgumentException.class) @@ -126,10 +144,10 @@ public void shouldSetDefaultsValuesForEntity() { //then assertPartsAreSet(new Parts() - .controllerAreaName("Core") + .controllerAreaName("Framework") .controllerName("Entity") .actionName("Entity") - .areaName("Core") + .areaName("AreaName") .viewName(viewName), mvcData); } diff --git a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImplTest.java b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImplTest.java index 7ce16f775..370b328b3 100644 --- a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImplTest.java +++ b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/api/model/page/AbstractPageModelImplTest.java @@ -212,4 +212,17 @@ public void shouldCollectFeedItems() throws DxaException { //then assertThat(feedItems, IsIterableContainingInOrder.contains(feedItem, feedItem2)); } + + @Test + public void shouldRemoveTcmPartFromPageId() { + //given + DefaultPageModel pageModel = new DefaultPageModel(); + pageModel.setId("tcm:1-2-3"); + + //when + String pureId = pageModel.getIdWithoutTcm(); + + //then + assertEquals("2", pureId); + } } \ No newline at end of file diff --git a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/util/InitializationUtilsTest.java b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/util/InitializationUtilsTest.java index 10839ad7b..e922851a4 100644 --- a/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/util/InitializationUtilsTest.java +++ b/dxa-framework/dxa-common-api/src/test/java/com/sdl/webapp/common/util/InitializationUtilsTest.java @@ -377,4 +377,12 @@ public void shouldUserClassNameForFilterRegistration() { } + @Test + public void shouldGetConfigurationByKey() { + //when + assertEquals("cid", InitializationUtils.getConfiguration("dxa.modules.cid", null)); + assertNull(InitializationUtils.getConfiguration("not.existing.key", null)); + assertEquals("hello", InitializationUtils.getConfiguration("not.existing.key", "hello")); + } + } \ No newline at end of file diff --git a/dxa-framework/dxa-common-api/src/test/resources/dxa.defaults.properties b/dxa-framework/dxa-common-api/src/test/resources/dxa.defaults.properties index 069a26ab8..3c02b254d 100644 --- a/dxa-framework/dxa-common-api/src/test/resources/dxa.defaults.properties +++ b/dxa-framework/dxa-common-api/src/test/resources/dxa.defaults.properties @@ -6,4 +6,9 @@ dxa.web.views.folder=/META-INF/resources/ dxa.web.views.override.folder=Override dxa.web.views.prefix=/WEB-INF/Views/ dxa.web.views.suffix=.jsp -spring.profiles.include=profile-default \ No newline at end of file +spring.profiles.include=profile-default +dxa.web.default.area.name=AreaName +dxa.web.default.region.name=RegionName +dxa.web.default.controller.name=ControllerName +dxa.web.default.controller.area.name=ControllerAreaName +dxa.web.default.action.name=ActionName \ No newline at end of file diff --git a/dxa-framework/dxa-common-impl/pom.xml b/dxa-framework/dxa-common-impl/pom.xml index cf58c8496..691a558fc 100644 --- a/dxa-framework/dxa-common-impl/pom.xml +++ b/dxa-framework/dxa-common-impl/pom.xml @@ -7,7 +7,7 @@ dxa-framework com.sdl.dxa - 1.7.0-SNAPSHOT + 1.7.0 dxa-common-impl diff --git a/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImpl.java b/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImpl.java index e15adf0bb..2404dcc9f 100644 --- a/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImpl.java +++ b/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImpl.java @@ -21,10 +21,9 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultAreaName; + @Component -/** - *

ViewModelRegistryImpl class.

- */ public class ViewModelRegistryImpl implements ViewModelRegistry { private static final Logger LOG = LoggerFactory.getLogger(ViewModelRegistryImpl.class); @@ -40,60 +39,34 @@ public class ViewModelRegistryImpl implements ViewModelRegistry { * {@inheritDoc} */ @Override - public void registerViewModel(MvcData viewData, Class entityClass) { - try { - if (lock.tryLock(10, TimeUnit.SECONDS)) { - if (viewData != null) { - if (viewEntityClassMap.containsKey(viewData)) { - LOG.warn("View {} registered multiple times.", viewData); - return; - } - viewEntityClassMap.put(viewData, entityClass); - } - semanticMappingRegistry.registerEntity((Class) entityClass); - } - } catch (InterruptedException e) { - LOG.warn(e.getMessage(), e); - } finally { - lock.unlock(); - } - } - - /** - * {@inheritDoc} - */ - @Override - public Class getViewModelType(final MvcData viewData) { + public Class getViewEntityClass(final String viewName) throws DxaException { + final String areaName; + final String scopedViewName; + if (!viewName.contains(":")) { // default module + areaName = getDefaultAreaName(); + scopedViewName = viewName; + } else { + String[] parts = viewName.split(":"); + areaName = parts[0]; + scopedViewName = parts[1]; + } Predicate>> keyNamePredicate = new Predicate>>() { @Override public boolean apply(Map.Entry> input) { - MvcData thisKey = input.getKey(); - return thisKey.getViewName().equals(viewData.getViewName()) && - thisKey.getControllerName().equals(viewData.getControllerName()) && - thisKey.getAreaName().equals(viewData.getAreaName()); - } - }; - Predicate>> keyNamePredicateNoArea = - new Predicate>>() { - @Override - public boolean apply(Map.Entry> input) { - MvcData thisKey = input.getKey(); - return thisKey.getViewName().equals(viewData.getViewName()) && - (thisKey.getControllerName().equals(viewData.getControllerName()) || viewData.getControllerName() == null); + return input.getKey().getAreaName().equals(areaName) && input.getKey().getViewName().equals(scopedViewName); } }; + + Map> possibleValues = Maps.filterEntries(viewEntityClassMap, keyNamePredicate); if (possibleValues.isEmpty()) { - //first let's see if there is another relevant view - possibleValues = Maps.filterEntries(viewEntityClassMap, keyNamePredicateNoArea); - } - if (possibleValues.isEmpty()) { - return null; + throw new DxaException(String.format("Could not find a view model for the view name %s", viewName)); } else { return possibleValues.entrySet().iterator().next().getValue(); } + } /** {@inheritDoc} */ @@ -126,35 +99,63 @@ public Class getMappedModelTypes(String semanticTypeName) { return getViewModelType(mvcData); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override - public Class getViewEntityClass(final String viewName) throws DxaException { + public Class getViewModelType(final MvcData viewData) { - final String areaName; - final String scopedViewName; - if (!viewName.contains(":")) { // Core module - areaName = "Core"; - scopedViewName = viewName; - } else { - String[] parts = viewName.split(":"); - areaName = parts[0]; - scopedViewName = parts[1]; - } Predicate>> keyNamePredicate = new Predicate>>() { @Override public boolean apply(Map.Entry> input) { - return input.getKey().getAreaName().equals(areaName) && input.getKey().getViewName().equals(scopedViewName); + MvcData thisKey = input.getKey(); + return thisKey.getViewName().equals(viewData.getViewName()) && + thisKey.getControllerName().equals(viewData.getControllerName()) && + thisKey.getAreaName().equals(viewData.getAreaName()); + } + }; + Predicate>> keyNamePredicateNoArea = + new Predicate>>() { + @Override + public boolean apply(Map.Entry> input) { + MvcData thisKey = input.getKey(); + return thisKey.getViewName().equals(viewData.getViewName()) && + (thisKey.getControllerName().equals(viewData.getControllerName()) || viewData.getControllerName() == null); } }; - - Map> possibleValues = Maps.filterEntries(viewEntityClassMap, keyNamePredicate); if (possibleValues.isEmpty()) { - throw new DxaException(String.format("Could not find a view model for the view name %s", viewName)); + //first let's see if there is another relevant view + possibleValues = Maps.filterEntries(viewEntityClassMap, keyNamePredicateNoArea); + } + if (possibleValues.isEmpty()) { + return null; } else { return possibleValues.entrySet().iterator().next().getValue(); } + } + /** + * {@inheritDoc} + */ + @Override + public void registerViewModel(MvcData viewData, Class entityClass) { + try { + if (lock.tryLock(10, TimeUnit.SECONDS)) { + if (viewData != null) { + if (viewEntityClassMap.containsKey(viewData)) { + LOG.warn("View {} registered multiple times.", viewData); + return; + } + viewEntityClassMap.put(viewData, entityClass); + } + semanticMappingRegistry.registerEntity((Class) entityClass); + } + } catch (InterruptedException e) { + LOG.warn(e.getMessage(), e); + } finally { + lock.unlock(); + } } } diff --git a/dxa-framework/dxa-common-impl/src/test/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImplTest.java b/dxa-framework/dxa-common-impl/src/test/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImplTest.java new file mode 100644 index 000000000..a671cb9a0 --- /dev/null +++ b/dxa-framework/dxa-common-impl/src/test/java/com/sdl/webapp/common/impl/model/ViewModelRegistryImplTest.java @@ -0,0 +1,139 @@ +package com.sdl.webapp.common.impl.model; + +import com.google.common.collect.Sets; +import com.sdl.webapp.common.api.mapping.semantic.SemanticMappingRegistry; +import com.sdl.webapp.common.api.model.ViewModel; +import com.sdl.webapp.common.api.model.ViewModelRegistry; +import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; +import com.sdl.webapp.common.api.model.mvcdata.MvcDataCreator; +import com.sdl.webapp.common.exceptions.DxaException; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.InjectMocks; +import org.mockito.Mock; +import org.mockito.runners.MockitoJUnitRunner; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.mockito.Mockito.doReturn; +import static org.springframework.test.util.ReflectionTestUtils.getField; + +@RunWith(MockitoJUnitRunner.class) +public class ViewModelRegistryImplTest { + + @Mock + private SemanticMappingRegistry semanticMappingRegistry; + + @InjectMocks + private ViewModelRegistry registry = new ViewModelRegistryImpl(); + + @Before + public void init() { + registry.registerViewModel(MvcDataCreator.creator() + .fromQualifiedName("Core:Entity:TestEntity") + .create(), TestEntity.class); + + registry.registerViewModel(MvcDataCreator.creator() + .fromQualifiedName("Test:Entity:TestEntity2") + .create(), TestEntity2.class); + + doReturn(TestEntity.class).when(semanticMappingRegistry).getEntityClassByFullyQualifiedName("registered"); + } + + @Test + public void shouldResolveEntityClass_ToDefaultModule() throws DxaException { + //when + Class entityClass = registry.getViewEntityClass("TestEntity"); + + //then + assertEquals(TestEntity.class, entityClass); + } + + @Test + public void shouldResolveEntityClass_ToExplicitAreaName() throws DxaException { + //when + Class entityClass = registry.getViewEntityClass("Test:TestEntity2"); + + //then + assertEquals(TestEntity2.class, entityClass); + } + + @Test + public void shouldRegisterFirstView_WhenMappingIsMultiple() { + //given + int initial = ((Map) getField(registry, "viewEntityClassMap")).size(); + + //when + registry.registerViewModel(MvcDataCreator.creator() + .fromQualifiedName("Core:Entity:TestEntity") + .create(), TestEntity3.class); + + //then + assertEquals(((Map) getField(registry, "viewEntityClassMap")).size(), initial); + } + + @Test(expected = DxaException.class) + public void shouldThrowException_WhenClassNotFound() throws DxaException { + //when + registry.getViewEntityClass("Area:View"); + } + + @Test + public void shouldReturnViewModel_WhenRegistered() { + //when + Class registered = registry.getMappedModelTypes("registered"); + + //then + assertEquals(TestEntity.class, registered); + } + + @Test + public void shouldViewModel_WhenRegistered_WithSet() { + //when + Class registered = registry.getMappedModelTypes(Sets.newHashSet("not-registered", "registered")); + + //then + assertEquals(TestEntity.class, registered); + } + + @Test + public void shouldReturnNull_IfNothingIfSemanticRegistryFound() { + Class registered = registry.getMappedModelTypes(Sets.newHashSet("not-registered", "not-registered-2")); + + //then + assertNull(registered); + } + + @Test + public void shouldResolveFromViewRegistry_IfSemanticRegistryFailed() { + //when + Class entityClass = registry.getMappedModelTypes("Test:Entity:TestEntity2"); + + //then + assertEquals(TestEntity2.class, entityClass); + } + + @Test + public void shouldResolveFromViewRegistry_IfSemanticRegistryFailed_WithNoArea() { + //when + Class entityClass = registry.getMappedModelTypes("TestEntity2"); + + //then + assertEquals(TestEntity2.class, entityClass); + } + + private class TestEntity extends AbstractEntityModel { + + } + + private class TestEntity2 extends AbstractEntityModel { + + } + + private class TestEntity3 extends AbstractEntityModel { + + } +} \ No newline at end of file diff --git a/dxa-framework/dxa-tridion-provider/pom.xml b/dxa-framework/dxa-tridion-provider/pom.xml index a4b6b5bbf..d435ff051 100644 --- a/dxa-framework/dxa-tridion-provider/pom.xml +++ b/dxa-framework/dxa-tridion-provider/pom.xml @@ -6,7 +6,7 @@ dxa-framework com.sdl.dxa - 1.7.0-SNAPSHOT + 1.7.0 dxa-tridion-provider diff --git a/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/EntityBuilderImpl.java b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/EntityBuilderImpl.java index 62fc6549b..6efc669c9 100644 --- a/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/EntityBuilderImpl.java +++ b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/EntityBuilderImpl.java @@ -7,13 +7,11 @@ import com.sdl.webapp.common.api.mapping.semantic.SemanticMappingRegistry; import com.sdl.webapp.common.api.mapping.semantic.config.SemanticSchema; import com.sdl.webapp.common.api.model.EntityModel; -import com.sdl.webapp.common.api.model.MvcData; import com.sdl.webapp.common.api.model.ViewModelRegistry; import com.sdl.webapp.common.api.model.entity.AbstractEntityModel; import com.sdl.webapp.common.api.model.entity.EclItem; import com.sdl.webapp.common.api.model.entity.ExceptionEntity; import com.sdl.webapp.common.api.model.entity.MediaItem; -import com.sdl.webapp.common.api.model.mvcdata.MvcDataImpl; import com.sdl.webapp.common.controller.exception.NotFoundException; import com.sdl.webapp.common.exceptions.DxaException; import com.sdl.webapp.tridion.SemanticFieldDataProviderImpl; @@ -37,20 +35,13 @@ import java.util.Map; import java.util.Objects; +import static com.sdl.webapp.util.dd4t.MvcDataHelper.createMvcData; import static org.apache.commons.lang3.StringUtils.isEmpty; @Slf4j @Service public final class EntityBuilderImpl implements EntityBuilder { - private static final String DEFAULT_AREA_NAME = "Core"; - - private static final String DEFAULT_CONTROLLER_NAME = "Entity"; - - private static final String DEFAULT_ACTION_NAME = "Entity"; - - private static final String DEFAULT_REGION_NAME = "Main"; - @Autowired private ViewModelRegistry viewModelRegistry; @@ -139,101 +130,6 @@ private static Map createXpmMetadata(EntityModel entity, Compone return xpmMetaData; } - private static String[] getControllerNameParts(Map templateMeta) { - String fullName = FieldUtils.getStringValue(templateMeta, "controller"); - if (isEmpty(fullName)) { - fullName = DEFAULT_CONTROLLER_NAME; - } - return splitName(fullName); - } - - private static String getActionName(Map templateMeta) { - String actionName = FieldUtils.getStringValue(templateMeta, "action"); - if (isEmpty(actionName)) { - actionName = DEFAULT_ACTION_NAME; - } - return actionName; - } - - private static String[] getViewNameParts(ComponentTemplate componentTemplate) { - String fullName = FieldUtils.getStringValue(componentTemplate.getMetadata(), "view"); - if (isEmpty(fullName)) { - fullName = componentTemplate.getTitle().replaceAll("\\[.*\\]|\\s", ""); - } - return splitName(fullName); - } - - private static String[] getRegionNameParts(Map templateMeta) { - String fullName = FieldUtils.getStringValue(templateMeta, "regionView"); - if (isEmpty(fullName)) { - fullName = DEFAULT_REGION_NAME; - } - return splitName(fullName); - } - - private static String[] splitName(String name) { - final String[] parts = name.split(":"); - return parts.length > 1 ? parts : new String[]{DEFAULT_AREA_NAME, name}; - } - - private static Map getMvcMetadata(ComponentTemplate componentTemplate) { - - // TODO: Move this code into a generic MvcDataHelper class - - Map metadata = new HashMap<>(); - Map metadataFields = componentTemplate.getMetadata(); - - for (Map.Entry entry : metadataFields.entrySet()) { - String fieldName = entry.getKey(); - if ("view".equals(fieldName) || "regionView".equals(fieldName) || "controller".equals(fieldName) || - "action".equals(fieldName) || "routeValues".equals(fieldName)) { - continue; - } - Field field = entry.getValue(); - if (!field.getValues().isEmpty()) { - metadata.put(fieldName, field.getValues().get(0).toString()); // Assume single-value text fields for template metadata - } - } - return metadata; - } - - private static MvcData createMvcData(ComponentPresentation componentPresentation) { - final ComponentTemplate componentTemplate = componentPresentation.getComponentTemplate(); - final Map templateMeta = componentTemplate.getMetadata(); - - final String[] controllerNameParts = getControllerNameParts(templateMeta); - final String[] viewNameParts = getViewNameParts(componentTemplate); - final String[] regionNameParts = getRegionNameParts(templateMeta); - - final String actionName = getActionName(templateMeta); - - final Map mvcMetadata = EntityBuilderImpl.getMvcMetadata(componentPresentation.getComponentTemplate()); - - final Map routeValues = new HashMap<>(); - - String routeValuesStrings = FieldUtils.getStringValue(templateMeta, "routeValues"); - if (routeValuesStrings != null) { - for (String value : routeValuesStrings.split(",")) { - final String[] parts = value.split(":"); - if (parts.length > 1 && !routeValues.containsKey(parts[0])) { - routeValues.put(parts[0], parts[1]); - } - } - } - - return MvcDataImpl.newBuilder() - .controllerAreaName(controllerNameParts[0]) - .controllerName(controllerNameParts[1]) - .areaName(viewNameParts[0]) - .viewName(viewNameParts[1]) - .regionAreaName(regionNameParts[0]) - .regionName(regionNameParts[1]) - .actionName(actionName) - .metadata(mvcMetadata) - .routeValues(routeValues) - .build(); - } - /** * {@inheritDoc} */ diff --git a/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/PageBuilderImpl.java b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/PageBuilderImpl.java index 0d7270f65..7082addb7 100644 --- a/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/PageBuilderImpl.java +++ b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/tridion/mapping/PageBuilderImpl.java @@ -24,17 +24,16 @@ import com.sdl.webapp.common.api.model.region.RegionModelImpl; import com.sdl.webapp.common.api.model.region.RegionModelSetImpl; import com.sdl.webapp.common.exceptions.DxaException; -import com.sdl.webapp.common.util.TcmUtils; import com.sdl.webapp.tridion.SemanticFieldDataProviderImpl; import com.sdl.webapp.tridion.fields.FieldConverterRegistry; import com.sdl.webapp.tridion.fields.converters.FieldConverter; import com.sdl.webapp.tridion.fields.exceptions.FieldConverterException; import com.sdl.webapp.tridion.fields.exceptions.UnsupportedFieldTypeException; import com.sdl.webapp.util.dd4t.FieldUtils; +import com.sdl.webapp.util.dd4t.MvcDataHelper; import lombok.NonNull; import org.apache.commons.lang3.StringUtils; import org.dd4t.contentmodel.ComponentPresentation; -import org.dd4t.contentmodel.ComponentTemplate; import org.dd4t.contentmodel.Field; import org.dd4t.contentmodel.FieldSet; import org.dd4t.contentmodel.FieldType; @@ -52,15 +51,15 @@ import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import static com.google.common.base.Strings.isNullOrEmpty; +import static com.sdl.webapp.util.dd4t.MvcDataHelper.createPageMvcData; +import static com.sdl.webapp.util.dd4t.MvcDataHelper.createRegionMvcData; +import static com.sdl.webapp.util.dd4t.MvcDataHelper.getRegionName; @Component public final class PageBuilderImpl implements PageBuilder { @@ -79,20 +78,6 @@ public final class PageBuilderImpl implements PageBuilder { private static final String COMPONENT_PAGE_TITLE_FIELD_NAME = "headline"; - private static final String DEFAULT_AREA_NAME = "Core"; - - private static final String PAGE_CONTROLLER_NAME = "Page"; - - private static final String PAGE_ACTION_NAME = "Page"; - - private static final String REGION_CONTROLLER_NAME = "Region"; - - private static final String REGION_ACTION_NAME = "Region"; - - private static final String DEFAULT_REGION_NAME = "Main"; - - private static final Pattern REGION_VIEW_NAME_PATTERN = Pattern.compile(".*\\[(.*)\\]"); - @Autowired private ModelBuilderPipeline modelBuilderPipeline; @@ -173,22 +158,6 @@ private static String extract(Map metaMap, String key) { return metaMap.get(key).getValues().get(0).toString(); } - private static String getRegionName(ComponentPresentation cp) { - final Map templateMeta = cp.getComponentTemplate().getMetadata(); - if (templateMeta != null) { - String regionName = FieldUtils.getStringValue(templateMeta, "regionName"); - if (isNullOrEmpty(regionName)) { - //fallback if region name field is empty, use regionView name - regionName = FieldUtils.getStringValue(templateMeta, "regionView"); - if (isNullOrEmpty(regionName)) { - regionName = DEFAULT_REGION_NAME; - } - } - return regionName; - } - - return null; - } private static Map createXpmMetaData(org.dd4t.contentmodel.Page page, Localization localization) { final PageTemplate pageTemplate = page.getPageTemplate(); @@ -205,28 +174,6 @@ private static Map createXpmMetaData(org.dd4t.contentmodel.Page return xpmMetaDataBuilder.build(); } - private static String[] getPageViewNameParts(PageTemplate pageTemplate) { - String fullName = FieldUtils.getStringValue(pageTemplate.getMetadata(), "view"); - if (isNullOrEmpty(fullName)) { - fullName = pageTemplate.getTitle().replaceAll(" ", ""); - } - return splitName(fullName); - } - - private static String[] getRegionViewNameParts(ComponentTemplate componentTemplate) { - String fullName = FieldUtils.getStringValue(componentTemplate.getMetadata(), "regionView"); - if (isNullOrEmpty(fullName)) { - final Matcher matcher = REGION_VIEW_NAME_PATTERN.matcher(componentTemplate.getTitle()); - fullName = matcher.matches() ? matcher.group(1) : DEFAULT_REGION_NAME; - } - return splitName(fullName); - } - - private static String[] splitName(String name) { - final String[] parts = name.split(":"); - return parts.length > 1 ? parts : new String[]{DEFAULT_AREA_NAME, name}; - } - /** * {@inheritDoc} */ @@ -326,10 +273,11 @@ private PageModel createPageModel(org.dd4t.contentmodel.Page genericPage, Locali final Class entityClass = viewModelRegistry.getMappedModelTypes(semanticSchema.getFullyQualifiedNames()); pageModel = (PageModel) createViewModel(entityClass, semanticSchema, genericPage); } else { - throw new DxaException(String.format("Cannot instantiate new page of template %s", genericPage.getPageTemplate().getTitle())); + throw new DxaException(String.format("Cannot instantiate new page of template '%s' with Mvc data = %s", + genericPage.getPageTemplate().getTitle(), pageMvcData.toString())); } - pageModel.setId(String.valueOf(TcmUtils.getItemId(genericPage.getId()))); + pageModel.setId(genericPage.getId()); // It's confusing, but what DD4T calls the "title" is what is called the "name" in the view model pageModel.setName(genericPage.getTitle()); @@ -536,66 +484,6 @@ private Map processMetadataField(final Field field) { return result; } - private MvcData createPageMvcData(PageTemplate pageTemplate) { - final String[] viewNameParts = getPageViewNameParts(pageTemplate); - return MvcDataCreator.creator() - .defaults(DefaultsMvcData.CORE_PAGE) - .builder() - .areaName(viewNameParts[0]) - .viewName(viewNameParts[1]) - .metadata(getMvcMetadata(pageTemplate)) - .build(); - } - - private MvcData createRegionMvcData(ComponentTemplate componentTemplate) { - final String[] viewNameParts = getRegionViewNameParts(componentTemplate); - return MvcDataCreator.creator() - .defaults(DefaultsMvcData.CORE_REGION) - .builder() - .areaName(viewNameParts[0]) - .viewName(viewNameParts[1]) - .build(); - } - - private Map getMvcMetadata(PageTemplate pageTemplate) { - - Map metadata = new HashMap<>(); - Map metadataFields = pageTemplate.getMetadata(); - for (Map.Entry entry : metadataFields.entrySet()) { - - String fieldName = entry.getKey(); - if (fieldName.equals("view") || - fieldName.equals("includes")) { - continue; - } - Field field = entry.getValue(); - if (field.getFieldType() == FieldType.EMBEDDED) { - // Output embedded field as List> - // - List> embeddedDataList = new ArrayList<>(); - for (Object value : field.getValues()) { - FieldSet fieldSet = (FieldSet) value; - Map embeddedData = new HashMap<>(); - for (String subFieldName : fieldSet.getContent().keySet()) { - Field subField = fieldSet.getContent().get(subFieldName); - if (!subField.getValues().isEmpty()) { - embeddedData.put(subFieldName, subField.getValues().get(0).toString()); - } - } - embeddedDataList.add(embeddedData); - } - metadata.put(fieldName, embeddedDataList); - } else { - // Output other field types as single-value text fields - // - if (field.getValues().size() > 0) { - metadata.put(fieldName, field.getValues().get(0).toString()); // Assume single-value text fields for template metadata - } - } - } - return metadata; - } - private class DD4TRegionBuilderCallback implements RegionBuilderCallback { @Override @@ -615,7 +503,7 @@ public EntityModel buildEntity(Object source, Localization localization) throws @Override public String getRegionName(Object source) throws ContentProviderException { - return PageBuilderImpl.getRegionName((ComponentPresentation) source); + return MvcDataHelper.getRegionName((ComponentPresentation) source); } @Override diff --git a/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/util/dd4t/MvcDataHelper.java b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/util/dd4t/MvcDataHelper.java new file mode 100644 index 000000000..d7a158da6 --- /dev/null +++ b/dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/webapp/util/dd4t/MvcDataHelper.java @@ -0,0 +1,261 @@ +package com.sdl.webapp.util.dd4t; + +import com.google.common.collect.Sets; +import com.sdl.webapp.common.api.model.MvcData; +import com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData; +import com.sdl.webapp.common.api.model.mvcdata.MvcDataCreator; +import com.sdl.webapp.common.api.model.mvcdata.MvcDataImpl; +import com.sdl.webapp.tridion.mapping.EntityBuilderImpl; +import com.sdl.webapp.tridion.mapping.PageBuilderImpl; +import org.dd4t.contentmodel.ComponentPresentation; +import org.dd4t.contentmodel.ComponentTemplate; +import org.dd4t.contentmodel.Field; +import org.dd4t.contentmodel.FieldSet; +import org.dd4t.contentmodel.FieldType; +import org.dd4t.contentmodel.HasMetadata; +import org.dd4t.contentmodel.PageTemplate; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultActionName; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultAreaName; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultControllerName; +import static com.sdl.webapp.common.api.model.mvcdata.DefaultsMvcData.getDefaultRegionName; +import static com.sdl.webapp.util.dd4t.FieldUtils.getStringValue; +import static org.apache.commons.lang3.StringUtils.defaultIfBlank; +import static org.apache.commons.lang3.StringUtils.isEmpty; + +/** + * Utility class to work with DD4T {@link ComponentPresentation}, {@link PageTemplate} and {@link ComponentTemplate} to + * extract different forms of view/page/region names, also in form of a {@link MvcData}. + * + * @see EntityBuilderImpl + * @see PageBuilderImpl + * @since 1.7 + */ +public final class MvcDataHelper { + + private static final Pattern REGION_VIEW_NAME_PATTERN = Pattern.compile(".*\\[(.*)]"); + + private static final Set NOT_METADATA_FIELD_NAMES = Sets.newHashSet("view", "regionView", "controller", "action", "routeValues"); + + private MvcDataHelper() { + } + + @NotNull + public static MvcData createPageMvcData(@NotNull PageTemplate pageTemplate) { + final String[] viewNameParts = getPageViewNameParts(pageTemplate); + + return MvcDataCreator.creator() + .defaults(DefaultsMvcData.CORE_PAGE) + .builder() + .areaName(viewNameParts[0]) + .viewName(viewNameParts[1]) + .metadata(getMvcMetadata(pageTemplate)) + .build(); + } + + @NotNull + public static MvcData createRegionMvcData(@NotNull ComponentTemplate componentTemplate) { + final String[] viewNameParts = getRegionViewNameParts(componentTemplate); + + return MvcDataCreator.creator() + .defaults(DefaultsMvcData.CORE_REGION) + .builder() + .areaName(viewNameParts[0]) + .viewName(viewNameParts[1]) + .build(); + } + + @NotNull + public static MvcData createMvcData(@NotNull ComponentPresentation componentPresentation) { + final ComponentTemplate componentTemplate = componentPresentation.getComponentTemplate(); + + final String[] controllerNameParts = getControllerNameParts(componentTemplate); + final String[] viewNameParts = getViewNameParts(componentTemplate); + final String[] regionNameParts = getRegionViewNameParts(componentTemplate); + + return MvcDataImpl.newBuilder() + .controllerAreaName(controllerNameParts[0]) + .controllerName(controllerNameParts[1]) + .areaName(viewNameParts[0]) + .viewName(viewNameParts[1]) + .regionAreaName(regionNameParts[0]) + .regionName(regionNameParts[1]) + .actionName(getActionName(componentTemplate)) + .metadata(getMvcMetadata(componentTemplate)) + .routeValues(getRouteValues(componentTemplate)) + .build(); + } + + @Nullable + public static String getRegionName(@NotNull ComponentPresentation componentPresentation) { + Map templateMeta = componentPresentation.getComponentTemplate().getMetadata(); + String regionName = null; + + if (templateMeta != null) { + regionName = FieldUtils.getStringValue(templateMeta, "regionName"); + if (isEmpty(regionName)) { + //fallback if region name field is empty, use regionView name + regionName = defaultIfBlank(FieldUtils.getStringValue(templateMeta, "regionView"), getDefaultRegionName()); + } + } + + return regionName; + } + + @NotNull + private static Map getRouteValues(@NotNull ComponentTemplate componentTemplate) { + final Map routeValues = new HashMap<>(); + + String routeValuesStrings = FieldUtils.getStringValue(componentTemplate.getMetadata(), "routeValues"); + if (routeValuesStrings != null) { + for (String value : routeValuesStrings.split(",")) { + final String[] parts = value.split(":"); + if (parts.length > 1 && !routeValues.containsKey(parts[0])) { + routeValues.put(parts[0], parts[1]); + } + } + } + return routeValues; + } + + @NotNull + private static Map getMvcMetadata(@NotNull HasMetadata withMetadata) { + Map metadata = new HashMap<>(); + + for (Map.Entry entry : withMetadata.getMetadata().entrySet()) { + String fieldName = entry.getKey(); + + if (NOT_METADATA_FIELD_NAMES.contains(fieldName)) { + continue; + } + + Field field = entry.getValue(); + if (!field.getValues().isEmpty()) { + metadata.put(fieldName, field.getValues().get(0).toString()); // Assume single-value text fields for template metadata + } + } + + return metadata; + } + + private static Map getMvcMetadata(PageTemplate pageTemplate) { + + Map metadata = new HashMap<>(); + Map metadataFields = pageTemplate.getMetadata(); + for (Map.Entry entry : metadataFields.entrySet()) { + + String fieldName = entry.getKey(); + if ("view".equals(fieldName) || + "includes".equals(fieldName)) { + continue; + } + Field field = entry.getValue(); + if (field.getFieldType() == FieldType.EMBEDDED) { + // Output embedded field as List> + // + List> embeddedDataList = new ArrayList<>(); + for (Object value : field.getValues()) { + FieldSet fieldSet = (FieldSet) value; + Map embeddedData = new HashMap<>(); + for (String subFieldName : fieldSet.getContent().keySet()) { + Field subField = fieldSet.getContent().get(subFieldName); + if (!subField.getValues().isEmpty()) { + embeddedData.put(subFieldName, subField.getValues().get(0).toString()); + } + } + embeddedDataList.add(embeddedData); + } + metadata.put(fieldName, embeddedDataList); + } else { + // Output other field types as single-value text fields + if (!field.getValues().isEmpty()) { + metadata.put(fieldName, field.getValues().get(0).toString()); // Assume single-value text fields for template metadata + } + } + } + return metadata; + } + + @NotNull + private static String[] getViewNameParts(@NotNull ComponentTemplate componentTemplate) { + return selectViewName(componentTemplate, "view", new DefaultValueCallback() { + @Override + public String call() { + return componentTemplate.getTitle().replaceAll("\\[.*]|\\s", ""); + } + }); + } + + @NotNull + private static String[] getRegionViewNameParts(@NotNull ComponentTemplate componentTemplate) { + return selectViewName(componentTemplate, "regionView", new DefaultValueCallback() { + @Override + public String call() { + final Matcher matcher = REGION_VIEW_NAME_PATTERN.matcher(componentTemplate.getTitle()); + + return matcher.matches() ? matcher.group(1) : getDefaultRegionName(); + } + }); + } + + @NotNull + private static String getActionName(@NotNull ComponentTemplate componentTemplate) { + return defaultIfBlank(getStringValue(componentTemplate.getMetadata(), "action"), getDefaultActionName()); + } + + @NotNull + private static String[] getControllerNameParts(@NotNull ComponentTemplate componentTemplate) { + return selectViewName(componentTemplate, "controller", getDefaultControllerName()); + } + + @NotNull + private static String[] getPageViewNameParts(@NotNull PageTemplate pageTemplate) { + + return selectViewName(pageTemplate, "view", new DefaultValueCallback() { + @Override + public String call() { + return pageTemplate.getTitle().replaceAll(" ", ""); + } + }); + } + + private static String[] selectViewName(HasMetadata withMetadata, String fieldName, String defaultValue) { + return selectViewName(withMetadata, fieldName, new DefaultValueCallback() { + @Override + public String call() { + return defaultValue; + } + }); + } + + private static String[] selectViewName(HasMetadata withMetadata, String fieldName, DefaultValueCallback callback) { + String viewName = getStringValue(withMetadata.getMetadata(), fieldName); + + if (isEmpty(viewName)) { + viewName = callback.call(); + } + + return splitViewName(viewName); + } + + private static String[] splitViewName(String name) { + final String[] parts = name.split(":"); + return parts.length > 1 ? parts : new String[]{getDefaultAreaName(), name}; + } + + @FunctionalInterface + private interface DefaultValueCallback { + + String call(); + } +} diff --git a/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/mapping/PageBuilderImplTest.java b/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/mapping/PageBuilderImplTest.java index 02528fc4d..3fdd918f7 100644 --- a/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/mapping/PageBuilderImplTest.java +++ b/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/tridion/mapping/PageBuilderImplTest.java @@ -315,7 +315,7 @@ public void describeTo(Description description) { verify(viewModelRegistry).getViewModelType(argThat(mvcDataMatcher)); //TSI-2131 - assertEquals("2", page.getId()); + assertEquals("tcm:1-2-3", page.getId()); // It's confusing, but what DD4T calls the "title" is what is called the "name" in the view model assertEquals(pageName, page.getName()); assertThat("MvcData matches with that used for view resolving", page.getMvcData(), mvcDataMatcher); diff --git a/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/util/dd4t/MvcDataHelperTest.java b/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/util/dd4t/MvcDataHelperTest.java new file mode 100644 index 000000000..5b608ba19 --- /dev/null +++ b/dxa-framework/dxa-tridion-provider/src/test/java/com/sdl/webapp/util/dd4t/MvcDataHelperTest.java @@ -0,0 +1,274 @@ +package com.sdl.webapp.util.dd4t; + +import com.google.common.collect.Lists; +import com.sdl.webapp.common.api.model.MvcData; +import org.dd4t.contentmodel.ComponentPresentation; +import org.dd4t.contentmodel.ComponentTemplate; +import org.dd4t.contentmodel.Field; +import org.dd4t.contentmodel.FieldSet; +import org.dd4t.contentmodel.PageTemplate; +import org.dd4t.contentmodel.impl.EmbeddedField; +import org.dd4t.contentmodel.impl.FieldSetImpl; +import org.dd4t.contentmodel.impl.TextField; +import org.junit.Test; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +public class MvcDataHelperTest { + + @Test + public void shouldCreateMvcDataForPageTemplate() { + //given + PageTemplate pageTemplate = mock(PageTemplate.class); + + when(pageTemplate.getMetadata()).thenReturn(new HashMap() {{ + TextField viewField = new TextField(); + viewField.setTextValues(Lists.newArrayList("ANT:VNT")); + put("view", viewField); + + TextField metaField = new TextField(); + metaField.setTextValues(Lists.newArrayList("META")); + put("meta1", metaField); + + EmbeddedField embeddedField = new EmbeddedField(); + FieldSet fieldSet = new FieldSetImpl(); + fieldSet.setContent(new HashMap() {{ + TextField embed = new TextField(); + embed.setTextValues(Lists.newArrayList("EMBED")); + put("embed1", embed); + + TextField embed2 = new TextField(); + put("embed2", embed2); //to be ignored + }}); + embeddedField.setEmbeddedValues(Lists.newArrayList(fieldSet)); + put("embedded", embeddedField); + }}); + + //when + MvcData mvcData = MvcDataHelper.createPageMvcData(pageTemplate); + + //then + assertEquals("ANT", mvcData.getAreaName()); + assertEquals("VNT", mvcData.getViewName()); + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Page", mvcData.getControllerName()); + assertEquals("META", mvcData.getMetadata().get("meta1")); + //noinspection unchecked + assertTrue(((List>) mvcData.getMetadata().get("embedded")).size() == 1); // one embed is empty => ignored + assertTrue(mvcData.getMetadata().size() == 2); // view meta is not doubled, so in meta we have embed and meta1 + } + + @Test + public void shouldCreateMvcDataForPageTemplate_FallbackScenario() { + //given + PageTemplate pageTemplate = mock(PageTemplate.class); + when(pageTemplate.getTitle()).thenReturn("Title With Spaces"); + when(pageTemplate.getMetadata()).thenReturn(Collections.emptyMap()); + + //when + MvcData mvcData = MvcDataHelper.createPageMvcData(pageTemplate); + + //then + assertEquals("Core", mvcData.getAreaName()); + assertEquals("TitleWithSpaces", mvcData.getViewName()); + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Page", mvcData.getControllerName()); + } + + @Test + public void shouldCreateMvcDataForRegion() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(new HashMap() {{ + TextField viewField = new TextField(); + viewField.setTextValues(Lists.newArrayList("ANT:VNT")); + put("regionView", viewField); + }}); + + //when + MvcData mvcData = MvcDataHelper.createRegionMvcData(componentTemplate); + + //then + assertEquals("ANT", mvcData.getAreaName()); + assertEquals("VNT", mvcData.getViewName()); + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Region", mvcData.getControllerName()); + } + + @Test + public void shouldFallbackToDefaultsWithBrackets() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(Collections.emptyMap()); + when(componentTemplate.getTitle()).thenReturn("Hello[AreaName:ViewName]"); + + //when + MvcData mvcData = MvcDataHelper.createRegionMvcData(componentTemplate); + + //then + assertEquals("AreaName", mvcData.getAreaName()); + assertEquals("ViewName", mvcData.getViewName()); + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Region", mvcData.getControllerName()); + } + + @Test + public void shouldFallbackToDefaultsWithoutBrackets() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(Collections.emptyMap()); + when(componentTemplate.getTitle()).thenReturn("DoesntMatchRegexpWithBrackets"); + + //when + MvcData mvcData = MvcDataHelper.createRegionMvcData(componentTemplate); + + //then + assertEquals("Core", mvcData.getAreaName()); + assertEquals("Main", mvcData.getViewName()); + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Region", mvcData.getControllerName()); + } + + @Test + public void shouldCreateMvcDataForComponentPresentation() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(new HashMap() {{ + TextField controller = new TextField(); + controller.setTextValues(Lists.newArrayList("AreaController:ViewController")); + put("controller", controller); + + TextField view = new TextField(); + view.setTextValues(Lists.newArrayList("AreaView:ViewView")); + put("view", view); + + TextField region = new TextField(); + region.setTextValues(Lists.newArrayList("AreaRegion:ViewRegion")); + put("regionView", region); + + TextField action = new TextField(); + action.setTextValues(Lists.newArrayList("Action")); + put("action", action); + + TextField routeValues = new TextField(); + routeValues.setTextValues(Lists.newArrayList("Route1:To1,Route2:To2,Route2:WrongTo2,Route3")); + put("routeValues", routeValues); + + TextField meta1 = new TextField(); + meta1.setTextValues(Lists.newArrayList("Meta1")); + put("meta1", meta1); + + TextField meta2 = new TextField(); + put("meta2", meta2); //to ignore + }}); + + ComponentPresentation componentPresentation = mock(ComponentPresentation.class); + when(componentPresentation.getComponentTemplate()).thenReturn(componentTemplate); + + //when + MvcData mvcData = MvcDataHelper.createMvcData(componentPresentation); + + //then + assertEquals("AreaController", mvcData.getControllerAreaName()); + assertEquals("ViewController", mvcData.getControllerName()); + assertEquals("AreaView", mvcData.getAreaName()); + assertEquals("ViewView", mvcData.getViewName()); + assertEquals("AreaRegion", mvcData.getRegionAreaName()); + assertEquals("ViewRegion", mvcData.getRegionName()); + assertEquals("Action", mvcData.getActionName()); + assertEquals("Meta1", mvcData.getMetadata().get("meta1")); + assertTrue(mvcData.getMetadata().size() == 1); + Map routeValues = mvcData.getRouteValues(); + assertEquals("To1", routeValues.get("Route1")); + assertEquals("To2", routeValues.get("Route2")); + assertTrue(routeValues.size() == 2); + } + + @Test + public void shouldCreateMvcDataForComponentPresentation_FallbackScenario() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(Collections.emptyMap()); + when(componentTemplate.getTitle()).thenReturn("My Title With Spaces"); + + ComponentPresentation componentPresentation = mock(ComponentPresentation.class); + when(componentPresentation.getComponentTemplate()).thenReturn(componentTemplate); + + //when + MvcData mvcData = MvcDataHelper.createMvcData(componentPresentation); + + //then + assertEquals("Framework", mvcData.getControllerAreaName()); + assertEquals("Entity", mvcData.getControllerName()); + assertEquals("Core", mvcData.getAreaName()); + assertEquals("MyTitleWithSpaces", mvcData.getViewName()); + assertEquals("Core", mvcData.getRegionAreaName()); + assertEquals("Main", mvcData.getRegionName()); + assertEquals("Entity", mvcData.getActionName()); + } + + @Test + public void shouldGetRegionNameFromCP() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(new HashMap() {{ + TextField regionName = new TextField(); + regionName.setTextValues(Lists.newArrayList("RegionName")); + put("regionName", regionName); + }}); + + ComponentPresentation componentPresentation = mock(ComponentPresentation.class); + when(componentPresentation.getComponentTemplate()).thenReturn(componentTemplate); + + //when + String regionName = MvcDataHelper.getRegionName(componentPresentation); + + //then + assertEquals("RegionName", regionName); + } + + @Test + public void shouldFallbackToRegionViewInsteadOfRegionNameFromCP() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(new HashMap() {{ + TextField regionView = new TextField(); + regionView.setTextValues(Lists.newArrayList("RegionView")); + put("regionView", regionView); + }}); + + ComponentPresentation componentPresentation = mock(ComponentPresentation.class); + when(componentPresentation.getComponentTemplate()).thenReturn(componentTemplate); + + //when + String regionName = MvcDataHelper.getRegionName(componentPresentation); + + //then + assertEquals("RegionView", regionName); + } + + @Test + public void shouldFallbackToDefaultInsteadOfRegionName() { + //given + ComponentTemplate componentTemplate = mock(ComponentTemplate.class); + when(componentTemplate.getMetadata()).thenReturn(Collections.emptyMap()); + + ComponentPresentation componentPresentation = mock(ComponentPresentation.class); + when(componentPresentation.getComponentTemplate()).thenReturn(componentTemplate); + + //when + String regionName = MvcDataHelper.getRegionName(componentPresentation); + + //then + assertEquals("Main", regionName); + } + +} \ No newline at end of file diff --git a/dxa-framework/dxa-web8-provider/pom.xml b/dxa-framework/dxa-web8-provider/pom.xml index 6f707da76..abe97cefd 100644 --- a/dxa-framework/dxa-web8-provider/pom.xml +++ b/dxa-framework/dxa-web8-provider/pom.xml @@ -4,7 +4,7 @@ dxa-framework com.sdl.dxa - 1.7.0-SNAPSHOT + 1.7.0 ../../dxa-framework 4.0.0 diff --git a/dxa-framework/dxa-web8-provider/src/main/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProvider.java b/dxa-framework/dxa-web8-provider/src/main/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProvider.java index 9a1a3d9ea..f61aa10e8 100644 --- a/dxa-framework/dxa-web8-provider/src/main/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProvider.java +++ b/dxa-framework/dxa-web8-provider/src/main/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProvider.java @@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import java.util.Collections; @@ -73,11 +72,6 @@ private static Map getClaimsForAspect(ContextMap getContextClaims(String aspectName) throws DxaException { HttpServletRequest request = HttpUtils.getCurrentRequest(); @@ -101,6 +95,9 @@ public Map getContextClaims(String aspectName) throws DxaExcepti ContextMap contextMap; try { Evidence evidence = evidenceBuilder.build(); + if (oDataContextEngine == null) { + oDataContextEngine = new ODataContextEngine(); + } contextMap = oDataContextEngine.resolve(evidence); log.trace("Current data context engine impl is {}", oDataContextEngine.getClass()); log.debug("Requested context map for aspect {} with evidence {}, and got {}", aspectName, evidence, contextMap); diff --git a/dxa-framework/dxa-web8-provider/src/test/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProviderTest.java b/dxa-framework/dxa-web8-provider/src/test/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProviderTest.java index d0757cb51..6f528018b 100644 --- a/dxa-framework/dxa-web8-provider/src/test/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProviderTest.java +++ b/dxa-framework/dxa-web8-provider/src/test/java/com/sdl/webapp/tridion/contextengine/ContextServiceClaimsProviderTest.java @@ -3,7 +3,6 @@ import com.sdl.context.api.exception.ResolverException; import com.sdl.context.api.resolution.Evidence; import com.sdl.context.odata.client.api.ODataContextEngine; -import com.sdl.odata.client.api.exception.ODataClientRuntimeException; import com.sdl.webapp.common.api.WebRequestContext; import com.sdl.webapp.common.api.localization.Localization; import com.sdl.webapp.common.exceptions.DxaException; @@ -20,7 +19,6 @@ import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import javax.annotation.PostConstruct; import javax.servlet.http.HttpServletRequest; import java.util.Map; @@ -116,10 +114,4 @@ public void describeTo(Description description) { } })); } - - @Test(expected = ODataClientRuntimeException.class) - public void shouldInitContextEngineOnStart() throws NoSuchMethodException { - assertTrue(contextServiceClaimsProvider.getClass().getDeclaredMethod("init").isAnnotationPresent(PostConstruct.class)); - contextServiceClaimsProvider.init(); - } } \ No newline at end of file diff --git a/dxa-framework/pom.xml b/dxa-framework/pom.xml index ef58b0c72..2b40ac758 100644 --- a/dxa-framework/pom.xml +++ b/dxa-framework/pom.xml @@ -11,7 +11,7 @@ com.sdl.dxa - 1.7.0-SNAPSHOT + 1.7.0 dxa-framework pom @@ -61,7 +61,7 @@ UTF-8 UTF-8 - 1.7.0-SNAPSHOT + 1.7.0 1.8 diff --git a/dxa-webapp/pom.xml b/dxa-webapp/pom.xml index 77e893a8f..d37b16c15 100644 --- a/dxa-webapp/pom.xml +++ b/dxa-webapp/pom.xml @@ -10,7 +10,7 @@ 1.0.3 - 1.7.0-SNAPSHOT + 1.7.0 com.sdl.dxa dxa-webapp war @@ -19,7 +19,7 @@ http://www.sdl.com/cxc/digital-experience/web-experience-management/digital-experience-accelerator.html - 1.7.0-SNAPSHOT + 1.7.0 release/1.7 1.8 @@ -93,6 +93,15 @@ + + core-module + + + com.sdl.dxa.modules + dxa-module-core + + + cid-module @@ -206,10 +215,6 @@ com.sdl.dxa dxa-common-impl - - com.sdl.dxa.modules - dxa-module-core - com.sdl.dxa diff --git a/dxa-webapp/src/main/resources/cd_client_conf.xml b/dxa-webapp/src/main/resources/cd_client_conf.xml index c141188dd..a720f8246 100644 --- a/dxa-webapp/src/main/resources/cd_client_conf.xml +++ b/dxa-webapp/src/main/resources/cd_client_conf.xml @@ -1,7 +1,7 @@ diff --git a/dxa-webapp/src/main/resources/ehcache-cil.xml b/dxa-webapp/src/main/resources/ehcache-cil.xml index 8140cf689..414f63fdb 100644 --- a/dxa-webapp/src/main/resources/ehcache-cil.xml +++ b/dxa-webapp/src/main/resources/ehcache-cil.xml @@ -1,11 +1,8 @@ - + - *CD_CACHE_DURATION* + 60 10000 diff --git a/dxa-webapp/src/main/resources/ehcache.xml b/dxa-webapp/src/main/resources/ehcache.xml index 28db66657..cbfec81ce 100644 --- a/dxa-webapp/src/main/resources/ehcache.xml +++ b/dxa-webapp/src/main/resources/ehcache.xml @@ -12,15 +12,15 @@ + + - + + - + - + - ${log.folder}/cd_debug.%d{yyyy-MM-dd}.log + ${log.folder}/cd_client.%d{yyyy-MM-dd}.log ${log.history} @@ -18,122 +20,7 @@ true - - - - ${log.folder}/cd_transport.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_deployer.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_monitor.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_core.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_preview.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_content.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_discovery.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_ugc.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - com.tridion.ambientdata.AmbientDataContext - - - ${log.folder}/cd_adf.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - - ${log.folder}/cd_oauth.%d{yyyy-MM-dd}.log - ${log.history} - - - ${log.encoding} - ${log.pattern} - - true - - - + ${log.folder}/dxa.%d{yyyy-MM-dd}.log ${log.history} @@ -149,111 +36,39 @@ com.tridion.ambientdata.AmbientDataContext - ${log.pattern} - - - - - com.tridion.ambientdata.AmbientDataContext - - - ${log.folder}/dxa.stdout.%d{yyyy-MM-dd}.log - ${log.history} - - + ${log.encoding} ${log.pattern} - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - + + - + - - + + - - + + + - - + + + - - diff --git a/gradle.properties b/gradle.properties index bd5afda26..e04df794b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1 +1 @@ -version=1.7.0-SNAPSHOT \ No newline at end of file +version=1.7.0 \ No newline at end of file diff --git a/local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.jar b/local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.jar similarity index 69% rename from local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.jar rename to local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.jar index 128ee011e..37020dbc2 100644 Binary files a/local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.jar and b/local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.jar differ diff --git a/local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.pom b/local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.pom similarity index 97% rename from local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.pom rename to local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.pom index 0ff0f788c..7ab113b72 100644 --- a/local-project-repo/org/dd4t/dd4t-api/2.1.3-DXA17/dd4t-api-2.1.3-DXA17.pom +++ b/local-project-repo/org/dd4t/dd4t-api/2.1.4-DXA17/dd4t-api-2.1.4-DXA17.pom @@ -5,13 +5,13 @@ dd4t-parent org.dd4t - 2.1.3-DXA17 + 2.1.4-DXA17 4.0.0 jar dd4t-api - 2.1.3-DXA17 + 2.1.4-DXA17 ${project.groupId}:${project.artifactId} Contains the dd4t interfaces and content model. diff --git a/local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.jar b/local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.jar similarity index 86% rename from local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.jar rename to local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.jar index a25f480c9..8c981ef99 100644 Binary files a/local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.jar and b/local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.jar differ diff --git a/local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.pom b/local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.pom similarity index 99% rename from local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.pom rename to local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.pom index 650f8877b..8d38955d5 100644 --- a/local-project-repo/org/dd4t/dd4t-core/2.1.3-DXA17/dd4t-core-2.1.3-DXA17.pom +++ b/local-project-repo/org/dd4t/dd4t-core/2.1.4-DXA17/dd4t-core-2.1.4-DXA17.pom @@ -5,7 +5,7 @@ dd4t-parent org.dd4t - 2.1.3-DXA17 + 2.1.4-DXA17 4.0.0 diff --git a/local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.jar b/local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.jar similarity index 84% rename from local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.jar rename to local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.jar index f9961bd2c..28f008219 100644 Binary files a/local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.jar and b/local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.jar differ diff --git a/local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.pom b/local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.pom similarity index 98% rename from local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.pom rename to local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.pom index 0c95b0dbe..bd0f4c7cc 100644 --- a/local-project-repo/org/dd4t/dd4t-databind/2.1.3-DXA17/dd4t-databind-2.1.3-DXA17.pom +++ b/local-project-repo/org/dd4t/dd4t-databind/2.1.4-DXA17/dd4t-databind-2.1.4-DXA17.pom @@ -7,11 +7,11 @@ dd4t-parent org.dd4t - 2.1.3-DXA17 + 2.1.4-DXA17 dd4t-databind - 2.1.3-DXA17 + 2.1.4-DXA17 ${project.groupId}:${project.artifactId} Contains deserialization functionality of datasources. https://github.com/dd4t diff --git a/local-project-repo/org/dd4t/dd4t-parent/2.1.3-DXA17/dd4t-parent-2.1.3-DXA17.pom b/local-project-repo/org/dd4t/dd4t-parent/2.1.4-DXA17/dd4t-parent-2.1.4-DXA17.pom similarity index 99% rename from local-project-repo/org/dd4t/dd4t-parent/2.1.3-DXA17/dd4t-parent-2.1.3-DXA17.pom rename to local-project-repo/org/dd4t/dd4t-parent/2.1.4-DXA17/dd4t-parent-2.1.4-DXA17.pom index e1d6a22a5..c3b1dab26 100644 --- a/local-project-repo/org/dd4t/dd4t-parent/2.1.3-DXA17/dd4t-parent-2.1.3-DXA17.pom +++ b/local-project-repo/org/dd4t/dd4t-parent/2.1.4-DXA17/dd4t-parent-2.1.4-DXA17.pom @@ -7,7 +7,7 @@ org.dd4t dd4t-parent pom - 2.1.3-DXA17 + 2.1.4-DXA17 dd4t-api dd4t-core diff --git a/local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.jar b/local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.jar similarity index 83% rename from local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.jar rename to local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.jar index 4d1f7387a..77ba4af71 100644 Binary files a/local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.jar and b/local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.jar differ diff --git a/local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.pom b/local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.pom similarity index 96% rename from local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.pom rename to local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.pom index 89a512091..066d26b47 100644 --- a/local-project-repo/org/dd4t/dd4t-providers/2.1.3-DXA17/dd4t-providers-2.1.3-DXA17.pom +++ b/local-project-repo/org/dd4t/dd4t-providers/2.1.4-DXA17/dd4t-providers-2.1.4-DXA17.pom @@ -5,7 +5,7 @@ dd4t-parent org.dd4t - 2.1.3-DXA17 + 2.1.4-DXA17 4.0.0 ${project.groupId}:${project.artifactId} @@ -43,7 +43,7 @@ jar - 8.5.0-1007 + 8.5.0-1008 1.8