Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

public class EntityRemover {
    private final GraphDatabase graphDatabase;
    public EntityRemover(EntityStateHandler entityStateHandlerTypeRepresentationStrategy<NodenodeTypeRepresentationStrategyTypeRepresentationStrategy<RelationshiprelationshipTypeRepresentationStrategyGraphDatabase graphDatabase) {
        this. = entityStateHandler;
        this. = nodeTypeRepresentationStrategy;
        this. = relationshipTypeRepresentationStrategy;
        this. = graphDatabase;
    public void removeNodeEntity(Object entity) {
        Node node = .getPersistentState(entityNode.class);
        if (node == nullreturn;
    private void removeNode(Node node) {
        for (Relationship relationship : node.getRelationships()) {
    public void removeRelationshipEntity(Object entity) {
        Relationship relationship = .getPersistentState(entityRelationship.class);
        if (relationship == nullreturn;
    private void removeRelationship(Relationship relationship) {
    public void removeRelationshipBetween(Object startObject targetString type) {
        final RelationshipResult result = .removeRelationshipTo(starttargettype);
        if (result!=null && result.type == ..) {
    public void remove(Object entity) {
        if (entity instanceof Node) {
        if (entity instanceof Relationship) {
        final Class<?> type = entity.getClass();
        if (.isNodeEntity(type)) {
        if (.isRelationshipEntity(type)) {
        throw new IllegalArgumentException("@NodeEntity or @RelationshipEntity annotation required on domain class"+type);
New to GrepCode? Check out our FAQ X