Class JobGroup
- Namespace
- Dynamicweb.DataIntegration.Integration
- Assembly
- Dynamicweb.DataIntegration.dll
Represents a group of data integration activities. A group is a subdirectory of the integration jobs folder ("/Files/Files/Integration/jobs") that contains job XML files and, optionally, nested subgroups; groups are how activities are organized into folders in the data integration area of the administration interface. The static members enumerate groups and their job files and manage the manual sort order that is persisted in a "sort.txt" file per folder.
public class JobGroup
- Inheritance
-
JobGroup
- Inherited Members
Remarks
Things to be careful of:
- Everything is file-system based: a group only exists as a directory on disk, and group names are directory names. Nested group identifiers are relative paths from the jobs folder using the platform directory separator.
- The "Personal" folder is reserved for data import configurations (see DataImportActivityConfiguration) and is excluded from GetGroups(bool, bool).
- Sorting is best-effort: entries missing from the sort file keep sort value 0 and therefore come first; the sort files are read on every call, so heavy repeated enumeration hits the disk.
Properties
Name
Gets or sets the name of the group — the directory name relative to the integration jobs folder.
public string? Name { get; set; }
Property Value
Methods
GetGroupActivityId(string)
Gets the Activity value that represents running every job in a group, rather than a single job. Marked with a trailing directory separator, a shape no job identifier can ever have (see GetJobIdentifier(string?, string?)), so it can never collide with one.
public static string GetGroupActivityId(string groupName)
Parameters
groupNamestringThe group path relative to the integration jobs folder.
Returns
GetGroupActivityLabel(string)
Gets the display label for a group when it is selected as a whole (see GetGroupActivityId(string)).
public static string GetGroupActivityLabel(string groupName)
Parameters
groupNamestringThe group path relative to the integration jobs folder.
Returns
GetGroupByJobFile(string)
Gets the group a job file belongs to, derived from the file's directory path.
public static string? GetGroupByJobFile(string jobFilePath)
Parameters
jobFilePathstringThe full physical path of the job XML file.
Returns
- string
The group path relative to the integration jobs folder, or
nullwhen the file is at the root of the jobs folder or the path is empty.
GetGroupFolderPath(string?)
Gets the physical path of a group's folder. The folder may not exist.
public static string GetGroupFolderPath(string? groupName)
Parameters
groupNamestringThe group path relative to the integration jobs folder, or
null/empty for the jobs folder itself.
Returns
- string
The physical path of the group folder.
GetGroupJobFiles(string?, bool)
Gets the job XML files in a group's folder (not including subgroup folders).
public static List<FileInfo> GetGroupJobFiles(string? groupName = null, bool getSorted = false)
Parameters
groupNamestringThe group path relative to the integration jobs folder, or
null/empty for job files at the root of the jobs folder.getSortedboolIf set to
true, orders the files by the group's persisted sort order (see SaveJobsSorting(string, Dictionary<string, int>)).
Returns
GetGroupNameFromActivityId(string?)
Gets the group path from an Activity value produced by GetGroupActivityId(string).
public static string? GetGroupNameFromActivityId(string? activityId)
Parameters
activityIdstringThe activity value to parse.
Returns
- string
The group path, or
nullwhenactivityIddoes not represent a group.
GetGroups()
Gets the top-level groups in the integration jobs folder as JobGroup instances, in file-system order.
public static IEnumerable<JobGroup> GetGroups()
Returns
- IEnumerable<JobGroup>
A JobGroup per top-level group directory; empty when the jobs folder does not exist.
GetGroups(bool)
Gets the names of the top-level groups in the integration jobs folder.
public static List<string> GetGroups(bool getSorted = false)
Parameters
getSortedboolIf set to
true, orders the groups by the persisted sort order (see SaveGroupsSorting(Dictionary<string, int>)).
Returns
GetGroups(bool, bool)
Gets the names of the groups in the integration jobs folder, optionally including nested subgroups. The reserved "Personal" data import folder is always excluded.
public static IEnumerable<string> GetGroups(bool getSorted = false, bool getSubGroups = false)
Parameters
getSortedboolIf set to
true, orders the groups by the persisted sort order (see SaveGroupsSorting(Dictionary<string, int>)).getSubGroupsboolIf set to
true, includes nested groups at any depth, returned as paths relative to the jobs folder; otherwise only top-level directory names are returned.
Returns
- IEnumerable<string>
The group names or relative paths; empty when the jobs folder does not exist.
GetSortedGroupsAndRootActivities()
Gets all group paths (including nested subgroups) together with the full file paths of the job files at the root of the integration jobs folder, ordered by the root sort order where available. Used to build the flat list of activities and groups, for example when selecting activities for a scheduled task.
public static List<string> GetSortedGroupsAndRootActivities()
Returns
- List<string>
Group paths relative to the jobs folder mixed with full paths of root-level job XML files.
GetSubGroups(string)
Gets the names of the immediate subgroups of a group, ordered by the parent folder's persisted sort order when one exists.
public static IEnumerable<string> GetSubGroups(string parentPath)
Parameters
parentPathstringThe parent group path relative to the integration jobs folder.
Returns
- IEnumerable<string>
The directory names of the immediate subgroups; empty when the jobs folder does not exist. Throws when the parent folder itself does not exist.
IsGroupActivityId(string?)
Determines whether an Activity value represents a whole group (see GetGroupActivityId(string)) rather than a single job.
public static bool IsGroupActivityId(string? activityId)
Parameters
activityIdstringThe activity value to check.
Returns
LoadGlobalVariables()
Loads the global variables from the jobs root folder. Returns Empty when no global variables file exists.
public static IntegrationVariables LoadGlobalVariables()
Returns
LoadGroupVariables(string?)
Loads the variables defined for the specified group.
Returns Empty when groupName is null or empty,
or when no group variables file exists.
public static IntegrationVariables LoadGroupVariables(string? groupName)
Parameters
groupNamestringThe group name or relative path identifying the group folder.
Returns
SaveGroupsSorting(Dictionary<string, int>)
Persists the manual sort order of the top-level groups, written as a "sort.txt" file in the integration jobs folder and applied by GetGroups(bool) when sorted results are requested.
public static void SaveGroupsSorting(Dictionary<string, int> sorting)
Parameters
sortingDictionary<string, int>The sort values keyed by group name. Groups not in the dictionary sort as 0.
SaveJobsSorting(string, Dictionary<string, int>)
Persists the manual sort order of the job files in a group, written as a "sort.txt" file in the group's folder and applied by GetGroupJobFiles(string?, bool) when sorted results are requested.
public static void SaveJobsSorting(string groupName, Dictionary<string, int> sorting)
Parameters
groupNamestringThe group path relative to the integration jobs folder; use an empty string for the root of the jobs folder.
sortingDictionary<string, int>The sort values keyed by job file name (including the ".xml" extension). Files not in the dictionary sort as 0.