Search in sources :

Example 1 with HistoryPointImpl

use of org.olat.core.id.context.HistoryPointImpl in project OpenOLAT by OpenOLAT.

the class UserSession method addToHistory.

public void addToHistory(UserRequest ureq, BusinessControl businessControl) {
    List<ContextEntry> entries = businessControl.getEntries();
    String businessPath = businessControl.getAsString();
    if (StringHelper.containsNonWhitespace(businessPath)) {
        String uuid = ureq.getUuid();
        if (!history.isEmpty()) {
            // consolidate
            synchronized (history) {
                for (Iterator<HistoryPoint> it = history.iterator(); it.hasNext(); ) {
                    HistoryPoint p = it.next();
                    if (uuid.equals(p.getUuid())) {
                        it.remove();
                    }
                }
            }
        }
        // System.out.println(ureq.getUuid() + " Add business path: " + businessPath);
        history.push(new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
        if (history.size() > 20) {
            history.remove(0);
        }
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) ContextEntry(org.olat.core.id.context.ContextEntry) HistoryPoint(org.olat.core.id.context.HistoryPoint)

Example 2 with HistoryPointImpl

use of org.olat.core.id.context.HistoryPointImpl in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method updateBusinessPath.

private void updateBusinessPath(UserRequest ureq, DTab tab) {
    // dtabToBusinessPath is null if the controller is disposed
    if (tab == null || dtabToBusinessPath == null)
        return;
    try {
        String businessPath = tab.getController().getWindowControlForDebug().getBusinessControl().getAsString();
        HistoryPoint point = ureq.getUserSession().getLastHistoryPoint();
        int index = businessPath.indexOf(']');
        if (index > 0 && point != null && point.getBusinessPath() != null) {
            String start = businessPath.substring(0, index);
            if (!point.getBusinessPath().startsWith(start)) {
                // if a controller has not set its business path, don't pollute the mapping
                List<ContextEntry> entries = tab.getController().getWindowControlForDebug().getBusinessControl().getEntries();
                dtabToBusinessPath.put(tab, new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
                return;
            }
        }
        dtabToBusinessPath.put(tab, point);
    } catch (Exception e) {
        logError("", e);
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) AssertException(org.olat.core.logging.AssertException)

Example 3 with HistoryPointImpl

use of org.olat.core.id.context.HistoryPointImpl in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method updateBusinessPath.

private String updateBusinessPath(UserRequest ureq, SiteInstance site) {
    if (site == null)
        return null;
    try {
        String businessPath = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getAsString();
        HistoryPoint point = ureq.getUserSession().getLastHistoryPoint();
        int index = businessPath.indexOf(':');
        if (index > 0 && point != null && point.getBusinessPath() != null) {
            String start = businessPath.substring(0, index);
            if (!point.getBusinessPath().startsWith(start)) {
                // if a controller has not set its business path, don't pollute the mapping
                List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
                siteToBusinessPath.put(site, new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
                return BusinessControlFactory.getInstance().getAsRestPart(entries, true);
            }
            List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
            businessPath = BusinessControlFactory.getInstance().getAsRestPart(entries, true);
        }
        siteToBusinessPath.put(site, point);
        return businessPath;
    } catch (Exception e) {
        logError("", e);
        return null;
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) AssertException(org.olat.core.logging.AssertException)

Example 4 with HistoryPointImpl

use of org.olat.core.id.context.HistoryPointImpl in project openolat by klemens.

the class BaseFullWebappController method updateBusinessPath.

private String updateBusinessPath(UserRequest ureq, SiteInstance site) {
    if (site == null)
        return null;
    try {
        String businessPath = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getAsString();
        HistoryPoint point = ureq.getUserSession().getLastHistoryPoint();
        int index = businessPath.indexOf(':');
        if (index > 0 && point != null && point.getBusinessPath() != null) {
            String start = businessPath.substring(0, index);
            if (!point.getBusinessPath().startsWith(start)) {
                // if a controller has not set its business path, don't pollute the mapping
                List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
                siteToBusinessPath.put(site, new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
                return BusinessControlFactory.getInstance().getAsRestPart(entries, true);
            }
            List<ContextEntry> entries = siteToBornSite.get(site).getController().getWindowControlForDebug().getBusinessControl().getEntries();
            businessPath = BusinessControlFactory.getInstance().getAsRestPart(entries, true);
        }
        siteToBusinessPath.put(site, point);
        return businessPath;
    } catch (Exception e) {
        logError("", e);
        return null;
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) AssertException(org.olat.core.logging.AssertException)

Example 5 with HistoryPointImpl

use of org.olat.core.id.context.HistoryPointImpl in project openolat by klemens.

the class BaseFullWebappController method updateBusinessPath.

private void updateBusinessPath(UserRequest ureq, DTab tab) {
    // dtabToBusinessPath is null if the controller is disposed
    if (tab == null || dtabToBusinessPath == null)
        return;
    try {
        String businessPath = tab.getController().getWindowControlForDebug().getBusinessControl().getAsString();
        HistoryPoint point = ureq.getUserSession().getLastHistoryPoint();
        int index = businessPath.indexOf(']');
        if (index > 0 && point != null && point.getBusinessPath() != null) {
            String start = businessPath.substring(0, index);
            if (!point.getBusinessPath().startsWith(start)) {
                // if a controller has not set its business path, don't pollute the mapping
                List<ContextEntry> entries = tab.getController().getWindowControlForDebug().getBusinessControl().getEntries();
                dtabToBusinessPath.put(tab, new HistoryPointImpl(ureq.getUuid(), businessPath, entries));
                return;
            }
        }
        dtabToBusinessPath.put(tab, point);
    } catch (Exception e) {
        logError("", e);
    }
}
Also used : HistoryPointImpl(org.olat.core.id.context.HistoryPointImpl) HistoryPoint(org.olat.core.id.context.HistoryPoint) HistoryPoint(org.olat.core.id.context.HistoryPoint) ContextEntry(org.olat.core.id.context.ContextEntry) AssertException(org.olat.core.logging.AssertException)

Aggregations

ContextEntry (org.olat.core.id.context.ContextEntry)6 HistoryPoint (org.olat.core.id.context.HistoryPoint)6 HistoryPointImpl (org.olat.core.id.context.HistoryPointImpl)6 AssertException (org.olat.core.logging.AssertException)4