1
|
/**
|
2
|
* Copyright (C) 2020 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.media;
|
10
|
|
11
|
/**
|
12
|
* All defined {@link SearchReplace} rules must match otherwise the transformations is omitted.
|
13
|
* A {@link SearchReplace} rule can be mediate an identity transformation of is URI part
|
14
|
* in which case the rule just acts as a filter.
|
15
|
*
|
16
|
* @author a.kohlbecker
|
17
|
* @since Jul 8, 2020
|
18
|
*/
|
19
|
public class MediaUriTransformation {
|
20
|
|
21
|
SearchReplace scheme = null;
|
22
|
SearchReplace host = null;
|
23
|
SearchReplace pathQueryFragment = null;
|
24
|
|
25
|
String mimeType = null;
|
26
|
|
27
|
Integer width = null;
|
28
|
Integer height = null;
|
29
|
|
30
|
public MediaUriTransformation() {
|
31
|
|
32
|
}
|
33
|
|
34
|
public SearchReplace getScheme() {
|
35
|
return scheme;
|
36
|
}
|
37
|
|
38
|
/**
|
39
|
* Replacement rule for the scheme part of the URI.
|
40
|
* <p>
|
41
|
* In case the regex pattern {@link SearchReplace#getSearch()} does not match the URI part
|
42
|
* the whole <code>MediaUriTransformation</code> must be omitted.
|
43
|
*
|
44
|
* @param scheme The search replace rule for the URI scheme
|
45
|
*/
|
46
|
public void setScheme(SearchReplace scheme) {
|
47
|
this.scheme = scheme;
|
48
|
}
|
49
|
|
50
|
|
51
|
public SearchReplace getHost() {
|
52
|
return host;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Replacement rule for the host part of the URI.
|
57
|
* <p>
|
58
|
* In case the regex pattern {@link SearchReplace#getSearch()} does not match the URI part
|
59
|
* the whole <code>MediaUriTransformation</code> must be omitted.
|
60
|
*
|
61
|
* @param scheme The search replace rule for the URI host
|
62
|
*/
|
63
|
public void setHost(SearchReplace host) {
|
64
|
this.host = host;
|
65
|
}
|
66
|
|
67
|
|
68
|
public SearchReplace getPathQueryFragment() {
|
69
|
return pathQueryFragment;
|
70
|
}
|
71
|
|
72
|
|
73
|
/**
|
74
|
* Replacement rule for the combined {@code path + "?" + query + "#" + fragment} parts of the URI.
|
75
|
* <p>
|
76
|
* In case the regex pattern {@link SearchReplace#getSearch()} does not match this string
|
77
|
* the whole <code>MediaUriTransformation</code> must be omitted.
|
78
|
*
|
79
|
* @param scheme The search replace rule for combined {@code path + "?" + query + "#" + fragment} parts of the URI.
|
80
|
*/
|
81
|
public void setPathQueryFragment(SearchReplace pathQueryFragment) {
|
82
|
this.pathQueryFragment = pathQueryFragment;
|
83
|
}
|
84
|
|
85
|
/**
|
86
|
* The mime type of the target media
|
87
|
*
|
88
|
* @return the mimeType
|
89
|
*/
|
90
|
public String getMimeType() {
|
91
|
return mimeType;
|
92
|
}
|
93
|
|
94
|
/**
|
95
|
* The mime type of the target media
|
96
|
*
|
97
|
* @param mimeType the mimeType to set
|
98
|
*/
|
99
|
public void setMimeType(String mimeType) {
|
100
|
this.mimeType = mimeType;
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* The pixel width of the target media, usually of an image.
|
105
|
*
|
106
|
* @return the width
|
107
|
*/
|
108
|
public Integer getWidth() {
|
109
|
return width;
|
110
|
}
|
111
|
|
112
|
/**
|
113
|
* The pixel width of the target media, usually of an image.
|
114
|
*
|
115
|
* @param width the width to set
|
116
|
*/
|
117
|
public void setWidth(Integer width) {
|
118
|
this.width = width;
|
119
|
}
|
120
|
|
121
|
/**
|
122
|
* The pixel height of the target media, usually of an image.
|
123
|
*
|
124
|
* @return the height
|
125
|
*/
|
126
|
public Integer getHeight() {
|
127
|
return height;
|
128
|
}
|
129
|
|
130
|
/**
|
131
|
* The pixel height of the target media, usually of an image.
|
132
|
*
|
133
|
* @param height the height to set
|
134
|
*/
|
135
|
public void setHeight(Integer height) {
|
136
|
this.height = height;
|
137
|
}
|
138
|
|
139
|
|
140
|
}
|