# HG changeset patch # User Sascha L. Teichmann # Date 1300362403 0 # Node ID 8be4a837f20ac1a4fdc7dfb959080b33e26ed757 # Parent 0bab3a39a474c74d22671e978e7326f62f2d24c4 Added support for the flys backend and an example how to use it. flys-artifacts/trunk@1498 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 0bab3a39a474 -r 8be4a837f20a flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Mar 15 17:12:58 2011 +0000 +++ b/flys-artifacts/ChangeLog Thu Mar 17 11:46:43 2011 +0000 @@ -1,3 +1,16 @@ +2011-03-17 Sascha L. Teichmann + + * pom.xml: Added dependency to flys backend. + + * src/main/java/de/intevation/flys/artifacts/model/River.java: + Removed. We are using the backend model now. + + * src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java: + Fetches the rivers from the backend. + + * src/main/java/de/intevation/flys/artifacts/states/RiverSelect.java: + Import fixes. + 2011-03-15 Sascha L. Teichmann * doc/conf/conf.xml: Added section for database backend configuration. diff -r 0bab3a39a474 -r 8be4a837f20a flys-artifacts/pom.xml --- a/flys-artifacts/pom.xml Tue Mar 15 17:12:58 2011 +0000 +++ b/flys-artifacts/pom.xml Thu Mar 17 11:46:43 2011 +0000 @@ -45,5 +45,10 @@ artifacts-common 1.0-SNAPSHOT + + de.intevation.flys + flys-backend + 1.0-SNAPSHOT + diff -r 0bab3a39a474 -r 8be4a837f20a flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/River.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/River.java Tue Mar 15 17:12:58 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -package de.intevation.flys.artifacts.model; - -import java.io.Serializable; - - -/** - * @author Ingo Weinzierl - */ -public class River implements Serializable { - - /** The river's name. */ - protected String name; - - - /** - * The default constructor that create a river with a name. - * - * @param name The name of the river. - */ - public River(String name) { - this.name = name; - } - - - /** - * Returns the name of the river. - * - * @return the name of the river. - */ - public String getName() { - return name; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 0bab3a39a474 -r 8be4a837f20a flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java Tue Mar 15 17:12:58 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/RiverFactory.java Thu Mar 17 11:46:43 2011 +0000 @@ -1,8 +1,15 @@ package de.intevation.flys.artifacts.model; -import java.util.ArrayList; + import java.util.List; +import de.intevation.flys.model.River; + +import de.intevation.flys.backend.SessionFactoryProvider; + +import org.hibernate.SessionFactory; +import org.hibernate.Session; +import org.hibernate.Query; /** * @author Ingo Weinzierl @@ -20,12 +27,15 @@ * @return all rivers. */ public static List getRivers() { - List rivers = new ArrayList(); - - rivers.add(new River("Mosel")); - rivers.add(new River("Saar")); - - return rivers; + SessionFactory sf = SessionFactoryProvider.getSessionFactory(); + Session session = sf.openSession(); + try { + return (List)session + .createQuery("from River order by name").list(); + } + finally { + session.close(); + } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : diff -r 0bab3a39a474 -r 8be4a837f20a flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverSelect.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverSelect.java Tue Mar 15 17:12:58 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/RiverSelect.java Thu Mar 17 11:46:43 2011 +0000 @@ -14,8 +14,10 @@ import de.intevation.artifactdatabase.ProtocolUtils; import de.intevation.artifactdatabase.data.StateData; -import de.intevation.flys.artifacts.model.River; +import de.intevation.flys.model.River; + import de.intevation.flys.artifacts.model.RiverFactory; + import de.intevation.flys.artifacts.resources.Resources;