Ard Schrijvers pushed to branch feature/spaplus at cms-community / 
hippo-site-toolkit


Commits:
c0a624d1 by Ard Schrijvers at 2018-03-12T17:27:01+01:00
HSTTWO-4227 Remove redundant setter and improve names

Also removed unnecessary null check

- - - - -


2 changed files:

- 
components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java
- 
components/core/src/main/java/org/hippoecm/hst/core/pagemodel/model/ComponentContainerWindowModel.java


Changes:

=====================================
components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java
=====================================
--- 
a/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java
+++ 
b/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/container/PageModelAggregationValve.java
@@ -252,7 +252,7 @@ public class PageModelAggregationValve extends 
AggregationValve {
                 
componentWindowModel.setLabel(window.getComponentInfo().getLabel());
                 addParameterMapMetadata(window, componentWindowModel);
                 decorateComponentWindowMetadata(hstRequest, hstResponse, 
componentWindowModel);
-                
curContainerWindowModel.addComponentWindowSet(componentWindowModel);
+                
curContainerWindowModel.addComponentWindow(componentWindowModel);
             } else {
                 curContainerWindowModel = null;
             }
@@ -327,17 +327,16 @@ public class PageModelAggregationValve extends 
AggregationValve {
         final HstLinkCreator linkCreator = requestContext.getHstLinkCreator();
         final HstSiteMapItem siteMapItem = 
requestContext.getResolvedSiteMapItem().getHstSiteMapItem();
 
-        if (siteMapItem != null) {
-            final Mount selfMount = 
requestContext.getResolvedMount().getMount();
-            final HstLink selfLink = linkCreator.create(siteMapItem, 
selfMount);
-            pageModel.putLink(ContainerConstants.LINK_NAME_SELF, 
selfLink.toUrlForm(requestContext, true));
+        final Mount selfMount = requestContext.getResolvedMount().getMount();
+        final HstLink selfLink = linkCreator.create(siteMapItem, selfMount);
+        pageModel.putLink(ContainerConstants.LINK_NAME_SELF, 
selfLink.toUrlForm(requestContext, true));
 
-            final Mount siteMount = 
requestContext.getMount(ContainerConstants.MOUNT_ALIAS_SITE);
-            if (siteMount != null) {
-                final HstLink siteLink = linkCreator.create(siteMapItem, 
siteMount);
-                pageModel.putLink(ContainerConstants.LINK_NAME_SITE, 
siteLink.toUrlForm(requestContext, true));
-            }
+        final Mount siteMount = 
requestContext.getMount(ContainerConstants.MOUNT_ALIAS_SITE);
+        if (siteMount != null) {
+            final HstLink siteLink = linkCreator.create(siteMapItem, 
siteMount);
+            pageModel.putLink(ContainerConstants.LINK_NAME_SITE, 
siteLink.toUrlForm(requestContext, true));
         }
+
     }
 
     /**


=====================================
components/core/src/main/java/org/hippoecm/hst/core/pagemodel/model/ComponentContainerWindowModel.java
=====================================
--- 
a/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/model/ComponentContainerWindowModel.java
+++ 
b/components/core/src/main/java/org/hippoecm/hst/core/pagemodel/model/ComponentContainerWindowModel.java
@@ -27,7 +27,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 public class ComponentContainerWindowModel extends 
IdentifiableLinkableMetadataBaseModel {
 
     private final String name;
-    private Set<ComponentWindowModel> componentWindowSet;
+    private Set<ComponentWindowModel> componentWindows;
 
     public ComponentContainerWindowModel(final String id, final String name) {
         super(id);
@@ -43,23 +43,19 @@ public class ComponentContainerWindowModel extends 
IdentifiableLinkableMetadataB
     }
 
     @JsonProperty("components")
-    public Set<ComponentWindowModel> getComponentWindowSet() {
-        if (componentWindowSet == null) {
+    public Set<ComponentWindowModel> getComponentWindows() {
+        if (componentWindows == null) {
             return Collections.emptySet();
         }
 
-        return componentWindowSet;
+        return componentWindows;
     }
 
-    public void setComponentWindowSet(Set<ComponentWindowModel> 
componentWindowSet) {
-        this.componentWindowSet = componentWindowSet;
-    }
-
-    public void addComponentWindowSet(ComponentWindowModel componentWindow) {
-        if (componentWindowSet == null) {
-            componentWindowSet = new LinkedHashSet<>();
+    public void addComponentWindow(ComponentWindowModel componentWindow) {
+        if (componentWindows == null) {
+            componentWindows = new LinkedHashSet<>();
         }
 
-        componentWindowSet.add(componentWindow);
+        componentWindows.add(componentWindow);
     }
 }



View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/c0a624d1cf73663134981ac73bb677512a5e4982

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-site-toolkit/commit/c0a624d1cf73663134981ac73bb677512a5e4982
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to