use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.
the class SecuredResourceImpl method getRequiredProperty.
/**
* Get a property value of this resource.
*
* <p>
* The securedModel associated with the resource instance is searched for
* statements whose subject is this resource and whose predicate is p. If
* such a statement is found, it is returned. If several such statements are
* found, any one may be returned. If no such statements are found, an
* exception is thrown.
* </p>
*
* @param p
* The property sought.
* @return some (this, p, ?O) statement if one exists
* @throws PropertyNotFoundException
* if no such statement found
* @throws ReadDeniedException
* @throws AuthenticationRequiredException
*/
@Override
public SecuredStatement getRequiredProperty(final Property p) throws PropertyNotFoundException, ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p).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();
}
}
use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.
the class SecuredResourceImpl method getProperty.
/**
* Answer some statement (this, p, O) in the associated securedModel. If
* there are several such statements, any one of them may be returned. If no
* such statements exist, null is returned - in this is differs from
* getRequiredProperty.
*
* @param p
* the property sought
* @return a statement (this, p, O), or null if no such statements exist
* here
* @throws ReadDeniedException
* @throws AuthenticationRequiredException
*/
@Override
public SecuredStatement getProperty(final Property p) throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p).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();
}
}
use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.
the class SecuredResourceImpl method hasProperty.
/**
* Test if this resource has a given property with a given value.
*
* @param p
* The property sought.
* @param o
* The value of the property sought.
* @return true if and only if this resource has property p with value o.
* @throws ReadDeniedException
* @throws AuthenticationRequiredException
*/
@Override
public boolean hasProperty(final Property p, final String o) throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem().getModel().listStatements(this, p, o).filterKeep(new PermStatementFilter(Action.Read, this));
try {
return iter.hasNext();
} finally {
iter.close();
}
}
use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.
the class SecuredResourceImpl method hasProperty.
/**
* Test if this resource has a given property with a given value.
*
* @param p
* The property sought.
* @param o
* The value of the property sought.
* @return true if and only if this resource has property p with value o.
* @throws ReadDeniedException
* @throws AuthenticationRequiredException
*/
@Override
public boolean hasProperty(final Property p, final RDFNode o) throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem().getModel().listStatements(this, p, o).filterKeep(new PermStatementFilter(Action.Read, this));
try {
return iter.hasNext();
} finally {
iter.close();
}
}
use of org.apache.jena.permissions.utils.PermStatementFilter in project jena by apache.
the class SecuredResourceImpl method hasProperty.
/**
* Determine whether this resource has any values for a given property.
*
* @param p
* The property sought.
* @return true if and only if this resource has at least one value for the
* property.
* @throws ReadDeniedException
* @throws AuthenticationRequiredException
*/
@Override
public boolean hasProperty(final Property p) throws ReadDeniedException, AuthenticationRequiredException {
checkRead();
final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p).filterKeep(new PermStatementFilter(Action.Read, this));
try {
return iter.hasNext();
} finally {
iter.close();
}
}
Aggregations