Example usage for java.lang Long equals

List of usage examples for java.lang Long equals

Introduction

In this page you can find the example usage for java.lang Long equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Compares this object to the specified object.

Usage

From source file:com.cloud.template.TemplateManagerImpl.java

@Override
@ActionEvent(eventType = EventTypes.EVENT_TEMPLATE_COPY, eventDescription = "copying template", async = true)
public VirtualMachineTemplate copyTemplate(CopyTemplateCmd cmd)
        throws StorageUnavailableException, ResourceAllocationException {
    Long templateId = cmd.getId();
    Long userId = CallContext.current().getCallingUserId();
    Long sourceZoneId = cmd.getSourceZoneId();
    Long destZoneId = cmd.getDestinationZoneId();
    Account caller = CallContext.current().getCallingAccount();

    // Verify parameters
    VMTemplateVO template = _tmpltDao.findById(templateId);
    if (template == null || template.getRemoved() != null) {
        throw new InvalidParameterValueException("Unable to find template with id");
    }//from  w w  w  .  ja va  2 s  . c  o m

    DataStore srcSecStore = null;
    if (sourceZoneId != null) {
        // template is on zone-wide secondary storage
        srcSecStore = getImageStore(sourceZoneId, templateId);
    } else {
        // template is on region store
        srcSecStore = getImageStore(templateId);
    }

    if (srcSecStore == null) {
        throw new InvalidParameterValueException(
                "There is no template " + templateId + " ready on image store.");
    }

    if (template.isCrossZones()) {
        // sync template from cache store to region store if it is not there, for cases where we are going to migrate existing NFS to S3.
        _tmpltSvr.syncTemplateToRegionStore(templateId, srcSecStore);
        s_logger.debug("Template " + templateId + " is cross-zone, don't need to copy");
        return template;
    }

    if (sourceZoneId != null) {
        if (sourceZoneId.equals(destZoneId)) {
            throw new InvalidParameterValueException("Please specify different source and destination zones.");
        }

        DataCenterVO sourceZone = _dcDao.findById(sourceZoneId);
        if (sourceZone == null) {
            throw new InvalidParameterValueException("Please specify a valid source zone.");
        }
    }

    DataCenterVO dstZone = _dcDao.findById(destZoneId);
    if (dstZone == null) {
        throw new InvalidParameterValueException("Please specify a valid destination zone.");
    }

    DataStore dstSecStore = getImageStore(destZoneId, templateId);
    if (dstSecStore != null) {
        s_logger.debug("There is template " + templateId + " in secondary storage " + dstSecStore.getName()
                + " in zone " + destZoneId + " , don't need to copy");
        return template;
    }

    _accountMgr.checkAccess(caller, AccessType.OperateEntry, true, template);

    boolean success = copy(userId, template, srcSecStore, dstZone);

    if (success) {
        // increase resource count
        long accountId = template.getAccountId();
        if (template.getSize() != null) {
            _resourceLimitMgr.incrementResourceCount(accountId, ResourceType.secondary_storage,
                    template.getSize());
        }
        return template;
    } else {
        throw new CloudRuntimeException("Failed to copy template");
    }
}

From source file:com.clustercontrol.jobmanagement.session.JobControllerBean.java

/**
 * ??<BR>//from  w  ww .j  av  a 2 s. c  o  m
 *
 * @param jobunitId
 * @param updateTime
 * @param forceFlag
 * @return
 * @throws HinemosUnknown
 * @throws OtherUserGetLock
 * @throws JobInvalid
 * @throws JobMasterNotFound
 * @throws InvalidRole
 */
public Integer getEditLock(String jobunitId, Long updateTime, boolean forceFlag, String userName,
        String ipAddress) throws HinemosUnknown, OtherUserGetLock, UpdateTimeNotLatest, JobMasterNotFound,
        JobInvalid, InvalidRole {
    JobEditEntity entity = null;
    JpaTransactionManager jtm = new JpaTransactionManager();
    Integer editSession = null;

    try {
        jtm.begin();
        HinemosEntityManager em = jtm.getEntityManager();

        // ???
        List<String> jobunitIdList = new ArrayList<String>();
        jobunitIdList.add(jobunitId);
        Long mstUpdateTime = null;

        if (getUpdateDateFromJobMstList(jobunitIdList).size() > 0) {
            mstUpdateTime = getUpdateDateFromJobMstList(jobunitIdList).get(0);
        }

        if (mstUpdateTime != null && !mstUpdateTime.equals(updateTime)) {
            // ????
            m_log.warn("getEditLock() : update time is not latest, jobunitId=" + jobunitId + ", manager="
                    + mstUpdateTime + ", client=" + updateTime);
            String mstUpdateTimeStr = null;
            mstUpdateTimeStr = new Timestamp(mstUpdateTime).toString();

            String updateTimeStr = null;
            if (updateTime != null) {
                updateTimeStr = new Timestamp(updateTime).toString();
            }
            throw new UpdateTimeNotLatest(MessageConstant.MESSAGE_JOBTREE_OLD
                    .getMessage(new String[] { mstUpdateTimeStr, updateTimeStr }));
        } else if (mstUpdateTime == null && updateTime != null) {
            // ?????????
            m_log.warn("getEditLock() : update time is not latest, jobunitId=" + jobunitId
                    + ", manager=null, client=" + updateTime);
            throw new UpdateTimeNotLatest(
                    MessageConstant.MESSAGE_JOBTREE_OLD_JOBUNIT_ALREADY_DELETE.getMessage());
        }

        // ??????????
        entity = em.find(JobEditEntity.class, jobunitId, ObjectPrivilegeMode.READ);
        if (entity == null) {
            // ???
            entity = new JobEditEntity(jobunitId);
        }

        if (entity.getEditSession() != null) {
            // ??????
            m_log.debug("getEditLock() : other user gets EditLock, jobunitId=" + jobunitId + ", username="
                    + entity.getLockUser() + ", ipaddr=" + entity.getLockIpAddress());

            if (forceFlag) {
                // ????
                m_log.debug("getEditLock() : get EditLock forcely, jobunitId=" + jobunitId);
            } else {
                // ?????????
                String message = MessageConstant.MESSAGE_JOBUNITS_LOCK_OTHER_PEOPLE_GET
                        .getMessage(new String[] { jobunitId, entity.getLockUser(), entity.getLockIpAddress() })
                        + "\n" + MessageConstant.MESSAGE_WANT_TO_GET_LOCK.getMessage();
                OtherUserGetLock e = new OtherUserGetLock(message);
                m_log.info("getEditLock() : " + e.getClass().getSimpleName() + ", " + e.getMessage());
                throw e;
            }
        }

        // ??
        entity.setLockIpAddress(ipAddress);
        entity.setLockUser(userName);
        editSession = random.nextInt();
        entity.setEditSession(editSession);
        m_log.info("getEditLock() : get edit lock(jobunitid=" + jobunitId + ", user=" + userName
                + ", ipAddress=" + ipAddress + ", editSession=" + editSession + ")");

        jtm.commit();
    } catch (OtherUserGetLock | UpdateTimeNotLatest e) {
        jtm.rollback();
        throw e;
    } catch (ObjectPrivilege_InvalidRole e) {
        jtm.rollback();
        throw new InvalidRole(e.getMessage(), e);
    } catch (Exception e) {
        m_log.warn("getEditLock() : " + e.getClass().getSimpleName() + ", " + e.getMessage(), e);
        jtm.rollback();
        throw new HinemosUnknown(e.getMessage(), e);
    } finally {
        jtm.close();
    }
    return editSession;
}

