Class ColumnControlRewriteRule
- java.lang.Object
-
- com.adobe.aem.modernize.component.rule.ColumnControlRewriteRule
-
- All Implemented Interfaces:
ComponentRewriteRule
,RewriteRule
,ServiceBasedRewriteRule
,Comparable<RewriteRule>
public class ColumnControlRewriteRule extends Object implements ComponentRewriteRule
Rewrites a Column Control component into multiple Responsive Grid layout components. Each column in the original control will become a grid instance with all of the appropriately nested components.The layout is mapped to column spans within the responsive grid.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.adobe.aem.modernize.rule.RewriteRule
RewriteRule.Comparator
-
-
Constructor Summary
Constructors Constructor Description ColumnControlRewriteRule()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
activate(org.osgi.service.component.ComponentContext context, com.adobe.aem.modernize.component.rule.ColumnControlRewriteRule.Config config)
@Nullable Node
applyTo(@NotNull Node root, @NotNull Set<String> finalPaths)
Updates this node, the returned node is the primary column control resource, although this updates a number of sibling resources.@NotNull Set<String>
findMatches(@NotNull org.apache.sling.api.resource.Resource resource)
Lists all resource paths in tree rooted at the specified resource, that match any rules of which this service is aware.String
getId()
Returns the unique identifier for this Rule.int
getRanking()
Ranking of this Rule relative to others that may also match a given node.String
getTitle()
The title for this rule.boolean
hasPattern(@NotNull String... slingResourceTypes)
Indicates if this service uses any of the specifiedsling:resourceType
in any of its matching logic.boolean
matches(@NotNull Node node)
Returns true if this rule matches the given subtree.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adobe.aem.modernize.rule.RewriteRule
compareTo
-
-
-
-
Field Detail
-
PN_WIDTH
protected static final String PN_WIDTH
- See Also:
- Constant Field Values
-
PN_OFFSET
protected static final String PN_OFFSET
- See Also:
- Constant Field Values
-
-
Method Detail
-
getTitle
public String getTitle()
Description copied from interface:RewriteRule
The title for this rule.- Specified by:
getTitle
in interfaceRewriteRule
- Returns:
- the title
-
getId
public String getId()
Description copied from interface:RewriteRule
Returns the unique identifier for this Rule.- Specified by:
getId
in interfaceRewriteRule
- Returns:
- the id
-
matches
public boolean matches(@NotNull @NotNull Node node) throws RepositoryException
Description copied from interface:RewriteRule
Returns true if this rule matches the given subtree.- Specified by:
matches
in interfaceRewriteRule
- Parameters:
node
- The root of the subtree to be checked for a match- Returns:
- true if this rule applies, false otherwise
- Throws:
RepositoryException
- if reading the repository fails
-
applyTo
@Nullable public @Nullable Node applyTo(@NotNull @NotNull Node root, @NotNull @NotNull Set<String> finalPaths) throws RewriteException, RepositoryException
Updates this node, the returned node is the primary column control resource, although this updates a number of sibling resources.- Specified by:
applyTo
in interfaceRewriteRule
- Parameters:
root
- The root of the subtree to be rewrittenfinalPaths
- list of nodes that should not be processed- Returns:
- updated Node
- Throws:
RewriteException
- when an error occurs during the rewrite operationRepositoryException
- when any repository operation error occurs
-
getRanking
public int getRanking()
Description copied from interface:RewriteRule
Ranking of this Rule relative to others that may also match a given node.- Specified by:
getRanking
in interfaceRewriteRule
- Returns:
- the rule's ranking
-
findMatches
@NotNull public @NotNull Set<String> findMatches(@NotNull @NotNull org.apache.sling.api.resource.Resource resource)
Description copied from interface:ServiceBasedRewriteRule
Lists all resource paths in tree rooted at the specified resource, that match any rules of which this service is aware.This method may result in fuzzy matches to improve performance and prevent resource utilization overhead.
- Specified by:
findMatches
in interfaceServiceBasedRewriteRule
- Parameters:
resource
- Resource for the root of the search- Returns:
- list of paths that match rules or an empty set if none match
-
hasPattern
public boolean hasPattern(@NotNull @NotNull String... slingResourceTypes)
Description copied from interface:ServiceBasedRewriteRule
Indicates if this service uses any of the specifiedsling:resourceType
in any of its matching logic.- Specified by:
hasPattern
in interfaceServiceBasedRewriteRule
- Parameters:
slingResourceTypes
- the sling resource type to check- Returns:
- true type matches
-
activate
protected void activate(org.osgi.service.component.ComponentContext context, com.adobe.aem.modernize.component.rule.ColumnControlRewriteRule.Config config) throws org.osgi.service.cm.ConfigurationException
- Throws:
org.osgi.service.cm.ConfigurationException
-
-