Project

General

Profile

Download (2.49 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.model.permission.User;
21
import eu.etaxonomy.cdm.validation.Level2;
22
import eu.etaxonomy.cdm.validation.Level3;
23

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

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

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

    
41
	public UUID getUuid();
42

    
43
	public void setUuid(UUID uuid);
44

    
45
	public DateTime getCreated();
46

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

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

    
63
	public void setCreatedBy(User createdBy);
64

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

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

    
82
}
(16-16/56)