From source file:com.square.core.service.implementations.PersonneServiceImplementation.java

@Override
public AdresseCreationDto ajouterNouvelleAdresse(Long idPersonne, AdresseDto adresseDto,
        Boolean impacterFamille) {
    final RapportDto rapport = new RapportDto();
    if (adresseDto == null) {
        throw new BusinessException(
                messageSourceUtil.get(PersonnePhysiqueKeyUtil.MESSAGE_ERREUR_ADRESSE_DTO_NULL));
    }/*from   w  w w. j  av  a  2 s .co  m*/
    // Rcupration de la personne en base.
    final Personne personnePrincipale = personneDao.rechercherPersonneParId(idPersonne);
    if (personnePrincipale == null) {
        throw new BusinessException(
                messageSourceUtil.get(PersonnePhysiqueKeyUtil.MESSAGE_ERREUR_PERSONNE_INEXISTANTE));
    }
    // Recherche de l'adresse principale actuelle
    final AdresseCriteresRechercheDto criteresRechercheAdressePrincipale = new AdresseCriteresRechercheDto();
    criteresRechercheAdressePrincipale.setIdPersonne(personnePrincipale.getId());
    criteresRechercheAdressePrincipale.setIdNature(squareMappingService.getIdNatureAdressePrincipale());
    criteresRechercheAdressePrincipale.setActive(true);
    final List<Adresse> listAdressesPrincipales = adresseDao
            .rechercherAdresseParCritere(criteresRechercheAdressePrincipale);
    Adresse adressePrincipaleEnCours = new Adresse();
    boolean plusQueAdressePrincipale = false;
    boolean choixPasserEnSecondaire = false;
    if (listAdressesPrincipales != null && listAdressesPrincipales.size() > 0) {
        adressePrincipaleEnCours = listAdressesPrincipales.get(0);
    }
    final Long idNatureAdressePrincipale = squareMappingService.getIdNatureAdressePrincipale();
    final Long idNatureAdresseSecondaire = squareMappingService.getIdNatureAdresseSecondaire();
    final AdresseNature natureAdressePrincipale = adresseNatureDao
            .rechercheAdresseNatureParId(idNatureAdressePrincipale);
    final AdresseNature natureAdresseSecondaire = adresseNatureDao
            .rechercheAdresseNatureParId(idNatureAdresseSecondaire);
    // Si l'adresse  ajouter est une adresse principale et est diffrente de l'adresse principale actuelle
    if (adresseDto.getNature() != null
            && adresseDto.getNature().getIdentifiant().equals(idNatureAdressePrincipale)
            && adressePrincipaleEnCours.getId() != null
            && !adressePrincipaleEnCours.getId().equals(adresseDto.getIdentifiant())) {
        // Est ce que l'adresse  ajouter doit remplacer l'adresse principale actuelle?
        choixPasserEnSecondaire = BooleanUtils.isTrue(adresseDto.getChoixPasserEnSecondaire());
        plusQueAdressePrincipale = true;
    }
    // Si aucune date de dbut n'est renseigne pour l'adresse
    if (adresseDto.getDateDebut() == null) {
        // On initialise la date de dbut de l'adresse  la date courante
        adresseDto.setDateDebut(Calendar.getInstance());
    }
    // Vrification des champs obligatoires de l'adresse  ajouter
    controlerAdresse(rapport, adresseDto, 0);
    if (Boolean.TRUE.equals(rapport.getEnErreur())) {
        RapportUtil.logRapport(rapport, logger);
        throw new ControleIntegriteException(rapport);
    }
    // On recherche les membres de la famille de la personne
    final Set<Personne> famille = getFamille(personnePrincipale);
    // Si le flag qui indique si l'on doit ajouter la nouvelle adresse aux bnficiaires n'est pas spcifi
    // Si la personne a une famille, on lve une exception car le flag impacterBeneficiaires doit tre renseign
    // pour dterminer si il faut ajouter l'adresse aux membres de la famille de la personne
    if (impacterFamille == null && famille.size() > 0) {
        throw new ConfirmationImpacterFamilleException(
                messageSourceUtil.get(PersonnePhysiqueKeyUtil.CONFIRMATION_IMPACTER_FAMILLE,
                        new String[] { String.valueOf(famille.size()) }));
    }
    final AdresseCreationDto adresseCree = new AdresseCreationDto();
    final Set<Personne> personnes = new LinkedHashSet<Personne>();
    personnes.add(personnePrincipale);
    if (BooleanUtils.isTrue(impacterFamille)) {
        // On ajoute la famille
        personnes.addAll(famille);
    }
    adresseCree.setIdAdressesModifiees(new ArrayList<Long>());
    final Adresse adresse = creerOuMettreAJourAdresse(personnes, adresseDto, impacterFamille);
    if (adresseDto.getIdentifiant() == null) {
        adresseCree.setIdAdresseCree(adresse.getId());
    }
    // si le rapport n'est pas en erreur, on met  jour l'adresse principale
    if (plusQueAdressePrincipale) {
        if (choixPasserEnSecondaire) {
            // On passe l'adresse principale actuelle en adresse secondaire
            adressePrincipaleEnCours.setNature(natureAdresseSecondaire);
        } else {
            // On remplace l'adresse principale actuelle par l'adresse  ajouter
            // On met donc fin  l'adresse principale actuelle en spcifiant la date de fin  J-1 de la date de dbut de la nouvelle adresse
            final Calendar dateFinAdressePrincipale = adresseDto.getDateDebut();
            dateFinAdressePrincipale.add(Calendar.DAY_OF_MONTH, -1);
            adressePrincipaleEnCours.setDateFin(dateFinAdressePrincipale);
            // Si la date de fin de l'action principal est inferieur  la date de debut
            if (adressePrincipaleEnCours.getDateFin().compareTo(adressePrincipaleEnCours.getDateDebut()) < 0
                    && dateFinAdressePrincipale.get(Calendar.DAY_OF_MONTH) < adressePrincipaleEnCours
                            .getDateDebut().get(Calendar.DAY_OF_MONTH)) {
                adressePrincipaleEnCours.getDateFin().add(Calendar.DAY_OF_MONTH, +1);
            }
        }
        adresseCree.getIdAdressesModifiees().add(adressePrincipaleEnCours.getId());
    }

    /*
     * // Un contact devra avoir au moins une adresse principal criteresRechercheAdressePrincipale = new AdresseCriteresRechercheDto();
     * criteresRechercheAdressePrincipale.setIdPersonne(personne.getId());
     * criteresRechercheAdressePrincipale.setIdNature(squareMappingService.getIdNatureAdressePrincipale()); long nbPrimaires =
     * adresseDao.rechercherIdAdressesParCriteres(criteresRechercheAdressePrincipale).size(); if (nbPrimaires == 0) { throw new
     * BusinessException(messageSourceUtil.get(PersonnePhysiqueKeyUtil.MESSAGE_ERREUR_AUCUNE_ADRESSE_PRINCIPALE)); } else if (nbPrimaires > 1) { throw new
     * BusinessException(messageSourceUtil.get(PersonnePhysiqueKeyUtil.MESSAGE_ERREUR_ADRESSE_PRINCIPALE_DUPLIQUEE)); }
     */

    // 2.13 Une date de fin ne pourra etre mise sur une adresse principale que s'il existe une adresse secondaire.
    // Dans ce cas l'adresse principal deviendra automatiquement secondaire et l'adresse secondaire deviendra principale
    Adresse adressePrincipale = null;
    Adresse adresseSecondaire = null;
    for (Adresse adresseParcourue : personnePrincipale.getAdresses()) {
        if (adresseParcourue.getNature().getId().equals(idNatureAdressePrincipale)) {
            adressePrincipale = adresseParcourue;
        }
        if (adresseParcourue.getNature().getId().equals(idNatureAdresseSecondaire)
                && adresseParcourue.getDateFin() == null) {
            adresseSecondaire = adresseParcourue;
        }
    }
    if (adressePrincipale != null && adressePrincipale.getDateFin() != null && adresseSecondaire != null) {
        // Changement adresse principale adresse secondaire
        adressePrincipale.setNature(natureAdresseSecondaire);
        adresseSecondaire.setNature(natureAdressePrincipale);
        // Enregistrement des adresses
        final AdresseDto adresseDtoPrincipal = mapperDozerBean.map(adressePrincipale, AdresseDto.class);
        final AdresseDto adresseDtoSecondaire = mapperDozerBean.map(adresseSecondaire, AdresseDto.class);
        creerOuMettreAJourAdresse(personnes, adresseDtoPrincipal, impacterFamille);
        creerOuMettreAJourAdresse(personnes, adresseDtoSecondaire, impacterFamille);
        if (!adresseCree.getIdAdressesModifiees().contains(adressePrincipale.getId())) {
            adresseCree.getIdAdressesModifiees().add(adressePrincipale.getId());
        }
        if (!adresseCree.getIdAdressesModifiees().contains(adresseSecondaire.getId())) {
            adresseCree.getIdAdressesModifiees().add(adresseSecondaire.getId());
        }

    }

    controlerPersonneAUneAdressePrincipale(personnePrincipale);

    // si il s'agit d'une personne physique et vivier ou bnficiaire vivier, on transforme en prospect ou bnficiaire prospect
    final PersonnePhysique personnePhysique = personnePhysiqueDao.rechercherPersonneParId(idPersonne);
    boolean vivierToProspect = false;
    boolean hasNaturePersonneChanged = false;
    Long idNaturePersonnePhysique = null;
    final Long idNaturePersonneVivier = squareMappingService.getIdNaturePersonneVivier();
    final Long idNaturePersonneBeneficiaireVivier = squareMappingService
            .getIdNaturePersonneBeneficiaireVivier();
    String ancienneNaturePersonne = "";
    String nouvelleNaturePersonne = "";
    if (personnePhysique != null && personnePhysique.getNature() != null) {
        if (idNaturePersonneVivier.equals(personnePhysique.getNature().getId())
                && validationPersonneUtil.verifierContrainteProspect(personnePhysique)) {
            idNaturePersonnePhysique = squareMappingService.getIdNaturePersonneProspect();
            vivierToProspect = true;
            hasNaturePersonneChanged = true;
            ancienneNaturePersonne = personnePhysique.getNature().getLibelle();
        } else if (idNaturePersonneBeneficiaireVivier.equals(personnePhysique.getNature())
                && validationPersonneUtil.verifierContrainteBeneficiaireProspect(personnePhysique)) {
            idNaturePersonnePhysique = squareMappingService.getIdNaturePersonneBeneficiaireProspect();
            hasNaturePersonneChanged = true;
            ancienneNaturePersonne = personnePhysique.getNature().getLibelle();
        }
        if (idNaturePersonnePhysique != null) {
            final PersonnePhysiqueNature naturePersonne = personnePhysiqueNatureDao
                    .rechercherPersonnePhysiqueParId(idNaturePersonnePhysique);
            if (naturePersonne != null) {
                nouvelleNaturePersonne = naturePersonne.getLibelle();
            }
            personnePhysique.setNature(naturePersonne);
        }
    }

    // si la personne est passe de vivier  prospect et qu'elle a des bnficiaires vivier,
    // on essaye de les passer en bnficiaire prospect si c'est possible
    if (vivierToProspect && famille != null && famille.size() > 0) {
        for (Personne beneficiaire : famille) {
            final PersonnePhysique beneficiairePhysique = (PersonnePhysique) beneficiaire;
            if (beneficiairePhysique.getNature() != null
                    && idNaturePersonneBeneficiaireVivier.equals(beneficiairePhysique.getNature().getId())
                    && validationPersonneUtil.verifierContrainteBeneficiaireProspect(beneficiairePhysique)) {
                final PersonnePhysiqueNature naturePersonne = personnePhysiqueNatureDao
                        .rechercherPersonnePhysiqueParId(
                                squareMappingService.getIdNaturePersonneBeneficiaireProspect());
                beneficiairePhysique.setNature(naturePersonne);
            }
        }
    }

    adresseCree.setHasNaturePersonneChanged(hasNaturePersonneChanged);
    adresseCree.setAncienneNaturePersonne(ancienneNaturePersonne);
    adresseCree.setNouvelleNaturePersonne(nouvelleNaturePersonne);
    return adresseCree;
}

