Package org.apache.jetspeed.profiler.rules

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


                {
                    rulesPerPrincipal.remove(principalName);
                    Iterator it = rules.iterator();
                    while (it.hasNext())
                    {
                        PrincipalRule rule = (PrincipalRule)it.next();
                        String key = this.makePrincipalRuleKey(rule.getPrincipalName(), rule.getLocatorName());
                        principalRules.remove(key);
                    }
                }
            }
        }
View Full Code Here


        {
            ProfilingRule pRule = pm.getRule(pr.getRule());

            try
            {
                PrincipalRule p1 = pm.createPrincipalRule();
                p1.setLocatorName(pr.getLocator());
                p1.setProfilingRule(pRule);
                p1.setPrincipalName(principalName);
                pm.storePrincipalRule(p1);
            }
            catch (Exception eRole)
            {
                eRole.printStackTrace();
View Full Code Here

                                String locatorName = ((PrincipalRule) ruleMap
                                        .get("rule")).getLocatorName();
                                for (Iterator ruleIter = rules.iterator(); ruleIter
                                        .hasNext();)
                                {
                                    PrincipalRule rule = (PrincipalRule) ruleIter
                                            .next();
                                    if (rule.getLocatorName().equals(
                                            locatorName))
                                    {
                                        getServiceLocator().getProfiler()
                                                .deletePrincipalRule(rule);
                                        getServiceLocator()
                                                .getAuditActivity()
                                                .logAdminAuthorizationActivity(
                                                        getPortletRequest()
                                                                .getUserPrincipal()
                                                                .getName(),
                                                        getIPAddress(),
                                                        getSelectedPrincipal(),
                                                        AuditActivity.USER_DELETE_PROFILE,
                                                        rule.getProfilingRule()
                                                                .getId()
                                                                + "-"
                                                                + rule
                                                                        .getLocatorName(),
                                                        AdminPortletWebPage.USER_ADMINISTRATION);
                                    }
                                }
                            }
View Full Code Here

                {
                    for (Iterator it = getServiceLocator().getProfiler()
                            .getRulesForPrincipal(getPrincipal()).iterator(); it
                            .hasNext();)
                    {
                        PrincipalRule rule = (PrincipalRule) it.next();
                        Map ruleMap = new HashMap();
                        ruleMap.put("rule", rule);
                        ruleMap.put("checked", Boolean.FALSE);
                        this.userRules.add(ruleMap);
                    }
View Full Code Here

    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);
            // track cached principal rules
            trackCachedPrincipalRulesPut(principal.getName(), pr);
        } else
        {
            // Get the associated rule
            rule = pr.getProfilingRule();
        }

        return rule;
    }
View Full Code Here

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

            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);
        // track cached principal rules
        trackCachedPrincipalRulesPut(principal.getName(), pr);
View Full Code Here

     *         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));
        if (pr != null) pr.getProfilingRule().setResolvers(resolvers);

        principalRules.put(makePrincipalRuleKey(principal, locatorName), pr);
        // track cached principal rules
        trackCachedPrincipalRulesPut(principal, pr);
        return pr;
View Full Code Here

        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

        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

TOP

Related Classes of org.apache.jetspeed.profiler.rules.PrincipalRule

Copyright © 2018 www.massapicom. 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.