Преглед на файлове

add createnewjob at crawling config

Kaoru FUZITA преди 9 години
родител
ревизия
07a440a215

+ 27 - 0
src/main/java/org/codelibs/fess/app/web/admin/dataconfig/AdminDataconfigAction.java

@@ -31,7 +31,9 @@ import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.ds.DataStoreFactory;
 import org.codelibs.fess.ds.DataStoreFactory;
 import org.codelibs.fess.es.config.exentity.DataConfig;
 import org.codelibs.fess.es.config.exentity.DataConfig;
+import org.codelibs.fess.es.config.exentity.ScheduledJob;
 import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.util.ComponentUtil;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalThing;
 import org.dbflute.optional.OptionalThing;
 import org.lastaflute.web.Execute;
 import org.lastaflute.web.Execute;
@@ -39,6 +41,7 @@ import org.lastaflute.web.callback.ActionRuntime;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.render.RenderData;
 import org.lastaflute.web.response.render.RenderData;
+import org.lastaflute.web.util.LaRequestUtil;
 import org.lastaflute.web.validation.VaErrorHook;
 import org.lastaflute.web.validation.VaErrorHook;
 
 
 /**
 /**
@@ -165,6 +168,30 @@ public class AdminDataconfigAction extends FessAdminAction {
         });
         });
     }
     }
 
 
+    @Execute
+    public HtmlResponse createnewjob(final EditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        final ScheduledJob scheduledJob = new ScheduledJob();
+        scheduledJob.setCrawler(true);
+        return asHtml(path_AdminScheduledjob_EditJsp).useForm(
+                org.codelibs.fess.app.web.admin.scheduledjob.CreateForm.class,
+                op -> {
+                    op.setup(scheduledJobForm -> {
+                        scheduledJobForm.initialize();
+                        scheduledJobForm.crudMode = CrudMode.CREATE;
+                        scheduledJobForm.jobLogging = Constants.ON;
+                        scheduledJobForm.crawler = Constants.ON;
+                        scheduledJobForm.available = Constants.ON;
+                        scheduledJobForm.name =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.data_crawling_job_title", form.id);
+                        scheduledJobForm.scriptData =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.scheduledjob_script_template", "", "", "\"" + form.id + "\"");
+                    });
+                });
+    }
+
     // -----------------------------------------------------
     // -----------------------------------------------------
     //                                               Details
     //                                               Details
     //                                               -------
     //                                               -------

+ 27 - 0
src/main/java/org/codelibs/fess/app/web/admin/fileconfig/AdminFileconfigAction.java

@@ -25,7 +25,9 @@ import org.codelibs.fess.app.service.RoleTypeService;
 import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.es.config.exentity.FileConfig;
 import org.codelibs.fess.es.config.exentity.FileConfig;
+import org.codelibs.fess.es.config.exentity.ScheduledJob;
 import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.util.ComponentUtil;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalThing;
 import org.dbflute.optional.OptionalThing;
 import org.lastaflute.web.Execute;
 import org.lastaflute.web.Execute;
@@ -33,6 +35,7 @@ import org.lastaflute.web.callback.ActionRuntime;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.render.RenderData;
 import org.lastaflute.web.response.render.RenderData;
+import org.lastaflute.web.util.LaRequestUtil;
 import org.lastaflute.web.validation.VaErrorHook;
 import org.lastaflute.web.validation.VaErrorHook;
 
 
 /**
 /**
@@ -154,6 +157,30 @@ public class AdminFileconfigAction extends FessAdminAction {
         });
         });
     }
     }
 
 
+    @Execute
+    public HtmlResponse createnewjob(final EditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        final ScheduledJob scheduledJob = new ScheduledJob();
+        scheduledJob.setCrawler(true);
+        return asHtml(path_AdminScheduledjob_EditJsp).useForm(
+                org.codelibs.fess.app.web.admin.scheduledjob.CreateForm.class,
+                op -> {
+                    op.setup(scheduledJobForm -> {
+                        scheduledJobForm.initialize();
+                        scheduledJobForm.crudMode = CrudMode.CREATE;
+                        scheduledJobForm.jobLogging = Constants.ON;
+                        scheduledJobForm.crawler = Constants.ON;
+                        scheduledJobForm.available = Constants.ON;
+                        scheduledJobForm.name =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.file_crawling_job_title", form.id);
+                        scheduledJobForm.scriptData =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.scheduledjob_script_template", "", "\"" + form.id + "\"", "");
+                    });
+                });
+    }
+
     // -----------------------------------------------------
     // -----------------------------------------------------
     //                                               Details
     //                                               Details
     //                                               -------
     //                                               -------

+ 30 - 0
src/main/java/org/codelibs/fess/app/web/admin/webconfig/AdminWebconfigAction.java

@@ -21,11 +21,14 @@ import org.codelibs.fess.Constants;
 import org.codelibs.fess.app.pager.WebConfigPager;
 import org.codelibs.fess.app.pager.WebConfigPager;
 import org.codelibs.fess.app.service.LabelTypeService;
 import org.codelibs.fess.app.service.LabelTypeService;
 import org.codelibs.fess.app.service.RoleTypeService;
 import org.codelibs.fess.app.service.RoleTypeService;
+import org.codelibs.fess.app.service.ScheduledJobService;
 import org.codelibs.fess.app.service.WebConfigService;
 import org.codelibs.fess.app.service.WebConfigService;
 import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.CrudMode;
 import org.codelibs.fess.app.web.base.FessAdminAction;
 import org.codelibs.fess.app.web.base.FessAdminAction;
+import org.codelibs.fess.es.config.exentity.ScheduledJob;
 import org.codelibs.fess.es.config.exentity.WebConfig;
 import org.codelibs.fess.es.config.exentity.WebConfig;
 import org.codelibs.fess.helper.SystemHelper;
 import org.codelibs.fess.helper.SystemHelper;
+import org.codelibs.fess.util.ComponentUtil;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalEntity;
 import org.dbflute.optional.OptionalThing;
 import org.dbflute.optional.OptionalThing;
 import org.lastaflute.web.Execute;
 import org.lastaflute.web.Execute;
@@ -33,6 +36,7 @@ import org.lastaflute.web.callback.ActionRuntime;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.HtmlResponse;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.next.HtmlNext;
 import org.lastaflute.web.response.render.RenderData;
 import org.lastaflute.web.response.render.RenderData;
+import org.lastaflute.web.util.LaRequestUtil;
 import org.lastaflute.web.validation.VaErrorHook;
 import org.lastaflute.web.validation.VaErrorHook;
 
 
 /**
 /**
@@ -48,6 +52,8 @@ public class AdminWebconfigAction extends FessAdminAction {
     @Resource
     @Resource
     private WebConfigService webConfigService;
     private WebConfigService webConfigService;
     @Resource
     @Resource
+    private ScheduledJobService scheduledJobService;
+    @Resource
     private WebConfigPager webConfigPager;
     private WebConfigPager webConfigPager;
     @Resource
     @Resource
     private RoleTypeService roleTypeService;
     private RoleTypeService roleTypeService;
@@ -155,6 +161,30 @@ public class AdminWebconfigAction extends FessAdminAction {
         });
         });
     }
     }
 
 
+    @Execute
+    public HtmlResponse createnewjob(final EditForm form) {
+        validate(form, messages -> {}, toEditHtml());
+        final ScheduledJob scheduledJob = new ScheduledJob();
+        scheduledJob.setCrawler(true);
+        return asHtml(path_AdminScheduledjob_EditJsp).useForm(
+                org.codelibs.fess.app.web.admin.scheduledjob.CreateForm.class,
+                op -> {
+                    op.setup(scheduledJobForm -> {
+                        scheduledJobForm.initialize();
+                        scheduledJobForm.crudMode = CrudMode.CREATE;
+                        scheduledJobForm.jobLogging = Constants.ON;
+                        scheduledJobForm.crawler = Constants.ON;
+                        scheduledJobForm.available = Constants.ON;
+                        scheduledJobForm.name =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.web_crawling_job_title", form.id);
+                        scheduledJobForm.scriptData =
+                                ComponentUtil.getMessageManager().getMessage(LaRequestUtil.getRequest().getLocale(),
+                                        "labels.scheduledjob_script_template", "\"" + form.id + "\"", "", "");
+                    });
+                });
+    }
+
     // -----------------------------------------------------
     // -----------------------------------------------------
     //                                               Details
     //                                               Details
     //                                               -------
     //                                               -------

+ 21 - 0
src/main/java/org/codelibs/fess/mylasta/action/FessLabels.java

@@ -1010,6 +1010,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Edit */
     /** The key of the message: Edit */
     public static final String LABELS_file_crawling_button_edit = "{labels.file_crawling_button_edit}";
     public static final String LABELS_file_crawling_button_edit = "{labels.file_crawling_button_edit}";
 
 
