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.failureurl;
17  
18  import org.lastaflute.web.validation.Required;
19  import org.lastaflute.web.validation.theme.conversion.ValidateTypeFailure;
20  
21  import jakarta.validation.constraints.Size;
22  
23  /**
24   * Form class for editing failure URL records in the admin interface.
25   * This form handles the editing of URLs that failed during crawling operations,
26   * providing details about the failure for debugging and troubleshooting purposes.
27   */
28  public class EditForm {
29  
30      /**
31       * Creates a new EditForm instance.
32       */
33      public EditForm() {
34          super();
35      }
36  
37      /**
38       * The name of the web configuration associated with this failure URL.
39       * Used to identify which web crawling configuration encountered the failure.
40       */
41      public String webConfigName;
42  
43      /**
44       * The name of the file configuration associated with this failure URL.
45       * Used to identify which file crawling configuration encountered the failure.
46       */
47      public String fileConfigName;
48  
49      /**
50       * The current page number for pagination in the failure URL list.
51       * Used for navigating through multiple pages of failure records.
52       */
53      @ValidateTypeFailure
54      public String pageNumber;
55  
56      /**
57       * The CRUD operation mode for this form.
58       * Indicates whether this is a create, read, update, or delete operation.
59       */
60      @ValidateTypeFailure
61      public Integer crudMode;
62  
63      /**
64       * The unique identifier of the failure URL record being edited.
65       * This is a required field for identifying which failure record to update.
66       */
67      @Required
68      @Size(max = 1000)
69      public String id;
70  
71      /**
72       * The URL that failed during crawling.
73       * This is a required field containing the actual URL that encountered an error.
74       */
75      @Required
76      public String url;
77  
78      /**
79       * The name of the crawler thread that encountered the failure.
80       * This is a required field used for identifying which crawler process failed.
81       */
82      @Required
83      public String threadName;
84  
85      /**
86       * The name or type of the error that occurred.
87       * This field provides a categorization of the failure type.
88       */
89      public String errorName;
90  
91      /**
92       * The detailed error log or stack trace for the failure.
93       * This field contains the full error information for debugging purposes.
94       */
95      public String errorLog;
96  
97      /**
98       * The number of times this URL has failed.
99       * This is a required field that tracks repeated failures for the same URL.
100      */
101     @Required
102     @ValidateTypeFailure
103     public String errorCount;
104 
105     /**
106      * The timestamp of the last access attempt for this URL.
107      * This is a required field indicating when the failure last occurred.
108      */
109     @Required
110     public String lastAccessTime;
111 
112     /**
113      * The configuration ID associated with this failure URL.
114      * Links the failure to a specific crawling configuration.
115      */
116     @Size(max = 1000)
117     public String configId;
118 
119     /**
120      * Returns the current page number for pagination.
121      * This method provides access to the current page number for UI display.
122      *
123      * @return The current page number as a string
124      */
125     public String getCurrentPageNumber() {
126         return pageNumber;
127     }
128 
129     /**
130      * Initializes the form with default null values.
131      * This method resets all fields to their default state for creating a new entry.
132      */
133     public void initialize() {
134         id = null;
135         url = null;
136         threadName = null;
137         errorName = null;
138         errorLog = null;
139         errorCount = null;
140         lastAccessTime = null;
141         configId = null;
142     }
143 
144 }