105 lines
2.1 KiB
Java
105 lines
2.1 KiB
Java
/*********************************************************************************************************************************
|
|
* Autorskie Prawa Majątkowe - Moose Spółka z ograniczoną odpowiedzialnością
|
|
*
|
|
* Copyright 2017 Moose Spółka z ograniczoną odpowiedzialnością
|
|
********************************************************************************************************************************/
|
|
|
|
package eu.mooseinc.dell.form.model;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import java.io.Serializable;
|
|
import java.util.Date;
|
|
|
|
/**
|
|
* Registration form attachment
|
|
*/
|
|
public class Attachment implements Serializable {
|
|
/**
|
|
* File id.
|
|
*/
|
|
@JsonProperty(value = "id")
|
|
private final String id;
|
|
|
|
/**
|
|
* File name.
|
|
*/
|
|
@JsonProperty(value = "name")
|
|
private final String fileName;
|
|
|
|
/**
|
|
* File path.
|
|
*/
|
|
@JsonIgnore
|
|
private final String filePath;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param id file id.
|
|
* @param fileName file name.
|
|
* @param filePath file path.
|
|
*/
|
|
public Attachment(final String id, final String fileName, final String filePath) {
|
|
this.id = id;
|
|
this.fileName = fileName;
|
|
this.filePath = filePath;
|
|
}
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param fileName file name.
|
|
* @param filePath file path..
|
|
*/
|
|
public Attachment(final String fileName, final String filePath) {
|
|
this.id = String.valueOf(new Date().getTime());
|
|
this.fileName = fileName;
|
|
this.filePath = filePath;
|
|
}
|
|
|
|
/**
|
|
* Returns file id.
|
|
*
|
|
* @return file id.
|
|
*/
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* Returns file name.
|
|
*
|
|
* @return file name.
|
|
*/
|
|
public String getFileName() {
|
|
return fileName;
|
|
}
|
|
|
|
/**
|
|
* Returns file path.
|
|
*
|
|
* @return file path.
|
|
*/
|
|
public String getFilePath() {
|
|
return filePath;
|
|
}
|
|
|
|
@Override
|
|
public boolean equals(Object o) {
|
|
if (this == o)
|
|
return true;
|
|
if (o == null || getClass() != o.getClass())
|
|
return false;
|
|
|
|
Attachment attachment = (Attachment) o;
|
|
|
|
return id.equals(attachment.id);
|
|
}
|
|
|
|
@Override
|
|
public int hashCode() {
|
|
return id.hashCode();
|
|
}
|
|
}
|