+    /** The key of the message: Create new job */
+    public static final String LABELS_file_crawling_button_create_job = "{labels.file_crawling_button_create_job}";
+
     /** The key of the message: Create New */
     /** The key of the message: Create New */
     public static final String LABELS_file_crawling_link_create_new = "{labels.file_crawling_link_create_new}";
     public static final String LABELS_file_crawling_link_create_new = "{labels.file_crawling_link_create_new}";
 
 
@@ -1040,6 +1043,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Next */
     /** The key of the message: Next */
     public static final String LABELS_file_crawling_link_next_page = "{labels.file_crawling_link_next_page}";
     public static final String LABELS_file_crawling_link_next_page = "{labels.file_crawling_link_next_page}";
 
 
+    /** The key of the message: File Crawler - {0} */
+    public static final String LABELS_file_crawling_job_title = "{labels.file_crawling_job_title}";
+
     /** The key of the message: Web Crawling */
     /** The key of the message: Web Crawling */
     public static final String LABELS_web_crawling_configuration = "{labels.web_crawling_configuration}";
     public static final String LABELS_web_crawling_configuration = "{labels.web_crawling_configuration}";
 
 
@@ -1070,6 +1076,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Confirm */
     /** The key of the message: Confirm */
     public static final String LABELS_web_crawling_button_confirm = "{labels.web_crawling_button_confirm}";
     public static final String LABELS_web_crawling_button_confirm = "{labels.web_crawling_button_confirm}";
 
 
