// Path: common/src/main/java/org/artificer/common/audit/AuditItemTypes.java
// public final class AuditItemTypes {
// 
//     public static final String PROPERTY_ADDED    = "property:added";
//     public static final String PROPERTY_CHANGED  = "property:changed";
//     public static final String PROPERTY_REMOVED  = "property:removed";
//     public static final String CLASSIFIERS_ADDED    = "classifier:added";
//     public static final String CLASSIFIERS_REMOVED  = "classifier:removed";
// 
// }
// 
// Path: repository/src/main/java/org/artificer/repository/audit/ArtifactDiff.java
// public class ArtifactDiff {
// 
//     private Map<String, String> addedProperties = new HashMap<String, String>();
//     private Map<String, String> updatedProperties = new HashMap<String, String>();
//     private Set<String> deletedProperties = new HashSet<String>();
//     private Set<String> addedClassifiers = new HashSet<String>();
//     private Set<String> deletedClassifiers = new HashSet<String>();
// 
//     /**
//      * Constructor.
//      */
//     public ArtifactDiff() {
//     }
// 
//     /**
//      * @return the addedProperties
//      */
//     public Map<String, String> getAddedProperties() {
//         return addedProperties;
//     }
// 
//     /**
//      * @return the updatedProperties
//      */
//     public Map<String, String> getUpdatedProperties() {
//         return updatedProperties;
//     }
// 
//     /**
//      * @return the deletedProperties
//      */
//     public Set<String> getDeletedProperties() {
//         return deletedProperties;
//     }
// 
//     /**
//      * @return the addedClassifiers
//      */
//     public Set<String> getAddedClassifiers() {
//         return addedClassifiers;
//     }
// 
//     /**
//      * @return the deletedClassifiers
//      */
//     public Set<String> getDeletedClassifiers() {
//         return deletedClassifiers;
//     }
// 
//     /**
//      * @param addedProperties the addedProperties to set
//      */
//     public void setAddedProperties(Map<String, String> addedProperties) {
//         this.addedProperties = addedProperties;
//     }
// 
//     /**
//      * @param updatedProperties the updatedProperties to set
//      */
//     public void setUpdatedProperties(Map<String, String> updatedProperties) {
//         this.updatedProperties = updatedProperties;
//     }
// 
//     /**
//      * @param deletedProperties the deletedProperties to set
//      */
//     public void setDeletedProperties(Set<String> deletedProperties) {
//         this.deletedProperties = deletedProperties;
//     }
// 
//     /**
//      * @param addedClassifiers the addedClassifiers to set
//      */
//     public void setAddedClassifiers(Set<String> addedClassifiers) {
//         this.addedClassifiers = addedClassifiers;
//     }
// 
//     /**
//      * @param deletedClassifiers the deletedClassifiers to set
//      */
//     public void setDeletedClassifiers(Set<String> deletedClassifiers) {
//         this.deletedClassifiers = deletedClassifiers;
//     }
// 
// }


import org.artificer.common.audit.AuditEntryTypes;
import org.artificer.common.audit.AuditItemTypes;
import org.artificer.repository.audit.ArtifactDiff;
import org.artificer.repository.hibernate.HibernateEntityFactory;
import org.artificer.repository.hibernate.entity.ArtificerArtifact;
import org.jboss.downloads.artificer._2013.auditing.AuditEntry;
import org.jboss.downloads.artificer._2013.auditing.AuditItemType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/*
 * Copyright 2014 JBoss Inc
 *
 * 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
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */
package org.artificer.repository.hibernate.audit;



/**
 * A class that is able to compare an artifact and output
 * the differences in properties, relationships, and classifiers.  This class
 * is used by the auditing code to record changes made to a node.
 *
 * @author Brett Meyer.
 */
public class HibernateAuditor {

    private final Map<String, String> oldProperties = new HashMap<>();
    private final List<String> oldClassifiers = new ArrayList<>();

    /**
     * Constructor.  Creates an initial snapshot of information found in the
     * included artifact.  The information will be used for a later comparison.
     */
    public HibernateAuditor(ArtificerArtifact oldArtifact) {
		// Note: Do not directly use the ArtificerArtifact collections, as they are going to change before #diff is called!
		oldProperties.putAll(oldArtifact.snapshotProperties());
        oldClassifiers.addAll(oldArtifact.getClassifiers());
    }

