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:org.jasig.portlets.FeedbackPortlet.web.ViewFeedbackFormController.java

@RequestMapping
protected ModelAndView showForm(RenderRequest request) throws Exception {

    PortletSession session = request.getPortletSession();

    // if this is the first request, initialize the restriction information
    if (session.getAttribute("feedbackQueryParameters", session.APPLICATION_SCOPE) == null) {
        session.setAttribute("feedbackQueryParameters", new FeedbackQueryParameters(),
                session.APPLICATION_SCOPE);
    }//from  ww w  .j a va  2 s.c om

    FeedbackQueryParameters queryParameters = (FeedbackQueryParameters) session
            .getAttribute("feedbackQueryParameters", session.APPLICATION_SCOPE);

    int startNum;
    // this seems to overwrites whatever attribute is in session with what is in request.
    String start = request.getParameter("start");
    if (start != null && !start.equals("")) {
        startNum = Integer.parseInt(start);
        if (startNum < 0) {
            startNum = 0;
        }
        session.setAttribute("start", startNum);
        queryParameters.setPagingStart(startNum);
    }
    List<FeedbackItem> theFeedbackItems = feedbackStore.getFeedback(queryParameters);
    Map<String, Object> model = new HashMap<String, Object>();
    model.putAll(queryParameters.putIntoModelMap());
    model.put("totalItems", feedbackStore.getFeedbackTotal(queryParameters));
    // get the overall statistics for the feedback data
    model.put("stats", feedbackStore.getStats());

    // get the statistics for the feedback data separated by user role
    model.put("overallstats", feedbackStore.getStatsByRole());
    model.put("feedback", theFeedbackItems);
    model.put("datePickerFormat", DATEPICKER_FORMAT); // puts in the date picker format for use by the date picker.
    request.setAttribute("viewFeedbackForm", new ViewFeedbackForm());
    model.put("viewFeedbackForm", new ViewFeedbackForm());

    return new ModelAndView("/viewFeedback", model);
}

From source file:com.github.horrorho.inflatabledonkey.cloud.AssetPool.java

public Map<Asset, Optional<List<ByteString>>> put(StorageHostChunkList container,
        Collection<ByteString> chunkChecksums) {
    synchronized (lock) {
        if (assetChunks == null) {
            throw new IllegalStateException("not authorized");
        }//w w  w .j  av  a2 s  .  com
        Set<ByteString> missing = container.getChunkInfoList().stream().map(ChunkInfo::getChunkChecksum)
                .collect(toSet());
        missing.removeAll(chunkChecksums);
        logger.debug("-- debug() - missing: {}", missing);

        Map<Asset, Optional<List<ByteString>>> map = putElements(chunkChecksums);
        map.putAll(voidElements(missing));
        return map;
    }
}

From source file:com.abuabdul.mytravelpal.controller.MyTravelPalLandingController.java

@RequestMapping(value = "/secure/travel/loadTravelMode.go", produces = "application/json")
@ResponseBody//w  w  w  .  ja v a  2 s  . c o m
public String myTravelPalTravelMode(HttpServletResponse response) throws JsonProcessingException {
    log.debug("Entering myTravelPalTravelMode() in " + this.getClass().getName());
    Map<String, String> map = Maps.newHashMap();
    map.put("", "Select");
    map.putAll(travelModesMap);
    response.setStatus(HttpServletResponse.SC_OK);
    ObjectMapper mapper = new ObjectMapper();
    return mapper.writeValueAsString(map);
}

From source file:com.abuabdul.mytravelpal.controller.MyTravelPalLandingController.java

@RequestMapping(value = "/secure/travel/loadTravelType.go", produces = "application/json")
@ResponseBody/*from w  ww .ja  va  2s . c  om*/
public String myTravelPalTravelType(HttpServletResponse response) throws JsonProcessingException {
    log.debug("Entering myTravelPalTravelType() in " + this.getClass().getName());
    Map<String, String> map = Maps.newHashMap();
    map.put("", "Select");
    map.putAll(travelTypesMap);
    response.setStatus(HttpServletResponse.SC_OK);
    ObjectMapper mapper = new ObjectMapper();
    return mapper.writeValueAsString(map);
}

From source file:com.liveramp.cascading_ext.CascadingUtil.java

private FlowConnector realGetFlowConnector(Map<Object, Object> properties,
        List<FlowStepStrategy<JobConf>> flowStepStrategies) {
    //Add in default properties
    Map<Object, Object> combinedProperties = getDefaultProperties();
    combinedProperties.putAll(properties);

    //Add in default flow step strategies
    List<FlowStepStrategy<JobConf>> combinedStrategies = new ArrayList<FlowStepStrategy<JobConf>>(
            flowStepStrategies);/*from   w  w  w.  ja v a2 s.c  om*/
    for (FlowStepStrategyFactory<JobConf> flowStepStrategyFactory : defaultFlowStepStrategies) {
        combinedStrategies.add(flowStepStrategyFactory.getFlowStepStrategy());
    }

    return new LoggingFlowConnector(combinedProperties, new MultiFlowStepStrategy(combinedStrategies),
            OperationStatsUtils.formatStackPosition(OperationStatsUtils.getStackPosition(2)));
}

