1
|
/**
|
2
|
* Copyright (C) 2007 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.api.service;
|
11
|
|
12
|
import java.io.IOException;
|
13
|
import java.util.List;
|
14
|
import java.util.Map;
|
15
|
import java.util.Set;
|
16
|
import java.util.UUID;
|
17
|
|
18
|
import org.apache.http.HttpException;
|
19
|
|
20
|
import eu.etaxonomy.cdm.api.service.config.MediaDeletionConfigurator;
|
21
|
import eu.etaxonomy.cdm.api.service.pager.Pager;
|
22
|
import eu.etaxonomy.cdm.model.description.MediaKey;
|
23
|
import eu.etaxonomy.cdm.model.location.NamedArea;
|
24
|
import eu.etaxonomy.cdm.model.media.Media;
|
25
|
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
26
|
import eu.etaxonomy.cdm.model.media.Rights;
|
27
|
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
|
28
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
29
|
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
|
30
|
import eu.etaxonomy.cdm.persistence.query.OrderHint;
|
31
|
|
32
|
public interface IMediaService extends IIdentifiableEntityService<Media> {
|
33
|
|
34
|
/**
|
35
|
* Return a List of MediaKeys, optionally filtered by the parameters passed.
|
36
|
*
|
37
|
* @param taxonomicScope a Set of Taxon instances that define the taxonomic scope of the key (can be null)
|
38
|
* @param geoScopes a Set of NamedArea instances that define the geospatial scope of the key (can be null)
|
39
|
* @param pageSize The maximum number of keys returned (can be null for all keys)
|
40
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
41
|
* @param propertyPaths Properties to initialize in the returned entities, following the syntax described in {@link IBeanInitializer#initialize(Object, List)}
|
42
|
* @return a Pager containing MediaKey instances
|
43
|
*/
|
44
|
public Pager<MediaKey> getMediaKeys(Set<Taxon> taxonomicScope, Set<NamedArea> geoScopes, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
45
|
|
46
|
/**
|
47
|
* Return a Pager of rights belonging to this object
|
48
|
*
|
49
|
* @param t The media object
|
50
|
* @param pageSize The maximum number of rights returned (can be null for all rights)
|
51
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
52
|
* @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
|
53
|
* @return a Pager of Rights entities
|
54
|
*/
|
55
|
@Override
|
56
|
public Pager<Rights> getRights(Media t, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
|
57
|
|
58
|
/**
|
59
|
* Returns a Paged List of Media instances where the default field matches the String queryString (as interpreted by the Lucene QueryParser)
|
60
|
*
|
61
|
* @param clazz filter the results by class (or pass null to return all Media instances)
|
62
|
* @param queryString
|
63
|
* @param pageSize The maximum number of media returned (can be null for all matching media)
|
64
|
* @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
|
65
|
* @param orderHints
|
66
|
* Supports path like <code>orderHints.propertyNames</code> which
|
67
|
* include *-to-one properties like createdBy.username or
|
68
|
* authorTeam.persistentTitleCache
|
69
|
* @param propertyPaths properties to be initialized
|
70
|
* @return a Pager Media instances
|
71
|
* @see <a href="http://lucene.apache.org/java/2_4_0/queryparsersyntax.html">Apache Lucene - Query Parser Syntax</a>
|
72
|
*/
|
73
|
@Override
|
74
|
public Pager<Media> search(Class<? extends Media> clazz, String queryString, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
|
75
|
|
76
|
|
77
|
public DeleteResult delete(UUID mediaUuid, MediaDeletionConfigurator config);
|
78
|
|
79
|
/**
|
80
|
* Reads the metadata as stored in the file or web resource and filters the data by the include and exclude lists of key names
|
81
|
* as stored in the data base properties {@link PreferencePredicate#MediaMetadataKeynameExcludes} and {@link PreferencePredicate#MediaMetadataKeynameExcludes}
|
82
|
* <p>
|
83
|
* Metadata of multiple parts is merged into one common metadata map whereas the later part being read may overwrite data from previous parts.
|
84
|
* The consequences of this can be neglected since we don't expect that multiple parts are actually being used.
|
85
|
*
|
86
|
* @param representation
|
87
|
* @return
|
88
|
* @throws IOException
|
89
|
* @throws HttpException
|
90
|
*/
|
91
|
Map<String, String> readResourceMetadataFiltered(MediaRepresentation representation) throws IOException, HttpException;
|
92
|
|
93
|
/**
|
94
|
* @param mediaUuids
|
95
|
* @param config
|
96
|
* @return
|
97
|
*/
|
98
|
public DeleteResult delete(Set<UUID> mediaUuids, MediaDeletionConfigurator config);
|
99
|
}
|