Search in sources :

Example 1 with SecuredReifiedStatement

use of org.apache.jena.permissions.model.SecuredReifiedStatement in project jena by apache.

the class SecuredReifiedStatementImpl method getInstance.

/**
 * Get an instance of SecuredReifiedStatement
 *
 * @param securedModel the Secured Model to use.
 * @param stmt         The ReifiedStatement to secure.
 * @return SecuredReifiedStatement
 */
public static SecuredReifiedStatement getInstance(final SecuredModel securedModel, final ReifiedStatement stmt) {
    if (securedModel == null) {
        throw new IllegalArgumentException("Secured securedModel may not be null");
    }
    if (stmt == null) {
        throw new IllegalArgumentException("Statement may not be null");
    }
    final ItemHolder<ReifiedStatement, SecuredReifiedStatement> holder = new ItemHolder<>(stmt);
    final SecuredReifiedStatementImpl checker = new SecuredReifiedStatementImpl(securedModel, holder);
    // one.
    if (stmt instanceof SecuredReifiedStatement) {
        if (checker.isEquivalent((SecuredReifiedStatement) stmt)) {
            return (SecuredReifiedStatement) stmt;
        }
    }
    return holder.setSecuredItem(new SecuredItemInvoker(stmt.getClass(), checker));
}
Also used : ReifiedStatement(org.apache.jena.rdf.model.ReifiedStatement) SecuredReifiedStatement(org.apache.jena.permissions.model.SecuredReifiedStatement) SecuredReifiedStatement(org.apache.jena.permissions.model.SecuredReifiedStatement) ItemHolder(org.apache.jena.permissions.impl.ItemHolder) SecuredItemInvoker(org.apache.jena.permissions.impl.SecuredItemInvoker)

Aggregations

ItemHolder (org.apache.jena.permissions.impl.ItemHolder)1 SecuredItemInvoker (org.apache.jena.permissions.impl.SecuredItemInvoker)1 SecuredReifiedStatement (org.apache.jena.permissions.model.SecuredReifiedStatement)1 ReifiedStatement (org.apache.jena.rdf.model.ReifiedStatement)1