001/*
002 * (C) Copyright 2007 Nuxeo SAS (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Nuxeo - initial API and implementation
016 *
017 * $Id$
018 */
019
020package org.nuxeo.ecm.platform.ec.notification.service;
021
022import java.util.ArrayList;
023import java.util.List;
024
025import org.nuxeo.common.xmap.annotation.XNode;
026import org.nuxeo.common.xmap.annotation.XNodeList;
027import org.nuxeo.common.xmap.annotation.XObject;
028import org.nuxeo.ecm.platform.notification.api.Notification;
029
030/**
031 * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
032 * @author <a href="mailto:tmartins@nuxeo.com">Thierry Martins</a>
033 */
034@XObject("notification")
035public class NotificationDescriptor implements Notification {
036
037    private static final long serialVersionUID = -5974825427889204458L;
038
039    @XNode("@name")
040    protected String name;
041
042    @XNode("@label")
043    protected String label; // used for i10n
044
045    @XNode("@channel")
046    protected String channel;
047
048    @XNode("@subject")
049    protected String subject;
050
051    @XNode("@subjectTemplate")
052    protected String subjectTemplate;
053
054    @XNode("@template")
055    protected String template;
056
057    /**
058     * The mail template name will be dinamycally evaluated from a Mvel exp
059     *
060     * @since 5.6
061     */
062    @XNode("@templateExpr")
063    protected String templateExpr;
064
065    @XNode("@enabled")
066    protected boolean enabled = true;
067
068    @XNode("@autoSubscribed")
069    protected boolean autoSubscribed = false;
070
071    @XNode("@availableIn")
072    protected String availableIn;
073
074    @XNodeList(value = "event", type = ArrayList.class, componentType = NotificationEventDescriptor.class)
075    protected List<NotificationEventDescriptor> events;
076
077    public boolean getAutoSubscribed() {
078        return autoSubscribed;
079    }
080
081    public String getAvailableIn() {
082        return availableIn;
083    }
084
085    public String getChannel() {
086        return channel;
087    }
088
089    public boolean getEnabled() {
090        return enabled;
091    }
092
093    public List<NotificationEventDescriptor> getEvents() {
094        return events;
095    }
096
097    public String getLabel() {
098        return label;
099    }
100
101    public String getName() {
102        return name;
103    }
104
105    public String getSubject() {
106        return subject;
107    }
108
109    public String getTemplate() {
110        return template;
111    }
112
113    public String getSubjectTemplate() {
114        return subjectTemplate;
115    }
116
117    public String getTemplateExpr() {
118        return templateExpr;
119    }
120
121}