Created
March 21, 2013 22:52
-
-
Save amorgner/5217550 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Services.command(SecurityContext.getSuperUserInstance(), TransactionCommand.class).execute(new StructrTransaction() { | |
@Override | |
public Object execute() throws FrameworkException { | |
for (Node node : IteratorUtil.asIterable(nodes)) { | |
final List<Relationship> references = ImmutableList.copyOf(node.getRelationships(Direction.INCOMING, new RelationshipType() { | |
@Override | |
public String name() { | |
return RELATIONSHIP_TYPE; | |
} | |
})); | |
for (int i = 1; i < references.size(); i++) { | |
final Relationship reference = references.get(i); | |
logger.log(Level.INFO, "Deleting reference {0} between {1} and {2}", new Object[] { reference.getId(), reference.getStartNode().getId(), | |
reference.getEndNode().getId() }); | |
reference.delete(); | |
} | |
} | |
return null; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment