Project

General

Profile

Revision 3c5c2395

ID3c5c239502ab8f64d51d29962d56b36c7e517b8a
Parent b1b42293
Child 481d494a

Added by Andreas Müller about 2 years ago

ref #7709 revert using uuid in CdmEntityCacheKey as

View differences:

cdmlib-cache/src/main/java/eu/etaxonomy/cdm/cache/CdmEntityCacheKey.java
1 1
package eu.etaxonomy.cdm.cache;
2 2

  
3
import java.util.UUID;
4

  
5 3
import eu.etaxonomy.cdm.model.common.CdmBase;
6 4

  
7 5
public class CdmEntityCacheKey<T extends CdmBase> {
8 6

  
9 7
	private Class<T> persistenceClass;
10
	private UUID persistenceId;
8
	private int persistenceId;
11 9

  
12 10

  
13 11
	public CdmEntityCacheKey(T cdmBase) {
14 12
		this.persistenceClass = (Class<T>)cdmBase.getClass();
15
		this.persistenceId = cdmBase.getUuid();
13
		this.persistenceId = cdmBase.getId();
16 14
	}
17 15

  
18 16
	/**
19 17
	 * @param clazz
20 18
	 * @param uuid
21 19
	 */
22
	public CdmEntityCacheKey(Class<T> clazz, UUID uuid) {
20
	public CdmEntityCacheKey(Class<T> clazz, int id) {
23 21
		this.persistenceClass = clazz;
24
		this.persistenceId = uuid;
22
		this.persistenceId = id;
25 23
		throw new NullPointerException("Uuid is null for CdmEntityCacheKey, null values are not allowed as they do not represent a valid entity");
26 24
	}
27 25

  
......
31 29
		return persistenceClass;
32 30
	}
33 31

  
34
	public UUID getPersistenceId() {
32
	public int getPersistenceId() {
35 33
		return persistenceId;
36 34
	}
37 35
	@Override
......
45 43
		}
46 44
		CdmEntityCacheKey<?> that = (CdmEntityCacheKey<?>) obj;
47 45
		if(this.persistenceClass.equals(that.persistenceClass)
48
		        && this.persistenceId.equals(that.persistenceId)) {
46
		        && this.persistenceId == that.persistenceId) {
49 47
			return true;
50 48
		}
51 49

  
......
54 52

  
55 53
	@Override
56 54
	public int hashCode() {
57
		return (this.persistenceClass.getName() + this.persistenceId.toString()).hashCode();
55
		return (this.persistenceClass.getName() + String.valueOf(this.persistenceId)).hashCode();
58 56
	}
59 57

  
60 58
	@Override
61 59
	public String toString() {
62
		return this.persistenceClass.getName() + this.persistenceId.toString();
60
		return this.persistenceClass.getName() + String.valueOf(this.persistenceId);
63 61
	}
64 62

  
65 63
}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)