Project

General

Profile

Download (2.44 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9

    
10
package eu.etaxonomy.cdm.model.common;
11

    
12
import java.util.UUID;
13

    
14
import javax.persistence.Transient;
15
import javax.validation.GroupSequence;
16
import javax.validation.groups.Default;
17

    
18
import org.joda.time.DateTime;
19

    
20
import eu.etaxonomy.cdm.validation.Level2;
21
import eu.etaxonomy.cdm.validation.Level3;
22

    
23
@GroupSequence({Default.class, Level2.class, Level3.class})
24
public interface ICdmBase {
25

    
26
	/**
27
	 * Returns local unique identifier for the concrete subclass
28
	 * @return
29
	 */
30
	public int getId();
31

    
32
	/**
33
	 * Assigns a unique local ID to this object.
34
	 * Because of the EJB3 @Id and @GeneratedValue annotation this id will be
35
	 * set automatically by the persistence framework when object is saved.
36
	 * @param id
37
	 */
38
	public void setId(int id);
39

    
40
	public UUID getUuid();
41

    
42
	public void setUuid(UUID uuid);
43

    
44
	public DateTime getCreated();
45

    
46
	/**
47
	 * Sets the timestamp this object was created.
48
	 * Most databases cannot store milliseconds, so they are removed by this method.
49
	 * Caution: We are planning to replace the Calendar class with a different datetime representation which is more suitable for hibernate
50
	 * see {@link http://dev.e-taxonomy.eu/trac/ticket/247 TRAC ticket}
51
	 *
52
	 * @param created
53
	 */
54
	public void setCreated(DateTime created);
55

    
56
	/**
57
	 * @return The {@link User} who was authenticated when the entity was created.
58
	 * Can be <code>null</code> if the entity has been created without any user authentication present.
59
	 */
60
	public User getCreatedBy();
61

    
62
	public void setCreatedBy(User createdBy);
63

    
64
    /**
65
     * @param class1
66
     * @return
67
     */
68
    public boolean isInstanceOf(Class<? extends CdmBase> clazz);
69

    
70
    /**
71
     * Reports the persistend state of the cdm entity. If this method returns <code>true</code> it does not
72
     * necessarily mean that there is a database record already but
73
     * maybe the object was only saved to a persistence session, which still needs to be flushed to the storage engine.
74
     *
75
     * @return if and only if the instance has been saved to the persistent storage.
76
     * For new and un-persisted entities this method returns false.
77
     */
78
    @Transient
79
    public boolean isPersited();
80

    
81
}
(17-17/79)