Merge pull request #1131 from nullpos/patch

Add page option for mapping API
This commit is contained in:
Shinsuke Sugaya 2017-07-01 13:39:48 +09:00 committed by GitHub
commit 9200a75df2
2 changed files with 7 additions and 3 deletions

View file

@ -95,7 +95,7 @@ Run package goal and then the release file is created in target/releases.
### Integration Tests
Lunch Fess Server and run the following command:
Launch Fess Server and run the following command:
mvn test -P integrationTests -Dtest.fess.url="http://localhost:8080" -Dtest.es.url="http://localhost:9201"

View file

@ -31,6 +31,7 @@ import org.codelibs.fess.app.web.api.ApiResult;
import org.codelibs.fess.app.web.api.admin.FessApiAdminAction;
import org.codelibs.fess.dict.mapping.CharMappingFile;
import org.codelibs.fess.dict.mapping.CharMappingItem;
import org.dbflute.optional.OptionalThing;
import org.lastaflute.web.Execute;
import org.lastaflute.web.response.JsonResponse;
import org.lastaflute.web.response.StreamResponse;
@ -40,12 +41,15 @@ public class ApiAdminDictMappingAction extends FessApiAdminAction {
@Resource
private CharMappingService charMappingService;
// GET /api/admin/dict/mapping/settings/{dictId}
// GET /api/admin/dict/mapping/settings/{dictId}/{id}
@Execute
public JsonResponse<ApiResult> get$settings(final String dictId, final SearchBody body) {
public JsonResponse<ApiResult> get$settings(final String dictId, final OptionalThing<Integer> page, final SearchBody body) {
body.dictId = dictId;
validateApi(body, messages -> {});
final CharMappingPager pager = copyBeanToNewBean(body, CharMappingPager.class);
page.ifPresent(p -> {
pager.setCurrentPageNumber(p);
});
return asJson(new ApiResult.ApiConfigsResponse<EditBody>()
.settings(
charMappingService.getCharMappingList(body.dictId, pager).stream()