Menu

26 Nisan 2009 Pazar

Visa FacadeBean

@Stateless
public class VisaRequestFacadeBean implements VisaRequestFacadeRemote, VisaRequestFacadeLocal {
@PersistenceContext EntityManager em;
public void createVisaRequest(VisaRequests visaRequest) {
em.persist(visaRequest);
}


public List getVisaRequestsList() {
return em.createQuery("select object(o) from VisaRequests as o").getResultList();
}

public void createVisa(Visas visa) {
em.persist(visa);
}

public VisaRequests getOriginalRequest(String requestUUID) {
return (VisaRequests) em.createQuery("SELECT v FROM VisaRequests v WHERE v.uuid = :uuid").setParameter
("uuid", requestUUID).getSingleResult();
}

public void setVisa(String requestUUID, Visas visa) throws VisaExceptions { VisaRequests request = (VisaRequests)em.createQuery("SELECT v FROM VisaRequests v WHERE v.uuid = :uuid").setParameter
("uuid", requestUUID).getSingleResult();
request.setVisa(visa);
em.merge(request);
}

public void addDocumentToVisaRequest(Documents document ){
em.persist(document);
}

public PaymConfirmations getVisaPaymentConfirmation(String requestUUID){
return (PaymConfirmations) em.createQuery("SELECT v FROM VisaRequests v WHERE v.uuid = :uuid").setParameter
("uuid", requestUUID).getSingleResult();
}

public boolean isPaymentConfirmed(String requestUUID){

VisaRequests request = (VisaRequests)em.createQuery("SELECT v FROM VisaRequests v WHERE v.uuid = :uuid").setParameter ("uuid", requestUUID).getSingleResult();
// return reqeuest.getPaymentConfirmation() != null; return request.getPaymConfirmationsCollection() !=null;
}

public boolean setPaymentConfirmed(String requestUUID, PaymConfirmations paymantConfirmation){
VisaRequests request = (VisaRequests)em.createQuery("SELECT v FROM VisaRequests v WHERE v.uuid = :uuid").setParameter("uuid", requestUUID).getSingleResult();
request.setFkPaymentConfirmationUid(paymantConfirmation);
return true;
}
// public List lookupRequests(String requestUUID, IdentificationTemplate){}
}

1 Nisan 2009 Çarşamba

Login1