+    /** The key of the message: Create new job */
+    public static final String LABELS_web_crawling_button_create_job = "{labels.web_crawling_button_create_job}";
+
     /** The key of the message: Confirm Web Crawling Configuration */
     /** The key of the message: Confirm Web Crawling Configuration */
     public static final String LABELS_web_crawling_title_confirm = "{labels.web_crawling_title_confirm}";
     public static final String LABELS_web_crawling_title_confirm = "{labels.web_crawling_title_confirm}";
 
 
@@ -1112,6 +1121,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Next */
     /** The key of the message: Next */
     public static final String LABELS_web_crawling_link_next_page = "{labels.web_crawling_link_next_page}";
     public static final String LABELS_web_crawling_link_next_page = "{labels.web_crawling_link_next_page}";
 
 
+    /** The key of the message: Web Crawler - {0} */
+    public static final String LABELS_web_crawling_job_title = "{labels.web_crawling_job_title}";
+
     /** The key of the message: General Configuration */
     /** The key of the message: General Configuration */
     public static final String LABELS_crawler_configuration = "{labels.crawler_configuration}";
     public static final String LABELS_crawler_configuration = "{labels.crawler_configuration}";
 
 
@@ -2210,6 +2222,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Edit */
     /** The key of the message: Edit */
     public static final String LABELS_data_crawling_button_edit = "{labels.data_crawling_button_edit}";
     public static final String LABELS_data_crawling_button_edit = "{labels.data_crawling_button_edit}";
 
 
+    /** The key of the message: Create new job */
+    public static final String LABELS_data_crawling_button_create_job = "{labels.data_crawling_button_create_job}";
+
     /** The key of the message: Create New */
     /** The key of the message: Create New */
     public static final String LABELS_data_crawling_link_create_new = "{labels.data_crawling_link_create_new}";
     public static final String LABELS_data_crawling_link_create_new = "{labels.data_crawling_link_create_new}";
 
 
@@ -2240,6 +2255,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Next */
     /** The key of the message: Next */
     public static final String LABELS_data_crawling_link_next_page = "{labels.data_crawling_link_next_page}";
     public static final String LABELS_data_crawling_link_next_page = "{labels.data_crawling_link_next_page}";
 
 
