Package org.dbwiki.data.document

Examples of org.dbwiki.data.document.DocumentNode


   
    if (_handler != null) {
      _handler.endElement();
      if (_readPath.equals(_schemaNodeRootPath)) {
        _handler.endDocument();
        DocumentNode inputRoot = _handler.getRootNode();
        if (!inputRoot.isGroup()) {
          throw new WikiDataException(WikiDataException.InvaldInputData, "Group node expected as input root");
        } else {
          _importHandler.importDocument((DocumentGroupNode)inputRoot);
        }
        _handler = null;
View Full Code Here


      _ignoreSubtreeDepth--;
    } else if (_valueReader != null) {
      if (_valueReader.hasOpenElements()) {
        _valueReader.endElement();
      } else if (!_elementStack.isEmpty()) {
        DocumentNode currentElement = _elementStack.peek();
        if (currentElement.isAttribute()) {
          DocumentAttributeNode attribute = (DocumentAttributeNode)currentElement;
          if (!attribute.hasValue()) {
            attribute.setValue(_valueReader.value());
            _valueReader = null;
            _elementStack.pop();
          } else {
            throw new WikiDataException(WikiDataException.InvaldInputData, "Duplicate text value for attribute " + attribute.label());
          }
        } else {
          throw new WikiDataException(WikiDataException.InvaldInputData, "Unexpected text value under element " + currentElement.label());
        }
      } else {
        throw new WikiDataException(WikiDataException.InvaldInputData, "Trying to close non-existing element past end of document");
      }
    } else if (!_elementStack.isEmpty()) {
View Full Code Here

        _elementStack.push(_root);
      } else {
        throw new WikiDataException(WikiDataException.InvaldInputData, "Expected root label " + _rootSchemaNode.label() + " instead of " + label);
      }
    } else if (!_elementStack.isEmpty()) {
      DocumentNode element = _elementStack.peek();
      if (element.isGroup()) {
        DocumentGroupNode group = (DocumentGroupNode)element;
        SchemaNode childSchemaNode = ((GroupSchemaNode)group.schema()).children().get(label);
        if (childSchemaNode != null && childSchemaNode.getTimestamp().isCurrent()) {
          DocumentNode child = null;
          if (childSchemaNode.isAttribute()) {
            child = new DocumentAttributeNode((AttributeSchemaNode)childSchemaNode);
            _valueReader = new NodeValueReader();
          } else {
            child = new DocumentGroupNode((GroupSchemaNode)childSchemaNode);
View Full Code Here

          DocumentGroupNode group,
          RDBMSDatabaseGroupNode parent,
          int entry)
      throws java.sql.SQLException, org.dbwiki.exception.WikiException {
    for (int iChild = 0; iChild < group.children().size(); iChild++) {
      DocumentNode element = group.children().get(iChild);
      if (element.isAttribute()) {
        DocumentAttributeNode attributeChild = (DocumentAttributeNode)element;
        insertAttributeNode((AttributeSchemaNode)attributeChild.schema(), parent, entry, null, attributeChild.value(), attributeChild.getpre(), attributeChild.getpost());

      } else {
        DocumentGroupNode groupChild = (DocumentGroupNode)element;
View Full Code Here

        }
      }
      Connection con = _connector.getConnection();     
      try {
        SQLDatabaseSchema schema = new SQLDatabaseSchema(con, _versionIndex, _wiki.name());
        DocumentNode insertNode = null;
        if (targetElement != null) {
          // FIXME #copypaste: This code looks unnecessarily complicated
          // Isn't:
          //
          //   (GroupSchemaNode)schema.get(targetElement.schema().id())
View Full Code Here

      if (schemaNode.isAttribute()) {
        return new DocumentAttributeNode((AttributeSchemaNode)schemaNode, ((PasteAttributeNode)sourceNode).getValue().getValue());
      } else {
        DocumentGroupNode group = new DocumentGroupNode((GroupSchemaNode)schemaNode);
        for (int iChild = 0; iChild < ((PasteGroupNode)sourceNode).children().size(); iChild++) {
          DocumentNode insertChild = getPasteInsertNode((GroupSchemaNode)schemaNode, (PasteElementNode)((PasteGroupNode)sourceNode).children().get(iChild), schema);
          if (insertChild != null) {
            group.children().add(insertChild);
          }
        }
        return group;
View Full Code Here

                .get(ParameterSchemaNodeType).value()),
            request.user());
        isGetRequest = !request.isRootRequest();
        isIndexRequest = !isGetRequest;
      } else if (action.actionInsert()) {
        DocumentNode insertNode = this.getInsertNode(request);
        page = new RedirectPage(request, database().insertNode(
            request.wri().resourceIdentifier(), insertNode,
            request.user()));
      } else if (action.actionUpdate()) {
        if (request.parameters().hasParameter(ParameterDatabaseID)) {
View Full Code Here

TOP

Related Classes of org.dbwiki.data.document.DocumentNode

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.