Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.PathologyRemote


                Pathology pathology = pathologiesToUpload.next();
                PathologyWs pathologyWs = this.toRemoteEntity.generateRemotePathology(pathology);
                if (pathologyWs != null) {
                    int remoteId = this.systoleSync.uploadPathology(pathologyWs);
                    if (remoteId > 0) {
                        PathologyRemote pathologyRemote = new PathologyRemote(pathology);
                        pathologyRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getPathologySyncBroker().savePathologyRemote(pathologyRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here


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

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

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

    private PatientPathologyWs convertToRemotePathologyPatient(PathologyPatient pathologyPatient) throws ExceptionDAO {
        if (pathologyPatient == null) {
            return null;
        }

        PathologyRemote pathologyRemote = FacadeDB.getInstance().getPathologySyncBroker().getPathologyRemoteByPathology(pathologyPatient.getPathology());
        if (pathologyRemote == null) {
            return null;
        }
        PatientPathologyWs patientPathologyWs = new PatientPathologyWs();
        patientPathologyWs.setPathologyId(pathologyRemote.getRemoteId());
        patientPathologyWs.setAgeAtStart(pathologyPatient.getAgeAtStartAsInteger() > 0 ? pathologyPatient.getPatient().getAge() - pathologyPatient.getAgeAtStartAsInteger() : 0);
        patientPathologyWs.setCurrently(pathologyPatient.getCurrently() != null ? pathologyPatient.getCurrently() : false);
        patientPathologyWs.setInherited(pathologyPatient.getInherited() != null ? pathologyPatient.getInherited() : false);
        return patientPathologyWs;
    }
View Full Code Here

            pathology = new Pathology();
            pathology.setName(pathologyWs.getName());
            pathology.setDescription(pathologyWs.getDescription());
            pathology.setInitials(pathologyWs.getInitials());
            FacadeDB.getInstance().getPathologyBroker().insert(pathology);
            PathologyRemote pathologyRemote = new PathologyRemote(pathology);
            pathologyRemote.setRemoteId(pathologyWs.getId());
            FacadeDB.getInstance().getPathologySyncBroker().savePathologyRemote(pathologyRemote);
        } else {
            if (FacadeDB.getInstance().getPathologySyncBroker().getPathologyRemoteByPathology(pathology) == null) {
                PathologyRemote pathologyRemote = new PathologyRemote(pathology);
                pathologyRemote.setRemoteId(pathologyWs.getId());
                FacadeDB.getInstance().getPathologySyncBroker().savePathologyRemote(pathologyRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

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

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.