Package org.apache.jetspeed.om.profile

Examples of org.apache.jetspeed.om.profile.ProfileLocator


     * Test the base link
     * @throws Exception
     */
    public void testBaseLink() throws Exception
    {
        ProfileLocator profileLocator = null;

        // Create the RunData object to be used during testing.
        RunData rundata = RunDataFactory.getRunData( request, response, config );
        assertNotNull( "Got rundata", rundata);
        TurbineTestUtilities.setupRunData(rundata);
View Full Code Here


                    if (logger.isDebugEnabled())
                    {
                        logger.debug("BaseJetspeedLink: elementValue = " + elementValue);
                    }
                    uriPathElement = JetspeedResources.PATH_PORTLETID_KEY;
                    ProfileLocator baseLocator = Profiler.createLocator();
                    Profile baseProfile = null;
                    switch (rootType)
                    {
                        case JetspeedLink.DEFAULT:
                            break;
                        case JetspeedLink.CURRENT:
                            baseProfile = rundata.getProfile();
                            break;
                        case JetspeedLink.GROUP:
                            baseLocator.setGroupByName(rootValue);
                            break;
                        case JetspeedLink.ROLE:
                            baseLocator.setRoleByName(rootValue);
                            break;
                        case JetspeedLink.USER:
                            try
                            {
                                if (logger.isDebugEnabled())
                                {
                                    logger.debug("BaseJetspeedLink: rootValue user = " + rootValue);
                                }
                                baseLocator.setUser(org.apache.jetspeed.services.JetspeedSecurity.getUser(rootValue));
                            }
                            catch (Exception se)
                            {
                                logger.error("Exception",  se);
                                return null;
                            }
                            break;
                    }
                   
                    if ((rootType != JetspeedLink.CURRENT) && (rootType != JetspeedLink.DEFAULT))
                    {
                        if (mediaType != null && mediaType.length() > 0)
                        {
                            baseLocator.setMediaType(mediaType);
                        }
                        if (language != null && language.length() > 0)
                        {
                            baseLocator.setLanguage(language);
                        }
                        if (country != null && country.length() > 0)
                        {
                            baseLocator.setCountry(country);
                        }
                        if (pageName != null && pageName.length() > 0)
                        {
                            baseLocator.setName(pageName);
                        }
                        baseProfile = Profiler.getProfile(baseLocator);
                    }
                  
                    if (logger.isDebugEnabled())
                    {
                        logger.debug("BaseJetspeedLink: baseLocator = " + baseLocator.getPath());
                    }

                    if ((baseProfile != null) && (elementValue != null))
                    {
                        if (logger.isDebugEnabled())
View Full Code Here

        }

        // if we have not yet setup for customization, do so now
        if (jdata.getCustomizedProfile() == null)
        {
            ProfileLocator locator = (ProfileLocator)jdata.getProfile().clone();

            if (editMediaType != null)
            {
                locator.setMediaType(editMediaType);
            }

            // get a profile to edit
            profile = (Profile) Profiler.getProfile(locator).clone();
            jdata.setCustomizedProfile(profile);
View Full Code Here

        if (null == path)
        {
            return new JetspeedClearElement("Path parameter not set");
        }
        ProfileLocator locator = Profiler.createLocator();
        locator.createFromPath(path);
        String id = locator.getId();

        try
        {
            Profile profile = Profiler.getProfile(locator);
            PSMLDocument doc = profile.getDocument();
View Full Code Here

        if (null == path)
        {
            return new JetspeedClearElement("Path parameter not set");
        }

        ProfileLocator locator = Profiler.createLocator();
        locator.createFromPath(path);
        String id = locator.getId();

        try
        {
            Profile profile = Profiler.getProfile(locator);
            PSMLDocument doc = profile.getDocument();
View Full Code Here

     */

    public void testLocatorCriteria() throws Exception
    {

        ProfileLocator locator = new BaseProfile();
        locator.setMediaType("html");
        locator.setLanguage("en");
        locator.setName("default.psml");
           
        Criteria criteria = new Criteria();

        String mediaType = locator.getMediaType();
        String language = locator.getLanguage();
        String country = locator.getCountry();
        String pageName = locator.getName();
        String userName = "anon";

        assertTrue(country == null);

        if (userName != null && userName.length() > 0)
View Full Code Here

        assertNotNull( "Got profile from Profiler", profile);
       
        // Verify the profile location information in the profile
        if (profile instanceof ProfileLocator)
        {
            ProfileLocator profileLocator = (ProfileLocator) profile;
            assertTrue("Verify the 'anonymous' is set", profileLocator.getAnonymous());
            assertNull("Verify the group is null", profileLocator.getGroup());
            assertNull("Verify the role is null", profileLocator.getRole());
        } else
        {
            assertTrue( "profile does not implement ProfileLocator", false);
        }
       
View Full Code Here

       
        // Verify the profile location information in the profile
        if (profile instanceof ProfileLocator)
        {
            // FIXME: Need to verify 'anonymous' and group name
            ProfileLocator profileLocator = (ProfileLocator) profile;
//            assertTrue("Verify the 'anonymous' is set", profileLocator.getAnonymous());
            assertNotNull("Verify the group is not null", profileLocator.getGroup());
            assertNull("Verify the role is null", profileLocator.getRole());
        } else
        {
            assertTrue( "profile does not implement ProfileLocator", false);
        }
        TurbineTestUtilities.generatePage(rundata);
View Full Code Here

        assertNotNull( "Got profile from Profiler", profile);
       
        // Verify the profile location information in the profile
        if (profile instanceof ProfileLocator)
        {
            ProfileLocator profileLocator = (ProfileLocator) profile;
            // FIXME: Need to verify 'anonymous' and page name
            assertTrue("Verify the 'anonymous' is set", profileLocator.getAnonymous());
            assertNull("Verify the group is null", profileLocator.getGroup());
            assertNull("Verify the role is null", profileLocator.getRole());
            assertEquals("Verify the page name", profileLocator.getName(), TEST_PAGE + ".psml");
        } else
        {
            assertTrue( "profile does not implement ProfileLocator", false);
        }
        TurbineTestUtilities.generatePage(rundata);
View Full Code Here

        assertNotNull( "Got profile from Profiler", profile);
       
        // Verify the profile location information in the profile
        if (profile instanceof ProfileLocator)
        {
            ProfileLocator profileLocator = (ProfileLocator) profile;
            // FIXME: Need to verify 'anonymous' and page name
            assertTrue("Verify the 'anonymous' is not", !profileLocator.getAnonymous());
            assertNull("Verify the group is null", profileLocator.getGroup());
            assertNull("Verify the role is null", profileLocator.getRole());
            assertNotNull("Verify the user is not null", profileLocator.getUser());
            assertTrue("Verify the user is logged in", profileLocator.getUser().hasLoggedIn());
            assertEquals("Verify the user's username", profileLocator.getUser().getUserName(),TEST_USER);
            assertEquals("Verify the page name", profileLocator.getName(), TEST_DEFAULT_PAGE + ".psml");
        } else
        {
            assertTrue( "profile does not implement ProfileLocator", false);
        }
        TurbineTestUtilities.generatePage(rundata);
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.profile.ProfileLocator

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.