surfzera 17 de dez. de 2010
coloquei o metodo que chama a sua classe java aqui porfavor.
felipedamiani 17 de dez. de 2010
Este métoddo "ejb.AgendamentoRemote.cancelar " existe e está recebendo a mesma quantidade de parametro que vc está enviando do flex?
vitoryudi 17 de dez. de 2010
sim existe e está passando o mesmo número de parametros.
vou passar como eu estou passando e como recebe..
classe java Remote
package ejb ;
import java.rmi.RemoteException ;
import java.util.Date ;
import java.util.List ;
import java.util.Map ;
import javax.ejb.Remote ;
import jpa.Agendamento ;
@Remote
public interface AgendamentoRemote {
List < Agendamento > listaAgendamento ( Integer idProfissional , Date data , String condicao , List < Object > parametros ) throws RemoteException ;
List < Agendamento > listaAgendamento ( String condicao , List < Object > parametros ) throws RemoteException ;
List < Object > listaAgendaDisponivel ( Integer idProfissional , Date data ) throws RemoteException ;
String agendarAtendimentoSemAgenda ( Agendamento obj ) throws RemoteException ;
String agendar ( List < Agendamento > obj ) throws RemoteException ;
String cancelar ( Integer idAgendamento , String motivoCancelamento ) throws RemoteException ;
String confirmarConsulta ( Map < String , Object > dados ) throws RemoteException ;
Agendamento getAgendamento ( int idAgendamento ) throws RemoteException ;
String atualizarObservacao ( int idAgendamento , String observacao ) throws RemoteException ;
String pacienteChegou ( int idAgendamento ) throws RemoteException ;
String iniciarAtendimento ( int idAgendamento ) throws RemoteException ;
String iniciarCirurgia ( int idAgendamento ) throws RemoteException ;
String reabrirAtendimento ( int idAgendamento ) throws RemoteException ;
List < Agendamento > listaAgendamentoPaciente ( int idPaciente ) throws RemoteException ;
List < Agendamento > listaNaoComparecimentoPaciente ( int idPaciente ) throws RemoteException ;
List < Agendamento > listaConsultasRealizadasPaciente ( int idPaciente ) throws RemoteException ;
String transferirAgenda ( int idProfissionalOrigem , Date data , int idProfissionalDestino ) throws RemoteException ;
}
metodo flex que envia os parametros
private function cancelarSim ( event : CloseEvent ) : void {
if (event.detail == Alert.YES){
AgendamentoRO.cancelar( txtIdConsulta.text, txtMotivo.text) ;
}
}
<mx:RemoteObject id= "AgendamentoRO" showBusyCursor= "true" destination= "Agendamento" endpoint= "http://{Application.application.servidor}/{Application.application.nomeProjeto}/messagebroker/amf" >
<mx:method name= "cancelar" result= "onResultCancelar(event);" fault= "onFault(event);" />
</mx:RemoteObject>
vitoryudi 17 de dez. de 2010
public String cancelar ( Integer idAgendamento , String motivoCancelamento ) throws RemoteException {
try {
Agendamento obj = em .find ( Agendamento .class , idAgendamento ) ;
if ( obj .getIdHorariosConsecutivos () != null && obj .getIdHorariosConsecutivos () .trim () .length () > 0 ) {
Query q = em .createQuery ( "From Agendamento o Where (o.cancelado is null or o.cancelado <> ?) and idHorariosConsecutivos = ?" ) ;
q .setParameter ( 1 , "S" ) ;
q .setParameter ( 2 , obj .getIdHorariosConsecutivos () ) ;
List < Agendamento > agendamentos = ( List < Agendamento > ) q .getResultList () ;
for ( Agendamento a : agendamentos ) {
a .setCancelado ( "S" ) ;
a .setMotivoCancelamento ( motivoCancelamento ) ;
em .merge ( a ) ;
}
}else {
obj .setCancelado ( "S" ) ;
obj .setMotivoCancelamento ( motivoCancelamento ) ;
em .merge ( obj ) ;
}
}catch ( Exception e ) {
e .printStackTrace () ;
return e .getMessage () ;
}
return "" ;
}
public String cancelar ( int idAgendamento , String motivoCancelamento ) {
try {
AgendamentoRemote agendamentoRemote = ( AgendamentoRemote ) ctx .lookup ( "AgendamentoBean/remote" ) ;
return agendamentoRemote .cancelar ( idAgendamento , motivoCancelamento ) ;
}catch ( Exception e ) {
e .printStackTrace () ;
return e .getMessage () ;
}
}
vitoryudi 20 de dez. de 2010