Package org.apache.isis.core.runtime.system.transaction

Examples of org.apache.isis.core.runtime.system.transaction.MessageBroker


    public void execute(final List<PersistenceCommand> commands) {
        final DatabaseConnector connector = connectionPool.acquire();
        connector.begin();

        final IsisTransactionManager transactionManager = IsisContext.getTransactionManager();
        final MessageBroker messageBroker = IsisContext.getMessageBroker();
        final UpdateNotifier updateNotifier = IsisContext.getUpdateNotifier();
        final SqlExecutionContext context =
            new SqlExecutionContext(connector, transactionManager, messageBroker, updateNotifier);
        try {
            for (final PersistenceCommand command : commands) {
View Full Code Here


    @Override
    public ObjectAdapter completeTask(final Context context, final Page page) {
        final ObjectAdapter[] parameters = getEntries(context);
        final ObjectAdapter target = getTarget(context);
        final ObjectAdapter result = action.execute(target, parameters);
        final MessageBroker broker = IsisContext.getMessageBroker();
        final List<String> messages = broker.getMessages();
        final List<String> warnings = broker.getWarnings();
        context.setMessagesAndWarnings(messages, warnings);
        return result;
    }
View Full Code Here

        }

        if (executeImmediately) {
            final ObjectAdapter[] parameters = isContributedMethod ? new ObjectAdapter[] { target } : null;
            final ObjectAdapter result = action.execute(target, parameters);
            final MessageBroker broker = IsisContext.getMessageBroker();
            final List<String> messages = broker.getMessages();
            final List<String> warnings = broker.getWarnings();
            context.setMessagesAndWarnings(messages, warnings);
            context.processChanges();
            final String targetId = context.mapObject(target);
            displayMethodResult(request, context, page, result, targetId);
        } else {
View Full Code Here

    public void process(final Request request) {
        request.pushNewBuffer();
        request.processUtilCloseTag();
        final String content = request.popBuffer();

        final MessageBroker messageBroker = IsisContext.getMessageBroker();
        messageBroker.addWarning(content);
    }
View Full Code Here

    public void process(final Request request) {
        request.pushNewBuffer();
        request.processUtilCloseTag();
        final String content = request.popBuffer();

        final MessageBroker messageBroker = IsisContext.getMessageBroker();
        messageBroker.addMessage(content);
    }
View Full Code Here

    public static void write(String cls, final StringBuffer buffer) {
        if (cls == null) {
            cls = "message";
        }
        final MessageBroker messageBroker = IsisContext.getMessageBroker();
        final List<String> messages = messageBroker.getMessages();
        for (final String message : messages) {
            buffer.append("<div class=\"" + cls + "\">" + message + "</div>");
        }
    }
View Full Code Here

                        view = view.substring(0, questionMark);
                    }
                }
                context.setRequestPath(view);
                if (message != null) {
                    final MessageBroker messageBroker = getMessageBroker();
                    messageBroker.addMessage(message);
                }
                if (override != null) {
                    context.addVariable(resultName, override, Scope.REQUEST);
                }
                if (!action.hasReturn() && context.getVariable(resultName) == null) {
                    context.addVariable(resultName, objectId, Scope.REQUEST);
                }
            } else {
                entryState.setForm(formId);
                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
                context.addVariable(resultName, objectId, Scope.REQUEST);
                if (override != null) {
                    context.addVariable(resultName, override, Scope.REQUEST);
                }
                final String error = entryState.getError();
                final String view = context.getParameter("_" + ERROR);
                context.setRequestPath(view, Dispatcher.ACTION);

                final MessageBroker messageBroker = getMessageBroker();
                messageBroker.addWarning(error);
            }
        } catch (final ConcurrencyException e) {
            final ObjectAdapter adapter = getAdapterManager().getAdapterFor(e.getOid());
            String user = adapter.getOid().getVersion().getUser();
            String errorMessage = "The data for '" + adapter.titleString() + "' was changed by " + user
View Full Code Here

    public static void write(String cls, final StringBuffer buffer) {
        if (cls == null) {
            cls = "warning";
        }
        final MessageBroker messageBroker = IsisContext.getMessageBroker();
        final List<String> warnings = messageBroker.getWarnings();
        for (final String warning : warnings) {
            buffer.append("<div class=\"" + cls + "\">" + warning + "</div>");
        }
    }
View Full Code Here

                    message = "Saved changes to " + adapter.getSpecification().getSingularName();
                } else if (message.equals("")) {
                    message = null;
                }
                if (message != null) {
                    final MessageBroker messageBroker = IsisContext.getMessageBroker();
                    messageBroker.addMessage(message);
                }

            } else {
                final String view = context.getParameter("_" + ERROR);
                context.setRequestPath(view, Dispatcher.EDIT);

                entryState.setForm(formId);
                context.addVariable(ENTRY_FIELDS, entryState, Scope.REQUEST);
                context.addVariable(resultName, objectId, Scope.REQUEST);
                if (override != null) {
                    context.addVariable(resultName, override, Scope.REQUEST);
                }

                final MessageBroker messageBroker = IsisContext.getMessageBroker();
                messageBroker.addWarning(entryState.getError());
            }

        } catch (final RuntimeException e) {
            IsisContext.getMessageBroker().getMessages();
            IsisContext.getMessageBroker().getWarnings();
View Full Code Here

TOP

Related Classes of org.apache.isis.core.runtime.system.transaction.MessageBroker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.