[jboss-svn-commits] JBL Code SVN: r26634 - in labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main: java/org/jboss/labs/clearspace/plugin/nfm/dao and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed May 20 05:29:31 EDT 2009
Author: lkrzyzanek
Date: 2009-05-20 05:29:31 -0400 (Wed, 20 May 2009)
New Revision: 26634
Added:
labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/
labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/DbNukesForumsMappingDAOImpl.java
labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/NukesForumsMappingDAO.java
Modified:
labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml
Log:
added Mapping DAO
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/DbNukesForumsMappingDAOImpl.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/DbNukesForumsMappingDAOImpl.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/DbNukesForumsMappingDAOImpl.java 2009-05-20 09:29:31 UTC (rev 26634)
@@ -0,0 +1,76 @@
+/*
+ * JBoss.org http://jboss.org/
+ *
+ * Copyright (c) 2009 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Libor Krzyzanek
+ */
+package org.jboss.labs.clearspace.plugin.nfm.dao;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.dao.DataAccessException;
+import org.springframework.jdbc.core.ResultSetExtractor;
+
+import com.jivesoftware.base.database.dao.JiveJdbcDaoSupport;
+
+/**
+ * DB Implementation of DAO
+ *
+ * @author <a href="mailto:lkrzyzan at redhat.com">Libor Krzyzanek</a>
+ *
+ */
+public class DbNukesForumsMappingDAOImpl extends JiveJdbcDaoSupport implements
+ NukesForumsMappingDAO {
+
+ private static final String SELECT_ALL_CATEGORY_MAPPINGS = "SELECT cat_id, communityID FROM nukesForumsCategoryMapping";
+
+ private static final String SELECT_ALL_FORUMS_MAPPINGS = "SELECT cat_id, communityID FROM nukesForumsForumMapping";
+
+ @SuppressWarnings("unchecked")
+ public Map<Long, Long> getAllCategoryMappings() {
+ return (Map<Long, Long>) this.getJdbcTemplate().query(
+ SELECT_ALL_CATEGORY_MAPPINGS, new TwoColumnsAsMapExtractor());
+ }
+
+ @SuppressWarnings("unchecked")
+ public Map<Long, Long> getAllForumMappings() {
+ return (Map<Long, Long>) this.getJdbcTemplate().query(
+ SELECT_ALL_FORUMS_MAPPINGS, new TwoColumnsAsMapExtractor());
+ }
+
+ /**
+ * Common extractor for result set which contains two columns as {@link Long}
+ * type
+ *
+ * @author <a href="mailto:lkrzyzan at redhat.com">Libor Krzyzanek</a>
+ */
+ class TwoColumnsAsMapExtractor implements ResultSetExtractor {
+ public Map<Long, Long> extractData(ResultSet rs) throws SQLException,
+ DataAccessException {
+ Map<Long, Long> result = new HashMap<Long, Long>();
+ while (rs.next()) {
+ result.put(rs.getLong(1), rs.getLong(2));
+ }
+ return result;
+ }
+ }
+
+}
Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/DbNukesForumsMappingDAOImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/NukesForumsMappingDAO.java
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/NukesForumsMappingDAO.java (rev 0)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/NukesForumsMappingDAO.java 2009-05-20 09:29:31 UTC (rev 26634)
@@ -0,0 +1,48 @@
+/*
+ * JBoss.org http://jboss.org/
+ *
+ * Copyright (c) 2009 Red Hat Middleware, LLC. All rights reserved.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT A WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License, v.2.1 along with this distribution; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ *
+ * Red Hat Author(s): Libor Krzyzanek
+ */
+package org.jboss.labs.clearspace.plugin.nfm.dao;
+
+import java.util.Map;
+
+/**
+ * Interface for Nukes Forums category, forum, topic and post mapping
+ *
+ * @author <a href="mailto:lkrzyzan at redhat.com">Libor Krzyzanek</a>
+ *
+ */
+public interface NukesForumsMappingDAO {
+
+ /**
+ * Get all category mappings
+ *
+ * @return map where key is cat_id and value is communityID
+ */
+ public Map<Long, Long> getAllCategoryMappings();
+
+ /**
+ * Get all forum mappings
+ *
+ * @return map where key is forum_id and value is communityID
+ */
+ public Map<Long, Long> getAllForumMappings();
+
+}
Property changes on: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/java/org/jboss/labs/clearspace/plugin/nfm/dao/NukesForumsMappingDAO.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml
===================================================================
--- labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml 2009-05-20 08:58:27 UTC (rev 26633)
+++ labs/jbosslabs/labs-3.0-build/integration/cs-nfm/trunk/src/main/resources/spring.xml 2009-05-20 09:29:31 UTC (rev 26634)
@@ -5,4 +5,11 @@
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
+ <bean id="nukesForumsMappingDAO"
+ class="org.jboss.labs.clearspace.plugin.nfm.dao.DbNukesForumsMappingDAOImpl">
+ <property name="dataSource">
+ <util:property-path path="dataSourceFactory.dataSource" />
+ </property>
+ </bean>
+
</beans>
More information about the jboss-svn-commits
mailing list