Difference between revisions of "GroupBuilderQuarantineVariable class"

From Catglobe Wiki
Jump to: navigation, search
Line 21: Line 21:
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
 
}}
 
}}
 +
 
=== <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);

Revision as of 05:09, 3 April 2017

GroupBuilderQuarantineVariable



Represents a group builder variable for users in any of the given quarantines.

Constructors

  • () - Create new variable

Methods

  • Empty Add(int quarantineResourceId "Quarantine resource id to add") - Add a new quarantine
  • int 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
  • 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.
  • 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();