Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.SurgeryRemote


        try {
            this.logger.logDebug("getting surgery by remote id");
            Session currentSession = FacadeDB.getInstance().getCurrentSession();
            Criteria criteria = currentSession.createCriteria(
                    SurgeryRemote.class).add(Restrictions.eq("remoteId", remoteId)).setMaxResults(1);
            SurgeryRemote surgeryRemote = (SurgeryRemote) criteria.uniqueResult();
            this.logger.logDebug("get successfully");
            return (surgeryRemote != null ? surgeryRemote.getSurgery() : null);
        } catch (HibernateException e) {
            this.logger.logError("error on get surgery by remote id, msg: " + e.getMessage());
            throw new ExceptionDAO("No se pudieron obtener las cirugias", e.fillInStackTrace());
        }
    }
View Full Code Here


        try {
            this.logger.logDebug("getting surgery remote by local surgery");
            Session currentSession = FacadeDB.getInstance().getCurrentSession();
            Criteria criteria = currentSession.createCriteria(
                    SurgeryRemote.class).add(Restrictions.eq("surgery", surgery)).setMaxResults(1);
            SurgeryRemote surgeryRemotes = (SurgeryRemote) criteria.uniqueResult();
            this.logger.logDebug("get successfully");
            return surgeryRemotes;
        } catch (HibernateException e) {
            this.logger.logError("error on get remote surgery by surgery, msg: " + e.getMessage());
            throw new ExceptionDAO("No se pudieron obtener las cirugias", e.fillInStackTrace());
View Full Code Here

        try {
            this.logger.logDebug("getting last remote surgery sync");
            Session currentSession = FacadeDB.getInstance().getCurrentSession();
            Criteria criteria = currentSession.createCriteria(
                    SurgeryRemote.class).addOrder(Order.desc("remoteId")).setMaxResults(1);
            SurgeryRemote surgeryRemote = (SurgeryRemote) criteria.uniqueResult();
            this.logger.logDebug("get successfully");
            return (surgeryRemote != null ? surgeryRemote.getRemoteId() : -1);
        } catch (HibernateException e) {
            this.logger.logError("error on get last remote surgery synchronized, msg: " + e.getMessage());
            throw new ExceptionDAO("No se pudieron obtener las cirugias", e.fillInStackTrace());
        }
    }
View Full Code Here

     */
    private PatientSurgeryWs convertToRemoteSurgeryPatient(SurgeryPatient surgeryPatient) throws ExceptionDAO {
        if (surgeryPatient == null) {
            return null;
        }
        SurgeryRemote surgeryRemote = FacadeDB.getInstance().getSurgerySyncBroker().getSurgeryRemoteBySurgery(surgeryPatient.getSurgery());
        if (surgeryRemote == null) {
            return null;
        }
        PatientSurgeryWs patientSurgeryWs = new PatientSurgeryWs();
        patientSurgeryWs.setSurgeryId(surgeryRemote.getRemoteId());
        patientSurgeryWs.setAgeAtSurgery(surgeryPatient.getAgeAtSurgery() != null ? surgeryPatient.getAgeAtSurgery() : 0);
        return patientSurgeryWs;
    }
View Full Code Here

                Surgery surgery = surgeriesToUpload.next();
                SurgeryWs surgeryWs = this.toRemoteEntity.generateRemoteSurgery(surgery);
                if (surgeryWs != null) {
                    int remoteId = this.systoleSync.uploadSurgery(surgeryWs);
                    if (remoteId > 0) {
                        SurgeryRemote surgeryRemote = new SurgeryRemote(surgery);
                        surgeryRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getSurgerySyncBroker().saveSurgeryRemote(surgeryRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here

        if (surgery == null) {
            surgery = new Surgery();
            surgery.setName(surgeryWs.getName());
            surgery.setDescription(surgeryWs.getDescription());
            FacadeDB.getInstance().getSurgeryBroker().insert(surgery);
            SurgeryRemote surgeryRemote = new SurgeryRemote(surgery);
            surgeryRemote.setRemoteId(surgeryWs.getId());
            FacadeDB.getInstance().getSurgerySyncBroker().saveSurgeryRemote(surgeryRemote);
        } else {
            if (FacadeDB.getInstance().getSurgerySyncBroker().getSurgeryRemoteBySurgery(surgery) == null) {
                SurgeryRemote surgeryRemote = new SurgeryRemote(surgery);
                surgeryRemote.setRemoteId(surgeryWs.getId());
                FacadeDB.getInstance().getSurgerySyncBroker().saveSurgeryRemote(surgeryRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

Related Classes of systole.synchronization.remote.entities.SurgeryRemote

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.