Skip to main content

Automatic file upload

The scheduler allows for automatic file uploads from a defined folder locations, e.g. a mounted network folder. The files can be attached To resources, activities or projects into attributes of type "FILE_MANAGEMENT". Therefore, 2 jobs are provided:

  • Automatic upload: Files can be automatically uploaded to the PeakTMS business objects
  • Folder cleanup: Already uploaded files can be automatically deleted

Upload job

The upload job is implemented by com.peaksolution.prp.scheduler.autofileupload.AutoFileUploadJobDefFactory. Following parameters steer the behaviour of the job.

Specify execution interval

Default is every 30 min**

AUTOFILEUPLOAD.cron=0 */30 * * * ? *

Specify source file folder

File Watch folder in which files for upload are detected, split by ";,"

AUTOFILEUPLOAD.data.watchfolder=/data/autofileupload

Specify activities and its attributes for file upload

Names (former manualUD) of activities which can be uploaded, split by ",". A wildcard operator can be used to define a set of activities.

AUTOFILEUPLOAD.activity.manualIds=TB_*,VEH_*

Additionally specify the attribute of an activity to which the uploaded data will be attached. The given attribute must be of type "FILE_MANAGEMENT"

AUTOFILEUPLOAD.data.attrmanualId=TESTDATA

Define file / activity identifier

Definition of an identifier to identify to which activities data files shall be uploaded. The job expects to either have files with the given identifier as prefix or a subfolder with the given identifier to exist.

AUTOFILEUPLOAD.activity.testnumbermanualId=REQUESTNUMBER

Define the identification strategy. The possible strategies are FILE and FOLDER.

  • FILE: In this case the job is expecting files to have a prefix containing an identifier (e.g. "234rtuz_) by which the upload can be detected.
  • FOLDER: the job expects a subfolder which name maches exactly the specified identifier.
AUTOFILEUPLOAD.data.mode=FOLDER

Ignore certain file types from automatic upload

It can be defined which kind of files should be ignored by auto file upload based on the file extension. Several extensions can be defined split by ","

AUTOFILEUPLOAD.data.ignoreExtension=tmp,properties

Job for automatic cleaning upload files and folders

When using the job for automatic uploads the files still remain in the original folders. The cleaning job allows to detect already uploaded files and delete them. Remind, that once the background scheduler is stopped eventually still remaining uploaded files will have to be deleted manually later.

The cleanup job is implemented by com.peaksolution.prp.scheduler.autofileupload.AutoFileCleanerJobDefFactory.

Specify the cleanup interval

Specify a cron pattern to specify the execution interval:

AUTOFILECLEANER.cron=0 0 3 ? * L *

Specifiy the clean up folder

File Watch folder, split by ","

AUTOFILECLEANER.data.watchfolder=/data/autofileupload

Specify retention time of uploaded files

You can specify how long data stays in the folder after upload before it is removed by the clean up job. Data will be keeped in the folder until time is this value after uploaded time, default is 7 days

AUTOFILECLEANER.data.keep.interval=604800000

Specify excluded files

You can specify the extensions of files which shall not be deleted:

AUTOFILECLEANER.data.ignoreExtension=tmp

Specify identification strategy

For defining if the job shall look for deleting just files or also folders the identification strategy must be set similar to the upload job. The values FILE and FOLDER are valid.

AUTOFILECLEANER.data.mode=FOLDER