@Override public boolean containsKey(Object key) { if (key == null || !(key instanceof String)) { return false; } return getIsValid((String)key); }
/** * Get the image file name based on the content type. * * @param contentType * The content type string. * @return The image file name based on the content type. */ public String getContentTypeImage(String contentType) { String image = DEFAULT_IMAGE; if (contentType != null && m_contentTypeImages.getIsValid(contentType.toLowerCase())) { image = m_contentTypeImages.getString(contentType.toLowerCase()); } return image; } // getContentTypeImage
/** * Get the font-awesome image class name based on the content type. * * @param contentType * The content type string. * @return The font-awesome image class name based on the content type. */ public String getContentTypeImageClass(String contentType) { String imageClass = DEFAULT_IMAGE_CLASS; if (contentType != null && m_contentTypeImageClasses.getIsValid(contentType.toLowerCase())) { imageClass = m_contentTypeImageClasses.getString(contentType.toLowerCase()); } return imageClass; } // getContentTypeImage
/** * Get the file extension value of the content type. * * @param contentType * The content type string. * @return The file extension value of the content type. */ public String getContentTypeExtension(String contentType) { String extension = DEFAULT_EXTENSION; if (contentType != null && m_contentTypeExtensions != null && m_contentTypeExtensions.getIsValid(contentType.toLowerCase())) { extension = m_contentTypeExtensions.getString(contentType.toLowerCase()); if (extension.indexOf(" ") != -1) { // possibility of multiple extensions for this MIME type, get one listed first extension = extension.substring(0, extension.indexOf(" ")); } } return extension; } // getContentTypeExtension
/** * Get the display name of the content type. * * @param contentType * The content type string. * @return The display name of the content type. */ public String getContentTypeDisplayName(String contentType) { String name = m_contentTypeDisplayNames.getString("contenttype.name.default"); if (contentType != null && m_contentTypeDisplayNames.getIsValid(contentType.toLowerCase())) { name = m_contentTypeDisplayNames.getString(contentType.toLowerCase()); } if (name == null || name.equals("")) { name = DEFAULT_DISPLAY_NAME; } return name; } // getContentTypeDisplayName
@Override public Map<String, SortedSet<String>> getAcceptableFileTypesToExtensions() { Map<String, SortedSet<String>> acceptableFileTypesToExtensions = new LinkedHashMap<>(); String[] acceptableFileTypes = getAcceptableFileTypes(); String[] acceptableFileExtensions = getAcceptableFileExtensions(); if (acceptableFileTypes != null && acceptableFileTypes.length > 0) { // The acceptable file types are listed in sakai.properties. Sakai.properties takes precedence. int min = Math.min(acceptableFileTypes.length, acceptableFileExtensions.length); for (int i = 0; i < min; i++) { appendToMap(acceptableFileTypesToExtensions, acceptableFileTypes[i], acceptableFileExtensions[i]); } } else { /* * acceptableFileTypes not specified in sakai.properties (this is normal). * Use ResourceLoader to resolve the file types. * If the resource loader doesn't find the file extenions, log a warning and return the [missing key...] messages */ ResourceLoader resourceLoader = new ResourceLoader("turnitin"); for( String fileExtension : acceptableFileExtensions ) { String key = KEY_FILE_TYPE_PREFIX + fileExtension; if (!resourceLoader.getIsValid(key)) { log.warn("While resolving acceptable file types for Turnitin, the sakai.property " + PROP_ACCEPTABLE_FILE_TYPES + " is not set, and the message bundle " + key + " could not be resolved. Displaying [missing key ...] to the user"); } String fileType = resourceLoader.getString(key); appendToMap( acceptableFileTypesToExtensions, fileType, fileExtension ); } } return acceptableFileTypesToExtensions; }
for( String fileExtension : acceptableFileExtensions ) { String key = KEY_FILE_TYPE_PREFIX + fileExtension; if (!resourceLoader.getIsValid(key)) { log.warn("While resolving acceptable file types for Turnitin, the sakai.property " + PROP_ACCEPTABLE_FILE_TYPES + " is not set, and the message bundle " + key + " could not be resolved. Displaying [missing key ...] to the user");
if (!resourceLoader.getIsValid(key))
if (!resourceLoader.getIsValid(key))