Skip to content

Commit

Permalink
DXA 2.0 CTP 1 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
rpannekoek committed Apr 6, 2017
2 parents cb9bfe2 + e6a9410 commit 94237a7
Show file tree
Hide file tree
Showing 34 changed files with 347 additions and 241 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
]
Expand Down
22 changes: 20 additions & 2 deletions dxa-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,31 @@
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-context-expressions</artifactId>
<version>${dxa-module-context-expressions}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-context-expressions-abstract</artifactId>
<version>${dxa-module-context-expressions}</version>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-context-expressions-legacy</artifactId>
<version>${dxa-module-context-expressions}</version>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-smarttarget</artifactId>
<version>${dxa-module-smarttarget.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-smarttarget-abstract</artifactId>
<version>${dxa-module-smarttarget.version}</version>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-module-smarttarget-legacy</artifactId>
<version>${dxa-module-smarttarget.version}</version>
</dependency>
<dependency>
<groupId>com.sdl.dxa.modules</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.springframework.util.Assert;

Expand All @@ -10,6 +11,7 @@
*/
@Builder
@Value
@EqualsAndHashCode(exclude = "depthCounter")
public class PageRequestDto {

private int publicationId;
Expand Down
Original file line number Diff line number Diff line change
@@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ protected ComponentPresentation getDynamicComponentPresentationInternal(int comp

return getComponentPresentation(result.getContent());
}

/**
* {@inheritDoc}
*/
Expand All @@ -75,7 +76,9 @@ public ComponentPresentation getDynamicComponentPresentation(int componentId, in
return getDynamicComponentPresentationInternal(componentId, templateId, publicationId);
}

/** {@inheritDoc} */
/**
* {@inheritDoc}
*/
@Override
public List<ComponentPresentation> getDynamicComponentPresentations(final String[] itemUris, final int templateId, final int publicationId)
throws ItemNotFoundException, SerializationException {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -178,6 +145,7 @@ public DataBindFactory databindFactory() {
@Configuration
@Profile("dxa.no-cache")
public static class NoCacheConfiguration {

@Bean
public PayloadCacheProvider cacheProvider() {
return new NoCacheProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@
import static org.apache.commons.lang3.StringUtils.isEmpty;

@Component
/**
* <p>DefaultRichTextProcessor class.</p>
*/
public class DefaultRichTextProcessor implements RichTextProcessor {

/**
* Constant <code>EMBEDDED_ENTITY="EmbeddedEntity"</code>
*/
public static final String EMBEDDED_ENTITY = "EmbeddedEntity";

private static final Logger LOG = LoggerFactory.getLogger(DefaultRichTextProcessor.class);

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -19,7 +18,6 @@

@Service
@Slf4j
@Profile("!r2.provider")
public class StaticNavigationProvider extends AbstractStaticNavigationProvider {

private static final Object $LOCK = new Object();
Expand Down
5 changes: 0 additions & 5 deletions dxa-framework/dxa-r2-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,6 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Expand Down
51 changes: 0 additions & 51 deletions dxa-framework/dxa-r2-provider/src/main/java/com/sdl/dxa/R2.java

This file was deleted.

Loading

0 comments on commit 94237a7

Please sign in to comment.