Package org.dbwiki.data.time

Examples of org.dbwiki.data.time.Version


        nid = new NodeIdentifier(nodeId);
      Provenance provenance =
        ProvenanceFactory.getProvenance((byte)rs.getInt(RelVersionColProvenance),
            user, nid, rs.getString(RelVersionColSource));
      long createTime = rs.getLong(RelVersionColTime);
      this.add(new Version(versionNumber, versionName, createTime, provenance, this));
   
    rs.close();
    stmt.close()
 
  }
View Full Code Here


    stmt.close()
 
  }
  public void store(Connection con) throws org.dbwiki.exception.WikiException {
    try {
      Version version = this.getLastVersion();
      PreparedStatement statement = storeUpdate(con,version);
      /*
      PreparedStatement statement = con.prepareStatement(_insertSQL);
     
      statement.setInt(1, version.number());
      statement.setString(2, version.name());
     
      Provenance provenance = version.provenance();
     
      statement.setShort(3, provenance.type());
      if (provenance.user() != null) {
        statement.setInt(4, provenance.user().id());
      } else {
        statement.setInt(4, User.UnknownUserID);
      }
      if (provenance.identifier() != null) {
        statement.setInt(5, ((NodeIdentifier)provenance.identifier()).nodeID());
      } else {
        statement.setInt(5, RelVersionColNodeValImport);
      }
      if (provenance.isCopy()) {
        statement.setString(6, ((ProvenanceCopy)provenance).sourceURL());
      } else if (provenance.isImport()) {
        statement.setString(6, ((ProvenanceImport)provenance).sourceURL());
      } else {
        statement.setString(6, null);
      }
      */
      statement.setLong(7, version.time());
      statement.execute();
      statement.close();
    } catch (java.sql.SQLException exception) {
      throw new WikiFatalException(exception);
    }
View Full Code Here

        }
        statement.execute(newNode);
      }
     
      // generate a version number for the schema root
      Version version = versionIndex.getNextVersion(new ProvenanceCreate(user));
      versionIndex.add(version);
      versionIndex.store(con);
     
      // generate a timestamp for the schema root
      int timestamp = -1;
      String makeTimestamp =
          "INSERT INTO " + dbName + RelationTimesequence + "(" +
              RelTimesequenceColStart + ", " +
              RelTimesequenceColStop + ") VALUES(" + version.number() + " , -1)";
      statement.execute(makeTimestamp, Statement.RETURN_GENERATED_KEYS);
      ResultSet rs = statement.getGeneratedKeys();
      if (rs.next()) {
        timestamp = rs.getInt(1);
        rs.close();
View Full Code Here

   
    int intervalIndex = 0;
    int versionIndex = 0;
   
    while ((intervalIndex < intervals.length) && (versionIndex < _versions.size())) {
      Version version = _versions.get(versionIndex);
      int versionNumber = version.number();
      if (version.provenance().type() == Provenance.ProvenanceTypeDelete) {
        versionNumber--;
        if (intervals[intervalIndex].end() == versionNumber) {
          return true;
        }
      } else {
View Full Code Here

  public synchronized void activate(ResourceIdentifier identifier, User user) throws org.dbwiki.exception.WikiException {
    Connection con = _connector.getConnection();

    DatabaseNode node = DatabaseReader.get(con, this, (NodeIdentifier)identifier);

    Version version = _versionIndex.getNextVersion(new ProvenanceActivate(user, identifier));

    try {
      con.setAutoCommit(false);
      try {
        activateNode(con, node, version);
View Full Code Here

  public synchronized void delete(ResourceIdentifier identifier, User user) throws org.dbwiki.exception.WikiException {
    Connection con = _connector.getConnection();

    DatabaseNode node = DatabaseReader.get(con, this, (NodeIdentifier)identifier);
    Version version = _versionIndex.getNextVersion(new ProvenanceDelete(user, identifier));
   
    try {
      con.setAutoCommit(false);
      try {
        deleteNode(con, node, version);
View Full Code Here

 
  public synchronized void deleteSchemaNode(ResourceIdentifier identifier, User user) throws org.dbwiki.exception.WikiException {
    Connection con = _connector.getConnection();

    SchemaNode schemaNode = _schema.get(((SchemaNodeIdentifier)identifier).nodeID());
    Version version = _versionIndex.getNextVersion(new ProvenanceUnknown(user));
   
    try {
      con.setAutoCommit(false);
      try {
        // delete all nodes whose types are schemaNode
View Full Code Here

  }

  public synchronized ResourceIdentifier insertNode(ResourceIdentifier identifier, DocumentNode node, User user) throws org.dbwiki.exception.WikiException {
    ResourceIdentifier nodeIdentifier = null;

    Version version = _versionIndex.getNextVersion(new ProvenanceInsert(user, identifier));

    try {
      Connection con = _connector.getConnection();
      con.setAutoCommit(false);
      try {
View Full Code Here

  public synchronized void insertSchemaNode(GroupSchemaNode parent, String name, byte type, User user) throws org.dbwiki.exception.WikiException {
    if (!DatabaseSchema.isValidName(name)) {
      throw new WikiSchemaException(WikiSchemaException.SyntaxError, "Invalid element name " + name);
    }
   
    Version version = _versionIndex.getNextVersion(new ProvenanceUnknown(user));
   
    SchemaNode schema = null;
    if (type == SchemaNodeTypeAttribute) {
      if (_schema.size() == 0) {
        throw new WikiSchemaException(WikiSchemaException.InvalidSchemaType, "Schema root cannot be an attribute");
View Full Code Here

          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);     
View Full Code Here

TOP

Related Classes of org.dbwiki.data.time.Version

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.