changeset 691:46bb231ff9b9

Documentation.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 07 Jul 2015 11:56:36 +0200
parents 6441bb4a90f0
children ae33fdecd9e2
files src/main/java/de/intevation/lada/factory/ProbeFactory.java src/main/resources/META-INF/persistence.xml
diffstat 2 files changed, 39 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Wed Jul 01 15:28:57 2015 +0200
+++ b/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Tue Jul 07 11:56:36 2015 +0200
@@ -1,3 +1,10 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out
+ * the documentation coming with IMIS-Labordaten-Application for details.
+ */
 package de.intevation.lada.factory;
 
 import java.math.BigInteger;
@@ -25,12 +32,30 @@
 import de.intevation.lada.util.data.RepositoryType;
 import de.intevation.lada.util.rest.Response;
 
+/**
+ * This factory creates probe objects and its children using a messprogramm
+ * as template.
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 public class ProbeFactory {
 
+    /**
+     * The data repository
+     */
     @Inject
     @RepositoryConfig(type = RepositoryType.RW)
     private Repository repository;
 
+    /**
+     * Create a list of probe objects
+     *
+     * @param id    Messprogramm id
+     * @param from  The start date
+     * @param to    The end date
+     *
+     * @return List of probe objects.
+     */
     public List<LProbe> create(String id, Long from, Long to) {
         QueryBuilder<Messprogramm> builder =
             new QueryBuilder<Messprogramm>(
@@ -49,13 +74,9 @@
         start.setTime(new Date(from));
         Calendar end = Calendar.getInstance();
         end.setTime(new Date (to));
-        // benutzereingabe + gültigVon/Bis
-        // kann mehrere Intervalle enthalten, wenn nutzereingabe über mehrere
-        // Jahre.
         Date[][] intervals = calculateIntervals(start, end, messprogramm);
         List<LProbe> proben = new ArrayList<LProbe>();
         for (Date[] interval : intervals) {
-            //erzeuge proben für einen intervall(gültigkeitsbereich)
             createProben(interval, messprogramm, proben);
         }
         return proben;
--- a/src/main/resources/META-INF/persistence.xml	Wed Jul 01 15:28:57 2015 +0200
+++ b/src/main/resources/META-INF/persistence.xml	Tue Jul 07 11:56:36 2015 +0200
@@ -2,34 +2,45 @@
 <persistence version="2.1"
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+    <!-- PU for bund datasource. Maps to the schema 'bund' in the Lada database. -->
     <persistence-unit name="bund">
+        <!-- The JTA datasource configured in the Wildfly AS -->
         <jta-data-source>java:/jboss/lada-bund</jta-data-source>
         <exclude-unlisted-classes>false</exclude-unlisted-classes>
         <properties>
+        	<!-- The JNDI name for lookups in the application -->
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/bund"/>
             <!-- Properties for Hibernate -->
+            <property name="hibernate.hbm2ddl.auto" value="none"/>
             <property name="hibernate.show_sql" value="false" />
+            <!-- Use a special PostGIS dialect implmented for Lada. This dialect implements an additional integer array type -->
             <property name="hibernate.dialect" value="de.intevation.lada.util.data.LadaPostgisDialect"/>
-            <property name="hibernate.hbm2ddl.auto" value="none"/>
        </properties>
    	</persistence-unit>
    	<persistence-unit name="land">
+        <!-- The JTA datasource configured in the Wildfly AS -->
    	    <jta-data-source>java:/jboss/lada-land</jta-data-source>
        	<exclude-unlisted-classes>false</exclude-unlisted-classes>
     	<properties>
+        	<!-- The JNDI name for lookups in the application -->
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/land"/>
+            <!-- Properties for Hibernate -->
+            <property name="hibernate.hbm2ddl.auto" value="none"/>
             <property name="hibernate.show_sql" value="true" />
+            <!-- Use a special PostGIS dialect implmented for Lada. This dialect implements an additional integer array type -->
 			<property name="hibernate.dialect" value="de.intevation.lada.util.data.LadaPostgisDialect"/>
-            <property name="hibernate.hbm2ddl.auto" value="none"/>
        </properties>
     </persistence-unit>
     <persistence-unit name="stamm">
+        <!-- The JTA datasource configured in the Wildfly AS -->
         <jta-data-source>java:/jboss/lada-stamm</jta-data-source>
         <properties>
+        	<!-- The JNDI name for lookups in the application -->
             <property name="jboss.entity.manager.jndi.name" value="java:app/entitymanager/stamm"/>
-			<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
+            <!-- Properties for Hibernate -->
             <property name="hibernate.show_sql" value="true" />
             <property name="hibernate.hbm2ddl.auto" value="none"/>
+			<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.postgis.PostgisDialect"/>
         </properties>
     </persistence-unit>
 </persistence>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)