Rev 760 |
Blame |
Compare with Previous |
Last modification |
View Log
| Download
| RSS feed
package br.com.sl.controller;
import java.io.Serializable;
import javax.inject.Inject;
import javax.inject.Named;
import org.springframework.context.annotation.Scope;
import br.com.ec.core.generic.GenericService;
import br.com.ec.web.exception.VerificadorLancamentoException;
import br.com.ec.web.exception.VerificadorLancamentoException.CommandBean;
import br.com.ec.web.generic.AbstractBean;
import br.com.ec.web.message.LancadorMensagem;
import br.com.sl.domain.dto.RoboDTO;
import br.com.sl.domain.service.RoboColetorService;
@Named
@Scope
("view")
public class ColetorDadosBean
extends AbstractBean
<RoboDTO
> implements Serializable {
private RoboColetorService roboColetorService
;
@Inject
public ColetorDadosBean
(RoboColetorService roboColetorService
) {
this.
roboColetorService = roboColetorService
;
}
@
Override
public void preCarregamento
() {
limparEntidade
();
getEntidade
().
setRodando(roboColetorService.
isRodando());
}
@
Override
public void limparEntidade
() {
setEntidade
(new RoboDTO
());
}
@
Override
public GenericService
<RoboDTO
> getService
() {
return roboColetorService
;
}
@
Override
public RoboDTO getEntidade
() {
return entidade
;
}
@
Override
public RoboDTO getId
() {
return getEntidade
();
}
public void iniciar
() {
new VerificadorLancamentoException
().
tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean
() {
public void execute
() {
roboColetorService.
iniciarColetor1Minuto();
setEntidade
(roboColetorService.
statusRobo());
LancadorMensagem.
lancarSucesso("COLETOR INICIADO COM SUCESSO!");
}
});
}
public void parar
() {
new VerificadorLancamentoException
().
tratarIhRelancarExcecaoSemLimparEntidade(new CommandBean
() {
public void execute
() {
roboColetorService.
pararColetor();
setEntidade
(roboColetorService.
statusRobo());
LancadorMensagem.
lancarSucesso("COLETOR PARADO COM SUCESSO!");
}
});
}
public void atualizarStatus
() {
setEntidade
(roboColetorService.
statusRobo());
}
}