Filter filter = persistentStore.newFilter();
filter.addEqualTo("principalName", principal);
filter.addEqualTo("locatorName", locatorName);
Object query = persistentStore.newQuery(principalRuleClass, filter);
PrincipalRule pr = (PrincipalRule) persistentStore.getObjectByQuery(query);
if (pr == null)
{
pr = new PrincipalRuleImpl(); // TODO: factory
pr.setPrincipalName(principal.getName());
pr.setLocatorName(locatorName);
pr.setProfilingRule(rule);
}
try
{
pr.setProfilingRule(rule);
persistentStore.lockForWrite(pr);
}
catch (LockFailedException e)
{
tx.rollback();