Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.SportRemote


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


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

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

                Sport sport = sportsToUpload.next();
                SportWs sportWs = this.toRemoteEntity.generateRemoteSport(sport);
                if (sportWs != null) {
                    int remoteId = this.systoleSync.uploadSport(sportWs);
                    if (remoteId > 0) {
                        SportRemote sportRemote = new SportRemote(sport);
                        sportRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getSportSyncBroker().saveSportRemote(sportRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here

    private PatientSportWs convertToRemoteSportPatient(SportPatient sportPatient) throws ExceptionDAO {
        if (sportPatient == null) {
            return null;
        }

        SportRemote sportRemote = FacadeDB.getInstance().getSportSyncBroker().getSportRemoteFromSport(sportPatient.getSport());
        if (sportRemote == null) {
            return null;
        }
        PatientSportWs patientSportWs = new PatientSportWs();
        patientSportWs.setAgeAtStart(sportPatient.getAgeAtStartAsInteger() > 0 ? sportPatient.getPatient().getAge() - sportPatient.getAgeAtStartAsInteger() : 0);
        patientSportWs.setHoursXWeek(sportPatient.getHoursXWeek() != null ? sportPatient.getHoursXWeek() : 0);
        patientSportWs.setSportId(sportRemote.getRemoteId());
        return patientSportWs;
    }
View Full Code Here

        if (sport == null) {
            sport = new Sport();
            sport.setName(sportWs.getName());
            sport.setDescription(sportWs.getDescription());
            FacadeDB.getInstance().getSportBroker().insert(sport);
            SportRemote sportRemote = new SportRemote(sport);
            sportRemote.setRemoteId(sportWs.getId());
            FacadeDB.getInstance().getSportSyncBroker().saveSportRemote(sportRemote);
        } else {
            if (FacadeDB.getInstance().getSportSyncBroker().getSportRemoteFromSport(sport) == null) {
                SportRemote sportRemote = new SportRemote(sport);
                sportRemote.setRemoteId(sportWs.getId());
                FacadeDB.getInstance().getSportSyncBroker().saveSportRemote(sportRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

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

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.