br.com.anteros.commons.services.rest.resource.v1.SecuritySessionResource Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Anteros-Services-RestSQL Show documentation
Show all versions of Anteros-Services-RestSQL Show documentation
Anteros Services REST SQL for Java.
package br.com.anteros.commons.services.rest.resource.v1;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.HttpStatus;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import br.com.anteros.commons.services.rest.service.SecuritySessionService;
import br.com.anteros.persistence.session.repository.Page;
import br.com.anteros.persistence.session.repository.PageRequest;
import br.com.anteros.persistence.session.repository.Pageable;
import br.com.anteros.persistence.session.repository.impl.PageImpl;
import br.com.anteros.persistence.session.service.SQLService;
import br.com.anteros.security.spring.AnterosSecurityManager;
import br.com.anteros.security.store.sql.domain.SecuritySession;
import br.com.anteros.spring.web.resource.AbstractSQLResourceRest;
/**
* Generated by Anteros Generator Maven Plugin at 29/12/2019 08:16:42
**/
@RestController
@RequestMapping(value = "/v1/securitySession")
public class SecuritySessionResource extends AbstractSQLResourceRest {
@Autowired
@Lazy
private SecuritySessionService securitySessionService;
@Autowired
@Lazy
protected AnterosSecurityManager anterosSecurityManager;
@Override
public SQLService getService() {
return securitySessionService;
}
@Override
protected Page createConcretePage(List content, PageRequest pageRequest,
long totalElements) {
return new PageSecuritySession(content, pageRequest, totalElements);
}
class PageSecuritySession extends PageImpl {
public PageSecuritySession(List content) {
super(content);
}
public PageSecuritySession(List content, Pageable pageable, long total) {
super(content, pageable, total);
}
}
@Override
protected List createConcreteList(List result) {
return new ListSecuritySession(result);
}
class ListSecuritySession extends ArrayList{
public ListSecuritySession(Collection extends SecuritySession> c) {
super(c);
}
}
/**
* Busca as sessões de um sistema
*
* @param system
* Sistema
* @return Lista de sessões
* @throws Exception
*/
@RequestMapping(value = "/getSessionsBySystem/{system}", method = RequestMethod.GET)
@ResponseStatus(HttpStatus.OK)
@ResponseBody
@Transactional(rollbackFor = Throwable.class, propagation = Propagation.REQUIRED, readOnly = true, transactionManager="transactionManagerSQL")
public List getSessionsBySystem(@PathVariable(value = "system") String system) throws Exception {
return securitySessionService.getSessionsBySystem(system);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy