Example usage for java.util Collection addAll

List of usage examples for java.util Collection addAll

Introduction

In this page you can find the example usage for java.util Collection addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:com.hp.autonomy.searchcomponents.idol.parametricvalues.IdolParametricValuesService.java

@Override
public Set<QueryTagInfo> getAllParametricValues(final IdolParametricRequest parametricRequest)
        throws AciErrorException {
    final Collection<String> fieldNames = new HashSet<>();
    fieldNames.addAll(parametricRequest.getFieldNames());
    if (fieldNames.isEmpty()) {
        fieldNames.addAll(fieldsService.getParametricFields(new IdolFieldsRequest.Builder().build()));
    }/* w w  w .  j a v a2 s .c o m*/

    final Set<QueryTagInfo> results;
    if (fieldNames.isEmpty()) {
        results = Collections.emptySet();
    } else {
        final AciParameters aciParameters = new AciParameters(TagActions.GetQueryTagValues.name());
        parameterHandler.addSearchRestrictions(aciParameters, parametricRequest.getQueryRestrictions());

        if (parametricRequest.isModified()) {
            parameterHandler.addQmsParameters(aciParameters, parametricRequest.getQueryRestrictions());
        }

        aciParameters.add(GetQueryTagValuesParams.DocumentCount.name(), true);
        aciParameters.add(GetQueryTagValuesParams.MaxValues.name(), parametricRequest.getMaxValues());
        aciParameters.add(GetQueryTagValuesParams.FieldName.name(),
                StringUtils.join(fieldNames.toArray(), ','));
        aciParameters.add(GetQueryTagValuesParams.Sort.name(), SortParam.DocumentCount.name());

        final GetQueryTagValuesResponseData responseData = contentAciService.executeAction(aciParameters,
                queryTagValuesResponseProcessor);
        final List<FlatField> fields = responseData.getField();
        results = new LinkedHashSet<>(fields.size());
        for (final FlatField field : fields) {
            final List<JAXBElement<? extends Serializable>> valueElements = field.getValueOrSubvalueOrValues();
            final LinkedHashSet<QueryTagCountInfo> values = new LinkedHashSet<>(valueElements.size());
            for (final JAXBElement<?> element : valueElements) {
                if (VALUE_NODE_NAME.equals(element.getName().getLocalPart())) {
                    final TagValue tagValue = (TagValue) element.getValue();
                    values.add(new QueryTagCountInfo(tagValue.getValue(), tagValue.getCount()));
                }
            }
            final String fieldName = getFieldNameFromPath(field.getName().get(0));
            if (!values.isEmpty()) {
                results.add(new QueryTagInfo(fieldName, values));
            }
        }
    }

    return results;
}

From source file:com.acc.core.search.solrfacetsearch.provider.impl.GenderValueProvider.java

@Override
public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig,
        final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException {
    final ApparelProductModel apparelModel = getApparelProductModel(model);
    if (apparelModel == null) {
        return Collections.emptyList();
    }/*from  w ww.ja v a 2  s .co m*/

    final List<Gender> genders = apparelModel.getGenders();

    if (genders != null && !genders.isEmpty()) {
        final Collection<FieldValue> fieldValues = new ArrayList<FieldValue>();
        for (final Gender gender : genders) {
            fieldValues.addAll(createFieldValue(gender, indexedProperty));
        }
        return fieldValues;
    } else {
        return Collections.emptyList();
    }
}

From source file:edu.wisc.portlet.hrs.security.HrsPreAuthenticatedGrantedAuthoritiesUserDetailsService.java

