Skip to content

Commit e87da79

Browse files
feat(newExtensionsSupport): test cases fixed
1 parent 659328b commit e87da79

File tree

5 files changed

+39
-7
lines changed

5 files changed

+39
-7
lines changed

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@ public List<String> getAccept() {
125125
.orElse(Collections.emptyList());
126126
}
127127

128-
@Override
129-
public List<String> getAcceptExtensions() {
130-
return Optional.ofNullable(acceptExtensions)
131-
.map(Arrays::asList)
132-
.orElse(Collections.emptyList());
133-
}
134-
135128
@Override
136129
public @NotNull Map<String, Object> getProperties() {
137130
Map<String, Object> customProperties = super.getProperties();

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@
1818

1919
package com.adobe.cq.forms.core.components.internal.models.v3.form;
2020

21+
import java.util.Arrays;
22+
import java.util.Collections;
23+
import java.util.List;
2124
import java.util.Map;
25+
import java.util.Optional;
2226

2327
import org.apache.sling.api.SlingHttpServletRequest;
2428
import org.apache.sling.api.resource.Resource;
@@ -48,6 +52,9 @@ public class FileInputImplV3 extends FileInputImplV2 {
4852
@Default(values = FileInput.DEFAULT_DRAGDROP_TEXT)
4953
protected String dragDropTextV3;
5054

55+
@ValueMapValue(injectionStrategy = InjectionStrategy.OPTIONAL, name = ReservedProperties.PN_FILE_ACCEPT_EXTENSIONS)
56+
protected String[] acceptExtensions;
57+
5158
@Override
5259
public String getDragDropText() {
5360
return dragDropTextV3;
@@ -60,4 +67,11 @@ public String getDragDropText() {
6067
customProperties.put(ReservedProperties.PN_DRAG_DROP_TEXT_V3, getDragDropText());
6168
return customProperties;
6269
}
70+
71+
@Override
72+
public List<String> getAcceptExtensions() {
73+
return Optional.ofNullable(acceptExtensions)
74+
.map(Arrays::asList)
75+
.orElse(Collections.emptyList());
76+
}
6377
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ default List<String> getAccept() {
5757
return DEFAULT_ACCEPT;
5858
}
5959

60+
/**
61+
* Returns the list of file extensions which field can accept. The constraint is
62+
* applicable for file attachment field
63+
*
64+
* @return the list of extensions supported by the field
65+
* @since com.adobe.cq.forms.core.components.models.form 0.0.1
66+
*/
6067
default List<String> getAcceptExtensions() {
6168
return Collections.emptyList();
6269
}

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
1616
package com.adobe.cq.forms.core.components.models.form;
1717

18+
import java.util.Collections;
19+
import java.util.List;
20+
1821
import org.osgi.annotation.versioning.ConsumerType;
1922

2023
import com.fasterxml.jackson.annotation.JsonIgnore;
@@ -40,6 +43,17 @@ default Boolean isMultiple() {
4043
return false;
4144
}
4245

46+
/**
47+
* Returns the list of file extensions which field can accept. The constraint is
48+
* applicable for file attachment field
49+
*
50+
* @return the list of extensions supported by the field
51+
*/
52+
@JsonIgnore
53+
default List<String> getAcceptExtensions() {
54+
return Collections.emptyList();
55+
}
56+
4357
/**
4458
* Returns the text to be displayed on the file input button
4559
*

ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/fileinput/v3/fileinput/_cq_dialog/.content.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@
108108
name="./acceptExtensions"
109109
jcr:primaryType="nt:unstructured"
110110
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"/>
111+
<granite:rendercondition
112+
jcr:primaryType="nt:unstructured"
113+
sling:resourceType="granite/ui/components/renderconditions/featuretoggle"
114+
toggleName="FT_FORMS-18927"/>
111115
</extensions>
112116
<acceptMessage
113117
jcr:primaryType="nt:unstructured"

0 commit comments

Comments
 (0)