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="authorityService" ref="AuthorityService" />
<property name="tenantAdminService" ref="tenantAdminService"/> <property name="tenantAdminService" ref="tenantAdminService"/>
<property name="networksService" ref="networksService"/> <property name="networksService" ref="networksService"/>
<property name="cmisCreateDocRequestRenditionsSet" value="${cmis.create.doc.request.renditions.set}" />
</bean> </bean>
<bean id="cmisDispatcherRegistry" class="org.alfresco.opencmis.CMISDispatcherRegistryImpl"> <bean id="cmisDispatcherRegistry" class="org.alfresco.opencmis.CMISDispatcherRegistryImpl">

View File

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