Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates the pom file in order to make it compactible with core-cif-co… #344

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f6fceb2
Updates the pon file in order to make it compactible with core-cif-co…
alwinjoseph02 Feb 12, 2025
92633f2
SITES-21278: Updates the docker image
alwinjoseph02 Feb 14, 2025
1e4a1b7
Updated docker image.
LSantha Feb 14, 2025
cc17a8b
Updated docker image.
LSantha Feb 14, 2025
cf26c46
Updated docker image.
LSantha Feb 14, 2025
10a6c9d
Updates the docker image
alwinjoseph02 Feb 15, 2025
d538d2b
Updates the docker image
alwinjoseph02 Feb 15, 2025
a1a57aa
Updates the docker image
alwinjoseph02 Feb 15, 2025
dd706fd
Updates the docker image
alwinjoseph02 Feb 15, 2025
e2cbd0d
Updates the docker image
alwinjoseph02 Feb 15, 2025
95b71f4
Updates the docker image
alwinjoseph02 Feb 15, 2025
b5bd0fe
Updates the docker image
alwinjoseph02 Feb 15, 2025
5a22717
Updates the docker image
alwinjoseph02 Feb 15, 2025
978f0bd
Updates the docker image
alwinjoseph02 Feb 15, 2025
d690149
Updates the docker image
alwinjoseph02 Feb 15, 2025
144dfe7
Updates the docker image
alwinjoseph02 Feb 15, 2025
17b6c4d
Updates the docker image
alwinjoseph02 Feb 15, 2025
2699d03
Updates the docker image
alwinjoseph02 Feb 15, 2025
5b6c0fb
Updates the docker image
alwinjoseph02 Feb 15, 2025
27015d2
Updates the docker image
alwinjoseph02 Feb 15, 2025
80ec106
Updates the docker image
alwinjoseph02 Feb 16, 2025
b8819a5
Reverts the changes
alwinjoseph02 Feb 16, 2025
2b80ab3
Merge branch 'bugfix/build-issue' into feature/SITES-21278
alwinjoseph02 Feb 16, 2025
5fa338e
SITES-21278: Resolves the build issue with classic
alwinjoseph02 Feb 16, 2025
8d8844b
SITES-21278: Resolves the build issue with classic
alwinjoseph02 Feb 16, 2025
850c3b9
SITES-21278: Resolves the build issue with classic
alwinjoseph02 Feb 16, 2025
6e31395
SITES-21278: Adds the configuration for invalidate cache
alwinjoseph02 Feb 17, 2025
0e192c2
Merge branch 'main' into feature/SITES-21278
LSantha Feb 17, 2025
bb76fb7
SITES-21278: Removed the configured property
alwinjoseph02 Feb 17, 2025
baab8f0
SITES-21278: Updates the core-cif-components version
alwinjoseph02 Feb 17, 2025
e089cd3
Updates the configuration for cache Notification
alwinjoseph02 Feb 28, 2025
0656c65
SITES-21278: Adds indexes
alwinjoseph02 Mar 12, 2025
b10f82a
SITES-21278: Adds OSGI configuration
alwinjoseph02 Mar 12, 2025
ee0f72e
SITES-21278: Adds extensibility to clear dispatcher cache based on na…
alwinjoseph02 Mar 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<configuration>
<group>com.adobe.aem.guides</group>
<name>aem-cif-guides-venia.all</name>
<packageType>container</packageType>
<packageType>mixed</packageType>
<allowIndexDefinitions>true</allowIndexDefinitions>
<properties>
<cloudManagerTarget>all</cloudManagerTarget>
</properties>
Expand Down
3 changes: 2 additions & 1 deletion classic/all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
<configuration>
<group>com.adobe.aem.guides</group>
<name>aem-cif-guides-venia.all</name>
<packageType>container</packageType>
<packageType>mixed</packageType>
<allowIndexDefinitions>true</allowIndexDefinitions>
<properties>
<cloudManagerTarget>all</cloudManagerTarget>
</properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/*******************************************************************************
*
* Copyright 2025 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
******************************************************************************/

package com.venia.core.models.commerce.services;

import com.adobe.cq.commerce.core.cacheinvalidation.spi.DispatcherCacheInvalidationStrategy;
import com.adobe.cq.commerce.magento.graphql.*;
import com.day.cq.wcm.api.Page;
import org.apache.sling.api.resource.ResourceResolver;
import org.osgi.service.component.annotations.Component;
import javax.jcr.Session;
import java.util.*;
import org.apache.sling.api.resource.Resource;

