Search in sources :

Example 6 with PermStatementFilter

use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.

the class SecuredResourceImpl method getProperty.

@Override
public SecuredStatement getProperty(Property p, String lang) throws ReadDeniedException, AuthenticationRequiredException {
    checkRead();
    final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p, lang).filterKeep(new PermStatementFilter(Action.Read, this));
    try {
        if (iter.hasNext()) {
            return org.apache.jena.permissions.model.impl.SecuredStatementImpl.getInstance(getModel(), iter.next());
        } else {
            return null;
        }
    } finally {
        iter.close();
    }
}
Also used : PermStatementFilter(org.apache.jena.permissions.utils.PermStatementFilter) SecuredStatement(org.apache.jena.permissions.model.SecuredStatement)

Example 7 with PermStatementFilter

use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.

the class SecuredResourceImpl method getRequiredProperty.

@Override
public SecuredStatement getRequiredProperty(Property p, String lang) throws PropertyNotFoundException, ReadDeniedException, AuthenticationRequiredException {
    checkRead();
    final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p, lang).filterKeep(new PermStatementFilter(Action.Read, this));
    try {
        if (iter.hasNext()) {
            return org.apache.jena.permissions.model.impl.SecuredStatementImpl.getInstance(getModel(), iter.next());
        } else {
            throw new PropertyNotFoundException(p);
        }
    } finally {
        iter.close();
    }
}
Also used : PermStatementFilter(org.apache.jena.permissions.utils.PermStatementFilter) PropertyNotFoundException(org.apache.jena.shared.PropertyNotFoundException) SecuredStatement(org.apache.jena.permissions.model.SecuredStatement)

Aggregations

SecuredStatement (org.apache.jena.permissions.model.SecuredStatement)7 PermStatementFilter (org.apache.jena.permissions.utils.PermStatementFilter)7 PropertyNotFoundException (org.apache.jena.shared.PropertyNotFoundException)2