Ignore:
Timestamp:
12/19/13 14:36:04 (10 years ago)
Author:
olhsha
Message:

adding trasnactional, refactoring and fixing bugs in updated annotations, removing try-catch from resource methods (The Greek's advice)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/UserResource.java

    r4010 r4207  
    2323import eu.dasish.annotation.schema.ObjectFactory;
    2424import eu.dasish.annotation.schema.User;
     25import java.io.IOException;
    2526import java.sql.SQLException;
    2627import java.util.UUID;
     
    3839import javax.ws.rs.core.UriInfo;
    3940import javax.xml.bind.JAXBElement;
     41import javax.xml.parsers.ParserConfigurationException;
    4042import org.springframework.beans.factory.annotation.Autowired;
    4143import org.springframework.security.access.annotation.Secured;
    4244import org.springframework.stereotype.Component;
     45import org.springframework.transaction.annotation.Transactional;
    4346
    4447/**
     
    4851@Component
    4952@Path("/users")
     53@Transactional(rollbackFor={Exception.class, SQLException.class, IOException.class, ParserConfigurationException.class})
    5054public class UserResource {
    5155    @Autowired
     
    6670    @Produces(MediaType.TEXT_XML)
    6771    @Path("{userid: " + BackendConstants.regExpIdentifier + "}")
    68     @Secured("ROLE_USER")
     72    @Secured("ROLE_USER")   
     73    @Transactional(readOnly=true)
    6974    public JAXBElement<User> getUser(@PathParam("userid") String ExternalIdentifier) throws SQLException {
    7075         dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString());
     
    7782    @Produces(MediaType.TEXT_XML)
    7883    @Path("/info")
    79     @Secured("ROLE_USER")
     84    @Secured("ROLE_USER")   
     85    @Transactional(readOnly=true)
    8086    public JAXBElement<User> getUserByInfo(@QueryParam("email") String email) throws SQLException {
    8187        dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString());
     
    8793    @Produces(MediaType.TEXT_XML)
    8894    @Path("{userid: " + BackendConstants.regExpIdentifier + "}/current")
    89     @Secured("ROLE_USER")
     95    @Secured("ROLE_USER")   
     96    @Transactional(readOnly=true)
    9097    public JAXBElement<CurrentUserInfo> getCurrentUserInfo(@PathParam("userid") String ExternalIdentifier){
    9198        dbIntegrityService.setServiceURI(uriInfo.getBaseUri().toString());
Note: See TracChangeset for help on using the changeset viewer.