Package org.structr.core.app

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


  @Export
  public void diff(final String file) throws FrameworkException {

    final App app = StructrApp.getInstance(securityContext);

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

      final String source = IOUtils.toString(new FileInputStream(file));
      final List<InvertibleModificationOperation> changeSet = new LinkedList<>();
      final Page diffPage = Importer.parsePageFromSource(securityContext, source, this.getProperty(Page.name) + "diff");
View Full Code Here


      public void flush() throws IOException {

        final String source = toString();

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

          // parse page from modified source
          Page modifiedPage = Importer.parsePageFromSource(securityContext, source, "__FTP_Temporary_Page__");

          final List<InvertibleModificationOperation> changeSet = Importer.diffPages(origPage, modifiedPage);
View Full Code Here

  protected <T extends AbstractNode> T createTestNode(final Class<T> type, final PropertyMap props, final Principal user) throws FrameworkException {

    final App backendApp = StructrApp.getInstance(SecurityContext.getInstance(user, AccessMode.Backend));

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

      final T result = backendApp.create(type, props);
      tx.success();

      return result;
View Full Code Here

  public static void clearResourceAccess() {

    final App app = StructrApp.getInstance();

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

      for (final ResourceAccess access : app.nodeQuery(ResourceAccess.class).getAsList()) {
        app.delete(access);
      }
View Full Code Here

  public AbstractNode getNode(final String id) {

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app = StructrApp.getInstance(securityContext);

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

      final AbstractNode node = (AbstractNode)app.get(id);

      tx.success();
View Full Code Here

    }

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app = StructrApp.getInstance(securityContext);

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

      final AbstractRelationship rel = (AbstractRelationship)app.get(id);

      tx.success();
View Full Code Here

    final SecurityContext securityContext = getWebSocket().getSecurityContext();
    final App app                         = StructrApp.getInstance(securityContext);
    final String id                       = webSocketData.getId();

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

      final Page page                = app.get(Page.class, id);
      final List<GraphObject> result = new LinkedList<>();

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

    final Long port                      = (Long)properties.get("port");

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

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

        final List<SyncableInfo> syncables = CloudService.doRemote(new SingleTransmission<>(new ListSyncables(type), username, password, host, port.intValue()), new WebsocketProgressListener(getWebSocket(), key));
        final StructrWebSocket webSocket   = getWebSocket();
        if (syncables != null) {
View Full Code Here

    query.includeDeletedAndHidden();
    query.orTypes(DOMElement.class);
    query.orType(Content.class);

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

      resultList.addAll(query.getAsList());

      // determine which of the nodes have incoming CONTAINS relationships and are not components
      for (GraphObject obj : resultList) {
View Full Code Here

    int count                             = 0;

    while (iterator.hasNext()) {

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

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

          app.delete(iterator.next());
        }
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.