use BeanUtil to copy body to pager
This commit is contained in:
parent
9b32efbf7e
commit
88e01170bd
55 changed files with 112 additions and 138 deletions
|
@ -17,17 +17,24 @@ package org.codelibs.fess.app.web.api.admin;
|
|||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.util.ComponentUtil;
|
||||
import org.lastaflute.web.validation.Required;
|
||||
|
||||
public class BaseSearchBody {
|
||||
|
||||
@Required
|
||||
public Integer size = ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
|
||||
@Required
|
||||
|
||||
public Integer page = Constants.DEFAULT_ADMIN_PAGE_NUMBER;
|
||||
|
||||
public BaseSearchBody() {
|
||||
super();
|
||||
public int getPageSize() {
|
||||
if (size != null) {
|
||||
return size;
|
||||
}
|
||||
return ComponentUtil.getFessConfig().getPagingPageSizeAsInteger();
|
||||
}
|
||||
|
||||
public int getCurrentPageNumber() {
|
||||
if (page != null) {
|
||||
return page;
|
||||
}
|
||||
return Constants.DEFAULT_ADMIN_PAGE_NUMBER;
|
||||
}
|
||||
}
|
|
@ -62,9 +62,7 @@ public class ApiAdminAccesstokenAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final AccessTokenPager pager = new AccessTokenPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
final AccessTokenPager pager = copyBeanToNewBean(body, AccessTokenPager.class);
|
||||
final List<AccessToken> list = accessTokenService.getAccessTokenList(pager);
|
||||
return asJson(new ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.accesstoken;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -57,9 +57,7 @@ public class ApiAdminBadwordAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final BadWordPager pager = new BadWordPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
final BadWordPager pager = copyBeanToNewBean(body, BadWordPager.class);
|
||||
final List<BadWord> list = badWordService.getBadWordList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.badword;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -56,9 +56,7 @@ public class ApiAdminBoostdocAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final BoostDocPager pager = new BoostDocPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
final BoostDocPager pager = copyBeanToNewBean(body, BoostDocPager.class);
|
||||
final List<BoostDocumentRule> list = boostDocumentRuleService.getBoostDocumentRuleList(pager);
|
||||
return asJson(new ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.boostdoc;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.CrawlingInfoPager;
|
||||
import org.codelibs.fess.app.service.CrawlingInfoService;
|
||||
import org.codelibs.fess.app.web.api.ApiResult;
|
||||
|
@ -44,8 +43,6 @@ public class ApiAdminCrawlinginfoAction extends FessApiAdminAction {
|
|||
@Resource
|
||||
private CrawlingInfoService crawlingInfoService;
|
||||
@Resource
|
||||
private CrawlingInfoPager crawlingInfoPager;
|
||||
@Resource
|
||||
protected ProcessHelper processHelper;
|
||||
|
||||
// ===================================================================================
|
||||
|
@ -57,8 +54,7 @@ public class ApiAdminCrawlinginfoAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> logs(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final CrawlingInfoPager pager = new CrawlingInfoPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final CrawlingInfoPager pager = copyBeanToNewBean(body, CrawlingInfoPager.class);
|
||||
final List<CrawlingInfo> list = crawlingInfoService.getCrawlingInfoList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
|
@ -96,7 +92,6 @@ public class ApiAdminCrawlinginfoAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> delete$all() {
|
||||
try {
|
||||
crawlingInfoService.deleteOldSessions(processHelper.getRunningSessionIdSet());
|
||||
crawlingInfoPager.clear();
|
||||
saveInfo(messages -> messages.addSuccessCrawlingInfoDeleteAll(GLOBAL));
|
||||
} catch (final Exception e) {
|
||||
throwValidationErrorApi(messages -> messages.addErrorsCrudFailedToDeleteCrudTable(GLOBAL, buildThrowableMessage(e)));
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.crawlinginfo;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.crawlinginfo.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String sessionId;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.DataConfigPager;
|
||||
import org.codelibs.fess.app.service.DataConfigService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,10 +55,7 @@ public class ApiAdminDataconfigAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final DataConfigPager pager = new DataConfigPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final DataConfigPager pager = copyBeanToNewBean(body, DataConfigPager.class);
|
||||
final List<DataConfig> list = dataConfigService.getDataConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.dataconfig;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package org.codelibs.fess.app.web.api.admin.dict;
|
||||
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
import org.lastaflute.web.validation.Required;
|
||||
|
||||
public class BaseSearchDictBody extends BaseSearchBody {
|
||||
@Required
|
||||
public String dictId;
|
||||
}
|
|
@ -45,10 +45,7 @@ public class ApiAdminDictKuromojiAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
|
||||
body.dictId = dictId;
|
||||
validateApi(body, messages -> {});
|
||||
final KuromojiPager pager = new KuromojiPager();
|
||||
if (body.pageNumber != null) {
|
||||
pager.setCurrentPageNumber(body.pageNumber);
|
||||
}
|
||||
final KuromojiPager pager = copyBeanToNewBean(body, KuromojiPager.class);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(
|
||||
kuromojiService.getKuromojiList(body.dictId, pager).stream()
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.dict.kuromoji;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.dict.kuromoji.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.dict.BaseSearchDictBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public Integer pageNumber;
|
||||
public class SearchBody extends BaseSearchDictBody {
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@ public class ApiAdminDictMappingAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
|
||||
body.dictId = dictId;
|
||||
validateApi(body, messages -> {});
|
||||
final CharMappingPager pager = new CharMappingPager();
|
||||
if (body.pageNumber != null) {
|
||||
pager.setCurrentPageNumber(body.pageNumber);
|
||||
}
|
||||
final CharMappingPager pager = copyBeanToNewBean(body, CharMappingPager.class);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(
|
||||
charMappingService.getCharMappingList(body.dictId, pager).stream()
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.dict.mapping;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.dict.mapping.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.dict.BaseSearchDictBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public Integer pageNumber;
|
||||
public class SearchBody extends BaseSearchDictBody {
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@ public class ApiAdminDictProtwordsAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
|
||||
body.dictId = dictId;
|
||||
validateApi(body, messages -> {});
|
||||
final ProtwordsPager pager = new ProtwordsPager();
|
||||
if (body.pageNumber != null) {
|
||||
pager.setCurrentPageNumber(body.pageNumber);
|
||||
}
|
||||
final ProtwordsPager pager = copyBeanToNewBean(body, ProtwordsPager.class);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(
|
||||
protwordsService.getProtwordsList(body.dictId, pager).stream()
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.dict.protwords;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.dict.protwords.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.dict.BaseSearchDictBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public Integer pageNumber;
|
||||
public class SearchBody extends BaseSearchDictBody {
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@ public class ApiAdminDictSeunjeonAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
|
||||
body.dictId = dictId;
|
||||
validateApi(body, messages -> {});
|
||||
final SeunjeonPager pager = new SeunjeonPager();
|
||||
if (body.pageNumber != null) {
|
||||
pager.setCurrentPageNumber(body.pageNumber);
|
||||
}
|
||||
final SeunjeonPager pager = copyBeanToNewBean(body, SeunjeonPager.class);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(
|
||||
seunjeonService.getSeunjeonList(body.dictId, pager).stream()
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.dict.seunjeon;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.dict.seunjeon.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.dict.BaseSearchDictBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public Integer pageNumber;
|
||||
public class SearchBody extends BaseSearchDictBody {
|
||||
}
|
||||
|
|
|
@ -44,10 +44,7 @@ public class ApiAdminDictSynonymAction extends FessApiAdminAction {
|
|||
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
|
||||
body.dictId = dictId;
|
||||
validateApi(body, messages -> {});
|
||||
final SynonymPager pager = new SynonymPager();
|
||||
if (body.pageNumber != null) {
|
||||
pager.setCurrentPageNumber(body.pageNumber);
|
||||
}
|
||||
final SynonymPager pager = copyBeanToNewBean(body, SynonymPager.class);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(
|
||||
synonymService.getSynonymList(body.dictId, pager).stream()
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.dict.synonym;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.dict.synonym.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.dict.BaseSearchDictBody;
|
||||
|
||||
public class SearchBody extends BaseSearchDictBody {
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public Integer pageNumber;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.DuplicateHostPager;
|
||||
import org.codelibs.fess.app.service.DuplicateHostService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,8 +55,7 @@ public class ApiAdminDuplicatehostAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final DuplicateHostPager pager = new DuplicateHostPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final DuplicateHostPager pager = copyBeanToNewBean(body, DuplicateHostPager.class);
|
||||
final List<DuplicateHost> list = duplicateHostService.getDuplicateHostList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.duplicatehost;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.duplicatehost.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -61,9 +61,7 @@ public class ApiAdminElevatewordAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final ElevateWordPager pager = new ElevateWordPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
final ElevateWordPager pager = copyBeanToNewBean(body, ElevateWordPager.class);
|
||||
final List<ElevateWord> list = elevateWordService.getElevateWordList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,4 +18,5 @@ package org.codelibs.fess.app.web.api.admin.elevateword;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.FailureUrlPager;
|
||||
import org.codelibs.fess.app.service.FailureUrlService;
|
||||
import org.codelibs.fess.app.web.api.ApiResult;
|
||||
|
@ -57,8 +56,7 @@ public class ApiAdminFailureurlAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> logs(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final FailureUrlPager pager = new FailureUrlPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final FailureUrlPager pager = copyBeanToNewBean(body, FailureUrlPager.class);
|
||||
final List<FailureUrl> list = failureUrlService.getFailureUrlList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
|
|
|
@ -15,8 +15,14 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.failureurl;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.failureurl.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String url;
|
||||
|
||||
public Integer errorCountMin;
|
||||
|
||||
public Integer errorCountMax;
|
||||
|
||||
public String errorName;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.FileAuthPager;
|
||||
import org.codelibs.fess.app.service.FileAuthenticationService;
|
||||
import org.codelibs.fess.app.service.FileConfigService;
|
||||
|
@ -60,8 +59,7 @@ public class ApiAdminFileauthAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final FileAuthPager pager = new FileAuthPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final FileAuthPager pager = copyBeanToNewBean(body, FileAuthPager.class);
|
||||
final List<FileAuthentication> list = fileAuthService.getFileAuthenticationList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.fileauth;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.fileauth.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.FileConfigPager;
|
||||
import org.codelibs.fess.app.service.FileConfigService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,10 +55,7 @@ public class ApiAdminFileconfigAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final FileConfigPager pager = new FileConfigPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final FileConfigPager pager = copyBeanToNewBean(body, FileConfigPager.class);
|
||||
final List<FileConfig> list = fileConfigService.getFileConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.fileconfig;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.GroupPager;
|
||||
import org.codelibs.fess.app.service.GroupService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -43,8 +42,7 @@ public class ApiAdminGroupAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final GroupPager pager = new GroupPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final GroupPager pager = copyBeanToNewBean(body, GroupPager.class);
|
||||
final List<Group> list = groupService.getGroupList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.group;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.group.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.JobLogPager;
|
||||
import org.codelibs.fess.app.service.JobLogService;
|
||||
import org.codelibs.fess.app.web.api.ApiResult;
|
||||
|
@ -51,8 +50,7 @@ public class ApiAdminJoblogAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> logs(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final JobLogPager pager = new JobLogPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final JobLogPager pager = copyBeanToNewBean(body, JobLogPager.class);
|
||||
final List<JobLog> list = jobLogService.getJobLogList(pager);
|
||||
return asJson(new ApiResult.ApiLogsResponse<EditBody>()
|
||||
.logs(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList())).total(pager.getAllRecordCount())
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.joblog;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.joblog.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.KeyMatchPager;
|
||||
import org.codelibs.fess.app.service.KeyMatchService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,10 +55,7 @@ public class ApiAdminKeymatchAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final KeyMatchPager pager = new KeyMatchPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final KeyMatchPager pager = copyBeanToNewBean(body, KeyMatchPager.class);
|
||||
final List<KeyMatch> list = keyMatchService.getKeyMatchList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.keymatch;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.LabelTypePager;
|
||||
import org.codelibs.fess.app.service.LabelTypeService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,10 +55,7 @@ public class ApiAdminLabeltypeAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final LabelTypePager pager = new LabelTypePager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final LabelTypePager pager = copyBeanToNewBean(body, LabelTypePager.class);
|
||||
final List<LabelType> list = labelTypeService.getLabelTypeList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.labeltype;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -42,8 +42,7 @@ public class ApiAdminPathmapAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final PathMapPager pager = new PathMapPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final PathMapPager pager = copyBeanToNewBean(body, PathMapPager.class);
|
||||
final List<PathMapping> list = pathMappingService.getPathMappingList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.pathmap;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.pathmap.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.ReqHeaderPager;
|
||||
import org.codelibs.fess.app.service.RequestHeaderService;
|
||||
import org.codelibs.fess.app.service.WebConfigService;
|
||||
|
@ -60,8 +59,7 @@ public class ApiAdminReqheaderAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final ReqHeaderPager pager = new ReqHeaderPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final ReqHeaderPager pager = copyBeanToNewBean(body, ReqHeaderPager.class);
|
||||
final List<RequestHeader> list = reqHeaderService.getRequestHeaderList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.reqheader;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.reqheader.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.RolePager;
|
||||
import org.codelibs.fess.app.service.RoleService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -42,8 +41,7 @@ public class ApiAdminRoleAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final RolePager pager = new RolePager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final RolePager pager = copyBeanToNewBean(body, RolePager.class);
|
||||
final List<Role> list = roleService.getRoleList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.role;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.role.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -93,8 +93,7 @@ public class ApiAdminSchedulerAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final SchedulerPager pager = new SchedulerPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final SchedulerPager pager = copyBeanToNewBean(body, SchedulerPager.class);
|
||||
final List<ScheduledJob> list = scheduledJobService.getScheduledJobList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.scheduler;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.scheduler.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.UserPager;
|
||||
import org.codelibs.fess.app.service.UserService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -42,8 +41,7 @@ public class ApiAdminUserAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final UserPager pager = new UserPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final UserPager pager = copyBeanToNewBean(body, UserPager.class);
|
||||
final List<User> list = userService.getUserList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,7 +15,8 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.user;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.user.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.WebAuthPager;
|
||||
import org.codelibs.fess.app.service.WebAuthenticationService;
|
||||
import org.codelibs.fess.app.service.WebConfigService;
|
||||
|
@ -60,8 +59,7 @@ public class ApiAdminWebauthAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final WebAuthPager pager = new WebAuthPager();
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final WebAuthPager pager = copyBeanToNewBean(body, WebAuthPager.class);
|
||||
final List<WebAuthentication> list = webAuthService.getWebAuthenticationList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
*/
|
||||
package org.codelibs.fess.app.web.api.admin.webauth;
|
||||
|
||||
import org.codelibs.fess.app.web.admin.webauth.SearchForm;
|
||||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends SearchForm {
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.util.stream.Collectors;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.codelibs.fess.Constants;
|
||||
import org.codelibs.fess.app.pager.WebConfigPager;
|
||||
import org.codelibs.fess.app.service.WebConfigService;
|
||||
import org.codelibs.fess.app.web.CrudMode;
|
||||
|
@ -56,10 +55,7 @@ public class ApiAdminWebconfigAction extends FessApiAdminAction {
|
|||
@Execute
|
||||
public JsonResponse<ApiResult> settings(final SearchBody body) {
|
||||
validateApi(body, messages -> {});
|
||||
final WebConfigPager pager = new WebConfigPager();
|
||||
pager.setPageSize(body.size);
|
||||
pager.setCurrentPageNumber(body.page);
|
||||
copyBeanToBean(body, pager, op -> op.exclude(Constants.PAGER_CONVERSION_RULE));
|
||||
final WebConfigPager pager = copyBeanToNewBean(body, WebConfigPager.class);
|
||||
final List<WebConfig> list = webConfigService.getWebConfigList(pager);
|
||||
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
|
||||
.settings(list.stream().map(entity -> createEditBody(entity)).collect(Collectors.toList()))
|
||||
|
|
|
@ -18,5 +18,6 @@ package org.codelibs.fess.app.web.api.admin.webconfig;
|
|||
import org.codelibs.fess.app.web.api.admin.BaseSearchBody;
|
||||
|
||||
public class SearchBody extends BaseSearchBody {
|
||||
public String id;
|
||||
|
||||
}
|
||||
|
|
|
@ -189,6 +189,10 @@ public abstract class FessBaseAction extends TypicalAction // has several interf
|
|||
BeanUtil.copyBeanToBean(src, dest, option);
|
||||
}
|
||||
|
||||
protected static <T> T copyBeanToNewBean(final Object src, final Class<T> destClass) {
|
||||
return BeanUtil.copyBeanToNewBean(src, destClass);
|
||||
}
|
||||
|
||||
protected String buildThrowableMessage(final Throwable t) {
|
||||
final StringBuilder buf = new StringBuilder(100);
|
||||
Throwable current = t;
|
||||
|
|
Loading…
Add table
Reference in a new issue