# HG changeset patch # User Raimund Renkert # Date 1372845328 -7200 # Node ID a305412206a3b916fd0c44c7e2a7d92268477aee # Parent 8f6242579a8594f2a5e20770865f97c130201068 Code documentation. diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/authentication/Authentication.java --- a/src/main/java/de/intevation/lada/authentication/Authentication.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/authentication/Authentication.java Wed Jul 03 11:55:28 2013 +0200 @@ -2,6 +2,9 @@ import javax.ws.rs.core.HttpHeaders; +/** + * @author Raimund Renkert + */ public interface Authentication { public boolean isAuthorizedUser(HttpHeaders headers) diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/authentication/AuthenticationException.java --- a/src/main/java/de/intevation/lada/authentication/AuthenticationException.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/authentication/AuthenticationException.java Wed Jul 03 11:55:28 2013 +0200 @@ -1,6 +1,8 @@ package de.intevation.lada.authentication; - +/** + * @author Raimund Renkert + */ public class AuthenticationException extends Exception { diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/authentication/AuthenticationResponse.java --- a/src/main/java/de/intevation/lada/authentication/AuthenticationResponse.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/authentication/AuthenticationResponse.java Wed Jul 03 11:55:28 2013 +0200 @@ -2,7 +2,12 @@ import java.util.List; - +/** + * Response of an authentication module. Contains the user name, + * 'Messstellen' and 'Netzbetreiber'. + * + * @author Raimund Renkert + */ public class AuthenticationResponse { private String user; diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/authentication/LdapAuthentication.java --- a/src/main/java/de/intevation/lada/authentication/LdapAuthentication.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/authentication/LdapAuthentication.java Wed Jul 03 11:55:28 2013 +0200 @@ -21,6 +21,12 @@ import de.intevation.lada.model.LProbe; import de.intevation.lada.model.LProbeInfo; +/** + * This implementation of the authentication interface reads LDAP users + * and groups from HTTP headers and validates the groups using a database. + * + * @author Raimund Renkert + */ @RequestScoped @Named("ldapauth") public class LdapAuthentication @@ -29,6 +35,11 @@ @Inject private EntityManager em; + /** + * Determine if the header contains information about a valid user. + * + * @param headers The HTTP header containing LDAP user information. + */ @Override public boolean isAuthorizedUser(HttpHeaders headers) throws AuthenticationException { @@ -40,6 +51,11 @@ return true; } + /** + * Synchronize LDAP user and groups with database. + * + * @param headers The HTTP header containing LDAP user information. + */ @Override public AuthenticationResponse authorizedGroups(HttpHeaders headers) throws AuthenticationException { @@ -66,6 +82,12 @@ return response; } + /** + * Determine if the user has the permission to access a probe. + * + * @param headers The HTTP header containing LDAP user information. + * @param probeId The LProbe id. + */ public boolean hasAccess (HttpHeaders headers, String probeId) throws AuthenticationException { QueryBuilder builder = new QueryBuilder(em, LProbe.class); @@ -84,11 +106,23 @@ return false; } + /** + * Determine if the LProbe identified by probeId is writeable for the user. + * + * @param headers The HTTP header containing LDAP user information. + * @param probeId The probe id. + */ public boolean isReadOnly(HttpHeaders headers, String probeId) { //TODO: test if probe has messung with status 'fertig'. return false; } + /** + * Get the user from HTTP header. + * + * @param headers The HTTP header containing user information. + * @return The user name. + */ private String extractUser(HttpHeaders headers) { List user = headers.getRequestHeader("x-ldap-user"); if (user == null || user.isEmpty()) { @@ -97,6 +131,13 @@ return user.get(0); } + /** + * Extract LDAP information from HTTP header. + * + * @param headers The HTTP header containing ldap information. + * @return The Ldap object. + * @throws InvalidNameException + */ private LdapName extractLdapName(HttpHeaders headers) throws InvalidNameException { List attributes = headers.getRequestHeader("x-ldap-groups"); if (attributes == null ||attributes.isEmpty()) { @@ -114,6 +155,13 @@ return ldap; } + /** + * Get the 'Messstellen' and 'Netzbetreiber' from database using the + * LDAP groups. + * + * @param groups List of LDAP groups. + * @return AuthenticationResponse object. + */ private AuthenticationResponse getDatabaseAtributes(List groups) { CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery criteria = builder.createQuery(Auth.class); diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/data/LKommentarPRepository.java --- a/src/main/java/de/intevation/lada/data/LKommentarPRepository.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LKommentarPRepository.java Wed Jul 03 11:55:28 2013 +0200 @@ -1,7 +1,5 @@ package de.intevation.lada.data; -import java.util.ArrayList; -import java.util.logging.Level; import java.util.logging.Logger; import javax.ejb.EJBTransactionRolledbackException; diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/manage/DataManager.java --- a/src/main/java/de/intevation/lada/manage/DataManager.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/manage/DataManager.java Wed Jul 03 11:55:28 2013 +0200 @@ -11,6 +11,12 @@ import javax.persistence.TransactionRequiredException; +/** + * This data manager provides the interface to persist, remove and update + * database objects. + * + * @author Raimund Renkert + */ @Stateless @Named("datamanager") public class DataManager @@ -19,6 +25,11 @@ @Inject private EntityManager em; + /** + * Create a new database object. + * + * @param object The new object. + */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void create(Object object) @@ -29,6 +40,11 @@ em.persist(object); } + /** + * Update a database object. + * + * @param object The object to update. + */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) public void update(Object object) @@ -39,9 +55,14 @@ em.merge(object); } + /** + * Delete a database object. + * + * @param object The object to delete. + */ @Override @TransactionAttribute(TransactionAttributeType.REQUIRED) - public void delete(Object object) + public void delete(Object object) throws IllegalArgumentException, TransactionRequiredException { em.remove(em.contains(object) ? object : em.merge(object)); diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/manage/Manager.java --- a/src/main/java/de/intevation/lada/manage/Manager.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/manage/Manager.java Wed Jul 03 11:55:28 2013 +0200 @@ -7,6 +7,9 @@ import javax.persistence.EntityExistsException; import javax.persistence.TransactionRequiredException; +/** + * @author Raimund Renkert + */ @Stateless public interface Manager { @@ -25,7 +28,7 @@ TransactionRequiredException; @TransactionAttribute(TransactionAttributeType.REQUIRED) - public void delete(Object object) + public void delete(Object object) throws IllegalArgumentException, TransactionRequiredException; } diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LKommentarMService.java --- a/src/main/java/de/intevation/lada/rest/LKommentarMService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LKommentarMService.java Wed Jul 03 11:55:28 2013 +0200 @@ -23,8 +23,8 @@ import de.intevation.lada.model.LKommentarM; /** - * This class produces a RESTful service to read the contents of l_kommentar_m - * table. + * This class produces a RESTful service to read, write and update + * LKommentarM objects. * * @author Raimund Renkert */ @@ -39,6 +39,9 @@ @Named("lkommentarmrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -48,8 +51,9 @@ * * Query parameters are used for the filter in form of key-value pairs. * - * @param info The URL query parameters. - * @return JSON Object via Rest service. + * @param info The URL query parameters. + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -84,6 +88,13 @@ } } + /** + * Update LKommentarM objects. + * + * @param kommentar The LKommentarM object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Produces("text/json") @Consumes("application/json") @@ -103,6 +114,13 @@ } } + /** + * Create a new LKommentarM object. + * + * @param kommentar The new LKommentarM object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") @@ -121,4 +139,4 @@ return new Response(false, 699, new ArrayList()); } } -} +} \ No newline at end of file diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LKommentarService.java --- a/src/main/java/de/intevation/lada/rest/LKommentarService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LKommentarService.java Wed Jul 03 11:55:28 2013 +0200 @@ -27,7 +27,8 @@ import de.intevation.lada.model.LKommentarP; /** - * This class produces a RESTful service to read the contents of LKommentarP table. + * This class produces a RESTful service to read, write and update + * LKommentarP objects. * * @author Raimund Renkert */ @@ -42,6 +43,9 @@ @Named("lkommentarRepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -52,6 +56,14 @@ @Inject private Logger logger; + /** + * Delete a LKommentarP object identified by 'probeId' and 'kId'. + * + * @param kId The object id. + * @param probeId The LProbe object id. + * @param headers The HTTP headers containing authorization information. + * @return Response object. + */ @DELETE @Path("/{kId}/{probeId}") @Produces("text/json") @@ -87,8 +99,9 @@ /** * Request a list of LKommentarP objects filtered by LProbe id. * - * @param info The query parameters - * @return JSON object via REST service. + * @param info The URL parameters + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -119,6 +132,13 @@ } } + /** + * Update a LKommentarP object. + * + * @param kommentar The LKommentarP object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Path("/{kId}/{probeId}") @Produces("text/json") @@ -139,6 +159,13 @@ } } + /** + * Create a new LKommentarP object. + * + * @param kommentar The new LKommentarP object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Consumes("application/json") @Produces("text/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LMessungService.java --- a/src/main/java/de/intevation/lada/rest/LMessungService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LMessungService.java Wed Jul 03 11:55:28 2013 +0200 @@ -24,8 +24,9 @@ import de.intevation.lada.model.LMessung; /** -* This class produces a RESTful service to read the contents of LProbe table. -* +* This class produces a RESTful service to read, write and update +* LMessung objects. +* * @author Raimund Renkert */ @Path("/messung") @@ -39,6 +40,9 @@ @Named("lmessungrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -83,6 +87,13 @@ } } + /** + * Update a LMessung object. + * + * @param messung The LMessung object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Path("/{id}") @Produces("text/json") @@ -103,6 +114,13 @@ } } + /** + * Create a new LMessung object. + * + * @param messung The new LMessung object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LMesswertService.java --- a/src/main/java/de/intevation/lada/rest/LMesswertService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LMesswertService.java Wed Jul 03 11:55:28 2013 +0200 @@ -10,7 +10,6 @@ import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; @@ -24,8 +23,8 @@ import de.intevation.lada.model.LMesswert; /** - * This class produces a RESTful service to read the contents of - * l_messert table. + * This class produces a RESTful service to read, write and update + * the contents of LMesswert objects. * * @author Raimund Renkert */ @@ -34,12 +33,15 @@ public class LMesswertService { /** - * The Repository for SUmwelt. + * The Repository for LMesswert. */ @Inject @Named("lmesswertrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -49,8 +51,9 @@ * * Query parameters are used for the filter in form of key-value pairs. * - * @param info The URL query parameters. - * @return JSON Object via Rest service. + * @param info The URL query parameters. + * @param headers The HTTP header containing authorization information. + * @return JSON Object via Rest service. */ @GET @Produces("text/json") @@ -84,6 +87,13 @@ } } + /** + * Update a LMesswert object. + * + * @param messwert The LMesswert object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Produces("text/json") @Consumes("application/json") @@ -103,6 +113,13 @@ } } + /** + * Create a new LMesswert object. + * + * @param messwert The new LMesswert object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LOrtService.java --- a/src/main/java/de/intevation/lada/rest/LOrtService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LOrtService.java Wed Jul 03 11:55:28 2013 +0200 @@ -22,7 +22,13 @@ import de.intevation.lada.data.Repository; import de.intevation.lada.model.LOrt; -@Path("ort") +/** + * This class produces a RESTful service to read, write and update + * LOrt objects. + * + * @author Raimund Renkert + */ +@Path("/ort") @RequestScoped public class LOrtService { @@ -34,10 +40,22 @@ @Named("lortrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; + /** + * Request LOrt via a filter. + * + * Query parameters are used for the filter in form of key-value pairs. + * + * @param info The URL query parameters. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @GET @Produces("text/json") public Response filter( @@ -68,6 +86,13 @@ } } + /** + * Update LOrt objects. + * + * @param ort The LOrt object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Path("/{id}") @Produces("text/json") @@ -88,6 +113,13 @@ } } + /** + * Create a new LOrt object. + * + * @param ort The new LOrt object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LProbeService.java --- a/src/main/java/de/intevation/lada/rest/LProbeService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LProbeService.java Wed Jul 03 11:55:28 2013 +0200 @@ -29,8 +29,9 @@ import de.intevation.lada.model.LProbeInfo; /** -* This class produces a RESTful service to read the contents of LProbe table. -* +* This class produces a RESTful service to read, write and update +* LProbe objects. +* * @author Raimund Renkert */ @Path("/proben") @@ -45,20 +46,24 @@ private Repository repository; /** + * The authorization module. + */ + @Inject + @Named("ldapauth") + private Authentication authentication; + + /** * The logger for this class. */ @Inject private Logger log; - @Inject - @Named("ldapauth") - private Authentication authentication; - /** * Request a LProbe via its id. * - * @param id The LProbe id - * @return JSON Object via REST service. + * @param id The LProbe id + * @param header THe HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") @@ -102,8 +107,9 @@ * uwb=$UWBID (String) * begin=$PROBEENTNAHMEBEGIN (Timestamp) * - * @param info The URL query parameters. - * @return JSON Object via Rest service. + * @param info The URL query parameters. + * @param header The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -155,6 +161,13 @@ } } + /** + * Update a LProbe object. + * + * @param probe A LProbeInfo object wrapping the LProbe object. + * @param header The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Path("/{id}") @Produces("text/json") @@ -171,6 +184,12 @@ } } + /** + * Create a new LProbe object. + * @param probe A LProbeInfo object wrapping the LProbe object. + * @param header The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LStatusService.java --- a/src/main/java/de/intevation/lada/rest/LStatusService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LStatusService.java Wed Jul 03 11:55:28 2013 +0200 @@ -23,8 +23,8 @@ import de.intevation.lada.model.LStatus; /** - * This class produces a RESTful service to read the contents of - * l_status table. + * This class produces a RESTful service to read, write and update + * LStatus objects. * * @author Raimund Renkert */ @@ -39,6 +39,9 @@ @Named("lstatusrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -48,8 +51,9 @@ * * Query parameters are used for the filter in form of key-value pairs. * - * @param info The URL query parameters. - * @return JSON Object via Rest service. + * @param info The URL query parameters. + * @param header The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -83,6 +87,13 @@ } } + /** + * Update a LStatus object. + * + * @param status The LStatus object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Produces("text/json") @Consumes("application/json") @@ -102,6 +113,13 @@ } } + /** + * Create a new LStatus object. + * + * @param status The new LStatus object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/LZusatzwertService.java --- a/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LZusatzwertService.java Wed Jul 03 11:55:28 2013 +0200 @@ -26,8 +26,8 @@ import de.intevation.lada.model.LZusatzWert; /** - * This class produces a RESTful service to read the contents of - * l_zusatz_wert table. + * This class produces a RESTful service to read, write and update + * LZusatzwert objects. * * @author Raimund Renkert */ @@ -42,6 +42,9 @@ @Named("lzusatzwertrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -51,8 +54,9 @@ * * Query parameters are used for the filter in form of key-value pairs. * - * @param info The URL query parameters. - * @return JSON Object via Rest service. + * @param info The URL query parameters. + * @param header The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -83,6 +87,13 @@ } } + /** + * Update a LZusatzwert object. + * + * @param zusatzwert The LZusatzwert object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Produces("text/json") @Path("/{pzsId}/{probeId}") @@ -103,6 +114,13 @@ } } + /** + * Create a new LZusatzwert object. + * + * @param zusatzwert The new LZusatzwert object. + * @param headers THe HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") @@ -122,6 +140,14 @@ } } + /** + * Delete a LZusatzwert object. + * + * @param pzsId The object id. + * @param probeId The LProbe id. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @DELETE @Path("/{pzsId}/{probeId}") public Response delete( diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/OrtService.java --- a/src/main/java/de/intevation/lada/rest/OrtService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/OrtService.java Wed Jul 03 11:55:28 2013 +0200 @@ -15,15 +15,18 @@ import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.HttpHeaders; -import javax.ws.rs.core.MultivaluedMap; -import javax.ws.rs.core.UriInfo; import de.intevation.lada.authentication.Authentication; import de.intevation.lada.authentication.AuthenticationException; -import de.intevation.lada.data.QueryBuilder; import de.intevation.lada.data.Repository; import de.intevation.lada.model.Ort; +/** +* This class produces a RESTful service to read, write and update +* Ort objects. +* +* @author Raimund Renkert +*/ @Path("/ortinfo") @RequestScoped public class OrtService @@ -35,15 +38,19 @@ @Named("ortrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; /** - * Request a LZusatzWert via its id. + * Request a Ort object via its id. * - * @param id The LProbe id - * @return JSON Object via REST service. + * @param id The Ort id + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") @@ -64,11 +71,9 @@ } /** - * Request LMessert via a filter. + * Request all Ort objects * - * Query parameters are used for the filter in form of key-value pairs. - * - * @param info The URL query parameters. + * @param headers The HTTP header containing authorization information. * @return JSON Object via Rest service. */ @GET @@ -85,6 +90,13 @@ } } + /** + * Update a Ort object. + * + * @param ort The Ort object to update. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @PUT @Produces("text/json") @Path("/{ortId}") @@ -101,6 +113,13 @@ } } + /** + * Create a new Ort object. + * + * @param ort The new Ort object. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @POST @Produces("text/json") @Consumes("application/json") @@ -116,6 +135,13 @@ } } + /** + * Delete a Ort object. + * + * @param ortId The object od. + * @param headers The HTTP header containing authorization information. + * @return Response object. + */ @DELETE @Path("/{ortId}") public Response delete( diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/Response.java --- a/src/main/java/de/intevation/lada/rest/Response.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/Response.java Wed Jul 03 11:55:28 2013 +0200 @@ -7,7 +7,8 @@ import javax.inject.Inject; /** -* This class is nice!. +* Response object storing information about success, warnings, errors and +* the data object. This class is used as return value in REST services. * * @author Torsten Irländer */ @@ -28,6 +29,13 @@ private Map warnings; private Boolean readonly; + /** + * Constructor to create a basic Response object. + * + * @param success Information if the operation was successful. + * @param code The return code. + * @param data The data object wrapped by the response. + */ public Response(boolean success, int code, Object data) { this.success = success; this.message = Integer.toString(code); diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SDatenbasisService.java --- a/src/main/java/de/intevation/lada/rest/SDatenbasisService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SDatenbasisService.java Wed Jul 03 11:55:28 2013 +0200 @@ -19,7 +19,7 @@ import de.intevation.lada.model.SDatenbasis; /** - * This class produces a RESTful service to read the contents of SDatenbasis table. + * This class produces a RESTful service to read SDatenbasis objects. * * @author Raimund Renkert */ @@ -34,6 +34,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -47,7 +50,8 @@ /** * Request all SDatenbasis objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -66,8 +70,9 @@ /** * Request a single SDatenbasis via its id. * - * @param id The mst_id - * @return JSON Object via REST service. + * @param id The object id. + * @param header The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SMesseinheitService.java --- a/src/main/java/de/intevation/lada/rest/SMesseinheitService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SMesseinheitService.java Wed Jul 03 11:55:28 2013 +0200 @@ -18,7 +18,7 @@ import de.intevation.lada.model.SMessEinheit; /** - * This class produces a RESTful service to read the contents of SDatenbasis table. + * This class produces a RESTful service to read SMesseinheit objects. * * @author Raimund Renkert */ @@ -33,6 +33,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -44,9 +47,10 @@ private Logger logger; /** - * Request all SDatenbasis objects. + * Request all SMesseinheit objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SMessstelleService.java --- a/src/main/java/de/intevation/lada/rest/SMessstelleService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SMessstelleService.java Wed Jul 03 11:55:28 2013 +0200 @@ -21,8 +21,7 @@ import de.intevation.lada.model.SMessStelle; /** - * This class produces a RESTful service to read the contents of s_messstelle - * table. + * This class produces a RESTful service to read SMessstelle objects * * @author Raimund Renkert */ @@ -37,6 +36,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -48,9 +50,10 @@ private Logger logger; /** - * Request all SMessStelle objects. + * Request all SMessstelle objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -70,10 +73,11 @@ } /** - * Request a single SMessStelle via its id. + * Request a single SMessstelle via its id. * - * @param id The mst_id - * @return JSON Object via REST service. + * @param id The object id. + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SNetzBetreiberService.java --- a/src/main/java/de/intevation/lada/rest/SNetzBetreiberService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SNetzBetreiberService.java Wed Jul 03 11:55:28 2013 +0200 @@ -21,7 +21,7 @@ import de.intevation.lada.model.SNetzBetreiber; /** - * This class produces a RESTful service to read the contents of SNetzbetreiber table. + * This class produces a RESTful service to read SNetzbetreiber objects. * * @author Torsten Irländer */ @@ -36,6 +36,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -47,9 +50,10 @@ private Logger logger; /** - * Request all SDatenbasis objects. + * Request all SNetzbetreiber objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -69,10 +73,11 @@ } /** - * Request a single SDatenbasis via its id. + * Request a single SNetzbetreiber via its id. * - * @param id The mst_id - * @return JSON Object via REST service. + * @param id The object id. + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SProbenartService.java --- a/src/main/java/de/intevation/lada/rest/SProbenartService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SProbenartService.java Wed Jul 03 11:55:28 2013 +0200 @@ -19,7 +19,7 @@ import de.intevation.lada.model.SProbenart; /** - * This class produces a RESTful service to read the contents of SProbenart table. + * This class produces a RESTful service to read SProbenart objects. * * @author Raimund Renkert */ @@ -34,6 +34,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -47,7 +50,7 @@ /** * Request all SProbenart objects. * - * @return JSON Object via Rest service + * @return Response object. */ @GET @Produces("text/json") @@ -66,8 +69,9 @@ /** * Request a single SProbenart via its id. * - * @param id The mst_id - * @return JSON Object via REST service. + * @param id The object id. + * @param header The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id}") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SProbenzusatzService.java --- a/src/main/java/de/intevation/lada/rest/SProbenzusatzService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SProbenzusatzService.java Wed Jul 03 11:55:28 2013 +0200 @@ -18,7 +18,7 @@ import de.intevation.lada.model.SProbenZusatz; /** - * This class produces a RESTful service to read the contents of SDatenbasis table. + * This class produces a RESTful service to read SProbenzusatz objects. * * @author Raimund Renkert */ @@ -33,6 +33,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -44,9 +47,10 @@ private Logger logger; /** - * Request all SDatenbasis objects. + * Request all SProbenzusatz objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SStaatService.java --- a/src/main/java/de/intevation/lada/rest/SStaatService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SStaatService.java Wed Jul 03 11:55:28 2013 +0200 @@ -18,7 +18,7 @@ import de.intevation.lada.model.SStaat; /** - * This class produces a RESTful service to read the contents of s_staat table. + * This class produces a RESTful service to read SStaat objects. * * @author Raimund Renkert */ @@ -33,14 +33,18 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; /** - * Request all SUmwelt objects. + * Request all SStaat objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -57,10 +61,11 @@ } /** - * Request a SUmwelt object via its id. + * Request a SStaat object via its id. * - * @param id The SUmwelt id - * @return JSON Object via REST service. + * @param id The object id. + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id:[0-9][0-9]*}") diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SUmweltService.java --- a/src/main/java/de/intevation/lada/rest/SUmweltService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SUmweltService.java Wed Jul 03 11:55:28 2013 +0200 @@ -19,7 +19,7 @@ import de.intevation.lada.model.SUmwelt; /** - * This class produces a RESTful service to read the contents of s_umwelt table. + * This class produces a RESTful service to read SUmwelt objects. * * @author Raimund Renkert */ @@ -34,6 +34,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -47,6 +50,7 @@ /** * Request all SUmwelt objects. * + * @param headers The HTTP header containing authorization information. * @return JSON Object via Rest service */ @GET @@ -66,7 +70,8 @@ /** * Request a SUmwelt object via its id. * - * @param id The SUmwelt id + * @param id The object id. + * @param headers The HTTP header containing authorization information. * @return JSON Object via REST service. */ @GET diff -r 8f6242579a85 -r a305412206a3 src/main/java/de/intevation/lada/rest/SVerwaltungseinheitService.java --- a/src/main/java/de/intevation/lada/rest/SVerwaltungseinheitService.java Tue Jul 02 15:56:26 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/SVerwaltungseinheitService.java Wed Jul 03 11:55:28 2013 +0200 @@ -18,8 +18,7 @@ import de.intevation.lada.model.SVerwaltungseinheit; /** - * This class produces a RESTful service to read the contents of - * s_verwaltungseinheit table. + * This class produces a RESTful service to read SVerwaltungseinheit objects. * * @author Raimund Renkert */ @@ -34,6 +33,9 @@ @Named("readonlyrepository") private Repository repository; + /** + * The authorization module. + */ @Inject @Named("ldapauth") private Authentication authentication; @@ -41,7 +43,8 @@ /** * Request all SUmwelt objects. * - * @return JSON Object via Rest service + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Produces("text/json") @@ -60,8 +63,9 @@ /** * Request a SUmwelt object via its id. * - * @param id The SUmwelt id - * @return JSON Object via REST service. + * @param id The object id. + * @param headers The HTTP header containing authorization information. + * @return Response object. */ @GET @Path("/{id:[0-9][0-9]*}")