From source file:edu.harvard.iq.dvn.core.web.ExploreDataPage.java

private List<SelectItem> loadSelectMeasureItems(int grouptype_id) {
    List selectItems = new ArrayList<SelectItem>();
    List<VarGroup> varGroups = new ArrayList();
    varGroupings = dt.getVarGroupings();
    for (VarGrouping varGrouping : varGroupings) {
        if (varGrouping.getGroupingType().equals(GroupingType.MEASURE)) {
            if (grouptype_id == 0) {
                varGroups = (List<VarGroup>) varGrouping.getVarGroups();
            } else {
                List<VarGroup> varGroupsTest = (List<VarGroup>) varGrouping.getVarGroups();
                for (VarGroup vgTest : varGroupsTest) {
                    List<VarGroupType> varGroupTypes = vgTest.getGroupTypes();
                    for (VarGroupType vgTypeTest : varGroupTypes) {
                        if (vgTypeTest.getId().intValue() == grouptype_id) {
                            varGroups.add(vgTest);
                        }//from w  w  w.j av a  2 s . co m
                    }
                }
            }
            for (VarGroup varGroup : varGroups) {
                boolean added = false;
                Long testId = varGroup.getId();
                for (Object testItem : selectItems) {
                    SelectItem testListSI = (SelectItem) testItem;
                    if (testId.equals(testListSI.getValue())) {
                        added = true;
                    }
                }
                if (!added) {
                    selectItems.add(new SelectItem(varGroup.getId(), varGroup.getName()));
                    if (varGroup.getId().equals(selectedMeasureId)) {
                    }
                    added = true;
                }
            }
        }
    }
    selectedMeasureId = new Long(0);
    return selectItems;
}

