package com.bocloud.ims.entity.resource;

import com.bocloud.common.utils.DateSerializer;
import com.bocloud.entity.annotations.Column;
import com.bocloud.entity.annotations.IgnoreAll;
import com.bocloud.entity.annotations.PK;
import com.bocloud.entity.annotations.Table;
import com.bocloud.entity.bean.GenericEntity;
import com.bocloud.entity.meta.PKStrategy;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * 对象存储元素实体类
 * 
 * @author hufy
 *
 */
@Table("object_storage_item")
public class ObjectStorageItem extends GenericEntity {

	@PK(value = PKStrategy.AUTO)
	private Long id ;
	@Column("size")
	private Long size;  // 大小
	@Column("is_directory")
	private Integer isDirectory;   // 0 不是目录  1 是目录
	@Column("content_type")
	private String contentType; //内容类型
	@Column("update_time")
	@JsonSerialize(using = DateSerializer.class)
	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	private Date updateTime; // 更新时间
	@Column("hash")
	private String hash; //hash值
	@Column("container_id")
	private Long containerId ; //容器的id
	@Column("upload_url")
	private String uploadUrl;  // 用户上传的路径

	@Column("directory_name")
	private String directoryName ;  // 所在目录名称

	@Column("container_name")
	private String containerName ;  // 容器名称

	@Column("vendor_id")
	private Long vendorId;

	@Column("orig_filename")
	private String origFilename ;

	@IgnoreAll
	private List<ObjectStorageItem> children;


	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Long getSize() {
		return size;
	}

	public void setSize(Long size) {
		this.size = size;
	}

	public Integer getIsDirectory() {
		return isDirectory;
	}

	public void setIsDirectory(Integer isDirectory) {
		this.isDirectory = isDirectory;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public String getHash() {
		return hash;
	}

	public void setHash(String hash) {
		this.hash = hash;
	}

	public Long getContainerId() {
		return containerId;
	}

	public void setContainerId(Long containerId) {
		this.containerId = containerId;
	}

	public String getUploadUrl() {
		return uploadUrl;
	}

	public void setUploadUrl(String uploadUrl) {
		this.uploadUrl = uploadUrl;
	}

	public String getDirectoryName() {
		return directoryName;
	}

	public void setDirectoryName(String directoryName) {
		this.directoryName = directoryName;
	}

	public String getContainerName() {
		return containerName;
	}

	public void setContainerName(String containerName) {
		this.containerName = containerName;
	}

	public Long getVendorId() {
		return vendorId;
	}

	public void setVendorId(Long vendorId) {
		this.vendorId = vendorId;
	}

	public List<ObjectStorageItem> getChildren() {
		return children;
	}

	public void setChildren(List<ObjectStorageItem> children) {
		this.children = children;
	}

	public String getOrigFilename() {
		return origFilename;
	}

	public void setOrigFilename(String origFilename) {
		this.origFilename = origFilename;
	}
}
