com.dp2345.entity.Shop.java Source code

Java tutorial

Introduction

Here is the source code for com.dp2345.entity.Shop.java

Source

/*
 * Copyright 2013-2015 cetvision.com. All rights reserved.
 * Support: http://www.cetvision.com
 * License: http://www.cetvision.com/license
 */
package com.dp2345.entity;

import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.PreRemove;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;
import org.hibernate.validator.constraints.Email;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

import com.dp2345.entity.ShopAttribute.Type;
import com.dp2345.util.JsonUtils;

/**
 * Entity - 
 * 
 * @author CETVISION CORP
 * @version 2.0.3
 */
@Entity
@Table(name = "xx_shop")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_shop_sequence")
public class Shop extends BaseEntity {

    /**
     * 
     */
    private static final long serialVersionUID = 5573899039363144864L;

    /** ??*/
    private String shopName;

    /** ?? ??*/
    private String shopAlias;

    /**   */
    public static final int ATTRIBUTE_VALUE_PROPERTY_COUNT = 10;

    /** ??? */
    public static final String ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX = "attributeValue";

    /**  */
    private Long point;

    /** ?? */
    private BigDecimal amount;

    /** ?? */
    private Boolean isEnabled;

    /** ?? */
    private Boolean isLocked;

    /** ? */
    private Date lockedDate;

    /**  */
    private Date birth;

    /** E-mail */
    private String email;

    /** ? */
    private String address;

    /**  */
    private String zipCode;

    /** ? */
    private String phone;

    /**  */
    private String mobile;

    /** 0 */
    private String attributeValue0;

    /** 1 */
    private String attributeValue1;

    /** 2 */
    private String attributeValue2;

    /** 3 */
    private String attributeValue3;

    /** 4 */
    private String attributeValue4;

    /** 5 */
    private String attributeValue5;

    /** 6 */
    private String attributeValue6;

    /** 7 */
    private String attributeValue7;

    /** 8 */
    private String attributeValue8;

    /** 9 */
    private String attributeValue9;

    /**  */
    private Area area;

    /**  */
    private ShopRank shopRank;

    /**  */
    private Member member;

    /** ? */
    private Set<Order> orders = new HashSet<Order>();

    /** ? */
    private Set<Payment> payments = new HashSet<Payment>();

    /**  */
    private Set<Review> reviews = new HashSet<Review>();

    /**  */
    private Set<Consultation> consultations = new HashSet<Consultation>();

    /** ? */
    private Set<Message> inMessages = new HashSet<Message>();

    /** ??? */
    private Set<Message> outMessages = new HashSet<Message>();

    // ?
    /** ? */
    private Set<Product> products = new HashSet<Product>();

    /**  **/
    private ShopCategory shopCategory;

    /** ? */
    private Set<ProductCategory> productCategories = new HashSet<ProductCategory>();

    /**  */
    private Set<Promotion> promotions = new HashSet<Promotion>();

    /**  */
    private Set<Article> articles = new HashSet<Article>();

    /** ???X */
    private String mapX;

    /** ??Y */
    private String mapY;

    /** URL */
    private String shopDomain;

    /**  logo */
    private String shopLogo;

    /** ? */
    private String shopImage;

    /**  */
    private String shopTemplate;

    /**  */
    private String shopTemplateImage;

    /** ? */
    private String shopDescript;

    /** ??*/
    private String productAmount;

    /**
     * ???
     * 
     * @return ??
     */
    @Length(max = 200)
    public String getShopName() {
        return shopName;
    }