From source file:io.wcm.devops.conga.plugins.aem.postprocessor.ContentPackagePostProcessor.java

@Override
public List<FileContext> apply(FileContext fileContext, PostProcessorContext context) {
    File file = fileContext.getFile();
    Logger logger = context.getLogger();
    Map<String, Object> options = context.getOptions();

    try {//from w  w w  .  ja v a2 s  . c  o m
        // extract file header
        FileHeaderContext fileHeader = extractFileHeader(fileContext, context);

        // create AEM content package with configurations
        File zipFile = new File(file.getParentFile(), FilenameUtils.getBaseName(file.getName()) + ".zip");
        logger.info("Generate " + zipFile.getCanonicalPath());

        String rootPath = ContentPackageUtil.getMandatoryProp(options, PROPERTY_PACKAGE_ROOT_PATH);

        ContentPackageBuilder builder = ContentPackageUtil.getContentPackageBuilder(options, fileHeader);
        try (ContentPackage contentPackage = builder.build(zipFile)) {

            // add content from JSON file
            ContentElement content = jsonContentLoader.load(fileContext.getFile());
            contentPackage.addContent(rootPath, content);

            // add additional binary files
            for (ContentPackageBinaryFile binaryFile : ContentPackageUtil.getFiles(options)) {
                String path = binaryFile.getPath();
                try (InputStream is = binaryFile.getInputStream(context.getUrlFileManager(),
                        fileContext.getTargetDir())) {
                    contentPackage.addFile(path, is);
                }
                binaryFile.deleteIfRequired(context.getUrlFileManager(), fileContext.getTargetDir());
            }

        }

        // delete provisioning file after transformation
        file.delete();

        // set force to true by default for CONGA-generated packages (but allow override from role definition)
        Map<String, Object> modelOptions = new HashMap<>();
        modelOptions.put("force", true);
        modelOptions.putAll(fileContext.getModelOptions());

        return ImmutableList.of(new FileContext().file(zipFile).modelOptions(modelOptions));
    } catch (IOException ex) {
        throw new GeneratorException(
                "Unable to post-process JSON data file: " + FileUtil.getCanonicalPath(file), ex);
    }
}

From source file:se.uu.it.cs.recsys.ruleminer.impl.FPGrowthImpl.java

private Map<Set<Integer>, Integer> consolidatePatterns(Map<Set<Integer>, Integer> patternFromSinglePrefixPath,
        Map<Set<Integer>, Integer> patternFromBranchingTree) {

    if (patternFromSinglePrefixPath.isEmpty()) {
        return patternFromBranchingTree;
    }// www . j  a  va 2  s .c o m

    Map<Set<Integer>, Integer> consolidated = new HashMap<>();
    consolidated.putAll(patternFromSinglePrefixPath);
    consolidated.putAll(patternFromBranchingTree);
    consolidated.putAll(getCrossProduct(patternFromSinglePrefixPath, patternFromBranchingTree));

    return consolidated;
}

From source file:com.github.dactiv.fear.service.service.access.AccessService.java

/**
 * /*from www  .ja  v  a 2  s  .co  m*/
 *
 * @param pageRequest ?
 * @param filter      ?
 *
 * @return  Map 
 */
public Page<Map<String, Object>> findOrganizations(PageRequest pageRequest, Map<String, Object> filter) {
    long total = organizationDao.count(filter);
    filter.putAll(pageRequest.getMap());
    List<Map<String, Object>> content = findOrganizations(filter);
    return new Page<>(pageRequest, content, total);
}

From source file:com.googlecode.janrain4j.api.engage.EngagePartnerServiceImpl.java

public void verifyApplicationDomain(String apiKey, String providerName,
        Map<String, String> applicationDomainProperties) throws EngageFailureException, ErrorResponeException {
    Map<String, String> params = new HashMap<String, String>();
    params.put(API_KEY_PARAM, apiKey);//from  w w w  .  j  av  a  2  s.  co m
    params.put(PROVIDER_PARAM, providerName);
    params.putAll(applicationDomainProperties);
    apiCall(VERIFY_APP_DOMAIN_METHOD, params);
}

From source file:com.googlecode.janrain4j.api.engage.EngagePartnerServiceImpl.java

public void setProviderProperties(String apiKey, String providerName, Map<String, String> providerProperties)
        throws EngageFailureException, ErrorResponeException {
    Map<String, String> params = new HashMap<String, String>();
    params.put(API_KEY_PARAM, apiKey);/*ww  w.  ja v a 2  s.  c  o  m*/
    params.put(PROVIDER_PARAM, providerName);
    params.putAll(providerProperties);
    apiCall(SET_PROVIDER_PROPERTIES_METHOD, params);
}