View Javadoc
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.pathmap;
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   * The create form for Path Map.
29   */
30  public class CreateForm {
31  
32      /**
33       * Creates a new CreateForm instance.
34       */
35      public CreateForm() {
36      }
37  
38      /**
39       * The CRUD operation mode (create, update, etc.).
40       */
41      @ValidateTypeFailure
42      public Integer crudMode;
43  
44      /**
45       * The regular expression pattern to match request paths.
46       */
47      @Required
48      @Size(max = 1000)
49      public String regex;
50  
51      /**
52       * The replacement pattern for matched paths.
53       */
54      @Size(max = 1000)
55      public String replacement;
56  
57      /**
58       * The processing type for path mapping.
59       */
60      @Required
61      public String processType;
62  
63      /**
64       * The sort order for this path mapping (0-2147483647).
65       */
66      @Required
67      @Min(value = 0)
68      @Max(value = 2147483647)
69      @ValidateTypeFailure
70      public Integer sortOrder;
71  
72      /**
73       * The username who created this path mapping.
74       */
75      @Size(max = 1000)
76      public String createdBy;
77  
78      /**
79       * The timestamp when this path mapping was created.
80       */
81      @ValidateTypeFailure
82      public Long createdTime;
83  
84      /**
85       * The user agent string for this path mapping.
86       */
87      @Size(max = 1000)
88      public String userAgent;
89  
90      /**
91       * Initializes the form with default values for creating a new path mapping.
92       */
93      public void initialize() {
94          crudMode = CrudMode.CREATE;
95          sortOrder = 0;
96          createdBy = ComponentUtil.getSystemHelper().getUsername();
97          createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
98      }
99  }