Package org.dbwiki.data.schema

Examples of org.dbwiki.data.schema.GroupSchemaNode


      body.openTABLE(layout.getCSS(CSS.CSSObjectFrameActive));
      this.printInsertLine(schema, body);
      body.closeTABLE();
    } else {
      body.openTABLE(layout.getCSS(CSS.CSSObjectFrame));
      GroupSchemaNode groupSchemaNode = (GroupSchemaNode)schema;
      for (int iChild = 0; iChild < groupSchemaNode.children().size(); iChild++) {
        SchemaNode child = groupSchemaNode.children().get(iChild);
        // skip deleted entities
        if (!child.getTimestamp().isCurrent())
          continue;
        if (child.isAttribute()) {
          body.openTR();
          body.openTD(layout.getCSS(CSS.CSSObjectListing));
          body.openTABLE(layout.getCSS(CSS.CSSObjectFrameActive));
          this.printInsertLine(child, body);
          body.closeTABLE();
          body.closeTD();
          body.closeTR();
        } else if (_layouter.get(child).getEditWithParent()) {
          GroupSchemaNode groupChild = (GroupSchemaNode)child;
          body.openTR();
          body.openTD(layout.getCSS(CSS.CSSObjectListing));
          body.openTABLE(layout.getCSS(CSS.CSSContentFrameActive));
          body.openTR();
          body.openTD(layout.getCSS(CSS.CSSContentTopLabelActive));
View Full Code Here


      content.closeTD();
    }

    content.openTD(layout.getCSS(CSS.CSSContentValue));
   
    GroupSchemaNode schemaNode = (GroupSchemaNode)list.schema();
   
    content.openTABLE(layout.getCSS(CSS.CSSContentTable));
     
    content.openTR();
    for (int iColumn = 0; iColumn < schemaNode.children().size(); iColumn++) {
      SchemaNode columnSchemaNode = schemaNode.children().get(iColumn);
      // only display columns for entities that have not been deleted
      if (versionParameter.matches(columnSchemaNode)) {
        SchemaLayout schemaLayout = _layouter.get(columnSchemaNode);
        if (active) {
          content.openTH(layout.getCSS(CSS.CSSContentCellActive));
        } else {
          content.openTH(layout.getCSS(CSS.CSSContentCellInactive));
        }
        content.text(schemaLayout.getName());
        content.closeTH();
      }
    }
    content.closeTR();
   
    for (int iNode = 0; iNode < list.size(); iNode++) {
      DatabaseGroupNode groupNode = (DatabaseGroupNode)list.get(iNode);
      // only display nodes that have not been deleted
      if (versionParameter.matches(groupNode)) {
        content.openTR();
        for (int iColumn = 0; iColumn < schemaNode.children().size(); iColumn++) {
          //DatabaseElementList nodes = groupNode.children().get(schemaNode.children().get(iColumn));
          DatabaseElementList nodes = groupNode.children().get(schemaNode.children().get(iColumn).label());
          if (groupNode.getTimestamp().isCurrent()) {
            content.openTD(layout.getCSS(CSS.CSSContentCellActive));
          } else {
            content.openTD(layout.getCSS(CSS.CSSContentCellInactive));
          }
View Full Code Here

   * Private Methods
   */
  private void buildSchema(DatabaseSchema schema, ElementNode node, GroupSchemaNode parent) throws WikiException {
    if (node.children().size() > 0) {
      // has children, so must be an element ('GroupSchemaNode')
      GroupSchemaNode schemaNode = new GroupSchemaNode(schema.size(), node.label(), parent);
      schema.add(schemaNode);
      for (int i = 0; i < node.children().size(); i++) {
        this.buildSchema(schema, node.children().get(i), schemaNode);
      }
    } else {
View Full Code Here

    }
  }
 
  private DatabaseSchema buildRoot(ElementNode node) throws WikiException {
    DatabaseSchema schema = new DatabaseSchema();
    GroupSchemaNode rootSchemaNode = new GroupSchemaNode(schema.size(), node.label(), null);
    schema.add(rootSchemaNode);
   
    for (int i = 0; i < node.children().size(); i++) {
      buildSchema(schema, node.children().get(i), rootSchemaNode);
    }
View Full Code Here

        } else {
            throw new WikiFatalException("There are no generated keys.");
       
     
      // update the schema root with the generated timestamp
      GroupSchemaNode root = schema.root();
      String updateTimestamp =
          "UPDATE " + schemaTable + " " +
            "SET " + RelSchemaColTimesequence + " = " + timestamp +
            " WHERE " + RelSchemaColID + " = " + root.id();
      statement.execute(updateTimestamp);
    }
   
    statement.close();
  }
View Full Code Here

      if (_schema.size() == 0) {
        throw new WikiSchemaException(WikiSchemaException.InvalidSchemaType, "Schema root cannot be an attribute");
      }
      schema = new AttributeSchemaNode(_schema.size(), name, parent, new TimeSequence(version));
    } else if (type == SchemaNodeTypeGroup) {
      schema = new GroupSchemaNode(_schema.size(), name, parent, new TimeSequence(version));
    } else {
      throw new WikiSchemaException(WikiSchemaException.InvalidSchemaType, String.valueOf(type));
    }
   
    try {
View Full Code Here

      if (schemaNode == null) {
        if (_wiki.getAutoSchemaChanges() == DatabaseWikiProperties.AutoSchemaChangesAllow) {
          if (sourceNode.isAttribute()) {
            schemaNode = new AttributeSchemaNode(schema.size(), sourceNode.label(), parentSchemaNode, null);
          } else {
            schemaNode = new GroupSchemaNode(schema.size(), sourceNode.label(), parentSchemaNode, null);
          }
          schema.add(schemaNode);
        } else if (_wiki.getAutoSchemaChanges() == DatabaseWikiProperties.AutoSchemaChangesNever) {
          throw new WikiDataException(WikiDataException.UnknownSchemaNode, sourceNode.label() + " not allowed under " + parentSchemaNode.label());
        }
      }
    } else if (schema.root() != null) {
      schemaNode = schema.root();
      if (!schemaNode.label().equals(sourceNode.label())) {
        throw new WikiDataException(WikiDataException.InvalidPasteTarget, "Node label does not match root label");
      }
    } else {
      if (_wiki.getAutoSchemaChanges() == DatabaseWikiProperties.AutoSchemaChangesAllow) {
        schemaNode = new GroupSchemaNode(schema.size(), sourceNode.label(), null, null);
        schema.add(schemaNode);
      } else if (_wiki.getAutoSchemaChanges() == DatabaseWikiProperties.AutoSchemaChangesNever) {
        throw new WikiDataException(WikiDataException.UnknownSchemaNode, sourceNode.label() + " not allowed as schema root");
      }
    }
View Full Code Here

      // if the schema node isn't already loaded, then load it
      SchemaNode schema;
      schema = get(id);    
      if(schema == null) {
        String label = results.getString(RelSchemaColLabel);
        GroupSchemaNode parent = null;
        if (results.getInt(RelSchemaColParent) != -1) {
          parent = (GroupSchemaNode)get(results.getInt(RelSchemaColParent));
        }

        if ((results.getInt(RelSchemaColType) == RelSchemaColTypeValAttribute) && (parent != null)) {
          schema = new AttributeSchemaNode(id, label, parent);
        } else if (results.getInt(RelSchemaColType) == RelSchemaColTypeValGroup) {
          schema = new GroupSchemaNode(id, label, parent);
        } else {
          throw new WikiSchemaException(WikiSchemaException.InvalidSchemaType, "Database value " + results.getInt(RelSchemaColType));
        }
      }
View Full Code Here

      Iterator<Counter> elements = labelCounter.values().iterator();
      while (elements.hasNext()) {
        elements.next().reset(1);
      }
      try {
        _resultSchema = new GroupSchemaNode(-1, "result", null, new TimeSequence(1));
        for (SubTreeSelectStatement stmt : _statements) {
          SchemaNode schema = stmt.targetPath().lastElement().entity();
          String label = null;
          if (stmt.label() != null) {
            label = stmt.label();
          } else {
            label = schema.label();
          }
          if (labelCounter.containsKey(label)) {
            Counter counter = labelCounter.get(label);
            label = label + Integer.toString(counter.value());
            stmt.setLabel(label);
            counter.inc();
          }
          SchemaNode renamedSchema = null;
          if (schema.isAttribute()) {
            renamedSchema = new AttributeSchemaNode(-1, label, _resultSchema, schema.getTimestamp());
            //renamedSchema = new AttributeSchemaNode(schema.id(), label, _resultSchema, schema.getTimestamp());
          } else {
            renamedSchema = new GroupSchemaNode(-1, label, _resultSchema, schema.getTimestamp());
            //renamedSchema = new GroupSchemaNode(schema.id(), label, _resultSchema, schema.getTimestamp());
            for (int iChild = 0; iChild < ((GroupSchemaNode)schema).children().size(); iChild++) {
              ((GroupSchemaNode)renamedSchema).children().add(((GroupSchemaNode)schema).children().get(iChild));
            }
          }
View Full Code Here

          }
        }
        // Only objects may be annotated, thus this is a get request
        isGetRequest = true;
      } else if (action.actionSchemaNode()) {
        GroupSchemaNode parent = null;
        if (!request.isRootRequest()) {
          parent = (GroupSchemaNode) ((DatabaseElementNode) _database
              .get(request.wri().resourceIdentifier())).schema();
        }
        _database.insertSchemaNode(
View Full Code Here

TOP

Related Classes of org.dbwiki.data.schema.GroupSchemaNode

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.