001/*
002 * (C) Copyright 2007 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021
022package org.nuxeo.ecm.platform.ec.notification.service;
023
024import java.util.ArrayList;
025import java.util.List;
026
027import org.nuxeo.common.xmap.annotation.XNode;
028import org.nuxeo.common.xmap.annotation.XNodeList;
029import org.nuxeo.common.xmap.annotation.XObject;
030import org.nuxeo.ecm.platform.notification.api.Notification;
031
032/**
033 * @author <a href="mailto:npaslaru@nuxeo.com">Narcis Paslaru</a>
034 * @author <a href="mailto:tmartins@nuxeo.com">Thierry Martins</a>
035 */
036@XObject("notification")
037public class NotificationDescriptor implements Notification {
038
039    private static final long serialVersionUID = -5974825427889204458L;
040
041    @XNode("@name")
042    protected String name;
043
044    @XNode("@label")
045    protected String label; // used for i10n
046
047    @XNode("@channel")
048    protected String channel;
049
050    @XNode("@subject")
051    protected String subject;
052
053    @XNode("@subjectTemplate")
054    protected String subjectTemplate;
055
056    @XNode("@template")
057    protected String template;
058
059    /**
060     * The mail template name will be dinamycally evaluated from a Mvel exp
061     *
062     * @since 5.6
063     */
064    @XNode("@templateExpr")
065    protected String templateExpr;
066
067    @XNode("@enabled")
068    protected boolean enabled = true;
069
070    @XNode("@autoSubscribed")
071    protected boolean autoSubscribed = false;
072
073    @XNode("@availableIn")
074    protected String availableIn;
075
076    @XNodeList(value = "event", type = ArrayList.class, componentType = NotificationEventDescriptor.class)
077    protected List<NotificationEventDescriptor> events;
078
079    public boolean getAutoSubscribed() {
080        return autoSubscribed;
081    }
082
083    public String getAvailableIn() {
084        return availableIn;
085    }
086
087    public String getChannel() {
088        return channel;
089    }
090
091    public boolean getEnabled() {
092        return enabled;
093    }
094
095    public List<NotificationEventDescriptor> getEvents() {
096        return events;
097    }
098
099    public String getLabel() {
100        return label;
101    }
102
103    public String getName() {
104        return name;
105    }
106
107    public String getSubject() {
108        return subject;
109    }
110
111    public String getTemplate() {
112        return template;
113    }
114
115    public String getSubjectTemplate() {
116        return subjectTemplate;
117    }
118
119    public String getTemplateExpr() {
120        return templateExpr;
121    }
122
123}