Project

General

Profile

Download (6.7 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.api.service;
10

    
11
import java.io.IOException;
12
import java.util.Collection;
13
import java.util.List;
14
import java.util.Map;
15
import java.util.Optional;
16
import java.util.UUID;
17

    
18
import eu.etaxonomy.cdm.api.service.pager.Pager;
19
import eu.etaxonomy.cdm.model.name.Registration;
20
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
21
import eu.etaxonomy.cdm.model.name.TaxonName;
22
import eu.etaxonomy.cdm.model.reference.Reference;
23
import eu.etaxonomy.cdm.persistence.query.MatchMode;
24
import eu.etaxonomy.cdm.persistence.query.OrderHint;
25

    
26
/**
27
 * @author a.kohlbecker
28
 * @since May 2, 2017
29
 *
30
 */
31
public interface IRegistrationService extends IAnnotatableService<Registration> {
32

    
33
    /**
34
     * Returns a sublist of Registration instances stored in the database. A
35
     * maximum of 'limit' objects are returned, starting at object with index
36
     * 'start'. The bean properties specified by the parameter
37
     * <code>propertyPaths</code> and recursively initialized for each of the
38
     * entities in the resultset
39
     *
40
     * For detailed description and examples regarding
41
     * <code>propertyPaths</code> <b>please refer to:</b>
42
     * {@link IBeanInitializer#initialize(Object, List)}
43
     *
44
     * @param pageSize
45
     *            The maximum number of objects returned (can be null for all
46
     *            matching objects)
47
     * @param pageNumber
48
     *            The offset (in pageSize chunks) from the start of the result
49
     *            set (0 - based, can be null, equivalent of starting at the
50
     *            beginning of the recordset)
51
     * @param reference
52
     *            filters the Registration by the reference of the nomenclatural
53
     *            act for which the Registration as been created. The name and
54
     *            all type designations associated with the Registration are
55
     *            sharing the same citation. If the Optional itself is
56
     *            <code>null</code> the parameter is neglected. If Optional
57
     *            contains the value <code>null</code> all registrations with a
58
     *            name or type designation that has no reference are returned.
59
     *            Also those registrations having no name and type designation
60
     *            at all.
61
     * @param includedStatus
62
     *            filters the Registration by the RegistrationStatus. Only
63
     *            Registration having one of the supplied status will included.
64
     *            // * @param orderHints // * Supports path like
65
     *            <code>orderHints.propertyNames</code> which // * include
66
     *            *-to-one properties like createdBy.username or // *
67
     *            authorTeam.persistentTitleCache
68
     * @param propertyPaths
69
     * @return
70
     * @throws DataAccessException
71
     */
72
    public Pager<Registration> page(Optional<Reference> reference, Collection<RegistrationStatus> includedStatus,
73
            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
74

    
75
    Pager<Registration> pageByIdentifier(String identifier, Integer pageIndex, Integer pageSize, List<String> propertyPaths) throws IOException;
76

    
77
    public Map<UUID, RegistrationStatus> statusByIdentifier(String identifier) throws IOException;
78

    
79
    /**
80
     * @param submitterUuid
81
     *    Filter by the uuid of the {@link User} associated with the Registration as <code>Registration.submitter</code>
82
     * @param includedStatus
83
     *    Filter by one or more {@link RegistrationStatus}. Multiple status will be combined with OR. In case the current user
84
     *    is not authenticated (i.e. the authentication is anonymous) the includedStatus will be set to {@link RegistrationStatus#PUBLISHED}
85
     *    to protect all other Registrations from being undisclosed.
86
     * @param identifierFilterPattern
87
     *    Filter by the {@link Registration#getIdentifier() Registration.identifier}.
88
     *    The method matches Registrations which contain the the passed pattern in the identifier.
89
     *    The asterisk '<code>*</code>' can be used as wildcard in any position of the pattern string
90
     * @param taxonNameFilterPattern
91
     *    The method matches Registrations which contain the the passed pattern in the
92
     *    {@link Registration#getName() Registration.name}. The asterisk '<code>*</code>' can be used
93
     *    as wildcard in any position of the pattern string
94
     * @param referenceFilterPattern
95
     *    The asterisk '<code>*</code>' can be used as wildcard in any position of the pattern string
96
     * @param typeDesignationStatusUuids
97
     *    Filter by one or more {@link eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus} or {@link eu.etaxonomy.cdm.model.name.NameTypeDesignationStatus}.
98
     *    Multiple status will be combined with OR.
99
     * @param pageSize
100
     * @param pageIndex
101
     * @param orderHints
102
     * @param propertyPaths
103
     * @return
104
     */
105
    Pager<Registration> page(UUID submitterUuid, Collection<RegistrationStatus> includedStatus, String identifierFilterPattern,
106
            String taxonNameFilterPattern, String referenceFilterPattern, Collection<UUID> typeDesignationStatusUuids,
107
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths);
108

    
109
    public Pager<Registration> page(UUID submitterUuid, Collection<RegistrationStatus> includedStatus,
110
            Collection<UUID> taxonNameUUIDs,
111
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths);
112

    
113
    public Pager<Registration> pageTaxomicInclusion(UUID submitterUuid, Collection<RegistrationStatus> includedStatus,
114
            String taxonNameFilterPattern, MatchMode matchMode,
115
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths);
116

    
117
    // ============= functionality to be moved into a "RegistrationManagerBean" ==================
118

    
119
    public Registration newRegistration();
120

    
121
    Registration assureIsPersisted(Registration reg);
122

    
123
    /**
124
     * Create and persist a new Registration for the name having the supplied UUID.
125
     *
126
     * @param taxonNameUuid
127
     * @return
128
     */
129
    Registration createRegistrationForName(UUID taxonNameUuid);
130

    
131
    boolean checkRegistrationExistsFor(TaxonName name);
132

    
133
    public void addTypeDesignation(UUID registrationUUID, UUID typeDesignationUuid);
134

    
135
    /**
136
     * @param registration
137
     * @param typeDesignationUuid
138
     */
139
    public void addTypeDesignation(Registration registration, UUID typeDesignationUuid);
140

    
141
    // ============================================================================================
142

    
143
}
(53-53/97)