Example usage for java.util Hashtable get

List of usage examples for java.util Hashtable get

Introduction

In this page you can find the example usage for java.util Hashtable get.

Prototype

@SuppressWarnings("unchecked")
public synchronized V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:com.hrs.controller.front.UpdateResumeController.java

private LanguageProficiency getLanguageProficiencyByOtherLanguage(String oneOtherLanguage) throws Exception {
    logger.info("enter getLanguageProficiencyByOtherLanguage method ");
    Hashtable<String, Integer> otherLanguageMap = MapTableArray.otherLanguageMap();
    LanguageProficiency languageProficiency = new LanguageProficiency();
    String[] allColumn = oneOtherLanguage.split("---");
    logger.info("allColumn by other language = " + allColumn[0]);
    languageProficiency.setLanguages(otherLanguageMap.get(allColumn[0].trim()));
    languageProficiency.setListen(allColumn[1]);
    if (allColumn.length == 3) {
        languageProficiency.setId(Integer.valueOf(allColumn[2]));
    }/* w w w  .j  a va 2s  .c om*/
    languageProficiency.setCreateDate(new Date());
    languageProficiency.setCreateUser("System");
    LanguageProficiencyDTO languageUTO = new LanguageProficiencyDTO();
    languageUTO.setLanguageType(allColumn[0]);
    languageUTO.setListen(allColumn[1]);

    languageUTO.setLocal(true);
    languageDtoList.add(languageUTO);

    return languageProficiency;
}

From source file:org.gridchem.client.gui.charts.UsageChart.java

/**
 * Returns a dataset representing the normalized usage of this project
 * on each resource in the CCG.  The values shown will be the current
 * usage on each resource, however, in terms of display, they will
 * appear as relative to each other.//from  w  ww  .  ja  v  a2 s. c  om
 * 
 * @param project
 * @return
 */
private DefaultPieDataset createResourceDataset(
        Hashtable<ProjectBean, List<CollaboratorBean>> projectCollabTable) {

    DefaultPieDataset pds = new DefaultPieDataset();

    Hashtable<String, Double> resourceUsageTable = new Hashtable<String, Double>();

    for (ProjectBean project : projectCollabTable.keySet()) {
        List<CollaboratorBean> collabs = projectCollabTable.get(project);

        for (CollaboratorBean collab : collabs) {

            for (String systemName : collab.getUsageTable().keySet()) {
                UsageBean usage = collab.getUsageTable().get(systemName);

                if (resourceUsageTable.containsKey(systemName)) {
                    double previousUsage = resourceUsageTable.get(systemName).doubleValue();
                    resourceUsageTable.remove(systemName);
                    resourceUsageTable.put(systemName, new Double(previousUsage + usage.getUsed()));
                } else {
                    resourceUsageTable.put(systemName, new Double(usage.getUsed()));
                }
            }
        }
    }

    // now put the tallies in the dataset
    for (String systemName : resourceUsageTable.keySet()) {
        pds.setValue(systemName, resourceUsageTable.get(systemName).doubleValue());
    }

    return pds;

    //        System.out.println("found specified collaborator " + collab.getLastName() + 
    //                " with " + collab.getUsageTable().size() + " resource records.");
    //        
    //        for(String key: collab.getUsageTable().keySet()) {
    //            pds.setValue(key, collab.getUsageTable().get(key).getUsed());
    //        }
    //        
    //        return pds;
}

From source file:io.cloudslang.content.database.services.dbconnection.DBConnectionManager.java

/**
 * clean any empty datasource and pool in the dbmsPool table.
 *///from   ww  w  .j  av  a  2s  .c o  m
