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.reqheader;
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.Size;
24
25 /**
26 * The create form for Request Header.
27 */
28 public class CreateForm {
29
30 /**
31 * Creates a new CreateForm instance.
32 */
33 public CreateForm() {
34 }
35
36 /**
37 * The CRUD mode for the form.
38 */
39 @ValidateTypeFailure
40 public Integer crudMode;
41
42 /**
43 * The name of the request header.
44 */
45 @Required
46 @Size(max = 100)
47 public String name;
48
49 /**
50 * The value of the request header.
51 */
52 @Required
53 @Size(max = 1000)
54 public String value;
55
56 /**
57 * The web configuration ID associated with this request header.
58 */
59 @Required
60 @Size(max = 1000)
61 public String webConfigId;
62
63 /**
64 * The username of who created this request header.
65 */
66 @Size(max = 1000)
67 public String createdBy;
68
69 /**
70 * The timestamp when this request header was created.
71 */
72 @ValidateTypeFailure
73 public Long createdTime;
74
75 /**
76 * Initializes the form with default values for creating a new request header.
77 */
78 public void initialize() {
79 crudMode = CrudMode.CREATE;
80 createdBy = ComponentUtil.getSystemHelper().getUsername();
81 createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
82 }
83 }