Class EntityDocThumbnailDataProvider
java.lang.Object
ch.tocco.nice2.dms.spi.customdataprovider.EntityDocThumbnailDataProvider
- All Implemented Interfaces:
CustomDataProvider
This data-provider returns thumbnail url (as string) of an entity doc.
It can be contributed in a spring boot configuration (you need to specify entityName, fieldName and size).
@Bean
public CustomDataProviderContribution articleThumbnailDataProvider(TypeManager typeManager,
Context context,
QueryBuilderFactory queryBuilderFactory,
ContentTreeService contentTreeService,
SecurityManager securityManager) {
EntityDocThumbnailDataProvider dataProvider = new EntityDocThumbnailDataProvider(typeManager, context, queryBuilderFactory, contentTreeService, securityManager);
dataProvider.setEntityName("Article");
dataProvider.setFieldName("pic_small");
dataProvider.setSize(80);
return new CustomDataProviderContribution("nice2.optional.webshop.ArticleThumbnailDataProvider", dataProvider);
}
Implementation note: it resolves entity doc in privileged mode for performance reasons
(you can assume that you can read an entity doc when you can read the related entity).-
Constructor Summary
ConstructorDescriptionEntityDocThumbnailDataProvider
(TypeManager typeManager, Context context, QueryBuilderFactory queryBuilderFactory, ContentTreeService contentTreeService, SecurityManager securityManager) -
Method Summary
Modifier and TypeMethodDescriptionCollects the custom data for this field and returns it as aTypedValue
.void
setEntityName
(String entityName) void
setFieldName
(String fieldName) void
setSize
(int size)
-
Constructor Details
-
EntityDocThumbnailDataProvider
public EntityDocThumbnailDataProvider(TypeManager typeManager, Context context, QueryBuilderFactory queryBuilderFactory, ContentTreeService contentTreeService, SecurityManager securityManager)
-
-
Method Details
-
getData
Description copied from interface:CustomDataProvider
Collects the custom data for this field and returns it as aTypedValue
.- Specified by:
getData
in interfaceCustomDataProvider
- Parameters:
entity
- The current entity, which gets loaded in the grid or form (is null in create scope).- Returns:
- a
TypedValue
containing the custom data for this field. - Throws:
CustomDataProviderException
- in case of error.
-
setEntityName
-
setFieldName
-
setSize
public void setSize(int size)
-