Package org.structr.core.app

Examples of org.structr.core.app.App


    } else {

      newName = "unknown";
    }

    final App app = StructrApp.getInstance(securityContext);

    if (nodeToClone != null) {

      try {
        final Page pageToClone = nodeToClone instanceof Page ? (Page) nodeToClone : null;
View Full Code Here


   *
   * @param nodeToClone
   */
  private DOMNode cloneAndAppendChildren(final SecurityContext securityContext, final DOMNode nodeToClone) {

    final App app = StructrApp.getInstance(securityContext);

    final DOMNode newNode = (DOMNode) nodeToClone.cloneNode(false);

    final List<DOMNode> childrenToClone = (List<DOMNode>) nodeToClone.getChildNodes();

View Full Code Here

   * @return the node
   */
  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();

      return node;

View Full Code Here

    if (id == null) {
      return null;
    }

    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();

      return rel;
View Full Code Here

   * @return shadow document
   * @throws FrameworkException
   */
  protected ShadowDocument getOrCreateHiddenDocument() throws FrameworkException {

    final App app = StructrApp.getInstance();

    ShadowDocument doc = app.nodeQuery(ShadowDocument.class).getFirst();
    if (doc == null) {

      final PropertyMap properties = new PropertyMap();
      properties.put(AbstractNode.type, ShadowDocument.class.getSimpleName());
      properties.put(AbstractNode.name, "__ShadowDocument__");
      properties.put(AbstractNode.hidden, true);
      properties.put(AbstractNode.visibleToAuthenticatedUsers, true);

      doc = app.create(ShadowDocument.class, properties);
    }

    return doc;

  }
View Full Code Here

  @Override
  public void setIdAttribute(final String idString, boolean isId) throws DOMException {

    checkWriteAccess();

    final App app = StructrApp.getInstance(securityContext);

    try {
      setProperty(DOMElement._id, idString);

    } catch (FrameworkException fex) {
View Full Code Here

  @Override
  public void processMessage(final WebSocketMessage webSocketData) {

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

    Map<String, Object> nodeData = webSocketData.getNodeData();

    try {

      final PropertyMap properties  = PropertyMap.inputTypeToJavaType(securityContext, nodeData);
      Class type      = SchemaHelper.getEntityClassForRawType(properties.get(AbstractNode.type));
      final NodeInterface newNode  = app.create(type, properties);

      // check for File node and store in WebSocket to receive chunks
      if (newNode instanceof FileBase) {

        Long size    = (Long) webSocketData.getNodeData().get("size");
View Full Code Here

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    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) {

        collectActiveElements(result, page, Collections.EMPTY_SET, null, 0);
View Full Code Here

    return super.tryCombineWith(next);
  }

  public GraphObject getEntity() throws FrameworkException {

    final App app = StructrApp.getInstance();
   
    GraphObject entity = app.nodeQuery().uuid(uuid).getFirst();
    if (entity == null) {
     
      entity = app.relationshipQuery().uuid(uuid).getFirst();
    }

    if (entity == null) {
      throw new NotFoundException();
    }
View Full Code Here

  }

  @Override
  public void processMessage(WebSocketMessage webSocketData) {

    final App app                      = StructrApp.getInstance(getWebSocket().getSecurityContext());
    final String id                     = webSocketData.getId();
    final Map<String, Object> nodeData = webSocketData.getNodeData();
    final String source                = (String) nodeData.get("source");
    final String name                  = (String) nodeData.get("name");

    // check for ID
    if (id == null) {

      getWebSocket().send(MessageBuilder.status().code(422).message("Cannot create widget without id").build(), true);

      return;

    }

    // check if parent node with given ID exists
    DOMNode node = getDOMNode(id);

    if (node == null) {

      getWebSocket().send(MessageBuilder.status().code(404).message("Node not found").build(), true);

      return;

    }
   
    try {
     
      // convertFromInput
      PropertyMap properties = new PropertyMap();

      properties.put(AbstractNode.type, Widget.class.getSimpleName());
      properties.put(AbstractNode.name, name);
      properties.put(Widget.source, source);

      app.create(Widget.class, properties);

    } catch (Throwable t) {

      logger.log(Level.WARNING, t.toString());
View Full Code Here

TOP

Related Classes of org.structr.core.app.App

Copyright © 2018 www.massapicom. 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.