use of com.pratilipi.data.client.TagData in project pratilipi by Pratilipi.
the class TagsApi method getTags.
@Get
public Response getTags(Request request) {
List<TagData> tagDataList = TagDataUtil.getTags(request.getLanguage(), request.getType());
List<Response.ResponseObject> responseObjList = new ArrayList<>();
List<TagData> storyTagList = new ArrayList<>();
List<TagData> articleTagList = new ArrayList<>();
List<TagData> poemTagList = new ArrayList<>();
for (TagData tagData : tagDataList) {
if (tagData.getPratilipiType().equals(PratilipiType.STORY))
storyTagList.add(tagData);
else if (tagData.getPratilipiType().equals(PratilipiType.ARTICLE))
articleTagList.add(tagData);
else if (tagData.getPratilipiType().equals(PratilipiType.POEM))
poemTagList.add(tagData);
}
if (storyTagList.size() > 0)
responseObjList.add(new Response.ResponseObject(PratilipiType.STORY, null, storyTagList));
if (articleTagList.size() > 0)
responseObjList.add(new Response.ResponseObject(PratilipiType.ARTICLE, null, articleTagList));
if (poemTagList.size() > 0)
responseObjList.add(new Response.ResponseObject(PratilipiType.POEM, null, poemTagList));
return new Response(responseObjList);
}
Aggregations