Package systole.synchronization.remote.entities

Examples of systole.synchronization.remote.entities.IdentityCardTypeRemote


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


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

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

                IdentityCardType cardType = cardTypesToUpload.next();
                IdentityCardTypeWs cardTypeWs = this.toRemoteEntity.generateRemoteIdentityCard(cardType);
                if (cardTypeWs != null) {
                    int remoteId = this.systoleSync.uploadIdentityCardType(cardTypeWs);
                    if (remoteId > 0) {
                        IdentityCardTypeRemote cardTypeRemote = new IdentityCardTypeRemote(cardType);
                        cardTypeRemote.setRemoteId(remoteId);
                        FacadeDB.getInstance().startTransaction();
                        FacadeDB.getInstance().getIdentityCardTypeSyncBroker().saveIdentityCardTypeRemote(cardTypeRemote);
                        FacadeDB.getInstance().commitTransaction();
                    }
                }
View Full Code Here

     */
    private IdentityCardWs convertToRemoteIdentityCard(IdentityCard identityCard) throws ExceptionDAO {
        if (identityCard == null) {
            return null;
        }
        IdentityCardTypeRemote cardTypeRemote = FacadeDB.getInstance().getIdentityCardTypeSyncBroker().getIdentityCardTypeRemoteFromCardType(identityCard.getCardType());

        if (cardTypeRemote == null) {
            return null;
        }

        IdentityCardWs cardWs = new IdentityCardWs();
        cardWs.setTypeId(cardTypeRemote.getRemoteId());
        cardWs.setNumber(identityCard.getNumber() != null ? identityCard.getNumber() : 0);
        return cardWs;
    }
View Full Code Here

        IdentityCardType cardType = FacadeDB.getInstance().getIdentityCardBroker().getIdentityCardTypeByName(cardTypeWs.getName());
        if (cardType == null) {
            cardType = new IdentityCardType();
            cardType.setDescription(cardTypeWs.getName());
            FacadeDB.getInstance().getIdentityCardBroker().save(cardType);
            IdentityCardTypeRemote cardTypeRemote = new IdentityCardTypeRemote(cardType);
            cardTypeRemote.setRemoteId(cardTypeWs.getId());
            FacadeDB.getInstance().getIdentityCardTypeSyncBroker().saveIdentityCardTypeRemote(cardTypeRemote);
        } else {
            if (FacadeDB.getInstance().getIdentityCardTypeSyncBroker().getIdentityCardTypeRemoteFromCardType(cardType) == null) {
                IdentityCardTypeRemote cardTypeRemote = new IdentityCardTypeRemote(cardType);
                cardTypeRemote.setRemoteId(cardTypeWs.getId());
                FacadeDB.getInstance().getIdentityCardTypeSyncBroker().saveIdentityCardTypeRemote(cardTypeRemote);
            }
        }
        FacadeDB.getInstance().commitTransaction();
    }
View Full Code Here

TOP

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

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.