1 package fr.paris.lutece.plugins.grustoragedb.business;
2
3 import fr.paris.lutece.plugins.grubusiness.business.notification.INotificationDAO;
4 import fr.paris.lutece.plugins.grubusiness.business.notification.Notification;
5 import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationFilter;
6 import fr.paris.lutece.portal.service.file.IFileStoreServiceProvider;
7 import fr.paris.lutece.portal.service.plugin.Plugin;
8 import fr.paris.lutece.portal.service.plugin.PluginService;
9 import fr.paris.lutece.portal.service.spring.SpringContextService;
10 import fr.paris.lutece.util.ReferenceList;
11
12 import java.util.List;
13 import java.util.Optional;
14
15
16
17
18 public final class NotificationHome
19 {
20
21 private static INotificationDAO _dao = SpringContextService.getBean( "grustoragedb.NotificationDAO" );
22 private static Plugin _plugin = PluginService.getPlugin( "grustoragedb" );
23
24
25
26
27 private NotificationHome( )
28 {
29 }
30
31
32
33
34
35
36
37
38 public static List<Notification> findByDemand( String strDemandId, String strDemandTypeId )
39 {
40 return _dao.loadByDemand(strDemandId, strDemandTypeId);
41 }
42
43
44
45
46
47
48
49
50
51
52 public static List<Notification> findByNotification( String strDemandId, String strDemandTypeId, long lDate )
53 {
54 return _dao.loadByDemandAndDate(strDemandId, strDemandTypeId, lDate);
55 }
56
57
58
59
60
61
62
63 public static Optional<Notification> getById( int id )
64 {
65 return _dao.loadById( id );
66 }
67
68
69
70
71
72
73
74 public static List<Notification> findByFilter( NotificationFilter filter )
75 {
76 return _dao.loadByFilter( filter );
77 }
78
79
80
81
82
83
84
85 public static List<Integer> findIdsByFilter( NotificationFilter filter )
86 {
87 return _dao.loadIdsByFilter( filter );
88 }
89
90
91
92
93
94
95
96 public static List<Notification> getByFilter(NotificationFilter notificationFilter )
97 {
98 return _dao.loadByFilter( notificationFilter );
99 }
100
101
102
103
104
105
106
107
108
109 public static List<Notification> getByDemandIdTypeIdCustomerId( String strDemandId, String strDemandTypeId, String strCustomerId )
110 {
111 return _dao.loadByDemandIdTypeIdCustomerId( strDemandId, strDemandTypeId, strCustomerId );
112 }
113
114
115
116
117
118
119
120 public static List<Notification> getByIds(List<Integer> listIds )
121 {
122 return _dao.loadByIds( listIds );
123 }
124
125
126
127
128
129
130 public static ReferenceList getDemandTypeIds( )
131 {
132 List<String> strList = _dao.loadDistinctDemandTypeIds( );
133
134 ReferenceList refList = new ReferenceList( );
135 for (String strId : strList )
136 {
137 refList.addItem(strId, strId);
138 }
139
140 return refList;
141 }
142
143
144
145
146
147
148
149
150 public static Notification create( Notification notification )
151 {
152 _dao.insert( notification );
153
154 return notification;
155 }
156
157
158
159
160
161
162
163 public static void remove( int nKey )
164 {
165 _dao.delete( nKey );
166 }
167
168
169
170
171
172
173
174 public static Notification getLastNotifByDemandIdAndDemandTypeId( String strDemandId, String strDemandTypeId )
175 {
176 return _dao.loadLastNotifByDemandIdAndDemandTypeId( strDemandId, strDemandTypeId );
177 }
178 }