From source file:com.egt.core.aplicacion.web.GestorBusquedaReferencia.java

public void validarCodigoRecursoReferenciado(FacesContext fc, UIComponent uic, Object o, RowKey rk,
        boolean flexible, boolean id) {
    Bitacora.trace(this.getClass(), "validarCodigoRecursoReferenciado", uic.getId() + "=" + o, "rk=" + rk,
            "flex=" + flexible, "id=" + id);
    // int tipoError = 1; /* OJO con la constante, 1 -> fila con un error desconocido */
    String columna = this.getColumnaIdentificacionRecursoReferenciado();
    try {/*from w ww. jav a  2s.  c o m*/
        Long idViejo = (Long) this.getRecursoDataProvider().getValue(columna, rk);
        Long idNuevo = null;
        boolean esIgual = false;
        String string = STP.getString(o);
        if (StringUtils.isEmpty(string)) {
            esIgual = (idViejo == null) ? true : false;
        } else {
            String clave = null;
            Object valor = null;
            if (!id && this.getRecursoReferenciadoDataProvider().isRecursoCodificable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoCodificableDataProvider()
                        .getColumnaCodigoRecurso();
                valor = string;
            } else if (this.getRecursoReferenciadoDataProvider().isRecursoIdentificable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoIdentificableDataProvider()
                        .getColumnaIdentificacionRecurso();
                valor = STP.getObjeto(string, EnumTipoDatoPar.ENTERO_GRANDE); /* Long.valueOf(string); */
                if (valor == null) {
                    // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                    throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM2.CHECK_CHANGES_EXCEPTION_4,
                            EnumTipoDatoPar.ENTERO_GRANDE.getLabel()));
                }
            } else if (this.getRecursoReferenciadoDataProvider().isRecursoEnumerable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoEnumerableDataProvider()
                        .getColumnaNumeroRecurso();
                valor = STP.getObjeto(string, EnumTipoDatoPar.ENTERO); /* Integer.valueOf(string); */
                if (valor == null) {
                    // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                    throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM2.CHECK_CHANGES_EXCEPTION_4,
                            EnumTipoDatoPar.ENTERO.getLabel()));
                }
            } else {
                // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                throw new ExcepcionAplicacion(
                        Bitacora.getTextoMensaje(CBM2.RECURSO_NO_REFERENCIABLE, "<" + columna + ">", string));
            }
            RowKey rowKey = this.getRow(clave, valor);
            if (rowKey != null) {
                if (this.getRecursoReferenciadoDataProvider().isRecursoIdentificable()) {
                    idNuevo = this.getRecursoReferenciadoDataProvider().getRecursoIdentificableDataProvider()
                            .getIdentificacionRecurso(rowKey);
                } else if (this.getRecursoReferenciadoDataProvider().isRecursoEnumerable()) {
                    idNuevo = Long.valueOf(this.getRecursoReferenciadoDataProvider()
                            .getRecursoEnumerableDataProvider().getNumeroRecurso(rowKey));
                }
                esIgual = idViejo == null ? false : idViejo.equals(idNuevo);
                if (!esIgual && !flexible
                        && this.getRecursoReferenciadoDataProvider().isRecursoDesactivable()) {
                    Integer inactivo = this.getRecursoReferenciadoDataProvider()
                            .getRecursoDesactivableDataProvider().getEsRecursoInactivo(rowKey);
                    if (BitUtils.valueOf(inactivo)) {
                        // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                        throw new ExcepcionAplicacion(
                                Bitacora.getTextoMensaje(CBM2.RECURSO_INACTIVO, "<" + columna + ">", string));
                    }
                }
            } else {
                // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                throw new ExcepcionAplicacion(
                        Bitacora.getTextoMensaje(CBM2.RECURSO_NO_REFERENCIABLE, "<" + columna + ">", string));
            }
        }
        if (!esIgual) {
            this.getRecursoDataProvider().setValue(columna, rk, idNuevo);
        }
    } catch (Exception ex) {
        this.getRecursoDataProvider().setValue(columna, rk, null);
        if (ex instanceof ValidatorException) {
            throw (ValidatorException) ex;
        } else {
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), null);
            //              String mensaje = tipoError + ex.getMessage();
            //              this.getRecursoDataProvider().getFilasConflictivas().put(currentRowKey.getRowId(), mensaje);
            throw new ValidatorException(message);
        }
    }
}

