Difference between revisions of "GroupBuilderQuarantineVariable class"
Nguyenduyan (talk | contribs) |
|||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=GroupBuilderQuarantineVariable | + | |Name=<nowiki>GroupBuilderQuarantineVariable</nowiki> |
− | |Description=Represents a group builder variable for users in any of the given quarantines. | + | |Description=<nowiki>Represents a group builder variable for users in any of the given quarantines.</nowiki> |
− | |Constructors= | + | |InheritsFrom=GroupBuilderVariable|Constructors= |
− | {{CGscriptConstructors_Template|Description=Create new variable}} | + | {{CGscriptConstructors_Template|Description=<nowiki>Create new variable</nowiki>}} |
|Methods= | |Methods= | ||
− | {{CGscriptMethods_Template|ReturnType=Empty|Name=Add|Parameters= | + | {{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Add</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=quarantineResourceId|Description=Quarantine resource id to add}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>quarantineResourceId</nowiki>|Description=<nowiki>Quarantine resource id to add</nowiki>}} |
− | |Description=Add a new quarantine}} | + | |Description=<nowiki>Add a new quarantine</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType= | + | {{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=index|Description=Index}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}} |
− | |Description=Get quarantine resource id at index}} | + | |Description=<nowiki>Get quarantine resource id at index</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=bool|Name=Remove|Parameters= | + | {{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Remove</nowiki>|Parameters= |
− | {{CGscriptParameters_Template|Type=int|Name=quarantineResourceId|Description=Quarantine resource id to remove}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>quarantineResourceId</nowiki>|Description=<nowiki>Quarantine resource id to remove</nowiki>}} |
− | |Description=Remove quarantine. Return true if removed}} | + | |Description=<nowiki>Remove quarantine. Return true if removed</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}} | + | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} |
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=int|Name=Count|HasGetter=1|Description=Number of specific quarantines}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Count</nowiki>|HasGetter=1|Description=<nowiki>Number of specific quarantines</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=Include|HasGetter=1|HasSetter=1|Description=Include users that match rule, or exclude}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>Include</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Include users that match rule, or exclude</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}} | + | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} |
}} | }} | ||
+ | |||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === | ||
− | + | '''Examples''' Add a quarantine on quarantine variable | |
<source lang="javascript"> | <source lang="javascript"> | ||
//Create a new group | //Create a new group | ||
Line 50: | Line 51: | ||
root.Save(); | root.Save(); | ||
+ | </source> | ||
+ | |||
<br/> | <br/> | ||
− | + | '''Examples''' Remove a quarantine on quarantine variable | |
<source lang="javascript"> | <source lang="javascript"> | ||
GroupBuilderRoot root = new GroupBuilderRoot (15560629); | GroupBuilderRoot root = new GroupBuilderRoot (15560629); |
Latest revision as of 05:48, 2 July 2020
GroupBuilderQuarantineVariable
Represents a group builder variable for users in any of the given quarantines.
Parent class
Inherits from GroupBuilderVariable
Constructors
- () - Create new variable
Methods
- Empty Add(int quarantineResourceId "Quarantine resource id to add") - Add a new quarantine
- object this[] { get; }(int index "Index") - Get quarantine resource id at index
- bool Remove(int quarantineResourceId "Quarantine resource id to remove") - Remove quarantine. Return true if removed
- (From object) string ToString() - The string representation of the object.
Properties
- int Count { get; } - Number of specific quarantines
- bool Include { get; set; } - Include users that match rule, or exclude
- string ObjectTypeName { get; } - The name of the type of object.
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
Examples
Examples Add a quarantine on quarantine variable
//Create a new group
string groupName = "Test Group Builder: quarantineVariable ";
number groupTemplateResourceId=2066;
number parentResourceId = 11088827;
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
Group_save(group);
number groupRId = group[GROUP_RESOURCE_ID ];
//Create rule for the group
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
GroupBuilderQuarantineVariable quarantineVariable = new GroupBuilderQuarantineVariable();
quarantineVariable.Include=true;
quarantineVariable.Add(15542993);
quarantineVariable.Add(15549081);
print(quarantineVariable.Count);//2
print(quarantineVariable[0]);//quarantineRId 15542993
print(quarantineVariable[1]);//quarantineRId 15549081
GroupBuilderRule rule = new GroupBuilderRule (root);
rule.Add(quarantineVariable);
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule);
root.Save();
Examples Remove a quarantine on quarantine variable
GroupBuilderRoot root = new GroupBuilderRoot (15560629);
GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderRule rule = ruleColection[0];
GroupBuilderQuarantineVariable quarantineVariable = rule[0];
print(quarantineVariable.Count);//2
quarantineVariable.Remove(quarantineVariable[0]);
print(quarantineVariable.Count);//1
root.Save();