net.groupbuy.entity.Attribute.java Source code

Java tutorial

Introduction

Here is the source code for net.groupbuy.entity.Attribute.java

Source

/*
 * Copyright 2005-2013 shopxx.net. All rights reserved.
 * Support: http://www.shopxx.net
 * License: http://www.shopxx.net/license
 */
package net.groupbuy.entity;

import java.util.ArrayList;
import java.util.List;

import javax.persistence.CollectionTable;
import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Entity - 
 * 
 * @author SHOP++ Team
 * @version 3.0
 */
@Entity
@Table(name = "xx_attribute")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_attribute_sequence")
public class Attribute extends OrderEntity {

    private static final long serialVersionUID = 2447794131117928367L;

    /** ?? */
    private String name;

    /** ?? */
    private Integer propertyIndex;

    /**  */
    private ProductCategory productCategory;

    /** ? */
    private List<String> options = new ArrayList<String>();

    /**
     * ???
     * 
     * @return ??
     */
    @JsonProperty
    @NotEmpty
    @Length(max = 200)
    @Column(nullable = false)
    public String getName() {
        return name;
    }

    /**
     * ??
     * 
     * @param name
     *            ??
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @Column(nullable = false, updatable = false)
    public Integer getPropertyIndex() {
        return propertyIndex;
    }

    /**
     * ??
     * 
     * @param propertyIndex
     *            ??
     */
    public void setPropertyIndex(Integer propertyIndex) {
        this.propertyIndex = propertyIndex;
    }

    /**
     * ?
     * 
     * @return 
     */
    @NotNull(groups = Save.class)
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false, updatable = false)
    public ProductCategory getProductCategory() {
        return productCategory;
    }

    /**
     * 
     * 
     * @param productCategory
     *            
     */
    public void setProductCategory(ProductCategory productCategory) {
        this.productCategory = productCategory;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @JsonProperty
    @NotEmpty
    @ElementCollection
    @CollectionTable(name = "xx_attribute_option")
    public List<String> getOptions() {
        return options;
    }

    /**
     * ?
     * 
     * @param options
     *            ?
     */
    public void setOptions(List<String> options) {
        this.options = options;
    }

}