From source file:ips1ap101.lib.core.web.app.GestorBusquedaReferencia.java

public void validarCodigoRecursoReferenciado(FacesContext fc, UIComponent uic, Object o, RowKey rk,
        boolean flexible, boolean id) {
    Bitacora.trace(this.getClass(), "validarCodigoRecursoReferenciado", uic.getId() + "=" + o, "rk=" + rk,
            "flex=" + flexible, "id=" + id);
    // int tipoError = 1; /* OJO con la constante, 1 -> fila con un error desconocido */
    String columna = this.getColumnaIdentificacionRecursoReferenciado();
    try {/*from  w  ww  .  j av a 2 s.com*/
        Long idViejo = (Long) this.getRecursoDataProvider().getValue(columna, rk);
        Long idNuevo = null;
        boolean esIgual = false;
        String string = STP.getString(o);
        if (StringUtils.isEmpty(string)) {
            esIgual = (idViejo == null) ? true : false;
        } else {
            String clave = null;
            Object valor = null;
            if (!id && this.getRecursoReferenciadoDataProvider().isRecursoCodificable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoCodificableDataProvider()
                        .getColumnaCodigoRecurso();
                valor = string;
            } else if (this.getRecursoReferenciadoDataProvider().isRecursoIdentificable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoIdentificableDataProvider()
                        .getColumnaIdentificacionRecurso();
                valor = STP.getObjeto(string, TipoDatoParEnumeration.ENTERO_GRANDE); /* Long.valueOf(string); */
                if (valor == null) {
                    // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                    throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM.CHECK_CHANGES_EXCEPTION_4,
                            TipoDatoParEnumeration.ENTERO_GRANDE.getLabel()));
                }
            } else if (this.getRecursoReferenciadoDataProvider().isRecursoEnumerable()) {
                clave = this.getRecursoReferenciadoDataProvider().getRecursoEnumerableDataProvider()
                        .getColumnaNumeroRecurso();
                valor = STP.getObjeto(string, TipoDatoParEnumeration.ENTERO); /* Integer.valueOf(string); */
                if (valor == null) {
                    // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                    throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM.CHECK_CHANGES_EXCEPTION_4,
                            TipoDatoParEnumeration.ENTERO.getLabel()));
                }
            } else {
                // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM.RECURSO_NO_REFERENCIABLE,
                        "<" + columna + ">", string, ""));
            }
            RowKey rowKey = this.getRow(clave, valor);
            if (rowKey != null) {
                if (this.getRecursoReferenciadoDataProvider().isRecursoIdentificable()) {
                    idNuevo = this.getRecursoReferenciadoDataProvider().getRecursoIdentificableDataProvider()
                            .getIdentificacionRecurso(rowKey);
                } else if (this.getRecursoReferenciadoDataProvider().isRecursoEnumerable()) {
                    idNuevo = Long.valueOf(this.getRecursoReferenciadoDataProvider()
                            .getRecursoEnumerableDataProvider().getNumeroRecurso(rowKey));
                }
                esIgual = idViejo == null ? false : idViejo.equals(idNuevo);
                if (!esIgual && !flexible
                        && this.getRecursoReferenciadoDataProvider().isRecursoDesactivable()) {
                    Boolean inactivo = this.getRecursoReferenciadoDataProvider()
                            .getRecursoDesactivableDataProvider().getEsRecursoInactivo(rowKey);
                    if (BitUtils.valueOf(inactivo)) {
                        // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                        throw new ExcepcionAplicacion(
                                Bitacora.getTextoMensaje(CBM.RECURSO_INACTIVO, "<" + columna + ">", string));
                    }
                }
            } else {
                // tipoError = 2; /* OJO con la constante, 2 -> fila con un error conocido */
                throw new ExcepcionAplicacion(Bitacora.getTextoMensaje(CBM.RECURSO_NO_REFERENCIABLE,
                        "<" + columna + ">", string, ""));
            }
        }
        if (!esIgual) {
            this.getRecursoDataProvider().setValue(columna, rk, idNuevo);
        }
    } catch (DataProviderException | ExcepcionAplicacion ex) {
        this.getRecursoDataProvider().setValue(columna, rk, null);
        if (ex instanceof ValidatorException) {
            throw (ValidatorException) ex;
        } else {
            FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, ex.getMessage(), null);
            //              String mensaje = tipoError + ex.getMessage();
            //              this.getRecursoDataProvider().getFilasConflictivas().put(currentRowKey.getRowId(), mensaje);
            throw new ValidatorException(message);
        }
    }
}

