Examples of TimeSequence


Examples of org.dbwiki.data.time.TimeSequence

  public int lastChange() {
    return -1;
  }

  public TimeSequence timestamp() {
    return new TimeSequence(1);
  }
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

   * @param version
   * @throws org.dbwiki.exception.WikiException
   */
  public void insertSchemaNode(SchemaNode schemaNode, Version version) throws org.dbwiki.exception.WikiException {
    User user = version.provenance().user();
    TimeSequence timestamp = new TimeSequence(version);
    try {
      PreparedStatement insert = _con.prepareStatement(
        "INSERT INTO " + _database.name() + RelationSchema + " (" +
          RelSchemaColID + ", " +
          RelSchemaColType + ", " +
          RelSchemaColLabel + ", " +
          RelSchemaColParent + ", " +
          RelSchemaColUser + ")" +
          " VALUES(?, ?, ?, ?, ?)", Statement.RETURN_GENERATED_KEYS);
      insert.setInt(1, schemaNode.id());
      if (schemaNode.isAttribute()) {
        insert.setInt(2, RelSchemaColTypeValAttribute);
      } else {
        insert.setInt(2, RelSchemaColTypeValGroup);
      }
      insert.setString(3, schemaNode.label());
      if (schemaNode.parent() != null) {
        insert.setInt(4, schemaNode.parent().id());
      } else {
        insert.setInt(4, RelSchemaColParentValUnknown);
      }
      if (user != null) {
        insert.setInt(5, user.id());
      } else {
        insert.setInt(5, User.UnknownUserID);
      }

      insert.execute();
      int id = getGeneratedKey(insert);
      insert.close();
     
      PreparedStatement insertTimestamp = prepareInsertTimestamp(true);

      insertTimestamp.setInt(1, timestamp.firstValue());
      insertTimestamp.setInt(2, RelTimestampColEndValOpen);
      insertTimestamp.execute();
       
      recordNewSchemaTimestamp(id, getGeneratedKey(insertTimestamp));
     
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

   */

  public ResourceIdentifier insertRootNode(DocumentGroupNode node, Version version) throws org.dbwiki.exception.WikiException {
    try {
      node.doNumberingRoot();
      RDBMSDatabaseGroupNode root = this.insertGroupNode((GroupSchemaNode)node.schema(), null, -1, new TimeSequence(version.number()), node.getpre(),node.getpost());
      this.insertGroupChildren(node, root, root.identifier().nodeID());
      PreparedStatement pStmtUpdateNode = _con.prepareStatement(
        "UPDATE " + _database.name() + RelationData + " " +
          "SET " + RelDataColEntry + " = ? WHERE " + RelDataColID + " = ?");
      pStmtUpdateNode.setInt(1, root.identifier().nodeID());
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

      // Shift all node indexes that are >= newpre
      shiftNodes(RelDataColPre, entryID,newPre,delta);
      shiftNodes(RelDataColPost, entryID,newPre,delta);
      // Add the new nodes
      if (node.isAttribute()) {
        nodeIdentifier = insertAttributeNode((AttributeSchemaNode)node.schema(), parent, entryID, new TimeSequence(version), ((DocumentAttributeNode)node).value(), node.getpre(), node.getpost()).identifier();
      } else {
        RDBMSDatabaseGroupNode group = insertGroupNode((GroupSchemaNode)node.schema(), parent, entryID, new TimeSequence(version),node.getpre(), node.getpost());
        insertGroupChildren((DocumentGroupNode)node, group, entryID);
        nodeIdentifier = group.identifier();
      }
     
    } catch (java.sql.SQLException sqlException) {
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

 
  private void writeTextNodes(RDBMSDatabaseAttributeNode attribute, int entry) throws java.sql.SQLException, org.dbwiki.exception.WikiException {   
    for (int iValue = 0; iValue < attribute.value().size(); iValue++) {
      DatabaseTextNode node = attribute.value().get(iValue);
      if (((NodeIdentifier)node.identifier()).nodeID() == RelDataColIDValUnknown) {
        TimeSequence timestamp = null;
        if (node.hasTimestamp()) {
          timestamp = node.getTimestamp();
        }
        this.insertTextNode(attribute, entry, timestamp, node.value(), attribute.getpre(), attribute.getpost());
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

        while (rs.next()) {
          int id = rs.getInt(1);
          int start = rs.getInt(2);
          int end = rs.getInt(3);
          if (entry == null) {
            entry = new RDBMSDatabaseEntry(new NodeIdentifier(id), new TimeSequence(start, end));
            add(entry);
          } else {
            if (entry.identifier().nodeID() == id) {
              entry.timestamp().elongate(start, end);
            } else {
              entry = new RDBMSDatabaseEntry(new NodeIdentifier(id), new TimeSequence(start, end));
              add(entry);
            }
          }
        }
        rs.close();
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

        
         
        if (!rs.wasNull()) {
          end = rs.getInt(ViewDataColTimestampEnd);
          if (!node.hasTimestamp()) {
            node.setTimestamp(new TimeSequence(start, end));
          } else {
            node.getTimestamp().elongate(start, end);
          }
        }
        int annotationID = rs.getInt(ViewDataColAnnotationID);
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

          int start = rs.getInt(ViewDataColTimestampStart);
          if (!rs.wasNull()) {
            end = rs.getInt(ViewDataColTimestampEnd);
            if (!node.hasTimestamp()) {
              //FIXME is this right?
              node.setTimestamp(new TimeSequence(start, end));
            } else {
              node.getTimestamp().elongate(start, end);
            }
          }
          int annotationID = rs.getInt(ViewDataColAnnotationID);
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

 
  public void evalTimestamp(DatabaseElementNode node, TimestampEvaluationResult evalResult) {
   
    DatabaseAttributeNode attribute = (DatabaseAttributeNode)node;
   
    TimeSequence timestamp = null;
   
    boolean hasAllPositiveEvaluations = true;
   
    for (int iValue = 0; iValue < attribute.value().size(); iValue++) {
      boolean opResult = _operator.eval(attribute.value().get(iValue).value());
      if (opResult) {
        if (timestamp != null) {
          timestamp = timestamp.union(attribute.value().get(iValue).getTimestamp());
        } else {
          timestamp = attribute.value().get(iValue).getTimestamp();
        }
      } else {
        hasAllPositiveEvaluations = false;
View Full Code Here

Examples of org.dbwiki.data.time.TimeSequence

    return true;
  }
 
  public TimeSequence evalTimestamp(DatabaseElementNode node) {

    TimeSequence timestamp = null;
    for (Condition condition : _conditions) {
      TimeSequence t = condition.evalTimestamp(node);
      if (t != null) {
        if (timestamp != null) {
          timestamp = timestamp.intersect(t);
          if (timestamp.isEmpty()) {
            return null;
View Full Code Here
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.