Example usage for java.util LinkedHashMap keySet

List of usage examples for java.util LinkedHashMap keySet

Introduction

In this page you can find the example usage for java.util LinkedHashMap keySet.

Prototype

public Set<K> keySet() 

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:com.ephesoft.dcma.tabbed.TabbedPdfExporter.java

/**
 * //from  ww w  .  j  a v a 2 s .co m
 * This will create the PDFMarks file
 * 
 * @param sFolderToBeExported
 * @param pdfCreationParam
 * @param pdfOptimizationParam
 * @param pdfOptimizationSwitch
 * @param batchInstanceIdentifier
 * @param documentPDFMap
 * @throws DCMAApplicationException
 * 
 */
private void writePDFMarksFile(String sFolderToBeExported, String pdfCreationParam,
        String batchInstanceIdentifier, String pdfOptimizationParam, String pdfOptimizationSwitch,
        LinkedHashMap<String, List<String>> documentPDFMap) throws IOException, DCMAApplicationException {
    String gsCommand = getGSCommand();
    if (gsCommand == null) {
        LOGGER.info("No ghostcript command specified in properties file.  ghostcript command = " + gsCommand);
        throw new DCMAApplicationException(
                "No ghostcript command specified in properties file.  ghostcript command = " + gsCommand);
    }
    Set<String> documentNames;
    documentNames = documentPDFMap.keySet();
    Iterator<String> iterator = documentNames.iterator();
    List<String> documentPDFPaths = new ArrayList<String>();

    String documentId;
    Batch batch = batchSchemaService.getBatch(batchInstanceIdentifier);

    String pdfMarkTemplatePath = batchSchemaService.getAbsolutePath(batch.getBatchClassIdentifier(),
            batchSchemaService.getScriptConfigFolderName(), true);
    File pdfMarksSample = new File(
            pdfMarkTemplatePath + File.separator + TabbedPdfConstant.PDF_MARKS_FILE_NAME);
    if (!pdfMarksSample.exists()) {
        throw new DCMAApplicationException("Sample PdfMarks file not provided.");
    }
    File localPdfMarksSample = new File(batchSchemaService.getLocalFolderLocation() + File.separator
            + batchInstanceIdentifier + File.separator + pdfMarksSample.getName());
    try {
        FileUtils.copyFile(pdfMarksSample, localPdfMarksSample);
    } catch (Exception e) {
        throw new DCMAApplicationException("Exception in copying the file \""
                + localPdfMarksSample.getAbsolutePath() + "\" to \"" + pdfMarksSample.getAbsolutePath() + "\"",
                e);

    }
    String pdfBookMarkTemplate = TabbedPdfConstant.PDF_MARKS_TEMPLATE;
    FileWriter fileWriter = null;
    try {
        fileWriter = new FileWriter(localPdfMarksSample, true);
        String pdfBookMarkText = "";
        while (iterator.hasNext()) {
            documentId = iterator.next();
            List<String> docDetails = documentPDFMap.get(documentId);
            pdfBookMarkText = pdfBookMarkTemplate.replace(TabbedPdfConstant.BOOKMARK_TITLE_PLACEHOLDER,
                    docDetails.get(0));// page
            // bookmark
            pdfBookMarkText = pdfBookMarkText.replace(TabbedPdfConstant.BOOKMARK_PAGE_NUMBER_PLACEHOLDER,
                    docDetails.get(1));// page
            // title
            fileWriter.write(pdfBookMarkText + System.getProperty(TabbedPdfConstant.LINE_SEPARATOR));
            documentPDFPaths.add(docDetails.get(2));
        }
    } catch (IOException ioException) {
        throw new DCMAApplicationException("Exception in getting the FileWriter.", ioException);

    } finally {
        try {
            if (fileWriter != null) {
                fileWriter.close();
            }
        } catch (IOException e) {
            LOGGER.info("Unable to close the file stream for file:\"" + localPdfMarksSample.getAbsolutePath()
                    + "\"");
        }

    }
    BatchInstanceThread batchInstanceThread = new BatchInstanceThread(batchInstanceIdentifier);

    List<TabbedPDFExecutor> tabbedPDFExecutors = new ArrayList<TabbedPDFExecutor>();
    String batchName = "";
    Map<String, String> subPoenaLoanMap = getTabbedPdfName(batch.getDocuments().getDocument());
    if (null != subPoenaLoanMap && subPoenaLoanMap.size() == TabbedPdfConstant.MAX_NAME_FIELDS) {
        batchName = subPoenaLoanMap.get(TabbedPdfConstant.SUBPOENA) + TabbedPdfConstant.UNDERSCORE
                + subPoenaLoanMap.get(TabbedPdfConstant.LOAN_NUMBER);
    }
    if (batchName == null || batchName.isEmpty()) {
        batchName = batch.getBatchName();
    }
    String tabbedPDFName = batchName + "_" + batchInstanceIdentifier + FileType.PDF.getExtensionWithDot();
    String tabbedPDFTempFolder = batchSchemaService.getLocalFolderLocation() + File.separator
            + batchInstanceIdentifier;
    String tabbedPDFLocalPath = tabbedPDFTempFolder + File.separator + tabbedPDFName;
    if (pdfOptimizationSwitch != null && pdfOptimizationSwitch.equalsIgnoreCase(TabbedPdfConstant.ON)) {
        tabbedPDFExecutors.add(new TabbedPDFExecutor(tabbedPDFName, tabbedPDFTempFolder, documentPDFPaths,
                localPdfMarksSample.getAbsolutePath(), batchInstanceThread, pdfCreationParam, gsCommand));
    } else {
        tabbedPDFExecutors.add(new TabbedPDFExecutor(tabbedPDFName, sFolderToBeExported, documentPDFPaths,
                localPdfMarksSample.getAbsolutePath(), batchInstanceThread, pdfCreationParam, gsCommand));
    }
    try {
        LOGGER.info("Executing commands for creation of tabbed pdf using thread pool.");
        batchInstanceThread.execute();
        LOGGER.info("Tabbed pdf creation ends.");
    } catch (DCMAApplicationException dcmae) {
        LOGGER.error("Error in executing command for tabbed pdf using thread pool" + dcmae.getMessage(), dcmae);
        batchInstanceThread.remove();
        // Throw the exception to set the batch status to Error by Application aspect
        throw new DCMAApplicationException(dcmae.getMessage(), dcmae);
    }
    checkForPdfOptimizationSwitch(sFolderToBeExported, batchInstanceIdentifier, pdfOptimizationParam,
            pdfOptimizationSwitch, tabbedPDFName, tabbedPDFTempFolder);

    copyMultipagePdfInEphesoftSystemFolder(sFolderToBeExported, tabbedPDFName, tabbedPDFLocalPath);
    mergeBatchXmlDocs(batchSchemaService, batch, documentNames, documentPDFMap, tabbedPDFName);
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

/**
 * author: fliu, set Multilingual facet error messages attached to facets in the schema please refer to bug 0009157
 *///  w  w  w  .  j  av a2  s . c  o m
public boolean setFactMessage(LinkedHashMap<String, String> facts) {
    Iterator<String> isos = Util.iso2lang.keySet().iterator();
    while (isos.hasNext()) {
        String lang = isos.next();
        removeAppInfos("X_Facet_" + lang.toUpperCase());//$NON-NLS-1$
    }

    Iterator<String> isoIter = facts.keySet().iterator();
    while (isoIter.hasNext()) {
        String iso = isoIter.next();
        removeAppInfos("X_Facet_" + iso.toUpperCase());//$NON-NLS-1$
        addAppInfo("X_Facet_" + iso.toUpperCase(), facts.get(iso));//$NON-NLS-1$
    }

    hasChanged = true;
    return true;
}

From source file:com.amalto.workbench.utils.XSDAnnotationsStructure.java

/**
 * @author ymli set the formats; fix the bug:0013463
 * @param fomats/*from  ww  w  .ja v  a  2s  .c  o  m*/
 * @return
 */
public boolean setDisplayFormat(LinkedHashMap<String, String> fomats) {
    Iterator<String> isos = Util.iso2lang.keySet().iterator();
    while (isos.hasNext()) {
        String lang = isos.next();
        removeAppInfos("X_Display_Format_" + lang.toUpperCase());//$NON-NLS-1$
    }

    Iterator<String> isoIter = fomats.keySet().iterator();
    while (isoIter.hasNext()) {
        String iso = isoIter.next();
        removeAppInfos("X_Display_Format_" + iso.toUpperCase());//$NON-NLS-1$
        addAppInfo("X_Display_Format_" + iso.toUpperCase(), fomats.get(iso));//$NON-NLS-1$
    }

    hasChanged = true;
    return true;
}

From source file:controller.ViewPackageController.java

@RequestMapping(value = "/addToOrder/{packageID}/{productID}", method = RequestMethod.GET)
public String addToOrder(Authentication authen, HttpServletRequest req, ModelMap mm,
        @PathVariable(value = "packageID") int packageID, @PathVariable(value = "productID") int productID) {
    try {//from  w w  w  . j  av  a 2 s  . co  m
        LinkedHashMap<OderDetail, Requirement> orderSession = null;
        HttpSession session = req.getSession();
        Packages pack = packModel.getByID(packageID);
        Product product = pmodel.getByID(productID);
        Customer customer = cusModel.find(authen.getName(), "username", false).get(0);
        OderDetail od = new OderDetail();
        od.setPackages(pack);
        od.setPrice(pack.getPackagePrice());
        od.setQuantity(1);

        Requirement rq = null;
        if (product != null) {
            rq = new Requirement(new RequirementId(product.getProductId(), customer.getCustomerId(),
                    "generic" + new Random().nextInt()), customer, product, product.getProductPrice());
        }
        if (session.getAttribute("orderSession") == null) {
            orderSession = new LinkedHashMap<>();
            orderSession.put(od, rq);
            session.setAttribute("orderSession", orderSession);
        } else {
            boolean ck = false;
            orderSession = (LinkedHashMap<OderDetail, Requirement>) session.getAttribute("orderSession");
            for (OderDetail orderDt : orderSession.keySet()) {
                if (orderDt.getPackages().getPackageId() == od.getPackages().getPackageId()) {
                    orderDt.setQuantity(orderDt.getQuantity() + 1);
                    ck = true;
                    break;
                }
            }
            if (!ck) {
                orderSession.put(od, rq);
            }
            session.setAttribute("orderSession", orderSession);
        }
        mm.put("msg", "Added");
    } catch (Exception ex) {
        ex.printStackTrace();
        mm.put("msg", ex.getMessage());
    }
    return "addToOrder";
}

From source file:de.ipk_gatersleben.ag_pbi.mmd.visualisations.gradient.GradientDataChartComponent.java

private IntervalXYDataset createDataSet(SubstanceInterface xmldata, ChartOptions co) {

    YIntervalSeriesCollection dataset = new YIntervalSeriesCollection();

    LinkedHashMap<String, ArrayList<NumericMeasurementInterface>> name2measurement = new LinkedHashMap<String, ArrayList<NumericMeasurementInterface>>();

    for (NumericMeasurementInterface m : Substance3D.getAllFiles(new Experiment(xmldata))) {
        SampleInterface s = m.getParentSample();
        String name = s.getParentCondition().getExpAndConditionName() + ", " + ((Sample3D) s).getName();
        if (!name2measurement.containsKey(name))
            name2measurement.put(name, new ArrayList<NumericMeasurementInterface>());
        name2measurement.get(name).add(m);
        co.rangeAxis = (co.rangeAxis != null && co.rangeAxis.equals("[unit]")) ? m.getUnit() : co.rangeAxis;
        co.domainAxis = co.domainAxis != null && co.domainAxis.equals("[unit]")
                ? ((NumericMeasurement3D) m).getPositionUnit()
                : co.domainAxis;/*from   w  w  w . j av  a2  s  .  c om*/
    }

    for (String name : name2measurement.keySet()) {
        YIntervalSeries gradientvalues = new YIntervalSeries(name);
        ArrayList<NumericMeasurementInterface> measurements = name2measurement.get(name);
        if (measurements != null && measurements.size() > 0) {
            // calculate on the fly the mean value by putting together
            // measurements with the same position but different replicateID
            HashMap<Double, ArrayList<NumericMeasurementInterface>> position2measurement = new HashMap<Double, ArrayList<NumericMeasurementInterface>>();

            for (NumericMeasurementInterface m : measurements) {
                Double position = ((NumericMeasurement3D) m).getPosition();
                if (position != null) {
                    if (!position2measurement.containsKey(position))
                        position2measurement.put(position, new ArrayList<NumericMeasurementInterface>());
                    position2measurement.get(position).add(m);
                }
            }
            for (Double pos : position2measurement.keySet()) {
                double sum = 0;
                int cnt = 0;
                for (NumericMeasurementInterface m : position2measurement.get(pos)) {
                    sum += m.getValue();
                    cnt++;
                }
                if (cnt != 0) {
                    double mean = (1d * sum) / (1d * cnt);
                    double stddev = 0d;
                    for (NumericMeasurementInterface m : position2measurement.get(pos))
                        stddev += Math.pow(m.getValue() - mean, 2);
                    stddev = Math.sqrt(stddev);
                    if (stddev < 0)
                        stddev = 0;
                    gradientvalues.add(pos * 1d, mean, mean - stddev, mean + stddev);
                }
            }

        }

        dataset.addSeries(gradientvalues);
    }

    return dataset;
}

From source file:org.esigate.extension.surrogate.Surrogate.java

/**
 * <ul>//from  w  w w  .  ja v a 2 s . c o  m
 * <li>Inject H_X_ENABLED_CAPABILITIES into response.</li>
 * <li>Consume capabilities. Does not support targeting yet.</li>
 * <li>Update caching directives.</li>
 * </ul>
 * 
 * @param event
 *            Incoming fetch event.
 */
private void onPostFetch(Event event) {
    // Update caching policies
    FetchEvent e = (FetchEvent) event;

    String ourSurrogateId = e.getHttpRequest().getFirstHeader(H_X_SURROGATE_ID).getValue();

    SurrogateCapabilitiesHeader surrogateCapabilitiesHeader = SurrogateCapabilitiesHeader
            .fromHeaderValue(e.getHttpRequest().getFirstHeader(H_SURROGATE_CAPABILITIES).getValue());

    if (!e.getHttpResponse().containsHeader(H_SURROGATE_CONTROL)
            && surrogateCapabilitiesHeader.getSurrogates().size() > 1) {

        // Ensure another proxy can process the request

        LinkedHashMap<String, List<String>> targetCapabilities = new LinkedHashMap<String, List<String>>();
        initSurrogateMap(targetCapabilities, surrogateCapabilitiesHeader);
        for (String c : this.capabilities) {

            // Ignore Surrogate/1.0
            if ("Surrogate/1.0".equals(c)) {
                continue;
            }

            String firstSurrogate = getFirstSurrogateFor(surrogateCapabilitiesHeader, c);

            // firstSurrogate cannot be null since we are the last surrogate.
            targetCapabilities.get(firstSurrogate).add(c);
        }

        fixSurrogateMap(targetCapabilities, ourSurrogateId);

        StringBuilder sb = new StringBuilder();
        boolean firstDevice = true;
        for (String device : targetCapabilities.keySet()) {
            if (targetCapabilities.get(device).size() == 0) {
                continue;
            }

            if (!firstDevice) {
                sb.append(", ");
            } else {
                firstDevice = false;
            }

            sb.append("content=\"");
            boolean firstCap = true;
            for (String cap : targetCapabilities.get(device)) {
                if (!firstCap) {
                    sb.append(" ");
                } else {
                    firstCap = false;

                }
                sb.append(cap);

            }
            sb.append("\";");
            sb.append(device);

        }

        e.getHttpResponse().addHeader(H_SURROGATE_CONTROL, sb.toString());
    }

    if (!e.getHttpResponse().containsHeader(H_SURROGATE_CONTROL)) {
        return;
    }

    // If there is a Surrogate-Control header, add a Vary header to ensure content is not reuse when using a
    // different set of Surrogates
    e.getHttpResponse().addHeader("Vary", H_SURROGATE_CAPABILITIES);

    List<String> enabledCapabilities = new ArrayList<String>();
    List<String> remainingCapabilities = new ArrayList<String>();
    List<String> newSurrogateControlL = new ArrayList<String>();
    List<String> newCacheContent = new ArrayList<String>();

    String controlHeader = e.getHttpResponse().getFirstHeader(H_SURROGATE_CONTROL).getValue();
    String[] control = split(controlHeader, ",");

    for (String directiveAndTarget : control) {
        String directive = strip(directiveAndTarget);

        // Is directive targeted
        int targetIndex = directive.lastIndexOf(';');
        String target = null;

        if (targetIndex > 0) {
            target = directive.substring(targetIndex + 1);
            directive = directive.substring(0, targetIndex);
        }

        if (target != null && !target.equals(ourSurrogateId)) {
            // If directive is not targeted to current instance.
            newSurrogateControlL.add(strip(directiveAndTarget));

        } else if (directive.startsWith("content=\"")) {
            // Handle content

            String[] content = split(directive.substring("content=\"".length(), directive.length() - 1), " ");

            for (String contentCap : content) {
                contentCap = strip(contentCap);
                if (contains(this.capabilities, contentCap)) {
                    enabledCapabilities.add(contentCap);
                } else {
                    remainingCapabilities.add(contentCap);
                }
            }
            if (remainingCapabilities.size() > 0) {
                newSurrogateControlL.add("content=\"" + join(remainingCapabilities, " ") + "\"");
            }
        } else if (directive.startsWith("max-age=")) {
            String[] maxAge = split(directive, "+");
            newCacheContent.add(maxAge[0]);
            // Freshness extension
            if (maxAge.length > 1) {
                newCacheContent.add("stale-while-revalidate=" + maxAge[1]);
                newCacheContent.add("stale-if-error=" + maxAge[1]);
            }

            newSurrogateControlL.add(directive);
        } else if (directive.startsWith("no-store")) {
            newSurrogateControlL.add(directive);
            newCacheContent.add(directive);
        } else {
            newSurrogateControlL.add(directive);
        }
    }

    e.getHttpResponse().setHeader(H_X_ENABLED_CAPABILITIES, join(enabledCapabilities, " "));
    e.getHttpResponse().setHeader(H_X_NEXT_SURROGATE_CONTROL, join(newSurrogateControlL, ", "));

    // If cache control must be updated.
    if (newCacheContent.size() > 0) {
        MoveResponseHeader.moveHeader(e.getHttpResponse(), "Cache-Control", H_X_ORIGINAL_CACHE_CONTROL);
        e.getHttpResponse().setHeader("Cache-Control", join(newCacheContent, ", "));
    }
}

From source file:pt.lsts.neptus.util.logdownload.LogsDownloaderWorkerActions.java

private void orderAndFilterOutTheActiveLog(LinkedHashMap<FTPFile, String> retList) {
    if (retList.size() > 0) {
        String[] ordList = retList.values().toArray(new String[retList.size()]);
        Arrays.sort(ordList);//from www .  j av  a2s  . c  o  m
        String activeLogName = ordList[ordList.length - 1];
        for (FTPFile fFile : retList.keySet().toArray(new FTPFile[retList.size()])) {
            if (retList.get(fFile).equals(activeLogName)) {
                retList.remove(fFile);
                break;
            }
        }
    }
}

From source file:com.aliyun.odps.local.common.WareHouse.java

/**
 * copy resource from warehouse/__resources__/ to temp/resource/
 *
 * @param projName/*from w w w  . ja va 2 s .  co  m*/
 * @param resourceName
 * @param resourceRootDir
 * @param limitDownloadRecordCount
 * @param inputColumnSeperator
 * @throws IOException
 * @throws OdpsException
 */
public void copyResource(String projName, String resourceName, File resourceRootDir,
        int limitDownloadRecordCount, char inputColumnSeperator) throws IOException, OdpsException {
    if (StringUtils.isBlank(projName) || StringUtils.isBlank(resourceName) || resourceRootDir == null) {
        return;
    }

    if (!resourceRootDir.exists()) {
        resourceRootDir.mkdirs();
    }

    LOG.info("Start to copy resource: " + projName + "." + resourceName + "-->"
            + resourceRootDir.getAbsolutePath());

    if (!existsResource(projName, resourceName)) {
        DownloadUtils.downloadResource(getOdps(), projName, resourceName, limitDownloadRecordCount,
                inputColumnSeperator);
    }

    File file = getReourceFile(projName, resourceName);

    // table resource
    if (file.isDirectory()) {
        File tableResourceDir = new File(resourceRootDir, resourceName);

        TableInfo refTableInfo = getReferencedTable(projName, resourceName);
        LinkedHashMap<String, String> partitions = refTableInfo.getPartSpec();

        if (partitions != null && partitions.size() > 0) {
            PartitionSpec partSpec = new PartitionSpec();
            for (String key : partitions.keySet()) {
                partSpec.set(key, partitions.get(key));
            }
            copyTable(refTableInfo.getProjectName(), refTableInfo.getTableName(), partSpec, null,
                    tableResourceDir, limitDownloadRecordCount, inputColumnSeperator);
        } else {
            copyTable(refTableInfo.getProjectName(), refTableInfo.getTableName(), null, null, tableResourceDir,
                    limitDownloadRecordCount, inputColumnSeperator);
        }

    } else {
        // not table resource
        if (!existsResource(projName, resourceName)) {

            DownloadUtils.downloadResource(getOdps(), projName, resourceName, limitDownloadRecordCount,
                    inputColumnSeperator);
        }
        FileUtils.copyFileToDirectory(file, resourceRootDir);
    }

    LOG.info("Finished copy resource: " + projName + "." + resourceName + "-->"
            + resourceRootDir.getAbsolutePath());
}

From source file:org.daxplore.presenter.server.servlets.AdminUploadServlet.java

private static void unzipAll(PersistenceManager pm, String prefix, byte[] fileData)
        throws BadRequestException, InternalServerException {
    LinkedHashMap<String, byte[]> fileMap = new LinkedHashMap<>();

    try (ZipInputStream zipIn = ServerTools.getAsZipInputStream(fileData)) {
        // Unzip all the files and put them in a map
        try {/*  w  w  w .j  a  v  a  2s .  com*/
            ZipEntry entry;
            while ((entry = zipIn.getNextEntry()) != null) {
                if (!entry.isDirectory()) {
                    byte[] data = IOUtils.toByteArray(zipIn);
                    fileMap.put(entry.getName(), data);
                }
            }
        } catch (IOException e) {
            throw new BadRequestException("Error when reading uploaded file (invalid file?)", e);
        }

        // Read the file manifest to get metadata about the file
        if (!fileMap.containsKey("manifest.xml")) {
            throw new BadRequestException("No manifest.xml found in uploaded file");
        }

        try (InputStream manifestStream = new ByteArrayInputStream(fileMap.get("manifest.xml"))) {
            UploadFileManifest manifest = new UploadFileManifest(manifestStream);

            // Check manifest content and make sure that the file is in proper order

            if (!ServerTools.isSupportedUploadFileVersion(manifest.getVersionMajor(),
                    manifest.getVersionMinor())) {
                throw new BadRequestException("Unsupported file version");
            }

            Locale unsupportedLocale = null;
            for (Locale locale : manifest.getSupportedLocales()) {
                if (!ServerTools.isSupportedLocale(locale)) {
                    unsupportedLocale = locale;
                    break;
                }
            }
            if (unsupportedLocale != null) {
                //TODO move exception into the for-loop above if Eclipse/Java stops warning about it
                throw new BadRequestException("Unsupported language: " + unsupportedLocale.toLanguageTag());
            }
            Set<String> missingUploadFiles = SharedResourceTools.findMissingUploadFiles(fileMap.keySet(),
                    manifest.getSupportedLocales());
            if (!missingUploadFiles.isEmpty()) {
                throw new BadRequestException("Uploaded doesn't contain required files: "
                        + SharedTools.join(missingUploadFiles, ", "));
            }

            Set<String> unwantedUploadFiles = SharedResourceTools.findUnwantedUploadFiles(fileMap.keySet(),
                    manifest.getSupportedLocales());
            if (!unwantedUploadFiles.isEmpty()) {
                throw new BadRequestException(
                        "Uploaded file contains extra files: " + SharedTools.join(unwantedUploadFiles, ", "));
            }

            // Purge all existing data that uses this prefix, but save gaID
            String gaID = SettingItemStore.getProperty(pm, prefix, "adminpanel", "gaID");
            String statStoreKey = prefix + "#adminpanel/gaID";
            String deleteResult = DeleteData.deleteForPrefix(pm, prefix);
            pm.makePersistent(new SettingItemStore(statStoreKey, gaID));
            logger.log(Level.INFO, deleteResult);

            // Since we just deleted the prefix and all it's data, we have to add it
            // again
            pm.makePersistent(new PrefixStore(prefix));
            logger.log(Level.INFO, "Added prefix to system: '" + prefix + "'");

            LocaleStore localeStore = new LocaleStore(prefix, manifest.getSupportedLocales(),
                    manifest.getDefaultLocale());
            pm.makePersistent(localeStore);
            logger.log(Level.INFO, "Added locale settings for prefix '" + prefix + "'");

            for (String fileName : fileMap.keySet()) {
                String storeName = prefix + "#" + fileName;
                if (fileName.startsWith("properties/")) {
                    unpackPropertyFile(pm, storeName, fileMap.get(fileName));
                } else if (fileName.startsWith("data/")) {
                    unpackStatisticalDataFile(pm, prefix, fileMap.get(fileName));
                } else if (fileName.startsWith("meta/")) {
                    unpackStaticFile(pm, storeName, fileMap.get(fileName));
                }
            }
        } catch (BadRequestException e) {
            throw e;
        }
    } catch (IOException e) {
        throw new InternalServerException("Failed to close unzip file", e);
    }
}

From source file:com.spankingrpgs.model.characters.GameCharacter.java

/**
 * This constructor will compute the values of the secondary statistics using the modifySecondaryStatistics
 * method./*from   w  w w  .  ja v a  2 s . com*/
 * <p>
 * This constructor is best used when initializing a plain character, without any of their own special bonuses.
 *
 *  @param name  The name of the character
 * @param printedNames  The name to be displayed to the player
 * @param battleName  The battle name of the character
 * @param description  The description of the character
 * @param gender  The gender of the character
 * @param attackRanges  The ranges at which the character can attack
 * @param primaryStatistics  The character's primary statistics
 * @param secondaryStatisticNames  The names of the secondary statistics to be computed
 * @param appearance  The character's appearance
 * @param equipSlots  The slots into which the character can put equipment
 * @param skills  The character's skills
 * @param spankingEvents  This character's in-combat spanking text
 * @param role  The role this character tends to take in spankings
 */
public GameCharacter(String name, Map<Gender, String> printedNames, String battleName, String description,
        Gender gender, List<CombatRange> attackRanges, LinkedHashMap<String, Integer> primaryStatistics,
        List<String> secondaryStatisticNames, Map<String, AppearanceElement> appearance,
        LinkedHashMap<String, EquipSlot> equipSlots, Map<Skill, Integer> skills,
        Map<String, EventDescription> spankingEvents, SpankingRole role) {
    this(name, printedNames, battleName, description, gender, attackRanges, primaryStatistics,
            CollectionUtils.buildMap(secondaryStatisticNames.stream(), () -> 0), appearance, equipSlots, skills,
            spankingEvents, role);
    primaryStatistics.keySet().forEach(this::modifySecondaryStatistics);
}