Package org.structr.core.app

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


        }

      } else {

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

          new RestMethodResult(HttpServletResponse.SC_FORBIDDEN).commitResponse(gson.get(), response);
          tx.success();
        }
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()) {

          // evaluate constraint chain
          resource = ResourceHelper.applyViewTransformation(request, securityContext,
            ResourceHelper.optimizeNestedResourceChain(ResourceHelper.parsePath(securityContext, request, resourceMap, propertyView,
              config.getDefaultIdProperty()), config.getDefaultIdProperty()), propertyView);
View Full Code Here

        // isolate doPut
        boolean retry = true;
        while (retry) {

          try (final Tx tx = app.tx()) {
            result = resource.doPut(convertPropertySetToMap(jsonInput.getJsonInputs().get(0)));
            tx.success();
            retry = false;

          } catch (DeadlockDetectedException ddex) {
View Full Code Here

            retry = true;
          }
        }

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

      } else {
View Full Code Here

        }

      } else {

        // isolate write output
        try (final Tx tx = app.tx()) {
          result = new RestMethodResult(HttpServletResponse.SC_FORBIDDEN);
          result.commitResponse(gson.get(), response);
          tx.success();
        }
View Full Code Here

    final Importer importer = new Importer(securityContext, source, null, "source", 0, true, true);
    final App localAppCtx   = StructrApp.getInstance(securityContext);
    Page page               = null;

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

      page   = localAppCtx.create(Page.class, new NodeAttribute<>(Page.name, name));

      if (importer.parse()) {
View Full Code Here

    List<FtpFile> ftpFiles = new ArrayList();

    final App app = StructrApp.getInstance();

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

      String requestedPath = getAbsolutePath();
      logger.log(Level.INFO, "Children of {0} requested", requestedPath);

      if ("/".equals(requestedPath)) {
View Full Code Here

  @Override
  public boolean mkdir() {

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

      logger.log(Level.INFO, "mkdir() Folder");

      AbstractFile existing = FileHelper.getFileByAbsolutePath(SecurityContext.getSuperUserInstance(), newPath);
      if (existing != null) {
View Full Code Here

   */
  public static <T extends NodeInterface> void merge(final Set<T> origNodes, final Set<T> newNodes, final PropertyKey shadowIdPropertyKey) {

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

      // Compare uuid of original nodes with the id given in the shadow id property
      // and mark all original nodes as deleted which are not contained in new nodes list anymore
      for (final NodeInterface origNode : origNodes) {

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.