package com.heroku.myapp.myorchestrator.consumers.snapshot.seiyu;

import com.heroku.myapp.commons.util.content.MapList;
import com.heroku.myapp.commons.consumers.SnapshotCategoryPagesAggregationConsumer;
import org.springframework.stereotype.Component;

@Component
public class SnapshotFemaleSeiyuCategoryMembersConsumer extends SnapshotCategoryPagesAggregationConsumer {

    public SnapshotFemaleSeiyuCategoryMembersConsumer() {
        super();
        addTargetCategory("Category:日本の女性声優");
        cmpropParam("title|ids|sortkeyprefix");
        includesCategoryFlag(false);
    }

    @Override
    protected void afterProcess(MapList mapList) {
        mapList.forEach((m) -> m.put("gender", "f"));
    }
}

@@ -96,112 +96,333 @@
 ons.
-util.content.MapList;%0Aimport com.heroku.myapp.commons.consumers.SnapshotCategoryPagesAggregationConsumer
+consumers.SnapshotQueueConsumer;%0Aimport com.heroku.myapp.commons.util.content.DocumentUtil;%0Aimport com.heroku.myapp.commons.util.content.MapList;%0Aimport com.heroku.myapp.commons.util.content.MediawikiApiRequest;%0Aimport java.net.URLEncoder;%0Aimport java.util.Optional;%0Aimport org.apache.camel.Exchange;%0Aimport org.bson.Document
 ;%0Aim
@@ -556,187 +556,599 @@
 shot
-CategoryPagesAggregationConsumer %7B%0A%0A    public SnapshotFemaleSeiyuCategoryMembersConsumer() %7B%0A        super();%0A        addTargetCategory(%22Category:%E6%97%A5%E6%9C%AC%E3%81%AE%E5%A5%B3%E6%80%A7%E5%A3%B0%E5%84%AA%22);%0A        cmpropParam(%22
+QueueConsumer %7B%0A%0A    @Override%0A    protected Optional%3CDocument%3E doSnapshot(Exchange exchange) %7B%0A        try %7B%0A            MapList result%0A                    = new MediawikiApiRequest()%0A                    .setApiParam(%22action=query&list=categorymembers%22%0A                            + %22&cmtitle=Category:%22%0A                            + URLEncoder.encode(%22%E6%97%A5%E6%9C%AC%E3%81%AE%E5%A5%B3%E6%80%A7%E5%A3%B0%E5%84%AA%22, %22UTF-8%22)%0A                            + %22&cmlimit=500%22%0A                            + %22&cmnamespace=0%22%0A                            + %22&format=xml%22%0A                            + %22&continue=%22%0A                            + %22&cmprop=
 titl
@@ -1168,17 +1168,16 @@
 prefix%22)
-;
 %0A       
@@ -1181,108 +1181,212 @@
     
-includesCategoryFlag(false);
+            .setListName(%22categorymembers%22).setMapName(%22cm%22)
 %0A    
-%7D%0A%0A
     
-@Override%0A    protected void afterProcess(MapList m
+            .setContinueElementName(%22cmcontinue%22)%0A                    .setIgnoreFields(%22ns%22)%0A                    .getResultByM
 apList
-) %7B
+();
 %0A   
@@ -1394,14 +1394,17 @@
     
-mapLis
+    resul
 t.fo
@@ -1439,16 +1439,198 @@
  %22f%22));%0A
+            return new DocumentUtil(result).nullable();%0A        %7D catch (Exception e) %7B%0A            util().sendError(%22doSnapshot%22, e);%0A            return Optional.empty();%0A        %7D%0A
     %7D%0A%7D%0A

revert SnapshotFemaleSeiyuCategoryMembersConsumer