Search in sources :

Example 1 with ReifiedStatement

use of org.apache.jena.rdf.model.ReifiedStatement 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)

Example 2 with ReifiedStatement

use of org.apache.jena.rdf.model.ReifiedStatement in project jena by apache.

the class SecuredReifiedStatementTest method setup.

@Override
@Before
public void setup() {
    super.setup();
    final ReifiedStatement stmt = baseModel.listStatements().next().createReifiedStatement();
    setSecuredRDFNode(SecuredReifiedStatementImpl.getInstance(securedModel, stmt), stmt);
}
Also used : ReifiedStatement(org.apache.jena.rdf.model.ReifiedStatement) SecuredReifiedStatement(org.apache.jena.permissions.model.SecuredReifiedStatement) Before(org.junit.Before)

Aggregations

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