Search in sources :

Example 1 with StateMapped

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

the class UsermanagerUserSearchForm method getStateEntry.

protected StateMapped getStateEntry() {
    StateMapped state = new StateMapped();
    if (items != null) {
        for (Map.Entry<String, FormItem> itemEntry : items.entrySet()) {
            String key = itemEntry.getKey();
            FormItem f = itemEntry.getValue();
            if (f instanceof TextElement) {
                state.getDelegate().put(key, ((TextElement) f).getValue());
            }
        }
    }
    if (auth.isMultiselect()) {
    // auth.
    }
    if (roles.isMultiselect()) {
    // 
    }
    if (status.isOneSelected()) {
    // 
    }
    return state;
}
Also used : TextElement(org.olat.core.gui.components.form.flexible.elements.TextElement) FormItem(org.olat.core.gui.components.form.flexible.FormItem) StateMapped(org.olat.core.id.context.StateMapped) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with StateMapped

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

the class PaypalTransactionsController method addSearchToHistory.

protected void addSearchToHistory(UserRequest ureq) {
    String transactionId = tableEl.getQuickSearchString();
    StateMapped state = new StateMapped();
    if (StringHelper.containsNonWhitespace(transactionId)) {
        state.getDelegate().put("transactionId", transactionId);
    }
    ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
    if (currentEntry != null) {
        currentEntry.setTransientState(state);
    }
    addToHistory(ureq, getWindowControl());
}
Also used : StateMapped(org.olat.core.id.context.StateMapped) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 3 with StateMapped

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

the class PaypalTransactionsController method addSearchToHistory.

protected void addSearchToHistory(UserRequest ureq) {
    String transactionId = tableEl.getQuickSearchString();
    StateMapped state = new StateMapped();
    if (StringHelper.containsNonWhitespace(transactionId)) {
        state.getDelegate().put("transactionId", transactionId);
    }
    ContextEntry currentEntry = getWindowControl().getBusinessControl().getCurrentContextEntry();
    if (currentEntry != null) {
        currentEntry.setTransientState(state);
    }
    addToHistory(ureq, getWindowControl());
}
Also used : StateMapped(org.olat.core.id.context.StateMapped) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 4 with StateMapped

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

the class PaypalTransactionsController method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (state instanceof StateMapped) {
        StateMapped map = (StateMapped) state;
        String transactionId = map.getDelegate().get("transactionId");
        if (StringHelper.containsNonWhitespace(transactionId)) {
            tableEl.quickSearch(ureq, transactionId);
        }
    }
    if (entries == null || entries.isEmpty())
        return;
    Long trxId = entries.get(0).getOLATResourceable().getResourceableId();
    PaypalTransaction trx = dataModel.getTransaction(trxId);
    if (trx != null) {
        doSelectTransaction(ureq, trx);
    }
}
Also used : PaypalTransaction(org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction) StateMapped(org.olat.core.id.context.StateMapped)

Example 5 with StateMapped

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

the class UsermanagerUserSearchForm method activate.

@Override
public void activate(UserRequest ureq, List<ContextEntry> entries, StateEntry state) {
    if (state instanceof StateMapped) {
        StateMapped searchState = (StateMapped) state;
        searchform.setStateEntry(searchState);
        if (entries != null && entries.size() > 0) {
            String table = entries.get(0).getOLATResourceable().getResourceableTypeName();
            if ("table".equals(table)) {
                entries.remove(0);
                event(ureq, searchform, Event.DONE_EVENT);
            }
        }
    }
    if (entries == null || entries.isEmpty())
        return;
    for (int i = 0; i < entries.size(); i++) {
        String resourceType = entries.get(i).getOLATResourceable().getResourceableTypeName();
        if ("Identity".equalsIgnoreCase(resourceType)) {
            Long identityKey = entries.get(i).getOLATResourceable().getResourceableId();
            Identity found = null;
            if (tdm != null) {
                for (Identity identity : tdm.getObjects()) {
                    if (identityKey.equals(identity.getKey())) {
                        found = identity;
                    }
                }
            }
            if (found == null) {
                found = securityManager.loadIdentityByKey(identityKey);
                if (found == null)
                    return;
                List<Identity> foundIdentites = new ArrayList<>();
                foundIdentites.add(found);
                initUserListCtr(ureq, foundIdentites, 0);
            }
            fireEvent(ureq, new SingleIdentityChosenEvent(found));
        }
    }
}
Also used : ArrayList(java.util.ArrayList) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity) StateMapped(org.olat.core.id.context.StateMapped)

Aggregations

StateMapped (org.olat.core.id.context.StateMapped)12 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)2 FormItem (org.olat.core.gui.components.form.flexible.FormItem)2 TextElement (org.olat.core.gui.components.form.flexible.elements.TextElement)2 Identity (org.olat.core.id.Identity)2 ContextEntry (org.olat.core.id.context.ContextEntry)2 PaypalTransaction (org.olat.resource.accesscontrol.provider.paypal.model.PaypalTransaction)2