Search in sources :

Example 6 with StateMapped

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

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 7 with StateMapped

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

the class OrdersSearchForm method setStateEntry.

public boolean setStateEntry(StateEntry state) {
    boolean changed = false;
    if (state instanceof StateMapped) {
        StateMapped map = (StateMapped) state;
        String refNo = map.getDelegate().get("refNo");
        if (StringHelper.containsNonWhitespace(refNo)) {
            refNoEl.setValue(refNo);
            changed = true;
        }
        String fromStr = map.getDelegate().get("from");
        if (StringHelper.containsNonWhitespace(fromStr)) {
            fromEl.setValue(fromStr);
            changed = true;
        }
        String toStr = map.getDelegate().get("to");
        if (StringHelper.containsNonWhitespace(toStr)) {
            toEl.setValue(toStr);
            changed = true;
        }
    }
    return changed;
}
Also used : StateMapped(org.olat.core.id.context.StateMapped)

Example 8 with StateMapped

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

the class OrdersSearchForm method getStateEntry.

public StateEntry getStateEntry() {
    StateMapped entry = new StateMapped();
    Long refNo = getRefNo();
    if (refNo != null) {
        entry.getDelegate().put("refNo", refNo.toString());
    }
    String fromStr = fromEl.getValue();
    if (StringHelper.containsNonWhitespace(fromStr)) {
        entry.getDelegate().put("from", fromStr);
    }
    String toStr = toEl.getValue();
    if (StringHelper.containsNonWhitespace(toStr)) {
        entry.getDelegate().put("to", toStr);
    }
    return entry;
}
Also used : StateMapped(org.olat.core.id.context.StateMapped)

Example 9 with StateMapped

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

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)

Example 10 with StateMapped

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

the class OrdersSearchForm method getStateEntry.

public StateEntry getStateEntry() {
    StateMapped entry = new StateMapped();
    Long refNo = getRefNo();
    if (refNo != null) {
        entry.getDelegate().put("refNo", refNo.toString());
    }
    String fromStr = fromEl.getValue();
    if (StringHelper.containsNonWhitespace(fromStr)) {
        entry.getDelegate().put("from", fromStr);
    }
    String toStr = toEl.getValue();
    if (StringHelper.containsNonWhitespace(toStr)) {
        entry.getDelegate().put("to", toStr);
    }
    return entry;
}
Also used : 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