MNT-14308: CMIS - optionally request rendition(s) when uploading docs - part 2 (#283)

* MNT-14308: CMIS - optionally request rendition(s) when uploading docs - part 2

- note: PublicApiAlfrescoCmisServiceFactory extends AlfrescoCmisServiceFactory and overrides getCmisServiceTarget
- hence, also ensure property (cmis.create.doc.request.renditions.set) is set for public rest api spring context

- note: set following log4j.properties: log4j.logger.org.alfresco.opencmis=info

* MNT-14308: CMIS - optionally request rendition(s) when uploading docs - part 2

- tweak info log to output property on init (since service currently instantiated on every call)

- note: set following log4j.properties: log4j.logger.org.alfresco.opencmis=info
This commit is contained in:
montgolfiere
2021-02-10 20:37:57 +00:00
committed by GitHub
parent e6e710751e
commit 3ad33034f1
2 changed files with 19 additions and 9 deletions

View File

@@ -1081,6 +1081,7 @@
<property name="authorityService" ref="AuthorityService" />
<property name="tenantAdminService" ref="tenantAdminService"/>
<property name="networksService" ref="networksService"/>
<property name="cmisCreateDocRequestRenditionsSet" value="${cmis.create.doc.request.renditions.set}" />
</bean>
<bean id="cmisDispatcherRegistry" class="org.alfresco.opencmis.CMISDispatcherRegistryImpl">

View File

@@ -174,6 +174,11 @@ public class AlfrescoCmisServiceFactory extends AbstractServiceFactory
// cmisService,
// connector.getTypesDefaultMaxItems(), connector.getTypesDefaultDepth(),
// connector.getObjectsDefaultMaxItems(), connector.getObjectsDefaultDepth());
if (logger.isInfoEnabled())
{
logger.info("init: cmis.create.doc.request.renditions.set=" + cmisCreateDocRequestRenditionsSet);
}
}
@Override
@@ -206,7 +211,17 @@ public class AlfrescoCmisServiceFactory extends AbstractServiceFactory
}
AlfrescoCmisService service = getCmisServiceTarget(connector);
if (service instanceof AlfrescoCmisServiceImpl)
{
Set<String> stringSet = parseCommaSeparatedSet(getCmisCreateDocRequestRenditionsSet());
((AlfrescoCmisServiceImpl)service).setCmisRequestRenditionsOnCreateDoc(stringSet);
if (logger.isTraceEnabled())
{
logger.trace("getService: cmis.create.doc.request.renditions.set=" + stringSet);
}
}
// Wrap it
ProxyFactory proxyFactory = new ProxyFactory(service);
proxyFactory.addInterface(AlfrescoCmisService.class);
@@ -227,16 +242,10 @@ public class AlfrescoCmisServiceFactory extends AbstractServiceFactory
return wrapperService;
}
protected AlfrescoCmisService getCmisServiceTarget(CMISConnector connector)
{
AlfrescoCmisServiceImpl cmisService = new AlfrescoCmisServiceImpl(connector);
Set<String> stringSet = parseCommaSeparatedSet(getCmisCreateDocRequestRenditionsSet());
logger.info("getCmisServiceTarget: cmis.create.doc.request.renditions.set="+stringSet);
cmisService.setCmisRequestRenditionsOnCreateDoc(stringSet);
return cmisService;
return new AlfrescoCmisServiceImpl(connector);
}
private Set<String> parseCommaSeparatedSet(String str)