Examples of PrincipalRule


Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

                    JSPrincipalRule pr = (JSPrincipalRule) _itRoles.next();
                    ProfilingRule pRule = pm.getRule(pr.getRule());
                   
                    try
                    {
                      PrincipalRule p1 = pm.createPrincipalRule();
                      p1.setLocatorName(pr.getLocator());
                      p1.setProfilingRule(pRule);
                      p1.setPrincipalName(principal.getName());
                      pm.storePrincipalRule(p1);
                    }
                    catch (Exception eRole)
                    {
                      eRole.printStackTrace();
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

            {
                Collection col = pm.getRulesForPrincipal(principal);
                Iterator _itCol = col.iterator();
                while (_itCol.hasNext())
                {
                    PrincipalRule p1 = (PrincipalRule) _itCol.next();
                    JSPrincipalRule pr = new JSPrincipalRule(p1
                            .getLocatorName(), p1.getProfilingRule().getId());
                    _user.getRules().add(pr);
                }
            }
        }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

                    try
                    {
                        Iterator it = rules.iterator();
                        while (it.hasNext())
                        {
                            PrincipalRule rule = (PrincipalRule)it.next();
                            if (rule.getLocatorName().equals(locatorNames[ix]))
                            {
                                profiler.deletePrincipalRule(rule);
                            }
                        }
                    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

    public ProfilingRule getRuleForPrincipal(Principal principal,
            String locatorName)
    {
        ProfilingRule rule = null;
        // lookup the rule for the given principal in our user/rule table
        PrincipalRule pr = lookupPrincipalRule(principal.getName(), locatorName);

        // if not found, fallback to the locator named rule or system wide rule
        if (pr == null)
        {
            // find rule on locator name
            rule = getRule(locatorName);

            if (rule == null)
            {
                // if not found, fallback to the system wide rule
                rule = getDefaultRule();
            }
            pr = new PrincipalRuleImpl();
            pr.setLocatorName(locatorName);
            pr.setPrincipalName(principal.getName());
            pr.setProfilingRule(rule);
            principalRules.put(makePrincipalRuleKey(principal.getName(),
                    locatorName), pr);
        } else
        {
            // Get the associated rule
            rule = pr.getProfilingRule();
        }

        return rule;
    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

    {
        if (this.prRuleClass == null)
        {
            try
            {
                PrincipalRule tempRule = createPrincipalRule();
                this.prRuleClass = tempRule.getClass();
            } catch (Exception e)
            {
                e.printStackTrace();
            }
        }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

            String locatorName)
    {
        Criteria c = new Criteria();
        c.addEqualTo("principalName", principal.getName());
        c.addEqualTo("locatorName", locatorName);
        PrincipalRule pr = (PrincipalRule) getPersistenceBrokerTemplate()
                .getObjectByQuery(
                        QueryFactory.newQuery(getPrincipalRuleClass(), c));

        if (pr == null)
        {
            pr = new PrincipalRuleImpl(); // TODO: factory
            pr.setPrincipalName(principal.getName());
            pr.setLocatorName(locatorName);
            pr.setProfilingRule(rule);
        }
        rule.setResolvers(resolvers);
        pr.setProfilingRule(rule);
        getPersistenceBrokerTemplate().store(pr);
        principalRules.put(makePrincipalRuleKey(principal.getName(),
                locatorName), pr);
        this.rulesPerPrincipal.remove(principal.getName());
    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

     *         if not found.
     */
    private PrincipalRule lookupPrincipalRule(String principal,
            String locatorName)
    {
        PrincipalRule pr = (PrincipalRule) principalRules
                .get(makePrincipalRuleKey(principal, locatorName));
        if (pr != null) { return pr; }
        Criteria c = new Criteria();
        c.addEqualTo("principalName", principal);
        c.addEqualTo("locatorName", locatorName);

        pr = (PrincipalRule) getPersistenceBrokerTemplate().getObjectByQuery(
                QueryFactory.newQuery(getPrincipalRuleClass(), c));

        principalRules.put(makePrincipalRuleKey(principal, locatorName), pr);
        if (pr != null) pr.getProfilingRule().setResolvers(resolvers);
        return pr;
    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

        String[] names = new String[result.size()];
        Iterator it = result.iterator();
        int ix = 0;
        while (it.hasNext())
        {
            PrincipalRule pr = (PrincipalRule) it.next();
            names[ix] = pr.getLocatorName();
            pr.getProfilingRule().setResolvers(resolvers);
            ix++;
        }
        return names;
    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

        rules = getPersistenceBrokerTemplate().getCollectionByQuery(
                QueryFactory.newQuery(getPrincipalRuleClass(), c));
        Iterator r = rules.iterator();
        while (r.hasNext())
        {
            PrincipalRule pr = (PrincipalRule) r.next();
            ProfilingRule rule = pr.getProfilingRule();
            if (rule != null) rule.setResolvers(resolvers);
        }
        this.rulesPerPrincipal.put(principal.getName(), rules);
        return rules;
    }
View Full Code Here

Examples of org.apache.jetspeed.profiler.rules.PrincipalRule

        Collection rules = getRulesForPrincipal(principal);

        Iterator it = rules.iterator();
        while (it.hasNext())
        {
            PrincipalRule pr = (PrincipalRule) it.next();
            locators.put(pr.getLocatorName(), getProfile(context, pr
                    .getLocatorName()));
        }
        return locators;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.