Package javax.jcr

Examples of javax.jcr.PropertyIterator


    referent.setProperty(propertyName, referenced);
  }

  @SuppressWarnings("unchecked")
  protected Iterator<Node> _getReferents(Node referenced, String propertyName) throws RepositoryException {
    PropertyIterator bilto = referenced.getReferences();
    return new AbstractFilterIterator<Node, Property>(bilto) {
      protected Node adapt(Property property) {
        try {
          String propertyName = property.getName();
          if (propertyName.equals(propertyName)) {
View Full Code Here


                                           Node n,
                                           RepositoryFilter filter) throws RepositoryException {
        int rows = 0;
        List<AssetItem> results = new ArrayList<AssetItem>();

        PropertyIterator it = n.getReferences();
        if ( skip > 0 ) it.skip( skip );

        while ( it.hasNext() && (numRowsToReturn == -1 || rows < numRowsToReturn) ) {

            Property ruleLink = (Property) it.next();

            Node parentNode = ruleLink.getParent();
            if ( isNotSnapshot( parentNode ) && parentNode.getPrimaryNodeType().getName().equals( AssetItem.RULE_NODE_TYPE_NAME ) ) {
                if ( seekArchivedAsset || !parentNode.getProperty( AssetItem.CONTENT_PROPERTY_ARCHIVE_FLAG ).getBoolean() ) {
                    AssetItem ai = new AssetItem( this, parentNode );
View Full Code Here

        return writer.writeNode(builder.getNodeState());
    }

    private void buildNode(NodeBuilder builder, Node node)
            throws RepositoryException {
        PropertyIterator properties = node.getProperties();
        while (properties.hasNext()) {
            Property property = properties.nextProperty();
            if (property.isMultiple()) {
                builder.setProperty(PropertyStates.createProperty(
                        property.getName(),
                        Arrays.asList(property.getValues())));
            } else {
View Full Code Here

        // removed, if any references are left to this node.
        NodeTypeImpl mixin = session.getNodeTypeManager().getNodeType(ntName);
        if (mixin.isNodeType(NameConstants.MIX_REFERENCEABLE)) {
            EffectiveNodeType entRemaining = getRemainingENT(mixinValue);
            if (!entRemaining.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
                PropertyIterator iter = getReferences();
                if (iter.hasNext()) {
                    throw new ConstraintViolationException("Mixin type " + mixinName + " can not be removed: the node is being referenced through at least one property of type REFERENCE");
                }
            }
        }
View Full Code Here

        // principal name is mandatory property -> no check required.
        return node.getProperty(P_PRINCIPAL_NAME).getString();
    }

    private void collectMembership(final Set<Group> groups, boolean includeIndirect) throws RepositoryException {
        PropertyIterator refs = getMembershipReferences();
        if (refs != null) {
            while (refs.hasNext()) {
                try {
                    NodeImpl n = (NodeImpl) refs.nextProperty().getParent();
                    if (n.isNodeType(NT_REP_GROUP)) {
                        Group group = userManager.createGroup(n);
                        // only retrieve indirect membership if the group is not
                        // yet present (detected eventual circular membership).
                        if (groups.add(group) && includeIndirect) {
View Full Code Here

     * @return the iterator returned by {@link Node#getWeakReferences(String)}
     * or <code>null</code> if the method call fails with <code>RepositoryException</code>.
     * See fallback scenario above.
     */
    private PropertyIterator getMembershipReferences() {
        PropertyIterator refs = null;
        try {
            refs = node.getWeakReferences(getSession().getJCRName(P_MEMBERS));
        } catch (RepositoryException e) {
            log.error("Failed to retrieve membership references of " + this + ".", e);
        }
View Full Code Here

                ((NodeTypeImpl) parent.getPrimaryNodeType()).getQName(),
                parent.getMixinTypeNames(),
                node.getSession()
        ));

        PropertyIterator iter = node.getProperties();
        while (iter.hasNext()) {
            PropertyImpl prop = (PropertyImpl) iter.nextProperty();
            events.add(EventState.propertyAdded(
                    (NodeId) node.getId(),
                    node.getPrimaryPath(),
                    prop.getPrimaryPath().getNameElement(),
                    ((NodeTypeImpl) node.getPrimaryNodeType()).getQName(),
View Full Code Here

     *
     * @param a The node in the source tree.
     * @param b The node in the target tree.
     */
    public void compareProperties(Node a, Node b) {
        PropertyIterator ai = null;
        try {
            ai = a.getProperties();
        } catch (RepositoryException e) {
            fail("Cannot access properties: " + e);
        }
        while (ai.hasNext()) {
            Property pa = (Property) ai.next();
            String pName = null;
            // todo
            String pPath = null;
            try {
                pPath = pa.getPath();
View Full Code Here

        for (int t = 0; t < level; t++) {
            log.print("-");
        }
        log.print(n.getName() + " ");
        log.print(n.getPrimaryNodeType().getName() + " [ ");
        PropertyIterator pi = n.getProperties();
        while (pi.hasNext()) {
            Property p = (Property) pi.next();
            log.print(p.getName() + " ");
        }
        log.println("]");

        NodeIterator ni = n.getNodes();
View Full Code Here

        // removed, if any references are left to this node.
        NodeTypeImpl mixin = session.getNodeTypeManager().getNodeType(ntName);
        if (mixin.isNodeType(NameConstants.MIX_REFERENCEABLE)) {
            EffectiveNodeType entRemaining = getRemainingENT(mixinValue);
            if (!entRemaining.includesNodeType(NameConstants.MIX_REFERENCEABLE)) {
                PropertyIterator iter = getReferences();
                if (iter.hasNext()) {
                    throw new ConstraintViolationException("Mixin type " + mixinName + " can not be removed: the node is being referenced through at least one property of type REFERENCE");
                }
            }
        }
View Full Code Here

TOP

Related Classes of javax.jcr.PropertyIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.