use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPFrontendManager method filterArtefactsByFilterSettings.
/**
* filter the provided list of artefacts with different filters
*
* @param allArtefacts the list to manipulate on
* @param filterSettings Settings for the filter to work on
* @return
*/
public List<AbstractArtefact> filterArtefactsByFilterSettings(EPFilterSettings filterSettings, Identity identity, Roles roles) {
List<Long> artefactKeys = fulltextSearchAfterArtefacts(filterSettings, identity, roles);
if (artefactKeys == null || artefactKeys.isEmpty()) {
List<AbstractArtefact> allArtefacts = artefactManager.getArtefactPoolForUser(identity);
return artefactManager.filterArtefactsByFilterSettings(allArtefacts, filterSettings);
}
List<AbstractArtefact> artefacts = artefactManager.getArtefacts(identity, artefactKeys, 0, 500);
// remove the text-filter when the lucene-search got some results before
EPFilterSettings settings = filterSettings.cloneAfterFullText();
return artefactManager.filterArtefactsByFilterSettings(artefacts, settings);
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class PortfolioMapDocument method getContent.
private static String getContent(PortfolioStructure map, SearchResourceContext resourceContext, StringBuilder sb, Filter filter) {
sb.append(' ').append(map.getTitle());
if (StringHelper.containsNonWhitespace(map.getDescription())) {
sb.append(' ').append(filter.filter(map.getDescription()));
}
for (PortfolioStructure child : ePFMgr.loadStructureChildren(map)) {
getContent(child, resourceContext, sb, filter);
}
for (AbstractArtefact artefact : ePFMgr.getArtefacts(map)) {
String reflexion = artefact.getReflexion();
if (StringHelper.containsNonWhitespace(reflexion)) {
sb.append(' ').append(filter.filter(reflexion));
}
OLATResourceable ores = OresHelper.createOLATResourceableInstance(AbstractArtefact.class.getSimpleName(), artefact.getKey());
EPArtefactHandler<?> handler = portfolioModule.getArtefactHandler(artefact.getResourceableTypeName());
SearchResourceContext artefactResourceContext = new SearchResourceContext(resourceContext);
artefactResourceContext.setBusinessControlFor(ores);
OlatDocument doc = handler.getIndexerDocument(artefactResourceContext, artefact, ePFMgr);
sb.append(' ').append(doc.getContent());
}
return sb.toString();
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class PortfolioArtefactIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext searchResourceContext, Object object, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
if (!portfolioModule.isEnabled())
return;
Identity identity = (Identity) object;
// SearchResourceContext resourceContext = new SearchResourceContext(searchResourceContext); // dont do this way, as it would then try to open an artefact over visiting card -> not possible!
SearchResourceContext resourceContext = new SearchResourceContext();
resourceContext.setDocumentType(TYPE);
resourceContext.setParentContextType(null);
int currentPosition = 0;
List<AbstractArtefact> artefacts;
do {
artefacts = frontendManager.getArtefacts(identity, currentPosition, MAX_RESULTS);
for (AbstractArtefact artefact : artefacts) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance(AbstractArtefact.class.getSimpleName(), artefact.getKey());
EPArtefactHandler<?> handler = portfolioModule.getArtefactHandler(artefact.getResourceableTypeName());
resourceContext.setBusinessControlFor(ores);
OlatDocument doc = handler.getIndexerDocument(resourceContext, artefact, frontendManager);
Identity author = artefact.getAuthor();
if (author != null && author.getUser() != null) {
doc.setReservedTo(author.getKey().toString());
}
if (doc != null) {
indexerWriter.addDocument(doc.getLuceneDocument());
}
}
currentPosition += artefacts.size();
} while (artefacts.size() == MAX_RESULTS);
super.doIndex(searchResourceContext, object, indexerWriter);
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class ArtefactWizzardStepsController method prepareNewArtefact.
/**
* @param ores
* @param businessPath
*/
private void prepareNewArtefact() {
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(ores.getResourceableTypeName());
AbstractArtefact artefact1 = artHandler.createArtefact();
artefact1.setAuthor(getIdentity());
artefact1.setCollectionDate(new Date());
artefact1.setBusinessPath(businessPath);
artHandler.prefillArtefactAccordingToSource(artefact1, ores);
this.artefact = artefact1;
}
use of org.olat.portfolio.model.artefacts.AbstractArtefact in project openolat by klemens.
the class EPAddArtefactController method prepareFileArtefactWizzard.
/**
* prepare a file artefact and open with wizzard initialized with a special
* first step for file-artefacts
*
* @param ureq
*/
private void prepareFileArtefactWizzard(UserRequest ureq) {
EPArtefactHandler<?> artHandler = portfolioModule.getArtefactHandler(FileArtefact.FILE_ARTEFACT_TYPE);
AbstractArtefact artefact1 = artHandler.createArtefact();
artefact1.setAuthor(getIdentity());
artefact1.setSource(translate("file.artefact.source.info"));
artefact1.setCollectionDate(new Date());
artefact1.setSignature(-30);
vfsTemp = ePFMgr.getArtefactsTempContainer(getIdentity());
Step start = new EPCreateFileArtefactStep00(ureq, artefact1, preSelectedStruct, vfsTemp);
StepRunnerCallback finish = new EPArtefactWizzardStepCallback(vfsTemp);
collectStepsCtrl = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("create.file.artefact.wizzard.title"), "o_sel_artefact_add_wizard o_sel_artefact_add_file_wizard");
listenTo(collectStepsCtrl);
getWindowControl().pushAsModalDialog(collectStepsCtrl.getInitialComponent());
}
Aggregations