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 @Override 080 public boolean getAutoSubscribed() { 081 return autoSubscribed; 082 } 083 084 @Override 085 public String getAvailableIn() { 086 return availableIn; 087 } 088 089 @Override 090 public String getChannel() { 091 return channel; 092 } 093 094 @Override 095 public boolean getEnabled() { 096 return enabled; 097 } 098 099 public List<NotificationEventDescriptor> getEvents() { 100 return events; 101 } 102 103 @Override 104 public String getLabel() { 105 return label; 106 } 107 108 @Override 109 public String getName() { 110 return name; 111 } 112 113 @Override 114 public String getSubject() { 115 return subject; 116 } 117 118 @Override 119 public String getTemplate() { 120 return template; 121 } 122 123 @Override 124 public String getSubjectTemplate() { 125 return subjectTemplate; 126 } 127 128 @Override 129 public String getTemplateExpr() { 130 return templateExpr; 131 } 132 133}