public static String getFilename(DocumentModel doc, DocumentView docView) { String filename = docView.getParameter(FILENAME_KEY); if (filename == null) { // try to get it from document String propertyPath = docView.getParameter(FILE_PROPERTY_PATH_KEY); String propertyName = DocumentModelUtils.decodePropertyName(propertyPath); if (propertyName != null) { filename = (String) DocumentModelUtils.getPropertyValue(doc, propertyName + "/filename"); } } return filename; }