Package org.structr.core.app

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


    webSocketData.getNodeData().remove("recursive");

    if (obj != null) {

      final App app = StructrApp.getInstance(getWebSocket().getSecurityContext());
      try (final Tx tx = app.tx()) {

        if (!getWebSocket().getSecurityContext().isAllowed(((AbstractNode) obj), Permission.accessControl)) {

          logger.log(Level.WARNING, "No access control permission for {0} on {1}", new Object[]{getWebSocket().getCurrentUser().toString(), obj.toString()});
          getWebSocket().send(MessageBuilder.status().message("No access control permission").code(400).build(), true);
View Full Code Here


    }

    final App app = StructrApp.getInstance(securityContext);

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

      for (Node node : toDelete) {

        logger.log(Level.INFO, "Deleting node {0}", node);
View Full Code Here

    logger.log(Level.INFO, "Connection closed with closeCode {0} and message {1}", new Object[]{closeCode, message});

    final App app = StructrApp.getInstance(securityContext);

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

      this.session = null;

      syncController.unregisterClient(this);
View Full Code Here

    final String sessionIdFromMessage = webSocketData.getSessionId();

    if (type != null) {

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

        if (sessionIdFromMessage != null) {

          // try to authenticated this connection by sessionId
          authenticate(sessionIdFromMessage);
View Full Code Here

        // The below blocks allow a websocket command to manage its own
        // transactions in case of bulk processing commands etc.

        if (abstractCommand.requiresEnclosingTransaction()) {

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

            // store authenticated-Flag in webSocketData
            // so the command can access it
            webSocketData.setSessionValid(isAuthenticated());
View Full Code Here

            tx.success();
          }

        } else {

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

            // store authenticated-Flag in webSocketData
            // so the command can access it
            webSocketData.setSessionValid(isAuthenticated());
View Full Code Here

        t.printStackTrace(System.out);

        // Clear result in case of rollback
        //webSocketData.clear();

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

          // send 400 Bad Request
          if (t instanceof FrameworkException) {

            send(MessageBuilder.status().message(t.toString()).jsonErrorObject(((FrameworkException) t).toJSON()).build(), true);
View Full Code Here

      // evaluate constraints and measure query time
      double queryTimeStart = System.nanoTime();

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

        resource = ResourceHelper.optimizeNestedResourceChain(ResourceHelper.parsePath(securityContext, request, resourceMap, propertyView, defaultIdProperty), defaultIdProperty);
        authenticator.checkResourceAccess(request, resource.getResourceSignature(), propertyView.get(securityContext));

        tx.success();
View Full Code Here

        authenticator.checkResourceAccess(request, resource.getResourceSignature(), propertyView.get(securityContext));

        tx.success();
      }

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

        String resourceSignature = resource.getResourceSignature();

        // let authenticator examine request again
        authenticator.checkResourceAccess(request, resourceSignature, propertyView.get(securityContext));
View Full Code Here

      }

      final App app = StructrApp.getInstance(securityContext);

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

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

        tx.success();
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.