Class GroovyDGFileHelper

java.lang.Object
de.uplanet.lucy.server.businesslogic.util.GroovyDGFileHelper

@Scriptable public final class GroovyDGFileHelper extends Object
Helper class for groovy, to handle intrexx data group files.
Since:
10.14.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final record 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    GroovyDGFileHelper(IProcessingContext p_ctx, de.uplanet.lucy.server.rtcache.IRtCacheProvider p_rtCacheProvider)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    copy(Map<String,Object> p_params)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...)
    void
    delete(Map<String,Object> p_params)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value) id_%fieldName% if (multiple) primary key will set by field name.
    getFile(Map<String,Object> p_params)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value) id_%fieldName% if (multiple) primary key will set by field name.
    guid, fieldGuid, field: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value) id_%fieldName% if (multiple) primary key will set by field name.
    void
    move(Map<String,Object> p_params)
    guid: GUID of the file field data field (required) id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value) id_%fieldName% if (multiple) primary key will set by field name.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GroovyDGFileHelper

      public GroovyDGFileHelper(IProcessingContext p_ctx, de.uplanet.lucy.server.rtcache.IRtCacheProvider p_rtCacheProvider)
  • Method Details

    • copy

      public void copy(Map<String,Object> p_params) throws IOException, de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...) (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field on parameter.(The placeholder %fieldName% should be replaced with the fieldName like id_LID)
      • replaceMode: true if all files should replaces with the given one (optional) otherwise false (default) if the existing one will be merged.
      • triggerWorkflow: true if a workflow should be triggered or false (default) no workflow will triggered.
      • triggerShareFeedAction: true if a shareFeedAction should be triggered or false, default same as triggerWorkflow.
      • file: The file to copy. Could be a type of String, File, Path or a Map with keys
        • mode
          • append: (default) File will added add the end.
          • appendFirst: File will added on first position.
          • replace: An existing file will be replaced
          • delete: An existing file will be deleted
        • file: (required if mode != delete) - The file to copy, type of String, File, Path or FileInformation
        • name: The name of the file (not empty, if not set, the name of file will be used
        • contentType: The contentType of the file (optional). Fallback value: The type is determined from the known file extension associations in file internal/cfg/minemap.xml or internal/cfg/mimemap-custom.xml, or if no association was found, "application/octet-stream" is taken.
        • for mode = replace, one of the following file identifier is required:
          • fileId: The id of the file
          • pos: The position of the file (0 is the first file).
          • replaceName: the name of the file to replace.
        • for mode = delete, one of the following file identifier is required:
          • fileId: The id of the file
          • pos: The position of the file (0 is the first file).
          • name: the name of the file to delete.

      Examples:

      • g_dgFile.copy(guid: "DF GUID", id: "recordID", file: "/tmp/test.txt")
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", files: ["/tmp/test.txt", "tmp/test1.txt"])
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", file: [ file: "tmp/test.txt", name: "name.txt", contentType: "application/json", mode: "appendFirst"])
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", files: [ file: "tmp/test.txt", name: "name.txt", contentType: "application/json", mode: "appendFirst"], [ file: "tmp/test1.txt", name: "name1.txt", contentType: "application/json", mode: "append"])
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", file: "tmp/test.txt", name: "name2.txt", replaceName: "name.txt", contentType: "application/json", mode: "replace")
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", file: "tmp/test.txt", name: "name2.txt", pos: 1, contentType: "application/json", mode: "replace")
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", file: "tmp/test.txt", name: "name2.txt", fileId: 1, contentType: "application/json", mode: "replace")
      • g_dgFile.copy(guid: "DF GUID", id: "recordID", files: [[file: "tmp/test.txt", name: "name2.txt", replaceName: "name.txt", contentType: "application/json", mode: "replace"], [file: "tmp/test1.txt", name: "name3.txt", contentType: "application/json", mode: "append"], [name: "file.txt", mode: "delete"])

      Parameters:
      p_params -
      Throws:
      IOException
      de.uplanet.lucy.server.businesslogic.BlException
    • move

      public void move(Map<String,Object> p_params) throws IOException, de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field on parameter.(The placeholder %fieldName% should be replaced with the field name like id_LID)
      • replaceMode true if all files should replaces with the given one (optional) otherwise false (default) if the existing one will be merged.
      • triggerWorkflow: true if a workflow should be triggered or false (default) no workflow will triggered.
      • triggerShareFeedAction: true if a shareFeedAction should be triggered or false, default same as triggerWorkflow.
      • file: The file to copy. Could be a type of String, File, Path or a Map with keys
        • mode
          • append: (default) File will added add the end.
          • appendFirst: File will added on first position.
          • replace: An existing file will be replaced
          • delete: An existing file will be deleted
        • file: The file to copy, typeof String, File or Path (required if mode != delete)
        • name: The name of the file (not empty, if not set, the name of file will be used
        • contentType: The contentType of the file (optional). Fallback value: The type is determined from the known file extension associations in file internal/cfg/minemap.xml or internal/cfg/mimemap-custom.xml, or if no association was found, "application/octet-stream" is taken.
        • for mode = replace, one of the following file identifier is required:
          • id: The id of the file
          • pos: The position of the file (0 is the first file).
          • replaceName: the name of the file to replace.
        • for mode = delete, one of the following file identifier is required:
          • id: The id of the file
          • pos: The position of the file (0 is the first file).
          • name: the name of the file to delete.
      • deleteAlways - If true the source file(s) will be removed even if an error occur, otherwise false.

      Examples:

      • g_dgFile.move(guid: "DF GUID", id: "recordID", file: "/tmp/test.txt", deleteAlways: true)
      • g_dgFile.move(guid: "DF GUID", id: "recordID", files: ["/tmp/test.txt", "tmp/test1.txt"])
      • g_dgFile.move(guid: "DF GUID", id: "recordID", file: "tmp/test.txt", name: "name.txt", contentType: "application/json", mode: "appendFirst")
      • g_dgFile.move(guid: "DF GUID", id: "recordID", files: [[file: "tmp/test.txt", name: "name.txt", contentType: "application/json", mode: "appendFirst"], [file: "tmp/test1.txt", name: "name1.txt", contentType: "application/json", mode: "append"], [ pos: 2, mode: "delete"]])
      • g_dgFile.move(guid: "DF GUID", id: "recordID", file: "tmp/test.txt", name: "name2.txt", replaceName: "name.txt", contentType: "application/json", mode: "replace")
      • g_dgFile.move(guid: "DF GUID", id: "recordID", files: [[file: "tmp/test.txt", name: "name2.txt", replaceName: "name.txt", contentType: "application/json", mode: "replace"], [file: "tmp/test2.txt", name: "name3.txt", contentType: "application/json", mode: "append"]])

      Parameters:
      p_params -
      Throws:
      IOException
      de.uplanet.lucy.server.businesslogic.BlException
    • delete

      public void delete(Map<String,Object> p_params) throws de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field one parameter. (The placeholder %fieldName% should be replaced with the field name like id_LID)
      • triggerWorkflow: true if a workflow should be triggered or false (default) no workflow will triggered.
      • triggerShareFeedAction: true if a shareFeedAction should be triggered or false, default same as triggerWorkflow.
      • without fileId, pos or name all files will be deleted.
      • fileId - The id of the file to delete
      • pos - The file on position (0 = first file) will be deleted
      • name - The file with the name will be deleted.

      Examples

      • g_dgFile.delete(guid: "DF GUID", id: "recordID")
      • g_dgFile.delete(guid: "DF GUID", id: "recordID", fileId: 1)
      • g_dgFile.delete(guid: "DF GUID", id: "recordID", name: "test.txt")
      • g_dgFile.delete(guid: "DF GUID", id: "recordID", pos: 1)

      Throws:
      de.uplanet.lucy.server.businesslogic.BlException
    • getFile

      public Path getFile(Map<String,Object> p_params) throws de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...) (placeholder %fieldName% should be replaced with the fieldName like LID= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field one parameter.
      • fileId - The id of the file to get
      • pos - The file on position (0 = first file) will be get
      • name - The file with the name will be get.
      Returns:
      The path to the given file or null if not found.
      Throws:
      de.uplanet.lucy.server.businesslogic.BlException
    • getFileInformation

      public FileInformation getFileInformation(Map<String,Object> p_params) throws de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...) (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field one parameter.(The placeholder %fieldName% should be replaced with the field name like id_LID)
      • fileId - The id of the file to get
      • pos -> The file on position (0 = first file) will be get
      • name - The file with the name will be get.
      Returns:
      The file information to the given object.
      Throws:
      de.uplanet.lucy.server.businesslogic.BlException
    • getFilesInformation

      public List<FileInformation> getFilesInformation(Map<String,Object> p_params) throws de.uplanet.lucy.server.businesslogic.BlException
      • guid, fieldGuid, field: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field one parameter.(The placeholder %fieldName% should be replaced with the field name like id_LID)
      • count - maximal count of files returned
      Returns:
      Array of file informations or empty array if no files found.
      Throws:
      de.uplanet.lucy.server.businesslogic.BlException
    • getFiles

      public List<Path> getFiles(Map<String,Object> p_params) throws de.uplanet.lucy.server.businesslogic.BlException
      • guid: GUID of the file field data field (required)
      • id The primary key, for multiple primary keys Intrexx serialize format (%fieldName%= value, %fieldName%= value) (required if primary key not set in parameter form id_...), (The placeholder %fieldName% should be replaced with the field name like LID= value, STRLANG= value)
      • id_%fieldName%
      • if (multiple) primary key will set by field name. For each primary key field one parameter. (The placeholder %fieldName% should be replaced with the field name like id_LID)
      • count - maximal count of files returned
      Returns:
      Array of path to the given files or empty array if no files found
      Throws:
      de.uplanet.lucy.server.businesslogic.BlException