View Javadoc

1   /*
2    * Copyright (c) 2002-2014, Mairie de Paris
3    * All rights reserved.
4    *
5    * Redistribution and use in source and binary forms, with or without
6    * modification, are permitted provided that the following conditions
7    * are met:
8    *
9    *  1. Redistributions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Redistributions in binary form must reproduce the above copyright notice
13   *     and the following disclaimer in the documentation and/or other materials
14   *     provided with the distribution.
15   *
16   *  3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17   *     contributors may be used to endorse or promote products derived from
18   *     this software without specific prior written permission.
19   *
20   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30   * POSSIBILITY OF SUCH DAMAGE.
31   *
32   * License 1.0
33   */
34  package fr.paris.lutece.plugins.formengine.business;
35  
36  import fr.paris.lutece.portal.service.plugin.Plugin;
37  import fr.paris.lutece.portal.service.spring.SpringContextService;
38  
39  import java.util.List;
40  
41  
42  /**
43   *
44   * NoticeGroupGroupHome
45   */
46  public final class NoticeGroupHome
47  {
48      // Static variable pointed at the DAO instance
49      private static INoticeGroupDAO _dao = (INoticeGroupDAO) SpringContextService.getPluginBean( "formengine",
50              "formengine.noticeGroupDAO" );
51  
52      /**
53       * Private constructor - this class need not be instantiated
54       */
55      private NoticeGroupHome(  )
56      {
57      }
58  
59      /**
60       * Creation of an instance of noticeGroup
61       *
62       * @param noticeGroup The instance of the NoticeGroup which contains the informations to store
63       * @param plugin the Plugin
64       * @return The primary key of the new noticeGroup.
65       */
66      public static int create( NoticeGroup noticeGroup, Plugin plugin )
67      {
68          return _dao.insert( noticeGroup, plugin );
69      }
70  
71      /**
72       * Copy of an instance of noticeGroup
73       *
74       * @param noticeGroup The instance of the noticeGroup who must copy
75       * @param plugin the Plugin
76       *
77       */
78      public static void copy( NoticeGroup noticeGroup, Plugin plugin )
79      {
80          create( noticeGroup, plugin );
81      }
82  
83      /**
84       * Update of the noticeGroup which is specified in parameter
85       *
86       * @param noticeGroup The instance of the noticeGroup which contains the informations to update
87       * @param plugin the Plugin
88       *
89       */
90      public static void update( NoticeGroup noticeGroup, Plugin plugin )
91      {
92          _dao.store( noticeGroup, plugin );
93      }
94  
95      /**
96       * Remove the noticeGroup whose identifier is specified in parameter
97       *
98       * @param nIdNoticeGroup The noticeGroup Id
99       * @param plugin the Plugin
100      */
101     public static void remove( int nIdNoticeGroup, Plugin plugin )
102     {
103         _dao.delete( nIdNoticeGroup, plugin );
104     }
105 
106     ///////////////////////////////////////////////////////////////////////////
107     // Finders
108     /**
109      * Returns an instance of a noticeGroup whose identifier is specified in parameter
110      *
111      * @param nKey The entry primary key
112      * @param plugin the Plugin
113      * @return an instance of noticeGroup
114      */
115     public static NoticeGroup findByPrimaryKey( int nKey, Plugin plugin )
116     {
117         return _dao.load( nKey, plugin );
118     }
119 
120     /**
121      * Finds all notice groups matching filter
122      * @param filter the filter
123      * @param plugin the plugin
124      * @return all notice groups
125      */
126     public static List<NoticeGroup> findByFilter( NoticeGroupFilter filter, Plugin plugin )
127     {
128         return _dao.selectNoticeGroupByFilter( filter, plugin );
129     }
130 
131     /**
132      * Returns an instance of a noticeGroup whose identifier is specified in parameter
133      *
134      * @param strIdForm The of of the noticeGroup
135      * @param plugin the Plugin
136      * @return an instance of noticeGroup
137      */
138     public static List<NoticeGroup> findNoticeGroupById( String strIdForm, Plugin plugin )
139     {
140         return _dao.getNoticeGroupByIdForm( strIdForm, plugin );
141     }
142 
143     /**
144      * Returns true if is enable false otherwise
145      *
146      * @param noticeGroup The noticeGroup
147      * @param plugin the Plugin
148      * @return  true if is enable false otherwise
149      */
150     public static boolean isEnable( NoticeGroup noticeGroup, Plugin plugin )
151     {
152         return _dao.isEnable( noticeGroup, plugin );
153     }
154 }