Project

General

Profile

Download (4.29 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2017 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
package eu.etaxonomy.cdm.mock;
10

    
11
import java.util.Collection;
12
import java.util.HashSet;
13
import java.util.Set;
14

    
15
import org.joda.time.DateTime;
16

    
17
import eu.etaxonomy.cdm.model.agent.Institution;
18
import eu.etaxonomy.cdm.model.common.CdmBase;
19
import eu.etaxonomy.cdm.model.common.User;
20
import eu.etaxonomy.cdm.model.name.TaxonName;
21
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
22

    
23
/**
24
 * @author a.kohlbecker
25
 * @since Mar 10, 2017
26
 *
27
 */
28
public class Registration extends CdmBase {
29

    
30
    private static final long serialVersionUID = -7214477130043178680L;
31

    
32
    private String identifier;
33

    
34
    private String specificIdentifier;   //id without http-domain
35

    
36
    private DateTime registrationDate;
37

    
38
    private RegistrationStatus status;
39

    
40
    private Institution institution;
41

    
42
    private TaxonName name;
43

    
44
    private Set<TypeDesignationBase> typeDesignations = new HashSet<>();
45

    
46
    private Set<Registration> blockedBy = new HashSet<>();
47

    
48
    private User submitter;
49

    
50
    static int idAutoincrement = 100000;
51

    
52

    
53
    /**
54
     * @param NAME
55
     */
56
    public Registration() {
57
        super();
58
        status = RegistrationStatus.values()[(int) (Math.random() * RegistrationStatus.values().length)];
59
        setId(idAutoincrement++);
60
        specificIdentifier = Integer.toString(getId());
61
        identifier = "http://pyhcobank.org/" + specificIdentifier;
62
        registrationDate = DateTime.now();
63
    }
64

    
65
    /**
66
     * @return the identifier
67
     */
68
    public String getIdentifier() {
69
        return identifier;
70
    }
71

    
72
    /**
73
     * @param identifier the identifier to set
74
     */
75
    public void setIdentifier(String identifier) {
76
        this.identifier = identifier;
77
    }
78

    
79
    /**
80
     * @return the specificIdentifier
81
     */
82
    public String getSpecificIdentifier() {
83
        return specificIdentifier;
84
    }
85

    
86
    /**
87
     * @param specificIdentifier the specificIdentifier to set
88
     */
89
    public void setSpecificIdentifier(String specificIdentifier) {
90
        this.specificIdentifier = specificIdentifier;
91
    }
92

    
93
    /**
94
     * @return the registrationDate
95
     */
96
    public org.joda.time.DateTime getRegistrationDate() {
97
        return registrationDate;
98
    }
99

    
100
    /**
101
     * @param registrationDate the registrationDate to set
102
     */
103
    public void setRegistrationDate(org.joda.time.DateTime registrationDate) {
104
        this.registrationDate = registrationDate;
105
    }
106

    
107
    /**
108
     * @return the status
109
     */
110
    public RegistrationStatus getStatus() {
111
        return status;
112
    }
113

    
114
    /**
115
     * @param status the status to set
116
     */
117
    public void setStatus(RegistrationStatus status) {
118
        this.status = status;
119
    }
120

    
121
    /**
122
     * @return the institution
123
     */
124
    public Institution getInstitution() {
125
        return institution;
126
    }
127

    
128
    /**
129
     * @param institution the institution to set
130
     */
131
    public void setInstitution(Institution institution) {
132
        this.institution = institution;
133
    }
134

    
135
    /**
136
     * @return the name
137
     */
138
    public TaxonName getName() {
139
        return name;
140
    }
141

    
142
    /**
143
     * @param name the name to set
144
     */
145
    public void setName(TaxonName name) {
146
        this.name = name;
147
    }
148

    
149
    /**
150
     * @return the submitter
151
     */
152
    public User getSubmitter() {
153
        return submitter;
154
    }
155

    
156
    /**
157
     * @param submitter the submitter to set
158
     */
159
    public void setSubmitter(User submitter) {
160
        this.submitter = submitter;
161
    }
162

    
163
    public boolean addTypeDesignation(TypeDesignationBase typeDesignation){
164
        return this.typeDesignations.add(typeDesignation);
165
    }
166

    
167
    public boolean addTypeDesignations(Collection<TypeDesignationBase> typeDesignations){
168
        return this.typeDesignations.addAll(typeDesignations);
169
    }
170

    
171
    public boolean addBlockedBy(Registration registration){
172
        return blockedBy.add(registration);
173
    }
174

    
175
    /**
176
     * @return the typeDesignations
177
     */
178
    public Set<TypeDesignationBase> getTypeDesignations() {
179
        return typeDesignations;
180
    }
181

    
182
    /**
183
     * @return the blockedBy
184
     */
185
    public Set<Registration> getBlockedBy() {
186
        return blockedBy;
187
    }
188

    
189

    
190

    
191

    
192

    
193

    
194
}
(1-1/3)