Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.ProfessionRemote


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


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

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

                Profession profession = professionsToUpload.next();
                ProfessionWs professionWs = this.toRemoteEntity.generateRemoteProfessionRemote(profession);
                if (professionWs != null) {
                    int remoteId = this.systoleSync.uploadProfession(professionWs);
                    if (remoteId > 0) {
                        ProfessionRemote professionRemote = new ProfessionRemote(profession);
                        professionRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getProfessionSyncBroker().saveProfessionRemote(professionRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here

     */
    private Integer convertToRemoteProfession(Profession profession) throws ExceptionDAO {
        if (profession == null) {
            return null;
        }
        ProfessionRemote professionRemote = FacadeDB.getInstance().getProfessionSyncBroker().getProfessionRemoteByProfession(profession);

        return professionRemote != null ? professionRemote.getRemoteId() : null;

    }
View Full Code Here

        if (profession == null) {
            profession = new Profession();
            profession.setName(professionWs.getName());
            profession.setDescription(professionWs.getDescription());
            FacadeDB.getInstance().getProfessionBroker().insert(profession);
            ProfessionRemote professionRemote = new ProfessionRemote(profession);
            professionRemote.setRemoteId(professionWs.getId());
            FacadeDB.getInstance().getProfessionSyncBroker().saveProfessionRemote(professionRemote);
        } else {
            if (FacadeDB.getInstance().getProfessionSyncBroker().getProfessionRemoteByProfession(profession) == null) {
                ProfessionRemote professionRemote = new ProfessionRemote(profession);
                professionRemote.setRemoteId(professionWs.getId());
                FacadeDB.getInstance().getProfessionSyncBroker().saveProfessionRemote(professionRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

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

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.