IQueryService does not return Permissions? (DFS 6.5)

bhannemann
edited February 3, 2009 in Documentum #1

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

  • Burlacu_Dorin
    edited January 14, 2009 #2 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.

Answers

  • Burlacu_Dorin
    edited January 14, 2009 #3 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.

  • bhannemann
    edited February 3, 2009 #4

    Very helpful, thanks.