diff --git a/src/main/java/org/codelibs/fess/crud/service/BsFileAuthenticationService.java b/src/main/java/org/codelibs/fess/crud/service/BsFileAuthenticationService.java deleted file mode 100644 index 7ef5bec5e..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsFileAuthenticationService.java +++ /dev/null @@ -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.FileAuthenticationCB; -import org.codelibs.fess.db.exbhv.FileAuthenticationBhv; -import org.codelibs.fess.db.exentity.FileAuthentication; -import org.codelibs.fess.pager.FileAuthenticationPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsFileAuthenticationService { - - @Resource - protected FileAuthenticationBhv fileAuthenticationBhv; - - public BsFileAuthenticationService() { - super(); - } - - public List getFileAuthenticationList(final FileAuthenticationPager fileAuthenticationPager) { - - final PagingResultBean fileAuthenticationList = fileAuthenticationBhv.selectPage(cb -> { - cb.paging(fileAuthenticationPager.getPageSize(), fileAuthenticationPager.getCurrentPageNumber()); - setupListCondition(cb, fileAuthenticationPager); - }); - - // update pager - Beans.copy(fileAuthenticationList, fileAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - fileAuthenticationPager.setPageNumberList(fileAuthenticationList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return fileAuthenticationList; - } - - public FileAuthentication getFileAuthentication(final Map keys) { - final FileAuthentication fileAuthentication = fileAuthenticationBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (fileAuthentication == null) { - // TODO exception? - return null; - } - - return fileAuthentication; - } - - public void store(final FileAuthentication fileAuthentication) throws CrudMessageException { - setupStoreCondition(fileAuthentication); - - fileAuthenticationBhv.insertOrUpdate(fileAuthentication); - - } - - public void delete(final FileAuthentication fileAuthentication) throws CrudMessageException { - setupDeleteCondition(fileAuthentication); - - fileAuthenticationBhv.delete(fileAuthentication); - - } - - protected void setupListCondition(final FileAuthenticationCB cb, final FileAuthenticationPager fileAuthenticationPager) { - - if (fileAuthenticationPager.id != null) { - cb.query().setId_Equal(Long.parseLong(fileAuthenticationPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final FileAuthenticationCB cb, final Map keys) { - } - - protected void setupStoreCondition(final FileAuthentication fileAuthentication) { - } - - protected void setupDeleteCondition(final FileAuthentication fileAuthentication) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/service/FileAuthenticationService.java b/src/main/java/org/codelibs/fess/service/FileAuthenticationService.java index d942314fc..6bb004825 100644 --- a/src/main/java/org/codelibs/fess/service/FileAuthenticationService.java +++ b/src/main/java/org/codelibs/fess/service/FileAuthenticationService.java @@ -20,18 +20,76 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsFileAuthenticationService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.FileAuthenticationCB; +import org.codelibs.fess.db.exbhv.FileAuthenticationBhv; import org.codelibs.fess.db.exentity.FileAuthentication; import org.codelibs.fess.pager.FileAuthenticationPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class FileAuthenticationService extends BsFileAuthenticationService implements Serializable { +public class FileAuthenticationService implements Serializable { private static final long serialVersionUID = 1L; - @Override + @Resource + protected FileAuthenticationBhv fileAuthenticationBhv; + + public FileAuthenticationService() { + super(); + } + + public List getFileAuthenticationList(final FileAuthenticationPager fileAuthenticationPager) { + + final PagingResultBean fileAuthenticationList = fileAuthenticationBhv.selectPage(cb -> { + cb.paging(fileAuthenticationPager.getPageSize(), fileAuthenticationPager.getCurrentPageNumber()); + setupListCondition(cb, fileAuthenticationPager); + }); + + // update pager + Beans.copy(fileAuthenticationList, fileAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + fileAuthenticationPager.setPageNumberList(fileAuthenticationList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return fileAuthenticationList; + } + + public FileAuthentication getFileAuthentication(final Map keys) { + final FileAuthentication fileAuthentication = fileAuthenticationBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (fileAuthentication == null) { + // TODO exception? + return null; + } + + return fileAuthentication; + } + + public void store(final FileAuthentication fileAuthentication) throws CrudMessageException { + setupStoreCondition(fileAuthentication); + + fileAuthenticationBhv.insertOrUpdate(fileAuthentication); + + } + + public void delete(final FileAuthentication fileAuthentication) throws CrudMessageException { + setupDeleteCondition(fileAuthentication); + + fileAuthenticationBhv.delete(fileAuthentication); + + } + protected void setupListCondition(final FileAuthenticationCB cb, final FileAuthenticationPager fileAuthenticationPager) { - super.setupListCondition(cb, fileAuthenticationPager); + if (fileAuthenticationPager.id != null) { + cb.query().setId_Equal(Long.parseLong(fileAuthenticationPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.setupSelect_FileCrawlingConfig(); @@ -43,26 +101,20 @@ public class FileAuthenticationService extends BsFileAuthenticationService imple } - @Override protected void setupEntityCondition(final FileAuthenticationCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final FileAuthentication fileAuthentication) { - super.setupStoreCondition(fileAuthentication); // setup condition } - @Override protected void setupDeleteCondition(final FileAuthentication fileAuthentication) { - super.setupDeleteCondition(fileAuthentication); // setup condition