Search in sources :

Example 11 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getBag.

/**
 * @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 SecuredBag getBag(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final Bag b = holder.getBaseItem().getBag(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), b.asNode()));
        return SecuredBagImpl.getInstance(getModel(), b);
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException) Bag(org.apache.jena.rdf.model.Bag) SecuredBag(org.apache.jena.permissions.model.SecuredBag)

Example 12 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getLong.

/**
 * @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 long getLong(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final long retval = holder.getBaseItem().getLong(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 13 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getByte.

/**
 * @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 byte getByte(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final byte retval = holder.getBaseItem().getByte(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 14 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getString.

/**
 * @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 String getString(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final String retval = holder.getBaseItem().getString(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), ResourceFactory.createTypedLiteral(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 15 with SeqIndexBoundsException

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

the class SecuredSeqImpl method getAlt.

/**
 * @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 SecuredAlt getAlt(final int index) throws ReadDeniedException, AuthenticationRequiredException {
    if (checkSoftRead()) {
        final Alt a = holder.getBaseItem().getAlt(index);
        checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), a.asNode()));
        return SecuredAltImpl.getInstance(getModel(), a);
    }
    throw new SeqIndexBoundsException(index, 0);
}
Also used : Triple(org.apache.jena.graph.Triple) SeqIndexBoundsException(org.apache.jena.rdf.model.SeqIndexBoundsException) SecuredAlt(org.apache.jena.permissions.model.SecuredAlt) Alt(org.apache.jena.rdf.model.Alt)

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