Skip to content

Commit 126fd28

Browse files
committed
2.2
2 parents 884e729 + 78d6e33 commit 126fd28

File tree

5 files changed

+34
-15
lines changed

5 files changed

+34
-15
lines changed

dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/EntityModelBuilder.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ public interface EntityModelBuilder extends ModelBuilder {
1919
/**
2020
* Builds a strongly typed Entity Model based on a given DXA R2 Data Model. Never returns {@code null}.
2121
*
22+
* @param <T> The expected class of the value.
2223
* @param originalEntityModel the strongly typed {@linkplain EntityModel Entity Model} to build.
2324
* Is {@code null} for the first {@linkplain EntityModelBuilder Entity Model Builder} in the {@link ModelBuilderPipelineImpl}
2425
* @param modelData the DXA R2 Data Model
2526
* @param expectedClass required class of entity model, gets the priority if {@code modelData} contains {@linkplain MvcModelData MVC} data
2627
* @return the strongly typed Entity Model
28+
* @throws DxaException Thrown when building of model fails
2729
*/
2830
@Contract("_, _, _ -> !null")
2931
<T extends EntityModel> T buildEntityModel(@Nullable T originalEntityModel, EntityModelData modelData,

dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/ModelBuilderPipeline.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public interface ModelBuilderPipeline {
1818
/**
1919
* See {@link PageModelBuilder#buildPageModel(PageModel, PageModelData)}.
2020
*
21+
* @param modelData model data
2122
* @return Page Model or {@code null} if no builders are registered
2223
*/
2324
@NotNull
@@ -27,16 +28,21 @@ public interface ModelBuilderPipeline {
2728
* See {@link EntityModelBuilder#buildEntityModel(EntityModel, EntityModelData, Class)}.
2829
* {@code expectedClass} defaults to data from {@code MvcData}
2930
*
31+
* @param modelData model data
3032
* @return Entity Model or {@code null} if no builders are registered
33+
* @throws DxaException in case
3134
*/
3235
@NotNull
3336
<T extends EntityModel> T createEntityModel(@NotNull EntityModelData modelData) throws DxaException;
3437

3538
/**
3639
* See {@link EntityModelBuilder#buildEntityModel(EntityModel, EntityModelData, Class)}.
3740
*
41+
* @param <T> type that extends EntityModel
42+
* @param modelData model data
43+
* @param expectedClass expected class
3844
* @return Entity Model
39-
* @throws IllegalArgumentException in case
45+
* @throws DxaException in case
4046
*/
4147
@NotNull
4248
<T extends EntityModel> T createEntityModel(@NotNull EntityModelData modelData, @Nullable Class<T> expectedClass) throws DxaException;

dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/PageModelBuilder.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public interface PageModelBuilder extends ModelBuilder {
2121
* Is {@code null} for the first {@linkplain PageModelBuilder Page Model Builder} in the {@link ModelBuilderPipelineImpl}
2222
* @param modelData the DXA R2 Data Model
2323
* @return the strongly typed Page Model, or {@code null} if cannot build a page
24+
* @throws SemanticMappingException in case of issue during semantic mapping
2425
*/
2526
@Nullable
2627
PageModel buildPageModel(@Nullable PageModel originalPageModel, PageModelData modelData) throws SemanticMappingException;

dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/impl/AbstractContentProvider.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public void setEntityEvaluators(List<ConditionalEntityEvaluator> entityEvaluator
4343

4444
/**
4545
* This default implementation handles caching and cloning the pagemodel.
46-
* Actually getting the pagemodel from the backend is done in loadPage.
46+
* Actually getting the page model from the backend is done in loadPage.
4747
*
48-
* @param path
49-
* @param localization
50-
* @return
51-
* @throws ContentProviderException
48+
* @param path path
49+
* @param localization Localization object
50+
* @return page model
51+
* @throws ContentProviderException in case of bad request
5252
*/
5353
public PageModel getPageModel(String path, Localization localization) throws ContentProviderException {
5454
Assert.notNull(localization);
@@ -100,10 +100,10 @@ public PageModel getPageModel(String path, Localization localization) throws Con
100100
* This default implementation handles caching and cloning the pagemodel.
101101
* Actually getting the pagemodel from the backend is done in loadPage.
102102
*
103-
* @param pageId
104-
* @param localization
105-
* @return
106-
* @throws ContentProviderException
103+
* @param pageId page ID
104+
* @param localization Localization object
105+
* @return page model
106+
* @throws ContentProviderException in case of bad request
107107
*/
108108
public PageModel getPageModel(int pageId, Localization localization) throws ContentProviderException {
109109
Assert.notNull(localization);
@@ -153,7 +153,7 @@ public PageModel getPageModel(int pageId, Localization localization) throws Cont
153153

154154
/**
155155
* Create a cache key for the current claims.
156-
* @return
156+
* @return cache key
157157
*/
158158
private String getClaimCacheKey() {
159159
ClaimStore currentClaimStore = WebContext.getCurrentClaimStore();

dxa-framework/dxa-tridion-provider/src/main/java/com/sdl/dxa/tridion/mapping/impl/StronglyTypedTopicBuilder.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,11 @@ public StronglyTypedTopicBuilder() throws XPathExpressionException {
100100
/**
101101
* Tries to convert a given generic Topic to a Strongly Typed Topic Model.
102102
*
103+
* @param <T> entity model type
103104
* @param genericTopic The generic Topic to convert.
104105
* @param ofType The type of the Strongly Typed Topic Model to convert to. If not specified (or null), the type will be determined from the XHTML.
105-
* @returns The Strongly Typed Topic Model or null if the generic Topic cannot be converted.
106+
* @return The Strongly Typed Topic Model or null if the generic Topic cannot be converted.
107+
* @throws DxaException in case of error during conversion
106108
*/
107109
public <T extends EntityModel> T tryConvertToStronglyTypedTopic(GenericTopic genericTopic, Class<T> ofType) throws DxaException {
108110
LOG.debug("Trying to convert {} to Strongly Typed Topic Model...", genericTopic);
@@ -235,10 +237,14 @@ protected String getPropertyXPath(String propertyName) {
235237
}
236238

237239
/**
238-
* Filters the XHTML elements found by the XPath query.
240+
* Filters the XHTML elements found by the XPath query.
239241
*
240-
* Because we use "contains" in the XPath, it may match on part of a class name.
241-
* We filter out any partial matches here.
242+
* Because we use "contains" in the XPath, it may match on part of a class name.
243+
* We filter out any partial matches here.
244+
*
245+
* @param htmlNodes list of html nodes
246+
* @param ditaPropertyName property name
247+
* @return List of filtered elements
242248
*/
243249
protected List<Element> filterXPathResults(NodeList htmlNodes, String ditaPropertyName) {
244250
if (htmlNodes == null || htmlNodes.getLength() == 0)
@@ -472,8 +478,12 @@ protected Link buildLink(Element htmlElement) {
472478
/**
473479
* Builds a strongly typed Entity Model based on a given DXA R2 Data Model.
474480
*
481+
* @param <T> entity model type
475482
* @param entityModel The strongly typed Entity Model to build. Is null for the first Entity Model Builder in the pipeline.
476483
* @param entityModelData The DXA R2 Data Model.
484+
* @param expectedClass expected class.
485+
* @return entity model
486+
* @throws DxaException in case of error during conversion
477487
*/
478488
@Override
479489
public <T extends EntityModel> T buildEntityModel(@Nullable T entityModel, EntityModelData entityModelData, @Nullable Class<T> expectedClass) throws DxaException {

0 commit comments

Comments
 (0)