+    /** The key of the message: Data Crawler - {0} */
+    public static final String LABELS_data_crawling_job_title = "{labels.data_crawling_job_title}";
+
     /** The key of the message: Configuration Wizard */
     /** The key of the message: Configuration Wizard */
     public static final String LABELS_wizard_title_configuration = "{labels.wizard_title_configuration}";
     public static final String LABELS_wizard_title_configuration = "{labels.wizard_title_configuration}";
 
 
@@ -2896,6 +2914,9 @@ public class FessLabels extends ActionMessages {
     /** The key of the message: Next */
     /** The key of the message: Next */
     public static final String LABELS_scheduledjob_link_next_page = "{labels.scheduledjob_link_next_page}";
     public static final String LABELS_scheduledjob_link_next_page = "{labels.scheduledjob_link_next_page}";
 
 
+    /** The key of the message: return container.getComponent("crawlJob").execute(executor, [{0}] as String[],[{1}] as String[],[{2}] as String[], ""); */
+    public static final String LABELS_scheduledjob_script_template = "{labels.scheduledjob_script_template}";
+
     /** The key of the message: Back */
     /** The key of the message: Back */
     public static final String LABELS_joblog_button_back = "{labels.joblog_button_back}";
     public static final String LABELS_joblog_button_back = "{labels.joblog_button_back}";
 
 

+ 7 - 0
src/main/resources/fess_label.properties

@@ -336,6 +336,7 @@ labels.file_crawling_title_confirm=Confirm File Crawling Configuration
 labels.file_crawling_button_update=Update
 labels.file_crawling_button_update=Update
 labels.file_crawling_button_delete=Delete
 labels.file_crawling_button_delete=Delete
 labels.file_crawling_button_edit=Edit
 labels.file_crawling_button_edit=Edit
+labels.file_crawling_button_create_job=Create new job
 labels.file_crawling_link_create_new=Create New
 labels.file_crawling_link_create_new=Create New
 labels.file_crawling_link_list=List
 labels.file_crawling_link_list=List
 labels.file_crawling_link_create=Create New
 labels.file_crawling_link_create=Create New
@@ -347,6 +348,7 @@ labels.file_crawling_link_edit=Edit
 labels.file_crawling_link_delete=Delete
 labels.file_crawling_link_delete=Delete
 labels.file_crawling_link_prev_page=Prev
 labels.file_crawling_link_prev_page=Prev
 labels.file_crawling_link_next_page=Next
 labels.file_crawling_link_next_page=Next
+labels.file_crawling_job_title=File Crawler - {0}
 labels.web_crawling_configuration=Web Crawling
 labels.web_crawling_configuration=Web Crawling
 labels.web_crawling_title_details=Web Crawling Configuration
 labels.web_crawling_title_details=Web Crawling Configuration
 labels.included_urls=Included URLs For Crawling
 labels.included_urls=Included URLs For Crawling
@@ -357,6 +359,7 @@ labels.user_agent=User Agent
 labels.web_crawling_button_create=Create
 labels.web_crawling_button_create=Create
 labels.web_crawling_button_back=Back
 labels.web_crawling_button_back=Back
 labels.web_crawling_button_confirm=Confirm
 labels.web_crawling_button_confirm=Confirm
+labels.web_crawling_button_create_job=Create new job
 labels.web_crawling_title_confirm=Confirm Web Crawling Configuration
 labels.web_crawling_title_confirm=Confirm Web Crawling Configuration
 labels.web_crawling_button_update=Update
 labels.web_crawling_button_update=Update
 labels.web_crawling_button_delete=Delete
 labels.web_crawling_button_delete=Delete
@@ -372,6 +375,7 @@ labels.web_crawling_link_edit=Edit
 labels.web_crawling_link_delete=Delete
 labels.web_crawling_link_delete=Delete
 labels.web_crawling_link_prev_page=Prev
 labels.web_crawling_link_prev_page=Prev
 labels.web_crawling_link_next_page=Next
 labels.web_crawling_link_next_page=Next
+labels.web_crawling_job_title=Web Crawler - {0}
 labels.crawler_configuration=General Configuration
 labels.crawler_configuration=General Configuration
 labels.crawler_title_edit=General Configuration
 labels.crawler_title_edit=General Configuration
 labels.schedule=Schedule
 labels.schedule=Schedule
@@ -753,6 +757,7 @@ labels.data_crawling_title_confirm=Confirm Data Crawling Configuration
 labels.data_crawling_button_update=Update
 labels.data_crawling_button_update=Update
 labels.data_crawling_button_delete=Delete
 labels.data_crawling_button_delete=Delete
 labels.data_crawling_button_edit=Edit
 labels.data_crawling_button_edit=Edit
+labels.data_crawling_button_create_job=Create new job
 labels.data_crawling_link_create_new=Create New
 labels.data_crawling_link_create_new=Create New
 labels.data_crawling_link_list=List
 labels.data_crawling_link_list=List
 labels.data_crawling_link_create=Create New
 labels.data_crawling_link_create=Create New
@@ -764,6 +769,7 @@ labels.data_crawling_link_edit=Edit
 labels.data_crawling_link_delete=Delete
 labels.data_crawling_link_delete=Delete
 labels.data_crawling_link_prev_page=Prev
 labels.data_crawling_link_prev_page=Prev
 labels.data_crawling_link_next_page=Next
 labels.data_crawling_link_next_page=Next
+labels.data_crawling_job_title=Data Crawler - {0}
 labels.wizard_title_configuration=Configuration Wizard
 labels.wizard_title_configuration=Configuration Wizard
 labels.wizard_start_title=Quick Setup
 labels.wizard_start_title=Quick Setup
 labels.wizard_start_desc=Using Configuration Wizard, you can create crawling settings easily.
 labels.wizard_start_desc=Using Configuration Wizard, you can create crawling settings easily.
@@ -988,6 +994,7 @@ labels.scheduledjob_link_edit=Edit
 labels.scheduledjob_link_delete=Delete
 labels.scheduledjob_link_delete=Delete
 labels.scheduledjob_link_prev_page=Prev
 labels.scheduledjob_link_prev_page=Prev
 labels.scheduledjob_link_next_page=Next
 labels.scheduledjob_link_next_page=Next
+labels.scheduledjob_script_template=return container.getComponent("crawlJob").execute(executor, [{0}] as String[],[{1}] as String[],[{2}] as String[], "");
 labels.joblog_button_back=Back
 labels.joblog_button_back=Back
 labels.joblog_button_create=Create
 labels.joblog_button_create=Create
 labels.joblog_button_delete=Delete
 labels.joblog_button_delete=Delete

+ 5 - 0
src/main/webapp/WEB-INF/view/admin/dataconfig/details.jsp

@@ -130,6 +130,11 @@
 								<!-- /.box-body -->
 								<!-- /.box-body -->
 								<div class="box-footer">
 								<div class="box-footer">
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
+									<button type="submit" class="btn btn-success" name="createnewjob"
+										value="createnewjob">
+										<i class="fa fa-plus-circle"></i>
+										<la:message key="labels.data_crawling_button_create_job" />
+									</button>
 								</div>
 								</div>
 								<!-- /.box-footer -->
 								<!-- /.box-footer -->
 							</div>
 							</div>

+ 5 - 0
src/main/webapp/WEB-INF/view/admin/fileconfig/details.jsp

@@ -160,6 +160,11 @@
 								<!-- /.box-body -->
 								<!-- /.box-body -->
 								<div class="box-footer">
 								<div class="box-footer">
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
+									<button type="submit" class="btn btn-success" name="createnewjob"
+										value="createnewjob">
+										<i class="fa fa-plus-circle"></i>
+										<la:message key="labels.file_crawling_button_create_job" />
+									</button>
 								</div>
 								</div>
 								<!-- /.box-footer -->
 								<!-- /.box-footer -->
 							</div>
 							</div>

+ 5 - 0
src/main/webapp/WEB-INF/view/admin/webconfig/details.jsp

@@ -164,6 +164,11 @@
 								<!-- /.box-body -->
 								<!-- /.box-body -->
 								<div class="box-footer">
 								<div class="box-footer">
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
 									<jsp:include page="/WEB-INF/view/common/admin/crud/buttons.jsp"></jsp:include>
+									<button type="submit" class="btn btn-success" name="createnewjob"
+										value="createnewjob">
+										<i class="fa fa-plus-circle"></i>
+										<la:message key="labels.web_crawling_button_create_job" />
+									</button>
 								</div>
 								</div>
 								<!-- /.box-footer -->
 								<!-- /.box-footer -->
 							</div>
 							</div>