com.dp2345.entity.ProductImage.java Source code

Java tutorial

Introduction

Here is the source code for com.dp2345.entity.ProductImage.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.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Transient;
import javax.validation.constraints.Min;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.CompareToBuilder;
import org.hibernate.validator.constraints.Length;
import org.springframework.web.multipart.MultipartFile;

/**
 * Entity - ?
 * 
 * @author CETVISION CORP
 * @version 2.0.3
 */
@Embeddable
public class ProductImage implements Serializable, Comparable<ProductImage> {

    private static final long serialVersionUID = -673883300094536107L;

    /**  */
    private String title;

    /**  */
    private String source;

    /**  */
    private String large;

    /**  */
    private String medium;

    /**  */
    private String thumbnail;

    /** ? */
    private Integer order;

    /**  */
    private MultipartFile file;

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

    /**
     * 
     * 
     * @param title
     *            
     */
    public void setTitle(String title) {
        this.title = title;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getSource() {
        return source;
    }

    /**
     * 
     * 
     * @param source
     *            
     */
    public void setSource(String source) {
        this.source = source;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getLarge() {
        return large;
    }

    /**
     * 
     * 
     * @param large
     *            
     */
    public void setLarge(String large) {
        this.large = large;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getMedium() {
        return medium;
    }

    /**
     * 
     * 
     * @param medium
     *            
     */
    public void setMedium(String medium) {
        this.medium = medium;
    }

    /**
     * ?
     * 
     * @return 
     */
    public String getThumbnail() {
        return thumbnail;
    }

    /**
     * 
     * 
     * @param thumbnail
     *            
     */
    public void setThumbnail(String thumbnail) {
        this.thumbnail = thumbnail;
    }

    /**
     * ??
     * 
     * @return ?
     */
    @Min(0)
    @Column(name = "orders")
    public Integer getOrder() {
        return order;
    }

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

    /**
     * ?
     * 
     * @return 
     */
    @Transient
    public MultipartFile getFile() {
        return file;
    }

    /**
     * 
     * 
     * @param file
     *            
     */
    public void setFile(MultipartFile file) {
        this.file = file;
    }

    /**
     * ?
     * 
     * @return ?
     */
    @Transient
    public boolean isEmpty() {
        return (getFile() == null || getFile().isEmpty())
                && (StringUtils.isEmpty(getSource()) || StringUtils.isEmpty(getLarge())
                        || StringUtils.isEmpty(getMedium()) || StringUtils.isEmpty(getThumbnail()));
    }

    /**
     * compareTo
     * 
     * @param productImage
     *            ?
     * @return 
     */
    public int compareTo(ProductImage productImage) {
        return new CompareToBuilder().append(getOrder(), productImage.getOrder()).toComparison();
    }

}