Skip to content

Commit

Permalink
Merge pull request adobe#140 from npeltier/adobeGH-139
Browse files Browse the repository at this point in the history
adobeGH-139 enhancements to IDTagger
  • Loading branch information
npeltier authored Aug 26, 2020
2 parents 50d3899 + a44c972 commit 08b7be9
Show file tree
Hide file tree
Showing 8 changed files with 585 additions and 234 deletions.
2 changes: 1 addition & 1 deletion bundles/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Bundle-DocURL:
<dependency>
<groupId>com.adobe.dx</groupId>
<artifactId>testing</artifactId>
<version>0.0.10</version>
<version>0.0.11-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
48 changes: 48 additions & 0 deletions bundles/core/src/main/java/com/adobe/dx/domtagging/IDTagger.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright 2020 Adobe
~
~ Licensed 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 CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

package com.adobe.dx.domtagging;

import org.apache.sling.api.SlingHttpServletRequest;
import org.apache.sling.api.resource.Resource;
import org.jetbrains.annotations.Nullable;

public interface IDTagger {

/**
* Get an ID for the given component request, depending on:
* <ol>
* <li>property that has been manually set on the component resource,</li>
* <li>if nothing is set, eventual presence of the tag set on the component resource by that service,</li>
* <li>if still nothing generation of an id. In that case next request will generate another id</li>
* </ol>
* The service also prepend reference components at the page root level with the reference component id, to
* avoid duplicate IDs as much as we can
*
* @param request current component request
* @param property property that could override any id value, can be null
* @return
*/
String computeComponentId(final SlingHttpServletRequest request, @Nullable String property);

/**
* Tags, if needed and configured, a resource with page & component id
*
* @param resource resource to tag
*/
void tagResource(Resource resource);

}
Loading

0 comments on commit 08b7be9

Please sign in to comment.