y***@gmail.com
2008-05-12 17:44:19 UTC
The documentation regarding for setting of the merit (aka Processing
Order) on a CRP is a bit confusing. Say I want to make sure my new
CRP is at position #3. How do I do that? The docs and the sample CRP
creation VB.NET code mention that setting the merit to any value at
creation time is ignored. And that you must apply changes (that
create the policy) to the policy, then edit the policy to change the
order.
Here's a code snipit (C#) I used to create the policy object...
// create profile first
....
// now we can create the matching policy...
ISdoCollection CRPolicies = (ISdoCollection)
sdoServiceSDO.GetProperty((int)
IASPROPERTIES.PROPERTY_IAS_PROXYPOLICIES_COLLECTION);
ISdo newPolicy = null;
// add a new policy to the collection and set its name...
object tempObject = newPolicy;
CRPolicies.Add(MyConstants.CRP_NAME, ref tempObject);
newPolicy = (ISdo)tempObject;
// edit conditions/constraints...here
....
// Set the policy's merit
//
// According to this docs, this value is ignored when you
create a new policy. So, we'll just set it to 1 for now
tempObject = 1;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_MERIT, ref
tempObject);
// match up this policy with the corresponding profile...
tempObject = MyConstants.CRP_NAME;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_PROFILE_NAME,
ref tempObject);
// save the policy
newPolicy.Apply();
// now that we have saved those settings, we can update
the merit value...
//
// fetch our newly create policy so we can edit its merit
value...
tempObject = MyConstants.CRP_NAME;
newPolicy = (ISdo) CRPolicies.Item(ref tempObject);
tempObject = _CRPPosition;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_MERIT, ref
tempObject);
newPolicy.Apply();
Order) on a CRP is a bit confusing. Say I want to make sure my new
CRP is at position #3. How do I do that? The docs and the sample CRP
creation VB.NET code mention that setting the merit to any value at
creation time is ignored. And that you must apply changes (that
create the policy) to the policy, then edit the policy to change the
order.
Here's a code snipit (C#) I used to create the policy object...
// create profile first
....
// now we can create the matching policy...
ISdoCollection CRPolicies = (ISdoCollection)
sdoServiceSDO.GetProperty((int)
IASPROPERTIES.PROPERTY_IAS_PROXYPOLICIES_COLLECTION);
ISdo newPolicy = null;
// add a new policy to the collection and set its name...
object tempObject = newPolicy;
CRPolicies.Add(MyConstants.CRP_NAME, ref tempObject);
newPolicy = (ISdo)tempObject;
// edit conditions/constraints...here
....
// Set the policy's merit
//
// According to this docs, this value is ignored when you
create a new policy. So, we'll just set it to 1 for now
tempObject = 1;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_MERIT, ref
tempObject);
// match up this policy with the corresponding profile...
tempObject = MyConstants.CRP_NAME;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_PROFILE_NAME,
ref tempObject);
// save the policy
newPolicy.Apply();
// now that we have saved those settings, we can update
the merit value...
//
// fetch our newly create policy so we can edit its merit
value...
tempObject = MyConstants.CRP_NAME;
newPolicy = (ISdo) CRPolicies.Item(ref tempObject);
tempObject = _CRPPosition;
newPolicy.PutProperty((int)POLICYPROPERTIES.PROPERTY_POLICY_MERIT, ref
tempObject);
newPolicy.Apply();