dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09736
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2639: Removed outdated jforum integration module
------------------------------------------------------------
revno: 2639
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-19 13:45:59 +0100
message:
Removed outdated jforum integration module
removed:
local/za/
local/za/dhis-web-jforum-integration/
local/za/dhis-web-jforum-integration/pom.xml
local/za/dhis-web-jforum-integration/src/
local/za/dhis-web-jforum-integration/src/main/
local/za/dhis-web-jforum-integration/src/main/java/
local/za/dhis-web-jforum-integration/src/main/java/org/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/NoAction.java
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/PopulateJForumAction.java
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JForumManager.java
local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JdbcJForumManager.java
local/za/dhis-web-jforum-integration/src/main/resources/
local/za/dhis-web-jforum-integration/src/main/resources/META-INF/
local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis/
local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis/beans.xml
local/za/dhis-web-jforum-integration/src/main/resources/org/
local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/
local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/
local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/
local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module.properties
local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module_es_ES.properties
local/za/dhis-web-jforum-integration/src/main/resources/struts.xml
local/za/dhis-web-jforum-integration/src/main/webapp/
local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF/
local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF/web.xml
local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration/
local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration/populateForm.vm
local/za/dhis-web-jforum-integration/src/test/
local/za/dhis-web-jforum-integration/src/test/java/
local/za/dhis-web-jforum-integration/src/test/java/org/
local/za/dhis-web-jforum-integration/src/test/java/org/hisp/
local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/
local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/
local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager/
local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager/JForumManagerTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed directory 'local/za'
=== removed directory 'local/za/dhis-web-jforum-integration'
=== removed file 'local/za/dhis-web-jforum-integration/pom.xml'
--- local/za/dhis-web-jforum-integration/pom.xml 2009-09-06 15:51:11 +0000
+++ local/za/dhis-web-jforum-integration/pom.xml 1970-01-01 00:00:00 +0000
@@ -1,51 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-web</artifactId>
- <version>2.0.3-SNAPSHOT</version>
- </parent>
-
- <artifactId>dhis-web-jforum-integration</artifactId>
- <packaging>war</packaging>
- <name>DHIS JForum Integration</name>
-
- <build>
- <finalName>dhis-web-maintenance-systemadmin</finalName>
- </build>
-
- <dependencies>
-
- <!-- DHIS -->
-
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-web-commons</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-web-commons-resources</artifactId>
- <type>war</type>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-service-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-support-hibernate</artifactId>
- </dependency>
- <dependency>
- <groupId>org.hisp.dhis</groupId>
- <artifactId>dhis-support-test</artifactId>
- </dependency>
-
- </dependencies>
-</project>
=== removed directory 'local/za/dhis-web-jforum-integration/src'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/NoAction.java'
--- local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/NoAction.java 2010-04-12 21:23:33 +0000
+++ local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/NoAction.java 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
-package org.hisp.dhis.jforum.action;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class NoAction
- implements Action
-{
- public String execute()
- throws Exception
- {
- return SUCCESS;
- }
-
-}
=== removed file 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/PopulateJForumAction.java'
--- local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/PopulateJForumAction.java 2010-04-12 21:23:33 +0000
+++ local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/action/PopulateJForumAction.java 1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
-package org.hisp.dhis.jforum.action;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.jforum.manager.JForumManager;
-import org.hisp.dhis.system.util.TimeUtils;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class PopulateJForumAction
- implements Action
-{
- private JForumManager forumManager;
-
- public void setForumManager( JForumManager forumManager )
- {
- this.forumManager = forumManager;
- }
-
- private String baseUrl;
-
- public void setBaseUrl( String baseUrl )
- {
- this.baseUrl = baseUrl;
- }
-
- private String time;
-
- public String getTime()
- {
- return time;
- }
-
- public String execute()
- throws Exception
- {
- TimeUtils.start();
-
- forumManager.populateJForum();
-
- forumManager.populateUrls( baseUrl );
-
- time = TimeUtils.getHMS();
-
- return SUCCESS;
- }
-}
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JForumManager.java'
--- local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JForumManager.java 2010-04-12 21:23:33 +0000
+++ local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JForumManager.java 1970-01-01 00:00:00 +0000
@@ -1,52 +0,0 @@
-package org.hisp.dhis.jforum.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public interface JForumManager
-{
- String ID = JForumManager.class.getName();
-
- /**
- * Adds a topic, post, and post text entry in the JForum database for all
- * data elements and indicators.
- */
- void populateJForum();
-
- /**
- * Updates the url property for data elements and indicators with a
- * corresponding URL based on the given base url pointing to a topic in
- * JForum.
- *
- * @param rootUrl the base URL.
- */
- void populateUrls( String baseUrl );
-}
=== removed file 'local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JdbcJForumManager.java'
--- local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JdbcJForumManager.java 2010-04-12 21:23:33 +0000
+++ local/za/dhis-web-jforum-integration/src/main/java/org/hisp/dhis/jforum/manager/JdbcJForumManager.java 1970-01-01 00:00:00 +0000
@@ -1,433 +0,0 @@
-package org.hisp.dhis.jforum.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import static org.hisp.dhis.system.util.DateUtils.getMediumDateString;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Date;
-
-import org.amplecode.quick.JdbcConfiguration;
-import org.amplecode.quick.StatementDialect;
-import org.amplecode.quick.StatementHolder;
-import org.amplecode.quick.StatementManager;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.Indicator;
-import org.hisp.dhis.indicator.IndicatorService;
-
-/**
- * Requires a forum called 'Data dictionary'.
- *
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class JdbcJForumManager
- implements JForumManager
-{
- private static final Log log = LogFactory.getLog( JdbcJForumManager.class );
-
- private static final String PREFIX_DATAELEMENT = "[DE] ";
- private static final String PREFIX_INDICATOR = "[IN] ";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private StatementManager statementManager;
-
- public void setStatementManager( StatementManager statementManager )
- {
- this.statementManager = statementManager;
- }
-
- private JdbcConfiguration jdbcConfiguration;
-
- public void setJdbcConfiguration( JdbcConfiguration jdbcConfiguration )
- {
- this.jdbcConfiguration = jdbcConfiguration;
- }
-
- // -------------------------------------------------------------------------
- // JForumManager implementation
- // -------------------------------------------------------------------------
-
- public void populateJForum()
- {
- Connection connection = getJForumConnection();
-
- try
- {
- Statement statement = connection.createStatement();
-
- addJForumTopics( statement );
-
- addJForumPosts( statement, jdbcConfiguration.getDialect() );
- }
- catch ( Exception ex )
- {
- throw new RuntimeException( "Failed to populate JForum database", ex );
- }
- finally
- {
- try
- {
- connection.close();
- }
- catch ( Exception ex )
- {
- }
- }
- }
-
- public void populateUrls( String baseUrl )
- {
- Connection jForumConnection = getJForumConnection();
-
- StatementHolder holder = statementManager.getHolder();
-
- try
- {
- Statement statement = jForumConnection.createStatement();
-
- String sql = "SELECT topic_id, topic_title FROM jforum_topics";
-
- ResultSet resultSet = statement.executeQuery( sql );
-
- while ( resultSet.next() )
- {
- int topicId = resultSet.getInt( 1 );
-
- String topicTitle = resultSet.getString( 2 );
-
- if ( topicTitle != null && topicTitle.startsWith( PREFIX_DATAELEMENT ) )
- {
- sql =
- "UPDATE dataelement SET url='" + baseUrl + "/posts/list/" + topicId + ".page' " +
- "WHERE name='" + topicTitle.substring( PREFIX_DATAELEMENT.length() ) + "'";
-
- log.debug( "Update DataElement SQL: " + sql );
-
- holder.getStatement().executeUpdate( sql );
- }
- else if ( topicTitle != null && topicTitle.startsWith( PREFIX_INDICATOR ) )
- {
- sql =
- "UPDATE indicator SET url='" + baseUrl + "/ports/list/" + topicId + ".page' " +
- "WHERE name='" + topicTitle.substring( PREFIX_INDICATOR.length() ) + "'";
-
- log.debug( "Update Indicator SQL: " + sql );
-
- holder.getStatement().executeUpdate( sql );
- }
- }
- }
- catch ( Exception ex )
- {
- throw new RuntimeException( "Failed to populate DHIS 2 URLs", ex );
- }
- finally
- {
- try
- {
- jForumConnection.close();
- }
- catch ( Exception ex )
- {
- }
-
- try
- {
- holder.close();
- }
- catch ( Exception ex )
- {
- }
- }
- }
-
- // -------------------------------------------------------------------------
- // Supportive methods
- // -------------------------------------------------------------------------
-
- /**
- * Adds one topic per data element and indicator to the JForum database.
- *
- * @param statement the statement to work on.
- * @throws SQLException
- */
- private void addJForumTopics( Statement statement )
- throws SQLException
- {
- String date = getMediumDateString( new Date() );
-
- for ( DataElement element : dataElementService.getAllDataElements() )
- {
- addJForumTopic( PREFIX_DATAELEMENT + element.getName(), date, statement );
- }
-
- for ( Indicator indicator : indicatorService.getAllIndicators() )
- {
- addJForumTopic( PREFIX_INDICATOR + indicator.getName(), date, statement );
- }
- }
-
- /**
- * Adds a topic.
- *
- * @param title the topic title.
- * @param prefix the topic prefix.
- * @param date the topic date.
- * @param statement the statement to work on.
- * @throws SQLException
- */
- private void addJForumTopic( String title, String date, Statement statement )
- throws SQLException
- {
- if ( !topicExists( statement, title ) )
- {
- String sql =
- "INSERT INTO jforum_topics ( forum_id, topic_title, user_id, topic_time ) " +
- "VALUES ( ( SELECT forum_id FROM jforum_forums WHERE forum_name = 'Data dictionary' LIMIT 1 ), " +
- "'" + title + "', '2', '" + date + "' )";
-
- log.debug( "Add Topic SQL: " + sql );
-
- statement.executeUpdate( sql );
- }
- }
-
- /**
- * Adds a JForum post for each data element and indicator to the JForum database.
- *
- * @param statement the statement to work on.
- * @param dialect the DBMS dialect.
- * @throws SQLException
- */
- private void addJForumPosts( Statement statement, StatementDialect dialect )
- throws SQLException
- {
- String date = getMediumDateString( new Date() );
-
- for ( DataElement element : dataElementService.getAllDataElements() )
- {
- addJForumPost( PREFIX_DATAELEMENT + element.getName(), date, statement, dialect );
- }
-
- for ( Indicator indicator : indicatorService.getAllIndicators() )
- {
- addJForumPost( PREFIX_INDICATOR + indicator.getName(), date, statement, dialect );
- }
- }
-
- /**
- * Adds a JForum post.
- *
- * @param title the post title.
- * @param date the post date.
- * @param statement the statement to work on.
- * @param dialect the DBMS dialect.
- * @throws SQLException
- */
- private void addJForumPost( String title, String date, Statement statement, StatementDialect dialect )
- throws SQLException
- {
- if ( !postExists( statement, title ) )
- {
- String sql =
- "INSERT INTO jforum_posts ( topic_id, forum_id, user_id, post_time, poster_ip, post_edit_time ) " +
- "VALUES ( ( SELECT topic_id FROM jforum_topics WHERE topic_title = '" + title + "' LIMIT 1 ), " +
- "( SELECT forum_id FROM jforum_forums WHERE forum_name = 'Data dictionary' LIMIT 1 ), " +
- "'2', '" + date + "', '127.0.0.1', '" + date + "' )";
-
- log.debug( "Add Post SQL: " + sql );
-
- statement.executeUpdate( sql );
-
- final Integer postId = getLastInsertPostId( statement, dialect );
-
- sql =
- "INSERT INTO jforum_posts_text ( post_id, post_text, post_subject ) " +
- "VALUES ( '" + postId + "', '[b]" + title + "[/b]', '" + title + "' )";
-
- log.debug( "Add Post Text SQL: " + sql );
-
- statement.executeUpdate( sql );
-
- sql =
- "UPDATE jforum_topics SET " +
- "topic_first_post_id='" + postId + "', " +
- "topic_last_post_id='" + postId + "' " +
- "WHERE topic_title='" + title + "'";
-
- log.debug( "Update Topic SQL: " + sql );
-
- statement.executeUpdate( sql );
- }
- }
-
- /**
- * Checks if a topic with the given title already exists.
- *
- * @param statement the statement to work on.
- * @param title the topic title.
- * @return true if a topic with the given title already exists, false if not.
- * @throws SQLException
- */
- private boolean topicExists( Statement statement, String title )
- throws SQLException
- {
- String sql = "SELECT COUNT(*) FROM jforum_topics WHERE topic_title='" + title + "'";
-
- ResultSet resultSet = statement.executeQuery( sql );
-
- resultSet.next();
-
- return resultSet.getInt( 1 ) > 0;
- }
-
- /**
- * Checks if a post with the given subject already exists.
- *
- * @param statement the statement to work on.
- * @param subject the post subject.
- * @return true if a post with the given subject already exists, false if not.
- * @throws SQLException
- */
- private boolean postExists( Statement statement, String subject )
- throws SQLException
- {
- String sql = "SELECT COUNT(*) FROM jforum_posts_text WHERE post_subject='" + subject + "'";
-
- ResultSet resultSet = statement.executeQuery( sql );
-
- resultSet.next();
-
- return resultSet.getInt( 1 ) > 0;
- }
-
- /**
- * Retrieves the last auto-increment identifier generated by the DBMS.
- *
- * @param statement the statement to work on.
- * @param dialect the DBMS dialect.
- * @return the last auto-increment identifier generated by the DBMS.
- * @throws SQLException
- */
- private Integer getLastInsertPostId( Statement statement, StatementDialect dialect )
- throws SQLException
- {
- String sql = null;
-
- if ( dialect.equals( StatementDialect.MYSQL ) || dialect.equals( StatementDialect.H2 ) )
- {
- sql = "SELECT LAST_INSERT_ID()";
- }
- else
- {
- sql = "SELECT currval('jforum_posts_seq')";
- }
-
- ResultSet resultSet = statement.executeQuery( sql );
-
- return resultSet.next() ? resultSet.getInt( 1 ) : 0;
- }
-
- /**
- * Returns a connection to the JForum database.
- *
- * @return a connection to the JForum database.
- */
- private Connection getJForumConnection()
- {
- try
- {
- Class.forName( jdbcConfiguration.getDriverClass() );
-
- Connection connection = DriverManager.getConnection(
- getJForumConnectionUrl( jdbcConfiguration.getConnectionUrl(), jdbcConfiguration.getDialect() ),
- jdbcConfiguration.getUsername(),
- jdbcConfiguration.getPassword() );
-
- return connection;
- }
- catch ( Exception ex )
- {
- throw new RuntimeException( "Failed to create connection", ex );
- }
- }
-
- /**
- * JForum runs on MySQL, PostgreSQL, and HSQLDB and is assumed to run on the
- * same DBMS and same user as DHIS 2 on database called "jforum". This
- * method substitutes the DHIS 2 database name in the connection URL with
- * "jforum".
- *
- * @param url the connection URL for DHIS 2.
- * @return the connection URL for JForum.
- */
- private String getJForumConnectionUrl( String dhis2Url, StatementDialect dialect )
- {
- String url = null;
-
- if ( dialect.equals( StatementDialect.MYSQL ) )
- {
- url = dhis2Url.substring( 0, dhis2Url.lastIndexOf( "/" ) + 1 );
- }
- else
- {
- url = dhis2Url.substring( 0, dhis2Url.lastIndexOf( ":" ) + 1 );
- }
-
- url += "jforum";
-
- log.debug( "Using JForum connection URL: " + url );
-
- return url;
- }
-}
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/META-INF'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis/beans.xml'
--- local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis/beans.xml 2009-06-14 19:43:19 +0000
+++ local/za/dhis-web-jforum-integration/src/main/resources/META-INF/dhis/beans.xml 1970-01-01 00:00:00 +0000
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="
-http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
-
- <bean id="org.hisp.dhis.jforum.manager.JForumManager"
- class="org.hisp.dhis.jforum.manager.JdbcJForumManager">
- <property name="dataElementService"
- ref="org.hisp.dhis.dataelement.DataElementService"/>
- <property name="indicatorService"
- ref="org.hisp.dhis.indicator.IndicatorService"/>
- <property name="statementManager" ref="statementManager"/>
- <property name="jdbcConfiguration" ref="jdbcConfiguration"/>
- </bean>
-
- <bean id="org.hisp.dhis.jforum.action.NoAction"
- class="org.hisp.dhis.jforum.action.NoAction"
- scope="prototype"/>
-
- <bean id="org.hisp.dhis.jforum.action.PopulateJForumAction"
- class="org.hisp.dhis.jforum.action.PopulateJForumAction"
- scope="prototype">
- <property name="forumManager"
- ref="org.hisp.dhis.jforum.manager.JForumManager"/>
- </bean>
-
-</beans>
\ No newline at end of file
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/org'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/org/hisp'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module.properties'
--- local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module.properties 2009-03-03 16:46:36 +0000
+++ local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module.properties 1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-base_url = Base URL
-populate = Populate
-details = Details
-jforum_integration_management = JForum integration management
-process_finished_in = Process finished in
\ No newline at end of file
=== removed file 'local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module_es_ES.properties'
--- local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module_es_ES.properties 2009-05-22 22:53:13 +0000
+++ local/za/dhis-web-jforum-integration/src/main/resources/org/hisp/dhis/jforum/i18n_module_es_ES.properties 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-#Resource generated by I18n Resource Editor
-#Sat May 16 13:17:47 GMT-05:00 2009
-process_finished_in=Proceso finalizado en
-details=Detalles
-jforum_integration_management=Administraci\u00F3n de integracion al JForum
-populate=Poblar
-base_url=URL base
=== removed file 'local/za/dhis-web-jforum-integration/src/main/resources/struts.xml'
--- local/za/dhis-web-jforum-integration/src/main/resources/struts.xml 2009-08-21 10:41:53 +0000
+++ local/za/dhis-web-jforum-integration/src/main/resources/struts.xml 1970-01-01 00:00:00 +0000
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE struts PUBLIC
-"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
-"http://struts.apache.org/dtds/struts-2.0.dtd">
-<struts>
-
- <include file="dhis-web-commons.xml"/>
-
- <package name="dhis-web-jforum-integration" extends="dhis-web-commons" namespace="/dhis-web-jforum-integration">
-
- <action name="index" class="org.hisp.dhis.jforum.action.NoAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-jforum-integration/populateForm.vm</param>
- </action>
-
- <action name="populate" class="org.hisp.dhis.jforum.action.PopulateJForumAction">
- <result name="success" type="chain">index</result>
- </action>
-
- </package>
-</struts>
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/webapp'
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF/web.xml'
--- local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF/web.xml 2009-08-21 10:41:53 +0000
+++ local/za/dhis-web-jforum-integration/src/main/webapp/WEB-INF/web.xml 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
- "http://java.sun.com/dtd/web-app_2_3.dtd">
-<web-app>
- <display-name>DHIS JForum integration</display-name>
-
- <context-param>
- <param-name>contextConfigLocation</param-name>
- <param-value>classpath*:/META-INF/dhis/beans.xml</param-value>
- </context-param>
- <context-param>
- <param-name>automaticAccessType</param-name>
- <param-value>ghostAdmin</param-value>
- </context-param>
-
- <filter>
- <filter-name>RedirectFilter</filter-name>
- <filter-class>org.hisp.dhis.servlet.filter.HttpRedirectFilter</filter-class>
- <init-param>
- <param-name>redirectPath</param-name>
- <param-value>dhis-web-jforum-integration/index.action</param-value>
- </init-param>
- </filter>
- <filter>
- <filter-name>OpenSessionInViewFilter</filter-name>
- <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
- </filter>
- <filter>
- <filter-name>SecurityFilterChain</filter-name>
- <filter-class>org.acegisecurity.util.FilterToBeanProxy</filter-class>
- <init-param>
- <param-name>targetBean</param-name>
- <param-value>org.acegisecurity.util.FilterChainProxy</param-value>
- </init-param>
- </filter>
- <filter>
- <filter-name>Struts</filter-name>
- <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
- </filter>
-
- <filter-mapping>
- <filter-name>RedirectFilter</filter-name>
- <url-pattern>/</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>OpenSessionInViewFilter</filter-name>
- <url-pattern>*.action</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>SecurityFilterChain</filter-name>
- <url-pattern>/*</url-pattern>
- </filter-mapping>
- <filter-mapping>
- <filter-name>Struts</filter-name>
- <url-pattern>*.action</url-pattern>
- </filter-mapping>
-
- <listener>
- <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
- </listener>
- <listener>
- <listener-class>org.hisp.dhis.system.startup.StartupListener</listener-class>
- </listener>
-</web-app>
=== removed directory 'local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration'
=== removed file 'local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration/populateForm.vm'
--- local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration/populateForm.vm 2009-03-03 16:46:36 +0000
+++ local/za/dhis-web-jforum-integration/src/main/webapp/dhis-web-jforum-integration/populateForm.vm 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
-
-<h3>$i18n.getString( "jforum_integration_management" )</h3>
-
-<form action="populate.action">
-
-<table>
- <tr>
- <th colspan="2">$i18n.getString( "details" )</th>
- </tr>
- <tr>
- <td><label>$i18n.getString( "base_url" )</label></td>
- <td><input type="text" id="baseUrl" name="baseUrl" style="width:200px"></td>
- </tr>
- <tr>
- <td></td>
- <td><input type="submit" value="$i18n.getString( 'populate' )" style="width:100px"></td>
- </tr>
-</table>
-
-</form>
-
-<span id="info">
-The integration functionality requires that a database 'jforum' exists in the
-same DBMS as the one where DHIS 2 is running, that the DHIS 2 database user has
-access to the jforum database, and that a forum called 'Data dictionary' exists.
-</span>
-
-<span id="info">
-The populate function will insert a topic for each data element and indicator in
-the JForum database, and update the url property on all data elements and indicators
-to point to a corresponding topic in JForum. The base URL is the external URL for
-the JForum installation, typically 'http://someserver.com/jforum'.
-</span>
-
-<span id="message" #if( $time )style="display:block"#end>
- $i18n.getString( "process_finished_in" ): $time
-</span>
\ No newline at end of file
=== removed directory 'local/za/dhis-web-jforum-integration/src/test'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java/org'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java/org/hisp'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum'
=== removed directory 'local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager'
=== removed file 'local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager/JForumManagerTest.java'
--- local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager/JForumManagerTest.java 2010-04-12 21:23:33 +0000
+++ local/za/dhis-web-jforum-integration/src/test/java/org/hisp/dhis/jforum/manager/JForumManagerTest.java 1970-01-01 00:00:00 +0000
@@ -1,79 +0,0 @@
-package org.hisp.dhis.jforum.manager;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import org.hisp.dhis.DhisSpringTest;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.junit.Ignore;
-import org.junit.Test;
-
-/**
- * @author Lars Helge Overland
- * @version $Id$
- */
-public class JForumManagerTest
- extends DhisSpringTest
-{
- private JForumManager forumManager;
-
- // -------------------------------------------------------------------------
- // Fixture
- // -------------------------------------------------------------------------
-
- @Override
- public void setUpTest()
- {
- forumManager = (JForumManager) getBean( JForumManager.ID );
-
- dataElementService = (DataElementService) getBean( DataElementService.ID );
-
- indicatorService = (IndicatorService) getBean( IndicatorService.ID );
- }
-
- // -------------------------------------------------------------------------
- // Tests
- // -------------------------------------------------------------------------
-
- @Ignore
- @Test
- public void testPopulate()
- {
- dataElementService.addDataElement( createDataElement( 'A' ) );
- dataElementService.addDataElement( createDataElement( 'B' ) );
- dataElementService.addDataElement( createDataElement( 'C' ) );
-
- indicatorService.addIndicator( createIndicator( 'A', null ) );
- indicatorService.addIndicator( createIndicator( 'B', null ) );
- indicatorService.addIndicator( createIndicator( 'C', null ) );
-
- forumManager.populateJForum();
-
- forumManager.populateUrls( "http://someserver/jforum/" );
- }
-}