Skip to content

Commit

Permalink
DXA 1.7 Release
Browse files Browse the repository at this point in the history
  • Loading branch information
rpannekoek committed Dec 22, 2016
2 parents 00094cf + 0d772e0 commit 888343a
Show file tree
Hide file tree
Showing 48 changed files with 1,058 additions and 641 deletions.
4 changes: 2 additions & 2 deletions dxa-bom-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.sdl.dxa.modules</groupId>
<artifactId>dxa-bom-modules</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.7.0</version>
<packaging>pom</packaging>

<name>DXA Modules - Bill of Materials</name>
Expand Down Expand Up @@ -45,7 +45,7 @@
</developers>

<properties>
<dxa-modules.version>1.7.0-SNAPSHOT</dxa-modules.version>
<dxa-modules.version>1.7.0</dxa-modules.version>
<dxa-module-core.version>${dxa-modules.version}</dxa-module-core.version>
<dxa-module-cid.version>${dxa-modules.version}</dxa-module-cid.version>
<dxa-module-googleanalytics.version>${dxa-modules.version}</dxa-module-googleanalytics.version>
Expand Down
6 changes: 3 additions & 3 deletions dxa-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-bom</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.7.0</version>
<packaging>pom</packaging>

<name>DXA - Bill of Materials</name>
Expand Down Expand Up @@ -45,8 +45,8 @@
</developers>

<properties>
<dd4t.version>2.1.3-DXA17</dd4t.version>
<cd-cil.version>8.5.0-1007</cd-cil.version>
<dd4t.version>2.1.4-DXA17</dd4t.version>
<cd-cil.version>8.5.0-1008</cd-cil.version>

<!-- DXA versions -->
<dxa.version>${project.version}</dxa.version>
Expand Down
2 changes: 1 addition & 1 deletion dxa-builder/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group 'com.sdl.dxa'
version '1.7.0-SNAPSHOT'
version '1.7.0'

apply plugin: 'groovy'
apply plugin: 'maven-publish'
Expand Down
2 changes: 1 addition & 1 deletion dxa-framework/dxa-common-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.sdl.dxa</groupId>
<artifactId>dxa-framework</artifactId>
<version>1.7.0-SNAPSHOT</version>
<version>1.7.0</version>
</parent>

<artifactId>dxa-common-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
/**
* <p>DefaultsMvcData class.</p>
*/
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) {
Expand All @@ -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");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand All @@ -25,6 +29,9 @@
@AllArgsConstructor
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class MvcDataImpl implements MvcData {

protected static final List<String> INCLUDE_CONTROLLERS = Splitter.on(",").trimResults().splitToList("Entity, List, Navigation, Region");

@JsonProperty("ControllerAreaName")
private String controllerAreaName;

Expand Down Expand Up @@ -54,11 +61,6 @@ public class MvcDataImpl implements MvcData {
// todo dxa2 return a copy instead of real map
private Map<String, Object> metadata = new HashMap<>();

/**
* <p>Constructor for MvcDataImpl.</p>
*
* @param mvcData a {@link com.sdl.webapp.common.api.model.MvcData} object.
*/
protected MvcDataImpl(MvcData mvcData) {
this.controllerAreaName = mvcData.getControllerAreaName();
this.controllerName = mvcData.getControllerName();
Expand All @@ -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);
}
Expand All @@ -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<String, String> routeValues = new HashMap<>();

private Map<String, Object> metadata = new HashMap<>();

protected static MvcDataImplBuilder toBuilder(MvcData mvcData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,7 +36,7 @@ public abstract class AbstractPageModelImpl extends AbstractViewModel implements

private static final String XPM_PAGE_SCRIPT = "<script type=\"text/javascript\" language=\"javascript\" defer=\"defer\" src=\"%s/WebUI/Editors/SiteEdit/Views/Bootstrap/Bootstrap.aspx?mode=js\" id=\"tridion.siteedit\"></script>";

@JsonProperty("Id")
@JsonIgnore
protected String id;

@JsonIgnore
Expand Down Expand Up @@ -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}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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) {
Expand Down Expand Up @@ -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<RequestMappingInfo, HandlerMethod> handlerMethods =
this.requestMappingHandlerMapping.getHandlerMethods();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 <code>/system/mvc/Core/Entity/Entity/{entityId}</code>.
* Entity controller for the Core area that handles include requests to <code>/system/mvc/Framework/Entity/Entity/{entityId}</code>.
*
* @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.
*
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 888343a

Please sign in to comment.