@Override public String getFileExtension(String outputFormat) { if (fileExtensions.containsKey(outputFormat)) { return (String) fileExtensions.get(outputFormat); } if (mimeTypes.values().contains(outputFormat)) { return (String) fileExtensions.values().iterator().next(); } return null; }
@Override public String getMimeType(String outputFormat) { Utilities.ensureNonNull("outputFormat", outputFormat); if (mimeTypes.containsKey(outputFormat)) { return (String) mimeTypes.get(outputFormat); } if (mimeTypes.values().contains(outputFormat)) { return outputFormat; } return null; }
/** * {@inheritDoc} */ public boolean isThemeRegistered(final String theme) { return themes.containsKey(theme); }
public boolean has(String name) { return map.containsKey(name); } }
private boolean requestNeedsWrapper(HttpServletRequest requestHTTP) { String pathInfo = requestHTTP.getPathInfo(); Map<String, String[]> parameterMap = requestHTTP.getParameterMap(); return pathInfo != null && parameterMap != null && "GET".equalsIgnoreCase(requestHTTP.getMethod()) && !(new CaseInsensitiveMap(parameterMap).containsKey("service")) && (pathInfo.endsWith("search") || pathInfo.endsWith("description")); }
/** * Retrieve a value from an input-map with a lookup-key * @param key The lookup-key * @param map The input-map to look in * @param required If the key-value pair must be in the map. * @return The value of the key-value pair */ public static String getMapValue(String key, CaseInsensitiveMap map, boolean required) throws ExceptionReport{ if(map.containsKey(key)){ return ((String[]) map.get(key))[0]; }else if(!required){ LOGGER.warn("Parameter <" + key + "> not found."); return null; }else{ //Fix for Bug 904 https://bugzilla.52north.org/show_bug.cgi?id=904 throw new ExceptionReport("Parameter <" + key + "> not specified.", ExceptionReport.MISSING_PARAMETER_VALUE, key); } }
/** * Retrieve an array of values from an input-map with a lookup-key * @param key The lookup-key * @param map The input-map to look in * @param required If the key-value pair must be in the map. * @return The array of values of the key-value pair */ public static String[] getMapArray(String key, CaseInsensitiveMap map, boolean required) throws ExceptionReport{ if(map.containsKey(key)){ return (String[]) map.get(key); }else if(!required){ LOGGER.warn("Parameter <" + key + "> not found."); return null; }else{ //Fix for Bug 904 https://bugzilla.52north.org/show_bug.cgi?id=904 throw new ExceptionReport("Parameter <" + key + "> not specified.", ExceptionReport.MISSING_PARAMETER_VALUE, key); } }
/** * Helper method to ensure unique output column names. If allowDupsWithRename is set to true, the original name * will be appended with a suffix number to ensure uniqueness. Otherwise, the original column would not be renamed even * even if it has been used * * @param origName the original input name of the column * @param result the data structure to keep track of the used names and decide what output name should be * to ensure uniqueness * @param allowDupsWithRename if the original name has been used, is renaming allowed to ensure output name unique */ private void addToResultMaps(final String origName, final ClassifierResult result, final boolean allowDupsWithRename) { String name = origName; if (allowDupsWithRename) { name = getUniqueName(origName, result); } if (!result.outputMap.containsKey(name)) { result.outputNames.add(name); result.outputMap.put(name, name); } else { result.outputNames.add(EMPTY_STRING); } }
/** * Retrieve a value from an input-map with a lookup-key * @param key The lookup-key * @param map The input-map to look in * @param required If the key-value pair must be in the map. * @return The value of the key-value pair */ public static String getMapValue(String key, CaseInsensitiveMap map, boolean required, String[] supportedValues) throws ExceptionReport{ if(map.containsKey(key)){ String value = ((String[]) map.get(key))[0]; for (String string : supportedValues) { if(string.equalsIgnoreCase(value)){ return value; } } throw new ExceptionReport("Invalid value for parameter <" + key + ">.", ExceptionReport.INVALID_PARAMETER_VALUE, key); }else if(!required){ LOGGER.warn("Parameter <" + key + "> not found."); return null; }else{ //Fix for Bug 904 https://bugzilla.52north.org/show_bug.cgi?id=904 throw new ExceptionReport("Parameter <" + key + "> not specified.", ExceptionReport.MISSING_PARAMETER_VALUE, key); } }
} else if (key.equalsIgnoreCase("instance_key")) { document.setInstanceKey(kp.getValueString()); } else if (this.docTableCols.containsKey(key)) {
} else if (key.equalsIgnoreCase("instance_key")) { document.setInstanceKey(kp.getValueString()); } else if (this.docTableCols.containsKey(key)) {
if (!result.outputMap.containsKey(incomingName)) { result.outputNames.set(k, incomingName); result.outputMap.put(incomingName, incomingName);