/*
 * #%L
 * BroadleafCommerce Common Libraries
 * %%
 * Copyright (C) 2009 - 2014 Broadleaf Commerce
 * %%
 * 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.
 * #L%
 */
package org.broadleafcommerce.common.site.domain;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * @author Jeff Fischer
 */
@Embeddable
public class SiteCatalogXrefPK implements Serializable {

    private static final long serialVersionUID = 1L;

    @ManyToOne(targetEntity = SiteImpl.class, optional = false)
    @JoinColumn(name = "SITE_ID")
    protected Site site = new SiteImpl();

    @ManyToOne(targetEntity = CatalogImpl.class, optional = false)
    @JoinColumn(name = "CATALOG_ID")
    protected Catalog catalog = new CatalogImpl();

    public Site getSite() {
        return site;
    }

    public void setSite(Site site) {
        this.site = site;
    }

    public Catalog getCatalog() {
        return catalog;
    }

    public void setCatalog(Catalog catalog) {
        this.catalog = catalog;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (SiteCatalogXrefPK.class.isAssignableFrom(obj.getClass())) {
            SiteCatalogXrefPK that = (SiteCatalogXrefPK) obj;
            return new EqualsBuilder()
                    .append(catalog, that.catalog)
                    .append(site, that.site)
                    .build();
        }
        return false;
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder()
            .append(catalog)
            .append(site)
            .build();
    }

}

@@ -726,121 +726,8 @@
 n;%0A%0A
-import org.apache.commons.lang3.builder.EqualsBuilder;%0Aimport org.apache.commons.lang3.builder.HashCodeBuilder;%0A%0A
 impo
@@ -1596,624 +1596,6 @@
  %7D%0A%0A
-    @Override%0A    public boolean equals(Object obj) %7B%0A        if (obj == null) %7B%0A            return false;%0A        %7D%0A        if (SiteCatalogXrefPK.class.isAssignableFrom(obj.getClass())) %7B%0A            SiteCatalogXrefPK that = (SiteCatalogXrefPK) obj;%0A            return new EqualsBuilder()%0A                    .append(catalog, that.catalog)%0A                    .append(site, that.site)%0A                    .build();%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public int hashCode() %7B%0A        return new HashCodeBuilder()%0A            .append(catalog)%0A            .append(site)%0A            .build();%0A    %7D%0A%0A
 %7D%0A

Fix an ehcache ConcurrentModificationException during write to overflow disk cache