Java 类com.liferay.portal.kernel.util.SetUtil 实例源码

项目:ch-inofix-contact-manager    文件:ContactImpl.java   
private EmailDTO getEmail(Email email) {

        EmailDTO emailDTO = new EmailDTO();

        if (email != null) {
            emailDTO.setAddress(email.getValue());

            // emailDTO.setAddress(email.getValue());

            // TODO: Add multi-type support
            StringBuilder sb = new StringBuilder();
            Set<EmailType> types = SetUtil.fromList(email.getTypes());
            if (types.size() > 0) {
                for (EmailType type : types) {
                    sb.append(type.getValue());
                }
            } else {
                sb.append("other");
            }

            emailDTO.setType(sb.toString());
        }

        return emailDTO;
    }
项目:ch-inofix-contact-manager    文件:ContactImpl.java   
private PhoneDTO getPhone(Telephone phone) {

        PhoneDTO phoneDTO = new PhoneDTO();

        if (phone != null) {
            phoneDTO.setNumber(phone.getText());

            StringBuilder sb = new StringBuilder();

            Set<TelephoneType> types = SetUtil.fromList(phone.getTypes());

            // TODO: Add support for multiple telephone types
            // e.g. home-fax, work-mobile, etc.
            if (types.size() > 0) {
                for (TelephoneType type : types) {
                    sb.append(type.getValue());
                }
            } else {
                sb.append("other");
            }

            phoneDTO.setType(sb.toString());
        }

        return phoneDTO;
    }
项目:OEPv2    文件:DocTemplatePersistenceImpl.java   
/**
 * Sets the dossier docs associated with the doc template, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the doc template
 * @param dossierDocPKs the primary keys of the dossier docs to be associated with the doc template
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDossierDocs(long pk, long[] dossierDocPKs)
    throws SystemException {
    Set<Long> newDossierDocPKsSet = SetUtil.fromArray(dossierDocPKs);
    Set<Long> oldDossierDocPKsSet = SetUtil.fromArray(docTemplateToDossierDocTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDossierDocPKsSet = new HashSet<Long>(oldDossierDocPKsSet);

    removeDossierDocPKsSet.removeAll(newDossierDocPKsSet);

    for (long removeDossierDocPK : removeDossierDocPKsSet) {
        docTemplateToDossierDocTableMapper.deleteTableMapping(pk,
            removeDossierDocPK);
    }

    newDossierDocPKsSet.removeAll(oldDossierDocPKsSet);

    for (long newDossierDocPK : newDossierDocPKsSet) {
        docTemplateToDossierDocTableMapper.addTableMapping(pk,
            newDossierDocPK);
    }
}
项目:OEPv2    文件:DossierDocPersistenceImpl.java   
/**
 * Sets the doc templates associated with the dossier doc, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dossier doc
 * @param docTemplatePKs the primary keys of the doc templates to be associated with the dossier doc
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDocTemplates(long pk, long[] docTemplatePKs)
    throws SystemException {
    Set<Long> newDocTemplatePKsSet = SetUtil.fromArray(docTemplatePKs);
    Set<Long> oldDocTemplatePKsSet = SetUtil.fromArray(dossierDocToDocTemplateTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDocTemplatePKsSet = new HashSet<Long>(oldDocTemplatePKsSet);

    removeDocTemplatePKsSet.removeAll(newDocTemplatePKsSet);

    for (long removeDocTemplatePK : removeDocTemplatePKsSet) {
        dossierDocToDocTemplateTableMapper.deleteTableMapping(pk,
            removeDocTemplatePK);
    }

    newDocTemplatePKsSet.removeAll(oldDocTemplatePKsSet);

    for (long newDocTemplatePK : newDocTemplatePKsSet) {
        dossierDocToDocTemplateTableMapper.addTableMapping(pk,
            newDocTemplatePK);
    }
}
项目:OEPv2    文件:DocTemplatePersistenceImpl.java   
/**
 * Sets the dossier docs associated with the doc template, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the doc template
 * @param dossierDocPKs the primary keys of the dossier docs to be associated with the doc template
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDossierDocs(long pk, long[] dossierDocPKs)
    throws SystemException {
    Set<Long> newDossierDocPKsSet = SetUtil.fromArray(dossierDocPKs);
    Set<Long> oldDossierDocPKsSet = SetUtil.fromArray(docTemplateToDossierDocTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDossierDocPKsSet = new HashSet<Long>(oldDossierDocPKsSet);

    removeDossierDocPKsSet.removeAll(newDossierDocPKsSet);

    for (long removeDossierDocPK : removeDossierDocPKsSet) {
        docTemplateToDossierDocTableMapper.deleteTableMapping(pk,
            removeDossierDocPK);
    }

    newDossierDocPKsSet.removeAll(oldDossierDocPKsSet);

    for (long newDossierDocPK : newDossierDocPKsSet) {
        docTemplateToDossierDocTableMapper.addTableMapping(pk,
            newDossierDocPK);
    }
}
项目:OEPv2    文件:DossierDocPersistenceImpl.java   
/**
 * Sets the doc templates associated with the dossier doc, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dossier doc
 * @param docTemplatePKs the primary keys of the doc templates to be associated with the dossier doc
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDocTemplates(long pk, long[] docTemplatePKs)
    throws SystemException {
    Set<Long> newDocTemplatePKsSet = SetUtil.fromArray(docTemplatePKs);
    Set<Long> oldDocTemplatePKsSet = SetUtil.fromArray(dossierDocToDocTemplateTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDocTemplatePKsSet = new HashSet<Long>(oldDocTemplatePKsSet);

    removeDocTemplatePKsSet.removeAll(newDocTemplatePKsSet);

    for (long removeDocTemplatePK : removeDocTemplatePKsSet) {
        dossierDocToDocTemplateTableMapper.deleteTableMapping(pk,
            removeDocTemplatePK);
    }

    newDocTemplatePKsSet.removeAll(oldDocTemplatePKsSet);

    for (long newDocTemplatePK : newDocTemplatePKsSet) {
        dossierDocToDocTemplateTableMapper.addTableMapping(pk,
            newDocTemplatePK);
    }
}
项目:OEPv2    文件:EmployeePersistenceImpl.java   
/**
 * Sets the Job Poses associated with the employee, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the employee
 * @param jobPosPKs the primary keys of the Job Poses to be associated with the employee
 * @throws SystemException if a system exception occurred
 */