public void cleanDataSources() {

    Hashtable<String, List<String>> removedDsKeyTable = null;

    //gather all the empty ds's key, can't remove item while iterate
    Enumeration<String> allPoolKeys = dbmsPoolTable.keys();
    while (allPoolKeys.hasMoreElements()) {
        String dbPoolKey = allPoolKeys.nextElement();
        Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(dbPoolKey);
        Enumeration<String> allDsKeys = dsTable.keys();
        while (allDsKeys.hasMoreElements()) {
            String dsKey = allDsKeys.nextElement();
            DataSource ds = dsTable.get(dsKey);

            //c3p0 impl
            if (ds != null && ds instanceof PooledDataSource) {
                PooledDataSource pDs = (PooledDataSource) ds;
                int conCount;
                try {
                    conCount = pDs.getNumConnectionsAllUsers();
                } catch (SQLException e) {
                    //                  todo      logger.error
                    //                                ("Failed to get total number of connections for datasource. dbmsPoolKey = "
                    //                                        + dbPoolKey, e);
                    continue;
                }
                //no connections
                if (conCount == 0) {
                    List<String> removedList = null;
                    if (removedDsKeyTable == null) {
                        removedDsKeyTable = new Hashtable<>();
                    } else {
                        removedList = removedDsKeyTable.get(dbPoolKey);
                    }

                    if (removedList == null) {
                        removedList = new ArrayList<>();
                        removedList.add(dsKey);
                        removedDsKeyTable.put(dbPoolKey, removedList);
                    } else {
                        removedList.add(dsKey);
                    }
                }
            }
        }
    }

    //have empty ds
    if (removedDsKeyTable != null && !removedDsKeyTable.isEmpty()) {
        Enumeration<String> removedPoolKeys = removedDsKeyTable.keys();
        while (removedPoolKeys.hasMoreElements()) {
            String removedPoolKey = removedPoolKeys.nextElement();
            PooledDataSourceProvider provider = this.getProvider(removedPoolKey);
            List<String> removedDsList = removedDsKeyTable.get(removedPoolKey);
            Hashtable<String, DataSource> dsTable = dbmsPoolTable.get(removedPoolKey);
            for (String dsKey : removedDsList) {
                DataSource removedDs = dsTable.remove(dsKey);
                try {
                    provider.closePooledDataSource(removedDs);
                } catch (SQLException e) {
                    //can't show the dsKey since it has encrypted password there
                    //                  todo      logger.error("Failed to close datadsource in dmbs poolKey = "
                    //                                + removedPoolKey, e);
                    continue;
                }

                //tracing
                //                todo    if (logger.isDebugEnabled()) {
                //                        logger.debug("Removed one datasource in dbms poolKey = "
                //                                + removedPoolKey);
                //                    }
            }
            //don't have any ds for the pool key
            if (dsTable.isEmpty()) {
                dbmsPoolTable.remove(removedPoolKey);
                //tracing
                //              todo      if (logger.isDebugEnabled()) {
                //                        logger.debug("Removed dbms poolKey = " + removedPoolKey);
                //                    }
            }
        }
    }
}

From source file:com.instantme.api.InstagramAPI.java

private String encodeUrl(Hashtable params) {

    StringBuffer encodedUrl = new StringBuffer();

    for (Enumeration elements = params.keys(); elements.hasMoreElements();) {
        String key = (String) elements.nextElement();
        String value = (String) params.get(key);
        //println("encodeUrl: " + key + "=" + value);
        encodedUrl.append(key);//from   www .j  ava 2  s.c om
        encodedUrl.append("=");
        encodedUrl.append(escapeUrl(value));
        encodedUrl.append("&");
    }
    // remove last "&"
    if (encodedUrl.length() > 0) {
        encodedUrl.deleteCharAt(encodedUrl.length() - 1);
    }

    return encodedUrl.toString();
}

From source file:jp.co.rakuten.rakutenvideoplayer.base.BaseActivity.java

