Search in sources :

Example 1 with Echo2Application

use of nl.nn.testtool.echo2.Echo2Application in project iaf by ibissource.

the class TibetView method isOpenReportAllowedViaAdapter.

public String isOpenReportAllowedViaAdapter(Object StorageId) {
    Echo2Application app = getEcho2Application();
    IAdapter adapter = ibisManager.getRegisteredAdapter(AUTHORISATION_CHECK_ADAPTER);
    if (adapter == null) {
        return "Not allowed. Could not find adapter " + AUTHORISATION_CHECK_ADAPTER;
    } else {
        PipeLineSession pipeLineSession = new PipeLineSession();
        if (app.getUserPrincipal() != null)
            pipeLineSession.put("principal", app.getUserPrincipal().getName());
        pipeLineSession.put("StorageId", StorageId);
        pipeLineSession.put("View", getName());
        PipeLineResult processResult = adapter.processMessage(null, new Message("<dummy/>"), pipeLineSession);
        if (processResult.isSuccessful()) {
            return ReportsComponent.OPEN_REPORT_ALLOWED;
        } else {
            return "Not allowed. Result of adapter " + AUTHORISATION_CHECK_ADAPTER + ": " + processResult.getResult();
        }
    }
}
Also used : Message(nl.nn.adapterframework.stream.Message) Echo2Application(nl.nn.testtool.echo2.Echo2Application) PipeLineResult(nl.nn.adapterframework.core.PipeLineResult) PipeLineSession(nl.nn.adapterframework.core.PipeLineSession) IAdapter(nl.nn.adapterframework.core.IAdapter)

Aggregations

IAdapter (nl.nn.adapterframework.core.IAdapter)1 PipeLineResult (nl.nn.adapterframework.core.PipeLineResult)1 PipeLineSession (nl.nn.adapterframework.core.PipeLineSession)1 Message (nl.nn.adapterframework.stream.Message)1 Echo2Application (nl.nn.testtool.echo2.Echo2Application)1