Package org.structr.core.entity

Examples of org.structr.core.entity.SchemaNode


     * of the includes for dynamic types are only available in rest
     */

    try {

      SchemaNode node = null;

      // setup
      try (final Tx tx = app.tx()) {

        node = app.create(SchemaNode.class, new NodeAttribute(SchemaNode.name, "TestType"));
        node.setProperty(new StringProperty("_test"), "Integer");

        tx.success();
      }

      // fetch dynamic type info
      final Class dynamicType   = StructrApp.getConfiguration().getNodeEntityClass("TestType");
      final PropertyKey testKey = StructrApp.getConfiguration().getPropertyKeyForJSONName(dynamicType, "test");

      // modify schema node but keep reference to "old" type
      try (final Tx tx = app.tx()) {

        node.setProperty(new StringProperty("_test2"), "String");

        tx.success();
      }

      // create test nodes
View Full Code Here


    for (final Entry<String, String> entry : builtinTypeMap.entrySet()) {

      final String type = entry.getKey();
      final String fqcn = entry.getValue();

      SchemaNode schemaNode = app.nodeQuery(SchemaNode.class).andName(type).getFirst();
      if (schemaNode == null) {

        schemaNode = app.create(SchemaNode.class, type);
      }

      schemaNode.setProperty(SchemaNode.extendsClass, fqcn);
      schemaNode.unlockReadOnlyPropertiesOnce();
      schemaNode.setProperty(SchemaNode.isBuiltinType, true);
    }
  }
View Full Code Here

public class RenderContextTest extends StructrUiTest {

  public void testVariableReplacementInDynamicTypes() {

    SchemaNode itemNode  = null;
    NodeInterface parent = null;
    NodeInterface child1 = null;
    NodeInterface child2 = null;

    try (final Tx tx = app.tx()) {
View Full Code Here

      }

      // create relationships
      for (final RelationshipInfo template : reducedRelationshipInfos) {

        final SchemaNode startNode    = schemaNodes.get(template.getStartNodeType());
        final SchemaNode endNode      = schemaNodes.get(template.getEndNodeType());
        final String relationshipType = template.getRelType();
        final PropertyMap propertyMap = new PropertyMap();

        propertyMap.put(SchemaRelationship.sourceId, startNode.getUuid());
        propertyMap.put(SchemaRelationship.targetId, endNode.getUuid());
        propertyMap.put(SchemaRelationship.relationshipType, relationshipType);

        app.create(startNode, endNode, SchemaRelationship.class, propertyMap);
      }
View Full Code Here

TOP

Related Classes of org.structr.core.entity.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.