public PlayResultModel changeHashTableToPlayResultMode(Hashtable<String, String> hashtable) {
    PlayResultModel playResultModel = new PlayResultModel();
    PlayResumeModel playResumeModel = new PlayResumeModel();
    PlayNextContentModel playNextContentModel = new PlayNextContentModel();
    PlaySessionModel playSessionModel = new PlaySessionModel();

    Enumeration<String> names;
    names = hashtable.keys();//from   w  ww  . j av a 2  s  .c  o m
    while (names.hasMoreElements()) {
        String key = (String) names.nextElement();
        DLog.i("DATABASE", key + ": " + hashtable.get(key));
        // Update value need
        if (key.equals("content_id"))
            playResultModel.setContent_id(hashtable.get(key));
        if (key.equals("content_name"))
            playResultModel.setContent_name(hashtable.get(key));
        if (key.equals("url"))
            playResultModel.setUrl(hashtable.get(key));
        if (key.equals("image_url"))
            playResultModel.setImage_url(hashtable.get(key));
        if (key.equals("r_enabled"))
            playResumeModel.setEnabled(hashtable.get(key));
        if (key.equals("r_polling_time"))
            playResumeModel.setPolling_time(hashtable.get(key));
        if (key.equals("r_position"))
            playResumeModel.setPosition(hashtable.get(key));
        if (key.equals("r_updated_at"))
            playResumeModel.setUpdated_at(hashtable.get(key));
        if (key.equals("ss_enabled"))
            playSessionModel.setEnabled(hashtable.get(key));
        if (key.equals("ss_token"))
            playSessionModel.setToken(hashtable.get(key));
        if (key.equals("nc_name"))
            playNextContentModel.setName(hashtable.get(key));
        if (key.equals("nc_url"))
            playNextContentModel.setUrl(hashtable.get(key));
        if (key.equals("nc_url_image"))
            playNextContentModel.setImage_url(hashtable.get(key));

        playResultModel.setResume(playResumeModel);
        playResultModel.setNext_content(playNextContentModel);
        playResultModel.setSingle_session(playSessionModel);
    }
    return playResultModel;

}

From source file:com.hrs.controller.front.UpdateResumeController.java

private LanguageProficiency getLanguageProficiencyByLanguage(String oneLanguage, int memberId)
        throws Exception {
    logger.info("enter getLanguageProficiencyByLanguage method ");
    Hashtable<String, Integer> languageMap = MapTableArray.languageMap();
    LanguageProficiency languageProficiency = new LanguageProficiency();
    LanguageCertificates tempCreateLanguageCertificates = new LanguageCertificates();
    String[] allColumn = oneLanguage.split("---");

    languageProficiency.setLanguages(languageMap.get(allColumn[0].trim()));
    languageProficiency.setListen(allColumn[1]);
    languageProficiency.setSay(allColumn[2]);
    languageProficiency.setReading(allColumn[3]);
    languageProficiency.setWrite(allColumn[4]);
    if (allColumn.length == 6) {
        logger.info("allColumn length is six. ");
        languageProficiency.setId(Integer.valueOf(allColumn[5]));
    } else if (allColumn.length == 7) {
        logger.info("allColumn length is seven. ");
        tempCreateLanguageCertificates.setName(allColumn[5]);
        tempCreateLanguageCertificates.setFraction(allColumn[6]);
        tempCreateLanguageCertificates.setMemberId(memberId);
    }/*from  w  w w .  jav  a 2 s  .  c o m*/
    languageProficiency.setCreateUser("System");
    languageProficiency.setCreateDate(new Date());

    LanguageProficiencyDTO languageUTO = new LanguageProficiencyDTO();
    languageUTO.setLanguageType(allColumn[0]);
    languageUTO.setListen(allColumn[1]);
    languageUTO.setSay(allColumn[2]);
    languageUTO.setReading(allColumn[3]);
    languageUTO.setWrite(allColumn[4]);
    languageUTO.setLocal(false);
    if (allColumn.length == 7) {
        logger.info("Certificate = " + allColumn[5]);
        logger.info("Fraction = " + allColumn[6]);
        languageUTO.setCertificate(allColumn[5]);
        languageUTO.setFraction(allColumn[6]);
    }
    languageDtoList.add(languageUTO);
    tempCreateLanguageCertificatesList.add(tempCreateLanguageCertificates);
    return languageProficiency;
}

From source file:Animator.java

/**
 * Fetch the sounds named in the argument. Is restartable.
 * /*from  w w  w.  j a  va  2  s  .  c o  m*/
 * @return URL of the first bogus file we hit, null if OK.
 */
URL fetchSounds(Hashtable sounds) {
    for (Enumeration e = sounds.keys(); e.hasMoreElements();) {
        Integer num = (Integer) e.nextElement();
        Object o = sounds.get(num);
        if (o instanceof URL) {
            URL file = (URL) o;
            tellLoadingMsg(file, soundLabel);
            try {
                sounds.put(num, getAudioClip(file));
            } catch (Exception ex) {
                return file;
            }
        }
    }
    return null;
}

