[ 
https://issues.apache.org/jira/browse/RYA-119?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15703554#comment-15703554
 ] 

ASF GitHub Bot commented on RYA-119:
------------------------------------

Github user isper3at commented on a diff in the pull request:

    https://github.com/apache/incubator-rya/pull/124#discussion_r89908937
  
    --- Diff: 
dao/mongodb.rya/src/main/java/org/apache/rya/mongodb/iter/RyaStatementBindingSetCursorIterator.java
 ---
    @@ -22,104 +44,104 @@
     
     import info.aduna.iteration.CloseableIteration;
     
    -import java.util.Collection;
    -import java.util.Iterator;
    -import java.util.Map.Entry;
    -
    -import org.apache.rya.api.RdfCloudTripleStoreUtils;
    -import org.apache.rya.api.domain.RyaStatement;
    -import org.apache.rya.api.persist.RyaDAOException;
    -import org.apache.rya.mongodb.dao.MongoDBStorageStrategy;
    -
    -import org.openrdf.query.BindingSet;
    -
    -import com.google.common.collect.Multimap;
    -import com.mongodb.DBCollection;
    -import com.mongodb.DBCursor;
    -import com.mongodb.DBObject;
    -
     public class RyaStatementBindingSetCursorIterator implements 
CloseableIteration<Entry<RyaStatement, BindingSet>, RyaDAOException> {
    -
    -   private DBCollection coll;
    -   private Multimap<DBObject, BindingSet> rangeMap;
    -   private Iterator<DBObject> queryIterator;
    -   private Long maxResults;
    -   private DBCursor resultCursor;
    -   private RyaStatement currentStatement;
    -   private Collection<BindingSet> currentBindingSetCollection;
    -   private Iterator<BindingSet> currentBindingSetIterator;
    -   private MongoDBStorageStrategy strategy;
    -
    -   public RyaStatementBindingSetCursorIterator(DBCollection coll,
    -                   Multimap<DBObject, BindingSet> rangeMap, 
MongoDBStorageStrategy strategy) {
    -           this.coll = coll;
    -           this.rangeMap = rangeMap;
    -           this.queryIterator = rangeMap.keySet().iterator();
    -           this.strategy = strategy;
    -   }
    -
    -   @Override
    -   public boolean hasNext() {
    -           if (!currentBindingSetIteratorIsValid()) {
    -                   findNextResult();
    -           }
    -           return currentBindingSetIteratorIsValid();
    -   }
    -
    -   @Override
    -   public Entry<RyaStatement, BindingSet> next() {
    -           if (!currentBindingSetIteratorIsValid()) {
    -                   findNextResult();
    -           }
    -           if (currentBindingSetIteratorIsValid()) {
    -                   BindingSet currentBindingSet = 
currentBindingSetIterator.next();
    -                   return new 
RdfCloudTripleStoreUtils.CustomEntry<RyaStatement, 
BindingSet>(currentStatement, currentBindingSet);
    -           }
    -           return null;
    -   }
    -   
    -   private boolean currentBindingSetIteratorIsValid() {
    -           return (currentBindingSetIterator != null) && 
currentBindingSetIterator.hasNext();
    -   }
    -
    -   private void findNextResult() {
    -           if (!currentResultCursorIsValid()) {
    -                   findNextValidResultCursor();
    -           }
    -           if (currentResultCursorIsValid()) {
    -                   // convert to Rya Statement
    -                   DBObject queryResult = resultCursor.next();
    -                   currentStatement = 
strategy.deserializeDBObject(queryResult);
    -                   currentBindingSetIterator = 
currentBindingSetCollection.iterator();
    -           }
    -   }
    -
    -   private void findNextValidResultCursor() {
    -           while (queryIterator.hasNext()){
    -                   DBObject currentQuery = queryIterator.next();
    -                   resultCursor = coll.find(currentQuery);
    -                   currentBindingSetCollection = 
rangeMap.get(currentQuery);
    -                   if (resultCursor.hasNext()) return;
    -           }
    -   }
    -   
    -   private boolean currentResultCursorIsValid() {
    -           return (resultCursor != null) && resultCursor.hasNext();
    -   }
    -
    -
    -   public void setMaxResults(Long maxResults) {
    -           this.maxResults = maxResults;
    -   }
    -
    -   @Override
    -   public void close() throws RyaDAOException {
    -           // TODO don't know what to do here
    -   }
    -
    -   @Override
    -   public void remove() throws RyaDAOException {
    -           next();
    -   }
    +    private static final Logger log = 
Logger.getLogger(RyaStatementBindingSetCursorIterator.class);
    +
    +    private final DBCollection coll;
    +    private final Multimap<DBObject, BindingSet> rangeMap;
    +    private final Iterator<DBObject> queryIterator;
    +    private Long maxResults;
    +    private Iterator<DBObject> resultsIterator;
    +    private RyaStatement currentStatement;
    +    private Collection<BindingSet> currentBindingSetCollection;
    +    private Iterator<BindingSet> currentBindingSetIterator;
    +    private final MongoDBStorageStrategy<RyaStatement> strategy;
    +    private final Authorizations auths;
    +
    +    public RyaStatementBindingSetCursorIterator(final DBCollection coll,
    --- End diff --
    
    don't pass in the whole config, just pass in the Auths


> Add visibility support to MongoDB
> ---------------------------------
>
>                 Key: RYA-119
>                 URL: https://issues.apache.org/jira/browse/RYA-119
>             Project: Rya
>          Issue Type: Improvement
>          Components: dao
>    Affects Versions: 3.2.10
>            Reporter: Andrew Smith
>            Assignee: Eric White
>
> Currently, when querying mongo, visibility is ignored.  Need to add support 
> for visibility when querying mongo.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to