Package org.dbwiki.data.schema

Examples of org.dbwiki.data.schema.SchemaNode


   * @param request
   * @return
   * @throws org.dbwiki.exception.WikiException
   */
  protected DocumentNode getInsertNode(WikiDataRequest  request) throws org.dbwiki.exception.WikiException {
    SchemaNode schemaNode = database().schema().get(Integer.parseInt(request.parameters().get(RequestParameter.ActionValueSchemaNode).value()));
    if (schemaNode.isAttribute()) {
      AttributeSchemaNode attributeSchemaNode = (AttributeSchemaNode)schemaNode;
      DocumentAttributeNode attribute = new DocumentAttributeNode(attributeSchemaNode);
      RequestParameter parameter = request.parameters().get(RequestParameter.TextFieldIndicator + attributeSchemaNode.id());
      if (parameter.hasValue()) {
        if (!parameter.value().equals("")) {
          attribute.setValue(parameter.value());
        }
      }
      return attribute;
    } else {
      Hashtable<Integer, DocumentGroupNode> groupIndex = new Hashtable<Integer, DocumentGroupNode>();
      DocumentGroupNode root = SchemaNode.createGroupNode((GroupSchemaNode)schemaNode, groupIndex);
      for (int iParameter = 0; iParameter < request.parameters().size(); iParameter++) {
        RequestParameter parameter = request.parameters().get(iParameter);
        if ((parameter.name().startsWith(RequestParameter.TextFieldIndicator)) && (parameter.hasValue())) {
          if (!parameter.value().equals("")) {
            SchemaNode child = database().schema().get(Integer.parseInt(parameter.name().substring(RequestParameter.TextFieldIndicator.length())));
            if (child.isAttribute()) {
              DocumentAttributeNode attribute = new DocumentAttributeNode((AttributeSchemaNode)child);
              attribute.setValue(parameter.value());
              groupIndex.get(new Integer(attribute.schema().parent().id())).children().add(attribute);
            }
          }
View Full Code Here


    if (container == null) {
      container = new SchemaNodeList(node);
      boolean added = false;
      SchemaLayout nodeLayout = _layout.get(node.schema());
      for (int iElement = 0; iElement < _lists.size(); iElement++) {
        SchemaNode schema = _lists.get(iElement).schema();
        SchemaLayout schemaLayout = _layout.get(schema);
        if (schemaLayout.getDisplayOrder() > nodeLayout.getDisplayOrder()) {
          _lists.add(iElement, container);
          added = true;
          break;
        } else if ((schemaLayout.getDisplayOrder() == nodeLayout.getDisplayOrder()) && (schema.id() > node.schema().id())) {
          _lists.add(iElement, container);
          added = true;
          break;
        }
      }
View Full Code Here

   * Private Methods
   */
 
  private void listSchemaNodes(GroupSchemaNode schema, Vector<SchemaNode> entities) {
    for (int iChild = 0; iChild < schema.children().size(); iChild++) {
      SchemaNode child = schema.children().get(iChild);
      // skip deleted entities
      if (child.getTimestamp().isCurrent()) {
        entities.add(child);
        if (child.isGroup()) {
          this.listSchemaNodes((GroupSchemaNode)child, entities);
        }
      }
    }
  }
View Full Code Here

   
    int count = 0;
   
    if (entities.size() > 0) {
      for (int i = 0; i < entities.size(); i++) {
        SchemaNode schemaNode = entities.get(i);
        if (schemaNode.isAttribute()) {
          if (count > 0) {
            printer.addBR();
          }
          if (schemaNode.id() == currentDisplaySchemaNodeID) {
            printer.addRADIOBUTTON(schemaNode.path(), DatabaseLayouter.PropertyDisplaySchema, Integer.toString(schemaNode.id()), true);
          } else {
            printer.addRADIOBUTTON(schemaNode.path(), DatabaseLayouter.PropertyDisplaySchema, Integer.toString(schemaNode.id()), false);
          }
          count++;
        }
      }
    }
View Full Code Here

    while (tokens.hasMoreTokens()) {
      if  (tokens.nextToken().equalsIgnoreCase("IDENTIFY")) {
        try {
          String path = tokens.nextToken();
          if (tokens.nextToken().equalsIgnoreCase("BY")) {
            SchemaNode node = schema.get(path);
            if (node.isGroup()) {
              String value = tokens.nextToken();
              String valuePath = path;
              if (!valuePath.endsWith(SchemaNode.SchemaPathSeparator)) {
                valuePath = valuePath + SchemaNode.SchemaPathSeparator + value;
              } else {
                valuePath = valuePath + value;
              }
              SchemaNode valueNode = schema.get(valuePath);
              if (valueNode.isAttribute()) {
                this.add(new URLDecodingRule((GroupSchemaNode)node, (AttributeSchemaNode)valueNode));
              } else {
                throw new WikiSchemaException(WikiSchemaException.InvalidConstraintDefinition, valueNode + " is not an attribute node");
              }
            } else {
View Full Code Here

      // If it's the last element of the URL path the nodeIdentifier could be the node label
      // of an attribute node or a key value for an internal node.
      // First check whether the nodeIdentifier is a valid node label for the current
      // schema node.
      for (int iChild = 0; iChild < schemaNode.children().size(); iChild++) {
        SchemaNode childSchema = schemaNode.children().get(iChild);
        if ((childSchema.label().equals(nodeIdentifier)) && (childSchema.isAttribute())) {
          // Make sure that there is only one child
          DatabaseElementList nodes = node.find(childSchema.path().substring(node.schema().path().length() + 1));
          if (nodes.size() > 1) {
            throw new WikiDataException(WikiDataException.UnknownResource, url.toString());
          } else if (nodes.size() == 1) {
            if (pathIndex == (url.size() - 1)) {
              return nodes.get(0).identifier();
View Full Code Here

TOP

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

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.