Skip to content
Snippets Groups Projects
Commit 890a680b authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Merge branch 'content-find-query-service' into 'master'

Add FindQueryService for Content

See merge request arsnova/arsnova-backend!90
parents 340bbed5 a844d440
No related merge requests found
/*
* This file is part of ARSnova Backend.
* Copyright (C) 2012-2018 The ARSnova Team and Contributors
*
* ARSnova Backend is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* ARSnova Backend is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package de.thm.arsnova.service;
import de.thm.arsnova.model.Content;
import de.thm.arsnova.model.FindQuery;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@Service
public class ContentFindQueryService implements FindQueryService<Content> {
private RoomService roomService;
private ContentService contentService;
public ContentFindQueryService(final RoomService roomService, final ContentService contentService) {
this.roomService = roomService;
this.contentService = contentService;
}
@Override
public Set<String> resolveQuery(final FindQuery<Content> findQuery) {
Set<String> contentIds = new HashSet<>();
if (findQuery.getProperties().getRoomId() != null) {
List<Content> contentList = contentService.getByRoomId(findQuery.getProperties().getRoomId());
for (Content c : contentList) {
contentIds.add(c.getId());
}
}
return contentIds;
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment