Example usage for java.util Map putAll

List of usage examples for java.util Map putAll

Introduction

In this page you can find the example usage for java.util Map putAll.

Prototype

void putAll(Map<? extends K, ? extends V> m);

Source Link

Document

Copies all of the mappings from the specified map to this map (optional operation).

Usage

From source file:fr.inria.atlanmod.neoemf.map.datastore.MapPersistenceBackendFactory.java

@SuppressWarnings({ "unchecked", "rawtypes" })
@Override//from   ww w  . j a va2  s .c o m
public void copyBackend(PersistenceBackend from, PersistenceBackend to) {
    assert from instanceof MapPersistenceBackend : "The backend to copy is not an instance of MapPersistenceBackend";
    assert to instanceof MapPersistenceBackend : "The target copy backend is not an instance of MapPersistenceBackend";
    MapPersistenceBackend mapFrom = (MapPersistenceBackend) from;
    MapPersistenceBackend mapTo = (MapPersistenceBackend) to;
    Map<String, Object> fromAll = mapFrom.getAll();
    for (String fromKey : fromAll.keySet()) {
        Object collection = fromAll.get(fromKey);
        if (collection instanceof Map) {
            Map fromMap = (Map) collection;
            Map toMap = mapTo.getHashMap(fromKey);
            toMap.putAll(fromMap);
        } else {
            throw new UnsupportedOperationException("Cannot copy Map backend: store type "
                    + collection.getClass().getSimpleName() + " is not supported");
        }
    }
}

From source file:com.liferay.ci.jenkins.cache.LiferayJenkinsBuildCache.java

public void putAll(String portletId, Map<? extends String, ? extends JSONArray> m) {

    Map<String, JSONArray> portletCache = _getPortletCache(portletId);

    portletCache.putAll(m);
}

From source file:org.parancoe.web.ContextListener.java

/**
 * Populate the "daoMap" bean with the DAOs defined in the context.
 *//* w ww .  j av a2 s  . c o  m*/
@SuppressWarnings("unchecked")
protected void populateDaoMap(XmlWebApplicationContext ctx) {
    Map daoMap = (Map) ctx.getBean("daoMap");
    Map daos = DaoUtils.getDaos(ctx);
    daoMap.putAll(daos);
}

From source file:com.redhat.lightblue.config.DataSourcesConfiguration.java

/**
 * Returns all datasources// w w  w . j  a v a  2  s  .c  o m
 */
public Map<String, DataSourceConfiguration> getDataSources() {
    Map<String, DataSourceConfiguration> map = new HashMap<>();
    map.putAll(datasources);
    return map;
}

From source file:de.jcup.egradle.codeassist.dsl.FilesystemFileLoader.java

@Override
public Map<String, String> loadApiMappings() throws IOException {
    Map<String, String> alternative;
    Map<String, String> origin;
    /* first load alternate origin mapping */
    File apiMappingFile = new File(dslFolder, "api-mapping.txt");
    try (InputStream stream = new FileInputStream(apiMappingFile)) {
        origin = apiMappingImporter.importMapping(stream);
    }// w  ww .j  av a  2 s. c o  m
    File alternativeApiMappingFile = new File(dslFolder, "alternative-api-mapping.txt");
    if (!alternativeApiMappingFile.exists()) {
        return origin;
    }
    try (InputStream stream = new FileInputStream(alternativeApiMappingFile)) {
        alternative = apiMappingImporter.importMapping(stream);
    }
    /* merge results, origin api wins, if there are conflicts */
    Map<String, String> result = alternative;
    result.putAll(origin);
    return result;
}

From source file:io.mapzone.arena.csw.catalog.ProjectNodeSynchronizer.java

protected Map<String, String> layerConnectionParams(ILayer layer) {
    String wmsUrl = serviceBaseUrl() + "?service=WMS";
    Map<String, String> params = new HashMap();
    params.putAll(WmsResourceResolver.createParams(wmsUrl, GeoServerUtils.simpleName(layer.label.get())));
    //params.put( "WMS", "This service provides image data. Style and data cannot be modified." );
    return params;
}

From source file:jetbrains.buildServer.runner.elasticbeanstalk.ElasticBeanstalkRunType.java

@NotNull
@Override//from   w  w w .  java2s.  c  om
public Map<String, String> getDefaultRunnerProperties() {
    final Map<String, String> defaults = new HashMap<String, String>();
    defaults.putAll(myAWSCommonParams.getDefaults());
    return defaults;
}

From source file:org.alfresco.mobile.android.api.services.impl.AbstractDocumentFolderServiceImpl.java

/**
 * Utility method to convert Alfresco Content Model Properties ID into CMIS
 * properties ID.//from   www  .jav a 2  s.  c  o m
 * 
 * @param properties : A possible mix of cmis and content model properties
 *            id.
 * @param typeId : Type Id of the node.
 */
private static Map<String, Serializable> convertProps(Map<String, Serializable> properties, String typeId) {

    Map<String, Serializable> tmpProperties = new HashMap<String, Serializable>();
    if (properties != null) {
        tmpProperties.putAll(properties);
    }

    // Transform Alfresco properties to cmis properties
    for (Entry<String, String> props : ALFRESCO_TO_CMIS.entrySet()) {
        if (tmpProperties.containsKey(props.getKey())) {
            tmpProperties.put(props.getValue(), tmpProperties.get(props.getKey()));
            tmpProperties.remove(props.getKey());
        }
    }

    // Take ObjectId provided in map or the default one provided by the
    // method
    String objectId = null;
    if (tmpProperties.containsKey(PropertyIds.OBJECT_TYPE_ID)) {
        objectId = (String) tmpProperties.get(PropertyIds.OBJECT_TYPE_ID);
    } else {
        if (ContentModel.TYPE_CONTENT.equals(typeId)) {
            objectId = BaseTypeId.CMIS_DOCUMENT.value();
        } else if (ContentModel.TYPE_FOLDER.equals(typeId)) {
            objectId = BaseTypeId.CMIS_FOLDER.value();
        } else {
            objectId = typeId;
        }
    }

    // add aspects flags to objectId
    for (Entry<String, String> props : ALFRESCO_ASPECTS.entrySet()) {
        if (tmpProperties.containsKey(props.getKey()) && !objectId.contains(props.getValue())) {
            objectId = objectId.concat("," + props.getValue());
        }
    }

    // Log.d(TAG, objectId);

    tmpProperties.put(PropertyIds.OBJECT_TYPE_ID, objectId);

    return tmpProperties;
}

From source file:eu.europa.ec.fisheries.uvms.reporting.service.bean.impl.AlarmServiceBean.java

private ObjectNode createGeoJsonWithAlarmProperties(List<TicketAndRuleType> ticketAndRules,
        List<AlarmMovement> alarmMovements, String userName) throws ReportingServiceException {
    ticketAndRules = AlarmHelper.removeRestrictedTickets(ticketAndRules, userName);
    List<Asset> assets = getAssets(ticketAndRules);
    GeoJsonBuilder geoJsonBuilder = new GeoJsonBuilder();
    for (TicketAndRuleType ticketAndRule : ticketAndRules) {
        Map<String, Double> coordinates = getPointCoordinates(alarmMovements,
                ticketAndRule.getTicket().getMovementGuid());
        Map<String, Object> properties = AlarmHelper.getAlarmProperties(ticketAndRule, assets);
        properties.putAll(AlarmHelper.getAssetProperties(assets, ticketAndRule.getTicket().getAssetGuid()));
        geoJsonBuilder.addFeatureToCollection(properties, coordinates);
    }/*from w  ww.  jav a2s  . c o m*/
    return geoJsonBuilder.toJson();
}

From source file:springfox.documentation.schema.DefaultModelProvider.java

@Override
public com.google.common.base.Optional<Model> modelFor(ModelContext modelContext) {
    ResolvedType propertiesHost = modelContext.alternateFor(modelContext.resolvedType(resolver));
    if (isContainerType(propertiesHost) || isMapType(propertiesHost) || propertiesHost.getErasedType().isEnum()
            || isBaseType(Types.typeNameFor(propertiesHost.getErasedType()))
            || modelContext.hasSeenBefore(propertiesHost)) {
        LOG.debug(//from  w ww .j  av a2  s  .c  o  m
                "Skipping model of type {} as its either a container type, map, enum or base type, or its already "
                        + "been handled",
                resolvedTypeSignature(propertiesHost).or("<null>"));
        return Optional.absent();
    }
    ImmutableMap<String, ModelProperty> propertiesIndex = uniqueIndex(properties(modelContext, propertiesHost),
            byPropertyName());
    LOG.debug("Inferred {} properties. Properties found {}", propertiesIndex.size(),
            Joiner.on(", ").join(propertiesIndex.keySet()));
    Map<String, ModelProperty> properties = newTreeMap();
    properties.putAll(propertiesIndex);
    return Optional.of(modelBuilder(propertiesHost, properties, modelContext));
}