From source file:jp.co.opentone.bsol.linkbinder.view.correspon.CorresponPage.java

public AttachmentInfo getDownloadingAttachmentInfo() {
    Long downloadingFileId = getFileId();
    Attachment a = null;//  w  ww. j  a va 2 s. co  m
    for (Attachment attachment : correspon.getAttachments()) {
        if (downloadingFileId.equals(attachment.getId())) {
            a = attachment;
            break;
        }
    }

    return new SavedAttachmentInfo(a, corresponService);
}

From source file:jp.primecloud.auto.ui.WinServerEdit.java

private void initData() {
    // ??//from   www  .j a  v  a 2 s  .  c  o  m
    // TODO: ?????
    InstanceService instanceService = BeanContext.getBean(InstanceService.class);
    this.instance = instanceService.getInstance(instanceNo);

    //LB????
    this.isLoadBalancer = BooleanUtils.isTrue(instance.getInstance().getLoadBalancer());

    // ??
    // TODO: ????
    Long imageNo = instance.getInstance().getImageNo();
    List<PlatformDto> platforms = instanceService.getPlatforms(ViewContext.getUserNo());
    for (PlatformDto platformDto : platforms) {
        if (instance.getInstance().getPlatformNo().equals(platformDto.getPlatform().getPlatformNo())) {
            this.platformDto = platformDto;
            for (ImageDto image : platformDto.getImages()) {
                if (imageNo.equals(image.getImage().getImageNo())) {
                    this.image = image;
                    break;
                }
            }
            break;
        }
    }

    Platform platform = platformDto.getPlatform();
    String platformType = platform.getPlatformType();
    // TODO CLOUD BRANCHING
    if (PCCConstant.PLATFORM_TYPE_AWS.equals(platformType)) {
        PlatformAws platformAws = platformDto.getPlatformAws();
        // ?
        // TODO: ????
        IaasDescribeService describeService = BeanContext.getBean(IaasDescribeService.class);
        //
        List<KeyPairDto> infos = describeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());
        keyPairs = new ArrayList<String>();
        for (KeyPairDto info : infos) {
            keyPairs.add(info.getKeyName());
        }

        //
        securityGroups = new ArrayList<String>();
        List<SecurityGroupDto> groups;
        if (platformAws.getEuca() == false && platformAws.getVpc()) {
            groups = describeService.getSecurityGroups(ViewContext.getUserNo(), platform.getPlatformNo(),
                    platformAws.getVpcId());
        } else {
            groups = describeService.getSecurityGroups(ViewContext.getUserNo(), platform.getPlatformNo(), null);
        }
        for (SecurityGroupDto group : groups) {
            securityGroups.add(group.getGroupName());
        }

        //
        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageAws().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }

        //
        zones = describeService.getAvailabilityZones(ViewContext.getUserNo(), platform.getPlatformNo());
        if (platformAws.getEuca() == false && platformAws.getVpc() == false) {
            //EC2 VPC????????????????
            zones.add(0, new ZoneDto());
        }

        //?
        if (platformAws.getEuca() == false && platformAws.getVpc()) {
            subnets = describeService.getSubnets(ViewContext.getUserNo(), platform.getPlatformNo(),
                    platformAws.getVpcId());
        }

        //ElasticIp
        elasticIps = new ArrayList<AddressDto>();
        List<AddressDto> addresses = describeService.getAddresses(ViewContext.getUserNo(),
                platform.getPlatformNo());
        for (AddressDto address : addresses) {
            elasticIps.add(address);
        }

    } else if (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platformType)) {
        // VMware?
        // TODO: ????
        VmwareDescribeService vmwareDescribeService = BeanContext.getBean(VmwareDescribeService.class);
        vmwareKeyPairs = vmwareDescribeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());
        keyPairs = new ArrayList<String>();
        for (VmwareKeyPair vmwareKeyPair : vmwareKeyPairs) {
            keyPairs.add(vmwareKeyPair.getKeyName());
        }

        List<ComputeResource> computeResources = vmwareDescribeService
                .getComputeResources(platform.getPlatformNo());
        clusters = new ArrayList<String>();
        for (ComputeResource computeResource : computeResources) {
            clusters.add(computeResource.getName());
        }

        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageVmware().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }
    } else if (PCCConstant.PLATFORM_TYPE_NIFTY.equals(platformType)) {
        // Nifty?
        // TODO: ????
        NiftyDescribeService niftyDescribeService = BeanContext.getBean(NiftyDescribeService.class);
        niftyKeyPairs = niftyDescribeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());
        keyPairs = new ArrayList<String>();
        for (NiftyKeyPair niftyKeyPair : niftyKeyPairs) {
            keyPairs.add(niftyKeyPair.getKeyName());
        }

        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageNifty().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }
    } else if (PCCConstant.PLATFORM_TYPE_CLOUDSTACK.equals(platformType)) {
        // CloudStack?
        // ?
        // TODO: ????
        IaasDescribeService describeService = BeanContext.getBean(IaasDescribeService.class);
        List<KeyPairDto> infos = describeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());
        keyPairs = new ArrayList<String>();
        for (KeyPairDto info : infos) {
            keyPairs.add(info.getKeyName());
        }

        networks = new ArrayList<String>();
        for (String network : platformDto.getPlatformCloudstack().getNetworkId().split(",")) {
            networks.add(network);
        }

        securityGroups = new ArrayList<String>();
        if (StringUtils.isEmpty(instance.getCloudstackInstance().getNetworkid())) {
            List<SecurityGroupDto> groups = describeService.getSecurityGroups(ViewContext.getUserNo(),
                    platform.getPlatformNo(), null);
            for (SecurityGroupDto group : groups) {
                securityGroups.add(group.getGroupName());
            }
        }

        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageCloudstack().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }

        zones = describeService.getAvailabilityZones(ViewContext.getUserNo(), platform.getPlatformNo());

        elasticIps = new ArrayList<AddressDto>();
        List<AddressDto> addresses = describeService.getAddresses(ViewContext.getUserNo(),
                platform.getPlatformNo());
        for (AddressDto address : addresses) {
            elasticIps.add(address);
        }

    } else if (PCCConstant.PLATFORM_TYPE_VCLOUD.equals(platformType)) {
        // VCloud?
        IaasDescribeService describeService = BeanContext.getBean(IaasDescribeService.class);
        //StorageType
        storageTypes = describeService.getStorageTypes(ViewContext.getUserNo(), platform.getPlatformNo());

        //KeyPair
        vcloudKeyPairs = describeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());

        //InstanceType
        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageVcloud().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }

        //DataDisk
        deleteDataDisks = new ArrayList<DataDiskDto>();
        dataDisks = new ArrayList<DataDiskDto>();
        List<VcloudDisk> vcloudDisks = instance.getVcloudDisks();
        for (VcloudDisk vcloudDisk : vcloudDisks) {
            if (BooleanUtils.isTrue(vcloudDisk.getDataDisk())) {
                DataDiskDto diskDto = new DataDiskDto();
                diskDto.setDiskNo(vcloudDisk.getDiskNo());
                diskDto.setDiskSize(vcloudDisk.getSize());
                diskDto.setUnitNo(vcloudDisk.getUnitNo());
                dataDisks.add(diskDto);
            }
        }

        //Network
        List<NetworkDto> networkDtos = describeService.getNetworks(ViewContext.getUserNo(),
                platform.getPlatformNo());
        networkMap = new HashMap<String, NetworkDto>();
        for (NetworkDto networkDto : networkDtos) {
            networkMap.put(networkDto.getNetworkName(), networkDto);
        }

        //InstanceNetwork
        instanceNetworks = new ArrayList<InstanceNetworkDto>();
        List<VcloudInstanceNetwork> tmpInstanceNetworks = this.instance.getVcloudInstanceNetworks();
        for (VcloudInstanceNetwork instanceNetwork : tmpInstanceNetworks) {
            InstanceNetworkDto instanceNetworkDto = new InstanceNetworkDto();
            instanceNetworkDto.setNetworkNo(instanceNetwork.getNetworkNo());
            instanceNetworkDto.setNetworkName(instanceNetwork.getNetworkName());
            instanceNetworkDto.setNew(false);
            instanceNetworkDto.setDelete(false);
            instanceNetworkDto.setIpMode(instanceNetwork.getIpMode());
            instanceNetworkDto.setIpAddress(instanceNetwork.getIpAddress());
            instanceNetworkDto.setRequired(networkMap.get(instanceNetwork.getNetworkName()).isPcc());
            instanceNetworkDto.setPrimary(BooleanUtils.isTrue(instanceNetwork.getIsPrimary()));
            instanceNetworks.add(instanceNetworkDto);
        }

    } else if (PCCConstant.PLATFORM_TYPE_AZURE.equals(platformType)) {
        // Azure?
        PlatformAzure platformAzure = platformDto.getPlatformAzure();
        // ?
        IaasDescribeService describeService = BeanContext.getBean(IaasDescribeService.class);

        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageAzure().getInstanceTypes().split(",")) {
            instanceTypes.add(instanceType.trim());
        }
        // ?
        availabilitySets = new ArrayList<String>();
        for (String availabilitySet : platformAzure.getAvailabilitySets().split(",")) {
            availabilitySets.add(availabilitySet.trim());
        }
        //?
        subnets = describeService.getAzureSubnets(ViewContext.getUserNo(), platform.getPlatformNo(),
                platformAzure.getNetworkName());

    } else if (PCCConstant.PLATFORM_TYPE_OPENSTACK.equals(platformType)) {
        // ?
        IaasDescribeService describeService = BeanContext.getBean(IaasDescribeService.class);
        //instanceTypes
        instanceTypes = new ArrayList<String>();
        for (String instanceType : image.getImageOpenstack().getInstanceTypes().split(",")) {
            //ID????????????
            instanceTypes.add(instanceType.trim());
        }
        // Availablility Zone
        zones = describeService.getAvailabilityZones(ViewContext.getUserNo(), platform.getPlatformNo());

        //
        securityGroups = new ArrayList<String>();
        List<SecurityGroupDto> groups;
        groups = describeService.getSecurityGroups(ViewContext.getUserNo(), platform.getPlatformNo(), null);
        for (SecurityGroupDto group : groups) {
            securityGroups.add(group.getGroupName());
        }

        //
        List<KeyPairDto> infos = describeService.getKeyPairs(ViewContext.getUserNo(), platform.getPlatformNo());
        keyPairs = new ArrayList<String>();
        for (KeyPairDto info : infos) {
            keyPairs.add(info.getKeyName());
        }

    }

    // ?????
    componentNos = new ArrayList<Long>();
    List<ComponentInstanceDto> componentInstances = instance.getComponentInstances();
    for (ComponentInstanceDto componentInstance : componentInstances) {
        if (BooleanUtils.isTrue(componentInstance.getComponentInstance().getAssociate())) {
            componentNos.add(componentInstance.getComponentInstance().getComponentNo());
        }
    }
}

