diff --git a/src/main/java/org/codelibs/fess/crud/service/BsJobLogService.java b/src/main/java/org/codelibs/fess/crud/service/BsJobLogService.java deleted file mode 100644 index be86917f5..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsJobLogService.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.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 getJobLogList(final JobLogPager jobLogPager) { - - final PagingResultBean 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 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 keys) { - } - - protected void setupStoreCondition(final JobLog jobLog) { - } - - protected void setupDeleteCondition(final JobLog jobLog) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsKeyMatchService.java b/src/main/java/org/codelibs/fess/crud/service/BsKeyMatchService.java deleted file mode 100644 index bff71d547..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsKeyMatchService.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.KeyMatchCB; -import org.codelibs.fess.db.exbhv.KeyMatchBhv; -import org.codelibs.fess.db.exentity.KeyMatch; -import org.codelibs.fess.pager.KeyMatchPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsKeyMatchService { - - @Resource - protected KeyMatchBhv keyMatchBhv; - - public BsKeyMatchService() { - super(); - } - - public List getKeyMatchList(final KeyMatchPager keyMatchPager) { - - final PagingResultBean keyMatchList = keyMatchBhv.selectPage(cb -> { - cb.paging(keyMatchPager.getPageSize(), keyMatchPager.getCurrentPageNumber()); - setupListCondition(cb, keyMatchPager); - }); - - // update pager - Beans.copy(keyMatchList, keyMatchPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - keyMatchPager.setPageNumberList(keyMatchList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return keyMatchList; - } - - public KeyMatch getKeyMatch(final Map keys) { - final KeyMatch keyMatch = keyMatchBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (keyMatch == null) { - // TODO exception? - return null; - } - - return keyMatch; - } - - public void store(final KeyMatch keyMatch) throws CrudMessageException { - setupStoreCondition(keyMatch); - - keyMatchBhv.insertOrUpdate(keyMatch); - - } - - public void delete(final KeyMatch keyMatch) throws CrudMessageException { - setupDeleteCondition(keyMatch); - - keyMatchBhv.delete(keyMatch); - - } - - protected void setupListCondition(final KeyMatchCB cb, final KeyMatchPager keyMatchPager) { - - if (keyMatchPager.id != null) { - cb.query().setId_Equal(Long.parseLong(keyMatchPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final KeyMatchCB cb, final Map keys) { - } - - protected void setupStoreCondition(final KeyMatch keyMatch) { - } - - protected void setupDeleteCondition(final KeyMatch keyMatch) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsLabelTypeService.java b/src/main/java/org/codelibs/fess/crud/service/BsLabelTypeService.java deleted file mode 100644 index 98668de1b..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsLabelTypeService.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.LabelTypeCB; -import org.codelibs.fess.db.exbhv.LabelTypeBhv; -import org.codelibs.fess.db.exentity.LabelType; -import org.codelibs.fess.pager.LabelTypePager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsLabelTypeService { - - @Resource - protected LabelTypeBhv labelTypeBhv; - - public BsLabelTypeService() { - super(); - } - - public List getLabelTypeList(final LabelTypePager labelTypePager) { - - final PagingResultBean labelTypeList = labelTypeBhv.selectPage(cb -> { - cb.paging(labelTypePager.getPageSize(), labelTypePager.getCurrentPageNumber()); - setupListCondition(cb, labelTypePager); - }); - - // update pager - Beans.copy(labelTypeList, labelTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - labelTypePager.setPageNumberList(labelTypeList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return labelTypeList; - } - - public LabelType getLabelType(final Map keys) { - final LabelType labelType = labelTypeBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (labelType == null) { - // TODO exception? - return null; - } - - return labelType; - } - - public void store(final LabelType labelType) throws CrudMessageException { - setupStoreCondition(labelType); - - labelTypeBhv.insertOrUpdate(labelType); - - } - - public void delete(final LabelType labelType) throws CrudMessageException { - setupDeleteCondition(labelType); - - labelTypeBhv.delete(labelType); - - } - - protected void setupListCondition(final LabelTypeCB cb, final LabelTypePager labelTypePager) { - - if (labelTypePager.id != null) { - cb.query().setId_Equal(Long.parseLong(labelTypePager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final LabelTypeCB cb, final Map keys) { - } - - protected void setupStoreCondition(final LabelType labelType) { - } - - protected void setupDeleteCondition(final LabelType labelType) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsOverlappingHostService.java b/src/main/java/org/codelibs/fess/crud/service/BsOverlappingHostService.java deleted file mode 100644 index d61a8a96b..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsOverlappingHostService.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.OverlappingHostCB; -import org.codelibs.fess.db.exbhv.OverlappingHostBhv; -import org.codelibs.fess.db.exentity.OverlappingHost; -import org.codelibs.fess.pager.OverlappingHostPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsOverlappingHostService { - - @Resource - protected OverlappingHostBhv overlappingHostBhv; - - public BsOverlappingHostService() { - super(); - } - - public List getOverlappingHostList(final OverlappingHostPager overlappingHostPager) { - - final PagingResultBean overlappingHostList = overlappingHostBhv.selectPage(cb -> { - cb.paging(overlappingHostPager.getPageSize(), overlappingHostPager.getCurrentPageNumber()); - setupListCondition(cb, overlappingHostPager); - }); - - // update pager - Beans.copy(overlappingHostList, overlappingHostPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - overlappingHostPager.setPageNumberList(overlappingHostList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return overlappingHostList; - } - - public OverlappingHost getOverlappingHost(final Map keys) { - final OverlappingHost overlappingHost = overlappingHostBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (overlappingHost == null) { - // TODO exception? - return null; - } - - return overlappingHost; - } - - public void store(final OverlappingHost overlappingHost) throws CrudMessageException { - setupStoreCondition(overlappingHost); - - overlappingHostBhv.insertOrUpdate(overlappingHost); - - } - - public void delete(final OverlappingHost overlappingHost) throws CrudMessageException { - setupDeleteCondition(overlappingHost); - - overlappingHostBhv.delete(overlappingHost); - - } - - protected void setupListCondition(final OverlappingHostCB cb, final OverlappingHostPager overlappingHostPager) { - - if (overlappingHostPager.id != null) { - cb.query().setId_Equal(Long.parseLong(overlappingHostPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final OverlappingHostCB cb, final Map keys) { - } - - protected void setupStoreCondition(final OverlappingHost overlappingHost) { - } - - protected void setupDeleteCondition(final OverlappingHost overlappingHost) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsPathMappingService.java b/src/main/java/org/codelibs/fess/crud/service/BsPathMappingService.java deleted file mode 100644 index 463f61384..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsPathMappingService.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.PathMappingCB; -import org.codelibs.fess.db.exbhv.PathMappingBhv; -import org.codelibs.fess.db.exentity.PathMapping; -import org.codelibs.fess.pager.PathMappingPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsPathMappingService { - - @Resource - protected PathMappingBhv pathMappingBhv; - - public BsPathMappingService() { - super(); - } - - public List getPathMappingList(final PathMappingPager pathMappingPager) { - - final PagingResultBean pathMappingList = pathMappingBhv.selectPage(cb -> { - cb.paging(pathMappingPager.getPageSize(), pathMappingPager.getCurrentPageNumber()); - setupListCondition(cb, pathMappingPager); - }); - - // update pager - Beans.copy(pathMappingList, pathMappingPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - pathMappingPager.setPageNumberList(pathMappingList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return pathMappingList; - } - - public PathMapping getPathMapping(final Map keys) { - final PathMapping pathMapping = pathMappingBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (pathMapping == null) { - // TODO exception? - return null; - } - - return pathMapping; - } - - public void store(final PathMapping pathMapping) throws CrudMessageException { - setupStoreCondition(pathMapping); - - pathMappingBhv.insertOrUpdate(pathMapping); - - } - - public void delete(final PathMapping pathMapping) throws CrudMessageException { - setupDeleteCondition(pathMapping); - - pathMappingBhv.delete(pathMapping); - - } - - protected void setupListCondition(final PathMappingCB cb, final PathMappingPager pathMappingPager) { - - if (pathMappingPager.id != null) { - cb.query().setId_Equal(Long.parseLong(pathMappingPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final PathMappingCB cb, final Map keys) { - } - - protected void setupStoreCondition(final PathMapping pathMapping) { - } - - protected void setupDeleteCondition(final PathMapping pathMapping) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsRequestHeaderService.java b/src/main/java/org/codelibs/fess/crud/service/BsRequestHeaderService.java deleted file mode 100644 index 95614be4c..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsRequestHeaderService.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.RequestHeaderCB; -import org.codelibs.fess.db.exbhv.RequestHeaderBhv; -import org.codelibs.fess.db.exentity.RequestHeader; -import org.codelibs.fess.pager.RequestHeaderPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsRequestHeaderService { - - @Resource - protected RequestHeaderBhv requestHeaderBhv; - - public BsRequestHeaderService() { - super(); - } - - public List getRequestHeaderList(final RequestHeaderPager requestHeaderPager) { - - final PagingResultBean requestHeaderList = requestHeaderBhv.selectPage(cb -> { - cb.paging(requestHeaderPager.getPageSize(), requestHeaderPager.getCurrentPageNumber()); - setupListCondition(cb, requestHeaderPager); - }); - - // update pager - Beans.copy(requestHeaderList, requestHeaderPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - requestHeaderPager.setPageNumberList(requestHeaderList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return requestHeaderList; - } - - public RequestHeader getRequestHeader(final Map keys) { - final RequestHeader requestHeader = requestHeaderBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (requestHeader == null) { - // TODO exception? - return null; - } - - return requestHeader; - } - - public void store(final RequestHeader requestHeader) throws CrudMessageException { - setupStoreCondition(requestHeader); - - requestHeaderBhv.insertOrUpdate(requestHeader); - - } - - public void delete(final RequestHeader requestHeader) throws CrudMessageException { - setupDeleteCondition(requestHeader); - - requestHeaderBhv.delete(requestHeader); - - } - - protected void setupListCondition(final RequestHeaderCB cb, final RequestHeaderPager requestHeaderPager) { - - if (requestHeaderPager.id != null) { - cb.query().setId_Equal(Long.parseLong(requestHeaderPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final RequestHeaderCB cb, final Map keys) { - } - - protected void setupStoreCondition(final RequestHeader requestHeader) { - } - - protected void setupDeleteCondition(final RequestHeader requestHeader) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsRoleTypeService.java b/src/main/java/org/codelibs/fess/crud/service/BsRoleTypeService.java deleted file mode 100644 index 78961ef53..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsRoleTypeService.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.RoleTypeCB; -import org.codelibs.fess.db.exbhv.RoleTypeBhv; -import org.codelibs.fess.db.exentity.RoleType; -import org.codelibs.fess.pager.RoleTypePager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsRoleTypeService { - - @Resource - protected RoleTypeBhv roleTypeBhv; - - public BsRoleTypeService() { - super(); - } - - public List getRoleTypeList(final RoleTypePager roleTypePager) { - - final PagingResultBean roleTypeList = roleTypeBhv.selectPage(cb -> { - cb.paging(roleTypePager.getPageSize(), roleTypePager.getCurrentPageNumber()); - setupListCondition(cb, roleTypePager); - }); - - // update pager - Beans.copy(roleTypeList, roleTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - roleTypePager.setPageNumberList(roleTypeList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return roleTypeList; - } - - public RoleType getRoleType(final Map keys) { - final RoleType roleType = roleTypeBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (roleType == null) { - // TODO exception? - return null; - } - - return roleType; - } - - public void store(final RoleType roleType) throws CrudMessageException { - setupStoreCondition(roleType); - - roleTypeBhv.insertOrUpdate(roleType); - - } - - public void delete(final RoleType roleType) throws CrudMessageException { - setupDeleteCondition(roleType); - - roleTypeBhv.delete(roleType); - - } - - protected void setupListCondition(final RoleTypeCB cb, final RoleTypePager roleTypePager) { - - if (roleTypePager.id != null) { - cb.query().setId_Equal(Long.parseLong(roleTypePager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final RoleTypeCB cb, final Map keys) { - } - - protected void setupStoreCondition(final RoleType roleType) { - } - - protected void setupDeleteCondition(final RoleType roleType) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsScheduledJobService.java b/src/main/java/org/codelibs/fess/crud/service/BsScheduledJobService.java deleted file mode 100644 index 1404d9eab..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsScheduledJobService.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.ScheduledJobCB; -import org.codelibs.fess.db.exbhv.ScheduledJobBhv; -import org.codelibs.fess.db.exentity.ScheduledJob; -import org.codelibs.fess.pager.ScheduledJobPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsScheduledJobService { - - @Resource - protected ScheduledJobBhv scheduledJobBhv; - - public BsScheduledJobService() { - super(); - } - - public List getScheduledJobList(final ScheduledJobPager scheduledJobPager) { - - final PagingResultBean scheduledJobList = scheduledJobBhv.selectPage(cb -> { - cb.paging(scheduledJobPager.getPageSize(), scheduledJobPager.getCurrentPageNumber()); - setupListCondition(cb, scheduledJobPager); - }); - - // update pager - Beans.copy(scheduledJobList, scheduledJobPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - scheduledJobPager.setPageNumberList(scheduledJobList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return scheduledJobList; - } - - public ScheduledJob getScheduledJob(final Map keys) { - final ScheduledJob scheduledJob = scheduledJobBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (scheduledJob == null) { - // TODO exception? - return null; - } - - return scheduledJob; - } - - public void store(final ScheduledJob scheduledJob) throws CrudMessageException { - setupStoreCondition(scheduledJob); - - scheduledJobBhv.insertOrUpdate(scheduledJob); - - } - - public void delete(final ScheduledJob scheduledJob) throws CrudMessageException { - setupDeleteCondition(scheduledJob); - - scheduledJobBhv.delete(scheduledJob); - - } - - protected void setupListCondition(final ScheduledJobCB cb, final ScheduledJobPager scheduledJobPager) { - - if (scheduledJobPager.id != null) { - cb.query().setId_Equal(Long.parseLong(scheduledJobPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final ScheduledJobCB cb, final Map keys) { - } - - protected void setupStoreCondition(final ScheduledJob scheduledJob) { - } - - protected void setupDeleteCondition(final ScheduledJob scheduledJob) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsSearchLogService.java b/src/main/java/org/codelibs/fess/crud/service/BsSearchLogService.java deleted file mode 100644 index d69b1d29c..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsSearchLogService.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.SearchLogCB; -import org.codelibs.fess.db.exbhv.SearchLogBhv; -import org.codelibs.fess.db.exentity.SearchLog; -import org.codelibs.fess.pager.SearchLogPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsSearchLogService { - - @Resource - protected SearchLogBhv searchLogBhv; - - public BsSearchLogService() { - super(); - } - - public List getSearchLogList(final SearchLogPager searchLogPager) { - - final PagingResultBean searchLogList = searchLogBhv.selectPage(cb -> { - cb.paging(searchLogPager.getPageSize(), searchLogPager.getCurrentPageNumber()); - setupListCondition(cb, searchLogPager); - }); - - // update pager - Beans.copy(searchLogList, searchLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - searchLogPager.setPageNumberList(searchLogList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return searchLogList; - } - - public SearchLog getSearchLog(final Map keys) { - final SearchLog searchLog = searchLogBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (searchLog == null) { - // TODO exception? - return null; - } - - return searchLog; - } - - public void store(final SearchLog searchLog) throws CrudMessageException { - setupStoreCondition(searchLog); - - searchLogBhv.insertOrUpdate(searchLog); - - } - - public void delete(final SearchLog searchLog) throws CrudMessageException { - setupDeleteCondition(searchLog); - - searchLogBhv.delete(searchLog); - - } - - protected void setupListCondition(final SearchLogCB cb, final SearchLogPager searchLogPager) { - - if (searchLogPager.id != null) { - cb.query().setId_Equal(Long.parseLong(searchLogPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final SearchLogCB cb, final Map keys) { - } - - protected void setupStoreCondition(final SearchLog searchLog) { - } - - protected void setupDeleteCondition(final SearchLog searchLog) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsSuggestBadWordService.java b/src/main/java/org/codelibs/fess/crud/service/BsSuggestBadWordService.java deleted file mode 100644 index 88f8435d5..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsSuggestBadWordService.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.SuggestBadWordCB; -import org.codelibs.fess.db.exbhv.SuggestBadWordBhv; -import org.codelibs.fess.db.exentity.SuggestBadWord; -import org.codelibs.fess.pager.SuggestBadWordPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsSuggestBadWordService { - - @Resource - protected SuggestBadWordBhv suggestBadWordBhv; - - public BsSuggestBadWordService() { - super(); - } - - public List getSuggestBadWordList(final SuggestBadWordPager suggestBadWordPager) { - - final PagingResultBean suggestBadWordList = suggestBadWordBhv.selectPage(cb -> { - cb.paging(suggestBadWordPager.getPageSize(), suggestBadWordPager.getCurrentPageNumber()); - setupListCondition(cb, suggestBadWordPager); - }); - - // update pager - Beans.copy(suggestBadWordList, suggestBadWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - suggestBadWordPager.setPageNumberList(suggestBadWordList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return suggestBadWordList; - } - - public SuggestBadWord getSuggestBadWord(final Map keys) { - final SuggestBadWord suggestBadWord = suggestBadWordBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (suggestBadWord == null) { - // TODO exception? - return null; - } - - return suggestBadWord; - } - - public void store(final SuggestBadWord suggestBadWord) throws CrudMessageException { - setupStoreCondition(suggestBadWord); - - suggestBadWordBhv.insertOrUpdate(suggestBadWord); - - } - - public void delete(final SuggestBadWord suggestBadWord) throws CrudMessageException { - setupDeleteCondition(suggestBadWord); - - suggestBadWordBhv.delete(suggestBadWord); - - } - - protected void setupListCondition(final SuggestBadWordCB cb, final SuggestBadWordPager suggestBadWordPager) { - - if (suggestBadWordPager.id != null) { - cb.query().setId_Equal(Long.parseLong(suggestBadWordPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final SuggestBadWordCB cb, final Map keys) { - } - - protected void setupStoreCondition(final SuggestBadWord suggestBadWord) { - } - - protected void setupDeleteCondition(final SuggestBadWord suggestBadWord) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsSuggestElevateWordService.java b/src/main/java/org/codelibs/fess/crud/service/BsSuggestElevateWordService.java deleted file mode 100644 index 9f5658f10..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsSuggestElevateWordService.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.SuggestElevateWordCB; -import org.codelibs.fess.db.exbhv.SuggestElevateWordBhv; -import org.codelibs.fess.db.exentity.SuggestElevateWord; -import org.codelibs.fess.pager.SuggestElevateWordPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsSuggestElevateWordService { - - @Resource - protected SuggestElevateWordBhv suggestElevateWordBhv; - - public BsSuggestElevateWordService() { - super(); - } - - public List getSuggestElevateWordList(final SuggestElevateWordPager suggestElevateWordPager) { - - final PagingResultBean suggestElevateWordList = suggestElevateWordBhv.selectPage(cb -> { - cb.paging(suggestElevateWordPager.getPageSize(), suggestElevateWordPager.getCurrentPageNumber()); - setupListCondition(cb, suggestElevateWordPager); - }); - - // update pager - Beans.copy(suggestElevateWordList, suggestElevateWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - suggestElevateWordPager.setPageNumberList(suggestElevateWordList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return suggestElevateWordList; - } - - public SuggestElevateWord getSuggestElevateWord(final Map keys) { - final SuggestElevateWord suggestElevateWord = suggestElevateWordBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (suggestElevateWord == null) { - // TODO exception? - return null; - } - - return suggestElevateWord; - } - - public void store(final SuggestElevateWord suggestElevateWord) throws CrudMessageException { - setupStoreCondition(suggestElevateWord); - - suggestElevateWordBhv.insertOrUpdate(suggestElevateWord); - - } - - public void delete(final SuggestElevateWord suggestElevateWord) throws CrudMessageException { - setupDeleteCondition(suggestElevateWord); - - suggestElevateWordBhv.delete(suggestElevateWord); - - } - - protected void setupListCondition(final SuggestElevateWordCB cb, final SuggestElevateWordPager suggestElevateWordPager) { - - if (suggestElevateWordPager.id != null) { - cb.query().setId_Equal(Long.parseLong(suggestElevateWordPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final SuggestElevateWordCB cb, final Map keys) { - } - - protected void setupStoreCondition(final SuggestElevateWord suggestElevateWord) { - } - - protected void setupDeleteCondition(final SuggestElevateWord suggestElevateWord) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsUserInfoService.java b/src/main/java/org/codelibs/fess/crud/service/BsUserInfoService.java deleted file mode 100644 index 7c501cae2..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsUserInfoService.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.UserInfoCB; -import org.codelibs.fess.db.exbhv.UserInfoBhv; -import org.codelibs.fess.db.exentity.UserInfo; -import org.codelibs.fess.pager.UserInfoPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsUserInfoService { - - @Resource - protected UserInfoBhv userInfoBhv; - - public BsUserInfoService() { - super(); - } - - public List getUserInfoList(final UserInfoPager userInfoPager) { - - final PagingResultBean userInfoList = userInfoBhv.selectPage(cb -> { - cb.paging(userInfoPager.getPageSize(), userInfoPager.getCurrentPageNumber()); - setupListCondition(cb, userInfoPager); - }); - - // update pager - Beans.copy(userInfoList, userInfoPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - userInfoPager.setPageNumberList(userInfoList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return userInfoList; - } - - public UserInfo getUserInfo(final Map keys) { - final UserInfo userInfo = userInfoBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (userInfo == null) { - // TODO exception? - return null; - } - - return userInfo; - } - - public void store(final UserInfo userInfo) throws CrudMessageException { - setupStoreCondition(userInfo); - - userInfoBhv.insertOrUpdate(userInfo); - - } - - public void delete(final UserInfo userInfo) throws CrudMessageException { - setupDeleteCondition(userInfo); - - userInfoBhv.delete(userInfo); - - } - - protected void setupListCondition(final UserInfoCB cb, final UserInfoPager userInfoPager) { - - if (userInfoPager.id != null) { - cb.query().setId_Equal(Long.parseLong(userInfoPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final UserInfoCB cb, final Map keys) { - } - - protected void setupStoreCondition(final UserInfo userInfo) { - } - - protected void setupDeleteCondition(final UserInfo userInfo) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsWebAuthenticationService.java b/src/main/java/org/codelibs/fess/crud/service/BsWebAuthenticationService.java deleted file mode 100644 index 696c60edb..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsWebAuthenticationService.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.WebAuthenticationCB; -import org.codelibs.fess.db.exbhv.WebAuthenticationBhv; -import org.codelibs.fess.db.exentity.WebAuthentication; -import org.codelibs.fess.pager.WebAuthenticationPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsWebAuthenticationService { - - @Resource - protected WebAuthenticationBhv webAuthenticationBhv; - - public BsWebAuthenticationService() { - super(); - } - - public List getWebAuthenticationList(final WebAuthenticationPager webAuthenticationPager) { - - final PagingResultBean webAuthenticationList = webAuthenticationBhv.selectPage(cb -> { - cb.paging(webAuthenticationPager.getPageSize(), webAuthenticationPager.getCurrentPageNumber()); - setupListCondition(cb, webAuthenticationPager); - }); - - // update pager - Beans.copy(webAuthenticationList, webAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - webAuthenticationPager.setPageNumberList(webAuthenticationList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return webAuthenticationList; - } - - public WebAuthentication getWebAuthentication(final Map keys) { - final WebAuthentication webAuthentication = webAuthenticationBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (webAuthentication == null) { - // TODO exception? - return null; - } - - return webAuthentication; - } - - public void store(final WebAuthentication webAuthentication) throws CrudMessageException { - setupStoreCondition(webAuthentication); - - webAuthenticationBhv.insertOrUpdate(webAuthentication); - - } - - public void delete(final WebAuthentication webAuthentication) throws CrudMessageException { - setupDeleteCondition(webAuthentication); - - webAuthenticationBhv.delete(webAuthentication); - - } - - protected void setupListCondition(final WebAuthenticationCB cb, final WebAuthenticationPager webAuthenticationPager) { - - if (webAuthenticationPager.id != null) { - cb.query().setId_Equal(Long.parseLong(webAuthenticationPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final WebAuthenticationCB cb, final Map keys) { - } - - protected void setupStoreCondition(final WebAuthentication webAuthentication) { - } - - protected void setupDeleteCondition(final WebAuthentication webAuthentication) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/crud/service/BsWebCrawlingConfigService.java b/src/main/java/org/codelibs/fess/crud/service/BsWebCrawlingConfigService.java deleted file mode 100644 index c6a2595ce..000000000 --- a/src/main/java/org/codelibs/fess/crud/service/BsWebCrawlingConfigService.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.WebCrawlingConfigCB; -import org.codelibs.fess.db.exbhv.WebCrawlingConfigBhv; -import org.codelibs.fess.db.exentity.WebCrawlingConfig; -import org.codelibs.fess.pager.WebCrawlingConfigPager; -import org.dbflute.cbean.result.PagingResultBean; -import org.seasar.framework.beans.util.Beans; - -public abstract class BsWebCrawlingConfigService { - - @Resource - protected WebCrawlingConfigBhv webCrawlingConfigBhv; - - public BsWebCrawlingConfigService() { - super(); - } - - public List getWebCrawlingConfigList(final WebCrawlingConfigPager webCrawlingConfigPager) { - - final PagingResultBean webCrawlingConfigList = webCrawlingConfigBhv.selectPage(cb -> { - cb.paging(webCrawlingConfigPager.getPageSize(), webCrawlingConfigPager.getCurrentPageNumber()); - setupListCondition(cb, webCrawlingConfigPager); - }); - - // update pager - Beans.copy(webCrawlingConfigList, webCrawlingConfigPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); - webCrawlingConfigPager.setPageNumberList(webCrawlingConfigList.pageRange(op -> { - op.rangeSize(5); - }).createPageNumberList()); - - return webCrawlingConfigList; - } - - public WebCrawlingConfig getWebCrawlingConfig(final Map keys) { - final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigBhv.selectEntity(cb -> { - cb.query().setId_Equal(Long.parseLong(keys.get("id"))); - setupEntityCondition(cb, keys); - }).orElse(null);//TODO - if (webCrawlingConfig == null) { - // TODO exception? - return null; - } - - return webCrawlingConfig; - } - - public void store(final WebCrawlingConfig webCrawlingConfig) throws CrudMessageException { - setupStoreCondition(webCrawlingConfig); - - webCrawlingConfigBhv.insertOrUpdate(webCrawlingConfig); - - } - - public void delete(final WebCrawlingConfig webCrawlingConfig) throws CrudMessageException { - setupDeleteCondition(webCrawlingConfig); - - webCrawlingConfigBhv.delete(webCrawlingConfig); - - } - - protected void setupListCondition(final WebCrawlingConfigCB cb, final WebCrawlingConfigPager webCrawlingConfigPager) { - - if (webCrawlingConfigPager.id != null) { - cb.query().setId_Equal(Long.parseLong(webCrawlingConfigPager.id)); - } - // TODO Long, Integer, String supported only. - } - - protected void setupEntityCondition(final WebCrawlingConfigCB cb, final Map keys) { - } - - protected void setupStoreCondition(final WebCrawlingConfig webCrawlingConfig) { - } - - protected void setupDeleteCondition(final WebCrawlingConfig webCrawlingConfig) { - } -} \ No newline at end of file diff --git a/src/main/java/org/codelibs/fess/service/JobLogService.java b/src/main/java/org/codelibs/fess/service/JobLogService.java index be567fa9b..5f8306d5c 100644 --- a/src/main/java/org/codelibs/fess/service/JobLogService.java +++ b/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 getJobLogList(final JobLogPager jobLogPager) { + + final PagingResultBean 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 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 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 diff --git a/src/main/java/org/codelibs/fess/service/KeyMatchService.java b/src/main/java/org/codelibs/fess/service/KeyMatchService.java index 2a6ffead8..897bad11a 100644 --- a/src/main/java/org/codelibs/fess/service/KeyMatchService.java +++ b/src/main/java/org/codelibs/fess/service/KeyMatchService.java @@ -20,18 +20,76 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsKeyMatchService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.KeyMatchCB; +import org.codelibs.fess.db.exbhv.KeyMatchBhv; import org.codelibs.fess.db.exentity.KeyMatch; import org.codelibs.fess.pager.KeyMatchPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class KeyMatchService extends BsKeyMatchService implements Serializable { +public class KeyMatchService implements Serializable { private static final long serialVersionUID = 1L; - @Override + @Resource + protected KeyMatchBhv keyMatchBhv; + + public KeyMatchService() { + super(); + } + + public List getKeyMatchList(final KeyMatchPager keyMatchPager) { + + final PagingResultBean keyMatchList = keyMatchBhv.selectPage(cb -> { + cb.paging(keyMatchPager.getPageSize(), keyMatchPager.getCurrentPageNumber()); + setupListCondition(cb, keyMatchPager); + }); + + // update pager + Beans.copy(keyMatchList, keyMatchPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + keyMatchPager.setPageNumberList(keyMatchList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return keyMatchList; + } + + public KeyMatch getKeyMatch(final Map keys) { + final KeyMatch keyMatch = keyMatchBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (keyMatch == null) { + // TODO exception? + return null; + } + + return keyMatch; + } + + public void store(final KeyMatch keyMatch) throws CrudMessageException { + setupStoreCondition(keyMatch); + + keyMatchBhv.insertOrUpdate(keyMatch); + + } + + public void delete(final KeyMatch keyMatch) throws CrudMessageException { + setupDeleteCondition(keyMatch); + + keyMatchBhv.delete(keyMatch); + + } + protected void setupListCondition(final KeyMatchCB cb, final KeyMatchPager keyMatchPager) { - super.setupListCondition(cb, keyMatchPager); + if (keyMatchPager.id != null) { + cb.query().setId_Equal(Long.parseLong(keyMatchPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -41,25 +99,19 @@ public class KeyMatchService extends BsKeyMatchService implements Serializable { } - @Override protected void setupEntityCondition(final KeyMatchCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition } - @Override protected void setupStoreCondition(final KeyMatch keyMatch) { - super.setupStoreCondition(keyMatch); // setup condition } - @Override protected void setupDeleteCondition(final KeyMatch keyMatch) { - super.setupDeleteCondition(keyMatch); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/LabelTypeService.java b/src/main/java/org/codelibs/fess/service/LabelTypeService.java index 090b94605..f075d55d6 100644 --- a/src/main/java/org/codelibs/fess/service/LabelTypeService.java +++ b/src/main/java/org/codelibs/fess/service/LabelTypeService.java @@ -23,8 +23,10 @@ import java.util.Map; import javax.annotation.Resource; -import org.codelibs.fess.crud.service.BsLabelTypeService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.LabelTypeCB; +import org.codelibs.fess.db.exbhv.LabelTypeBhv; import org.codelibs.fess.db.exbhv.LabelTypeToRoleTypeMappingBhv; import org.codelibs.fess.db.exentity.LabelType; import org.codelibs.fess.db.exentity.LabelTypeToRoleTypeMapping; @@ -32,17 +34,51 @@ import org.codelibs.fess.helper.LabelTypeHelper; import org.codelibs.fess.pager.LabelTypePager; import org.codelibs.fess.util.ComponentUtil; import org.dbflute.cbean.result.ListResultBean; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class LabelTypeService extends BsLabelTypeService implements Serializable { +public class LabelTypeService implements Serializable { private static final long serialVersionUID = 1L; @Resource protected LabelTypeToRoleTypeMappingBhv labelTypeToRoleTypeMappingBhv; - @Override + @Resource + protected LabelTypeBhv labelTypeBhv; + + public LabelTypeService() { + super(); + } + + public List getLabelTypeList(final LabelTypePager labelTypePager) { + + final PagingResultBean labelTypeList = labelTypeBhv.selectPage(cb -> { + cb.paging(labelTypePager.getPageSize(), labelTypePager.getCurrentPageNumber()); + setupListCondition(cb, labelTypePager); + }); + + // update pager + Beans.copy(labelTypeList, labelTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + labelTypePager.setPageNumberList(labelTypeList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return labelTypeList; + } + + public void delete(final LabelType labelType) throws CrudMessageException { + setupDeleteCondition(labelType); + + labelTypeBhv.delete(labelType); + + } + protected void setupListCondition(final LabelTypeCB cb, final LabelTypePager labelTypePager) { - super.setupListCondition(cb, labelTypePager); + if (labelTypePager.id != null) { + cb.query().setId_Equal(Long.parseLong(labelTypePager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -52,26 +88,20 @@ public class LabelTypeService extends BsLabelTypeService implements Serializable } - @Override protected void setupEntityCondition(final LabelTypeCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final LabelType labelType) { - super.setupStoreCondition(labelType); // setup condition } - @Override protected void setupDeleteCondition(final LabelType labelType) { - super.setupDeleteCondition(labelType); // setup condition @@ -100,11 +130,12 @@ public class LabelTypeService extends BsLabelTypeService implements Serializable return labelTypeList; } - @Override public void store(final LabelType labelType) { final boolean isNew = labelType.getId() == null; final String[] roleTypeIds = labelType.getRoleTypeIds(); - super.store(labelType); + setupStoreCondition(labelType); + + labelTypeBhv.insertOrUpdate(labelType); final Long labelTypeId = labelType.getId(); if (isNew) { // Insert @@ -156,9 +187,11 @@ public class LabelTypeService extends BsLabelTypeService implements Serializable } } - @Override public LabelType getLabelType(final Map keys) { - final LabelType labelType = super.getLabelType(keys); + final LabelType labelType = labelTypeBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO if (labelType != null) { final List wctrtmList = labelTypeToRoleTypeMappingBhv.selectList(wctrtmCb -> { wctrtmCb.query().setLabelTypeId_Equal(labelType.getId()); diff --git a/src/main/java/org/codelibs/fess/service/OverlappingHostService.java b/src/main/java/org/codelibs/fess/service/OverlappingHostService.java index 171135cd6..46f2260e3 100644 --- a/src/main/java/org/codelibs/fess/service/OverlappingHostService.java +++ b/src/main/java/org/codelibs/fess/service/OverlappingHostService.java @@ -20,15 +20,71 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsOverlappingHostService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.OverlappingHostCB; +import org.codelibs.fess.db.exbhv.OverlappingHostBhv; import org.codelibs.fess.db.exentity.OverlappingHost; import org.codelibs.fess.pager.OverlappingHostPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class OverlappingHostService extends BsOverlappingHostService implements Serializable { +public class OverlappingHostService implements Serializable { private static final long serialVersionUID = 1L; + @Resource + protected OverlappingHostBhv overlappingHostBhv; + + public OverlappingHostService() { + super(); + } + + public List getOverlappingHostList(final OverlappingHostPager overlappingHostPager) { + + final PagingResultBean overlappingHostList = overlappingHostBhv.selectPage(cb -> { + cb.paging(overlappingHostPager.getPageSize(), overlappingHostPager.getCurrentPageNumber()); + setupListCondition(cb, overlappingHostPager); + }); + + // update pager + Beans.copy(overlappingHostList, overlappingHostPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + overlappingHostPager.setPageNumberList(overlappingHostList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return overlappingHostList; + } + + public OverlappingHost getOverlappingHost(final Map keys) { + final OverlappingHost overlappingHost = overlappingHostBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (overlappingHost == null) { + // TODO exception? + return null; + } + + return overlappingHost; + } + + public void store(final OverlappingHost overlappingHost) throws CrudMessageException { + setupStoreCondition(overlappingHost); + + overlappingHostBhv.insertOrUpdate(overlappingHost); + + } + + public void delete(final OverlappingHost overlappingHost) throws CrudMessageException { + setupDeleteCondition(overlappingHost); + + overlappingHostBhv.delete(overlappingHost); + + } + public List getOverlappingHostList() { return overlappingHostBhv.selectList(cb -> { @@ -39,9 +95,11 @@ public class OverlappingHostService extends BsOverlappingHostService implements }); } - @Override protected void setupListCondition(final OverlappingHostCB cb, final OverlappingHostPager overlappingHostPager) { - super.setupListCondition(cb, overlappingHostPager); + if (overlappingHostPager.id != null) { + cb.query().setId_Equal(Long.parseLong(overlappingHostPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -51,26 +109,20 @@ public class OverlappingHostService extends BsOverlappingHostService implements } - @Override protected void setupEntityCondition(final OverlappingHostCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final OverlappingHost overlappingHost) { - super.setupStoreCondition(overlappingHost); // setup condition } - @Override protected void setupDeleteCondition(final OverlappingHost overlappingHost) { - super.setupDeleteCondition(overlappingHost); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/PathMappingService.java b/src/main/java/org/codelibs/fess/service/PathMappingService.java index 1f7aee6da..4380494f3 100644 --- a/src/main/java/org/codelibs/fess/service/PathMappingService.java +++ b/src/main/java/org/codelibs/fess/service/PathMappingService.java @@ -21,16 +21,72 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsPathMappingService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.allcommon.CDef; import org.codelibs.fess.db.cbean.PathMappingCB; +import org.codelibs.fess.db.exbhv.PathMappingBhv; import org.codelibs.fess.db.exentity.PathMapping; import org.codelibs.fess.pager.PathMappingPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class PathMappingService extends BsPathMappingService implements Serializable { +public class PathMappingService implements Serializable { private static final long serialVersionUID = 1L; + @Resource + protected PathMappingBhv pathMappingBhv; + + public PathMappingService() { + super(); + } + + public List getPathMappingList(final PathMappingPager pathMappingPager) { + + final PagingResultBean pathMappingList = pathMappingBhv.selectPage(cb -> { + cb.paging(pathMappingPager.getPageSize(), pathMappingPager.getCurrentPageNumber()); + setupListCondition(cb, pathMappingPager); + }); + + // update pager + Beans.copy(pathMappingList, pathMappingPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + pathMappingPager.setPageNumberList(pathMappingList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return pathMappingList; + } + + public PathMapping getPathMapping(final Map keys) { + final PathMapping pathMapping = pathMappingBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (pathMapping == null) { + // TODO exception? + return null; + } + + return pathMapping; + } + + public void store(final PathMapping pathMapping) throws CrudMessageException { + setupStoreCondition(pathMapping); + + pathMappingBhv.insertOrUpdate(pathMapping); + + } + + public void delete(final PathMapping pathMapping) throws CrudMessageException { + setupDeleteCondition(pathMapping); + + pathMappingBhv.delete(pathMapping); + + } + public List getPathMappingList(final Collection cdefList) { return pathMappingBhv.selectList(cb -> { @@ -40,9 +96,11 @@ public class PathMappingService extends BsPathMappingService implements Serializ }); } - @Override protected void setupListCondition(final PathMappingCB cb, final PathMappingPager pathMappingPager) { - super.setupListCondition(cb, pathMappingPager); + if (pathMappingPager.id != null) { + cb.query().setId_Equal(Long.parseLong(pathMappingPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -52,26 +110,20 @@ public class PathMappingService extends BsPathMappingService implements Serializ } - @Override protected void setupEntityCondition(final PathMappingCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final PathMapping pathMapping) { - super.setupStoreCondition(pathMapping); // setup condition } - @Override protected void setupDeleteCondition(final PathMapping pathMapping) { - super.setupDeleteCondition(pathMapping); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/RequestHeaderService.java b/src/main/java/org/codelibs/fess/service/RequestHeaderService.java index 92ffe0eaa..45b3d5132 100644 --- a/src/main/java/org/codelibs/fess/service/RequestHeaderService.java +++ b/src/main/java/org/codelibs/fess/service/RequestHeaderService.java @@ -20,18 +20,76 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsRequestHeaderService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.RequestHeaderCB; +import org.codelibs.fess.db.exbhv.RequestHeaderBhv; import org.codelibs.fess.db.exentity.RequestHeader; import org.codelibs.fess.pager.RequestHeaderPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class RequestHeaderService extends BsRequestHeaderService implements Serializable { +public class RequestHeaderService implements Serializable { private static final long serialVersionUID = 1L; - @Override + @Resource + protected RequestHeaderBhv requestHeaderBhv; + + public RequestHeaderService() { + super(); + } + + public List getRequestHeaderList(final RequestHeaderPager requestHeaderPager) { + + final PagingResultBean requestHeaderList = requestHeaderBhv.selectPage(cb -> { + cb.paging(requestHeaderPager.getPageSize(), requestHeaderPager.getCurrentPageNumber()); + setupListCondition(cb, requestHeaderPager); + }); + + // update pager + Beans.copy(requestHeaderList, requestHeaderPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + requestHeaderPager.setPageNumberList(requestHeaderList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return requestHeaderList; + } + + public RequestHeader getRequestHeader(final Map keys) { + final RequestHeader requestHeader = requestHeaderBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (requestHeader == null) { + // TODO exception? + return null; + } + + return requestHeader; + } + + public void store(final RequestHeader requestHeader) throws CrudMessageException { + setupStoreCondition(requestHeader); + + requestHeaderBhv.insertOrUpdate(requestHeader); + + } + + public void delete(final RequestHeader requestHeader) throws CrudMessageException { + setupDeleteCondition(requestHeader); + + requestHeaderBhv.delete(requestHeader); + + } + protected void setupListCondition(final RequestHeaderCB cb, final RequestHeaderPager requestHeaderPager) { - super.setupListCondition(cb, requestHeaderPager); + if (requestHeaderPager.id != null) { + cb.query().setId_Equal(Long.parseLong(requestHeaderPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.setupSelect_WebCrawlingConfig(); @@ -43,26 +101,20 @@ public class RequestHeaderService extends BsRequestHeaderService implements Seri } - @Override protected void setupEntityCondition(final RequestHeaderCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final RequestHeader requestHeader) { - super.setupStoreCondition(requestHeader); // setup condition } - @Override protected void setupDeleteCondition(final RequestHeader requestHeader) { - super.setupDeleteCondition(requestHeader); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/RoleTypeService.java b/src/main/java/org/codelibs/fess/service/RoleTypeService.java index 92e3cfb44..b1f660187 100644 --- a/src/main/java/org/codelibs/fess/service/RoleTypeService.java +++ b/src/main/java/org/codelibs/fess/service/RoleTypeService.java @@ -20,18 +20,76 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsRoleTypeService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.RoleTypeCB; +import org.codelibs.fess.db.exbhv.RoleTypeBhv; import org.codelibs.fess.db.exentity.RoleType; import org.codelibs.fess.pager.RoleTypePager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class RoleTypeService extends BsRoleTypeService implements Serializable { +public class RoleTypeService implements Serializable { private static final long serialVersionUID = 1L; - @Override + @Resource + protected RoleTypeBhv roleTypeBhv; + + public RoleTypeService() { + super(); + } + + public List getRoleTypeList(final RoleTypePager roleTypePager) { + + final PagingResultBean roleTypeList = roleTypeBhv.selectPage(cb -> { + cb.paging(roleTypePager.getPageSize(), roleTypePager.getCurrentPageNumber()); + setupListCondition(cb, roleTypePager); + }); + + // update pager + Beans.copy(roleTypeList, roleTypePager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + roleTypePager.setPageNumberList(roleTypeList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return roleTypeList; + } + + public RoleType getRoleType(final Map keys) { + final RoleType roleType = roleTypeBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (roleType == null) { + // TODO exception? + return null; + } + + return roleType; + } + + public void store(final RoleType roleType) throws CrudMessageException { + setupStoreCondition(roleType); + + roleTypeBhv.insertOrUpdate(roleType); + + } + + public void delete(final RoleType roleType) throws CrudMessageException { + setupDeleteCondition(roleType); + + roleTypeBhv.delete(roleType); + + } + protected void setupListCondition(final RoleTypeCB cb, final RoleTypePager roleTypePager) { - super.setupListCondition(cb, roleTypePager); + if (roleTypePager.id != null) { + cb.query().setId_Equal(Long.parseLong(roleTypePager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -41,26 +99,20 @@ public class RoleTypeService extends BsRoleTypeService implements Serializable { } - @Override protected void setupEntityCondition(final RoleTypeCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final RoleType roleType) { - super.setupStoreCondition(roleType); // setup condition } - @Override protected void setupDeleteCondition(final RoleType roleType) { - super.setupDeleteCondition(roleType); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/ScheduledJobService.java b/src/main/java/org/codelibs/fess/service/ScheduledJobService.java index 780e21328..c23593f76 100644 --- a/src/main/java/org/codelibs/fess/service/ScheduledJobService.java +++ b/src/main/java/org/codelibs/fess/service/ScheduledJobService.java @@ -23,22 +23,71 @@ import java.util.Map; import javax.annotation.Resource; import org.codelibs.fess.Constants; -import org.codelibs.fess.crud.service.BsScheduledJobService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.ScheduledJobCB; +import org.codelibs.fess.db.exbhv.ScheduledJobBhv; import org.codelibs.fess.db.exentity.ScheduledJob; import org.codelibs.fess.job.JobScheduler; import org.codelibs.fess.pager.ScheduledJobPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class ScheduledJobService extends BsScheduledJobService implements Serializable { +public class ScheduledJobService implements Serializable { private static final long serialVersionUID = 1L; + @Resource + protected ScheduledJobBhv scheduledJobBhv; + + public ScheduledJobService() { + super(); + } + + public List getScheduledJobList(final ScheduledJobPager scheduledJobPager) { + + final PagingResultBean scheduledJobList = scheduledJobBhv.selectPage(cb -> { + cb.paging(scheduledJobPager.getPageSize(), scheduledJobPager.getCurrentPageNumber()); + setupListCondition(cb, scheduledJobPager); + }); + + // update pager + Beans.copy(scheduledJobList, scheduledJobPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + scheduledJobPager.setPageNumberList(scheduledJobList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return scheduledJobList; + } + + public ScheduledJob getScheduledJob(final Map keys) { + final ScheduledJob scheduledJob = scheduledJobBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (scheduledJob == null) { + // TODO exception? + return null; + } + + return scheduledJob; + } + + public void delete(final ScheduledJob scheduledJob) throws CrudMessageException { + setupDeleteCondition(scheduledJob); + + scheduledJobBhv.delete(scheduledJob); + + } + @Resource protected JobScheduler jobScheduler; - @Override protected void setupListCondition(final ScheduledJobCB cb, final ScheduledJobPager scheduledJobPager) { - super.setupListCondition(cb, scheduledJobPager); + if (scheduledJobPager.id != null) { + cb.query().setId_Equal(Long.parseLong(scheduledJobPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -49,26 +98,20 @@ public class ScheduledJobService extends BsScheduledJobService implements Serial } - @Override protected void setupEntityCondition(final ScheduledJobCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final ScheduledJob scheduledJob) { - super.setupStoreCondition(scheduledJob); // setup condition } - @Override protected void setupDeleteCondition(final ScheduledJob scheduledJob) { - super.setupDeleteCondition(scheduledJob); // setup condition @@ -82,11 +125,12 @@ public class ScheduledJobService extends BsScheduledJobService implements Serial }); } - @Override public void store(final ScheduledJob scheduledJob) { final boolean isNew = scheduledJob.getId() == null; final boolean isDelete = scheduledJob.getDeletedBy() != null; - super.store(scheduledJob); + setupStoreCondition(scheduledJob); + + scheduledJobBhv.insertOrUpdate(scheduledJob); if (!isNew) { jobScheduler.unregister(scheduledJob); } diff --git a/src/main/java/org/codelibs/fess/service/SearchLogService.java b/src/main/java/org/codelibs/fess/service/SearchLogService.java index 6d442d8a8..38eaf8b22 100644 --- a/src/main/java/org/codelibs/fess/service/SearchLogService.java +++ b/src/main/java/org/codelibs/fess/service/SearchLogService.java @@ -42,22 +42,26 @@ import org.apache.commons.logging.LogFactory; import org.codelibs.core.CoreLibConstants; import org.codelibs.core.util.StringUtil; import org.codelibs.fess.Constants; -import org.codelibs.fess.crud.service.BsSearchLogService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.allcommon.CDef.AccessType; import org.codelibs.fess.db.cbean.ClickLogCB; import org.codelibs.fess.db.cbean.SearchLogCB; import org.codelibs.fess.db.exbhv.ClickLogBhv; import org.codelibs.fess.db.exbhv.SearchFieldLogBhv; +import org.codelibs.fess.db.exbhv.SearchLogBhv; import org.codelibs.fess.db.exentity.SearchFieldLog; import org.codelibs.fess.db.exentity.SearchLog; import org.codelibs.fess.pager.SearchLogPager; import org.codelibs.fess.util.ComponentUtil; import org.dbflute.bhv.readable.EntityRowHandler; import org.dbflute.cbean.result.ListResultBean; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; import com.ibm.icu.text.SimpleDateFormat; -public class SearchLogService extends BsSearchLogService implements Serializable { +public class SearchLogService implements Serializable { private static final Log log = LogFactory.getLog(SearchLogService.class); private static final long serialVersionUID = 1L; @@ -68,9 +72,34 @@ public class SearchLogService extends BsSearchLogService implements Serializable @Resource protected SearchFieldLogBhv searchFieldLogBhv; - @Override + @Resource + protected SearchLogBhv searchLogBhv; + + public SearchLogService() { + super(); + } + + public List getSearchLogList(final SearchLogPager searchLogPager) { + + final PagingResultBean searchLogList = searchLogBhv.selectPage(cb -> { + cb.paging(searchLogPager.getPageSize(), searchLogPager.getCurrentPageNumber()); + setupListCondition(cb, searchLogPager); + }); + + // update pager + Beans.copy(searchLogList, searchLogPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + searchLogPager.setPageNumberList(searchLogList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return searchLogList; + } + protected void setupListCondition(final SearchLogCB cb, final SearchLogPager searchLogPager) { - super.setupListCondition(cb, searchLogPager); + if (searchLogPager.id != null) { + cb.query().setId_Equal(Long.parseLong(searchLogPager.id)); + } + // TODO Long, Integer, String supported only. cb.setupSelect_UserInfo(); // setup condition @@ -113,9 +142,11 @@ public class SearchLogService extends BsSearchLogService implements Serializable buildSearchCondition(searchLogPager, cb); } - @Override public SearchLog getSearchLog(final Map keys) { - final SearchLog searchLog = super.getSearchLog(keys); + final SearchLog searchLog = searchLogBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO if (searchLog != null) { searchLog.setClickLogList(clickLogBhv.selectList(cb -> { cb.query().setSearchId_Equal(searchLog.getId()); @@ -124,37 +155,32 @@ public class SearchLogService extends BsSearchLogService implements Serializable return searchLog; } - @Override protected void setupEntityCondition(final SearchLogCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition } - @Override protected void setupStoreCondition(final SearchLog searchLog) { - super.setupStoreCondition(searchLog); // setup condition } - @Override protected void setupDeleteCondition(final SearchLog searchLog) { - super.setupDeleteCondition(searchLog); // setup condition } - @Override - public void delete(final SearchLog searchLog) { + public void delete(final SearchLog searchLog) throws CrudMessageException { clickLogBhv.batchDelete(searchLog.getClickLogList()); searchFieldLogBhv.varyingQueryDelete(cb -> { cb.query().setSearchId_Equal(searchLog.getId()); }, op -> op.allowNonQueryDelete()); - super.delete(searchLog); + setupDeleteCondition(searchLog); + + searchLogBhv.delete(searchLog); } public void deleteAll(final SearchLogPager searchLogPager) { @@ -545,9 +571,10 @@ public class SearchLogService extends BsSearchLogService implements Serializable } } - @Override - public void store(final SearchLog searchLog) { - super.store(searchLog); + public void store(final SearchLog searchLog) throws CrudMessageException { + setupStoreCondition(searchLog); + + searchLogBhv.insertOrUpdate(searchLog); final List searchFieldLogList = searchLog.getSearchFieldLogList(); if (!searchFieldLogList.isEmpty()) { final List fieldLogList = new ArrayList(); diff --git a/src/main/java/org/codelibs/fess/service/SuggestBadWordService.java b/src/main/java/org/codelibs/fess/service/SuggestBadWordService.java index 2e3acd7c8..e2f9993bb 100644 --- a/src/main/java/org/codelibs/fess/service/SuggestBadWordService.java +++ b/src/main/java/org/codelibs/fess/service/SuggestBadWordService.java @@ -25,6 +25,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.annotation.Resource; + import jp.sf.orangesignal.csv.CsvConfig; import jp.sf.orangesignal.csv.CsvReader; import jp.sf.orangesignal.csv.CsvWriter; @@ -32,14 +34,18 @@ import jp.sf.orangesignal.csv.CsvWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelibs.core.util.StringUtil; -import org.codelibs.fess.crud.service.BsSuggestBadWordService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.SuggestBadWordCB; +import org.codelibs.fess.db.exbhv.SuggestBadWordBhv; import org.codelibs.fess.db.exentity.SuggestBadWord; import org.codelibs.fess.pager.SuggestBadWordPager; import org.codelibs.fess.util.ComponentUtil; import org.dbflute.bhv.readable.EntityRowHandler; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class SuggestBadWordService extends BsSuggestBadWordService implements Serializable { +public class SuggestBadWordService implements Serializable { private static final String DELETE_PREFIX = "--"; @@ -47,9 +53,61 @@ public class SuggestBadWordService extends BsSuggestBadWordService implements Se private static final Log log = LogFactory.getLog(SuggestBadWordService.class); - @Override + @Resource + protected SuggestBadWordBhv suggestBadWordBhv; + + public SuggestBadWordService() { + super(); + } + + public List getSuggestBadWordList(final SuggestBadWordPager suggestBadWordPager) { + + final PagingResultBean suggestBadWordList = suggestBadWordBhv.selectPage(cb -> { + cb.paging(suggestBadWordPager.getPageSize(), suggestBadWordPager.getCurrentPageNumber()); + setupListCondition(cb, suggestBadWordPager); + }); + + // update pager + Beans.copy(suggestBadWordList, suggestBadWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + suggestBadWordPager.setPageNumberList(suggestBadWordList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return suggestBadWordList; + } + + public SuggestBadWord getSuggestBadWord(final Map keys) { + final SuggestBadWord suggestBadWord = suggestBadWordBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (suggestBadWord == null) { + // TODO exception? + return null; + } + + return suggestBadWord; + } + + public void store(final SuggestBadWord suggestBadWord) throws CrudMessageException { + setupStoreCondition(suggestBadWord); + + suggestBadWordBhv.insertOrUpdate(suggestBadWord); + + } + + public void delete(final SuggestBadWord suggestBadWord) throws CrudMessageException { + setupDeleteCondition(suggestBadWord); + + suggestBadWordBhv.delete(suggestBadWord); + + } + protected void setupListCondition(final SuggestBadWordCB cb, final SuggestBadWordPager suggestBadWordPager) { - super.setupListCondition(cb, suggestBadWordPager); + if (suggestBadWordPager.id != null) { + cb.query().setId_Equal(Long.parseLong(suggestBadWordPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -59,25 +117,19 @@ public class SuggestBadWordService extends BsSuggestBadWordService implements Se } - @Override protected void setupEntityCondition(final SuggestBadWordCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition } - @Override protected void setupStoreCondition(final SuggestBadWord suggestBadWord) { - super.setupStoreCondition(suggestBadWord); // setup condition } - @Override protected void setupDeleteCondition(final SuggestBadWord suggestBadWord) { - super.setupDeleteCondition(suggestBadWord); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/SuggestElevateWordService.java b/src/main/java/org/codelibs/fess/service/SuggestElevateWordService.java index 06a6136e0..ece9abef8 100644 --- a/src/main/java/org/codelibs/fess/service/SuggestElevateWordService.java +++ b/src/main/java/org/codelibs/fess/service/SuggestElevateWordService.java @@ -26,6 +26,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import javax.annotation.Resource; + import jp.sf.orangesignal.csv.CsvConfig; import jp.sf.orangesignal.csv.CsvReader; import jp.sf.orangesignal.csv.CsvWriter; @@ -33,22 +35,78 @@ import jp.sf.orangesignal.csv.CsvWriter; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.codelibs.core.util.StringUtil; -import org.codelibs.fess.crud.service.BsSuggestElevateWordService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.SuggestElevateWordCB; +import org.codelibs.fess.db.exbhv.SuggestElevateWordBhv; import org.codelibs.fess.db.exentity.SuggestElevateWord; import org.codelibs.fess.pager.SuggestElevateWordPager; import org.codelibs.fess.util.ComponentUtil; import org.dbflute.bhv.readable.EntityRowHandler; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class SuggestElevateWordService extends BsSuggestElevateWordService implements Serializable { +public class SuggestElevateWordService implements Serializable { private static final long serialVersionUID = 1L; private static final Log log = LogFactory.getLog(SuggestElevateWordService.class); - @Override + @Resource + protected SuggestElevateWordBhv suggestElevateWordBhv; + + public SuggestElevateWordService() { + super(); + } + + public List getSuggestElevateWordList(final SuggestElevateWordPager suggestElevateWordPager) { + + final PagingResultBean suggestElevateWordList = suggestElevateWordBhv.selectPage(cb -> { + cb.paging(suggestElevateWordPager.getPageSize(), suggestElevateWordPager.getCurrentPageNumber()); + setupListCondition(cb, suggestElevateWordPager); + }); + + // update pager + Beans.copy(suggestElevateWordList, suggestElevateWordPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + suggestElevateWordPager.setPageNumberList(suggestElevateWordList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return suggestElevateWordList; + } + + public SuggestElevateWord getSuggestElevateWord(final Map keys) { + final SuggestElevateWord suggestElevateWord = suggestElevateWordBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (suggestElevateWord == null) { + // TODO exception? + return null; + } + + return suggestElevateWord; + } + + public void store(final SuggestElevateWord suggestElevateWord) throws CrudMessageException { + setupStoreCondition(suggestElevateWord); + + suggestElevateWordBhv.insertOrUpdate(suggestElevateWord); + + } + + public void delete(final SuggestElevateWord suggestElevateWord) throws CrudMessageException { + setupDeleteCondition(suggestElevateWord); + + suggestElevateWordBhv.delete(suggestElevateWord); + + } + protected void setupListCondition(final SuggestElevateWordCB cb, final SuggestElevateWordPager suggestElevateWordPager) { - super.setupListCondition(cb, suggestElevateWordPager); + if (suggestElevateWordPager.id != null) { + cb.query().setId_Equal(Long.parseLong(suggestElevateWordPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -58,25 +116,19 @@ public class SuggestElevateWordService extends BsSuggestElevateWordService imple } - @Override protected void setupEntityCondition(final SuggestElevateWordCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition } - @Override protected void setupStoreCondition(final SuggestElevateWord suggestElevateWord) { - super.setupStoreCondition(suggestElevateWord); // setup condition } - @Override protected void setupDeleteCondition(final SuggestElevateWord suggestElevateWord) { - super.setupDeleteCondition(suggestElevateWord); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/UserInfoService.java b/src/main/java/org/codelibs/fess/service/UserInfoService.java index 8d2fea66c..9c70535c7 100644 --- a/src/main/java/org/codelibs/fess/service/UserInfoService.java +++ b/src/main/java/org/codelibs/fess/service/UserInfoService.java @@ -17,21 +17,26 @@ package org.codelibs.fess.service; import java.io.Serializable; +import java.util.List; import java.util.Map; import javax.annotation.Resource; import org.codelibs.core.util.StringUtil; -import org.codelibs.fess.crud.service.BsUserInfoService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.UserInfoCB; import org.codelibs.fess.db.exbhv.FavoriteLogBhv; import org.codelibs.fess.db.exbhv.SearchLogBhv; +import org.codelibs.fess.db.exbhv.UserInfoBhv; import org.codelibs.fess.db.exentity.SearchLog; import org.codelibs.fess.db.exentity.UserInfo; import org.codelibs.fess.pager.UserInfoPager; import org.codelibs.fess.util.ComponentUtil; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class UserInfoService extends BsUserInfoService implements Serializable { +public class UserInfoService implements Serializable { private static final long serialVersionUID = 1L; @@ -41,7 +46,56 @@ public class UserInfoService extends BsUserInfoService implements Serializable { @Resource protected FavoriteLogBhv favoriteLogBhv; - @Override + @Resource + protected UserInfoBhv userInfoBhv; + + public UserInfoService() { + super(); + } + + public List getUserInfoList(final UserInfoPager userInfoPager) { + + final PagingResultBean userInfoList = userInfoBhv.selectPage(cb -> { + cb.paging(userInfoPager.getPageSize(), userInfoPager.getCurrentPageNumber()); + setupListCondition(cb, userInfoPager); + }); + + // update pager + Beans.copy(userInfoList, userInfoPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + userInfoPager.setPageNumberList(userInfoList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return userInfoList; + } + + public UserInfo getUserInfo(final Map keys) { + final UserInfo userInfo = userInfoBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (userInfo == null) { + // TODO exception? + return null; + } + + return userInfo; + } + + public void store(final UserInfo userInfo) throws CrudMessageException { + setupStoreCondition(userInfo); + + userInfoBhv.insertOrUpdate(userInfo); + + } + + public void delete(final UserInfo userInfo) throws CrudMessageException { + setupDeleteCondition(userInfo); + + userInfoBhv.delete(userInfo); + + } + protected void setupListCondition(final UserInfoCB cb, final UserInfoPager userInfoPager) { // setup condition cb.query().addOrderBy_UpdatedTime_Desc(); @@ -52,23 +106,18 @@ public class UserInfoService extends BsUserInfoService implements Serializable { } } - @Override protected void setupEntityCondition(final UserInfoCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition } - @Override protected void setupStoreCondition(final UserInfo userInfo) { - super.setupStoreCondition(userInfo); // setup condition } - @Override protected void setupDeleteCondition(final UserInfo userInfo) { final Long userInfoId = userInfo.getId(); final SearchLog searchLog = new SearchLog(); @@ -81,8 +130,6 @@ public class UserInfoService extends BsUserInfoService implements Serializable { cb2.query().setUserId_Equal(userInfoId); }); - super.setupDeleteCondition(userInfo); - // setup condition } diff --git a/src/main/java/org/codelibs/fess/service/WebAuthenticationService.java b/src/main/java/org/codelibs/fess/service/WebAuthenticationService.java index 2e66e0d78..096e5f5be 100644 --- a/src/main/java/org/codelibs/fess/service/WebAuthenticationService.java +++ b/src/main/java/org/codelibs/fess/service/WebAuthenticationService.java @@ -20,19 +20,76 @@ import java.io.Serializable; import java.util.List; import java.util.Map; -import org.codelibs.fess.crud.service.BsWebAuthenticationService; +import javax.annotation.Resource; + +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.WebAuthenticationCB; +import org.codelibs.fess.db.exbhv.WebAuthenticationBhv; import org.codelibs.fess.db.exentity.WebAuthentication; import org.codelibs.fess.pager.WebAuthenticationPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class WebAuthenticationService extends BsWebAuthenticationService implements Serializable { +public class WebAuthenticationService implements Serializable { private static final long serialVersionUID = 1L; - @Override - protected void setupListCondition(final WebAuthenticationCB cb, final WebAuthenticationPager webAuthenticationPager) { - super.setupListCondition(cb, webAuthenticationPager); + @Resource + protected WebAuthenticationBhv webAuthenticationBhv; + public WebAuthenticationService() { + super(); + } + + public List getWebAuthenticationList(final WebAuthenticationPager webAuthenticationPager) { + + final PagingResultBean webAuthenticationList = webAuthenticationBhv.selectPage(cb -> { + cb.paging(webAuthenticationPager.getPageSize(), webAuthenticationPager.getCurrentPageNumber()); + setupListCondition(cb, webAuthenticationPager); + }); + + // update pager + Beans.copy(webAuthenticationList, webAuthenticationPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + webAuthenticationPager.setPageNumberList(webAuthenticationList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return webAuthenticationList; + } + + public WebAuthentication getWebAuthentication(final Map keys) { + final WebAuthentication webAuthentication = webAuthenticationBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO + if (webAuthentication == null) { + // TODO exception? + return null; + } + + return webAuthentication; + } + + public void store(final WebAuthentication webAuthentication) throws CrudMessageException { + setupStoreCondition(webAuthentication); + + webAuthenticationBhv.insertOrUpdate(webAuthentication); + + } + + public void delete(final WebAuthentication webAuthentication) throws CrudMessageException { + setupDeleteCondition(webAuthentication); + + webAuthenticationBhv.delete(webAuthentication); + + } + + protected void setupListCondition(final WebAuthenticationCB cb, final WebAuthenticationPager webAuthenticationPager) { + if (webAuthenticationPager.id != null) { + cb.query().setId_Equal(Long.parseLong(webAuthenticationPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.setupSelect_WebCrawlingConfig(); cb.query().setDeletedBy_IsNull(); @@ -43,26 +100,20 @@ public class WebAuthenticationService extends BsWebAuthenticationService impleme } - @Override protected void setupEntityCondition(final WebAuthenticationCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final WebAuthentication webAuthentication) { - super.setupStoreCondition(webAuthentication); // setup condition } - @Override protected void setupDeleteCondition(final WebAuthentication webAuthentication) { - super.setupDeleteCondition(webAuthentication); // setup condition diff --git a/src/main/java/org/codelibs/fess/service/WebCrawlingConfigService.java b/src/main/java/org/codelibs/fess/service/WebCrawlingConfigService.java index 63084cea8..6a1b02ca7 100644 --- a/src/main/java/org/codelibs/fess/service/WebCrawlingConfigService.java +++ b/src/main/java/org/codelibs/fess/service/WebCrawlingConfigService.java @@ -24,16 +24,20 @@ import java.util.Map; import javax.annotation.Resource; import org.codelibs.fess.Constants; -import org.codelibs.fess.crud.service.BsWebCrawlingConfigService; +import org.codelibs.fess.crud.CommonConstants; +import org.codelibs.fess.crud.CrudMessageException; import org.codelibs.fess.db.cbean.WebCrawlingConfigCB; import org.codelibs.fess.db.exbhv.WebConfigToLabelTypeMappingBhv; import org.codelibs.fess.db.exbhv.WebConfigToRoleTypeMappingBhv; +import org.codelibs.fess.db.exbhv.WebCrawlingConfigBhv; import org.codelibs.fess.db.exentity.WebConfigToLabelTypeMapping; import org.codelibs.fess.db.exentity.WebConfigToRoleTypeMapping; import org.codelibs.fess.db.exentity.WebCrawlingConfig; import org.codelibs.fess.pager.WebCrawlingConfigPager; +import org.dbflute.cbean.result.PagingResultBean; +import org.seasar.framework.beans.util.Beans; -public class WebCrawlingConfigService extends BsWebCrawlingConfigService implements Serializable { +public class WebCrawlingConfigService implements Serializable { private static final long serialVersionUID = 1L; @@ -43,6 +47,36 @@ public class WebCrawlingConfigService extends BsWebCrawlingConfigService impleme @Resource protected WebConfigToRoleTypeMappingBhv webConfigToRoleTypeMappingBhv; + @Resource + protected WebCrawlingConfigBhv webCrawlingConfigBhv; + + public WebCrawlingConfigService() { + super(); + } + + public List getWebCrawlingConfigList(final WebCrawlingConfigPager webCrawlingConfigPager) { + + final PagingResultBean webCrawlingConfigList = webCrawlingConfigBhv.selectPage(cb -> { + cb.paging(webCrawlingConfigPager.getPageSize(), webCrawlingConfigPager.getCurrentPageNumber()); + setupListCondition(cb, webCrawlingConfigPager); + }); + + // update pager + Beans.copy(webCrawlingConfigList, webCrawlingConfigPager).includes(CommonConstants.PAGER_CONVERSION_RULE).execute(); + webCrawlingConfigPager.setPageNumberList(webCrawlingConfigList.pageRange(op -> { + op.rangeSize(5); + }).createPageNumberList()); + + return webCrawlingConfigList; + } + + public void delete(final WebCrawlingConfig webCrawlingConfig) throws CrudMessageException { + setupDeleteCondition(webCrawlingConfig); + + webCrawlingConfigBhv.delete(webCrawlingConfig); + + } + public List getAllWebCrawlingConfigList() { return getAllWebCrawlingConfigList(true, true, true, null); } @@ -83,9 +117,11 @@ public class WebCrawlingConfigService extends BsWebCrawlingConfigService impleme return list; } - @Override public WebCrawlingConfig getWebCrawlingConfig(final Map keys) { - final WebCrawlingConfig webCrawlingConfig = super.getWebCrawlingConfig(keys); + final WebCrawlingConfig webCrawlingConfig = webCrawlingConfigBhv.selectEntity(cb -> { + cb.query().setId_Equal(Long.parseLong(keys.get("id"))); + setupEntityCondition(cb, keys); + }).orElse(null);//TODO if (webCrawlingConfig != null) { final List wctltmList = webConfigToLabelTypeMappingBhv.selectList(wctltmCb -> { @@ -118,12 +154,13 @@ public class WebCrawlingConfigService extends BsWebCrawlingConfigService impleme return webCrawlingConfig; } - @Override public void store(final WebCrawlingConfig webCrawlingConfig) { final boolean isNew = webCrawlingConfig.getId() == null; final String[] labelTypeIds = webCrawlingConfig.getLabelTypeIds(); final String[] roleTypeIds = webCrawlingConfig.getRoleTypeIds(); - super.store(webCrawlingConfig); + setupStoreCondition(webCrawlingConfig); + + webCrawlingConfigBhv.insertOrUpdate(webCrawlingConfig); final Long webConfigId = webCrawlingConfig.getId(); if (isNew) { // Insert @@ -208,9 +245,11 @@ public class WebCrawlingConfigService extends BsWebCrawlingConfigService impleme } } - @Override protected void setupListCondition(final WebCrawlingConfigCB cb, final WebCrawlingConfigPager webCrawlingConfigPager) { - super.setupListCondition(cb, webCrawlingConfigPager); + if (webCrawlingConfigPager.id != null) { + cb.query().setId_Equal(Long.parseLong(webCrawlingConfigPager.id)); + } + // TODO Long, Integer, String supported only. // setup condition cb.query().setDeletedBy_IsNull(); @@ -221,26 +260,20 @@ public class WebCrawlingConfigService extends BsWebCrawlingConfigService impleme } - @Override protected void setupEntityCondition(final WebCrawlingConfigCB cb, final Map keys) { - super.setupEntityCondition(cb, keys); // setup condition cb.query().setDeletedBy_IsNull(); } - @Override protected void setupStoreCondition(final WebCrawlingConfig webCrawlingConfig) { - super.setupStoreCondition(webCrawlingConfig); // setup condition } - @Override protected void setupDeleteCondition(final WebCrawlingConfig webCrawlingConfig) { - super.setupDeleteCondition(webCrawlingConfig); // setup condition