-
Notifications
You must be signed in to change notification settings - Fork 60
feat(print-properties): Adding dorContainer
in each component and pageTemplate
in FormContainer and new print specific components
#1567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
06029ad
84595f0
2f5b773
8364461
759fc18
17b1fcd
fbd6c54
e21b887
87fd33d
5754617
4e40c00
d983f5c
95637d5
d0c3127
a44da37
4a2337e
9dd6f5d
342ab72
d16065c
38d35ec
f86758b
7278ab6
3905f4b
8d4f206
14823b3
0802951
13d35b6
e6df077
c139ebf
76d0013
58c4f65
626fc80
9daa825
51397f7
dc54a47
e2552f4
addff88
7098df6
7a7e6ec
85615a7
8b3f729
6c2e675
a102c16
e7fce1f
b4da8b9
147aee9
5c5ebec
2a4e3a2
647aab7
6224fde
5a50aff
73544b8
7dda7cd
6869b67
61f5635
6d98a95
cf75caf
4bcab00
9b37340
0c2f684
3cd94a8
ef2296c
39c0a34
3a02724
0f7b44e
12394b1
db7d064
bc9494f
d65475d
46d6e36
e29e6a9
78832dc
4bb41b9
a4ee1a8
2c8b3a9
97d3ef3
e0e0e98
25d3fc1
49161a3
ddb399a
5968306
da806f0
7869af1
1f0c175
599209d
897c3a9
1127fb1
c687c1a
1c68613
ed6e81a
1f6d1aa
b771876
4f1d925
1616f4f
f24a6f5
be540ca
f81a7b3
4e204cc
adcab7f
b2e04c1
27acd0f
9563283
5a664b1
5bc69d4
f56d4f2
a4d38ce
c2f5541
3602adc
2caf07b
ca0df4b
b78d438
bda638f
d5988f7
7e23ad8
de89d87
4e68519
368d0d2
eefb043
45a8ac9
00a1790
6b9929c
ea0cb35
63d59ea
cf8a03e
e8c4979
77c9fbb
e591a34
9adecdb
89dc082
2d66a36
d78a971
675ef55
7cbad92
e694f73
3fad22c
f6da205
66d5662
14ba330
573440a
9bb657f
d968cb0
d30c482
e20dcc6
bd4c837
890f849
e5686e6
3e010cf
246fd7a
56978ed
558d89a
e735020
c0d0baa
ad3d757
58997bd
0a0313e
06fb328
7cd9fc8
86de2d9
09a848e
cb83e8f
78aef26
18e5781
a88abc7
144f931
22a13d0
c90e7b6
40ce0e8
521decf
e8ff6ed
2f622bc
79fbc3b
ad87c1d
aa43dd7
dd23f7b
dc954be
34cf735
50964b5
1ebba30
05c089b
862d26d
69ec08a
684783c
b4642c5
d765a1e
b9c4756
52fb23d
c7bad24
c532fb7
0a1cc6a
cf9a75a
1528964
ef16f4c
3f88d8b
2170fa9
c350bba
55c0249
24a61cd
b239d36
29a6ad1
416dde5
588fcfb
a629c0f
76dc85d
59ab8fa
fc7e5c2
cf0ba1d
79f398c
355d616
71b6ab5
e8664c4
1e9337d
759e5e3
ac40ad7
294c1f1
0fd0c32
685f4b0
e5208e3
f9e6af4
a0ba68e
228c96e
2fe0f60
c8f495f
bf6a091
9f5815e
9af1ab2
daca019
9441b66
caec2bc
bfdc252
a26841e
bf86385
f47b25d
e058642
be59600
db39664
91af370
3d36975
381920e
fc23df6
368c9b8
148081b
48b8c44
a81d73d
279019e
9068451
490339d
e64eee5
ff844e6
ff49fcb
27c99d9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,18 @@ | |
|
||
import java.io.IOException; | ||
import java.math.BigDecimal; | ||
import java.util.*; | ||
import java.util.AbstractMap; | ||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.Calendar; | ||
import java.util.Collections; | ||
import java.util.HashMap; | ||
import java.util.HashSet; | ||
import java.util.LinkedHashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
import java.util.Set; | ||
import java.util.function.Predicate; | ||
import java.util.regex.Pattern; | ||
import java.util.stream.Collectors; | ||
|
@@ -44,11 +55,13 @@ | |
import com.adobe.aemds.guide.utils.GuideUtils; | ||
import com.adobe.cq.forms.core.components.datalayer.FormComponentData; | ||
import com.adobe.cq.forms.core.components.internal.datalayer.ComponentDataImpl; | ||
import com.adobe.cq.forms.core.components.internal.form.FormConstants; | ||
import com.adobe.cq.forms.core.components.internal.form.ReservedProperties; | ||
import com.adobe.cq.forms.core.components.models.form.BaseConstraint; | ||
import com.adobe.cq.forms.core.components.models.form.FieldType; | ||
import com.adobe.cq.forms.core.components.models.form.FormComponent; | ||
import com.adobe.cq.forms.core.components.models.form.Label; | ||
import com.adobe.cq.forms.core.components.models.form.print.dorapi.DorContainer; | ||
import com.adobe.cq.wcm.core.components.models.Component; | ||
import com.adobe.cq.wcm.core.components.util.ComponentUtils; | ||
import com.day.cq.i18n.I18n; | ||
|
@@ -58,6 +71,7 @@ | |
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.fasterxml.jackson.databind.JsonSerializer; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
@@ -258,6 +272,7 @@ protected boolean getEditMode() { | |
} | ||
|
||
public static final String CUSTOM_DOR_PROPERTY_WRAPPER = "fd:dor"; | ||
public static final String CUSTOM_DOR_CONTAINER_WRAPPER = "dorContainer"; | ||
// used for DOR and SPA editor to work | ||
public static final String CUSTOM_JCR_PATH_PROPERTY_WRAPPER = "fd:path"; | ||
|
||
|
@@ -544,6 +559,10 @@ public Map<String, Object> getDorProperties() { | |
if (dorBindRef != null) { | ||
customDorProperties.put("dorBindRef", dorBindRef); | ||
} | ||
Map<String, Object> dorContainer = getDorContainer(); | ||
if (dorContainer != null) { | ||
customDorProperties.put(CUSTOM_DOR_CONTAINER_WRAPPER, dorContainer); | ||
} | ||
return customDorProperties; | ||
} | ||
|
||
|
@@ -567,4 +586,26 @@ private List<String> getDisabledXFAScripts() { | |
} | ||
return new ArrayList<>(disabledScripts); | ||
} | ||
|
||
/** | ||
* Returns the dor container properties. | ||
* | ||
* @return Map of dor container properties if `fd:dorContainer` node is present otherwise returns null | ||
*/ | ||
@JsonIgnore | ||
@Override | ||
public Map<String, Object> getDorContainer() { | ||
if (FormConstants.CHANNEL_PRINT.equals(this.channel) && resource != null) { | ||
Resource dorContainerResource = resource.getChild("fd:dorContainer"); | ||
if (dorContainerResource != null) { | ||
DorContainer dorContainer = dorContainerResource.adaptTo(DorContainer.class); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is confusing -> DorContainer for each component, nomenclature needs to be improved, I believe you mean DorComponent and not DorContainer There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a single interface for all components? (this seems to be the case, seeing the implementation), how large is it? if its very small, and will not be required to change frequently, then we can have it here, this will lead to removing of dependency of core components on newly introduced print artifact There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The name
Yes...we have a single interface for all components because they have a large number of common properties and almost half of them are non-primitive(objects of other classes). Since there were so many classes involved, that's why, @rismehta suggested moving these interfaces to a different artifact. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok, so basically it encapsulates all other classes. Then we might have to live with print dependency. Just make sure that only interfaces are defined in the dependant print artifact. The implementations of these apis are in a different artifact (bundle), this will ensure keeping the dependency light and will be less prone to breaking core components. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To keep it lean, we have even segregated the interfaces into two bundles. |
||
ObjectMapper objectMapper = new ObjectMapper(); | ||
if (dorContainer != null) { | ||
return objectMapper.convertValue(dorContainer, new TypeReference<Map<String, Object>>() {}); | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rismehta : Here I am assuming
dorContainer
node will be named asfd:dorContainer
in JCR, keeping it in consistency withfd:rules
and'fd:events
. I hope it is okay.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
take this in spec review meeting