View Javadoc
1   /*
2    * Copyright 2012-2021 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.scheduler;
17  
18  import javax.validation.constraints.Max;
19  import javax.validation.constraints.Min;
20  import javax.validation.constraints.Size;
21  
22  import org.codelibs.fess.Constants;
23  import org.codelibs.fess.util.ComponentUtil;
24  import org.codelibs.fess.validation.CronExpression;
25  import org.codelibs.fess.validation.CustomSize;
26  import org.lastaflute.web.validation.Required;
27  import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
28  
29  /**
30   * @author shinsuke
31   */
32  public class CreateForm {
33  
34      @ValidateTypeFailure
35      public Integer crudMode;
36  
37      @Required
38      @Size(max = 100)
39      public String name;
40  
41      @Required
42      @Size(max = 100)
43      public String target;
44  
45      @Size(max = 100)
46      @CronExpression
47      public String cronExpression;
48  
49      @Required
50      @Size(max = 100)
51      public String scriptType;
52  
53      @CustomSize(maxKey = "form.admin.max.input.size")
54      public String scriptData;
55  
56      public String crawler;
57  
58      public String jobLogging;
59  
60      public String available;
61  
62      @Required
63      @Min(value = 0)
64      @Max(value = 2147483647)
65      @ValidateTypeFailure
66      public Integer sortOrder;
67  
68      @Size(max = 1000)
69      public String createdBy;
70  
71      @ValidateTypeFailure
72      public Long createdTime;
73  
74      public void initialize() {
75          target = Constants.DEFAULT_JOB_TARGET;
76          cronExpression = Constants.DEFAULT_CRON_EXPRESSION;
77          scriptType = Constants.DEFAULT_JOB_SCRIPT_TYPE;
78          sortOrder = 0;
79          createdBy = ComponentUtil.getSystemHelper().getUsername();
80          createdTime = ComponentUtil.getSystemHelper().getCurrentTimeAsLong();
81  
82      }
83  }