Package org.structr.core.app

Examples of org.structr.core.app.App.tx()


  protected <T extends NodeInterface> List<T> createTestNodes(final Class<T> type, final int number) throws FrameworkException {

    final App app       = StructrApp.getInstance(securityContext);
    final List<T> nodes = new LinkedList<>();

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

      for (int i = 0; i < number; i++) {
        nodes.add(app.create(type));
      }
View Full Code Here


    final List<TestOne> nodes = createTestNodes(TestOne.class, 2);
    final TestOne startNode   = nodes.get(0);
    final TestOne endNode     = nodes.get(1);
    final List<T> rels        = new LinkedList<>();

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

      for (int i = 0; i < number; i++) {

        rels.add((T)app.create(startNode, endNode, relType));
      }
View Full Code Here

  protected <T extends NodeInterface> List<T> createTestNodes(final Class<T> type, final int number) throws FrameworkException {

    final App app       = StructrApp.getInstance(securityContext);
    final List<T> nodes = new LinkedList<>();

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

      for (int i = 0; i < number; i++) {
        nodes.add(app.create(type));
      }
View Full Code Here

    final List<TestOne> nodes = createTestNodes(TestOne.class, 2);
    final TestOne startNode   = nodes.get(0);
    final TestOne endNode     = nodes.get(1);
    final List<T> rels        = new LinkedList<>();

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

      for (int i = 0; i < number; i++) {

        rels.add((T)app.create(startNode, endNode, relType));
      }
View Full Code Here

    Tag top  = body.block("div").id("top");

    final App app  = StructrApp.getInstance(securityContext);
    final Tag left = body.block("div").id("left");

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

      for (SchemaNode node : app.nodeQuery(SchemaNode.class).getAsList()) {

        final String rawType = node.getName();
        top.inline("a").attr(new Href(restPath + "/" + rawType), new If(rawType.equals(currentType), new Css("active"))).text(rawType);
View Full Code Here

          retry = true;
        }
      }

      // isolate write output
      try (final Tx tx = app.tx()) {
        result.commitResponse(gson.get(), response);
        tx.success();
      }

    } catch (FrameworkException frameworkException) {
View Full Code Here

      if (StringUtils.isBlank(input)) {
        input = "{}";
      }

      // isolate input parsing (will include read and write operations)
      try (final Tx tx = app.tx()) {
        jsonInput   = gson.get().fromJson(input, IJsonInput.class);
        tx.success();
      }

      if (securityContext != null) {
View Full Code Here

      }

      if (securityContext != null) {

        // isolate resource authentication
        try (final Tx tx = app.tx()) {

          resource = ResourceHelper.applyViewTransformation(request, securityContext,
              ResourceHelper.optimizeNestedResourceChain(ResourceHelper.parsePath(securityContext, request, resourceMap, propertyView,
              config.getDefaultIdProperty()), config.getDefaultIdProperty()), propertyView);
          authenticator.checkResourceAccess(request, resource.getResourceSignature(), propertyView.get(securityContext));
View Full Code Here

        boolean retry = true;
        while (retry) {

          if (resource.createPostTransaction()) {

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

              for (JsonInput propertySet : jsonInput.getJsonInputs()) {

                results.add(resource.doPost(convertPropertySetToMap(propertySet)));
              }
View Full Code Here

        // set default value for property view
        propertyView.set(securityContext, config.getDefaultPropertyView());

        // isolate write output
        try (final Tx tx = app.tx()) {

          if (!results.isEmpty()) {

            final RestMethodResult result = results.get(0);
            final int resultCount         = results.size();
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.