Class Group
- Namespace
- Geotab.Checkmate.ObjectModel
- Assembly
- Geotab.Checkmate.ObjectModel.dll
A group is one element in a hierarchical tree. Each group can have none or many children, it is the children that define the shape of the hierarchical tree. The parent is not a property of the group object and is only defined by who the group is a child of. It is necessary to know the id of the parent group when adding a new group.
There are three core Group branches used in MyGeotab. The most common are "Company Groups", company Groups are used to organize entities (Zone, User, Device, Driver and Rule) into logical groups related to the organization. A Group structure can be constructed by region, vocation, reporting or anything that makes sense to the business, this allows aggregate reports and rolling up data in a flexible way. These groups have a many to many type of relationship with the entities that are members and are not limited to one type of entity.
The second type is "Security Groups", these are Groups to which User(s) are members of and can only be applied to Users. Each Group has a list of SecurityFilter(s) associated to it. Security Filters control what parts of the application/API a User has access to.
The third type of group is a "Private User Group", this group is used only for scheduling reports and displaying dashboard reports for a User. This Group will only ever apply to one User and will typically be named the user's name.
There is a base structure of Groups which cannot be removed, these are considered to be "System"
Some of these groups are:
When Groups are retrieved they will always be in a flat list of groups. The hierarchically tree(s) can be reconstructed by looking at the "Children" property of each Group. The "Root" group will never be returned and is only for system use.
[ReportClass]
public class Group : NameEntity, IEntity, IComparable, IIdentifiable, IDefaultable
- Inheritance
-
Group
- Implements
- Derived
- Inherited Members
Constructors
Group()
Initializes a new instance of the Group class. Groups should always be created using the Get(Id?, Group?, string?, string?, string?, Color?, List<Group>?, string?, bool?) method.
public Group()
Group(Group)
Initializes a new instance of the Group class.
protected Group(Group group)
Parameters
group
GroupThe group.
Group(Id?)
Initializes a new instance of the Group class. Groups should always be created using the Get(Id?, Group?, string?, string?, string?, Color?, List<Group>?, string?, bool?) method. This method is specifically for embedded groups.
public Group(Id? id)
Parameters
id
IdThe identifier.
Group(Id?, Group?, string?, string?, string?, Color?, List<Group>?, string?)
Initializes a new instance of the Group class. Groups should always be created using the Get(Id?, Group?, string?, string?, string?, Color?, List<Group>?, string?, bool?) method.
public Group(Id? id, Group? parent, string? name, string? comments = null, string? reference = null, Color? color = null, List<Group>? children = null, string? path = null)
Parameters
id
IdThe identifier.
parent
GroupThe parent.
name
stringThe name.
comments
stringThe comments.
reference
stringThe reference.
color
ColorThe color.
children
List<Group>The children of this group
path
stringLtree path of the group
Remarks
The left/right values are internal to the nested set structure. A user cannot create a group with these values.
Properties
Children
Gets or sets the Children of this group. A list of Group(s).
public List<Group>? Children { get; set; }
Property Value
Color
Gets or sets the Color used to render assets belonging to this group. Default [Blue].
public virtual Color? Color { get; set; }
Property Value
Comments
Gets or sets the free text field where any user information can be stored and referenced for this entity. Default [""].
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.GroupComment })]
public string? Comments { get; set; }
Property Value
Id
Gets or sets the unique identifier for this entity. See Id.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.GroupId })]
public override Id? Id { get; set; }
Property Value
Name
Gets or sets the name of this entity which identifies it and is used when displaying this entity.
[ExcelColumnHeader(new ReportHeading[] { ReportHeading.GroupName })]
public override string? Name { get; set; }
Property Value
Parent
Gets or sets the parent Group of the selected group.
public Group? Parent { get; set; }
Property Value
Remarks
Not defined in the group object, the relationship is assumed by which group has this group as a child.
Path
Gets or sets the ltree path of the group.
public string? Path { get; set; }
Property Value
Reference
Gets or sets the string reference to add to the database entry for this group. Maximum length [255] Default [""].
public string? Reference { get; set; }
Property Value
Methods
Clone()
Creates a new object that is a copy of the current instance.
public override IEntity Clone()
Returns
- IEntity
A new object that is a copy of this instance.
Get(Id?, Group?, string?, string?, string?, Color?, List<Group>?, string?, bool?)
Gets the correct group given an id.
public static Group Get(Id? id, Group? parent = null, string? name = null, string? comments = null, string? reference = null, Color? color = null, List<Group>? children = null, string? path = null, bool? isGlobalReportingGroup = null)
Parameters
id
IdThe identifier.
parent
GroupThe parent.
name
stringThe name.
comments
stringThe comments.
reference
stringThe reference.
color
ColorThe color.
children
List<Group>The groups children.
path
stringLtree path of the group.
isGlobalReportingGroup
bool?Indicates if the group is global for reporting.
Returns
GetDefect(Id?, Group?, string?, string?, string?, DefectSeverity?, DefectAssetType?, IList<Group>?, List<Group>?, string?, bool?, bool?)
public static Defect GetDefect(Id? id, Group? parent = null, string? name = null, string? comments = null, string? reference = null, DefectSeverity? severity = null, DefectAssetType? assetType = null, IList<Group>? defectGroups = null, List<Group>? children = null, string? path = null, bool? isHidden = null, bool? isRequired = null)
Parameters
id
IdThe identifier.
parent
GroupThe parent.
name
stringThe name.
comments
stringThe comments.
reference
stringThe reference.
severity
DefectSeverity?Severity for a defect
assetType
DefectAssetType?The asset type
defectGroups
IList<Group>The defect groups
children
List<Group>The groups children
path
stringLtree path of the group
isHidden
bool?If the defect is visible in the UI
isRequired
bool?If the defect must be signed off in the UI
Returns
GetSecurityClearance(Id?, Group?, string?, string?, string?, List<SecurityFilter>?, List<Group>?, string?)
Gets a new SecurityClearanceGroup.
public static SecurityClearance GetSecurityClearance(Id? id, Group? parent = null, string? name = null, string? comments = null, string? reference = null, List<SecurityFilter>? securityFilters = null, List<Group>? children = null, string? path = null)
Parameters
id
IdThe identifier.
parent
GroupThe parent.
name
stringThe name.
comments
stringThe comments.
reference
stringThe reference.
securityFilters
List<SecurityFilter>Security Filter for clearances
children
List<Group>The groups children
path
stringLtree path of the group
Returns
- SecurityClearance
The new Group
GetSlim(Id)
Gets the correct embedded group given an id.
public static Group GetSlim(Id id)
Parameters
id
IdThe identifier.
Returns
GetTreeNodeCount()
The tree Group count.
public int GetTreeNodeCount()
Returns
IsChildOf(Group)
Returns true if the current group is a child group of the given Group.
public bool IsChildOf(Group group)
Parameters
group
GroupThe group being tested.
Returns
- bool
True if the current instance is a child of the given group, otherwise false.
PopulateDefaults()
Populate non-required empty (null) properties with default values.
public void PopulateDefaults()
ToString()
Returns a string that represents this instance.
public override string ToString()
Returns
Traverse()
Returns an enumerator that will traverse the tree. The tree is traversed Depth First.
public IEnumerable<Group> Traverse()
Returns
TraverseUp()
Returns an enumerator that will traverse the tree up.
public IEnumerable<Group> TraverseUp()
Returns
Exceptions
- NotSupportedException
Are you sure to traverse the parent. It seems that parent group is not populated.