Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ private ReservedProperties() {
public static final String PN_SUBMIT_EMAIL_CC = "cc";
public static final String PN_SUBMIT_EMAIL_BCC = "bcc";
public static final String PN_SUBMIT_SPREADSHEETURL = "spreadsheetUrl";
// AEP submit action properties
public static final String SS_AEP = "aep";
public static final String PN_SUBMIT_AEP_SCHEMA_REF_ID = "schemaRefId";
public static final String PN_SUBMIT_AEP_IMS_ORG_ID = "imsOrgId";
public static final String PN_SUBMIT_AEP_SANDBOX_REGION = "sandboxRegion";
public static final String PN_SUBMIT_AEP_SANDBOX_ID = "sandboxId";
public static final String PN_SUBMIT_AEP_DATASET_ID = "datasetId";
// End: Form submission related properties
private static final Set<String> reservedProperties = aggregateReservedProperties();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;

@Model(
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { FormContainer.class, ContainerExporter.class, ComponentExporter.class },
resourceType = { FormContainerImpl.RESOURCE_TYPE, FormConstants.RT_FD_FRAGMENT_CONTAINER_V1 })
adaptables = { SlingHttpServletRequest.class, Resource.class },
adapters = { FormContainer.class, ContainerExporter.class, ComponentExporter.class },
resourceType = { FormContainerImpl.RESOURCE_TYPE, FormConstants.RT_FD_FRAGMENT_CONTAINER_V1 })
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
public class FormContainerImpl extends AbstractContainerImpl implements FormContainer {
protected static final String RESOURCE_TYPE = "core/fd/components/form/container/v2/container";
Expand All @@ -95,6 +95,9 @@ public class FormContainerImpl extends AbstractContainerImpl implements FormCont
/** Constant representing spreadsheet submit action type */
private static final String SS_SPREADSHEET = "spreadsheet";

/** Constant representing AEP submit action type */
private static final String SS_AEP = ReservedProperties.SS_AEP;

@OSGiService(injectionStrategy = InjectionStrategy.OPTIONAL)
private CoreComponentCustomPropertiesProvider coreComponentCustomPropertiesProvider;

Expand Down Expand Up @@ -278,7 +281,7 @@ public String getId() {
// handling use-case when AF is used in iframe mode inside embed form component
if (request != null && request.getAttribute("formRenderingInsideEmbedContainer") != null) {
return ComponentUtils.getEncodedPath(StringUtils.replace(getPath(), "/" + JcrConstants.JCR_CONTENT + "/"
+ GuideConstants.GUIDE_CONTAINER_NODE_NAME, ""));
+ GuideConstants.GUIDE_CONTAINER_NODE_NAME, ""));
}
return ComponentUtils.getEncodedPath(getPath());
}
Expand Down Expand Up @@ -482,7 +485,9 @@ private Map<String, Object> getSubmitProperties() {

Map<String, Object> submitProps = null;

if (request == null || ComponentUtils.shouldIncludeSubmitProperties(request)) {
String actionName = resource.getValueMap().get(ReservedProperties.PN_SUBMIT_ACTION_NAME, String.class);
if (request == null || ComponentUtils.shouldIncludeSubmitProperties(request)
|| (StringUtils.isNotBlank(actionName) && (SS_AEP.equals(actionName)))) {
submitProps = new LinkedHashMap<>();
List<String> submitActionProperties = Arrays.asList(
ReservedProperties.PN_SUBMIT_ACTION_TYPE,
Expand All @@ -496,7 +501,15 @@ private Map<String, Object> getSubmitProperties() {
ReservedProperties.PN_SUBMIT_EMAIL_BCC);

List<String> submitSpreadsheetProperties = Arrays.asList(
ReservedProperties.PN_SUBMIT_SPREADSHEETURL);
ReservedProperties.PN_SUBMIT_SPREADSHEETURL);

List<String> submitAepProperties = Arrays.asList(
ReservedProperties.PN_SUBMIT_AEP_SCHEMA_REF_ID,
ReservedProperties.PN_SUBMIT_AEP_IMS_ORG_ID,
ReservedProperties.PN_SUBMIT_AEP_SANDBOX_REGION,
ReservedProperties.PN_SUBMIT_AEP_SANDBOX_ID,
ReservedProperties.PN_SUBMIT_AEP_DATASET_ID);

ValueMap resourceMap = resource.getValueMap();
for (Map.Entry<String, Object> entry : resourceMap.entrySet()) {
if (submitActionProperties.contains(entry.getKey())) {
Expand All @@ -507,6 +520,9 @@ private Map<String, Object> getSubmitProperties() {
} else if (submitSpreadsheetProperties.contains(entry.getKey())) {
submitProps.computeIfAbsent(SS_SPREADSHEET, k -> new LinkedHashMap<String, Object>());
((Map<String, Object>) submitProps.get(SS_SPREADSHEET)).put(entry.getKey(), entry.getValue());
} else if (submitAepProperties.contains(entry.getKey())) {
submitProps.computeIfAbsent(SS_AEP, k -> new LinkedHashMap<String, Object>());
((Map<String, Object>) submitProps.get(SS_AEP)).put(entry.getKey(), entry.getValue());
}
}
}
Expand Down