Package org.apache.jetspeed.om.profile

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


        JetspeedRunData rundata,
        CapabilityMap cm)
        throws Exception
    {
        Vector profiles = new Vector();
        Profile profile = null;
        String paramRole =
            rundata.getParameters().getString(Profiler.PARAM_ROLE);
        Iterator groups =
            JetspeedSecurity.getGroups(rundata.getUser().getUserName());
        if (groups != null)
View Full Code Here


     * @exception Exception
     */
    protected Profile mergeGroupProfiles(RunData data, Vector profiles)
        throws Exception
    {
        Profile result = null;
        // If merge feature is not turned on, return
        // profile for the first group (if any)
        if (this.useGroupMerge == false)
        {
            if (profiles.size() > 0)
            {
                result = (Profile) profiles.get(0);
            }
        }
        // Proceed with merging all profiles
        else if (profiles.size() > 0)
        {
            // Sort the profiles by group name (Jetspeed should come out on top if all other
            // group names are lower case
            // TODO: Need to figure out a better method of controlling the tab sequence           
            Collections.sort(profiles, new Comparator()
            {
                public int compare(Object o1, Object o2)
                {
                    Profile e1 = (Profile) o1;
                    Profile e2 = (Profile) o2;
                    Comparable v1 = (Comparable) e1.getGroupName();
                    Comparable v2 = (Comparable) e2.getGroupName();
                    return v1.compareTo(v2);
                }
            });

            try
            {
                // Create an empty portlet container
                Portlets portlets = new PsmlPortlets();
                Control control = new PsmlControl();
                control.setName(this.groupmergeControl);
                portlets.setControl(control);
                Controller controller = new PsmlController();
                controller.setName(this.groupmergeController);
                portlets.setController(controller);

                // Set title
                portlets.setTitle("Home Page");

                // Set the skin
                Skin skin = new PsmlSkin();
                skin.setName(PortalToolkit.getSkin((String) null).getName());
                portlets.setSkin(skin);

                // Set top level security ref
                if (groupmergeSecurityref != null)
                {
                    SecurityEntry entry =
                        (SecurityEntry) Registry.getEntry(
                            Registry.SECURITY,
                            groupmergeSecurityref);
                    if (entry != null)
                    {
                        SecurityReference ref = new BaseSecurityReference();
                        ref.setParent(entry.getName());
                        portlets.setSecurityRef(ref);
                    }
                }

                String mediaType = null;

                // Process each group profile
                int paneCount = 0;
                for (Iterator it = profiles.iterator(); it.hasNext();)
                {
                    Profile groupProfile = (Profile) it.next();
                    mediaType =
                        mediaType == null
                            ? groupProfile.getMediaType()
                            : mediaType;
                    Profile tmpProfile = (Profile) groupProfile.clone();
                    Portlets tmpPortlets =
                        tmpProfile.getDocument().getPortlets();

                    // If topmost control is a tab control, then add each tab to the container
                    Control paneControl = tmpPortlets.getControl();
                    if (paneControl != null
                        && paneControl.getName().equals(this.groupmergeControl))
View Full Code Here

        throws ProfileException
    {
        try
        {
            JetspeedRunData rundata = (JetspeedRunData) data;
            Profile profile = createProfile();
            JetspeedUser user = rundata.getJetspeedUser();

            // get the media type from the capability map or rundata
            profile.setMediaType(getMediaType(rundata, cm));

            //  Is it a group, role, or user resource?
            //  It can only be one
            String param =
                rundata.getParameters().getString(Profiler.PARAM_GROUP);

            if (null != param)
            {
                // GROUP Resource
                profile.setGroup(JetspeedSecurity.getGroup(param));
            }
            else
            {
                param = rundata.getParameters().getString(Profiler.PARAM_ROLE);
                if (null != param)
                {
                    // ROLE Resource
                    if (user.hasLoggedIn())
                        // disallow role access for anonymous user
                    {
                        profile.setRole(JetspeedSecurity.getRole(param));
                    }
                    else
                    {
                        profile.setAnonymous(true);
                        profile.setUser(user);
                    }
                }
                else // it must be a user resource or anonymous resource
                    {
                    // accessing another user's resource
                    param =
                        rundata.getParameters().getString(Profiler.PARAM_USER);
                    if (null != param)
                    {

                        if (param
                            .equals(JetspeedSecurity.getAnonymousUserName()))
                        {
                            profile.setAnonymous(true);
                        }
                        if (user.getUserName().equals(param))
                        {
                            profile.setUser(user);
                        }
                        else
                        {
                            profile.setUser(JetspeedSecurity.getUser(param));
                        }
                    }
                    else
                    {
                        profile.setAnonymous(
                            user.getUserName().equals(
                                JetspeedSecurity.getAnonymousUserName()));
                        profile.setUser(user);
                    }
                }
            }

            // get resource name
            StringBuffer resource = new StringBuffer();
            param = rundata.getParameters().getString(Profiler.PARAM_PAGE);
            if (null == param)
            {
                // the default resource
                resource.append(resourceDefault);
                resource.append(resourceExt);
            }
            else
            { // a specific resource
                resource.append(param);
                if (-1 == param.indexOf(PATH_EXTENSION_DELIMITER))
                    resource.append(resourceExt);
            }
            profile.setName(resource.toString());

            // LANGUAGE
            getLanguageSettings(profile, rundata);

            PSMLDocument doc = fallback(profile);
            if (null != doc)
            {
                profile.setDocument(doc);
                return profile;
            }
        }
        catch (Exception e)
        {
View Full Code Here

        if (runDataService != null)
        {
            JetspeedRunData rundata = runDataService.getCurrentRunData();
            if (rundata != null)
            {
                Profile profile = rundata.getProfile();
                if (profile != null)
                {
                    pc.setPageId(profile.getId());
                }
            }
        }
        pc.setPortletId(id);
View Full Code Here

     * @return a new Profile object
     */
    public Profile getProfile(ProfileLocator locator) throws ProfileException
    {
        PSMLDocument doc = fallback(locator);
        Profile profile = createProfile(locator);
        profile.setDocument(doc);
        return profile;
    }
View Full Code Here

     * @param locator The description of the profile.
     * @return A new Profile object
     */
    public Profile createProfile(ProfileLocator locator)
    {
        Profile profile =
            (Profile) ServiceHelper.createObject(this.profileClass);
        profile.init(locator);
        return profile;
    }
View Full Code Here

        if (portlets == null)
        {
            portlets = new PsmlPortlets();
        }

        Profile profile = createProfile(locator);
        PSMLDocument doc = new BasePSMLDocument(null, portlets);
        profile.setDocument(doc);
        doc = PsmlManager.createDocument(profile);
        profile.setDocument(doc);
        return profile;
    }
View Full Code Here

        try
        {
            profile.setMediaType(contentType);

            PSMLDocument doc = PsmlManager.createDocument(profile);
            Profile newProfile = (Profile) profile.clone();
            newProfile.setDocument(doc);

            return newProfile;
        }
        catch (CloneNotSupportedException e)
        {
View Full Code Here

            this.consumer = consumer;
            profiles = query(locator);

            while (profiles.hasNext() )
            {
                Profile profile = (Profile)profiles.next();
                //dumpProfile(profile);
                try
                {
                    consumer.createDocument(profile);
                    count++;
View Full Code Here

     * @param portlets The PSML blob.
     * @return A new profile object representing the locator and PSML blob.
     */
    public Profile createUserProfile(JetspeedUserProfile entity, Portlets portlets)
    {
        Profile profile = Profiler.createProfile();
        try
        {
            JetspeedUser user = JetspeedSecurity.getUser(entity.getUserName());
            if (null == user)
            {
                user = JetspeedUserFactory.getInstance();
                user.setUserName(entity.getUserName());
            }
            profile.setUser(user);

            profile.setMediaType(entity.getMediaType());
            profile.setLanguage(entity.getLanguage());
            profile.setCountry(entity.getCountry());
            profile.setName(entity.getPage());
            profile.setDocument(getPSMLDocument(entity.getPage(), portlets));
        }
        catch (JetspeedSecurityException e)
        {
        }
        return profile;
View Full Code Here

TOP

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

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.