Package org.apache.lenya.notification

Examples of org.apache.lenya.notification.Message


                    if (messageElements[i].hasAttribute("read")) {
                        readString = messageElements[i].getAttribute("read");
                    }
                    boolean read = Boolean.valueOf(readString).booleanValue();

                    Message message = new Message(subject, subjectParams, body, bodyParams, sender,
                            recipients);
                    InboxMessage msg = new XmlSourceInboxMessage(this, id, message, read);
                    this.messages.add(msg);
                }
            }
View Full Code Here


        NamespaceHelper helper = new NamespaceHelper(Notifier.NAMESPACE, "", "inbox");

        InboxMessage[] messages = getMessages();
        for (int i = 0; i < messages.length; i++) {
           
            Message message = messages[i].getMessage();
           
            Element messageElement = helper.createElement("message");
            helper.getDocument().getDocumentElement().appendChild(messageElement);
            User sender = (User) message.getSender();
            messageElement.setAttribute("sender", sender.getId());

            Element recipientsElement = helper.createElement("recipients");
            messageElement.appendChild(recipientsElement);

            Identifiable[] recipients = message.getRecipients();
            for (int r = 0; r < recipients.length; r++) {
                if (recipients[r] instanceof User) {
                    Element userElement = helper.createElement("user");
                    userElement.setAttribute("id", ((User) recipients[r]).getId());
                    recipientsElement.appendChild(userElement);
                } else if (recipients[r] instanceof Group) {
                    Element groupElement = helper.createElement("group");
                    groupElement.setAttribute("id", ((Group) recipients[r]).getId());
                    recipientsElement.appendChild(groupElement);
                }
            }

            Element subjectElement = helper.createElement("subject");
            messageElement.appendChild(subjectElement);
            Element subjectTextElement = helper.createElement("text", message.getSubject());
            subjectElement.appendChild(subjectTextElement);
            String[] subjectParams = message.getSubjectParameters();
            for (int p = 0; p < subjectParams.length; p++) {
                Element paramElement = helper.createElement("param", subjectParams[p]);
                subjectElement.appendChild(paramElement);
            }

            Element bodyElement = helper.createElement("body");
            messageElement.appendChild(bodyElement);
            Element bodyTextElement = helper.createElement("text", message.getBody());
            bodyElement.appendChild(bodyTextElement);
            String[] bodyParams = message.getBodyParameters();
            for (int p = 0; p < bodyParams.length; p++) {
                Element paramElement = helper.createElement("param", bodyParams[p]);
                bodyElement.appendChild(paramElement);
            }
           
View Full Code Here

        Identifiable[] recipients = { recipient };
        String subject = getSubject();
        String body = getBody();

        Message message = new Message(subject, new String[0], body, new String[0], sender,
                recipients);
        NotificationUtil.notify(this.manager, message);

    }
View Full Code Here

        Text[] subjectParams = { new Text(getEvent(), true) };
        Text[] params = { new Text(url, false), new Text(userMessage, false) };
        Text subject = new Text(MESSAGE_SUBJECT, subjectParams);
        Text body = new Text(MESSAGE_DOCUMENT_SUBMITTED, params);
        Message message = new Message(subject, body, sender, recipients);


        NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
        RepositoryEvent event = RepositoryEventFactory.createEvent(this.manager, getSession(),
                getLogger(), descriptor);
View Full Code Here

        cleanUp(inbox, SUBJECT);
        assertFalse(containsMessage(inbox, SUBJECT));
       
        Identifiable[] recipients = { lenya };

        Message message = new Message(SUBJECT, new String[0], "body", new String[0], lenya,
                recipients);
        InboxMessage inboxMessage = inbox.add(message);
       
        assertEquals(inboxMessage.getMessage().getSubject(), SUBJECT);
       
View Full Code Here

        Text subject = new Text(MESSAGE_SUBJECT, subjectParams);
       
        String userMessage = getParameterAsString(PARAM_USER_NOTIFICATION_MESSAGE, "");
        Text[] params = { new Text(url, false), new Text(userMessage, false) };
        Text body = new Text(MESSAGE_DOCUMENT_PUBLISHED, params);
        Message message = new Message(subject, body, sender, recipients);

        NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
        RepositoryEvent event = RepositoryEventFactory.createEvent(this.manager, getSession(),
                getLogger(), descriptor);
        getSession().enqueueEvent(event);
View Full Code Here

           
            Text[] subjectParams = { new Text(getEvent(), true) };
            Text[] params = { new Text(reason, false), new Text(url, false) };
            Text subject = new Text(MESSAGE_SUBJECT, subjectParams);
            Text body = new Text(MESSAGE_DOCUMENT_REJECTED, params);
            Message message = new Message(subject, body, sender, recipients);

            NotificationEventDescriptor descriptor = new NotificationEventDescriptor(message);
            RepositoryEvent event = RepositoryEventFactory.createEvent(this.manager, getSession(),
                    getLogger(), descriptor);
            getSession().enqueueEvent(event);
View Full Code Here

        String name = getParameterAsString(NAME);
        String body = getParameterAsString(MESSAGE);
        String from = getParameterAsString(FROM);

        Message message = new Message("Contact form submitted by " + name + " (" + from + ")",
                new String[0],
                body,
                new String[0],
                sender,
                recipients);
View Full Code Here

            String subject = "indexing-failed-subject";
            String[] subjectParams = new String[0];
            String body = "indexing-failed-body";
            String[] bodyParams = { this.pubId, this.area, this.uuid, this.language, msg };

            Message message = new Message(subject, subjectParams, body, bodyParams, sender,
                    recipients);
            NotificationUtil.notify(this.manager, message);

            getLogger().error(
                    "Could not index document [" + this.pubId + ":" + this.area + ":" + this.uuid
View Full Code Here

TOP

Related Classes of org.apache.lenya.notification.Message

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.