Package org.structr.core.app

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


      if (fileName == null || fileName.isEmpty()) {

        throw new FrameworkException(400, "Please specify name.");
      }

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

        final File file = FileHelper.createFile(securityContext, new byte[0], "application/zip", File.class, fileName);

        // make file visible for auth. users
        file.setProperty(File.visibleToAuthenticatedUsers, true);
View Full Code Here


    final String host = (String)attributes.get("host");

    if (name != null && host != null) {

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

        final NodeInterface entity = app.nodeQuery().andName(name).getFirst();
        if (entity != null && entity instanceof Syncable) {

          CloudService.doRemote(new PushTransmission((Syncable)entity, true, "admin", "admin", host, 54555), new LoggingListener());
View Full Code Here

    try {

      final String id = (String) webSocketData.getId();
      final File file;

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

        file = app.get(File.class, id);

        if (file == null) {
          getWebSocket().send(MessageBuilder.status().code(400).message("File not found: ".concat(id)).build(), true);
View Full Code Here

      t.printStackTrace();

      String msg = t.toString();

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

        // return error message
        getWebSocket().send(MessageBuilder.status().code(400).message("Could not unarchive file: ".concat((msg != null) ? msg : "")).build(), true);

        tx.success();
View Full Code Here

  private void unarchive(final SecurityContext securityContext, final File file) throws ArchiveException, IOException, FrameworkException {

    final App app = StructrApp.getInstance(securityContext);
    final InputStream is;

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

      final String fileName = file.getName();

      logger.log(Level.INFO, "Unarchiving file {0}", fileName);
View Full Code Here

    ArchiveEntry entry          = in.getNextEntry();
    int overallCount            = 0;

    while (entry != null) {

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

        int count = 0;

        while (entry != null && count++ < 50) {
View Full Code Here

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

    if (obj != null) {

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

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

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

    }

    if (obj != null) {

      final Set<GraphObject> entities = new LinkedHashSet<>();
      try (final Tx tx = app.tx()) {

        collectEntities(entities, obj, null, rec);

        // commit and close transaction
        tx.success();
View Full Code Here

      final Iterator<GraphObject> iterator = entities.iterator();

      while (iterator.hasNext()) {

        count = 0;
        try (final Tx tx = app.tx()) {

          while (iterator.hasNext() && count++ < 100) {

            setProperties(app, iterator.next(), properties, true);
          }
View Full Code Here

    final String key                     = (String)properties.get("key");

    if (sourceId != null && host != null && port != null && username != null && password != null && key != null) {

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

        final GraphObject root = app.get(sourceId);
        if (root != null) {

          if (root instanceof Syncable) {
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.