Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.FamilyRemote


                Family family = familyToUpload.next();
                FamilyWs familyWs = this.toRemoteEntity.generateRemoteFamily(family);
                if (familyWs != null) {
                    int remoteId = this.systoleSync.uploadFamily(familyWs);
                    if (remoteId > 0) {
                        FamilyRemote familyRemote = new FamilyRemote(family);
                        familyRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getFamilySyncBroker().saveFamilyRemote(familyRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here


        try {
            this.logger.logDebug("getting family to upload");
            Session currentSession = FacadeDB.getInstance().getCurrentSession();
            Criteria criteria = currentSession.createCriteria(
                    FamilyRemote.class).add(Restrictions.eq("remoteId", remoteId)).setMaxResults(1);
            FamilyRemote familyRemote = (FamilyRemote) criteria.uniqueResult();
            this.logger.logDebug("get successfully");
            return (familyRemote != null ? familyRemote.getFamily() : null);
        } catch (HibernateException e) {
            this.logger.logError("error on get las remote family synchronized, msg: " + e.getMessage());
            throw new ExceptionDAO("No se pudieron obtener los familiares", e.fillInStackTrace());
        }
    }
View Full Code Here

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

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

    private PatientFamilyWs convertToRemoteFamilyPatient(FamilyPatientBackground background) throws ExceptionDAO {
        if (background == null) {
            return null;
        }

        FamilyRemote familyRemote = FacadeDB.getInstance().getFamilySyncBroker().getFamilyRemoteByFamily(background.getFamily());
        if (familyRemote == null) {
            return null;
        }
        PatientFamilyWs familyWs = new PatientFamilyWs();
        familyWs.setFamilyId(familyRemote.getRemoteId());
        familyWs.setBackgroundCardiac(background.getBackgroundCardiac() != null ? background.getBackgroundCardiac() : false);
        familyWs.setBackgroundCholesterol(background.getBackgroundCholesterol() != null ? background.getBackgroundCholesterol() : false);
        familyWs.setBackgroundDiabetic(background.getBackgroundDiabetic() != null ? background.getBackgroundDiabetic() : false);
        familyWs.setBackgroundHypertension(background.getBackgroundHypertension() != null ? background.getBackgroundHypertension() : false);
        return familyWs;
View Full Code Here

        if (family == null) {
            family = new Family();
            family.setName(familyWs.getName());
            family.setSex(familyWs.isSex() ? "M" : "F");
            FacadeDB.getInstance().getFamilyBroker().insert(family);
            FamilyRemote familyRemote = new FamilyRemote(family);
            familyRemote.setRemoteId(familyWs.getId());
            FacadeDB.getInstance().getFamilySyncBroker().saveFamilyRemote(familyRemote);
        } else {
            if (FacadeDB.getInstance().getFamilySyncBroker().getFamilyRemoteByFamily(family) == null) {
                FamilyRemote familyRemote = new FamilyRemote(family);
                familyRemote.setRemoteId(familyWs.getId());
                FacadeDB.getInstance().getFamilySyncBroker().saveFamilyRemote(familyRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

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

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.