Skip to content
Snippets Groups Projects
Commit 613e75d7 authored by srosse's avatar srosse
Browse files

OO-1917: index questions after import

parent 1251b347
No related branches found
No related tags found
No related merge requests found
...@@ -135,7 +135,7 @@ public interface QPoolService { ...@@ -135,7 +135,7 @@ public interface QPoolService {
public ResultInfos<QuestionItemView> getSharedItemByResource(OLATResource resource, SearchQuestionItemParams params, int firstResult, int maxResults, SortKey... orderBy); public ResultInfos<QuestionItemView> getSharedItemByResource(OLATResource resource, SearchQuestionItemParams params, int firstResult, int maxResults, SortKey... orderBy);
public List<QuestionItem2Resource> getSharedResourceInfosByItem(QuestionItem item); public List<QuestionItem2Resource> getSharedResourceInfosByItem(QuestionItem item);
//list //list
public QuestionItemCollection createCollection(Identity owner, String collectionName, List<QuestionItemShort> initialItems); public QuestionItemCollection createCollection(Identity owner, String collectionName, List<QuestionItemShort> initialItems);
...@@ -153,6 +153,11 @@ public interface QPoolService { ...@@ -153,6 +153,11 @@ public interface QPoolService {
public ResultInfos<QuestionItemView> getItemsOfCollection(QuestionItemCollection collection, SearchQuestionItemParams params, int firstResult, int maxResults, SortKey... orderBy); public ResultInfos<QuestionItemView> getItemsOfCollection(QuestionItemCollection collection, SearchQuestionItemParams params, int firstResult, int maxResults, SortKey... orderBy);
/**
* Send the message to index this list of items.
* @param items
*/
public void index(List<? extends QuestionItemShort> items);
//study field admin //study field admin
public List<TaxonomyLevel> getTaxonomyLevels(); public List<TaxonomyLevel> getTaxonomyLevels();
......
...@@ -187,7 +187,18 @@ public class QuestionPoolServiceImpl implements QPoolService { ...@@ -187,7 +187,18 @@ public class QuestionPoolServiceImpl implements QPoolService {
lifeIndexer.indexDocument(QItemDocument.TYPE, mergedItem.getKey()); lifeIndexer.indexDocument(QItemDocument.TYPE, mergedItem.getKey());
return mergedItem; return mergedItem;
} }
@Override
public void index(List<? extends QuestionItemShort> items) {
if(items == null || items.isEmpty()) return;
List<Long> keys = new ArrayList<>();
for(QuestionItemShort item:items) {
keys.add(item.getKey());
}
lifeIndexer.indexDocument(QItemDocument.TYPE, keys);
}
@Override @Override
public List<QuestionItem> copyItems(Identity owner, List<QuestionItemShort> itemsToCopy) { public List<QuestionItem> copyItems(Identity owner, List<QuestionItemShort> itemsToCopy) {
List<QuestionItem> copies = new ArrayList<QuestionItem>(); List<QuestionItem> copies = new ArrayList<QuestionItem>();
...@@ -539,6 +550,7 @@ public class QuestionPoolServiceImpl implements QPoolService { ...@@ -539,6 +550,7 @@ public class QuestionPoolServiceImpl implements QPoolService {
for(QuestionItemShort item:items) { for(QuestionItemShort item:items) {
questionItemDao.share(item, resources, editable); questionItemDao.share(item, resources, editable);
} }
index(items);
} }
@Override @Override
......
...@@ -58,6 +58,7 @@ public class MarkedItemsSource extends DefaultItemsSource { ...@@ -58,6 +58,7 @@ public class MarkedItemsSource extends DefaultItemsSource {
String businessPath = "[QuestionItem:" + item.getResourceableId() + "]"; String businessPath = "[QuestionItem:" + item.getResourceableId() + "]";
markManager.setMark(item, identity, null, businessPath); markManager.setMark(item, identity, null, businessPath);
} }
qpoolService.index(items);
return items.size(); return items.size();
} }
......
...@@ -45,6 +45,7 @@ public class MyItemsSource extends DefaultItemsSource { ...@@ -45,6 +45,7 @@ public class MyItemsSource extends DefaultItemsSource {
@Override @Override
public int postImport(List<QuestionItem> items, boolean editable) { public int postImport(List<QuestionItem> items, boolean editable) {
qpoolService.index(items);
return items == null ? 0 : items.size(); return items == null ? 0 : items.size();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment