Package org.structr.schema.compiler

Examples of org.structr.schema.compiler.NodeExtender


      // this is a very critical section :)
      synchronized (SchemaService.class) {

        final Set<String> dynamicViews  = new LinkedHashSet<>();
        final NodeExtender nodeExtender = new NodeExtender();

        try (final Tx tx = StructrApp.getInstance().tx()) {

          SchemaService.ensureBuiltinTypesExist();

          // collect node classes
          for (final SchemaNode schemaNode : StructrApp.getInstance().nodeQuery(SchemaNode.class).getAsList()) {

            nodeExtender.addClass(schemaNode.getClassName(), schemaNode.getSource(errorBuffer));

            final String auxSource = schemaNode.getAuxiliarySource();
            if (auxSource != null) {

              nodeExtender.addClass("_" + schemaNode.getClassName() + "Helper", auxSource);
            }

            dynamicViews.addAll(schemaNode.getViews());
          }

          // collect relationship classes
          for (final SchemaRelationship schemaRelationship : StructrApp.getInstance().relationshipQuery(SchemaRelationship.class).getAsList()) {

            nodeExtender.addClass(schemaRelationship.getClassName(), schemaRelationship.getSource(errorBuffer));

            final String auxSource = schemaRelationship.getAuxiliarySource();
            if (auxSource != null) {

              nodeExtender.addClass("_" + schemaRelationship.getClassName() + "Helper", auxSource);
            }

            dynamicViews.addAll(schemaRelationship.getViews());
          }

          // compile all classes at once and register
          Map<String, Class> newTypes = nodeExtender.compile(errorBuffer);
          for (final Class newType : newTypes.values()) {

            config.registerEntityType(newType);

            // instantiate classes to execute
View Full Code Here

TOP

Related Classes of org.structr.schema.compiler.NodeExtender

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.