public JSRuleCriterion(RuleCriterion c) { this.name = c.getName(); this.type = c.getType(); this.value = c.getValue(); this.fallBackOrder = c.getFallbackOrder(); this.fallBackType = c.getFallbackType(); }
public void setProfilingRule(ProfilingRule rule) { this.profilingRule = rule; this.ruleId = rule.getId(); }
public String resolve(RequestContext context, RuleCriterion criterion) { return criterion.getValue(); }
public ProfileLocatorPropertyImpl(RuleCriterion criterion, boolean isControl, boolean isNavigation, String value) { this.name = criterion.getName(); this.value = value; this.type = criterion.getType(); this.fallbackType = criterion.getFallbackType(); this.isControl = isControl; this.isNavigation = isNavigation; }
protected String getProfilingRuleForUser(User user) { Collection<PrincipalRule> userRules = profiler.getRulesForPrincipal(user); for (PrincipalRule userRule : userRules) { if (userRule.getLocatorName().equals(ProfileLocator.PAGE_LOCATOR)) { return userRule.getProfilingRule().getId(); } } return ""; }
public ProfileDataTableBean(Collection<ProfilingRule> rules) { totalRecords = rules.size(); for (ProfilingRule rule : rules) { ProfileListBean record = new ProfileListBean(rule.getId(), rule.getTitle(), rule.getClassname()); this.records.add(record); } }
public String resolve(RequestContext context, RuleCriterion criterion) { Subject subject = context.getSubject(); if (subject == null) { String msg = "Invalid (null) Subject in request pipeline"; log.error(msg); return null; } return combinePrincipals(context, criterion, subject, criterion.getName()); }
public void deletePrincipalRule(PrincipalRule rule) throws ProfilerException { getPersistenceBrokerTemplate().delete(rule); // reset persistent rules per principal rulesPerPrincipal.remove(rule.getPrincipalName()); String key = this.makePrincipalRuleKey(rule.getPrincipalName(), rule.getLocatorName()); // remove individual rule principalRules.remove(key); // track cached principal rules trackCachedPrincipalRulesRemoved(rule.getPrincipalName(), rule); }
public Collection<PrincipalRule> getRulesForPrincipal(Principal principal) { Collection<PrincipalRule> rules = this.rulesPerPrincipal.get(principal.getName()); if (rules != null) return rules; Criteria c = new Criteria(); c.addEqualTo("principalName", principal.getName()); rules = getPersistenceBrokerTemplate().getCollectionByQuery( QueryFactory.newQuery(getPrincipalRuleClass(), c)); for (PrincipalRule pr : rules) { ProfilingRule rule = pr.getProfilingRule(); if (rule != null) rule.setResolvers(resolvers); } this.rulesPerPrincipal.put(principal.getName(), rules); return rules; }
public Map<String, ProfileLocator> getDefaultProfileLocators(RequestContext context) throws ProfilerException { // get default profile locators Map<String, ProfileLocator> locators = new HashMap<String, ProfileLocator>(); Collection<PrincipalRule> rules = getRulesForPrincipal(DEFAULT_RULE_PRINCIPAL); for (PrincipalRule pr : rules) { locators.put(pr.getLocatorName(), getDefaultProfile(context, pr.getLocatorName())); } return locators; }
public RuleCriterionResolver getDefaultResolver() { return resolvers.get(RuleCriterionResolver.REQUEST); }
public ProfileLocator getProfile(RequestContext context, ProfilingRule rule) throws ProfilerException { // create a profile locator for given rule return rule.apply(context, this); }
public RuleCriterionImpl(RuleCriterion master) { this.name = master.getName(); this.ruleId = master.getRuleId(); this.type = master.getType(); this.value = master.getValue(); this.fallbackOrder = master.getFallbackOrder(); this.fallbackType = master.getFallbackType(); } /**
protected List<String> getProfilingRuleNames() { List<String> names = new ArrayList<>(); names.add(""); Collection<ProfilingRule> rules = profiler.getRules(); for (ProfilingRule rule : rules) { names.add(rule.getId()); } return names; }
public Map<String, ProfileLocator> getProfileLocators(RequestContext context, Principal principal) throws ProfilerException { // setup/maintain profiler context for session end notification setupProfilerContext(context); // get profile locators Map<String, ProfileLocator> locators = new HashMap<String, ProfileLocator>(); Collection<PrincipalRule> rules = getRulesForPrincipal(principal); for (PrincipalRule pr : rules) { locators.put(pr.getLocatorName(), getProfile(context, pr.getLocatorName())); } return locators; }
public RuleCriterionResolver getResolver(String name) { return resolvers.get(name); }