use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class GenericMainController method activate.
protected void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
TreeNode selectedNode = getMenuTree().getSelectedNode();
String node = entry.getOLATResourceable().getResourceableTypeName();
if (node != null && node.startsWith(GMCMT)) {
activate(ureq, node + ":" + entries.get(0).getOLATResourceable().getResourceableId());
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
} else {
// maybe the node is a GAE-NavigationKey ?
GenericActionExtension gAE = ExtManager.getInstance().getActionExtensioByNavigationKey(className, node);
if (gAE != null) {
// if the controller is already selected, only activate it, don't reinstanciate it
if (selectedNode != null && selectedNode.getUserObject() != gAE) {
activateTreeNodeByActionExtension(ureq, gAE);
}
if (entries.size() >= 1) {
entries = entries.subList(1, entries.size());
}
if (contentCtr instanceof Activateable2) {
((Activateable2) contentCtr).activate(ureq, entries, entry.getTransientState());
}
}
}
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class AssessmentTestDisplayController method computeTestAssessmentResult.
private AssessmentResult computeTestAssessmentResult(Date requestTimestamp, AssessmentTestSession testSession) {
List<ContextEntry> entries = getWindowControl().getBusinessControl().getEntries();
OLATResourceable testSessionOres = OresHelper.createOLATResourceableInstance("TestSession", testSession.getKey());
entries.add(BusinessControlFactory.getInstance().createContextEntry(testSessionOres));
String url = BusinessControlFactory.getInstance().getAsAuthURIString(entries, true);
URI sessionIdentifierSourceId = URI.create(url);
String sessionIdentifier = "testsession/" + testSession.getKey();
return testSessionController.computeAssessmentResult(requestTimestamp, sessionIdentifier, sessionIdentifierSourceId);
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class BinderListController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
String resName = entries.get(0).getOLATResourceable().getResourceableTypeName();
if ("Binder".equalsIgnoreCase(resName)) {
Long portfolioKey = entries.get(0).getOLATResourceable().getResourceableId();
Activateable2 activateable = doOpenBinder(ureq, new BinderRefImpl(portfolioKey));
if (activateable != null) {
List<ContextEntry> subEntries = entries.subList(1, entries.size());
activateable.activate(ureq, subEntries, entries.get(0).getTransientState());
}
}
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class QuestionListController method activate.
@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
if (entries == null || entries.isEmpty())
return;
ContextEntry entry = entries.get(0);
String type = entry.getOLATResourceable().getResourceableTypeName();
if ("QuestionItem".equals(type)) {
Long itemKey = entry.getOLATResourceable().getResourceableId();
ItemRow row = getModel().getObjectByKey(itemKey);
if (row == null) {
getModel().load(null, null, null, 0, -1);
row = getModel().getObjectByKey(itemKey);
if (row != null) {
doOpenDetails(ureq, row);
int index = getModel().getObjects().indexOf(row);
if (index >= 1 && getItemsTable().getPageSize() > 1) {
int page = index / getItemsTable().getPageSize();
getItemsTable().setPage(page);
}
}
} else {
doOpenDetails(ureq, row);
}
}
}
use of org.olat.core.id.context.ContextEntry in project openolat by klemens.
the class FeedViewHelper method getJumpInLink.
/**
* @param feed
* the target feed for the jumpInLink
* @param item
* the target item for the jumpInLink or null if not want to
* refer to a specific item
* @return the jump in link
*/
public String getJumpInLink(Feed feed, Item item) {
String jumpInLink = null;
RepositoryManager resMgr = RepositoryManager.getInstance();
if (courseId != null && nodeId != null) {
OLATResourceable oresCourse = OLATResourceManager.getInstance().findResourceable(courseId, CourseModule.getCourseTypeName());
OLATResourceable oresNode = OresHelper.createOLATResourceableInstance("CourseNode", Long.valueOf(nodeId));
RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(oresCourse, false);
List<ContextEntry> ces = new ArrayList<>();
ces.add(BusinessControlFactory.getInstance().createContextEntry(repositoryEntry));
ces.add(BusinessControlFactory.getInstance().createContextEntry(oresNode));
jumpInLink = BusinessControlFactory.getInstance().getAsURIString(ces, false);
} else {
RepositoryEntry repositoryEntry = resMgr.lookupRepositoryEntry(feed, false);
if (repositoryEntry != null) {
ContextEntry ce = BusinessControlFactory.getInstance().createContextEntry(repositoryEntry);
jumpInLink = BusinessControlFactory.getInstance().getAsURIString(Collections.singletonList(ce), false);
} else {
// its a liveblog-helperFeed
final BusinessControlFactory bCF = BusinessControlFactory.getInstance();
String feedBP = LiveBlogArtefactHandler.LIVEBLOG + feed.getResourceableId() + "]";
final List<ContextEntry> ceList = bCF.createCEListFromString(feedBP);
jumpInLink = bCF.getAsURIString(ceList, true);
}
}
if (item != null && jumpInLink != null) {
jumpInLink += "/item=" + item.getKey() + "/0";
}
return jumpInLink;
}
Aggregations