org.broadleafcommerce.core.catalog.domain.CrossSaleProductImpl Maven / Gradle / Ivy
/*
* Copyright 2008-2012 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
*
* 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.broadleafcommerce.core.catalog.domain;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Index;
import org.hibernate.annotations.Parameter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name="BLC_PRODUCT_CROSS_SALE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE, region="blStandardElements")
public class CrossSaleProductImpl implements RelatedProduct {
protected static final long serialVersionUID = 1L;
@Id
@GeneratedValue(generator= "CrossSaleProductId")
@GenericGenerator(
name="CrossSaleProductId",
strategy="org.broadleafcommerce.common.persistence.IdOverrideTableGenerator",
parameters = {
@Parameter(name="table_name", value="SEQUENCE_GENERATOR"),
@Parameter(name="segment_column_name", value="ID_NAME"),
@Parameter(name="value_column_name", value="ID_VAL"),
@Parameter(name="segment_value", value="CrossSaleProductImpl"),
@Parameter(name="increment_size", value="50"),
@Parameter(name="entity_name", value="org.broadleafcommerce.core.catalog.domain.CrossSaleProductImpl")
}
)
@Column(name = "CROSS_SALE_PRODUCT_ID")
protected Long id;
@Column(name = "PROMOTION_MESSAGE")
@AdminPresentation(friendlyName = "CrossSaleProductImpl_Cross_Sale_Promotion_Message", largeEntry=true)
protected String promotionMessage;
@Column(name = "SEQUENCE")
protected Long sequence;
@ManyToOne(targetEntity = ProductImpl.class)
@JoinColumn(name = "PRODUCT_ID")
@Index(name="CROSSSALE_INDEX", columnNames={"PRODUCT_ID"})
protected Product product;
@ManyToOne(targetEntity = CategoryImpl.class)
@JoinColumn(name = "CATEGORY_ID")
@Index(name="CROSSSALE_CATEGORY_INDEX", columnNames={"CATEGORY_ID"})
protected Category category;
@ManyToOne(targetEntity = ProductImpl.class, optional=false)
@JoinColumn(name = "RELATED_SALE_PRODUCT_ID", referencedColumnName = "PRODUCT_ID")
@Index(name="CROSSSALE_RELATED_INDEX", columnNames={"RELATED_SALE_PRODUCT_ID"})
protected Product relatedSaleProduct = new ProductImpl();
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getPromotionMessage() {
return promotionMessage;
}
public void setPromotionMessage(String promotionMessage) {
this.promotionMessage = promotionMessage;
}
public Long getSequence() {
return sequence;
}
public void setSequence(Long sequence) {
this.sequence = sequence;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
public Product getRelatedProduct() {
return relatedSaleProduct;
}
public void setRelatedProduct(Product relatedSaleProduct) {
this.relatedSaleProduct = relatedSaleProduct;
}
}