IQueryService does not return Permissions? (DFS 6.5)
Hello,
I am having a curious issue, and I am wondering if this is by design or a bug in DFS. It looks like using the IQueryService for a PassthroughQuery does not respect the options set using the PermissionProfile object. The following code works fine with the IObjectService:
PermissionProfile permissionProfile = new PermissionProfile();
permissionProfile.setPermissionTypeFilter(PermissionTypeFilter.ANY);
operationOptions = new OperationOptions();
operationOptions.setPermissionProfile(permissionProfile);
This is the IQueryService code:
PassthroughQuery query = new PassthroughQuery();
query.setQueryString(sDQL);
query.addRepository(sRepository);
QueryExecution queryEx = new QueryExecution();
queryEx.setCacheStrategyType(CacheStrategyType.DEFAULT_CACHE_STRATEGY);
ServiceFactory serviceFactory = ServiceFactory.getInstance();
IQueryService queryService = serviceFactory.getRemoteService(IQueryService.class, context);
OperationOptions operationOptions = null;
if (includePermissions) {
logger.debug("Include permissions.");
PermissionProfile permissionProfile = new PermissionProfile();
permissionProfile.setPermissionTypeFilter(PermissionTypeFilter.ANY);
operationOptions = new OperationOptions();
operationOptions.setPermissionProfile(permissionProfile);
}
QueryResult queryResult = queryService.execute(query, queryEx, operationOptions);
and this is for IObjectService:
ObjectIdentity objIdentity = new ObjectIdentity<ObjectId>(new ObjectId(sObjId), sRepository);
ObjectIdentitySet objectIdSet = new ObjectIdentitySet();
objectIdSet.addIdentity(objIdentity);
DataObject dataObj = null;
try {
ServiceFactory sf = ServiceFactory.getInstance();
IObjectService os = sf.getRemoteService(IObjectService.class, context);
PropertyProfile pp = new PropertyProfile(PropertyFilterMode.ALL); //ALL_NON_SYSTEM);
ContentProfile cp = new ContentProfile();
OperationOptions oo = new OperationOptions();
if (includePermissions) {
logger.debug("Include permissions (object).");
PermissionProfile permissionProfile = new PermissionProfile();
permissionProfile.setPermissionTypeFilter(PermissionTypeFilter.ANY);
oo.setPermissionProfile(permissionProfile);
}
cp.setFormatFilter(ff);
oo.setPropertyProfile(pp);
oo.setContentProfile(cp);
DataPackage dataPackage = os.get(objectIdSet, oo);
dataObj = dataPackage.getDataObjects().get(0);
}
Using the same code with the IQueryService produces an empty Permissions set in the result. Shouldn't this work on whichever service I choose to use, as long as it is returning a collection of DataObjects? I should prefer to use IQueryService because it is more lightweight, correct?
Thanks for the help.
Best Answer
-
IQueryService should not honor any profile by design (except maybe ContentTransferProfile). It should return only things specified by the Query, the fact that it honors a profile is a bug, this will probably change soon, so do not count on Profiles in QueryService.
>1. Shouldn't this work on whichever service I choose to use, as long as it is returning a collection of DataObjects?
Methods that support profiles usually stipulate it in the docs which one they does.
Methods that return DataPackage usually support at least all profiles that ObjectService.get() method does, but that's NOT A RULE.
>2. I should prefer to use IQueryService because it is more lightweight, correct?
It depends a lot on the query you need.
Retrieving a full object should not differ a lot in timing, plus ObjectService has more options than QueryService, it honors PayloadPolicy, multiple repositories, etc.
0
Answers
-
IQueryService should not honor any profile by design (except maybe ContentTransferProfile). It should return only things specified by the Query, the fact that it honors a profile is a bug, this will probably change soon, so do not count on Profiles in QueryService.
>1. Shouldn't this work on whichever service I choose to use, as long as it is returning a collection of DataObjects?
Methods that support profiles usually stipulate it in the docs which one they does.
Methods that return DataPackage usually support at least all profiles that ObjectService.get() method does, but that's NOT A RULE.
>2. I should prefer to use IQueryService because it is more lightweight, correct?
It depends a lot on the query you need.
Retrieving a full object should not differ a lot in timing, plus ObjectService has more options than QueryService, it honors PayloadPolicy, multiple repositories, etc.
0 -
Very helpful, thanks.
0
Categories
- All Categories
- 108 Developer Announcements
- 53 Articles
- 106 General Questions
- 144 IM Services
- 43 OpenText Hackathon
- 32 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 899 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 120 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management