Search in sources :

Example 1 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getObject.

/**
 * @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
 *            the user does not have read access then SeqIndexBoundsException is
 *            thrown
 * @sec.triple Read SecTriple( this, RDF.li(1), o )
 * @throws ReadDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public SecuredRDFNode getObject(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final RDFNode retval = holder.getBaseItem().getObject(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), retval.asNode()));
        return SecuredRDFNodeImpl.getInstance(getModel(), retval);
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException) RDFNode(org.apache.jena.rdf.model.RDFNode) SecuredRDFNode(org.apache.jena.permissions.model.SecuredRDFNode)

Example 2 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getFloat.

/**
 * @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
 *            the user does not have read access then SeqIndexBoundsException is
 *            thrown
 * @sec.triple Read SecTriple( this, RDF.li(1), o )
 * @throws ReadDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public float getFloat(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final float retval = holder.getBaseItem().getFloat(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), asObject(retval).asNode()));
        return retval;
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException)

Example 3 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getDouble.

/**
 * @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
 *            the user does not have read access then SeqIndexBoundsException is
 *            thrown
 * @sec.triple Read SecTriple( this, RDF.li(1), o )
 * @throws ReadDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public double getDouble(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final double retval = holder.getBaseItem().getDouble(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), asObject(retval).asNode()));
        return retval;
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException)

Example 4 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getResource.

/**
 * @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
 *            the user does not have read access then SeqIndexBoundsException is
 *            thrown
 * @sec.triple Read SecTriple( this, RDF.li(1), o )
 * @throws ReadDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public SecuredResource getResource(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final Resource retval = holder.getBaseItem().getResource(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), retval.asNode()));
        return SecuredResourceImpl.getInstance(getModel(), retval);
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException) Resource(org.apache.jena.rdf.model.Resource) SecuredResource(org.apache.jena.permissions.model.SecuredResource)

Example 5 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getBoolean.

/**
 * @sec.graph Read if {@link SecurityEvaluator#isHardReadError()} is true and
 *            the user does not have read access then SeqIndexBoundsException is
 *            thrown
 * @sec.triple Read SecTriple( this, RDF.li(1), o )
 * @throws ReadDeniedException
 * @throws AuthenticationRequiredException if user is not authenticated and is
 *                                         required to be.
 */
@Override
public boolean getBoolean(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final boolean retval = holder.getBaseItem().getBoolean(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), asObject(retval).asNode()));
        return retval;
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException)

Aggregations

Triple (org.apache.jena.graph.Triple)17 SeqIndexBoundsException (org.apache.jena.rdf.model.SeqIndexBoundsException)17 SecuredLiteral (org.apache.jena.permissions.model.SecuredLiteral)2 SecuredResource (org.apache.jena.permissions.model.SecuredResource)2 Literal (org.apache.jena.rdf.model.Literal)2 Resource (org.apache.jena.rdf.model.Resource)2 SecuredAlt (org.apache.jena.permissions.model.SecuredAlt)1 SecuredBag (org.apache.jena.permissions.model.SecuredBag)1 SecuredRDFNode (org.apache.jena.permissions.model.SecuredRDFNode)1 SecuredSeq (org.apache.jena.permissions.model.SecuredSeq)1 Alt (org.apache.jena.rdf.model.Alt)1 Bag (org.apache.jena.rdf.model.Bag)1 RDFNode (org.apache.jena.rdf.model.RDFNode)1 Seq (org.apache.jena.rdf.model.Seq)1