Mercurial > lada > lada-server
changeset 366:567ce7697fc7 0.5
Code documentation.
line wrap: on
line diff
--- a/pom.xml Tue Sep 10 10:17:32 2013 +0200 +++ b/pom.xml Tue Sep 10 15:55:54 2013 +0200 @@ -7,8 +7,6 @@ <artifactId>lada</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> - <name>Java EE 6 webapp project</name> - <description>A starter Java EE 6 webapp project for use on JBoss AS 7.1 / EAP 6, generated from the jboss-javaee6-webapp archetype</description> <properties> <!-- Explicitly declaring the source encoding eliminates the following @@ -362,4 +360,8 @@ <url>http://www.hibernatespatial.org/repository</url> </repository> </repositories> + <name>Lada Server</name> + <description>Lada server application. + +The Lada server provides RESTful services to grant access to laboratory data using authentication and validation.</description> </project>
--- a/src/main/java/de/intevation/lada/auth/Authentication.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/auth/Authentication.java Tue Sep 10 15:55:54 2013 +0200 @@ -3,6 +3,9 @@ import javax.ws.rs.core.HttpHeaders; /** + * Defines the interface authentication modules that provide information about + * the user. + * * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> */ public interface Authentication
--- a/src/main/java/de/intevation/lada/auth/AuthenticationException.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/auth/AuthenticationException.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,6 +1,8 @@ package de.intevation.lada.auth; /** + * Exception thrown in the authentication process. + * * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> */ public class AuthenticationException
--- a/src/main/java/de/intevation/lada/auth/Authorization.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/auth/Authorization.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,6 +1,10 @@ package de.intevation.lada.auth; - +/** + * Defines the interface for data access. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public interface Authorization { public boolean isReadOnly(String id);
--- a/src/main/java/de/intevation/lada/data/LKommentarMRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LKommentarMRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -45,7 +45,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/LKommentarPRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LKommentarPRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -53,7 +53,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/LMessungRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LMessungRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -56,7 +56,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response opbject. */ public <T> Response filter(CriteriaQuery<T> filter) { @@ -98,7 +98,7 @@ /** * Validate and persist a new LMessung object. * - * @param probe The new object + * @param object The new object * @return Response object. */ public Response create(Object object) {
--- a/src/main/java/de/intevation/lada/data/LMesswertRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LMesswertRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -55,7 +55,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/LOrtRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LOrtRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -57,7 +57,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -63,7 +63,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter + * @param filter The query filter * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) { @@ -99,6 +99,7 @@ } return new Response(true, 200, res); } + /** * Get all objects. * @@ -130,7 +131,7 @@ /** * Validate and persist a new LProbe object. * - * @param probe The new LProbe object + * @param object The new LProbe object * @return Response. */ public Response create(Object object) {
--- a/src/main/java/de/intevation/lada/data/LStatusRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LStatusRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -47,7 +47,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -48,7 +48,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/OrtRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/OrtRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -46,7 +46,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The query filter. + * @param filter The query filter. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java Tue Sep 10 15:55:54 2013 +0200 @@ -34,7 +34,7 @@ /** * Filter object list by the given criteria. * - * @param criteria The filter query. + * @param filter The filter query. * @return Response object. */ public <T> Response filter(CriteriaQuery<T> filter) {
--- a/src/main/java/de/intevation/lada/data/exporter/Creator.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/exporter/Creator.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,7 +1,10 @@ package de.intevation.lada.data.exporter; - +/** + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public interface Creator { public String create(String probeId);
--- a/src/main/java/de/intevation/lada/data/exporter/LAFCreator.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/exporter/LAFCreator.java Tue Sep 10 15:55:54 2013 +0200 @@ -27,6 +27,13 @@ import de.intevation.lada.model.SProbenart; import de.intevation.lada.rest.Response; +/** + * This creator produces a LAF conform String containing all information about + * a single {@link LProbe} object including subobjects like + * {@link LMessung}, {@link LMesswert}, {@link LKommentarP}... + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @Named("lafcreator") public class LAFCreator implements Creator @@ -64,6 +71,11 @@ @Named("readonlyrepository") private Repository readonlyRepo; + /** + * Create the LAF conform String. + * + * @param probeId The {@link LProbe} id. + */ @Override public String create(String probeId) { String lafProbe = "%PROBE%\n"; @@ -71,6 +83,11 @@ return lafProbe; } + /** + * Find the {@link LProbe} object and produce the LAF conform string. + * @param probeId The {@link LProbe} id. + * @return LAF conform string. + */ private String probeToLAF(String probeId) { Response found = this.proben.findById(LProbe.class, probeId); if (found.getData() == null) { @@ -82,6 +99,12 @@ return lafProbe; } + /** + * Write the attributes and subobjects. + * + * @param probe The {@link LProbeInfo} object. + * @return LAF conform string. + */ private String writeAttributes(LProbeInfo probe) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); QueryBuilder<LKommentarP> kommBuilder = @@ -150,6 +173,12 @@ return laf; } + /** + * Write {@link LZusatzWert} attributes. + * + * @param zw The {@link LZusatzWert}. + * @return Single LAF line. + */ private String writeZusatzwert(LZusatzWert zw) { QueryBuilder<SProbenZusatz> builder = new QueryBuilder<SProbenZusatz>( @@ -165,6 +194,12 @@ return lafLine("PZB_S", value); } + /** + * Write {@link LOrt} attributes. + * + * @param probe The {@link LProbeInfo} object. + * @return LAF conform string + */ private String writeOrt(LProbeInfo probe) { QueryBuilder<LOrt> builder = new QueryBuilder<LOrt>( @@ -203,6 +238,12 @@ return laf; } + /** + * Write {@link LKommentarP} attributes. + * + * @param kp The {@link LKommentarP} object. + * @return Single LAF line. + */ private String writeKommentar(LKommentarP kp) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); String value = "\"" + kp.getErzeuger() + "\" " + @@ -211,6 +252,12 @@ return lafLine("PROBENKOMMENTAR", value); } + /** + * Write {@link LMessung} attributes. + * + * @param probe The {@link LProbeInfo} object. + * @return LAF conform string. + */ private String writeMessung(LProbeInfo probe) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); // Get all messungen @@ -257,6 +304,11 @@ return laf; } + /** + * Write {@link LKommentarM} attributes. + * @param mk The {@link LKommentarM} object. + * @return Single LAF line. + */ private String writeKommentar(LKommentarM mk) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); String value = "\"" + mk.getErzeuger() + "\" " + @@ -265,6 +317,11 @@ return lafLine("KOMMENTAR", value); } + /** + * Write {@link LMesswert} attributes. + * @param mw The {@link LMesswert} object. + * @return Single LAF line. + */ private String writeMesswert(LMesswert mw) { QueryBuilder<SMessgroesse> builder = new QueryBuilder<SMessgroesse>( @@ -295,6 +352,13 @@ return lafLine("MESSWERT", value); } + /** + * Write a single LAF conform line from key and value. + * + * @param key The key. + * @param value The value. + * @return LAF conform line. + */ private String lafLine(String key, String value) { for (int i = key.length(); i < 30; i++) { key += " ";
--- a/src/main/java/de/intevation/lada/data/exporter/LAFExporter.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/exporter/LAFExporter.java Tue Sep 10 15:55:54 2013 +0200 @@ -14,6 +14,11 @@ import de.intevation.lada.auth.AuthenticationResponse; import de.intevation.lada.model.LProbe; +/** +* The LAF exporter implements {@link Exporter} to produce a LAF file. +* +* @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> +*/ @Named("lafexporter") public class LAFExporter implements Exporter @@ -23,6 +28,13 @@ @Named("lafcreator") private Creator creator; + /** + * Export the {@link LProbe} objects. + * + * @param proben List of probe ids. + * @param auth The authentication information. + * @return InputStream with the LAF data. + */ @Override public InputStream export( List<String> proben,
--- a/src/main/java/de/intevation/lada/data/importer/AttributeMapper.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/AttributeMapper.java Tue Sep 10 15:55:54 2013 +0200 @@ -32,6 +32,12 @@ import de.intevation.lada.model.SUmwelt; import de.intevation.lada.rest.Response; +/** + * The AttributeMapper is used to set object attributes via string based + * key value pairs. The key represents a member of an entity object. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @Stateless public class AttributeMapper { @@ -53,11 +59,22 @@ private List<ReportData> warnings; private List<ReportData> errors; + /** + * Default constructor to create a new AttributeMapper object. + */ public AttributeMapper() { this.warnings = new ArrayList<ReportData>(); this.errors = new ArrayList<ReportData>(); } + /** + * Add an attribute to the given LProbe object. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param probe The entity object. + * @return The updated entity object. + */ public LProbe addAttribute(String key, Object value, LProbe probe) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); if ("datenbasis_s".equals(key) && probe.getDatenbasisId() == null) { @@ -203,36 +220,21 @@ return probe; } + /** + * Add an attribute to the given LKommentarP object. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param kommentar The entity object. + * @return The updated entity object. + */ public LKommentarP addAttribute( String key, - Object values, + Object value, LKommentarP kommentar ) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); - String v = values.toString(); - String erzeuger = v.substring(1, 5); - String date = v.substring(8, 21); - Date d; - try { - d = format.parse(date); - kommentar.setKDatum(d); - } - catch (ParseException e) { - this.warnings.add(new ReportData(key, values.toString(), 674)); - } - String text = v.substring(23, v.length() -1); - kommentar.setErzeuger(erzeuger); - kommentar.setKText(text); - return kommentar; - } - - public LKommentarM addAttribute( - String key, - Object values, - LKommentarM kommentar - ) { - DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); - String v = values.toString(); + String v = value.toString(); String erzeuger = v.substring(1, 5); String date = v.substring(8, 21); Date d; @@ -241,7 +243,7 @@ kommentar.setKDatum(d); } catch (ParseException e) { - this.warnings.add(new ReportData(key, values.toString(), 674)); + this.warnings.add(new ReportData(key, value.toString(), 674)); } String text = v.substring(23, v.length() -1); kommentar.setErzeuger(erzeuger); @@ -249,43 +251,82 @@ return kommentar; } + /** + * Add an attribute to the given LKommentarM object. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param kommentar The entity object. + * @return The updated entity object. + */ + public LKommentarM addAttribute( + String key, + Object value, + LKommentarM kommentar + ) { + DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); + String v = value.toString(); + String erzeuger = v.substring(1, 5); + String date = v.substring(8, 21); + Date d; + try { + d = format.parse(date); + kommentar.setKDatum(d); + } + catch (ParseException e) { + this.warnings.add(new ReportData(key, value.toString(), 674)); + } + String text = v.substring(23, v.length() -1); + kommentar.setErzeuger(erzeuger); + kommentar.setKText(text); + return kommentar; + } + + /** + * Add an attribute to the given LMessung object. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param messung The entity object. + * @return The updated entity object. + */ public LMessung addAttribute( String key, - Object values, + Object value, LMessung messung ) { DateFormat format = new SimpleDateFormat("yyyyMMdd HHmm"); if ("messungs_id".equals(key)) { LMessungId id = messung.getId(); - Integer v = Integer.valueOf(values.toString()); + Integer v = Integer.valueOf(value.toString()); id.setMessungsId(v); messung.setMessungsId(v); messung.setId(id); } else if ("nebenprobennummer".equals(key)) { - messung.setNebenprobenNr(values.toString()); + messung.setNebenprobenNr(value.toString()); } else if ("mess_datum_uhrzeit".equals(key)) { try { - Date d = format.parse(values.toString()); + Date d = format.parse(value.toString()); messung.setMesszeitpunkt(d); } catch (ParseException e) { - this.warnings.add(new ReportData(key, values.toString(), 674)); + this.warnings.add(new ReportData(key, value.toString(), 674)); } } else if ("messzeit_sekunden".equals(key)) { - Integer i = Integer.valueOf(values.toString()); + Integer i = Integer.valueOf(value.toString()); messung.setMessdauer(i); } else if ("messmethode_s".equals(key)) { - messung.setMmtId(values.toString()); + messung.setMmtId(value.toString()); } else if ("bearbeitungsstatus".equals(key)) { //ignored.!? } else if ("erfassung_abgeschlossen".equals(key)) { - if(!values.toString().equals("0")) { + if(!value.toString().equals("0")) { messung.setFertig(true); } else { @@ -295,15 +336,23 @@ return messung; } + /** + * Add an attribute to the given LMesswert object. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param messwert The entity object. + * @return The updated entity object. + */ public LMesswert addAttribute( String key, - Object values, + Object value, LMesswert messwert ) { Pattern p = Pattern.compile( "(\".+\")( .+ )(\".+\")( .*)( .{1,12})( .{1,9})(.{0,9})(.{0,3})"); //TODO Does not perfectly match... Use better matching for floats. - Matcher m = p.matcher(values.toString()); + Matcher m = p.matcher(value.toString()); if (m.matches()) { String messgroesse = m.group(1).substring(1, m.group(1).length() - 1); String wert = m.group(2); @@ -351,59 +400,76 @@ return messwert; } + /** + * Add an attribute to the OrtCreator. The creator is used to build the + * two objects Ort and LOrt. + * + * @param key The key mapping to a object member. + * @param value The value to set. + * @param ort The creator object. + * @return The updated creator object. + */ public OrtCreator addAttribute( String key, - Object values, + Object value, OrtCreator ort ) { if ("ort_code".equals(key)) { - ort.setOrtCode(values.toString()); + ort.setOrtCode(value.toString()); } if ("ort_typ".equals(key)) { - ort.setOrtTyp(values.toString()); + ort.setOrtTyp(value.toString()); } if ("ort_zusatz".equals(key)) { - ort.setZusatztext(values.toString()); + ort.setZusatztext(value.toString()); } if ("ort_land_lang".equals(key)) { - ort.setLandLang(values.toString()); + ort.setLandLang(value.toString()); } if ("ort_land_kurz".equals(key)) { - ort.setLandKurz(values.toString()); + ort.setLandKurz(value.toString()); } if ("ort_land_s".equals(key)) { - ort.setLandS(values.toString()); + ort.setLandS(value.toString()); } if ("ort_gemeindeschlĂĽssel".equals(key)) { - ort.setGemSchluessel(values.toString()); + ort.setGemSchluessel(value.toString()); } if ("ort_bezeichnung".equals(key)) { - ort.setBezeichnung(values.toString()); + ort.setBezeichnung(value.toString()); } if ("ort_beschreibung".equals(key)) { - ort.setBeschreibung(values.toString()); + ort.setBeschreibung(value.toString()); } if ("ort_nuts_code".equals(key)) { - ort.setNuts(values.toString()); + ort.setNuts(value.toString()); } if ("ort_hoehe_land".equals(key)) { - ort.setHoehe(values.toString()); + ort.setHoehe(value.toString()); } if ("ort_koordinaten".equals(key)) { - ort.setKoordinaten(values.toString()); + ort.setKoordinaten(value.toString()); } if ("ort_koordinaten_s".equals(key)) { - ort.setKoordinatenS(values.toString()); + ort.setKoordinatenS(value.toString()); } return ort; } + /** + * Add an attribute to the given LZusatzwert object. + * + * @param lKey The key mapping to a object member. + * @param value The value to set. + * @param wert The entity object. + * @return The updated entity object. + */ public LZusatzWert addAttribute( String lKey, - Object values, + Object value, LZusatzWert wert ) { - String v = values.toString().substring(1); + String v = value.toString().substring(1); int ndx = v.indexOf("\""); String groesse = v.substring(0, ndx); v = v.substring(ndx + 2); @@ -430,12 +496,20 @@ return wert; } + /** + * Add an attribute to the given LZusatzwert object. + * + * @param lKey The key mapping to a object member. + * @param value The value to set. + * @param wert The entity object. + * @return The updated entity object. + */ public LZusatzWert addAttributeS( String lKey, - Object values, + Object value, LZusatzWert wert ) { - String v = values.toString().substring(1); + String v = value.toString().substring(1); int ndx = v.indexOf("\""); String groesse = v.substring(0, ndx); v = v.substring(ndx + 2); @@ -451,6 +525,7 @@ wert.setMessfehler(Float.valueOf(fehler)); return wert; } + /** * @return the warnings */
--- a/src/main/java/de/intevation/lada/data/importer/EntryFormat.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/EntryFormat.java Tue Sep 10 15:55:54 2013 +0200 @@ -2,36 +2,64 @@ import java.util.regex.Pattern; - +/** + * An EntryFormat describes the internal structure of LAF-based key-value pairs. + * The pattern is a regular expression used to match the value in the LAF + * importer. + * The entry formats are defined in a config file + * (see wiki-doc: https://bfs-intern.intevation.de/Server/Importer). + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class EntryFormat { private String key; private Pattern pattern; private Object defaultValue; + /** + * Default constructor to create a new EntryFormat object. + */ public EntryFormat() { } + /** + * @return the key. + */ public String getKey() { return key; } + /** + * @param key The key to set. + */ public void setKey(String key) { this.key = key; } + /** + * @return the pattern + */ public Pattern getPattern() { return pattern; } + /** + * @param pattern The pattern to set. + */ public void setPattern(Pattern pattern) { this.pattern = pattern; } + /** + * @return the default value. + */ public Object getDefaultValue() { return defaultValue; } + /** + * @param defaultValue the default value to set. + */ public void setDefaultValue(Object defaultValue) { this.defaultValue = defaultValue; }
--- a/src/main/java/de/intevation/lada/data/importer/Importer.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/Importer.java Tue Sep 10 15:55:54 2013 +0200 @@ -5,7 +5,11 @@ import de.intevation.lada.auth.AuthenticationResponse; - +/** + * Defines the interface for data importer using authentication information. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public interface Importer { public boolean importData(String content, AuthenticationResponse auth);
--- a/src/main/java/de/intevation/lada/data/importer/LAFFormat.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFFormat.java Tue Sep 10 15:55:54 2013 +0200 @@ -13,11 +13,23 @@ import org.json.JSONException; import org.json.JSONObject; - +/** + * The LAFFormat reads the config file + * (https://bfs-intern.intevation.de/Server/Importer) and creates format + * objects for each entry. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class LAFFormat { private JSONObject fileContent; + /** + * Reads the config file. + * + * @param fileName Path to the config file. + * @return success + */ public boolean readConfigFile(String fileName) { try { byte[] encoded = Files.readAllBytes(Paths.get(fileName)); @@ -35,6 +47,16 @@ } } + /** + * Returns a List of EntryFormat for the requested entity type. + * The Entity type can be one of: + * * "probe" + * * "messung" + * * "ort" + * + * @param dataType The entity type + * @return List of entry formats defined for the requested type. + */ public List<EntryFormat> getFormat(String dataType) { List<EntryFormat> formats = new LinkedList<EntryFormat>(); try {
--- a/src/main/java/de/intevation/lada/data/importer/LAFImporter.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFImporter.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,34 +1,24 @@ package de.intevation.lada.data.importer; -import java.math.BigInteger; import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.ejb.Stateless; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; import javax.inject.Inject; import javax.inject.Named; import javax.persistence.EntityManager; -import javax.persistence.Query; import de.intevation.lada.auth.AuthenticationResponse; -import de.intevation.lada.data.QueryBuilder; import de.intevation.lada.data.Repository; -import de.intevation.lada.model.LKommentarM; -import de.intevation.lada.model.LKommentarP; -import de.intevation.lada.model.LMessung; -import de.intevation.lada.model.LMesswert; -import de.intevation.lada.model.LOrt; -import de.intevation.lada.model.LProbe; -import de.intevation.lada.model.LProbeInfo; -import de.intevation.lada.rest.Response; -import de.intevation.lada.validation.ValidationException; import de.intevation.lada.validation.Validator; +/** + * This importer uses the LAFParser to read data and create error/warning reports. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @Named("lafimporter") @Stateless public class LAFImporter @@ -76,6 +66,9 @@ private Map<String, List<ReportData>> warnings; private Map<String, List<ReportData>> errors; + /** + * Default constructor. + */ public LAFImporter() { warnings = new HashMap<String, List<ReportData>>(); errors = new HashMap<String, List<ReportData>>(); @@ -95,6 +88,13 @@ return errors; } + /** + * Import LAF formated data using authentication information. + * + * @param content The LAF file content. + * @param auth The authentication information. + * @return success. + */ @Override public boolean importData(String content, AuthenticationResponse auth) { this.warnings.clear(); @@ -122,6 +122,10 @@ return true; } + /** + * Reset the errors and warnings. Use this before calling importData() + * to have a clean error and warning report. + */ public void reset() { parser.reset(); this.warnings = new HashMap<String, List<ReportData>>();
--- a/src/main/java/de/intevation/lada/data/importer/LAFParser.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFParser.java Tue Sep 10 15:55:54 2013 +0200 @@ -10,7 +10,11 @@ import de.intevation.lada.auth.AuthenticationResponse; - +/** + * This parser is used to read data in LAF based key-value pair structure. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class LAFParser { private static final String PROBE_NEXT = "\n%PROBE%"; @@ -28,12 +32,23 @@ private Map<String, List<ReportData>> warnings; private Map<String, List<ReportData>> errors; + /** + * Default constructor. + */ public LAFParser() { this.warnings = new HashMap<String, List<ReportData>>(); this.errors = new HashMap<String, List<ReportData>>(); this.setDryRun(false); } + /** + * Read and parse the data and write the objects to the database. + * + * @param auth Authentication information + * @param laf The LAF formated data. + * @return success + * @throws LAFParserException + */ public boolean parse(AuthenticationResponse auth, String laf) throws LAFParserException { @@ -103,6 +118,11 @@ return parsed; } + /** + * Write all created objects to the database. + * + * @param auth The authentication information. + */ private void writeAll(AuthenticationResponse auth) { String probeId = producer.getProbe().getProbeId() == null ? "probeId" : producer.getProbe().getProbeId(); boolean p = writer.writeProbe(auth, producer.getProbe()); @@ -136,6 +156,12 @@ } } + /** + * Read all attributes from a single probe block and create entity objects. + * + * @param content Single probe block enclosed by %PROBE% + * @throws LAFParserException + */ private void readAll(String content) throws LAFParserException { @@ -242,10 +268,18 @@ } } + /** + * @return if objects are or not. + */ public boolean isDryRun() { return dryRun; } + /** + * If set to true, no objects will be created and written to database. + * + * @param dryRun + */ public void setDryRun(boolean dryRun) { this.dryRun = dryRun; } @@ -264,6 +298,9 @@ return errors; } + /** + * Reset errors and warnings. + */ public void reset() { producer.reset(); this.errors = new HashMap<String, List<ReportData>>();
--- a/src/main/java/de/intevation/lada/data/importer/LAFParserException.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFParserException.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,10 +1,13 @@ package de.intevation.lada.data.importer; - +/** + * Exception thrown in the LAF import process. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class LAFParserException extends Exception { - public LAFParserException(String message) { super(message); }
--- a/src/main/java/de/intevation/lada/data/importer/LAFProducer.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFProducer.java Tue Sep 10 15:55:54 2013 +0200 @@ -2,14 +2,12 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import javax.inject.Inject; import javax.inject.Named; -import de.intevation.lada.data.QueryBuilder; import de.intevation.lada.data.Repository; import de.intevation.lada.model.LKommentarM; import de.intevation.lada.model.LKommentarMId; @@ -20,12 +18,16 @@ import de.intevation.lada.model.LMesswertId; import de.intevation.lada.model.LOrt; import de.intevation.lada.model.LProbe; -import de.intevation.lada.model.LProbe; import de.intevation.lada.model.LZusatzWert; import de.intevation.lada.model.LZusatzWertId; import de.intevation.lada.model.Ort; -import de.intevation.lada.model.SProbenZusatz; +/** + * The LAFProducer creates entity objects form key-value pairs using the + * AttributeMapper. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @Named("lafproducer") public class LAFProducer implements Producer @@ -57,6 +59,10 @@ @Inject private AttributeMapper mapper; + /** + * Default contructor. Initializes the producer and reads the config file + * using the systemproperty "de.intevation.lada.importconfig". + */ public LAFProducer() { this.warnings = new HashMap<String, List<ReportData>>(); this.errors = new HashMap<String, List<ReportData>>(); @@ -74,6 +80,14 @@ ortFormat = format.getFormat("ort"); } + /** + * Add data to the producer. + * This triggers the producer to create a new object or add data to + * existing objects. + * + * @param key The key. + * @param values The value + */ @Override public void addData(String key, Object values) throws LAFParserException { @@ -173,6 +187,14 @@ } } + /** + * Check if the key is defined in the config file and validate the value + * using the pattern defined for this key. + * + * @param key The key. + * @param value The value. + * @return valid or not. + */ private boolean isValidOrt(String key, String value) { for (EntryFormat ef: ortFormat) { if (ef.getKey().equals(key.toLowerCase())) { @@ -184,6 +206,14 @@ return false; } + /** + * Check if the key is defined in the config file and validate the value + * using the pattern defined for this key. + * + * @param key The key. + * @param value The value. + * @return valid or not. + */ private boolean isValidMessung(String key, String value) { for (EntryFormat ef: messungFormat) { if (ef.getKey().equals(key.toLowerCase())) { @@ -195,6 +225,14 @@ return false; } + /** + * Check if the key is defined in the config file and validate the value + * using the pattern defined for this key. + * + * @param key The key. + * @param value The value. + * @return valid or not. + */ private boolean isValidProbe(String key, String value) { for (EntryFormat ef: probenFormat) { if (ef.getKey().equals(key.toLowerCase())) { @@ -206,45 +244,73 @@ return false; } + /** + * @return the {@link LProbe} entity. + */ @Override public LProbe getProbe() { return this.probe; } + /** + * @return List of {@link LMessung} entities. + */ @Override public List<LMessung> getMessungen() { return this.messungen; } + /** + * @return List of {@link Ort} entities. + */ @Override public List<Ort> getOrte() { return this.orte; } + /** + * @return List of {@link LOrt} entities. + */ @Override public List<LOrt> getLOrte() { return this.lorte; } + + /** + * @return List of {@link LKommentarP} entities. + */ @Override public List<LKommentarP> getProbenKommentare() { return this.pKommentare; } + /** + * @return List of {@link LKommentarM} entities. + */ @Override public List<LKommentarM> getMessungsKommentare() { return this.mKommentare; } + /** + * @return List of {@link LMesswert} entities. + */ @Override public List<LMesswert> getMesswerte() { return this.messwerte; } + /** + * @return List of {@link LZusatzWert} entities. + */ @Override public List<LZusatzWert> getZusatzwerte() { return this.zusatzwerte; } + /** + * Reset errors and warnings. + */ @Override public void reset() { this.errors = new HashMap<String, List<ReportData>>(); @@ -261,6 +327,9 @@ mapper.reset(); } + /** + * Add the current {@link LMessung} entity to the List and create a new one. + */ public void newMessung() { if (this.messung != null) { this.messungen.add(this.messung); @@ -272,6 +341,10 @@ this.messung.setId(id); } + /** + * Add the {@link Ort} and {@link LOrt} entities to the lists and create + * a new {@link OrtCreator}. + */ public void newOrt() { if (this.ort != null) { Ort o = this.ort.toOrt(); @@ -328,6 +401,5 @@ if (orte.isEmpty()) { return; } - } }
--- a/src/main/java/de/intevation/lada/data/importer/LAFWriter.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/LAFWriter.java Tue Sep 10 15:55:54 2013 +0200 @@ -24,6 +24,11 @@ import de.intevation.lada.validation.ValidationException; import de.intevation.lada.validation.Validator; +/** + * Writer to persist new entities in the database. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @Named("lafwriter") public class LAFWriter implements Writer @@ -69,11 +74,22 @@ private List<ReportData> errors; private List<ReportData> warnings; + /** + * Default constructor. + */ public LAFWriter() { errors = new ArrayList<ReportData>(); warnings = new ArrayList<ReportData>(); } + /** + * Write a new {@link LProbe} object to the database using + * authorization and validation. + * + * @param auth The authentication information. + * @param probe The new {@link LProbe} object. + * @return success + */ @Override public boolean writeProbe(AuthenticationResponse auth, LProbe probe) { if (!authorized(probe, auth)) { @@ -113,6 +129,14 @@ return true; } + /** + * Write new {@link LMessung} objects to the database using + * authorization and validation. + * + * @param auth The authentication information. + * @param messungen The new {@link LMessung} objects. + * @return success + */ @Override public boolean writeMessungen( AuthenticationResponse auth, @@ -150,6 +174,13 @@ return true; } + /** + * Write new {@link Ort} objects to the database. + * + * @param auth The authentication information. + * @param orte List of {@link Ort} objects. + * @return success + */ @Override public boolean writeOrte(AuthenticationResponse auth, List<Ort> orte) { for (Ort ort :orte) { @@ -158,6 +189,13 @@ return true; } + /** + * Write new {@link LOrt} objects to the database using validation. + * + * @param auth The authentication information. + * @param orte List of {@link LOrt} objects. + * @return success + */ @Override public boolean writeLOrte(AuthenticationResponse auth, List<LOrt> orte) { for(LOrt ort: orte) { @@ -191,6 +229,13 @@ return true; } + /** + * Write new {@link LKommentarP} objects to the database. + * + * @param auth The authentication information. + * @param kommentare List of {@link LKommentarP} objects. + * @return success + */ @Override public boolean writeProbenKommentare( AuthenticationResponse auth, @@ -202,6 +247,13 @@ return true; } + /** + * Write new {@link LKommentarM} objects to the database. + * + * @param auth The authentication information. + * @param kommentare List of {@link LKommentarM} objects. + * @return success + */ @Override public boolean writeMessungKommentare( AuthenticationResponse auth, @@ -218,6 +270,13 @@ return true; } + /** + * Write new {@link LMesswert} objects to the database using validation. + * + * @param auth The authentication information. + * @param werte List of {@link LMesswert} objects. + * @return success + */ @Override public boolean writeMesswerte( AuthenticationResponse auth, @@ -254,6 +313,11 @@ return false; } + /** + * Persist a {@link LProbe} object. + * + * @param probe The {@link LProbe} object. + */ @TransactionAttribute(TransactionAttributeType.REQUIRED) private void persist(LProbe probe) { String queryColumns = "insert into l_probe (probe_id, ba_id, test," + @@ -373,6 +437,14 @@ insert.executeUpdate(); } + /** + * Check if the user given in the authentication information is authorized + * to access the {@link LProbe} object. + * + * @param probe The {@link LProbe} object. + * @param auth The authentication information. + * @return access + */ private boolean authorized(LProbe probe, AuthenticationResponse auth) { if (auth.getNetzbetreiber().contains(probe.getNetzbetreiberId()) && auth.getMst().contains(probe.getMstId())) { @@ -395,6 +467,9 @@ return warnings; } + /** + * Reset the errors and warnings. + */ public void reset() { this.warnings = new ArrayList<ReportData>(); this.errors = new ArrayList<ReportData>();
--- a/src/main/java/de/intevation/lada/data/importer/OrtCreator.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/OrtCreator.java Tue Sep 10 15:55:54 2013 +0200 @@ -76,7 +76,7 @@ } /** - * @param ortId the ortCode to set + * @param ortCode the ortCode to set */ public void setOrtCode(String ortCode) { this.ortCode = ortCode;
--- a/src/main/java/de/intevation/lada/data/importer/Producer.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/Producer.java Tue Sep 10 15:55:54 2013 +0200 @@ -12,7 +12,12 @@ import de.intevation.lada.model.LZusatzWert; import de.intevation.lada.model.Ort; - +/** + * Defines the interface for producers that create lada entities from + * key-value pairs. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public interface Producer { public void addData(String key, Object values)
--- a/src/main/java/de/intevation/lada/data/importer/ReportData.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/ReportData.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,15 +1,37 @@ package de.intevation.lada.data.importer; - +/** + * Container for error or warning messages send to the client. + * + * Errors and warnings are specified by the key-value pair that caused the problem and a code. + * The code can be + * 670: Parser error + * 671: existing + * 672: duplicated entry + * 673: missing + * 674: date error + * or any validation code. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class ReportData { private String key; private String value; private Integer code; + /** + * Default constructor. + */ public ReportData() { } + /** + * Constructor to create a {@link ReportData} object with data. + * @param key The key caused the error/warning. + * @param value The value caused the error/warning. + * @param code The code specifying the error/warning. + */ public ReportData(String key, String value, Integer code) { this.key = key; this.value = value;
--- a/src/main/java/de/intevation/lada/data/importer/Writer.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/importer/Writer.java Tue Sep 10 15:55:54 2013 +0200 @@ -11,7 +11,11 @@ import de.intevation.lada.model.LProbe; import de.intevation.lada.model.Ort; - +/** + * Defines the interface for database object writers. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public interface Writer { public boolean writeProbe(AuthenticationResponse auth, LProbe probe);
--- a/src/main/java/de/intevation/lada/model/query/QueryConfig.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/model/query/QueryConfig.java Tue Sep 10 15:55:54 2013 +0200 @@ -2,7 +2,17 @@ import java.util.List; +import de.intevation.lada.model.LProbeInfo; +/** + * Container for SQL query configuration. + * + * The server can filter {@link LProbeInfo} objects by configurable SQL queries + * as described in the project wiki (<link>https://bfs-intern.intevation.de/Server/Suche</link>). + * This container is used to store the config at runtime. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class QueryConfig { int id; @@ -80,7 +90,7 @@ } /** - * @param filter the filter to set + * @param filters the filter to set */ public void setFilters(List<QueryFilter> filters) { this.filters = filters;
--- a/src/main/java/de/intevation/lada/model/query/QueryFilter.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/model/query/QueryFilter.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,41 +1,74 @@ package de.intevation.lada.model.query; - +/** + * Container for data filter. + * Stores filter defined in the SQL query configuration. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class QueryFilter { private String dataIndex; private String type; private String label; + /** + * Default constructor. + */ public QueryFilter() { } + /** + * Constructor to create a filled filter. + * + * @param dataIndex The dataIndex. + * @param type The filter type. + * @param label The label. + */ public QueryFilter(String dataIndex, String type, String label) { this.dataIndex = dataIndex; this.type = type; this.label = label; } + /** + * @return The dataIndex + */ public String getDataIndex() { return dataIndex; } + /** + * @param dataIndex THe dataIndex to set. + */ public void setDataIndex(String dataIndex) { this.dataIndex = dataIndex; } + /** + * @return The filter type. + */ public String getType() { return type; } + /** + * @param type The filter type to set. + */ public void setType(String type) { this.type = type; } + /** + * @return The label. + */ public String getLabel() { return label; } + /** + * @param label The label to set. + */ public void setLabel(String label) { this.label = label; }
--- a/src/main/java/de/intevation/lada/model/query/ResultConfig.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/model/query/ResultConfig.java Tue Sep 10 15:55:54 2013 +0200 @@ -1,6 +1,11 @@ package de.intevation.lada.model.query; - +/** + * Container for result configurations. + * Provides config for the client like column header, column with and data index. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class ResultConfig { String dataIndex; @@ -8,9 +13,18 @@ Integer flex; Integer width; + /** + * Default constructor. + */ public ResultConfig() { } + /** + * @param dataIndex The dataIndex + * @param header The column header + * @param flex Flexible with + * @param width Width in px. + */ public ResultConfig(String dataIndex, String header, Integer flex, Integer width) { this.dataIndex= dataIndex; this.header= header; @@ -18,6 +32,11 @@ this.width = width; } + /** + * @param dataIndex The dataIndex + * @param header The column header + * @param flex Flexible with + */ public ResultConfig(String dataIndex, String header, Integer flex) { this.dataIndex= dataIndex; this.header= header; @@ -25,6 +44,10 @@ this.width = null; } + /** + * @param dataIndex The dataIndex + * @param header The column header + */ public ResultConfig(String dataIndex, String header) { this.dataIndex= dataIndex; this.header= header;
--- a/src/main/java/de/intevation/lada/rest/AuthInfoService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/AuthInfoService.java Tue Sep 10 15:55:54 2013 +0200 @@ -14,6 +14,7 @@ import de.intevation.lada.auth.Authentication; import de.intevation.lada.auth.AuthenticationException; import de.intevation.lada.auth.Authorization; +import de.intevation.lada.model.LProbe; /** * This class produces a RESTful service to get information about @@ -39,7 +40,7 @@ /** * Request information about access to probe objects * - * @param info The URL query parameters. + * @param id The {@link LProbe} id. * @param headers The HTTP header containing authorization information. * @return Response object. */
--- a/src/main/java/de/intevation/lada/rest/InfoService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/InfoService.java Tue Sep 10 15:55:54 2013 +0200 @@ -49,8 +49,8 @@ } /** - * This class produces a RESTful service to read, write and update - * LOrt objects. + * This class produces a RESTful service to read information about the user and + * server * * @author <a href="mailto:torsten.irlaender@intevation.de">Torsten Irländer</a> */ @@ -70,9 +70,7 @@ private Repository readonlyRepo; /** - * Request SQL-Queries - * - * Query parameters are used for the filter in form of key-value pairs. + * Request User and Server information. * * @param info The URL query parameters. * @param headers The HTTP header containing authorization information.
--- a/src/main/java/de/intevation/lada/rest/LAFExportService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LAFExportService.java Tue Sep 10 15:55:54 2013 +0200 @@ -43,15 +43,16 @@ @Inject @Named("lafexporter") private Exporter exporter; + /** - * Import LProbe object. - * See - * http://howtodoinjava.com/2013/05/21/jax-rs-resteasy-file-upload-httpclient-example/ - * for more details on the implementation. + * Export LProbe objects. * - * @param input MulitpartFormDataInput containing the file to upload. + * The service takes form url encoded POST data containing probe ids and + * exports the LProbe objects filtered by these ids. + * + * @param proben Form data (url encoded) string with probe ids. * @param header The HTTP header containing authorization information. - * @return Response object. + * @return The LAF file to export. */ @POST @Path("/laf")
--- a/src/main/java/de/intevation/lada/rest/LKommentarMService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LKommentarMService.java Tue Sep 10 15:55:54 2013 +0200 @@ -27,6 +27,8 @@ import de.intevation.lada.data.Repository; import de.intevation.lada.model.LKommentarM; import de.intevation.lada.model.LKommentarMId; +import de.intevation.lada.model.LMessung; +import de.intevation.lada.model.LProbe; /** * This class produces a RESTful service to read, write and update @@ -157,9 +159,9 @@ * Delete a LKommentarM object. * * @param kId The object id. - * @param messungsId The LProbe id. - * @param statusId The LStatus id - * @param headers The HTTP header containing authorization information. + * @param messungsId The {@link LMessung} id. + * @param probeId The {@link LProbe} id + * @param headers The HTTP header containing authorization information. * @return Response object. */ @DELETE
--- a/src/main/java/de/intevation/lada/rest/LMesswertService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LMesswertService.java Tue Sep 10 15:55:54 2013 +0200 @@ -26,6 +26,7 @@ import de.intevation.lada.model.LMessung; import de.intevation.lada.model.LMesswert; import de.intevation.lada.model.LMesswertId; +import de.intevation.lada.model.LProbe; /** * This class produces a RESTful service to read, write and update @@ -158,10 +159,10 @@ /** * Delete a LMesswert object. * - * @param statusId The object id. - * @param messungsId The LProbe id. - * @param statusId The LStatus id - * @param headers The HTTP header containing authorization information. + * @param messgroesseId The messgroesse id. + * @param messungsId The {@link LMessung} id. + * @param probeId The {@link LProbe} id + * @param headers The HTTP header containing authorization information. * @return Response object. */ @DELETE
--- a/src/main/java/de/intevation/lada/rest/LOrtService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LOrtService.java Tue Sep 10 15:55:54 2013 +0200 @@ -25,6 +25,7 @@ import de.intevation.lada.data.QueryBuilder; import de.intevation.lada.data.Repository; import de.intevation.lada.model.LOrt; +import de.intevation.lada.model.LProbe; /** * This class produces a RESTful service to read, write and update @@ -156,8 +157,8 @@ /** * Delete a LOrt object. * - * @param pzsId The object id. - * @param probeId The LProbe id. + * @param ortId The {@link LOrt} id. + * @param probeId The {@link LProbe} id. * @param headers The HTTP header containing authorization information. * @return Response object. */
--- a/src/main/java/de/intevation/lada/rest/LStatusService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LStatusService.java Tue Sep 10 15:55:54 2013 +0200 @@ -23,6 +23,8 @@ import de.intevation.lada.auth.AuthenticationException; import de.intevation.lada.data.QueryBuilder; import de.intevation.lada.data.Repository; +import de.intevation.lada.model.LMessung; +import de.intevation.lada.model.LProbe; import de.intevation.lada.model.LStatus; import de.intevation.lada.model.LStatusId; @@ -56,7 +58,7 @@ * Query parameters are used for the filter in form of key-value pairs. * * @param info The URL query parameters. - * @param header The HTTP header containing authorization information. + * @param headers The HTTP header containing authorization information. * @return Response object. */ @GET @@ -148,9 +150,9 @@ * Delete a LStatus object. * * @param statusId The object id. - * @param messungsId The LProbe id. - * @param statusId The LStatus id - * @param headers The HTTP header containing authorization information. + * @param messungsId The {@link LMessung} id. + * @param probeId The {@link LProbe} id + * @param headers The HTTP header containing authorization information. * @return Response object. */ @DELETE
--- a/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Tue Sep 10 15:55:54 2013 +0200 @@ -55,7 +55,7 @@ * Query parameters are used for the filter in form of key-value pairs. * * @param info The URL query parameters. - * @param header The HTTP header containing authorization information. + * @param headers The HTTP header containing authorization information. * @return Response object. */ @GET
--- a/src/main/java/de/intevation/lada/rest/SDatenbasisService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SDatenbasisService.java Tue Sep 10 15:55:54 2013 +0200 @@ -71,7 +71,7 @@ * Request a single SDatenbasis via its id. * * @param id The object id. - * @param header The HTTP header containing authorization information. + * @param headers The HTTP header containing authorization information. * @return Response object. */ @GET
--- a/src/main/java/de/intevation/lada/rest/SProbenartService.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SProbenartService.java Tue Sep 10 15:55:54 2013 +0200 @@ -70,7 +70,7 @@ * Request a single SProbenart via its id. * * @param id The object id. - * @param header The HTTP header containing authorization information. + * @param headers The HTTP header containing authorization information. * @return Response object. */ @GET
--- a/src/main/java/de/intevation/lada/utils/QueryTools.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/utils/QueryTools.java Tue Sep 10 15:55:54 2013 +0200 @@ -16,9 +16,19 @@ import de.intevation.lada.model.query.QueryFilter; import de.intevation.lada.model.query.ResultConfig; - +/** + * Utility class to handle the SQL query configuration. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ public class QueryTools { + /** + * Read the config file using the system property + * "de.intevation.lada.sqlconfig". + * + * @return The file content. + */ public static String readConfigFile() { String file = System.getProperty("de.intevation.lada.sqlconfig"); try { @@ -31,6 +41,13 @@ } } + /** + * Get the configuration objects. + * First reads the config file and creates {@link QueryConfig} objects + * from JSON. + * + * @return List of {@link QueryConfig} objects. + */ public static List<QueryConfig> getConfig() { String content = readConfigFile(); if (content == null) { @@ -79,6 +96,14 @@ return configs; } + /** + * Get a query by id. + * First reads the config file and returns the {@link QueryConfig} + * identified by the given id. + * + * @param id {@link QueryConfig} id. + * @return The query config as JSON object or null if no object was found. + */ public static JSONObject getQueryById(String id) { try { String content = readConfigFile();
--- a/src/main/java/de/intevation/lada/validation/LOrtValidator.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/validation/LOrtValidator.java Tue Sep 10 15:55:54 2013 +0200 @@ -22,6 +22,11 @@ import de.intevation.lada.model.SVerwaltungseinheit; import de.intevation.lada.rest.Response; +/** + * Validator for LOrt objects. + * + * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a> + */ @ApplicationScoped @Named("lortvalidator") public class LOrtValidator @@ -59,6 +64,13 @@ return warnings; } + /** + * Check if the given lat/lon coordinates are within the area of the + * verwaltungseinheit. + * + * @param ort + * @param warnings + */ private void validateVerwaltungseinheit(LOrt ort, Map<String, Integer> warnings) { if (!ort.getOrtsTyp().equals("E")) { return;
--- a/src/main/java/de/intevation/lada/validation/ValidationException.java Tue Sep 10 10:17:32 2013 +0200 +++ b/src/main/java/de/intevation/lada/validation/ValidationException.java Tue Sep 10 15:55:54 2013 +0200 @@ -55,7 +55,7 @@ /** * Getter for the errors. * - * @return + * @return the errors */ public Map<String, Integer> getErrors() { return errors; @@ -64,7 +64,7 @@ /** * Getter for the warnings. * - * @return + * @return the warnings */ public Map<String, Integer> getWarnings() { return warnings;