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.