    /**
     * ??
     * 
     * @param storeName
     *            ??
     */
    public void setShopName(String shopName) {
        this.shopName = shopName;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @NotEmpty(groups = Save.class)
    @Pattern(regexp = "^[0-9a-z_A-Z\\u4e00-\\u9fa5]+$")
    @Column(nullable = false, updatable = false, unique = true, length = 100)
    public String getShopAlias() {
        return shopAlias;
    }

    /**
     * ??
     * 
     * @param storeAlias
     *            ??
     */
    public void setShopAlias(String shopAlias) {
        this.shopAlias = shopAlias;
    }

    /**
     * ?E-mail
     * 
     * @return E-mail
     */
    @NotEmpty
    @Email
    @Length(max = 200)
    @Column(nullable = false)
    public String getEmail() {
        return email;
    }

    /**
     * E-mail
     * 
     * @param email
     *            E-mail
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * ?
     * 
     * @return 
     */
    @NotNull(groups = Save.class)
    @Min(0)
    @Column(nullable = false)
    public Long getPoint() {
        return point;
    }

    /**
     * 
     * 
     * @param point
     *            
     */
    public void setPoint(Long point) {
        this.point = point;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @Column(nullable = false, precision = 27, scale = 12)
    public BigDecimal getAmount() {
        return amount;
    }

    /**
     * ?
     * 
     * @param amount
     *            ?
     */
    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @NotNull
    @Column(nullable = false)
    public Boolean getIsEnabled() {
        return isEnabled;
    }

    /**
     * ??
     * 
     * @param isEnabled
     *            ??
     */
    public void setIsEnabled(Boolean isEnabled) {
        this.isEnabled = isEnabled;
    }

    /**
     * ???
     * 
     * @return ??
     */
    @Column(nullable = false)
    public Boolean getIsLocked() {
        return isLocked;
    }

    /**
     * ??
     * 
     * @param isLocked
     *            ??
     */
    public void setIsLocked(Boolean isLocked) {
        this.isLocked = isLocked;
    }

    /**
     * ??
     * 
     * @return ?
     */
    public Date getLockedDate() {
        return lockedDate;
    }

    /**
     * ?
     * 
     * @param lockedDate
     *            ?
     */
    public void setLockedDate(Date lockedDate) {
        this.lockedDate = lockedDate;
    }

    /**
     * ?
     * 
     * @return 
     */
    public Date getBirth() {
        return birth;
    }

    /**
     * 
     * 
     * @param birth
     *            
     */
    public void setBirth(Date birth) {
        this.birth = birth;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @Length(max = 200)
    public String getAddress() {
        return address;
    }

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

    /**
     * ?
     * 
     * @return 
     */
    @Length(max = 200)
    public String getZipCode() {
        return zipCode;
    }

    /**
     * 
     * 
     * @param zipCode
     *            
     */
    public void setZipCode(String zipCode) {
        this.zipCode = zipCode;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @Length(max = 200)
    public String getPhone() {
        return phone;
    }

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

    /**
     * ?
     * 
     * @return 
     */
    @Length(max = 200)
    public String getMobile() {
        return mobile;
    }

    /**
     * 
     * 
     * @param mobile
     *            
     */
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    /**
     * ?0
     * 
     * @return 0
     */
    @Length(max = 200)
    public String getAttributeValue0() {
        return attributeValue0;
    }

    /**
     * 0
     * 
     * @param attributeValue0
     *            0
     */
    public void setAttributeValue0(String attributeValue0) {
        this.attributeValue0 = attributeValue0;
    }

    /**
     * ?1
     * 
     * @return 1
     */
    @Length(max = 200)
    public String getAttributeValue1() {
        return attributeValue1;
    }

    /**
     * 1
     * 
     * @param attributeValue1
     *            1
     */
    public void setAttributeValue1(String attributeValue1) {
        this.attributeValue1 = attributeValue1;
    }

    /**
     * ?2
     * 
     * @return 2
     */
    @Length(max = 200)
    public String getAttributeValue2() {
        return attributeValue2;
    }

    /**
     * 2
     * 
     * @param attributeValue2
     *            2
     */
    public void setAttributeValue2(String attributeValue2) {
        this.attributeValue2 = attributeValue2;
    }

    /**
     * ?3
     * 
     * @return 3
     */
    @Length(max = 200)
    public String getAttributeValue3() {
        return attributeValue3;
    }

    /**
     * 3
     * 
     * @param attributeValue3
     *            3
     */
    public void setAttributeValue3(String attributeValue3) {
        this.attributeValue3 = attributeValue3;
    }

    /**
     * ?4
     * 
     * @return 4
     */
    @Length(max = 200)
    public String getAttributeValue4() {
        return attributeValue4;
    }

    /**
     * 4
     * 
     * @param attributeValue4
     *            4
     */
    public void setAttributeValue4(String attributeValue4) {
        this.attributeValue4 = attributeValue4;
    }

    /**
     * ?5
     * 
     * @return 5
     */
    @Length(max = 200)
    public String getAttributeValue5() {
        return attributeValue5;
    }

    /**
     * 5
     * 
     * @param attributeValue5
     *            5
     */
    public void setAttributeValue5(String attributeValue5) {
        this.attributeValue5 = attributeValue5;
    }

    /**
     * ?6
     * 
     * @return 6
     */
    @Length(max = 200)
    public String getAttributeValue6() {
        return attributeValue6;
    }

    /**
     * 6
     * 
     * @param attributeValue6
     *            6
     */
    public void setAttributeValue6(String attributeValue6) {
        this.attributeValue6 = attributeValue6;
    }

    /**
     * ?7
     * 
     * @return 7
     */
    @Length(max = 200)
    public String getAttributeValue7() {
        return attributeValue7;
    }

    /**
     * 7
     * 
     * @param attributeValue7
     *            7
     */
    public void setAttributeValue7(String attributeValue7) {
        this.attributeValue7 = attributeValue7;
    }

    /**
     * ?8
     * 
     * @return 8
     */
    @Length(max = 200)
    public String getAttributeValue8() {
        return attributeValue8;
    }

    /**
     * 8
     * 
     * @param attributeValue8
     *            8
     */
    public void setAttributeValue8(String attributeValue8) {
        this.attributeValue8 = attributeValue8;
    }

    /**
     * ?9
     * 
     * @return 9
     */
    @Length(max = 200)
    public String getAttributeValue9() {
        return attributeValue9;
    }

    /**
     * 9
     * 
     * @param attributeValue9
     *            9
     */
    public void setAttributeValue9(String attributeValue9) {
        this.attributeValue9 = attributeValue9;
    }

    /**
     * ?
     * 
     * @return 
     */
    @ManyToOne(fetch = FetchType.LAZY)
    public Area getArea() {
        return area;
    }

    /**
     * 
     * 
     * @param area
     *            
     */
    public void setArea(Area area) {
        this.area = area;
    }

    /**
     * ?
     * 
     * @return 
     */
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    public ShopRank getShopRank() {
        return shopRank;
    }

    /**
     * 
     * 
     * @param storeRank
     *            
     */
    public void setShopRank(ShopRank shopRank) {
        this.shopRank = shopRank;
    }

    /**
     * ?
     * ?
     * 
     * @return 
     */
    //@OneToOne(mappedBy = "store", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    public Member getMember() {
        return member;
    }

    /**
     * 
     * 
     * @param member
     *            
     */
    public void setMember(Member member) {
        this.member = member;
    }

    /**
     * ?
     * 
     * @return 
     */
    @NotNull
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(nullable = false)
    public ShopCategory getShopCategory() {
        return shopCategory;
    }

    /**
     * 
     * 
     * @param storeCategory
     *            
     */
    public void setShopCategory(ShopCategory shopCategory) {
        this.shopCategory = shopCategory;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Order> getOrders() {
        return orders;
    }

    /**
     * ?
     * 
     * @param orders
     *            ?
     */
    public void setOrders(Set<Order> orders) {
        this.orders = orders;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Payment> getPayments() {
        return payments;
    }

    /**
     * ?
     * 
     * @param payments
     *            ?
     */
    public void setPayments(Set<Payment> payments) {
        this.payments = payments;
    }

    /**
     * ?
     * 
     * @return 
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    @OrderBy("createDate desc")
    public Set<Review> getReviews() {
        return reviews;
    }

    /**
     * 
     * 
     * @param reviews
     *            
     */
    public void setReviews(Set<Review> reviews) {
        this.reviews = reviews;
    }

    /**
     * ?
     * 
     * @return 
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    @OrderBy("createDate desc")
    public Set<Consultation> getConsultations() {
        return consultations;
    }

    /**
     * 
     * 
     * @param consultations
     *            
     */
    public void setConsultations(Set<Consultation> consultations) {
        this.consultations = consultations;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "receiver", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Message> getInMessages() {
        return inMessages;
    }

    /**
     * ?
     * 
     * @param inMessages
     *            ?
     */
    public void setInMessages(Set<Message> inMessages) {
        this.inMessages = inMessages;
    }

    /**
     * ????
     * 
     * @return ???
     */
    @OneToMany(mappedBy = "sender", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
    public Set<Message> getOutMessages() {
        return outMessages;
    }

    /**
     * ???
     * 
     * @param outMessages
     *            ???
     */
    public void setOutMessages(Set<Message> outMessages) {
        this.outMessages = outMessages;
    }

    // 
    /**
     * ??
     * 
     * @return ?
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY)
    public Set<Product> getProducts() {
        return products;
    }

    /**
     * ?
     * 
     * @param products
     *            ?
     */
    public void setProducts(Set<Product> products) {
        this.products = products;
    }

    /**
     * ?
     * 
     * @return 
     */
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY)
    public Set<Article> getArticles() {
        return articles;
    }

    /**
     * 
     * 
     * @param articles
     *            
     */
    public void setArticles(Set<Article> articles) {
        this.articles = articles;
    }

    /**
     * ??
     * 
     * @return ?
     */
    //@ManyToMany(mappedBy = "stores", fetch = FetchType.LAZY)
    //@OrderBy("order asc")
    @OneToMany(mappedBy = "shop", fetch = FetchType.LAZY)
    public Set<ProductCategory> getProductCategories() {
        return productCategories;
    }

    /**
     * ?
     * 
     * @param productCategories
     *            ?
     */
    public void setProductCategories(Set<ProductCategory> productCategories) {
        this.productCategories = productCategories;
    }

    /**
     * ?
     * 
     * @return 
     */
    @ManyToMany(mappedBy = "shops", fetch = FetchType.LAZY)
    public Set<Promotion> getPromotions() {
        return promotions;
    }

    /**
     * 
     * 
     * @param promotions
     *            
     */
    public void setPromotions(Set<Promotion> promotions) {
        this.promotions = promotions;
    }

    /**
     * ??
     * 
     * @return ?
     */
    public String getMapX() {
        return mapX;
    }

    /**
     * ?
     * 
     * @param promotions
     *            ?
     */
    public void setMapX(String mapX) {
        this.mapX = mapX;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getMapY() {
        return mapY;
    }

    /**
     * 
     * 
     * @param mapY
     *            
     */
    public void setMapY(String mapY) {
        this.mapY = mapY;
    }

    /**
     * ???
     * 
     * @return ??
     */
    public String getShopDomain() {
        return shopDomain;
    }

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

    /**
     * ?logo
     * 
     * @return logo
     */
    public String getShopLogo() {
        return shopLogo;
    }

    /**
     * logo
     * 
     * @param shopLogo
     *            logo
     */
    public void setShopLogo(String shopLogo) {
        this.shopLogo = shopLogo;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getShopImage() {
        return shopImage;
    }

    /**
     * 
     * 
     * @param shopImage
     *            
     */
    public void setShopImage(String shopImage) {
        this.shopImage = shopImage;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getShopTemplate() {
        return shopTemplate;
    }

    /**
     * 
     * 
     * @param shopTemplate
     *            
     */
    public void setShopTemplate(String shopTemplate) {
        this.shopTemplate = shopTemplate;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getShopTemplateImage() {
        return shopTemplateImage;
    }

    /**
     * 
     * 
     * @param shopTemplateImage
     *            
     */
    public void setShopTemplateImage(String shopTemplateImage) {
        this.shopTemplateImage = shopTemplateImage;
    }

    /**
     * ??
     * 
     * @return ?
     */
    public String getShopDescript() {
        return shopDescript;
    }

    /**
     * ?
     * 
     * @param storeDescript
     *            ?
     */
    public void setShopDescript(String shopDescript) {
        this.shopDescript = shopDescript;
    }

    public String getProductAmount() {
        return productAmount;
    }

    /**
     * ?
     * 
     * @param promotions
     *            ?
     */
    public void setProductAmount(String productAmount) {
        this.productAmount = productAmount;
    }

    /**
     * ?
     * 
     * @param storeAttribute
     *            
     * @return 
     */
    @Transient
    public Object getAttributeValue(ShopAttribute storeAttribute) {
        if (storeAttribute != null) {
            if (storeAttribute.getType() == Type.name) {
                return getShopName();
            } else if (storeAttribute.getType() == Type.area) {
                return getArea();
            } else if (storeAttribute.getType() == Type.address) {
                return getAddress();
            } else if (storeAttribute.getType() == Type.zipCode) {
                return getZipCode();
            } else if (storeAttribute.getType() == Type.phone) {
                return getPhone();
            } else if (storeAttribute.getType() == Type.mobile) {
                return getMobile();
            } else if (storeAttribute.getType() == Type.checkbox) {
                if (storeAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + storeAttribute.getPropertyIndex();
                        String propertyValue = (String) PropertyUtils.getProperty(this, propertyName);
                        if (propertyValue != null) {
                            return JsonUtils.toObject(propertyValue, List.class);
                        }
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            } else {
                if (storeAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + storeAttribute.getPropertyIndex();
                        return (String) PropertyUtils.getProperty(this, propertyName);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        return null;
    }

    /**
     * 
     * 
     * @param storeAttribute
     *            
     * @param attributeValue
     *            
     */
    @Transient
    public void setAttributeValue(ShopAttribute storeAttribute, Object attributeValue) {
        if (storeAttribute != null) {
            if (attributeValue instanceof String && StringUtils.isEmpty((String) attributeValue)) {
                attributeValue = null;
            }
            if (storeAttribute.getType() == Type.name
                    && (attributeValue instanceof String || attributeValue == null)) {
                setShopName((String) attributeValue);
            } else if (storeAttribute.getType() == Type.birth
                    && (attributeValue instanceof Date || attributeValue == null)) {
                setBirth((Date) attributeValue);
            } else if (storeAttribute.getType() == Type.area
                    && (attributeValue instanceof Area || attributeValue == null)) {
                setArea((Area) attributeValue);
            } else if (storeAttribute.getType() == Type.address
                    && (attributeValue instanceof String || attributeValue == null)) {
                setAddress((String) attributeValue);
            } else if (storeAttribute.getType() == Type.zipCode
                    && (attributeValue instanceof String || attributeValue == null)) {
                setZipCode((String) attributeValue);
            } else if (storeAttribute.getType() == Type.phone
                    && (attributeValue instanceof String || attributeValue == null)) {
                setPhone((String) attributeValue);
            } else if (storeAttribute.getType() == Type.mobile
                    && (attributeValue instanceof String || attributeValue == null)) {
                setMobile((String) attributeValue);
            } else if (storeAttribute.getType() == Type.checkbox
                    && (attributeValue instanceof List || attributeValue == null)) {
                if (storeAttribute.getPropertyIndex() != null) {
                    if (attributeValue == null || (storeAttribute.getOptions() != null
                            && storeAttribute.getOptions().containsAll((List<?>) attributeValue))) {
                        try {
                            String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                    + storeAttribute.getPropertyIndex();
                            PropertyUtils.setProperty(this, propertyName, JsonUtils.toJson(attributeValue));
                        } catch (IllegalAccessException e) {
                            e.printStackTrace();
                        } catch (InvocationTargetException e) {
                            e.printStackTrace();
                        } catch (NoSuchMethodException e) {
                            e.printStackTrace();
                        }
                    }
                }
            } else {
                if (storeAttribute.getPropertyIndex() != null) {
                    try {
                        String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX
                                + storeAttribute.getPropertyIndex();
                        PropertyUtils.setProperty(this, propertyName, attributeValue);
                    } catch (IllegalAccessException e) {
                        e.printStackTrace();
                    } catch (InvocationTargetException e) {
                        e.printStackTrace();
                    } catch (NoSuchMethodException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }

    /**
     * 
     */
    @Transient
    public void removeAttributeValue() {
        setBirth(null);
        setArea(null);
        setAddress(null);
        setZipCode(null);
        setPhone(null);
        setMobile(null);
        for (int i = 0; i < ATTRIBUTE_VALUE_PROPERTY_COUNT; i++) {
            String propertyName = ATTRIBUTE_VALUE_PROPERTY_NAME_PREFIX + i;
            try {
                PropertyUtils.setProperty(this, propertyName, null);
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            }
        }
    }

    /**
     * ??
     */
    @PreRemove
    public void preRemove() {
        Set<Product> products = getProducts();
        if (products != null) {
            for (Product product : products) {
                product.setShop(null);
            }
        }
        /**
        // ??
        Set<ProductCategory> productCategories = getProductCategories();
        if (productCategories != null) {
           for (ProductCategory productCategory : productCategories) {
        productCategory.getMembers().remove(this);
           }
        }
        // ??
        Set<Promotion> promotions = getPromotions();
        if (promotions != null) {
           for (Promotion promotion : promotions) {
        promotion.getMembers().remove(this);
           }
        }
        **/
    }
}