fix #897 update unscheduled job
This commit is contained in:
parent
2434a1a840
commit
fb02131c9b
2 changed files with 36 additions and 5 deletions
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright 2012-2017 CodeLibs Project and the Others.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||
* either express or implied. See the License for the specific language
|
||||
* governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.codelibs.fess.exception;
|
||||
|
||||
import org.codelibs.fess.es.config.exentity.ScheduledJob;
|
||||
|
||||
public class JobNotFoundException extends FessSystemException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public JobNotFoundException(ScheduledJob scheduledJob) {
|
||||
super(scheduledJob.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -27,6 +27,7 @@ import org.codelibs.fess.es.config.exbhv.JobLogBhv;
|
|||
import org.codelibs.fess.es.config.exbhv.ScheduledJobBhv;
|
||||
import org.codelibs.fess.es.config.exentity.JobLog;
|
||||
import org.codelibs.fess.es.config.exentity.ScheduledJob;
|
||||
import org.codelibs.fess.exception.JobNotFoundException;
|
||||
import org.codelibs.fess.job.ScheduledJobException;
|
||||
import org.codelibs.fess.mylasta.direction.FessConfig;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
|
@ -67,11 +68,13 @@ public class JobHelper {
|
|||
}
|
||||
|
||||
final FessConfig fessConfig = ComponentUtil.getFessConfig();
|
||||
final CronParamsSupplier paramsOp = () -> {
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
params.put(Constants.SCHEDULED_JOB, scheduledJob);
|
||||
return params;
|
||||
};
|
||||
final CronParamsSupplier paramsOp =
|
||||
() -> {
|
||||
final Map<String, Object> params = new HashMap<>();
|
||||
params.put(Constants.SCHEDULED_JOB, ComponentUtil.getComponent(ScheduledJobBhv.class).selectByPK(scheduledJob.getId())
|
||||
.orElseThrow(() -> new JobNotFoundException(scheduledJob)));
|
||||
return params;
|
||||
};
|
||||
findJobByUniqueOf(LaJobUnique.of(id)).ifPresent(job -> {
|
||||
if (!job.isUnscheduled()) {
|
||||
if (StringUtil.isNotBlank(scheduledJob.getCronExpression())) {
|
||||
|
|
Loading…
Add table
Reference in a new issue