Package org.structr.core.graph

Examples of org.structr.core.graph.CreateRelationshipCommand


  private void fixLostComponents() throws FrameworkException {
   
    Page hiddenDoc                            = getOrCreateHiddenDocument();
    SecurityContext securityContext           = SecurityContext.getSuperUserInstance();
    Result<DOMNode> result                    = StructrApp.getInstance(securityContext).nodeQuery(DOMNode.class).getResult();
    final CreateRelationshipCommand createRel = StructrApp.getInstance(securityContext).command(CreateRelationshipCommand.class);
   
    for (DOMNode node : result.getResults()) {
     
      if (node.hasChildNodes()
        && (node.hasIncomingRelationships(Sync.class) || node.hasRelationship(Sync.class))
        && (!hiddenDoc.equals(node.getOwnerDocument()))
        ) {
       
        try {
       
          DOMNode clonedNode = (DOMNode) node.cloneNode(false);

          moveChildNodes(node, clonedNode);
          clonedNode.setProperty(DOMNode.ownerDocument, hiddenDoc);

          createRel.execute((DOMNode) node, clonedNode, Sync.class);
          createRel.execute(clonedNode, (DOMNode) node, Sync.class);
         
        } catch (Exception ex) {
         
          logger.log(Level.SEVERE, "Could not fix component " + node, ex);
         
View Full Code Here

TOP

Related Classes of org.structr.core.graph.CreateRelationshipCommand

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.