@Component(
service = DispatcherCacheInvalidationStrategy.class,
property = {"invalidateRequestParameter=categoryUids" })
public class ClearFullDispatcherCacheBasedOnCategory implements DispatcherCacheInvalidationStrategy {

private static final String HEADER_FRAGMENT_PATH = "/content/experience-fragments/venia/us/en/site/header/master";
private static final String NAVIGATION_NODE_PATH = "jcr:content/root/navigation";
private static final String STRUCTURE_DEPTH_PROPERTY = "structureDepth";
private static final String CATEGORY_LIST_KEY = "categoryList";
private static final String LEVEL_KEY = "level";

@Override
public String getPattern() {
return null;
}

@Override
public String[] getCorrespondingPagePaths(Session session, String storePath, String dataList) {
return new String[0];
}

@Override
public String getGraphqlQuery(String[] data) {
CategoryFilterInput filter = new CategoryFilterInput();
FilterEqualTypeInput identifiersFilter = new FilterEqualTypeInput().setIn(Arrays.asList(data));
filter.setCategoryUid(identifiersFilter);
QueryQuery.CategoryListArgumentsDefinition searchArgs = s -> s.filters(filter);

CategoryTreeQueryDefinition queryArgs = q -> q.uid().level();

return Operations.query(query -> query
.categoryList(searchArgs, queryArgs)).toString();
}

@Override
public String[] getPathsToInvalidate(Page page, ResourceResolver resourceResolver, Map<String, Object> data, String storePath) {
if (resourceResolver == null || data == null || !data.containsKey(CATEGORY_LIST_KEY)) {
return new String[0];
}

Integer navigationStructureDepth = getNavigationStructureDepth(resourceResolver);
if (navigationStructureDepth == null) {
return new String[0];
}

List<Map<String, Object>> categories = (List<Map<String, Object>>) data.get(CATEGORY_LIST_KEY);

if (shouldInvalidateFullCache(categories, navigationStructureDepth)) {
return new String[] { storePath };
}
return new String[0];
}

private Integer getNavigationStructureDepth(ResourceResolver resourceResolver) {
Resource headerResource = resourceResolver.getResource(
HEADER_FRAGMENT_PATH + "/" + NAVIGATION_NODE_PATH);
if (headerResource == null) {
return null;
}

return headerResource.getValueMap().get(STRUCTURE_DEPTH_PROPERTY, Integer.class);
}

private boolean shouldInvalidateFullCache(List<Map<String, Object>> categories, int navigationStructureDepth) {
return categories.stream()
.map(category -> ((Number) category.get(LEVEL_KEY)).intValue())
.filter(Objects::nonNull)
.anyMatch(level -> level <= navigationStructureDepth + 1);
}
}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<vault.user>admin</vault.user>
<vault.password>admin</vault.password>
<core.wcm.components.version>2.18.6</core.wcm.components.version>
<core.cif.components.version>2.15.0</core.cif.components.version>
<core.cif.components.version>2.15.3-SNAPSHOT</core.cif.components.version>
<graphql.client.version>1.7.10</graphql.client.version>
<magento.graphql.version>9.1.0-magento242ee</magento.graphql.version>
<bnd.version>5.1.2</bnd.version>
Expand Down
4 changes: 3 additions & 1 deletion ui.apps/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@
<plugin>
<groupId>org.apache.jackrabbit</groupId>
<artifactId>filevault-package-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<group>com.adobe.aem.guides</group>
<name>aem-cif-guides-venia.ui.apps</name>
<packageType>application</packageType>
<packageType>mixed</packageType>
<allowIndexDefinitions>true</allowIndexDefinitions>
<repositoryStructurePackages>
<repositoryStructurePackage>
<groupId>com.adobe.aem.guides</groupId>
Expand Down
3 changes: 3 additions & 0 deletions ui.apps/src/main/content/META-INF/vault/filter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
<filter root="/apps/venia/clientlibs"/>
<filter root="/apps/venia/components"/>
<filter root="/apps/venia/i18n"/>

<!-- Index for cif cache -->
<filter root="/oak:index/cifCacheInvalidationSupport" />
</workspaceFilter>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:oak="http://jackrabbit.apache.org/oak/ns/1.0"
xmlns:dam="http://www.day.com/dam/1.0"
xmlns:jcr="http://www.jcp.org/jcr/1.0"
xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="oak:QueryIndexDefinition"
async="[async,nrt]"
compatVersion="{Long}2"
evaluatePathRestrictions="{Boolean}true"
fullTextEnabled="{Boolean}false"
includedPaths="[/content]"
priority="{Long}100"
queryPaths="[/content]"
reindex="{Boolean}false"
type="lucene">
<indexRules jcr:primaryType="nt:unstructured">
<nt:unstructured jcr:primaryType="nt:unstructured">
<properties jcr:primaryType="nt:unstructured">
<product
jcr:primaryType="nt:unstructured"
name="product"
propertyIndex="{Boolean}true"
type="String"/>
<selectionType
jcr:primaryType="nt:unstructured"
name="selectionType"
propertyIndex="{Boolean}true"
type="String"/>
<selection
jcr:primaryType="nt:unstructured"
name="selection"
propertyIndex="{Boolean}true"
type="String"/>
<productType
jcr:primaryType="nt:unstructured"
name="productType"
propertyIndex="{Boolean}true"
type="String"/>
</properties>
</nt:unstructured>
</indexRules>
</jcr:root>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"enableDispatcherCacheInvalidation": true,
"dispatcherBasePathConfiguration": "/content/venia/([a-z]{2})/([a-z]{2}):/content/venia/$1/$2",
"dispatcherUrlPathConfiguration": [
"productUrlPath:/products/product-page.html/(.+):/p/$1",
"categoryUrlPath:/products/category-page.html/(.+):/c/$1",
"productUrlPath-1:/products/product-page.html/(.+):/pp/$1",
"categoryUrlPath-1:/products/category-page.html/(.+):/cc/$1"
],
"dispatcherBaseUrl": "http://localhost:80"
}