summaryrefslogtreecommitdiffstats
path: root/dozentenmodulserver/src/main/java/org/openslx/bwlp/sat/database/models/LocalImageVersion.java
blob: 1810f95ad0f859c013068dc0931a98fccf64180c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package org.openslx.bwlp.sat.database.models;

import org.openslx.bwlp.sat.database.mappers.DbImage.DeleteState;

public class LocalImageVersion {

	public final String imageVersionId;

	public final String imageBaseId;

	public final String filePath;

	public final long fileSize;

	public final boolean isValid;

	public final String uploaderId;

	public final long createTime;

	public final long expireTime;

	public final DeleteState deleteState;

	public LocalImageVersion(String imageVersionId, String imageBaseId, String filePath, long fileSize,
			String uploaderId, long createTime, long expireTime, boolean isValid, String deleteState) {
		this.imageVersionId = imageVersionId;
		this.imageBaseId = imageBaseId;
		this.filePath = filePath;
		this.fileSize = fileSize;
		this.uploaderId = uploaderId;
		this.createTime = createTime;
		this.expireTime = expireTime;
		this.isValid = isValid;
		DeleteState ds;
		try {
			ds = DeleteState.valueOf(deleteState);
		} catch (Exception e) {
			ds = DeleteState.KEEP;
		}
		this.deleteState = ds;
	}

	@Override
	public boolean equals(Object that) {
		return this.imageVersionId != null && that != null && (that instanceof LocalImageVersion)
				&& this.imageVersionId.equals(((LocalImageVersion) that).imageVersionId);
	}

	@Override
	public int hashCode() {
		return imageVersionId == null ? 0 : imageVersionId.hashCode() ^ 12345;
	}

	@Override
	public String toString() {
		return "[" + imageVersionId + ": Base=" + imageBaseId + ", filePath=" + filePath + ", fileSize="
				+ fileSize + ", isValid=" + isValid + ", createTime=" + createTime + ", expireTime="
				+ expireTime + ", deleteState=" + deleteState + "]";
	}

}