package org.javers.core;

import org.javers.core.diff.DiffFactory;
import org.javers.model.domain.Diff;
import org.javers.model.mapping.EntityManager;
import org.javers.model.mapping.ManagedClass;
import org.javers.model.object.graph.ObjectGraphBuilder;

/**
 * Facade to JaVers instance.
 * Should be constructed by {@link JaversBuilder} provided with your domain model metadata and configuration.
 * <br/>
 *
 * Domain TODO: move to doc
 * <ul>
 *   <li>Entity - a class in client's domain model. List of those classes should be provided to JaversBuilder</li>
 *   <li>CDO - client's domain object, instance of an Entity</li>
 * </ul>
 *
 * @author bartosz walacik
 */
public class Javers {

    private EntityManager entityManager;

    private DiffFactory diffFactory;

    private ObjectGraphBuilder objectGraphBuilder;

    /**
     * JaVers instance should be constructed by {@link JaversBuilder}
     */
    public Javers(EntityManager entityManager, DiffFactory diffFactory, ObjectGraphBuilder objectGraphBuilder) {
        this.entityManager = entityManager;
        this.diffFactory = diffFactory;
        this.objectGraphBuilder = objectGraphBuilder;
    }

    public ManagedClass getByClass(Class<?> forClass) {
        return entityManager.getByClass(forClass);
    }

    public boolean isManaged(Class<?> forClass) {
        return entityManager.isManaged(forClass);
    }

    public Diff compare(String user, Object left, Object right) {
        return diffFactory.create(user, objectGraphBuilder.buildGraph(left), objectGraphBuilder.buildGraph(right));
    }
}

@@ -1446,24 +1446,181 @@
 ct right) %7B%0A
+        ObjectGraphBuilder leftGraph = new ObjectGraphBuilder(entityManager);%0A        ObjectGraphBuilder rightGraph = new ObjectGraphBuilder(entityManager);%0A
         retu
@@ -1647,34 +1647,25 @@
 e(user, 
-objec
+lef
 tGraph
-Builder
 .buildGr
@@ -1675,34 +1675,26 @@
 (left), 
-objec
+righ
 tGraph
-Builder
 .buildGr

fix for javers build