ComponentData data = DataLayerBuilder.forComponent() .withId(this::getId) .withTitle(this::getDataLayerTitle) .withDescription(this::getDataLayerDescription) .withText(this::getDataLayerText) .withLastModifiedDate(this::getDataLayerLastModifiedDate) .withLinkUrl(this::getDataLayerLinkUrl) .withType(resource::getResourceType) .build();+1 for having such a feature in core components – I’ve encountered the same problem.
the method to generate a unique ID for the current resource path (including all the special handlings) should also be put into a separate class available via the core components API to be re-used in custom components.
stefan
--
You received this message because you are subscribed to the Google Groups "AEM Core Components Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
aem-core-componen...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/aem-core-components-dev/134760af-063e-4433-b16d-08eb3590e798o%40googlegroups.com.
--
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aem-core-components-dev/774c2cf1ec6f47008fa9d2eecddad3f1%40mailx01.intern.pro-vision.de.
--
You received this message because you are subscribed to the Google Groups "AEM Core Components Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aem-core-components-dev/bedea2e5-8179-4519-bbf2-2457aac9d7e4o%40googlegroups.com.
@Override @NotNull protected ImageData getComponentData() { return DataLayerBuilder.extending(super.getComponentData()).asImageComponent() .withTitle(this::getTitle) .withLinkUrl(this::getLink) .withAssetData(() -> Optional.ofNullable(this.fileReference) .map(reference -> this.request.getResourceResolver().getResource(reference)) .map(assetResource -> assetResource.adaptTo(Asset.class)) .map(DataLayerBuilder::forAsset) .map(AssetDataBuilder::build) .orElse(null)) .build(); }componentData.getAssetData().getLastModifiedDate()
componentData.getAssetData().getLastModifiedDate()
Optional.ofNullable(this.fileReference) .map(reference -> this.request.getResourceResolver().getResource(reference)) .map(assetResource -> assetResource.adaptTo(Asset.class)) .map(DataLayerBuilder::forAsset) .map(AssetDataBuilder::build) .orElse(null)() -> new Date( Optional.of(asset.getLastModified()) .filter(lastMod -> lastMod > 0) .orElseGet(() -> Optional.ofNullable(asset.adaptTo(ValueMap.class)) .map(vm -> vm.get(JcrConstants.JCR_CREATED, Calendar.class)) .map(Calendar::getTimeInMillis) .orElse(0L)))--
You received this message because you are subscribed to the Google Groups "AEM Core Components Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aem-core-componen...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/aem-core-components-dev/8510fc55-04bf-4575-8dd0-9c4e95946e06n%40googlegroups.com.