Package org.dbwiki.data.provenance

Examples of org.dbwiki.data.provenance.ProvenanceCopy


          insertNode = getPasteInsertNode((GroupSchemaNode)schema.get(targetElement.schema().id()), (PasteElementNode)pasteNode, schema);
        } else {
          insertNode = getPasteInsertNode(null, (PasteElementNode)pasteNode, schema);
        }
        if (insertNode != null) {
          Version version = _versionIndex.getNextVersion(new ProvenanceCopy(user, target, sourceURL));
          try {
            con.setAutoCommit(false);
            try {
              if (target.isRootIdentifier()) {
                new DatabaseWriter(con, this).insertRootNode((DocumentGroupNode)insertNode, version);     
              } else {
                new DatabaseWriter(con, this).insertNode((NodeIdentifier)target, insertNode, version);
              }
              for (int i = schema().size(); i < schema.size(); i++) {
                new DatabaseWriter(con, this).insertSchemaNode(schema.get(i), version);
              }
              _versionIndex.add(version);
              _versionIndex.store(con);
            } catch (org.dbwiki.exception.WikiException wikiException) {
              con.rollback();
              con.close();
              throw wikiException;
            }
            con.commit();
            con.close();
          } catch (java.sql.SQLException sqlException) {
            throw new WikiFatalException(sqlException);
          }
          _schema = schema;
        }
      } catch (java.sql.SQLException sqlException) {
        throw new WikiFatalException(sqlException);
      }
    } else {
      // targetElement should be nonnull
      assert(targetElement != null);
      if (!targetElement.isAttribute()) {
        throw new WikiDataException(WikiDataException.InvalidPasteTarget, target.toParameterString());
      }
      Update update = new Update();
      update.add(new NodeUpdate(targetElement.identifier(), ((PasteTextNode)pasteNode).getValue()));
      updateNodeWrapped(targetElement, update, _versionIndex.getNextVersion(new ProvenanceCopy(user, targetElement.identifier(), sourceURL)));
    }
  }
View Full Code Here

TOP

Related Classes of org.dbwiki.data.provenance.ProvenanceCopy

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.