Skip to content

Commit 0a7d883

Browse files
committed
LUT-25131 : Modernize the markup language used
1 parent f1c8755 commit 0a7d883

File tree

59 files changed

+65999
-1171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+65999
-1171
lines changed

pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@
6666
<version>2.4</version>
6767
<classifier>jdk15</classifier>
6868
</dependency>
69+
<!-- Used to convert html to markdown -->
70+
<dependency>
71+
<groupId>com.vladsch.flexmark</groupId>
72+
<artifactId>flexmark-all</artifactId>
73+
<version>0.62.2</version>
74+
</dependency>
6975
</dependencies>
7076

7177
<properties>

src/java/fr/paris/lutece/plugins/wiki/business/ITopicVersionDAO.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public interface ITopicVersionDAO
7575
*/
7676
TopicVersion load( int nKey, Plugin plugin );
7777

78+
void deleteByTopicVersion(int nTopicId, Plugin plugin);
7879
/**
7980
* Load the data of all the topicVersion objects and returns them as a collection
8081
*

src/java/fr/paris/lutece/plugins/wiki/business/TopicDAO.java

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,11 @@ public final class TopicDAO implements ITopicDAO
4747
// Constants
4848
private static final String SQL_QUERY_NEW_PK = "SELECT max( id_topic ) FROM wiki_topic";
4949
private static final String SQL_QUERY_SELECT = "SELECT id_topic, namespace, page_name, page_view_role, page_edit_role, parent_page_name FROM wiki_topic WHERE id_topic = ?";
50-
private static final String SQL_QUERY_INSERT = "INSERT INTO wiki_topic ( id_topic, namespace, page_name, page_view_role, page_edit_role, parent_page_name ) VALUES ( ?, ?, ?, ?, ?, ? ) ";
50+
private static final String SQL_QUERY_INSERT = "INSERT INTO wiki_topic ( id_topic, namespace, page_name, page_view_role, page_edit_role, parent_page_name ) VALUES (?, ?, ?, ?, ?, ? ) ";
5151
private static final String SQL_QUERY_DELETE = "DELETE FROM wiki_topic WHERE id_topic = ? ";
5252
private static final String SQL_QUERY_UPDATE = "UPDATE wiki_topic SET id_topic = ?, namespace = ?, page_name = ?, page_view_role = ?, page_edit_role = ?, parent_page_name = ? WHERE id_topic = ?";
5353
private static final String SQL_QUERY_SELECTALL = "SELECT id_topic, namespace, page_name, page_view_role, page_edit_role, parent_page_name FROM wiki_topic";
5454
private static final String SQL_QUERY_SELECT_BY_NAME = "SELECT id_topic, namespace, page_name, page_view_role, page_edit_role, parent_page_name FROM wiki_topic WHERE page_name = ?";
55-
5655
/**
5756
* Generates a new primary key
5857
*
@@ -64,7 +63,7 @@ public int newPrimaryKey( Plugin plugin )
6463
{
6564
int nKey;
6665

67-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_NEW_PK, plugin ) )
66+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_NEW_PK, plugin ) )
6867
{
6968
daoUtil.executeQuery( );
7069

@@ -81,7 +80,7 @@ public int newPrimaryKey( Plugin plugin )
8180
@Override
8281
public void insert( Topic topic, Plugin plugin )
8382
{
84-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, plugin ) )
83+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_INSERT, plugin ) )
8584
{
8685
topic.setIdTopic( newPrimaryKey( plugin ) );
8786

@@ -104,21 +103,14 @@ public Topic load( int nId, Plugin plugin )
104103
{
105104
Topic topic = null;
106105

107-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT, plugin ) )
106+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT, plugin ) )
108107
{
109108
daoUtil.setInt( 1, nId );
110109
daoUtil.executeQuery( );
111110

112111
if ( daoUtil.next( ) )
113112
{
114-
topic = new Topic( );
115-
116-
topic.setIdTopic( daoUtil.getInt( 1 ) );
117-
topic.setNamespace( daoUtil.getInt( 2 ) );
118-
topic.setPageName( daoUtil.getString( 3 ) );
119-
topic.setViewRole( daoUtil.getString( 4 ) );
120-
topic.setEditRole( daoUtil.getString( 5 ) );
121-
topic.setParentPageName( daoUtil.getString( 6 ) );
113+
topic = setTopicWithDaoUtil(daoUtil);
122114
}
123115
}
124116

@@ -131,7 +123,7 @@ public Topic load( int nId, Plugin plugin )
131123
@Override
132124
public void delete( int nTopicId, Plugin plugin )
133125
{
134-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE, plugin ) )
126+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_DELETE, plugin ) )
135127
{
136128
daoUtil.setInt( 1, nTopicId );
137129
daoUtil.executeUpdate( );
@@ -144,7 +136,7 @@ public void delete( int nTopicId, Plugin plugin )
144136
@Override
145137
public void store( Topic topic, Plugin plugin )
146138
{
147-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE, plugin ) )
139+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_UPDATE, plugin ) )
148140
{
149141
daoUtil.setInt( 1, topic.getIdTopic( ) );
150142
daoUtil.setInt( 2, topic.getNamespace( ) );
@@ -165,20 +157,13 @@ public void store( Topic topic, Plugin plugin )
165157
public Collection<Topic> selectTopicsList( Plugin plugin )
166158
{
167159
Collection<Topic> topicList = new ArrayList<>( );
168-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin ) )
160+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECTALL, plugin ) )
169161
{
170162
daoUtil.executeQuery( );
171163

172164
while ( daoUtil.next( ) )
173165
{
174-
Topic topic = new Topic( );
175-
176-
topic.setIdTopic( daoUtil.getInt( 1 ) );
177-
topic.setNamespace( daoUtil.getInt( 2 ) );
178-
topic.setPageName( daoUtil.getString( 3 ) );
179-
topic.setViewRole( daoUtil.getString( 4 ) );
180-
topic.setEditRole( daoUtil.getString( 5 ) );
181-
topic.setParentPageName( daoUtil.getString( 6 ) );
166+
Topic topic = setTopicWithDaoUtil(daoUtil);
182167

183168
topicList.add( topic );
184169
}
@@ -195,24 +180,30 @@ public Topic load( String strTopicName, Plugin plugin )
195180
{
196181
Topic topic = null;
197182

198-
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_BY_NAME, plugin ) )
183+
try( DAOUtil daoUtil = new DAOUtil( SQL_QUERY_SELECT_BY_NAME, plugin ) )
199184
{
200185
daoUtil.setString( 1, strTopicName );
201186
daoUtil.executeQuery( );
202187

203188
if ( daoUtil.next( ) )
204189
{
205-
topic = new Topic( );
206-
207-
topic.setIdTopic( daoUtil.getInt( 1 ) );
208-
topic.setNamespace( daoUtil.getInt( 2 ) );
209-
topic.setPageName( daoUtil.getString( 3 ) );
210-
topic.setViewRole( daoUtil.getString( 4 ) );
211-
topic.setEditRole( daoUtil.getString( 5 ) );
212-
topic.setParentPageName( daoUtil.getString( 6 ) );
190+
topic = setTopicWithDaoUtil(daoUtil);
213191
}
214192
}
215193

216194
return topic;
217195
}
196+
/**
197+
* set the content of a topic version with doaUtil
198+
*/
199+
public Topic setTopicWithDaoUtil(DAOUtil daoUtil) {
200+
Topic topic = new Topic( );
201+
topic.setIdTopic( daoUtil.getInt( 1 ) );
202+
topic.setNamespace( daoUtil.getInt( 2 ) );
203+
topic.setPageName( daoUtil.getString( 3 ) );
204+
topic.setViewRole( daoUtil.getString( 4 ) );
205+
topic.setEditRole( daoUtil.getString( 5 ) );
206+
topic.setParentPageName( daoUtil.getString( 6 ) );
207+
return topic;
208+
}
218209
}

src/java/fr/paris/lutece/plugins/wiki/business/TopicHome.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static Topic findByPrimaryKey( int nKey )
119119
* The topic name
120120
* @return The topic
121121
*/
122-
public static Topic findByPrimaryKey( String strTopicName )
122+
public static Topic findByPageName( String strTopicName )
123123
{
124124
return _dao.load( strTopicName, _plugin );
125125
}
@@ -133,4 +133,5 @@ public static Collection<Topic> getTopicsList( )
133133
{
134134
return _dao.selectTopicsList( _plugin );
135135
}
136+
136137
}

0 commit comments

Comments
 (0)