From source file:net.solarnetwork.node.backup.s3.S3BackupService.java

private Backup performBackupInternal(final Iterable<BackupResource> resources, final Calendar now,
        Map<String, String> props) {
    if (resources == null) {
        return null;
    }//from  w  ww.j  a v a2s  .  c o m
    final Iterator<BackupResource> itr = resources.iterator();
    if (!itr.hasNext()) {
        log.debug("No resources provided, nothing to backup");
        return null;
    }
    S3Client client = this.s3Client;
    if (!status.compareAndSet(BackupStatus.Configured, BackupStatus.RunningBackup)) {
        // try to reset from error
        if (!status.compareAndSet(BackupStatus.Error, BackupStatus.RunningBackup)) {
            return null;
        }
    }
    S3BackupMetadata result = null;
    try {
        final Long nodeId = nodeId(props);
        final String metaName = String.format(META_NAME_FORMAT, now, nodeId);
        final String metaObjectKey = objectKeyForPath(META_OBJECT_KEY_PREFIX + metaName);
        log.info("Starting backup to archive {}", metaObjectKey);

        final Set<S3ObjectReference> allDataObjects = client
                .listObjects(objectKeyForPath(DATA_OBJECT_KEY_PREFIX));

        S3BackupMetadata meta = new S3BackupMetadata();
        meta.setNodeId(nodeId);
        MessageDigest digest = DigestUtils.getSha256Digest();
        byte[] buf = new byte[4096];
        for (BackupResource rsrc : resources) {
            ObjectMetadata objectMetadata = new ObjectMetadata();
            if (rsrc.getModificationDate() > 0) {
                objectMetadata.setLastModified(new Date(rsrc.getModificationDate()));
            }
            String sha = calculateContentDigest(rsrc, digest, buf, objectMetadata);
            String objectKey = objectKeyForPath(DATA_OBJECT_KEY_PREFIX + sha);

            // see if already exists
            if (!allDataObjects.contains(new S3ObjectReference(objectKey))) {
                log.info("Saving resource to S3: {}", rsrc.getBackupPath());
                client.putObject(objectKey, rsrc.getInputStream(), objectMetadata);
            } else {
                log.info("Backup resource already saved to S3: {}", rsrc.getBackupPath());
            }
            meta.addBackupResource(rsrc, objectKey, sha);
        }

        // now save metadata
        meta.setComplete(true);
        meta.setDate(now.getTime());
        meta.setKey(metaName);
        byte[] metaJsonBytes = OBJECT_MAPPER.writeValueAsBytes(meta);
        try (ByteArrayInputStream in = new ByteArrayInputStream(metaJsonBytes)) {
            ObjectMetadata metaObjectMetadata = new ObjectMetadata();
            metaObjectMetadata.setContentType("application/json;charset=UTF-8");
            metaObjectMetadata.setContentLength(metaJsonBytes.length);
            metaObjectMetadata.setLastModified(meta.getDate());
            S3ObjectReference metaRef = client.putObject(metaObjectKey, in, metaObjectMetadata);
            result = new S3BackupMetadata(metaRef);
        }

        if (additionalBackupCount < 1) {
            // add this backup to the cached data
            CachedResult<List<Backup>> cached = cachedBackupList.get();
            if (cached != null) {
                List<Backup> list = cached.getResult();
                List<Backup> newList = new ArrayList<>(list);
                newList.add(0, result);
                updateCachedBackupList(newList);
            }
        } else {
            // clean out older backups
            List<Backup> knownBackups = getAvailableBackupsInternal();
            List<String> backupsForNode = knownBackups.stream().filter(b -> nodeId.equals(b.getNodeId()))
                    .map(b -> b.getKey()).collect(Collectors.toList());
            if (backupsForNode.size() > additionalBackupCount + 1) {
                Set<String> keysToDelete = backupsForNode.stream()
                        .limit(backupsForNode.size() - additionalBackupCount - 1).collect(Collectors.toSet());
                log.info("Deleting {} expired backups for node {}: {}", keysToDelete.size(), nodeId,
                        keysToDelete);
                client.deleteObjects(keysToDelete);

                // update cache
                knownBackups = knownBackups.stream().filter(b -> !keysToDelete.contains(b.getKey()))
                        .collect(Collectors.toList());
                updateCachedBackupList(knownBackups);
            }
        }
    } catch (IOException e) {
        log.error("IO error performing backup", e);
    } finally {
        status.compareAndSet(BackupStatus.RunningBackup, BackupStatus.Configured);
    }
    return result;
}

