Project

General

Profile

Revision f69d6df9

IDf69d6df9e720ebabbedc5fa192cbfbf3d0aa817d
Parent 69fd8336
Child c7637ad4

Added by Andreas Kohlbecker 9 months ago

ref #8330 removing unused and obsolete service methods which are replaces by the new one

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IRegistrationService.java
13 13
import java.util.List;
14 14
import java.util.Map;
15 15
import java.util.Optional;
16
import java.util.Set;
17 16
import java.util.UUID;
18 17

  
19 18
import eu.etaxonomy.cdm.api.service.pager.Pager;
20
import eu.etaxonomy.cdm.model.common.User;
21 19
import eu.etaxonomy.cdm.model.name.Registration;
22 20
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
23 21
import eu.etaxonomy.cdm.model.name.TaxonName;
24
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
25 22
import eu.etaxonomy.cdm.model.reference.Reference;
26 23
import eu.etaxonomy.cdm.persistence.query.MatchMode;
27 24
import eu.etaxonomy.cdm.persistence.query.OrderHint;
......
75 72
    public Pager<Registration> page(Optional<Reference> reference, Collection<RegistrationStatus> includedStatus,
76 73
            Integer pageSize, Integer pageIndex, List<String> propertyPaths);
77 74

  
78
    /**
79
     * Returns a sublist of Registration instances stored in the database. A
80
     * maximum of 'limit' objects are returned, starting at object with index
81
     * 'start'. The bean properties specified by the parameter
82
     * <code>propertyPaths</code> and recursively initialized for each of the
83
     * entities in the resultset
84
     *
85
     * For detailed description and examples regarding
86
     * <code>propertyPaths</code> <b>please refer to:</b>
87
     * {@link IBeanInitializer#initialize(Object, List)}
88
     *
89
     * @param submitter
90
     *            Limits the result set to Registrations having the given
91
     *            submitter. This filter is ignored if set to <code>null</code>.
92
     * @param includedStatus
93
     *            filters the Registration by the RegistrationStatus. Only
94
     *            Registration having one of the supplied status will included.
95
     * @param identifierFilterPattern
96
     *            filters the Registration by this pattern, The asterisk '<code>*</code>' can be used
97
     *            as wildcard in any position of the pattern string
98
     * @param taxonNameFilterPattern
99
     *            filters the registered taxon name by this pattern, The asterisk '<code>*</code>' can be used
100
     *            as wildcard in any position of the pattern string
101
     * @param typeDesignationStatus
102
     * @param pageSize
103
     *            The maximum number of objects returned (can be null for all
104
     *            matching objects)
105
     * @param pageNumber
106
     *            The offset (in pageSize chunks) from the start of the result
107
     *            set (0 - based, can be null, equivalent of starting at the
108
     *            beginning of the recordset)
109
     * @param orderHints
110
     *            Supports path like <code>orderHints.propertyNames</code> which
111
     *            include *-to-one properties like createdBy.username or
112
     *            authorTeam.persistentTitleCache
113
     * @param propertyPaths
114
     * @return
115
     * @throws DataAccessException
116
     */
117
    public Pager<Registration> page(User submitter, Collection<RegistrationStatus> includedStatus,
118
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeDesignationStatus, Integer pageSize,
119
            Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths);
120

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

  
123 77
    public Map<UUID, RegistrationStatus> statusByIdentifier(String identifier) throws IOException;
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/RegistrationServiceImpl.java
39 39
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
40 40
import eu.etaxonomy.cdm.model.name.TaxonName;
41 41
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
42
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
43 42
import eu.etaxonomy.cdm.model.reference.Reference;
44 43
import eu.etaxonomy.cdm.persistence.dao.common.Restriction;
45 44
import eu.etaxonomy.cdm.persistence.dao.name.IRegistrationDao;
......
104 103
        return new DefaultPagerImpl<>(pageIndex, numberOfResults, pageSize, results);
105 104
    }
106 105

  
107
    /**
108
     * {@inheritDoc}
109
     */
110
    @Override
111
    @Transactional(readOnly = true)
112
    public Pager<Registration> page(User submitter, Collection<RegistrationStatus> includedStatus,
113
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeDesignationStatus,
114
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints, List<String> propertyPaths) {
115

  
116
        List<Restriction<? extends Object>> restrictions = new ArrayList<>();
117 106

  
118
        if( !userHelper.userIsAutheticated() || userHelper.userIsAnnonymous() ) {
119
            includedStatus = Arrays.asList(RegistrationStatus.PUBLISHED);
120
        }
121

  
122
        if(submitter != null){
123
            restrictions.add(new Restriction<>("submitter", MatchMode.EXACT, submitter));
124
        }
125
        if(includedStatus != null && !includedStatus.isEmpty()){
126
            restrictions.add(new Restriction<>("status", MatchMode.EXACT, includedStatus.toArray(new RegistrationStatus[includedStatus.size()])));
127
        }
128
        if(identifierFilterPattern != null){
129
            restrictions.add(new Restriction<>("identifier", MatchMode.LIKE, identifierFilterPattern));
130
        }
131
        if(taxonNameFilterPattern != null){
132
            restrictions.add(new Restriction<>("name.titleCache", MatchMode.LIKE, taxonNameFilterPattern));
133
        }
134
        if(typeDesignationStatus != null){
135
            restrictions.add(new Restriction<>("typeDesignations.typeStatus", null, typeDesignationStatus.toArray(new TypeDesignationStatusBase[typeDesignationStatus.size()])));
136
        }
137

  
138
        long numberOfResults = dao.count(Registration.class, restrictions);
139

  
140
        List<Registration> results = new ArrayList<>();
141
        Integer [] limitStart = AbstractPagerImpl.limitStartforRange(numberOfResults, pageIndex, pageSize);
142
        if(limitStart != null) {
143
            results = dao.list(Registration.class, restrictions, limitStart[0], limitStart[1], orderHints, propertyPaths);
144
        }
145

  
146
        return new DefaultPagerImpl<>(pageIndex, numberOfResults, pageSize, results);
147
    }
