1 /*
2 * Copyright 2012-2025 CodeLibs Project and the Others.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13 * either express or implied. See the License for the specific language
14 * governing permissions and limitations under the License.
15 */
16 package org.codelibs.fess.app.web.admin.boostdoc;
17
18 import org.codelibs.fess.app.web.CrudMode;
19 import org.codelibs.fess.util.ComponentUtil;
20 import org.lastaflute.web.validation.Required;
21 import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
22
23 import jakarta.validation.constraints.Max;
24 import jakarta.validation.constraints.Min;
25 import jakarta.validation.constraints.Size;
26
27 /**
28 * Form class for creating boost document configurations.
29 * Boost documents allow administrators to define URL patterns and boost expressions
30 * to influence search result rankings for specific documents.
31 */
32 public class CreateForm {
33
34 /**
35 * Creates a new CreateForm instance.
36 */
37 public CreateForm() {
38 // Default constructor
39 }
40
41 /** CRUD operation mode (CREATE, EDIT, etc.) */
42 @ValidateTypeFailure
43 public Integer crudMode;
44
45 /** URL expression pattern to match documents for boosting */
46 @Required
47 @Size(max = 10000)
48 public String urlExpr;
49
50 /** Boost expression to apply to matching documents */
51 @Required
52 @Size(max = 10000)
53 public String boostExpr;
54
55 /** Sort order for displaying boost configurations */
56 @Required
57 @Min(value = 0)
58 @Max(value = 2147483647)
59 @ValidateTypeFailure
60 public Integer sortOrder;
61
62 /** User who created this configuration */
63 @Size(max = 1000)
64 public String createdBy;
65
66 /** Timestamp when this configuration was created */
67 @ValidateTypeFailure
68 public Long createdTime;
69
70 /**
71 * Initializes the form with default values for creating a new boost document configuration.
72 */
73 public void initialize() {
74 crudMode = CrudMode.CREATE;
75 sortOrder = 0;
76 createdBy = ComponentUtil.getSystemHelper().getUsername();
77 createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
78 }
79 }