@Override
public void setJobPoses(long pk, long[] jobPosPKs)
    throws SystemException {
    Set<Long> newJobPosPKsSet = SetUtil.fromArray(jobPosPKs);
    Set<Long> oldJobPosPKsSet = SetUtil.fromArray(employeeToJobPosTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeJobPosPKsSet = new HashSet<Long>(oldJobPosPKsSet);

    removeJobPosPKsSet.removeAll(newJobPosPKsSet);

    for (long removeJobPosPK : removeJobPosPKsSet) {
        employeeToJobPosTableMapper.deleteTableMapping(pk, removeJobPosPK);
    }

    newJobPosPKsSet.removeAll(oldJobPosPKsSet);

    for (long newJobPosPK : newJobPosPKsSet) {
        employeeToJobPosTableMapper.addTableMapping(pk, newJobPosPK);
    }
}
项目:OEPv2    文件:JobPosPersistenceImpl.java   
/**
 * Sets the employees associated with the Job Pos, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the Job Pos
 * @param employeePKs the primary keys of the employees to be associated with the Job Pos
 * @throws SystemException if a system exception occurred
 */
@Override
public void setEmployees(long pk, long[] employeePKs)
    throws SystemException {
    Set<Long> newEmployeePKsSet = SetUtil.fromArray(employeePKs);
    Set<Long> oldEmployeePKsSet = SetUtil.fromArray(jobPosToEmployeeTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeEmployeePKsSet = new HashSet<Long>(oldEmployeePKsSet);

    removeEmployeePKsSet.removeAll(newEmployeePKsSet);

    for (long removeEmployeePK : removeEmployeePKsSet) {
        jobPosToEmployeeTableMapper.deleteTableMapping(pk, removeEmployeePK);
    }

    newEmployeePKsSet.removeAll(oldEmployeePKsSet);

    for (long newEmployeePK : newEmployeePKsSet) {
        jobPosToEmployeeTableMapper.addTableMapping(pk, newEmployeePK);
    }
}
项目:OEPv2    文件:DictCollectionPersistenceImpl.java   
/**
 * Sets the dictionary datas associated with the dictionary collection, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dictionary collection
 * @param dictDataPKs the primary keys of the dictionary datas to be associated with the dictionary collection
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDictDatas(long pk, long[] dictDataPKs)
    throws SystemException {
    Set<Long> newDictDataPKsSet = SetUtil.fromArray(dictDataPKs);
    Set<Long> oldDictDataPKsSet = SetUtil.fromArray(dictCollectionToDictDataTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDictDataPKsSet = new HashSet<Long>(oldDictDataPKsSet);

    removeDictDataPKsSet.removeAll(newDictDataPKsSet);

    for (long removeDictDataPK : removeDictDataPKsSet) {
        dictCollectionToDictDataTableMapper.deleteTableMapping(pk,
            removeDictDataPK);
    }

    newDictDataPKsSet.removeAll(oldDictDataPKsSet);

    for (long newDictDataPK : newDictDataPKsSet) {
        dictCollectionToDictDataTableMapper.addTableMapping(pk,
            newDictDataPK);
    }
}
项目:OEPv2    文件:DictDataPersistenceImpl.java   
/**
 * Sets the dictionary collections associated with the dictionary data, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dictionary data
 * @param dictCollectionPKs the primary keys of the dictionary collections to be associated with the dictionary data
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDictCollections(long pk, long[] dictCollectionPKs)
    throws SystemException {
    Set<Long> newDictCollectionPKsSet = SetUtil.fromArray(dictCollectionPKs);
    Set<Long> oldDictCollectionPKsSet = SetUtil.fromArray(dictDataToDictCollectionTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDictCollectionPKsSet = new HashSet<Long>(oldDictCollectionPKsSet);

    removeDictCollectionPKsSet.removeAll(newDictCollectionPKsSet);

    for (long removeDictCollectionPK : removeDictCollectionPKsSet) {
        dictDataToDictCollectionTableMapper.deleteTableMapping(pk,
            removeDictCollectionPK);
    }

    newDictCollectionPKsSet.removeAll(oldDictCollectionPKsSet);

    for (long newDictCollectionPK : newDictCollectionPKsSet) {
        dictDataToDictCollectionTableMapper.addTableMapping(pk,
            newDictCollectionPK);
    }
}
项目:OEPv2    文件:DictCollectionPersistenceImpl.java   
/**
 * Sets the dictionary datas associated with the dictionary collection, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dictionary collection
 * @param dictDataPKs the primary keys of the dictionary datas to be associated with the dictionary collection
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDictDatas(long pk, long[] dictDataPKs)
    throws SystemException {
    Set<Long> newDictDataPKsSet = SetUtil.fromArray(dictDataPKs);
    Set<Long> oldDictDataPKsSet = SetUtil.fromArray(dictCollectionToDictDataTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDictDataPKsSet = new HashSet<Long>(oldDictDataPKsSet);

    removeDictDataPKsSet.removeAll(newDictDataPKsSet);

    for (long removeDictDataPK : removeDictDataPKsSet) {
        dictCollectionToDictDataTableMapper.deleteTableMapping(pk,
            removeDictDataPK);
    }

    newDictDataPKsSet.removeAll(oldDictDataPKsSet);

    for (long newDictDataPK : newDictDataPKsSet) {
        dictCollectionToDictDataTableMapper.addTableMapping(pk,
            newDictDataPK);
    }
}
项目:OEPv2    文件:DictDataPersistenceImpl.java   
/**
 * Sets the dictionary collections associated with the dictionary data, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the dictionary data
 * @param dictCollectionPKs the primary keys of the dictionary collections to be associated with the dictionary data
 * @throws SystemException if a system exception occurred
 */
@Override
public void setDictCollections(long pk, long[] dictCollectionPKs)
    throws SystemException {
    Set<Long> newDictCollectionPKsSet = SetUtil.fromArray(dictCollectionPKs);
    Set<Long> oldDictCollectionPKsSet = SetUtil.fromArray(dictDataToDictCollectionTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeDictCollectionPKsSet = new HashSet<Long>(oldDictCollectionPKsSet);

    removeDictCollectionPKsSet.removeAll(newDictCollectionPKsSet);

    for (long removeDictCollectionPK : removeDictCollectionPKsSet) {
        dictDataToDictCollectionTableMapper.deleteTableMapping(pk,
            removeDictCollectionPK);
    }

    newDictCollectionPKsSet.removeAll(oldDictCollectionPKsSet);

    for (long newDictCollectionPK : newDictCollectionPKsSet) {
        dictDataToDictCollectionTableMapper.addTableMapping(pk,
            newDictCollectionPK);
    }
}
项目:govapps    文件:CategoryPersistenceImpl.java   
/**
 * Sets the applications associated with the category, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the category
 * @param applicationPKs the primary keys of the applications to be associated with the category
 * @throws SystemException if a system exception occurred
 */
public void setApplications(long pk, long[] applicationPKs)
    throws SystemException {
    try {
        Set<Long> applicationPKSet = SetUtil.fromArray(applicationPKs);

        List<de.fraunhofer.fokus.movepla.model.Application> applications = getApplications(pk);

        for (de.fraunhofer.fokus.movepla.model.Application application : applications) {
            if (!applicationPKSet.remove(application.getPrimaryKey())) {
                removeApplication.remove(pk, application.getPrimaryKey());
            }
        }

        for (Long applicationPK : applicationPKSet) {
            addApplication.add(pk, applicationPK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(CategoryModelImpl.MAPPING_TABLE_MVP_APPLICATION_CATEGORY_NAME);
    }
}
项目:govapps    文件:RegionPersistenceImpl.java   
/**
 * Sets the applications associated with the region, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the region
 * @param applicationPKs the primary keys of the applications to be associated with the region
 * @throws SystemException if a system exception occurred
 */
public void setApplications(long pk, long[] applicationPKs)
    throws SystemException {
    try {
        Set<Long> applicationPKSet = SetUtil.fromArray(applicationPKs);

        List<de.fraunhofer.fokus.movepla.model.Application> applications = getApplications(pk);

        for (de.fraunhofer.fokus.movepla.model.Application application : applications) {
            if (!applicationPKSet.remove(application.getPrimaryKey())) {
                removeApplication.remove(pk, application.getPrimaryKey());
            }
        }

        for (Long applicationPK : applicationPKSet) {
            addApplication.add(pk, applicationPK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(RegionModelImpl.MAPPING_TABLE_MVP_APPLICATION_REGION_NAME);
    }
}
项目:govapps    文件:ApplicationPersistenceImpl.java   
/**
 * Sets the categories associated with the application, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the application
 * @param categoryPKs the primary keys of the categories to be associated with the application
 * @throws SystemException if a system exception occurred
 */
public void setCategories(long pk, long[] categoryPKs)
    throws SystemException {
    try {
        Set<Long> categoryPKSet = SetUtil.fromArray(categoryPKs);

        List<de.fraunhofer.fokus.movepla.model.Category> categories = getCategories(pk);

        for (de.fraunhofer.fokus.movepla.model.Category category : categories) {
            if (!categoryPKSet.remove(category.getPrimaryKey())) {
                removeCategory.remove(pk, category.getPrimaryKey());
            }
        }

        for (Long categoryPK : categoryPKSet) {
            addCategory.add(pk, categoryPK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(ApplicationModelImpl.MAPPING_TABLE_MVP_APPLICATION_CATEGORY_NAME);
    }
}
项目:govapps    文件:ApplicationPersistenceImpl.java   
/**
 * Sets the regions associated with the application, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the application
 * @param regionPKs the primary keys of the regions to be associated with the application
 * @throws SystemException if a system exception occurred
 */
public void setRegions(long pk, long[] regionPKs) throws SystemException {
    try {
        Set<Long> regionPKSet = SetUtil.fromArray(regionPKs);

        List<de.fraunhofer.fokus.movepla.model.Region> regions = getRegions(pk);

        for (de.fraunhofer.fokus.movepla.model.Region region : regions) {
            if (!regionPKSet.remove(region.getPrimaryKey())) {
                removeRegion.remove(pk, region.getPrimaryKey());
            }
        }

        for (Long regionPK : regionPKSet) {
            addRegion.add(pk, regionPK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(ApplicationModelImpl.MAPPING_TABLE_MVP_APPLICATION_REGION_NAME);
    }
}
项目:govapps    文件:ApplicationPersistenceImpl.java   
/**
 * Sets the languages associated with the application, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the application
 * @param languagePKs the primary keys of the languages to be associated with the application
 * @throws SystemException if a system exception occurred
 */
public void setLanguages(long pk, long[] languagePKs)
    throws SystemException {
    try {
        Set<Long> languagePKSet = SetUtil.fromArray(languagePKs);

        List<de.fraunhofer.fokus.movepla.model.Language> languages = getLanguages(pk);

        for (de.fraunhofer.fokus.movepla.model.Language language : languages) {
            if (!languagePKSet.remove(language.getPrimaryKey())) {
                removeLanguage.remove(pk, language.getPrimaryKey());
            }
        }

        for (Long languagePK : languagePKSet) {
            addLanguage.add(pk, languagePK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(ApplicationModelImpl.MAPPING_TABLE_MVP_APPLICATION_LANGUAGE_NAME);
    }
}
项目:govapps    文件:LanguagePersistenceImpl.java   
/**
 * Sets the applications associated with the language, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the language
 * @param applicationPKs the primary keys of the applications to be associated with the language
 * @throws SystemException if a system exception occurred
 */
public void setApplications(long pk, long[] applicationPKs)
    throws SystemException {
    try {
        Set<Long> applicationPKSet = SetUtil.fromArray(applicationPKs);

        List<de.fraunhofer.fokus.movepla.model.Application> applications = getApplications(pk);

        for (de.fraunhofer.fokus.movepla.model.Application application : applications) {
            if (!applicationPKSet.remove(application.getPrimaryKey())) {
                removeApplication.remove(pk, application.getPrimaryKey());
            }
        }

        for (Long applicationPK : applicationPKSet) {
            addApplication.add(pk, applicationPK);
        }
    } catch (Exception e) {
        throw processException(e);
    } finally {
        FinderCacheUtil.clearCache(LanguageModelImpl.MAPPING_TABLE_MVP_APPLICATION_LANGUAGE_NAME);
    }
}
项目:particity    文件:AHOfferPersistenceImpl.java   
/**
 * Sets the a h cat entrieses associated with the a h offer, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the a h offer
 * @param ahCatEntriesPKs the primary keys of the a h cat entrieses to be associated with the a h offer
 * @throws SystemException if a system exception occurred
 */
@Override
public void setAHCatEntrieses(long pk, long[] ahCatEntriesPKs)
    throws SystemException {
    Set<Long> newAHCatEntriesPKsSet = SetUtil.fromArray(ahCatEntriesPKs);
    Set<Long> oldAHCatEntriesPKsSet = SetUtil.fromArray(ahOfferToAHCatEntriesTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeAHCatEntriesPKsSet = new HashSet<Long>(oldAHCatEntriesPKsSet);

    removeAHCatEntriesPKsSet.removeAll(newAHCatEntriesPKsSet);

    for (long removeAHCatEntriesPK : removeAHCatEntriesPKsSet) {
        ahOfferToAHCatEntriesTableMapper.deleteTableMapping(pk,
            removeAHCatEntriesPK);
    }

    newAHCatEntriesPKsSet.removeAll(oldAHCatEntriesPKsSet);

    for (long newAHCatEntriesPK : newAHCatEntriesPKsSet) {
        ahOfferToAHCatEntriesTableMapper.addTableMapping(pk,
            newAHCatEntriesPK);
    }
}
项目:particity    文件:AHCatEntriesPersistenceImpl.java   
/**
 * Sets the a h subscriptions associated with the a h cat entries, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the a h cat entries
 * @param ahSubscriptionPKs the primary keys of the a h subscriptions to be associated with the a h cat entries
 * @throws SystemException if a system exception occurred
 */
@Override
public void setAHSubscriptions(long pk, long[] ahSubscriptionPKs)
    throws SystemException {
    Set<Long> newAHSubscriptionPKsSet = SetUtil.fromArray(ahSubscriptionPKs);
    Set<Long> oldAHSubscriptionPKsSet = SetUtil.fromArray(ahCatEntriesToAHSubscriptionTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeAHSubscriptionPKsSet = new HashSet<Long>(oldAHSubscriptionPKsSet);

    removeAHSubscriptionPKsSet.removeAll(newAHSubscriptionPKsSet);

    for (long removeAHSubscriptionPK : removeAHSubscriptionPKsSet) {
        ahCatEntriesToAHSubscriptionTableMapper.deleteTableMapping(pk,
            removeAHSubscriptionPK);
    }

    newAHSubscriptionPKsSet.removeAll(oldAHSubscriptionPKsSet);

    for (long newAHSubscriptionPK : newAHSubscriptionPKsSet) {
        ahCatEntriesToAHSubscriptionTableMapper.addTableMapping(pk,
            newAHSubscriptionPK);
    }
}
项目:particity    文件:AHCatEntriesPersistenceImpl.java   
/**
 * Sets the a h offers associated with the a h cat entries, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the a h cat entries
 * @param ahOfferPKs the primary keys of the a h offers to be associated with the a h cat entries
 * @throws SystemException if a system exception occurred
 */
@Override
public void setAHOffers(long pk, long[] ahOfferPKs)
    throws SystemException {
    Set<Long> newAHOfferPKsSet = SetUtil.fromArray(ahOfferPKs);
    Set<Long> oldAHOfferPKsSet = SetUtil.fromArray(ahCatEntriesToAHOfferTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeAHOfferPKsSet = new HashSet<Long>(oldAHOfferPKsSet);

    removeAHOfferPKsSet.removeAll(newAHOfferPKsSet);

    for (long removeAHOfferPK : removeAHOfferPKsSet) {
        ahCatEntriesToAHOfferTableMapper.deleteTableMapping(pk,
            removeAHOfferPK);
    }

    newAHOfferPKsSet.removeAll(oldAHOfferPKsSet);

    for (long newAHOfferPK : newAHOfferPKsSet) {
        ahCatEntriesToAHOfferTableMapper.addTableMapping(pk, newAHOfferPK);
    }
}
项目:particity    文件:AHSubscriptionPersistenceImpl.java   
/**
 * Sets the a h cat entrieses associated with the a h subscription, removing and adding associations as necessary. Also notifies the appropriate model listeners and clears the mapping table finder cache.
 *
 * @param pk the primary key of the a h subscription
 * @param ahCatEntriesPKs the primary keys of the a h cat entrieses to be associated with the a h subscription
 * @throws SystemException if a system exception occurred
 */
@Override
public void setAHCatEntrieses(long pk, long[] ahCatEntriesPKs)
    throws SystemException {
    Set<Long> newAHCatEntriesPKsSet = SetUtil.fromArray(ahCatEntriesPKs);
    Set<Long> oldAHCatEntriesPKsSet = SetUtil.fromArray(ahSubscriptionToAHCatEntriesTableMapper.getRightPrimaryKeys(
                pk));

    Set<Long> removeAHCatEntriesPKsSet = new HashSet<Long>(oldAHCatEntriesPKsSet);

    removeAHCatEntriesPKsSet.removeAll(newAHCatEntriesPKsSet);

    for (long removeAHCatEntriesPK : removeAHCatEntriesPKsSet) {
        ahSubscriptionToAHCatEntriesTableMapper.deleteTableMapping(pk,
            removeAHCatEntriesPK);
    }

    newAHCatEntriesPKsSet.removeAll(oldAHCatEntriesPKsSet);

    for (long newAHCatEntriesPK : newAHCatEntriesPKsSet) {
        ahSubscriptionToAHCatEntriesTableMapper.addTableMapping(pk,
            newAHCatEntriesPK);
    }
}
项目:edemocracia    文件:BBCodeParser.java   
public BBCodeParser() {
    _blockElements = SetUtil.fromArray(
        new String[] {
            "*", "center", "code", "justify", "left", "li", "list", "q",
            "quote", "right", "table", "td", "th", "tr"
        });

    _inlineElements = SetUtil.fromArray(
        new String[] {
            "b", "color", "font", "i", "img", "s", "size", "u", "url", "youtube"
        });

    _selfCloseElements = SetUtil.fromArray(new String[] {"*"});
}
项目:ch-inofix-timetracker    文件:BaseExportImportController.java   
protected void initXStream() {

        _xStream = new XStream(null, new XppDriver(), new ClassLoaderReference(
                XStreamConfiguratorRegistryUtil.getConfiguratorsClassLoader(XStream.class.getClassLoader())));

        _xStream.omitField(HashMap.class, "cache_bitmask");

        Set<XStreamConfigurator> xStreamConfigurators = XStreamConfiguratorRegistryUtil.getXStreamConfigurators();

        if (SetUtil.isEmpty(xStreamConfigurators)) {
            return;
        }

        List<String> allowedTypeNames = new ArrayList<>();

        for (XStreamConfigurator xStreamConfigurator : xStreamConfigurators) {
            List<XStreamAlias> xStreamAliases = xStreamConfigurator.getXStreamAliases();

            if (ListUtil.isNotEmpty(xStreamAliases)) {
                for (XStreamAlias xStreamAlias : xStreamAliases) {
                    _xStream.alias(xStreamAlias.getName(), xStreamAlias.getClazz());
                }
            }

            List<XStreamConverter> xStreamConverters = xStreamConfigurator.getXStreamConverters();

            if (ListUtil.isNotEmpty(xStreamConverters)) {
                for (XStreamConverter xStreamConverter : xStreamConverters) {
                    _xStream.registerConverter(new ConverterAdapter(xStreamConverter), XStream.PRIORITY_VERY_HIGH);
                }
            }

            List<XStreamType> xStreamTypes = xStreamConfigurator.getAllowedXStreamTypes();

            if (ListUtil.isNotEmpty(xStreamTypes)) {
                for (XStreamType xStreamType : xStreamTypes) {
                    allowedTypeNames.add(xStreamType.getTypeExpression());
                }
            }
        }

        // For default permissions, first wipe than add default

        _xStream.addPermission(NoTypePermission.NONE);

        // Add permissions

        _xStream.addPermission(PrimitiveTypePermission.PRIMITIVES);
        _xStream.addPermission(XStreamStagedModelTypeHierarchyPermission.STAGED_MODELS);

        _xStream.allowTypes(_XSTREAM_DEFAULT_ALLOWED_TYPES);

        _xStream.allowTypeHierarchy(List.class);
        _xStream.allowTypeHierarchy(Map.class);
        _xStream.allowTypeHierarchy(Timestamp.class);
        _xStream.allowTypeHierarchy(Set.class);

        _xStream.allowTypes(allowedTypeNames.toArray(new String[0]));

        _xStream.allowTypesByWildcard(new String[] { "com.thoughtworks.xstream.mapper.DynamicProxyMapper*" });
    }
项目:ch-inofix-contact-manager    文件:BaseExportImportController.java   
protected void initXStream() {

        _xStream = new XStream(null, new XppDriver(), new ClassLoaderReference(
                XStreamConfiguratorRegistryUtil.getConfiguratorsClassLoader(XStream.class.getClassLoader())));

        _xStream.omitField(HashMap.class, "cache_bitmask");

        Set<XStreamConfigurator> xStreamConfigurators = XStreamConfiguratorRegistryUtil.getXStreamConfigurators();

        if (SetUtil.isEmpty(xStreamConfigurators)) {
            return;
        }

        List<String> allowedTypeNames = new ArrayList<>();

        for (XStreamConfigurator xStreamConfigurator : xStreamConfigurators) {
            List<XStreamAlias> xStreamAliases = xStreamConfigurator.getXStreamAliases();

            if (ListUtil.isNotEmpty(xStreamAliases)) {
                for (XStreamAlias xStreamAlias : xStreamAliases) {
                    _xStream.alias(xStreamAlias.getName(), xStreamAlias.getClazz());
                }
            }

            List<XStreamConverter> xStreamConverters = xStreamConfigurator.getXStreamConverters();

            if (ListUtil.isNotEmpty(xStreamConverters)) {
                for (XStreamConverter xStreamConverter : xStreamConverters) {
                    _xStream.registerConverter(new ConverterAdapter(xStreamConverter), XStream.PRIORITY_VERY_HIGH);
                }
            }

            List<XStreamType> xStreamTypes = xStreamConfigurator.getAllowedXStreamTypes();

            if (ListUtil.isNotEmpty(xStreamTypes)) {
                for (XStreamType xStreamType : xStreamTypes) {
                    allowedTypeNames.add(xStreamType.getTypeExpression());
                }
            }
        }

        // For default permissions, first wipe than add default

        _xStream.addPermission(NoTypePermission.NONE);

        // Add permissions

        _xStream.addPermission(PrimitiveTypePermission.PRIMITIVES);
        _xStream.addPermission(XStreamStagedModelTypeHierarchyPermission.STAGED_MODELS);

        _xStream.allowTypes(_XSTREAM_DEFAULT_ALLOWED_TYPES);

        _xStream.allowTypeHierarchy(List.class);
        _xStream.allowTypeHierarchy(Map.class);
        _xStream.allowTypeHierarchy(Timestamp.class);
        _xStream.allowTypeHierarchy(Set.class);

        _xStream.allowTypes(allowedTypeNames.toArray(new String[0]));

        _xStream.allowTypesByWildcard(new String[] { "com.thoughtworks.xstream.mapper.DynamicProxyMapper*" });
    }
项目:ch-inofix-data-manager    文件:BaseExportImportController.java   
protected void initXStream() {

        _xStream = new XStream(null, new XppDriver(), new ClassLoaderReference(
                XStreamConfiguratorRegistryUtil.getConfiguratorsClassLoader(XStream.class.getClassLoader())));

        _xStream.omitField(HashMap.class, "cache_bitmask");

        Set<XStreamConfigurator> xStreamConfigurators = XStreamConfiguratorRegistryUtil.getXStreamConfigurators();

        if (SetUtil.isEmpty(xStreamConfigurators)) {
            return;
        }

        List<String> allowedTypeNames = new ArrayList<>();

        for (XStreamConfigurator xStreamConfigurator : xStreamConfigurators) {
            List<XStreamAlias> xStreamAliases = xStreamConfigurator.getXStreamAliases();

            if (ListUtil.isNotEmpty(xStreamAliases)) {
                for (XStreamAlias xStreamAlias : xStreamAliases) {
                    _xStream.alias(xStreamAlias.getName(), xStreamAlias.getClazz());
                }
            }

            List<XStreamConverter> xStreamConverters = xStreamConfigurator.getXStreamConverters();

            if (ListUtil.isNotEmpty(xStreamConverters)) {
                for (XStreamConverter xStreamConverter : xStreamConverters) {
                    _xStream.registerConverter(new ConverterAdapter(xStreamConverter), XStream.PRIORITY_VERY_HIGH);
                }
            }

            List<XStreamType> xStreamTypes = xStreamConfigurator.getAllowedXStreamTypes();

            if (ListUtil.isNotEmpty(xStreamTypes)) {
                for (XStreamType xStreamType : xStreamTypes) {
                    allowedTypeNames.add(xStreamType.getTypeExpression());
                }
            }
        }

        // For default permissions, first wipe than add default

        _xStream.addPermission(NoTypePermission.NONE);

        // Add permissions

        _xStream.addPermission(PrimitiveTypePermission.PRIMITIVES);
        _xStream.addPermission(XStreamStagedModelTypeHierarchyPermission.STAGED_MODELS);

        _xStream.allowTypes(_XSTREAM_DEFAULT_ALLOWED_TYPES);

        _xStream.allowTypeHierarchy(List.class);
        _xStream.allowTypeHierarchy(Map.class);
        _xStream.allowTypeHierarchy(Timestamp.class);
        _xStream.allowTypeHierarchy(Set.class);

        _xStream.allowTypes(allowedTypeNames.toArray(new String[0]));

        _xStream.allowTypesByWildcard(new String[] { "com.thoughtworks.xstream.mapper.DynamicProxyMapper*" });
    }