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.dila.business.fichelocale.dao;
35  
36  import fr.paris.lutece.plugins.dila.business.fichelocale.dto.XmlDTO;
37  
38  import java.util.List;
39  
40  
41  /**
42   * DAO for {@link XmlDTO}
43   */
44  public interface IXmlDAO
45  {
46      /**
47       * Find the title of a {@link XmlDTO}
48       * @param id the id to find
49       * @return the corresponding title
50       */
51      String findTitleById( String id );
52  
53      /**
54       * Find a {@link XmlDTO} by its id
55       * @param id the id to find
56       * @return the corresponding {@link XmlDTO}
57       */
58      XmlDTO findFolderById( String id );
59  
60      /**
61       * Find the resource type of a {@link XmlDTO}
62       * @param strIdXml the xml id
63       * @param lIdAudience the audience id
64       * @return the corresponding resource type
65       */
66      String findResourceTypeByIdXMLAndAudience( String strIdXml, Long lIdAudience );
67  
68      /**
69       * Find a {@link XmlDTO} by its id and type
70       * @param parentThemeId the id to find
71       * @param availableTypes list of types for the resource
72       * @param audienceId the id audience
73       * @return the corresponding title
74       */
75      XmlDTO findByIdAndTypesAndAudience( String parentThemeId, List<String> availableTypes, Long audienceId );
76  
77      /**
78       * Find the title of a {@link XmlDTO}
79       * @param siblingFolderId the id to find
80       * @param availableTypes list of types for the resource
81       * @param idAudience the id audience
82       * @return the corresponding title
83       */
84      String findTitleByIdAndTypesAndAudience( String siblingFolderId, List<String> availableTypes, Long idAudience );
85  
86      /**
87       * Find all XML
88       * @return list of all XML files
89       */
90      List<XmlDTO> findAll(  );
91  
92      /**
93       * Find all "Comment faire si" resources for audience
94       * @param audienceId the audience to check
95       * @return the list of corresponding {@link XmlDTO}
96       */
97      List<XmlDTO> findHowToByAudience( Long audienceId );
98  
99      /**
100      * Find a national card's technical id by its xml name and audience
101      * @param xmlName the xmlName
102      * @param audienceId the audience id
103      * @return the technical id, null if not found
104      */
105     Long findIdByXmlAndAudience( String xmlName, Long audienceId );
106 
107     /**
108      * Find the "How to ..." section for given audience
109      * @param audienceId the audienceId
110      * @return {@link XmlDTO} for "How to ..." section of given audience
111      */
112     XmlDTO findHomeHowTo( Long audienceId );
113 
114     /**
115      * Create a {@link XmlDTO}
116      * @param dilaXml the xml to create
117      */
118     void create( XmlDTO dilaXml );
119 
120     /**
121      * Update a {@link XmlDTO}
122      * @param dilaXml the xml to store
123      */
124     void store( XmlDTO dilaXml );
125 
126     /**
127      * Delete old files
128      */
129     void delete(  );
130 }