    /**
     * Called to compare the initial snapshot information with the current state
     * of the artifact node.
     *
     * @param newArtifact
     */
    public ArtificerAuditEntry diff(ArtificerArtifact newArtifact) {
// Path: common/src/main/java/org/artificer/common/audit/AuditItemTypes.java
// public final class AuditItemTypes {
// 
//     public static final String PROPERTY_ADDED    = "property:added";
//     public static final String PROPERTY_CHANGED  = "property:changed";
//     public static final String PROPERTY_REMOVED  = "property:removed";
//     public static final String CLASSIFIERS_ADDED    = "classifier:added";
//     public static final String CLASSIFIERS_REMOVED  = "classifier:removed";
// 
// }
// 
// Path: repository/src/main/java/org/artificer/repository/audit/ArtifactDiff.java
// public class ArtifactDiff {
// 
//     private Map<String, String> addedProperties = new HashMap<String, String>();
//     private Map<String, String> updatedProperties = new HashMap<String, String>();
//     private Set<String> deletedProperties = new HashSet<String>();
//     private Set<String> addedClassifiers = new HashSet<String>();
//     private Set<String> deletedClassifiers = new HashSet<String>();
// 
//     /**
//      * Constructor.
//      */
//     public ArtifactDiff() {
//     }
// 
//     /**
//      * @return the addedProperties
//      */
//     public Map<String, String> getAddedProperties() {
//         return addedProperties;
//     }
// 
//     /**
//      * @return the updatedProperties
//      */
//     public Map<String, String> getUpdatedProperties() {
//         return updatedProperties;
//     }
// 
//     /**
//      * @return the deletedProperties
//      */
//     public Set<String> getDeletedProperties() {
//         return deletedProperties;
//     }
// 
//     /**
//      * @return the addedClassifiers
//      */
//     public Set<String> getAddedClassifiers() {
//         return addedClassifiers;
//     }
// 
//     /**
//      * @return the deletedClassifiers
//      */
//     public Set<String> getDeletedClassifiers() {
//         return deletedClassifiers;
//     }
// 
//     /**
//      * @param addedProperties the addedProperties to set
//      */
//     public void setAddedProperties(Map<String, String> addedProperties) {
//         this.addedProperties = addedProperties;
//     }
// 
//     /**
//      * @param updatedProperties the updatedProperties to set
//      */
//     public void setUpdatedProperties(Map<String, String> updatedProperties) {
//         this.updatedProperties = updatedProperties;
//     }
// 
//     /**
//      * @param deletedProperties the deletedProperties to set
//      */
//     public void setDeletedProperties(Set<String> deletedProperties) {
//         this.deletedProperties = deletedProperties;
//     }
// 
//     /**
//      * @param addedClassifiers the addedClassifiers to set
//      */
//     public void setAddedClassifiers(Set<String> addedClassifiers) {
//         this.addedClassifiers = addedClassifiers;
//     }
// 
//     /**
//      * @param deletedClassifiers the deletedClassifiers to set
//      */
//     public void setDeletedClassifiers(Set<String> deletedClassifiers) {
//         this.deletedClassifiers = deletedClassifiers;
//     }
// 
// }


// Path: repository/hibernate/src/main/java/org/artificer/repository/hibernate/audit/HibernateAuditor.java
import org.artificer.common.audit.AuditEntryTypes;
import org.artificer.common.audit.AuditItemTypes;
import org.artificer.repository.audit.ArtifactDiff;
import org.artificer.repository.hibernate.HibernateEntityFactory;
import org.artificer.repository.hibernate.entity.ArtificerArtifact;
import org.jboss.downloads.artificer._2013.auditing.AuditEntry;
import org.jboss.downloads.artificer._2013.auditing.AuditItemType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/*
 * Copyright 2014 JBoss Inc
 *
 * 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
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * 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.
 */
package org.artificer.repository.hibernate.audit;



/**
 * A class that is able to compare an artifact and output
 * the differences in properties, relationships, and classifiers.  This class
 * is used by the auditing code to record changes made to a node.
 *
 * @author Brett Meyer.
 */
public class HibernateAuditor {

    private final Map<String, String> oldProperties = new HashMap<>();
    private final List<String> oldClassifiers = new ArrayList<>();

    /**
     * Constructor.  Creates an initial snapshot of information found in the
     * included artifact.  The information will be used for a later comparison.
     */
    public HibernateAuditor(ArtificerArtifact oldArtifact) {
		// Note: Do not directly use the ArtificerArtifact collections, as they are going to change before #diff is called!
		oldProperties.putAll(oldArtifact.snapshotProperties());
        oldClassifiers.addAll(oldArtifact.getClassifiers());
    }

    /**
     * Called to compare the initial snapshot information with the current state
     * of the artifact node.
     *
     * @param newArtifact
     */
    public ArtificerAuditEntry diff(ArtificerArtifact newArtifact) {
        ArtifactDiff diff = new ArtifactDiff();