From source file:edu.harvard.iq.dvn.core.study.StudyServiceBean.java

public void incrementNumberOfDownloads(Long studyFileId, Long currentVDCId, Date lastDownloadTime,
        GuestBookResponse guestbookResponse) {
    StudyFile sf = studyFileService.getStudyFile(studyFileId);
    Study study = sf.getStudy();/*from   www .j  ava  2s.  c  o m*/
    StudyFileActivity sfActivity = sf.getStudyFileActivity();
    if (guestbookResponse.getStudyVersion() == null || guestbookResponse.getStudyVersion().isDraft()) {
        //if our studyversion is in draft or doesn't exist we don't want to count it or save GB responses.
        return;
    }
    addGuestbookRecords(sf, guestbookResponse);

    if (sfActivity == null) {
        sfActivity = new StudyFileActivity();
        sfActivity.setStudyFile(sf);
        sfActivity.setStudy(study);

        sf.setStudyFileActivity(sfActivity);
        study.getStudyFileActivity().add(sfActivity);
    }

    sfActivity.setDownloadCount(sfActivity.getDownloadCount() + 1);
    sfActivity.setLastDownloadTime(lastDownloadTime);

    if (currentVDCId == null) {
        VDCActivity vdcActivity = study.getOwner().getVDCActivity();
        vdcActivity.setLocalStudyNetworkDownloadCount(vdcActivity.getLocalStudyNetworkDownloadCount() + 1);

    } else if (currentVDCId.equals(study.getOwner().getId())) {
        VDCActivity vdcActivity = study.getOwner().getVDCActivity();
        vdcActivity.setLocalStudyLocalDownloadCount(vdcActivity.getLocalStudyLocalDownloadCount() + 1);

    } else {
        VDCActivity vdcActivity1 = study.getOwner().getVDCActivity();
        vdcActivity1.setLocalStudyForeignDownloadCount(vdcActivity1.getLocalStudyForeignDownloadCount() + 1);

        VDCActivity vdcActivity2 = vdcService.findById(currentVDCId).getVDCActivity();
        vdcActivity2.setForeignStudyLocalDownloadCount(vdcActivity2.getForeignStudyLocalDownloadCount() + 1);
    }

}