From source file:it.greenvulcano.util.txt.TextUtils.java

/**
 * @param input//  w  w w  .  j  ava2  s .  c  om
 * @param phPrefix
 * @param phSuffix
 * @param phValues
 * @return the string with placeholders replaced
 * 
 */
public static String replacePlaceholder(String input, String phPrefix, String phSuffix,
        Hashtable<String, String> phValues) {
    if (input == null) {
        return null;
    }
    if (input.equals("")) {
        return "";
    }
    if (phValues == null) {
        return input;
    }
    if (phValues.isEmpty()) {
        return input;
    }
    if ((phPrefix == null) || (phSuffix == null)) {
        return input;
    }
    if ((phPrefix.equals("")) || (phSuffix.equals(""))) {
        return input;
    }

    int phPlen = phPrefix.length();
    int phSlen = phSuffix.length();
    int startNextToken = 0;
    int endNextToken = 0;
    int maxPosition = input.length();

    StringBuilder buf = new StringBuilder("");
    while (startNextToken < maxPosition) {
        endNextToken = input.indexOf(phPrefix, startNextToken);
        if (endNextToken != -1) {
            String currToken = input.substring(startNextToken, endNextToken);
            int endPH = input.indexOf(phSuffix, endNextToken + phPlen);
            String phName = input.substring(endNextToken + phPlen, endPH);
            String replacement = phPrefix + phName + phSuffix;
            Object phValue = phValues.get(phName);
            if (phValue != null) {
                replacement = StringEscapeUtils.unescapeJava(phValue.toString());
            }
            if (currToken.length() > 0) {
                buf.append(currToken).append(replacement);
            } else {
                buf.append(replacement);
            }
            startNextToken = endPH + phSlen;
        } else {
            String currToken = input.substring(startNextToken);
            buf.append(currToken);
            startNextToken = maxPosition;
        }
    }
    return buf.toString();
}

From source file:edu.ku.brc.specify.tools.datamodelgenerator.DataDict.java

protected void compareSchemas() {
    String[] skipTables = {//from   w  ww  . j  a  v  a  2  s .co m
            //"AccessionAgents",
            //"AccessionAuthorizations",
            "AgentAddress",
            //"Authors",
            "BiologicalObjectAttributes", "BiologicalObjectRelation", "BiologicalObjectRelationType",
            "BorrowAgents", "BorrowShipments", "CatalogSeriesDefinition", "Collection",
            //"CollectionObjectCatalog",
            "CollectionObjectType", "CollectionTaxonomyTypes",
            //"Collectors",
            "DATAVIEWS",
            //"DeaccessionAgents",
            //"DeaccessionCollectionObject",
            "GeologicTimeBoundary",
            //"GroupPersons",
            "Habitat", "Image", "ImageAgents", "ImageCollectionObjects", "ImageLocalities",
            //"LoanAgents",
            "Observation", "Preparation", "REPORTS", "RaveProject", "Sound", "SoundEventStorage", "TaxonName",
            "TaxonomicUnitType", "TaxonomyType", "WebAdmin",

    };

    String[] nameMapArray = {
            // Old Name                New Name
            "AccessionAgents", "AccessionAgent", "AccessionAuthorizations", "AccessionAuthorization", "Authors",
            "Author", "BorrowAgents", "BorrowAgent", "Collectors", "Collector", "CollectionObjectCatalog",
            "CollectionObject", "CollectionObject", "CollectionObject", "DeaccessionAgents", "DeaccessionAgent",
            "GroupPersons", "GroupPerson", "LoanAgents", "LoanAgent", "TaxonName", "Taxon",

    };

    Hashtable<String, String> nameMap = new Hashtable<String, String>();
    for (int i = 0; i < nameMapArray.length; i++) {
        nameMap.put(nameMapArray[i], nameMapArray[i + 1]);
        i++;
    }

    Hashtable<String, String> tablesToSkip = new Hashtable<String, String>();
    for (int i = 0; i < skipTables.length; i++) {
        tablesToSkip.put(skipTables[i], skipTables[i]);
    }

    Vector<String> okTables = new Vector<String>();

    DBTableIdMgr mgr = DBTableIdMgr.getInstance();

    for (TableDef tableDef : sp5Tables) {
        if (!tableDef.getName().startsWith("USYS") && tablesToSkip.get(tableDef.getName()) == null) {
            String tblName = nameMap.get(tableDef.getName());
            if (tblName == null) {
                tblName = tableDef.getName();
            }
            DBTableInfo tableInfo = mgr.getInfoByTableName(tblName.toLowerCase());
            if (tableInfo != null) {
                compareFields(tableDef, tableInfo, okTables);

            } else {
                System.err.println("Missing table [" + tableDef.getName() + "]");
            }
        }
    }

    System.out.println("\nTables passed:");
    for (String name : okTables) {
        System.out.println(name);
    }

    System.out.println("\nTables Skipped:");
    for (String name : skipTables) {
        System.out.println(name);
    }
}

