Skip to content

Commit 47ab34c

Browse files
feat(print-properties): Converting string literals to constants
1 parent 3b943dd commit 47ab34c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/form/FormConstants.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,4 +148,6 @@ private FormConstants() {
148148

149149
/** Form definition type indicating submission view */
150150
public static final String FORM_DEFINITION_SUBMISSION = "submission";
151+
152+
public static final String PRINT_CHANNEL_MARKER = "print";
151153
}

bundles/af-core/src/main/java/com/adobe/cq/forms/core/components/internal/models/v1/form/FragmentImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
public class FragmentImpl extends PanelImpl implements Fragment {
5959

6060
public static final String CUSTOM_FRAGMENT_PROPERTY_WRAPPER = "fd:fragment";
61+
private static final String PRINT_CHANNEL_PATH = "/" + JcrConstants.JCR_CONTENT + "/" + "print";
6162

6263
@OSGiService
6364
private SlingModelFilter slingModelFilter;
@@ -91,8 +92,8 @@ private String getFragmentPathBasedOnChannel(String fragmentPath) {
9192
String fragmentPathOfChannel = fragmentPath;
9293
while (formContainerResource != null) {
9394
String resourceType = formContainerResource.getValueMap().get("sling:resourceType", String.class);
94-
if (resourceType != null && resourceType.contains("print")) {
95-
fragmentPathOfChannel = fragmentPath + "/" + JcrConstants.JCR_CONTENT + "/" + "print";
95+
if (resourceType != null && resourceType.contains(FormConstants.PRINT_CHANNEL_MARKER)) {
96+
fragmentPathOfChannel = fragmentPath + PRINT_CHANNEL_PATH;
9697
break;
9798
}
9899
formContainerResource = formContainerResource.getParent();

0 commit comments

Comments
 (0)