Examples of NodeBuilder


Examples of groovy.util.NodeBuilder

    @Override
    public boolean onNodeChildren(FactoryBuilderSupport builder, Object node, Closure content) {
        Xpp3Dom dom = (Xpp3Dom)node;

        NodeBuilder nodes = new NodeBuilder() {
            @Override
            protected void setClosureDelegate(final Closure c, final Object o) {
                c.setDelegate(this);
                c.setResolveStrategy(Closure.DELEGATE_FIRST);
            }

            @Override
            public void setProperty(final String name, final Object value) {
                this.invokeMethod(name, value);
            }
        };

        content.setDelegate(nodes);
        content.setResolveStrategy(Closure.DELEGATE_FIRST);
        Node root = (Node) nodes.invokeMethod(getName(), content);

        for (Node child : (List<Node>) root.children()) {
            dom.addChild(nodeToXpp3(child));
        }

Examples of net.solosky.maplefetion.util.NodeBuilder

     */
    public SipcRequest createSetPersonalInfoRequest()
    {
      SipcRequest req = this.createDefaultSipcRequest(SipcMethod.SERVICE);
     
      NodeBuilder builder = new NodeBuilder();
      //因为用户可以改变自己的信息,这里权限改变了所以不使用BeanHelper来处理
      builder.add("nickname", StringHelper.qouteHtmlSpecialChars(user.getNickName()));
      builder.add("impresa",  StringHelper.qouteHtmlSpecialChars(user.getImpresa()));
      //用户扩展信息。.TODO ..
        //BeanHelper.toUpdateXML(BuddyExtend.class, this.client.getFetionUser(), builder);
     
      String body = MessageTemplate.TMPL_SET_PERSONAL_INFO;
      body = body.replace("{personal}", builder.toXML("personal"));
     
      req.addHeader(SipcHeader.EVENT,"SetUserInfoV4");
     
      req.setBody(new SipcBody(body));
      return req;

Examples of nux.xom.binary.NodeBuilder

   * @return a shallow XOM Node corresponding to the current StAX event.
   * @throws ParsingException
   *             if there is an error processing the underlying XML source
   */
  public Node buildNode() throws ParsingException {
    if (nodeBuilder == null) nodeBuilder = new NodeBuilder();
   
    switch (reader.getEventType()) {
      case XMLStreamConstants.START_ELEMENT: {
        Element elem = readStartTag();
        addAttributes(elem);

Examples of nux.xom.binary.NodeBuilder

        case XMLStreamConstants.START_ELEMENT: {
          if (hasRootElement) throw new IllegalAddException(
            "StAX reader must not return multiple root elements");

          if (factory.getClass() == NodeFactory.class) { // fast path
            if (nodeBuilder == null) nodeBuilder = new NodeBuilder();
            Element root = readStartTag();
            addAttributes(root);
            addNamespaceDeclarations(root);
            readElement(root); // reads entire subtree
            nodes = new Nodes(root);

Examples of nux.xom.binary.NodeBuilder

     */
    return new NodeFactory() {
     
      private Element buffer = null;
      private final Nodes NONE = new Nodes();
      private final NodeBuilder nodeBuilder = new NodeBuilder();
           
      public Nodes makeAttribute(String name, String namespace,
          String value, Attribute.Type type) {
       
        buffer.addAttribute(
          nodeBuilder.createAttribute(name, namespace, value, type));
//        buffer.addAttribute(
//          new Attribute(name, namespace, value, type));
        return NONE;
      }
 
      public Nodes makeComment(String data) {
        flush();
        try {
          serializer.write(new Comment(data));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
 
      public Nodes makeDocType(String rootElementName, String publicID, String systemID) {
        flush();
        try {
          serializer.write(new DocType(rootElementName, publicID, systemID));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
 
      public Nodes makeProcessingInstruction(String target, String data) {
        flush();
        try {
          serializer.write(new ProcessingInstruction(target, data));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
     
      public Nodes makeText(String text) {
        flush();
        try {
          serializer.write(new Text(text));
        } catch (IOException e) {
          throw new RuntimeException(e);
        }
        return NONE;
      }
     
      public Element startMakingElement(String name, String namespace) {
        flush();
//        buffer = new Element(name, namespace);
        buffer = nodeBuilder.createElement(name, namespace);
        return buffer;
      }
     
      public Nodes finishMakingElement(Element element) {
        flush();

Examples of org.apache.jackrabbit.oak.spi.state.NodeBuilder


        @Override
        public void initialize(NodeBuilder root) {
            if (root.hasChildNode(INDEX_DEFINITIONS_NAME)) {
                NodeBuilder index = root.child(INDEX_DEFINITIONS_NAME);

                // jcr:
                property(index, "jcrLanguage", "jcr:language");
                property(index, "jcrLockOwner", "jcr:lockOwner");

                // sling:
                property(index, "slingAlias", "sling:alias");
                property(index, "slingResource", "sling:resource");
                property(index, "slingResourceType", "sling:resourceType");
                property(index, "slingVanityPath", "sling:vanityPath");

                // various
                property(index, "event.job.topic", "event.job.topic");
                property(index, "extensionType", "extensionType");
                property(index, "lockCreated", "lock.created");
                property(index, "status", "status");
                property(index, "type", "type");

                // lucene full-text index
                if (!index.hasChildNode("lucene")) {
                    LuceneIndexHelper.newLuceneIndexDefinition(
                            index, "lucene", LuceneIndexHelper.JR_PROPERTY_INCLUDES,
                            of(
                               "jcr:createdBy",
                               "jcr:lastModifiedBy",

Examples of org.apache.jackrabbit.oak.spi.state.NodeBuilder

    }

    private void collectIndexEditors(NodeBuilder definitions)
            throws CommitFailedException {
        for (String name : definitions.getChildNodeNames()) {
            NodeBuilder definition = definitions.getChildNode(name);
            if (Objects.equal(async, definition.getString(ASYNC_PROPERTY_NAME))) {
                String type = definition.getString(TYPE_PROPERTY_NAME);
                Editor editor = provider.getIndexEditor(type, definition, root);
                if (editor == null) {
                    // trigger reindexing when an indexer becomes available
                    definition.setProperty(REINDEX_PROPERTY_NAME, true);
                } else if (definition.getBoolean(REINDEX_PROPERTY_NAME)) {
                    definition.setProperty(REINDEX_PROPERTY_NAME, false);
                    // as we don't know the index content node name
                    // beforehand, we'll remove all child nodes
                    for (String rm : definition.getChildNodeNames()) {
                        definition.getChildNode(rm).remove();
                    }
                    reindex.add(VisibleEditor.wrap(editor));
                } else {
                    editors.add(VisibleEditor.wrap(editor));
                }

Examples of org.apache.jackrabbit.oak.spi.state.NodeBuilder

    }

    @Nonnull
    @Override
    public NodeState processCommit(final NodeState before, NodeState after) throws CommitFailedException {
        NodeBuilder rootAfter = after.builder();

        permissionRoot = getPermissionRoot(rootAfter);
        bitsProvider = new PrivilegeBitsProvider(new ImmutableRoot(before));

        isACL = new TypePredicate(after, NT_REP_ACL);
        isACE = new TypePredicate(after, NT_REP_ACE);
        isGrantACE = new TypePredicate(after, NT_REP_GRANT_ACE);

        Diff diff = new Diff("");
        after.compareAgainstBaseState(before, diff);
        apply();
        return rootAfter.getNodeState();
    }

Examples of org.apache.jackrabbit.oak.spi.state.NodeBuilder

        private void remove(Set<String> principalNames) {
            String msg = "Unable to remove permission entry";
            for (String principalName: entries.keySet()) {
                if (permissionRoot.hasChildNode(principalName)) {
                    principalNames.add(principalName);
                    NodeBuilder principalRoot = permissionRoot.getChildNode(principalName);

                    // find the ACL node that for this path and principal
                    NodeBuilder parent = principalRoot.getChildNode(nodeName);
                    if (!parent.exists()) {
                        continue;
                    }

                    long numEntries = PermissionUtil.getNumPermissions(principalRoot);

                    // check if the node is the correct one
                    if (PermissionUtil.checkACLPath(parent, accessControlledPath)) {
                        // remove and reconnect child nodes
                        NodeBuilder newParent = null;
                        for (String childName : parent.getChildNodeNames()) {
                            if (childName.charAt(0) != 'c') {
                                numEntries--;
                                continue;
                            }
                            NodeBuilder child = parent.getChildNode(childName);
                            if (newParent == null) {
                                newParent = child;
                            } else {
                                newParent.setChildNode(childName, child.getNodeState());
                                child.remove();
                            }
                        }
                        parent.remove();
                        if (newParent != null) {
                            principalRoot.setChildNode(nodeName, newParent.getNodeState());
                        }
                    } else {
                        // check if any of the child nodes match
                        for (String childName : parent.getChildNodeNames()) {
                            if (childName.charAt(0) != 'c') {
                                continue;
                            }
                            NodeBuilder child = parent.getChildNode(childName);
                            if (PermissionUtil.checkACLPath(child, accessControlledPath)) {
                                // remove child
                                for (String n: child.getChildNodeNames()) {
                                    numEntries--;
                                }
                                child.remove();
                            }
                        }
                    }
                    principalRoot.setProperty(REP_NUM_PERMISSIONS, numEntries);
                    principalRoot.setProperty(REP_TIMESTAMP, System.currentTimeMillis());

Examples of org.apache.jackrabbit.oak.spi.state.NodeBuilder

                beforeKeys.removeAll(sharedKeys);
                afterKeys.removeAll(sharedKeys);
            }

            if (!beforeKeys.isEmpty() || !afterKeys.isEmpty()) {
                NodeBuilder index = definition.child(INDEX_CONTENT_NODE_NAME);
                getStrategy(keysToCheckForUniqueness != null).update(
                        index, getPath(), beforeKeys, afterKeys);
                if (keysToCheckForUniqueness != null) {
                    keysToCheckForUniqueness.addAll(afterKeys);
                }
TOP
Copyright © 2018 www.massapi.com. 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.