1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.codelibs.fess.app.web.admin.webconfig;
17
18 import org.codelibs.core.lang.StringUtil;
19 import org.codelibs.fess.Constants;
20 import org.codelibs.fess.app.web.CrudMode;
21 import org.codelibs.fess.mylasta.direction.FessConfig;
22 import org.codelibs.fess.util.ComponentUtil;
23 import org.codelibs.fess.validation.CustomSize;
24 import org.codelibs.fess.validation.UriType;
25 import org.codelibs.fess.validation.UriTypeValidator.ProtocolType;
26 import org.lastaflute.web.validation.Required;
27 import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
28
29 import jakarta.validation.constraints.Max;
30 import jakarta.validation.constraints.Min;
31 import jakarta.validation.constraints.Size;
32
33
34
35
36
37 public class CreateForm {
38
39
40
41
42 public CreateForm() {
43
44 }
45
46
47
48
49 public String[] labelTypeIds;
50
51
52
53
54 @ValidateTypeFailure
55 public Integer crudMode;
56
57
58
59
60 @Required
61 @Size(max = 200)
62 public String name;
63
64
65
66
67 @Size(max = 1000)
68 public String description;
69
70
71
72
73 @Required
74 @UriType(protocolType = ProtocolType.WEB)
75 @CustomSize(maxKey = "form.admin.max.input.size")
76 public String urls;
77
78
79
80
81 @CustomSize(maxKey = "form.admin.max.input.size")
82 public String includedUrls;
83
84
85
86
87 @CustomSize(maxKey = "form.admin.max.input.size")
88 public String excludedUrls;
89
90
91
92
93 @CustomSize(maxKey = "form.admin.max.input.size")
94 public String includedDocUrls;
95
96
97
98
99 @CustomSize(maxKey = "form.admin.max.input.size")
100 public String excludedDocUrls;
101
102
103
104
105 @CustomSize(maxKey = "form.admin.max.input.size")
106 public String configParameter;
107
108
109
110
111 @Min(value = 0)
112 @Max(value = 2147483647)
113 @ValidateTypeFailure
114 public Integer depth;
115
116
117
118
119 @Min(value = 0)
120 @Max(value = 9223372036854775807L)
121 @ValidateTypeFailure
122 public Long maxAccessCount;
123
124
125
126
127 @Required
128 @Size(max = 200)
129 public String userAgent;
130
131
132
133
134 @Required
135 @Min(value = 1)
136 @Max(value = 2147483647)
137 @ValidateTypeFailure
138 public Integer numOfThread;
139
140
141
142
143 @Required
144 @Min(value = 0)
145 @Max(value = 2147483647)
146 @ValidateTypeFailure
147 public Integer intervalTime;
148
149
150
151
152 @Required
153 @ValidateTypeFailure
154 public Float boost;
155
156
157
158
159 @Required
160 @Size(max = 5)
161 public String available;
162
163
164
165
166 @CustomSize(maxKey = "form.admin.max.input.size")
167 public String permissions;
168
169
170
171
172 @CustomSize(maxKey = "form.admin.max.input.size")
173 public String virtualHosts;
174
175
176
177
178 @Required
179 @Min(value = 0)
180 @Max(value = 2147483647)
181 @ValidateTypeFailure
182 public Integer sortOrder;
183
184
185
186
187 @Size(max = 1000)
188 public String createdBy;
189
190
191
192
193 @ValidateTypeFailure
194 public Long createdTime;
195
196
197
198
199 public void initialize() {
200 crudMode = CrudMode.CREATE;
201 final FessConfig fessConfig = ComponentUtil.getFessConfig();
202 includedUrls = fessConfig.getCrawlerDocumentHtmlDefaultIncludeIndexPatterns();
203 excludedUrls = fessConfig.getCrawlerDocumentHtmlDefaultExcludeIndexPatterns();
204 includedDocUrls = fessConfig.getCrawlerDocumentHtmlDefaultIncludeSearchPatterns();
205 excludedDocUrls = fessConfig.getCrawlerDocumentHtmlDefaultExcludeSearchPatterns();
206 boost = 1.0f;
207 if (StringUtil.isBlank(userAgent)) {
208 userAgent = fessConfig.getUserAgentName();
209 }
210 numOfThread = Constants.DEFAULT_NUM_OF_THREAD_FOR_WEB;
211 intervalTime = Constants.DEFAULT_INTERVAL_TIME_FOR_WEB;
212 sortOrder = 0;
213 createdBy = ComponentUtil.getSystemHelper().getUsername();
214 createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
215 permissions = fessConfig.getSearchDefaultDisplayPermission();
216 }
217 }