Search for an IT policy rule in an IT policy

To search for an IT policy rule in an IT policy, you can search for the IT policy and select the IT policy rule that you want.
Before you begin: Retrieve the following strings:
  • itPolicyName string for the name of the IT policy you want to find
  • ruleName string for the name of the IT policy rule you want to find
  1. Create the ITPolicy object to store the IT policy.
    ITPolicy itPolicy = null;
    ITPolicyItem itPolicyRule = null;
  2. Specify the includePolicyItems parameter as true and invoke findITPolicies().
    FindITPoliciesResult result=coreWebService.findITPolicies(locale, true);
    
  3. Check the result for errors and handle any errors.
    if (result.getFindITPoliciesReturnStatus().getCode()!= FindITPoliciesReturnStatusEnumType.SUCCESS) 
    {
         // handle any errors
    }
  4. Loop through the result to find the IT policy that you want and store the ID.
    for (ITPolicy itr:result.getITPolicies()) 
    {
        if( itr.getPolicyName().equalsIgnoreCase(itPolicyName);
        {
             itPolicy = itr;
        }
    }
  5. Loop through the IT policy rules to find the IT policy rule object that you are looking for.
    if (itPolicy != null)
    {
         for (ITPolicyItem itr: itPolicy.getITPolicyItem())
         {
              if ( itr.name.equalsIgnoreCase(ruleName))
              {
                   itPolicyRule = itr;
              }
         }
    } 

Was this information helpful? Send us your comments.