148 107

  
149 108
    @Override
150 109
    @Transactional(readOnly = true)
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/registration/IRegistrationWorkingSetService.java
19 19
import eu.etaxonomy.cdm.api.service.exception.RegistrationValidationException;
20 20
import eu.etaxonomy.cdm.api.service.pager.Pager;
21 21
import eu.etaxonomy.cdm.database.PermissionDeniedException;
22
import eu.etaxonomy.cdm.model.common.User;
23 22
import eu.etaxonomy.cdm.model.name.Registration;
24 23
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
25
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
26 24
import eu.etaxonomy.cdm.persistence.query.MatchMode;
27 25
import eu.etaxonomy.cdm.persistence.query.OrderHint;
28 26

  
......
43 41

  
44 42
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex);
45 43

  
46
    public Pager<RegistrationDTO> pageDTOs(User submitter, Collection<RegistrationStatus> includedStatus,
47
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeStatusFilter,
48
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints);
49

  
50 44
    public Pager<RegistrationDTO> pageDTOs(String identifier, Integer pageIndex,  Integer pageSize) throws IOException;
51 45

  
52 46
    /**
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/registration/RegistrationWorkingSetService.java
37 37
import eu.etaxonomy.cdm.database.PermissionDeniedException;
38 38
import eu.etaxonomy.cdm.format.ReferenceEllypsisFormatter;
39 39
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
40
import eu.etaxonomy.cdm.model.common.User;
41 40
import eu.etaxonomy.cdm.model.name.Registration;
42 41
import eu.etaxonomy.cdm.model.name.RegistrationStatus;
43 42
import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation;
44 43
import eu.etaxonomy.cdm.model.name.TypeDesignationBase;
45
import eu.etaxonomy.cdm.model.name.TypeDesignationStatusBase;
46 44
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
47 45
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
48 46
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
......
196 194
    @Override
197 195
    public Pager<RegistrationDTO> pageDTOs(Integer pageSize, Integer pageIndex) {
198 196

  
199
        return pageDTOs((User)null, null, null, null, null, pageSize, pageIndex, null);
200
    }
201

  
202
    /**
203
     * {@inheritDoc}
204
     */
205
    @Override
206
    public Pager<RegistrationDTO> pageDTOs(User submitter, Collection<RegistrationStatus> includedStatus,
207
            String identifierFilterPattern, String taxonNameFilterPattern, Set<TypeDesignationStatusBase> typeStatusFilter,
208
            Integer pageSize, Integer pageIndex, List<OrderHint> orderHints) {
197
        return pageDTOs((UUID)null, null, null, null, null, null, pageSize, pageIndex, null);
209 198

  
210
        if(pageSize == null){
211
            pageSize = PAGE_SIZE;
212
        }
213

  
214
        if(orderHints == null){
215
            orderHints = Arrays.asList(new OrderHint("identifier", SortOrder.ASCENDING));
216
        }
217

  
218
        Pager<Registration> pager = repo.getRegistrationService().page(submitter, includedStatus, identifierFilterPattern, taxonNameFilterPattern,
219
                typeStatusFilter, PAGE_SIZE, pageIndex , orderHints, REGISTRATION_DTO_INIT_STRATEGY.getPropertyPaths());
220

  
221
        Pager<RegistrationDTO> dtoPager = convertToDTOPager(pager);
222
        if(logger.isDebugEnabled()){
223
            logger.debug(String.format("pageDTOs() pageIndex: $1%d, pageSize: $2%d, includedStatus: $3%s, identifierFilterPattern: $4%s, taxonNameFilterPattern: $5%s, submitter: $6%s",
224
                    pageIndex, pageSize, includedStatus, identifierFilterPattern, taxonNameFilterPattern, submitter));
225
            logger.debug("pageDTOs() result: " + pager.toString());
226
        }
227
        return dtoPager;
228 199
    }
229 200

  
230 201
    /**
......
248 219
     * @param orderHints
249 220
     * @return
250 221
     */
222

  
251 223
    @Override
252 224
    public Pager<RegistrationDTO> pageDTOs(UUID submitterUuid, Collection<RegistrationStatus> includedStatus, String identifierFilterPattern,
253 225
            String taxonNameFilterPattern, String referenceFilterPattern, Collection<UUID> typeDesignationStatusUuids,

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)