diff --git a/README.md b/README.md
index 6a7fec7b9..41e1af72e 100644
--- a/README.md
+++ b/README.md
@@ -30,7 +30,7 @@ If you encounter any issues with the Digital Experience Accelerator, please reac
Documentation
-------------
-Documentation can be found online in the SDL documentation portal: http://docs.sdl.com/sdldxa
+Documentation can be found online in the SDL documentation portal: http://docs.sdl.com/sdldxa2-ctp
Repositories
diff --git a/build.gradle b/build.gradle
index 1d67a77d9..8628b9122 100644
--- a/build.gradle
+++ b/build.gradle
@@ -31,7 +31,7 @@ task help(type: MavenHelpTask)
task buildFramework(type: MavenBuildTask) {
configurations = [
- ["dxa-bom"],
+ //["dxa-bom"],
["dxa-framework"],
["> dxa-webapp > clean org.apache.maven.plugins:maven-archetype-plugin:2.4:create-from-project -Darchetype.properties=archetype.properties"]
]
diff --git a/dxa-bom/pom.xml b/dxa-bom/pom.xml
index e42035f42..93a4432fb 100644
--- a/dxa-bom/pom.xml
+++ b/dxa-bom/pom.xml
@@ -186,13 +186,31 @@
com.sdl.dxa.modulesdxa-module-context-expressions${dxa-module-context-expressions}
- compile
+
+
+ com.sdl.dxa.modules
+ dxa-module-context-expressions-abstract
+ ${dxa-module-context-expressions}
+
+
+ com.sdl.dxa.modules
+ dxa-module-context-expressions-legacy
+ ${dxa-module-context-expressions}com.sdl.dxa.modulesdxa-module-smarttarget${dxa-module-smarttarget.version}
- runtime
+
+
+ com.sdl.dxa.modules
+ dxa-module-smarttarget-abstract
+ ${dxa-module-smarttarget.version}
+
+
+ com.sdl.dxa.modules
+ dxa-module-smarttarget-legacy
+ ${dxa-module-smarttarget.version}com.sdl.dxa.modules
diff --git a/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmButtonTag.java b/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmButtonTag.java
index b924c49c0..8531f1de9 100644
--- a/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmButtonTag.java
+++ b/dxa-framework/dxa-common-impl/src/main/java/com/sdl/webapp/common/impl/taglib/xpm/XpmButtonTag.java
@@ -45,8 +45,12 @@ protected HtmlNode generateXpmMarkup() {
.build();
} else {
String title = "Edit " + this.region.getXpmMetadata().get(INCLUDED_FROM_PAGE_TITLE_XPM_METADATA_KEY);
- String editUrl = ApplicationContextHolder.getContext().getBean(WebRequestContext.class).getLocalization().localizePath(
- this.region.getXpmMetadata().get(INCLUDED_FROM_PAGE_FILE_NAME_XPM_METADATA_KEY).toString());
+ String urlOfInclude = this.region.getXpmMetadata().get(INCLUDED_FROM_PAGE_FILE_NAME_XPM_METADATA_KEY).toString();
+ if (!urlOfInclude.matches("/?system/include.*")) {
+ urlOfInclude = String.format("system/include/%s", urlOfInclude.startsWith("/") ? urlOfInclude.substring(1) : urlOfInclude);
+ }
+ String editUrl = ApplicationContextHolder.getContext().getBean(WebRequestContext.class)
+ .getLocalization().localizePath(urlOfInclude);
return HtmlBuilders.div()
.withClass("xpm-button" + (cssClass == null ? "" : " " + cssClass))
.withNode(HtmlBuilders.a(editUrl)
diff --git a/dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/PageRequestDto.java b/dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/PageRequestDto.java
index 30b3ba91a..17c44c373 100644
--- a/dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/PageRequestDto.java
+++ b/dxa-framework/dxa-common/src/main/java/com/sdl/dxa/common/dto/PageRequestDto.java
@@ -2,6 +2,7 @@
import lombok.AllArgsConstructor;
import lombok.Builder;
+import lombok.EqualsAndHashCode;
import lombok.Value;
import org.springframework.util.Assert;
@@ -10,6 +11,7 @@
*/
@Builder
@Value
+@EqualsAndHashCode(exclude = "depthCounter")
public class PageRequestDto {
private int publicationId;
diff --git a/dxa-framework/dxa-common/src/test/java/com/sdl/dxa/common/dto/PageRequestDtoTest.java b/dxa-framework/dxa-common/src/test/java/com/sdl/dxa/common/dto/PageRequestDtoTest.java
new file mode 100644
index 000000000..5b3df6485
--- /dev/null
+++ b/dxa-framework/dxa-common/src/test/java/com/sdl/dxa/common/dto/PageRequestDtoTest.java
@@ -0,0 +1,27 @@
+package com.sdl.dxa.common.dto;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class PageRequestDtoTest {
+
+ @Test
+ public void shouldIgnoreDepthCounter_InEqualsAndHashCodeCheck() {
+ //given
+ PageRequestDto dto1 = PageRequestDto.builder()
+ .includePages(PageRequestDto.PageInclusion.INCLUDE)
+ .path("/").build();
+
+ PageRequestDto dto2 = PageRequestDto.builder()
+ .includePages(PageRequestDto.PageInclusion.INCLUDE)
+ .path("/").build();
+
+ //when
+ dto2.depthIncreaseAndCheckIfSafe();
+
+ //then
+ assertEquals(dto2, dto1);
+ assertEquals(dto2.hashCode(), dto1.hashCode());
+ }
+}
\ No newline at end of file
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/BrokerComponentPresentationProvider.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/BrokerComponentPresentationProvider.java
index f5e35f9a7..06696be72 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/BrokerComponentPresentationProvider.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/BrokerComponentPresentationProvider.java
@@ -57,6 +57,7 @@ protected ComponentPresentation getDynamicComponentPresentationInternal(int comp
return getComponentPresentation(result.getContent());
}
+
/**
* {@inheritDoc}
*/
@@ -75,7 +76,9 @@ public ComponentPresentation getDynamicComponentPresentation(int componentId, in
return getDynamicComponentPresentationInternal(componentId, templateId, publicationId);
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public List getDynamicComponentPresentations(final String[] itemUris, final int templateId, final int publicationId)
throws ItemNotFoundException, SerializationException {
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/SpringContextConfiguration.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/SpringContextConfiguration.java
index cb79381a4..4eca1907a 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/SpringContextConfiguration.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/SpringContextConfiguration.java
@@ -1,13 +1,5 @@
package com.sdl.webapp.tridion;
-import com.sdl.web.api.content.BinaryContentRetriever;
-import com.sdl.web.api.dynamic.BinaryContentRetrieverImpl;
-import com.sdl.web.api.dynamic.DynamicMappingsRetriever;
-import com.sdl.web.api.dynamic.DynamicMappingsRetrieverImpl;
-import com.sdl.web.api.dynamic.DynamicMetaRetriever;
-import com.sdl.web.api.dynamic.DynamicMetaRetrieverImpl;
-import com.sdl.web.api.taxonomies.TaxonomyRelationManager;
-import com.tridion.taxonomies.TaxonomyFactory;
import org.dd4t.contentmodel.impl.BaseField;
import org.dd4t.contentmodel.impl.ComponentImpl;
import org.dd4t.core.factories.ComponentPresentationFactory;
@@ -37,16 +29,6 @@
@ComponentScan("com.sdl.webapp.tridion")
public class SpringContextConfiguration {
- @Bean
- public TaxonomyFactory webTaxonomyFactory() {
- return new TaxonomyFactory();
- }
-
- @Bean
- public TaxonomyRelationManager taxonomyRelationManager() {
- return new TaxonomyRelationManager();
- }
-
@Bean
public BrokerLinkProvider linkProvider() {
BrokerLinkProvider linkProvider = new BrokerLinkProvider();
@@ -82,21 +64,6 @@ public ComponentPresentationProvider componentPresentationProvider() {
return componentPresentationProvider;
}
- @Bean
- public DynamicMetaRetriever dynamicMetaRetriever() {
- return new DynamicMetaRetrieverImpl();
- }
-
- @Bean
- public BinaryContentRetriever binaryContentRetriever() {
- return new BinaryContentRetrieverImpl();
- }
-
- @Bean
- public DynamicMappingsRetriever dynamicMappingsRetriever() {
- return new DynamicMappingsRetrieverImpl();
- }
-
@Bean
public PayloadCacheProvider cacheProvider() {
EHCacheProvider cacheProvider = new EHCacheProvider();
@@ -178,6 +145,7 @@ public DataBindFactory databindFactory() {
@Configuration
@Profile("dxa.no-cache")
public static class NoCacheConfiguration {
+
@Bean
public PayloadCacheProvider cacheProvider() {
return new NoCacheProvider();
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/fields/converters/ComponentLinkFieldConverter.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/fields/converters/ComponentLinkFieldConverter.java
index 7df18924f..17c4822ba 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/fields/converters/ComponentLinkFieldConverter.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/fields/converters/ComponentLinkFieldConverter.java
@@ -5,8 +5,10 @@
import com.sdl.webapp.common.api.content.LinkResolver;
import com.sdl.webapp.common.api.localization.Localization;
import com.sdl.webapp.common.api.mapping.semantic.SemanticMappingException;
+import com.sdl.webapp.common.api.model.EntityModel;
import com.sdl.webapp.common.api.model.entity.AbstractEntityModel;
import com.sdl.webapp.common.api.model.entity.Link;
+import com.sdl.webapp.common.util.TcmUtils;
import com.sdl.webapp.tridion.fields.exceptions.FieldConverterException;
import com.sdl.webapp.tridion.fields.exceptions.UnsupportedTargetTypeException;
import com.sdl.webapp.tridion.mapping.ModelBuilderPipeline;
@@ -26,6 +28,7 @@ public class ComponentLinkFieldConverter extends AbstractFieldConverter {
private static final FieldType[] SUPPORTED_FIELD_TYPES = {FieldType.COMPONENTLINK};
private final LinkResolver linkResolver;
+
private final WebRequestContext webRequestContext;
@Autowired
@@ -69,10 +72,11 @@ public Object createPageLink(org.dd4t.contentmodel.Page page, Class> targetCla
String pageId = page.getId();
final String url = linkResolver.resolveLink(pageId, null);
- if (targetClass.isAssignableFrom(String.class)) {
+ if (targetClass == String.class) {
return url;
- } else if (targetClass.isAssignableFrom(Link.class)) {
+ } else if (Link.class.isAssignableFrom(targetClass)) {
final Link link = new Link();
+ link.setId(String.valueOf(TcmUtils.getItemId(pageId)));
link.setUrl(url);
return link;
} else {
@@ -85,18 +89,20 @@ public Object createComponentLink(org.dd4t.contentmodel.Component component, Cla
String componentId = component.getId();
final String url = linkResolver.resolveLink(componentId, null);
- if (targetClass.isAssignableFrom(String.class)) {
+ if (String.class == targetClass) {
return url;
- } else if (targetClass.isAssignableFrom(Link.class)) {
+ } else if (Link.class.isAssignableFrom(targetClass)) {
final Link link = new Link();
+ link.setId(String.valueOf(TcmUtils.getItemId(componentId)));
link.setUrl(url);
return link;
- } else if (AbstractEntityModel.class.isAssignableFrom(targetClass)) {
+ } else if (EntityModel.class.isAssignableFrom(targetClass)) { //what we want should be assignable from what we want to have
Localization localization = this.webRequestContext.getLocalization();
try {
Object retval = builder.createEntityModel(component, localization);
- if (targetClass.isAssignableFrom(retval.getClass())) {
+ // what we got should be assignable from what we expected
+ if (retval != null && targetClass.isAssignableFrom(retval.getClass())) {
return retval;
} else {
return null;
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultContentProvider.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultContentProvider.java
index 01bb012db..724dc2d5f 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultContentProvider.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultContentProvider.java
@@ -13,6 +13,7 @@
import com.sdl.webapp.common.exceptions.DxaItemNotFoundException;
import com.sdl.webapp.common.util.LocalizationUtils;
import com.sdl.webapp.common.util.TcmUtils;
+import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.dd4t.contentmodel.Component;
import org.dd4t.contentmodel.ComponentPresentation;
@@ -37,7 +38,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.util.UriUtils;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -82,8 +85,9 @@ public DefaultContentProvider(WebRequestContext webRequestContext,
}
@Override
+ @SneakyThrows(UnsupportedEncodingException.class)
protected PageModel _loadPage(String _path, Localization localization) throws ContentProviderException {
- return LocalizationUtils.findPageByPath(_path, localization, (path, publicationId) -> {
+ return LocalizationUtils.findPageByPath(UriUtils.encodePath(_path, "UTF-8"), localization, (path, publicationId) -> {
final org.dd4t.contentmodel.Page genericPage;
try {
synchronized (LOCK) {
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultRichTextProcessor.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultRichTextProcessor.java
index 598233dc3..3a75c128a 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultRichTextProcessor.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/mapping/DefaultRichTextProcessor.java
@@ -54,15 +54,13 @@
import static org.apache.commons.lang3.StringUtils.isEmpty;
@Component
-/**
- *
DefaultRichTextProcessor class.
- */
public class DefaultRichTextProcessor implements RichTextProcessor {
/**
* Constant EMBEDDED_ENTITY="EmbeddedEntity"
*/
public static final String EMBEDDED_ENTITY = "EmbeddedEntity";
+
private static final Logger LOG = LoggerFactory.getLogger(DefaultRichTextProcessor.class);
@Autowired
diff --git a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/navigation/StaticNavigationProvider.java b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/navigation/StaticNavigationProvider.java
index 4b584b506..cec8cc3e3 100644
--- a/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/navigation/StaticNavigationProvider.java
+++ b/dxa-framework/dxa-dd4t-provider/src/main/java/com/sdl/webapp/tridion/navigation/StaticNavigationProvider.java
@@ -10,7 +10,6 @@
import org.dd4t.core.exceptions.ItemNotFoundException;
import org.dd4t.core.factories.PageFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
import java.io.ByteArrayInputStream;
@@ -19,7 +18,6 @@
@Service
@Slf4j
-@Profile("!r2.provider")
public class StaticNavigationProvider extends AbstractStaticNavigationProvider {
private static final Object $LOCK = new Object();
diff --git a/dxa-framework/dxa-r2-provider/pom.xml b/dxa-framework/dxa-r2-provider/pom.xml
index 8ffb8f72a..40e0bbda9 100644
--- a/dxa-framework/dxa-r2-provider/pom.xml
+++ b/dxa-framework/dxa-r2-provider/pom.xml
@@ -64,11 +64,6 @@
pom
-
- xalan
- xalan
-
-
com.fasterxml.jackson.corejackson-annotations
diff --git a/dxa-framework/dxa-r2-provider/src/main/java/com/sdl/dxa/R2.java b/dxa-framework/dxa-r2-provider/src/main/java/com/sdl/dxa/R2.java
deleted file mode 100644
index f7f2c22f2..000000000
--- a/dxa-framework/dxa-r2-provider/src/main/java/com/sdl/dxa/R2.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.sdl.dxa;
-
-import com.sdl.webapp.tridion.navigation.DynamicNavigationProvider;
-import org.springframework.context.annotation.Primary;
-import org.springframework.context.annotation.Profile;
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Marker annotation/shortcut for R2 pipeline profile. This annotation should be put on {@link Component}s and subclasses
- * to conditionally enable them in case of presence of {@code r2.provider} Spring profile.
- *
Pay attention that this also makes a bean {@code @Primary}. This means that in case you have 2+
- * beans of the same time, this potentially won't work, solution is simple (without double use of {@code @Primary}):