Come join us on November 27-29, 2018 at the Gartner Application Strategies & Solutions Summit 2018 in Las Vegas, USA.

Skip to end of metadata
Go to start of metadata

Description

  • org.joget.apps.form.service.FileUtil
  • Under wflow-core module
  • Utility class to used to handle the files of a form

Code Sample

Methods

checkAndUpdateFileName
public static void checkAndUpdateFileName(org.joget.apps.form.model.FormRowSet results, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Method used to check for the duplicate file name of files in the FormRowSet object against the existing files in the target upload directory.

It will update the file name by appending with number if found duplicated.

checkAndUpdateFileName
public static void checkAndUpdateFileName(org.joget.apps.form.model.FormRowSet results, java.lang.String tableName, java.lang.String primaryKeyValue)

Method used to check for the duplicate file name of files in the FormRowSet object against the existing files in the target upload directory.

It will update the file name by appending with number if found duplicated.

getApplicationContext
public static org.springframework.context.ApplicationContext getApplicationContext()

Utility method to retrieve the ApplicationContext of the system

getFile
public static java.io.File getFile(String fileName, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue) throws java.io.IOException

Gets the file from target upload directory of a form data record

getFile
public static java.io.File getFile(java.lang.String fileName, java.lang.String tableName, java.lang.String primaryKeyValue) throws java.io.IOException

Gets the file from target upload directory of a form data record

getTableName
public static java.lang.String getTableName (org.joget.apps.form.model.Element form)

Method used to gets the table name from the properties of a Form object

getUploadPath
public static java.lang.String getUploadPath(org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Gets the target upload directory of a form data record

getUploadPath
public static java.lang.String getUploadPath(java.lang.String tableName, java.lang.String primaryKeyValue)

Gets the target upload directory of a form data record

storeFile
public static void storeFile(java.io.File file, java.lang.String tableName, java.lang.String primaryKeyValue)

Store file to target upload directory of a form data record

storeFile
public static java.io.File getFile(java.lang.String fileName, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue) throws java.io.IOException

Gets the file from target upload directory of a form data record

storeFile
public static void storeFile(org.springframework.web.multipart.MultipartFile file, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Store file to target upload directory of a form data record

storeFileFromFormRowSet
public static void storeFileFromFormRowSet(org.joget.apps.form.model.FormRowSet results, org.joget.apps.form.model.Element form, java.lang.String primaryKeyValue)

Store files in the FormRowSet to target upload directory of a form data record

storeFileFromFormRowSet
public static void storeFileFromFormRowSet(org.joget.apps.form.model.FormRowSet results, java.lang.String tableName, java.lang.String primaryKeyValue)

Store files in the FormRowSet to target upload directory of a form data record

validateFileName
public static java.lang.String validateFileName(java.lang.String fileName, java.lang.String path, java.util.Set<java.lang.String> existedFileName)

Validate the file name against the existing files in the target upload directory.

Parameters:

existedFileName - a set of file names which not yet exist in the target upload directory but the current checking file should not has the same file name in it. 

Return the new file name with number appended when duplicate file is found.

  • No labels