@Override public SecuredSeq getSeq(final int index) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final Seq retval = holder.getBaseItem().getSeq(index); checkRead(new Triple(holder.getBaseItem().asNode(), RDF.li(index).asNode(), retval.asNode())); return SecuredSeqImpl.getInstance(getModel(), retval); }
/** * get a SecuredSeq. * * @param securedModel The secured model that provides the security context * @param seq The Seq to secure. * @return the SecuredSeq */ public static SecuredSeq getInstance(final SecuredModel securedModel, final Seq seq) { if (securedModel == null) { throw new IllegalArgumentException("Secured securedModel may not be null"); } if (seq == null) { throw new IllegalArgumentException("Seq may not be null"); } final ItemHolder<Seq, SecuredSeq> holder = new ItemHolder<Seq, SecuredSeq>(seq); final SecuredSeqImpl checker = new SecuredSeqImpl(securedModel, holder); // if we are going to create a duplicate proxy, just return this // one. if (seq instanceof SecuredSeq) { if (checker.isEquivalent((SecuredSeq) seq)) { return (SecuredSeq) seq; } } return holder.setSecuredItem(new SecuredItemInvoker(seq.getClass(), checker)); }