Skip to content

Commit 0b89561

Browse files
committed
update javadocs issues
1 parent 4c92327 commit 0b89561

File tree

12 files changed

+183
-131
lines changed

12 files changed

+183
-131
lines changed

aemdesign-aem-services/src/main/java/design/aem/models/v2/details/ContactDetails.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ protected void ready() {
122122
/***
123123
* substitute formatted field template with fields from component
124124
* @param componentProperties source map with fields
125-
* @param i18n
126-
* @param sling
125+
* @param i18n i18n instance
126+
* @param sling sling instance
127127
* @return returns map with new values
128128
*/
129129
@SuppressWarnings("Duplicates")

aemdesign-aem-services/src/main/java/design/aem/models/v2/details/EventDetails.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ protected void ready() {
140140
/***
141141
* substitute formatted field template with fields from component.
142142
* @param componentProperties source map with fields
143-
* @param i18n
144-
* @param sling
143+
* @param i18n i18n instance
144+
* @param sling sling instance
145145
* @return returns map with new values
146146
*/
147147
@SuppressWarnings("Duplicates")

aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/List.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ static Map<String,Object> getPageBadgeInfo(Page page,String[] detailsNameSuffix,
420420

421421
/**
422422
* get list options type.
423-
* @return
423+
* @return selected list type
424424
*/
425425
protected Source getListType() {
426426
String listFromValue = componentProperties.get(PN_SOURCE, getCurrentStyle().get(PN_SOURCE, StringUtils.EMPTY));
@@ -429,7 +429,7 @@ protected Source getListType() {
429429

430430
/**
431431
* get list items, used by HTL templates.
432-
* @return
432+
* @return collection of list types
433433
*/
434434
public Collection<Map<String,Object>> getListItems() {
435435

@@ -665,8 +665,8 @@ private void populateSearchListItems() {
665665

666666
/**
667667
* get predicate group from query string.
668-
* @param request
669-
* @return
668+
* @param request reques instance
669+
* @return predicates converted from query string
670670
*/
671671
public static PredicateGroup getPredicateGroupFromRequest(SlingHttpServletRequest request) {
672672

@@ -691,7 +691,7 @@ public static PredicateGroup getPredicateGroupFromRequest(SlingHttpServletReques
691691
/**
692692
* get predicate group config from querystring param.
693693
* @param queryParam query string param, same as querybuilder
694-
* @return
694+
* @return predicates converted from query string
695695
*/
696696
public static PredicateGroup getPredicateGroupFromQuery(String queryParam) {
697697

aemdesign-aem-services/src/main/java/design/aem/models/v2/lists/SearchList.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ protected void ready() {
261261
*
262262
* @param slingRequest `SlingHttpServletRequest` instance
263263
* @param resourceResolver `ResourceResolver` instance
264+
* @return formed query object
264265
*/
265266
public Query composeQueryBuilder(
266267
SlingHttpServletRequest slingRequest,
@@ -312,6 +313,7 @@ public Query composeQueryBuilder(
312313
* @param searchResults Array to store the normalised dataset in
313314
* @param sling `SlingScriptHelper` instance
314315
* @param slingRequest `SlingHttpServletRequest` instance
316+
* @param result search result instance
315317
*/
316318
public void normaliseContentTree(
317319
java.util.List<CustomSearchResult> searchResults,

aemdesign-aem-services/src/main/java/design/aem/utils/UserManagementUtil.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,10 @@ public static String getEmail(Authorizable authorizable) throws RepositoryExcept
162162

163163
/**
164164
* <p>Returns mailing target in format: "NAME" [E-MAIL].</p>
165-
* @param authorizable user
165+
* @param resourceResolver resolver instance
166+
* @param authorizable user to check
166167
* @return Mailing target or null in case of non-specified email
168+
* @throws RepositoryException if cant read content
167169
*/
168170
public static String getNameAndEmail(ResourceResolver resourceResolver, Authorizable authorizable) throws RepositoryException {
169171
String email = getEmail(authorizable);

aemdesign-aem-services/src/main/java/design/aem/utils/components/CommonUtil.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ public static boolean validDetailComponent(String resourceType) {
308308
* @param page is the current page (for a reference to the root node)
309309
* @param nodeName is the node name to check for
310310
* @return true if the script exists
311-
* @throws RepositoryException when can't read content
312311
*/
313312
public static boolean nodeExists(Page page, String nodeName) {
314313
if (page == null || isEmpty(nodeName)) {
@@ -432,7 +431,7 @@ public static String getSingularPropertyString(Node node, String key) throws Rep
432431
/***
433432
* find a component in a page root that matches required suffix.
434433
* @param inputPage is the page to look through for the component
435-
* @param resourceTypeTail
434+
* @param resourceTypeTail string to use for matching resource type
436435
* @return path to component
437436
*/
438437
public static String findComponentInPage(Page inputPage, String[] resourceTypeTail) {
@@ -446,7 +445,6 @@ public static String findComponentInPage(Page inputPage, String[] resourceTypeTa
446445
* @param resourceTypeTail array for suffixes to check as endsWith with sling:resourceType or node name (as failover)
447446
* @param pageRoots use matching page root as a staring point for search
448447
* @return the path to component
449-
* @throws RepositoryException when can't read content
450448
*/
451449
public static String findComponentInPage(Page inputPage, String[] resourceTypeTail, String[] pageRoots) {
452450

@@ -549,6 +547,7 @@ public static long tryParseLong(String value, long defaultValue) {
549547
* Return a JCR node for a first found matching path
550548
*
551549
* @param thisPage is the page to inspect for newsdetails
550+
* @param nodePaths paths to look for
552551
* @return a JCR node or null when not found
553552
*/
554553
public static String getComponentNodePath(Page thisPage, String[] nodePaths) {
@@ -571,6 +570,7 @@ public static String getComponentNodePath(Page thisPage, String[] nodePaths) {
571570
* Return a JCR node for a first found matching path
572571
*
573572
* @param thisPage is the page to inspect for newsdetails
573+
* @param nodePaths paths to look for
574574
* @return a JCR node or null when not found
575575
*/
576576
public static Node getComponentNode(Page thisPage, String[] nodePaths) {
@@ -614,20 +614,24 @@ public static Node getComponentNode(Page thisPage, String componentPath) {
614614
* @param thisPage is the page to inspect for component
615615
* @return a JCR node or null when not found
616616
*/
617-
public static Node getFirstMediaNode(Page thisPage) throws RepositoryException {
617+
public static Node getFirstMediaNode(Page thisPage) {
618618
Node media = null;
619-
Node par = getComponentNode(thisPage, "article/par");
620-
if (par != null) {
621-
NodeIterator ite = par.getNodes();
622-
while (ite.hasNext()) {
623-
Node node = (Node) ite.next();
624-
String type = node.getProperty(RESOURCE_TYPE).getValue().toString();
625-
if ((type.indexOf("mediagallery") != -1) || (type.indexOf("video") != -1)) {
626-
media = node;
627-
break;
628-
}
619+
try {
620+
Node par = getComponentNode(thisPage, "article/par");
621+
if (par != null) {
622+
NodeIterator ite = par.getNodes();
623+
while (ite.hasNext()) {
624+
Node node = (Node) ite.next();
625+
String type = node.getProperty(RESOURCE_TYPE).getValue().toString();
626+
if ((type.indexOf("mediagallery") != -1) || (type.indexOf("video") != -1)) {
627+
media = node;
628+
break;
629+
}
629630

631+
}
630632
}
633+
} catch (Exception ex) {
634+
LOGGER.error("getFirstMediaNode: Could not get media node in page {}, err: {}",thisPage,ex);
631635
}
632636
return media;
633637

aemdesign-aem-services/src/main/java/design/aem/utils/components/ComponentsUtil.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -601,8 +601,8 @@ public class ComponentsUtil {
601601
* Get a include file contents
602602
*
603603
* @param resourceResolver is the resource
604-
* @param paths
605-
* @param separator
604+
* @param paths paths to check
605+
* @param separator separator to use
606606
* @return a string with the file contents
607607
*/
608608
public static String getResourceContent(ResourceResolver resourceResolver, String[] paths, String separator) {
@@ -1356,6 +1356,7 @@ public static ComponentProperties getComponentProperties(Map<String, Object> pag
13561356
* return variant template name from component or return default
13571357
* @param component component to check for variant template
13581358
* @param variantTemplate variant template
1359+
* @param sling sling instance
13591360
* @return variant template path
13601361
*/
13611362
public static String getComponentVariantTemplate(Component component, String variantTemplate, SlingScriptHelper sling) {
@@ -1382,7 +1383,6 @@ public static String getComponentVariantTemplate(Component component, String var
13821383
* @param data map of data attributes and values
13831384
* @param xssAPI old xssi api
13841385
* @return attributes string
1385-
* @throws IOException
13861386
*/
13871387
@SuppressWarnings("Depreciated")
13881388
public static String buildAttributesString(Map<String, String> data, com.adobe.granite.xss.XSSAPI xssAPI) {
@@ -1395,7 +1395,6 @@ public static String buildAttributesString(Map<String, String> data, com.adobe.g
13951395
* @param xssAPI old xssi api
13961396
* @param encodings map of encoding per data attribute
13971397
* @return attributes string
1398-
* @throws IOException
13991398
*/
14001399
@SuppressWarnings({"Depreciated", "squid:S3776"})
14011400
public static String buildAttributesString(Map<String, String> data, com.adobe.granite.xss.XSSAPI xssAPI, Map<String, String> encodings) {
@@ -1446,7 +1445,7 @@ public static String buildAttributesString(Map<String, String> data, com.adobe.g
14461445

14471446
/***
14481447
*
1449-
* @deprecated please use responsive {@link design.aem.utils.components.ImagesUtil.getBackgroundImageRenditions} or ComponentProperties.attr which is an AttributeBuilder.
1448+
* @deprecated please use responsive {@link design.aem.utils.components.ImagesUtil#getBackgroundImageRenditions} or ComponentProperties.attr which is an AttributeBuilder.
14501449
* add style tag to component attributes collection
14511450
* @param componentProperties component attributes collection
14521451
* @param resource resource to search for image
@@ -1724,6 +1723,7 @@ public static Resource findInheritedResource(Page page, ComponentContext compone
17241723
/***
17251724
* get attribute from first item list of maps.
17261725
* @param sourceMap map to use
1726+
* @param attributeName attribute name
17271727
* @return value of attribute from first found element
17281728
*/
17291729
public static String getFirstAttributeFromList(LinkedHashMap<String, Map> sourceMap, String attributeName) {
@@ -1765,6 +1765,7 @@ public static String getComponentInPagePath(Node componentNode) {
17651765
* find local resource in component and its super components
17661766
* @param component component to check
17671767
* @param resourceName local resource name
1768+
* @param sling sing instance
17681769
* @return local resource path found
17691770
*/
17701771
@SuppressWarnings("squid:S3776")
@@ -1831,10 +1832,10 @@ public static String findLocalResourceInSuperComponent(Component component, Stri
18311832

18321833
/**
18331834
* create a map of component fields matched to Dialog Title and Description
1834-
* @param componentResource
1835-
* @param adminResourceResolver
1836-
* @param slingScriptHelper
1837-
* @return
1835+
* @param componentResource component resource
1836+
* @param adminResourceResolver admin resolver
1837+
* @param slingScriptHelper sling script helper
1838+
* @return map of component dialog fields and their attributes
18381839
*/
18391840
public static Map<String, Object> getComponentFieldsAndDialogMap(Resource componentResource , ResourceResolver adminResourceResolver, SlingScriptHelper slingScriptHelper) {
18401841
Map<String, Object> firstComponentConfig = new HashMap<>();
@@ -2004,7 +2005,6 @@ public static boolean isStringRegex(String value, String patternToUse) {
20042005
* @param value value to add into JXTL context
20052006
* @return returns evaluated value
20062007
* @throws JexlException throes Jexl errors with regex expression
2007-
* @throws Exception thows other errors
20082008
*
20092009
*/
20102010
public static Object evaluateExpressionWithValue(JxltEngine jxlt, JexlContext jc, String expression, Object value) {
@@ -2053,6 +2053,7 @@ public static String formattedRssDate(Calendar cal) {
20532053
* Transform calendar into a publication date.
20542054
*
20552055
* @param cal is the calendar to transform
2056+
* @param format format to use
20562057
* @return is the formatted RSS date.
20572058
*/
20582059
public static String formatDate(Calendar cal, String format) {

aemdesign-aem-services/src/main/java/design/aem/utils/components/ImagesUtil.java

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ public class ImagesUtil {
160160
*
161161
* @param assetNode is the asset to interogate
162162
* @param key is the key to get the metadata for
163+
* @param defaultValue default value to return on null
163164
* @return the value or null when nothing is found
164165
*/
165166
public static String getMetadataStringForKey(Node assetNode, String key, String defaultValue) {
@@ -281,16 +282,23 @@ public static Rendition getThumbnail(Asset asset, int minWidth) {
281282
return null;
282283
}
283284

284-
public static String getThumbnailUrl(Page page, ResourceResolver _resourceResolver) {
285-
return _resourceResolver.map(page.getPath().concat(DEFAULT_THUMB_SELECTOR_MD));
285+
/**
286+
* get thumbnail url for a page.
287+
* @param page page object
288+
* @param resourceResolver resource resolver instance
289+
* @return page thumbnail url
290+
*/
291+
public static String getThumbnailUrl(Page page, ResourceResolver resourceResolver) {
292+
return resourceResolver.map(page.getPath().concat(DEFAULT_THUMB_SELECTOR_MD));
286293
}
287294

288295

289296
/**
290297
* Get width of the asset
291298
*
299+
* @param assetNode asset node to check metadata in
292300
* @return width of asset
293-
* @throws javax.jcr.RepositoryException
301+
* @throws javax.jcr.RepositoryException when can't access asset
294302
*/
295303
public static int getWidth(Node assetNode) throws RepositoryException {
296304
int width = 0;
@@ -379,7 +387,6 @@ public static String getResourceImageCustomHref(Resource resource, String imageR
379387
* get asset reference for image node from a page
380388
* @param page to use as source
381389
* @return path to image or return default reference to page thumbnail selector
382-
* @throws RepositoryException when can't read content
383390
*/
384391
public static String getPageImgReferencePath(Page page) {
385392
String imagePath = getResourceImagePath(page.getContentResource(), DEFAULT_IMAGE_NODE_NAME);
@@ -934,6 +941,9 @@ public static ComponentProperties getBackgroundImageRenditions(Map<String, Objec
934941
/***
935942
* get resource image settings.
936943
* @param wcmUsePojoModel component model model
944+
* @param resource resource to use
945+
* @param attributeName attribute name to use
946+
* @param returnLastRenditionName rendition to stop search on
937947
* @return returns map of attributes
938948
*/
939949
public static ComponentProperties getResourceImageRenditions(WCMUsePojo wcmUsePojoModel, Resource resource, String attributeName, String returnLastRenditionName) {
@@ -953,6 +963,9 @@ public static ComponentProperties getResourceImageRenditions(WCMUsePojo wcmUsePo
953963
/***
954964
* get resource image settings.
955965
* @param pageContext page context
966+
* @param resource resource to use
967+
* @param attributeName attribute name to use
968+
* @param returnLastRenditionName last rendition to return if not found
956969
* @return returns map of attributes
957970
*/
958971
public static ComponentProperties getResourceImageRenditions(PageContext pageContext, Resource resource, String attributeName, String returnLastRenditionName) {
@@ -971,6 +984,9 @@ public static ComponentProperties getResourceImageRenditions(PageContext pageCon
971984
/***
972985
* get resource image settings.
973986
* @param pageContext page context map
987+
* @param imageResource resource to use
988+
* @param returnRenditionsListName name of the attribute to create for rendition list
989+
* @param returnLastRenditionName last rendition to return if not found
974990
* @return returns map of attributes
975991
*/
976992
@SuppressWarnings("Duplicates")
@@ -1148,14 +1164,14 @@ public static Map<String, String> getBestFitMediaQueryRenditionSet(com.adobe.gra
11481164
/**
11491165
* function to filter out the design dialog values which are not matching adaptive profile
11501166
*
1151-
* @param adaptiveImageMapping
1152-
* @param resolver
1167+
* @param adaptiveImageMapping image mapping config
1168+
* @param resolver resolver instance
11531169
* @param componentPath path to component doing the render
11541170
* @param fileReference path to asset to use for render
11551171
* @param outputFormat specify which output format to use
11561172
* @param useFileReferencePathAsRender create paths using fileReference instead of using Component Path
1157-
* @param sling
1158-
* @return Map<Integer , String>
1173+
* @param sling sling instance
1174+
* @return map of urls
11591175
*/
11601176
public static Map<String, String> getAdaptiveImageSet(String[] adaptiveImageMapping, ResourceResolver resolver, String componentPath, String fileReference, String outputFormat, Boolean useFileReferencePathAsRender, org.apache.sling.api.scripting.SlingScriptHelper sling) {
11611177

@@ -1222,8 +1238,8 @@ public static Map<String, String> getAdaptiveImageSet(String[] adaptiveImageMapp
12221238
/**
12231239
* return list of configured widths in com.day.cq.wcm.foundation.impl.AdaptiveImageComponentServlet
12241240
*
1225-
* @param sling
1226-
* @return int []
1241+
* @param sling sling instance
1242+
* @return list of ints allowed
12271243
*/
12281244
@SuppressWarnings("unchecked")
12291245
public static int[] getAdaptiveImageSupportedWidths(org.apache.sling.api.scripting.SlingScriptHelper sling) {

0 commit comments

Comments
 (0)