1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.notifications.notifiers.internal.email

File WikiEmailNotificationRendererDocumentInitializer.java

 

Coverage histogram

../../../../../../img/srcFileCovDistChart10.png
0% of files have more coverage

Code metrics

0
5
2
1
101
39
2
0.4
2.5
2
1

Classes

Class Line # Actions
WikiEmailNotificationRendererDocumentInitializer 44 5 0% 2 0
1.0100%
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.notifications.notifiers.internal.email;
21   
22    import java.util.Arrays;
23    import java.util.List;
24   
25    import javax.inject.Named;
26    import javax.inject.Singleton;
27   
28    import org.xwiki.component.annotation.Component;
29    import org.xwiki.model.reference.LocalDocumentReference;
30   
31    import com.xpn.xwiki.doc.AbstractMandatoryClassInitializer;
32    import com.xpn.xwiki.objects.classes.BaseClass;
33    import com.xpn.xwiki.objects.classes.TextAreaClass;
34   
35    /**
36    * Define the NotificationEmailRendererClass XObjects.
37    *
38    * @version $Id: f866f6ca33a0c9a061509a93b42c317c99dfe268 $
39    * @since 9.11.1
40    */
41    @Component
42    @Named(WikiEmailNotificationRendererDocumentInitializer.XCLASS_NAME)
43    @Singleton
 
44    public class WikiEmailNotificationRendererDocumentInitializer extends AbstractMandatoryClassInitializer
45    {
46    /**
47    * The name of the XObject class that should be bound used.
48    */
49    public static final String XCLASS_NAME = "XWiki.Notifications.Code.NotificationEmailRendererClass";
50   
51    /**
52    * The name of the event type property in the XObject.
53    */
54    public static final String EVENT_TYPE = "eventType";
55   
56    /**
57    * The name of the notification html template property in the XObject.
58    */
59    public static final String HTML_TEMPLATE = "htmlTemplate";
60   
61    /**
62    * The name of the notification plain text template property in the XObject.
63    */
64    public static final String PLAIN_TEXT_TEMPLATE = "plainTextTemplate";
65   
66    /**
67    * The name of the email sibject property in the XObject.
68    */
69    public static final String EMAIL_SUBJECT_TEMPLATE = "emailSubject";
70   
71    /**
72    * The name of the space where the class is located.
73    */
74    private static final List<String> SPACE_PATH = Arrays.asList("XWiki", "Notifications", "Code");
75   
76    /**
77    * Reference of the XClass to create.
78    */
79    public static final LocalDocumentReference CLASS_REFERENCE
80    = new LocalDocumentReference(SPACE_PATH, "NotificationEmailRendererClass");
81   
82    /**
83    * Default constructor.
84    */
 
85  12 toggle public WikiEmailNotificationRendererDocumentInitializer()
86    {
87  12 super(CLASS_REFERENCE);
88    }
89   
 
90  14 toggle @Override
91    protected void createClass(BaseClass xclass)
92    {
93  14 xclass.addTextField(EVENT_TYPE, "Event type", 64);
94  14 xclass.addTextAreaField(HTML_TEMPLATE, "HTML template",
95    40, 3, TextAreaClass.ContentType.VELOCITY_CODE);
96  14 xclass.addTextAreaField(PLAIN_TEXT_TEMPLATE, "Plain text template",
97    40, 3, TextAreaClass.ContentType.VELOCITY_CODE);
98  14 xclass.addTextAreaField(EMAIL_SUBJECT_TEMPLATE, "Email subject template",
99    40, 3, TextAreaClass.ContentType.VELOCITY_CODE);
100    }
101    }