@Override
protected UserDetails createuserDetails(Authentication token,
        Collection<? extends GrantedAuthority> authorities) {
    final PrimaryAttributePortletAuthenticationDetails details = (PrimaryAttributePortletAuthenticationDetails) token
            .getDetails();/*  w  w  w .jav  a 2 s .c  o m*/

    final String emplId = details.getPrimaryAttribute();
    final Set<String> hrsRoles = this.hrsRolesDao.getHrsRoles(emplId);

    final Collection<GrantedAuthority> additionalGrantedAuthorities = new ArrayList<GrantedAuthority>(
            hrsRoles.size() + authorities.size());
    additionalGrantedAuthorities.addAll(authorities);

    for (final String hrsRole : hrsRoles) {
        additionalGrantedAuthorities.add(new SimpleGrantedAuthority(hrsRole));
    }

    return super.createuserDetails(token, additionalGrantedAuthorities);
}

From source file:fr.cls.atoll.motu.library.misc.vfs.provider.gsiftp.GsiFtpFileSystem.java

/**
 * Adds the capabilities of this file system.
 * /*from w w w.j av  a2  s  . c om*/
 * @param caps the caps
 */
@Override
@SuppressWarnings("unchecked")
protected void addCapabilities(final Collection<Capability> caps) {
    caps.addAll(GsiFtpFileProvider.CAPABILITIES);
}

From source file:com.acc.core.search.solrfacetsearch.provider.impl.ColorFacetValueProvider.java

@Override
public Collection<FieldValue> getFieldValues(final IndexConfig indexConfig,
        final IndexedProperty indexedProperty, final Object model) throws FieldValueProviderException {
    final ApparelStyleVariantProductModel apparelStyleModel = getApparelStyleProductModel(model);
    if (apparelStyleModel == null) {
        return Collections.emptyList();
    }//www  . j  a v a2 s  .com

    final Set<SwatchColorEnum> colors = apparelStyleModel.getSwatchColors();

    if (colors != null && !colors.isEmpty()) {
        final Collection<FieldValue> fieldValues = new ArrayList<FieldValue>();
        for (final SwatchColorEnum color : colors) {
            fieldValues.addAll(createFieldValue(color, indexedProperty));
        }
        return fieldValues;
    } else {
        return Collections.emptyList();
    }
}

From source file:io.github.jeddict.orm.generator.compiler.ConstructorSnippet.java

@Override
public Collection<String> getImportSnippets() throws InvalidDataException {
    Collection<String> imports = new HashSet<>();
    for (VariableDefSnippet variableSnippet : allVariableSnippets) {
        imports.addAll(variableSnippet.getTypeImportSnippets());
    }//from  w w  w  . j av a2 s.c o  m
    return imports;
}

From source file:ar.com.fluxit.jqa.JQAEclipseRunner.java

private Collection<File> getClassFiles(IJavaProject javaProject) throws JavaModelException {
    Collection<File> result = new ArrayList<File>();
    File buildDir = JdtUtils.getAbsolutePath(javaProject.getOutputLocation());
    result.addAll(FileUtils.listFiles(buildDir, new SuffixFileFilter(RulesContextChecker.CLASS_SUFFIX),
            TrueFileFilter.INSTANCE));//from   w w  w .ja  va  2 s . co m
    return result;
}

From source file:com.cloudera.oryx.app.als.FeatureVectors.java

/**
 * Adds all IDs that are mapped to a feature vector to a given collection
 *
 * @param allIDs collection to add IDs to
 *//*from  w  ww .ja v a 2 s.  c om*/
public void addAllIDsTo(Collection<String> allIDs) {
    try (AutoLock al = lock.autoReadLock()) {
        allIDs.addAll(vectors.keySet());
    }
}

From source file:com.datos.vfs.provider.zip.ZipFileSystem.java

/**
 * Returns the capabilities of this file system.
 *//*from  w w w  .  j  av  a2s. co m*/
@Override
protected void addCapabilities(final Collection<Capability> caps) {
    caps.addAll(ZipFileProvider.capabilities);
}

From source file:com.cloudera.oryx.app.als.FeatureVectors.java

/**
 * Add all recently set IDs to the given collection
 *
 * @param allRecent collection to add IDs to
 *//* ww w.j a v a  2 s .co m*/
public void addAllRecentTo(Collection<String> allRecent) {
    try (AutoLock al = lock.autoReadLock()) {
        allRecent.addAll(recentIDs);
    }
}