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.service;
35  
36  import fr.paris.lutece.plugins.dila.business.fichelocale.dto.XmlDTO;
37  
38  import org.w3c.dom.Document;
39  
40  import java.util.List;
41  import java.util.Locale;
42  
43  import javax.xml.parsers.DocumentBuilder;
44  
45  
46  /**
47   * Interface for {@link XmlDTO}
48   */
49  public interface IDilaXmlService
50  {
51      /**
52       * Find the title of a {@link XmlDTO}
53       * @param id the id to find
54       * @return the corresponding title
55       */
56      String findTitleById( String id );
57  
58      /**
59       * Find a {@link XmlDTO} by its id
60       * @param id the id to find
61       * @return the corresponding {@link XmlDTO}
62       */
63      XmlDTO findFolderById( String id );
64  
65      /**
66       * Find the resource type of a {@link XmlDTO}
67       * @param strIdXml the xml id
68       * @param lIdAudience the audience id
69       * @return the corresponding type_resource
70       */
71      String findResourceTypeByIdXMLAndAudience( String strIdXml, Long lIdAudience );
72  
73      /**
74       * Find a {@link XmlDTO} by its id and type
75       * @param idThemeParent the id to find
76       * @param availableTypes list of types for the resource
77       * @param idAudience the id audience
78       * @return the corresponding title
79       */
80      XmlDTO findByIdAndTypesAndAudience( String idThemeParent, List<String> availableTypes, Long idAudience );
81  
82      /**
83       * Find the title of a {@link XmlDTO}
84       * @param siblingFolderId the id to find
85       * @param availableTypes list of types for the resource
86       * @param idAudience the id audience
87       * @return the corresponding title
88       */
89      String findTitleByIdAndTypesAndAudience( String siblingFolderId, List<String> availableTypes, Long idAudience );
90  
91      /**
92       * Find all XML
93       * @return list of all XML files
94       */
95      List<XmlDTO> findAll(  );
96  
97      /**
98       * Insert "comment faire" resource in document
99       * @param audienceId the audience to check
100      * @param builder the document builder
101      * @param document the document
102      * @return the updated document
103      */
104     Document insertHowToLinks( Long audienceId, DocumentBuilder builder, Document document );
105 
106     /**
107      * Find a national card's technical id by it xml name and audience
108      * @param xmlName the xmlName
109      * @param audienceId the audience id
110      * @return the technical id, null if not found
111      */
112     Long findIdByXmlAndAudience( String xmlName, Long audienceId );
113 
114     /**
115      * Access RSS feeds and get links to display in document
116      * @param builder the builder
117      * @param document the document
118      * @param locale the locale
119      * @return the modified document
120      */
121     Document insertRssLinks( DocumentBuilder builder, Document document, Locale locale );
122 
123     /**
124      * Find the "How to ..." section for given audience
125      * @param audienceId the audienceId
126      * @return {@link XmlDTO} for "How to ..." section of given audience
127      */
128     XmlDTO findHomeHowTo( Long audienceId );
129 }