浏览代码

JobLogService.java

Shunji Makino 10 年之前
父节点
当前提交
d3950ea80a

+ 0 - 101
src/main/java/org/codelibs/fess/crud/service/BsJobLogService.java

@@ -1,101 +0,0 @@
-/*
- * Copyright 2009-2015 the 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.crud.service;
-
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.codelibs.fess.crud.CommonConstants;
-import org.codelibs.fess.crud.CrudMessageException;
-import org.codelibs.fess.db.cbean.JobLogCB;
-import org.codelibs.fess.db.exbhv.JobLogBhv;
-import org.codelibs.fess.db.exentity.JobLog;
-import org.codelibs.fess.pager.JobLogPager;
-import org.dbflute.cbean.result.PagingResultBean;
-import org.seasar.framework.beans.util.Beans;
-
-public abstract class BsJobLogService {
-
-    @Resource
-    protected JobLogBhv jobLogBhv;
-
-    public BsJobLogService() {
-        super();
-    }
-
-    public List<JobLog> getJobLogList(final JobLogPager jobLogPager) {
-
-        final PagingResultBean<JobLog> jobLogList = jobLogBhv.selectPage(cb -> {
-            cb.paging(jobLogPager.getPageSize(), jobLogPager.getCurrentPageNumber());
-            setupListCondition(cb, jobLogPager);
-        });
-
-        // update pager
-        Beans.copy(jobLogList, jobLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
-        jobLogPager.setPageNumberList(jobLogList.pageRange(op -> {
-            op.rangeSize(5);
-        }).createPageNumberList());
-
-        return jobLogList;
-    }
-
-    public JobLog getJobLog(final Map<String, String> keys) {
-        final JobLog jobLog = jobLogBhv.selectEntity(cb -> {
-            cb.query().setId_Equal(Long.parseLong(keys.get("id")));
-            setupEntityCondition(cb, keys);
-        }).orElse(null);//TODO
-        if (jobLog == null) {
-            // TODO exception?
-            return null;
-        }
-
-        return jobLog;
-    }
-
-    public void store(final JobLog jobLog) throws CrudMessageException {
-        setupStoreCondition(jobLog);
-
-        jobLogBhv.insertOrUpdate(jobLog);
-
-    }
-
-    public void delete(final JobLog jobLog) throws CrudMessageException {
-        setupDeleteCondition(jobLog);
-
-        jobLogBhv.delete(jobLog);
-
-    }
-
-    protected void setupListCondition(final JobLogCB cb, final JobLogPager jobLogPager) {
-
-        if (jobLogPager.id != null) {
-            cb.query().setId_Equal(Long.parseLong(jobLogPager.id));
-        }
-        // TODO Long, Integer, String supported only.
-    }
-
-    protected void setupEntityCondition(final JobLogCB cb, final Map<String, String> keys) {
-    }
-
-    protected void setupStoreCondition(final JobLog jobLog) {
-    }
-
-    protected void setupDeleteCondition(final JobLog jobLog) {
-    }
-}

+ 62 - 10
src/main/java/org/codelibs/fess/service/JobLogService.java

@@ -21,19 +21,77 @@ import java.time.LocalDateTime;
 import java.util.List;
 import java.util.Map;
 
-import org.codelibs.fess.crud.service.BsJobLogService;
+import javax.annotation.Resource;
+
+import org.codelibs.fess.crud.CommonConstants;
+import org.codelibs.fess.crud.CrudMessageException;
 import org.codelibs.fess.db.cbean.JobLogCB;
+import org.codelibs.fess.db.exbhv.JobLogBhv;
 import org.codelibs.fess.db.exentity.JobLog;
 import org.codelibs.fess.pager.JobLogPager;
 import org.codelibs.fess.util.ComponentUtil;
+import org.dbflute.cbean.result.PagingResultBean;
+import org.seasar.framework.beans.util.Beans;
 
-public class JobLogService extends BsJobLogService implements Serializable {
+public class JobLogService implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @Override
+    @Resource
+    protected JobLogBhv jobLogBhv;
+
+    public JobLogService() {
+        super();
+    }
+
+    public List<JobLog> getJobLogList(final JobLogPager jobLogPager) {
+
+        final PagingResultBean<JobLog> jobLogList = jobLogBhv.selectPage(cb -> {
+            cb.paging(jobLogPager.getPageSize(), jobLogPager.getCurrentPageNumber());
+            setupListCondition(cb, jobLogPager);
+        });
+
+        // update pager
+        Beans.copy(jobLogList, jobLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute();
+        jobLogPager.setPageNumberList(jobLogList.pageRange(op -> {
+            op.rangeSize(5);
+        }).createPageNumberList());
+
+        return jobLogList;
+    }
+
+    public JobLog getJobLog(final Map<String, String> keys) {
+        final JobLog jobLog = jobLogBhv.selectEntity(cb -> {
+            cb.query().setId_Equal(Long.parseLong(keys.get("id")));
+            setupEntityCondition(cb, keys);
+        }).orElse(null);//TODO
+        if (jobLog == null) {
+            // TODO exception?
+            return null;
+        }
+
+        return jobLog;
+    }
+
+    public void store(final JobLog jobLog) throws CrudMessageException {
+        setupStoreCondition(jobLog);
+
+        jobLogBhv.insertOrUpdate(jobLog);
+
+    }
+
+    public void delete(final JobLog jobLog) throws CrudMessageException {
+        setupDeleteCondition(jobLog);
+
+        jobLogBhv.delete(jobLog);
+
+    }
+
     protected void setupListCondition(final JobLogCB cb, final JobLogPager jobLogPager) {
-        super.setupListCondition(cb, jobLogPager);
+        if (jobLogPager.id != null) {
+            cb.query().setId_Equal(Long.parseLong(jobLogPager.id));
+        }
+        // TODO Long, Integer, String supported only.
 
         // setup condition
         cb.query().addOrderBy_StartTime_Desc();
@@ -43,25 +101,19 @@ public class JobLogService extends BsJobLogService implements Serializable {
 
     }
 
-    @Override
     protected void setupEntityCondition(final JobLogCB cb, final Map<String, String> keys) {
-        super.setupEntityCondition(cb, keys);
 
         // setup condition
 
     }
 
-    @Override
     protected void setupStoreCondition(final JobLog jobLog) {
-        super.setupStoreCondition(jobLog);
 
         // setup condition
 
     }
 
-    @Override
     protected void setupDeleteCondition(final JobLog jobLog) {
-        super.setupDeleteCondition(jobLog);
 
         // setup condition