From source file:dpfmanager.conformancechecker.tiff.reporting.HtmlReport.java

private String generateTagsDivs(IndividualReport ir) {
    Map<String, Boolean> hasExpert = new HashMap<>();
    Map<String, String> tagsMap = new HashMap<>();
    Map<String, String> templates = new HashMap<>();
    String row;//from w  w  w .  j  av a 2s.  c  o  m

    /**
     * Parse TAGs
     */
    for (ReportTag tag : getTags(ir)) {
        if (tag.tv.getId() == 700) {
            String mapId = "xmp" + tag.index;
            String mapIdH = "xmp" + tag.index + "h";
            // XMP
            for (abstractTiffType to : tag.tv.getValue()) {
                XMP xmp = (XMP) to;
                try {
                    Metadata metadata = xmp.createMetadata();
                    for (String key : metadata.keySet()) {
                        row = "<tr class='xmp" + tag.index + "'><td>" + key + "</td><td>"
                                + metadata.get(key).toString().trim() + "</td></tr>";
                        String rows = tagsMap.containsKey(mapId) ? tagsMap.get(mapId) : "";
                        tagsMap.put(mapId, rows + row);
                    }
                    if (xmp.getHistory() != null) {
                        for (Hashtable<String, String> kv : xmp.getHistory()) {
                            // TODO WORKARROUND
                            String key = kv.keySet().iterator().next();
                            String value = kv.get(key);
                            row = "<tr class='##LINE## xmp" + tag.index
                                    + "'><td>##ATTR##</td><td>##VALUE##</td></tr>";
                            if (key.equals("action")) {
                                row = row.replace("##LINE##", "line-top");
                            } else {
                                row = row.replace("##LINE##", "");
                            }
                            row = row.replace("##ATTR##", key);
                            row = row.replace("##VALUE##", value);
                            String rows = tagsMap.containsKey(mapIdH) ? tagsMap.get(mapIdH) : "";
                            tagsMap.put(mapIdH, rows + row);
                        }
                    }
                } catch (Exception ex) {
                    ex.printStackTrace();
                }
            }
            continue;
        }
        if (tag.tv.getId() == 34665) {
            // EXIF
            String mapId = "exi" + tag.index;
            IFD exif = (IFD) tag.tv.getValue().get(0);
            for (TagValue tv : exif.getTags().getTags()) {
                if (tv.getId() == 36864) {
                    tv.toString();
                }
                row = "<tr class='exi" + tag.index + "'><td>##ICON##</td><td class='tcenter'>" + tv.getId()
                        + "</td><td>" + (tv.getName().equals(tv.getId() + "") ? "Private tag" : tv.getName())
                        + "</td><td>" + tv.getDescriptiveValue() + "</td></tr>";
                row = row.replace("##ICON##",
                        "<i class=\"image-default icon-" + tv.getName().toLowerCase() + "\"></i>");
                String rows = tagsMap.containsKey(mapId) ? tagsMap.get(mapId) : "";
                tagsMap.put(mapId, rows + row);
            }
            continue;
        }
        if (tag.tv.getId() == 330) {
            // Sub IFD
            String mapId = "sub" + tag.index;
            IFD sub = (IFD) tag.tv.getValue().get(0);
            for (TagValue tv : sub.getTags().getTags()) {
                String expert = "";
                if (!showTag(tv)) {
                    expert = "expert";
                    hasExpert.put(mapId, true);
                }
                row = "<tr class='sub" + tag.index + " " + expert
                        + "'><td>##ICON##</td><td class='tcenter'>##ID##</td><td>##KEY##</td><td>##VALUE##</td></tr>";
                row = row.replace("##ICON##",
                        "<i class=\"image-default icon-" + tv.getName().toLowerCase() + "\"></i>");
                row = row.replace("##ID##", tv.getId() + "");
                row = row.replace("##KEY##",
                        (tv.getName().equals(tv.getId() + "") ? "Private tag" : tv.getName()));
                row = row.replace("##VALUE##", tv.getDescriptiveValue());
                String rows = tagsMap.containsKey(mapId) ? tagsMap.get(mapId) : "";
                tagsMap.put(mapId, rows + row);
            }
            continue;
        }
        if (tag.tv.getId() == 33723) {
            String mapId = "ipt" + tag.index;
            // IPTC
            for (abstractTiffType to : tag.tv.getValue()) {
                try {
                    IPTC iptc = (IPTC) to;
                    Metadata metadata = iptc.createMetadata();
                    for (String key : metadata.keySet()) {
                        row = "<tr class='ipt" + tag.index + "'><td>" + key + "</td><td>"
                                + metadata.get(key).toString().trim() + "</td></tr>";
                        String rows = tagsMap.containsKey(mapId) ? tagsMap.get(mapId) : "";
                        tagsMap.put(mapId, rows + row);
                    }
                } catch (Exception ex) {
                    ex.toString();
                    //ex.printStackTrace();
                }
            }
            continue;
        }
        // IFD
        String mapId = "ifd" + tag.index;
        String expert = "";
        if (tag.expert) {
            expert = " expert";
            hasExpert.put(mapId, true);
        }
        row = "<tr class='ifd" + tag.index + " " + expert
                + "'><td>##ICON##</td><td class='tcenter'>##ID##</td><td>##KEY##</td><td>##VALUE##</td></tr>";
        String sDif = "";
        if (tag.dif < 0)
            sDif = "<i class=\"fa fa-times\"></i>";
        else if (tag.dif > 0)
            sDif = "<i class=\"fa fa-plus\"></i>";
        row = row.replace("##ICON##",
                "<i class=\"image-default icon-" + tag.tv.getName().toLowerCase() + "\"></i>");
        row = row.replace("##ID##", tag.tv.getId() + sDif);
        row = row.replace("##KEY##",
                (tag.tv.getName().equals(tag.tv.getId()) ? "Private tag" : tag.tv.getName()));
        row = row.replace("##VALUE##", tag.tv.getDescriptiveValue());
        String rows = tagsMap.containsKey(mapId) ? tagsMap.get(mapId) : "";
        tagsMap.put(mapId, rows + row);
    }

    /**
     * Generate divs
     */
    String finalResult = "";
    String expertTmpl = "<div class=\"clexpert\"><input type=\"checkbox\" id=\"checkSelected##INDEX##\" onchange=\"expertChanged('##INDEX##')\"><label for=\"checkSelected##INDEX##\"><span></span> Expert mode</label></div>";
    String genTmpl = "<div id=\"div##INDEX##\" class=\"tags-divs col-md-8\" style='display: ##DISPLAY##'>\n"
            + "\t\t\t\t\t##EXPERT##\n"
            + "\t\t\t\t\t<h4 class='bold'><i class=\"fa fa-tags\"></i>  ##TITLE##</h4>\n"
            + "\t\t\t\t\t<table class=\"CustomTable3\">\n" + "\t\t\t\t        <tr>\n"
            + "\t\t\t\t            <th style=\"width: 40px;\"></th>\n"
            + "\t\t\t\t            <th style=\"width: 70px;\" class=\"bold tcenter\">Tag Id</th>\n"
            + "\t\t\t\t            <th class=\"bold\">Tag Name</th>\n"
            + "\t\t\t\t            <th class=\"bold\">Value</th>\n" + "\t\t\t\t        </tr>\n"
            + "\t\t\t\t        ##ROWS##\n" + "\t\t\t\t\t</table>\n" + "\t\t\t\t</div>";
    String subTmpl = StringUtils.replace(genTmpl, "##TITLE##", "Sub IFD Tags");
    String ifdTmpl = StringUtils.replace(genTmpl, "##TITLE##", "IFD Tags");
    String exifTmpl = StringUtils.replace(genTmpl, "##TITLE##", "EXIF");
    String iptcTmpl = "<div id=\"div##INDEX##\" class=\"tags-divs col-md-8\" style='display: ##DISPLAY##'>\n"
            + "\t\t\t\t\t##EXPERT##\n" + "\t\t\t\t\t<h4 class='bold'><i class=\"fa fa-tags\"></i>  IPTC</h4>\n"
            + "\t\t\t\t\t<table class=\"CustomTable3\">\n" + "\t\t\t\t        <tr>\n"
            + "\t\t\t\t            <th class=\"bold\">Name</th>\n"
            + "\t\t\t\t            <th class=\"bold\">Value</th>\n" + "\t\t\t\t        </tr>\n"
            + "\t\t\t\t        ##ROWS##\n" + "\t\t\t\t\t</table>\n" + "\t\t\t\t</div>";
    String xmpTmpl = "<div id=\"div##INDEX##\" class=\"tags-divs col-md-8\" style='display: ##DISPLAY##'>\n"
            + "\t\t\t\t\t##EXPERT##\n" + "\t\t\t\t\t<h4 class='bold'><i class=\"fa fa-tags\"></i>  XMP</h4>\n"
            + "\t\t\t\t\t<table class=\"CustomTable3\">\n" + "\t\t\t\t        <tr>\n"
            + "\t\t\t\t            <th class=\"bold\">Name</th>\n"
            + "\t\t\t\t            <th class=\"bold\">Value</th>\n" + "\t\t\t\t        </tr>\n"
            + "\t\t\t\t        ##ROWS##\n" + "\t\t\t\t\t</table>\n"
            + "\t\t\t\t\t<div style='display: ##DISH##;' class='top20'>\n"
            + "\t\t\t\t\t<h4 class='bold'><i class=\"fa fa-history\"></i>  History</h4>\n"
            + "\t\t\t\t\t<table class=\"CustomTable3\">\n" + "\t\t\t\t        <tr>\n"
            + "\t\t\t\t            <th class=\"bold\">Attribute</th>\n"
            + "\t\t\t\t            <th class=\"bold\">Value</th>\n" + "\t\t\t\t        </tr>\n"
            + "\t\t\t\t        ##ROWSH##\n" + "\t\t\t\t\t</table>\n" + "\t\t\t\t\t</div>\n" + "\t\t\t\t</div>";
    templates.put("ifd", ifdTmpl);
    templates.put("sub", subTmpl);
    templates.put("ipt", iptcTmpl);
    templates.put("xmp", xmpTmpl);
    templates.put("exi", exifTmpl);

    /**
     * Generate HTMLs
     */
    for (String key : tagsMap.keySet()) {
        if (key.endsWith("h"))
            continue;
        String type = key.substring(0, 3);
        String display = "none;", expert = "";
        if (key.equals("ifd0"))
            display = "block;";
        if (hasExpert.containsKey(key))
            expert = expertTmpl;
        String tmpl = templates.get(type);
        tmpl = StringUtils.replace(tmpl, "##EXPERT##", expert);
        tmpl = StringUtils.replace(tmpl, "##INDEX##", key);
        tmpl = StringUtils.replace(tmpl, "##DISPLAY##", display);
        tmpl = StringUtils.replace(tmpl, "##ROWS##", tagsMap.get(key));
        if (type.equals("xmp") && tagsMap.containsKey(key + "h")) {
            tmpl = StringUtils.replace(tmpl, "##ROWSH##", tagsMap.get(key + "h"));
            tmpl = StringUtils.replace(tmpl, "##DISH##", "block");
        } else {
            tmpl = StringUtils.replace(tmpl, "##DISH##", "none");
        }
        finalResult += tmpl;
    }
    return finalResult;
}