Package org.apache.jetspeed.om.page

Examples of org.apache.jetspeed.om.page.BaseFragmentElement


            }
            boolean contentFragmentIsReference = (contentFragmentImpl.getReference() != null);
           
            // retrieve current page or template and fragments from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentPageImpl.getPageOrTemplate().getPath());
            BaseFragmentElement fromFragmentElement = pageOrTemplate.getFragmentById(fromContentFragmentImpl.getFragment().getId());
            if (!(fromFragmentElement instanceof Fragment))
            {
                throw new IllegalArgumentException("Move from fragmentId and page not consistent");
            }
            Fragment fromFragment = (Fragment)fromFragmentElement;
            String pageFragmentId = (contentFragmentIsReference ? contentFragmentImpl.getReference().getId() : contentFragmentImpl.getFragment().getId());
            BaseFragmentElement fragment = fromFragment.getFragmentById(pageFragmentId);
            if (fragment == null)
            {
                throw new IllegalArgumentException("Move fragmentId and page not consistent");               
            }
            BaseFragmentElement toFragmentElement = pageOrTemplate.getFragmentById(toContentFragmentImpl.getFragment().getId());
            if (!(toFragmentElement instanceof Fragment))
            {
                throw new IllegalArgumentException("Move to fragmentId and page not consistent");
            }
            Fragment toFragment = (Fragment)toFragmentElement;
View Full Code Here


       
        log.debug("PageLayoutComponentImpl.newContentPage(): construct ContentPage: id="+contentPageImpl.getId()+", path="+contentPageImpl.getPath());
       
        // generate root and nested content fragments
        BaseFragmentsElement definition = null;
        BaseFragmentElement rootFragment = null;
        boolean rootTemplate = false;
        if (pageTemplate != null)
        {
            definition = pageTemplate;
            rootFragment = definition.getRootFragment();
View Full Code Here

            boolean contentFragmentIsReference = (contentFragmentImpl.getReference() != null);
           
            // retrieve current page or template and fragment from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentPageImpl.getPageOrTemplate().getPath());
            String pageFragmentId = (contentFragmentIsReference ? contentFragmentImpl.getReference().getId() : contentFragmentImpl.getFragment().getId());
            BaseFragmentElement fragment = pageOrTemplate.getFragmentById(pageFragmentId);
            if (fragment == null)
            {
                throw new IllegalArgumentException("Remove fragmentId and page not consistent");               
            }

            // check for edit permission
            fragment.checkAccess(JetspeedActions.EDIT);
           
            // remove fragment and update in page manager
            boolean update = (pageOrTemplate.removeFragmentById(pageFragmentId) != null);
            if (update)
            {
View Full Code Here

        {
            // validate content fragment and lookup current fragment
            // of page or page template from page manager and check
            // edit or view access requirements
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            BaseFragmentElement fragment = lookupPageOrTemplateFragment(contentFragmentImpl, scope);
           
            // update fragment decorator and page or page template in
            // page manager
            boolean update = false;
            decoratorName = (!Utils.isNull(decoratorName) ? decoratorName : null);
            if (((decoratorName != null) && !decoratorName.equals(fragment.getDecorator()) ||
                ((decoratorName == null) && (fragment.getDecorator() != null))))
            {
                fragment.setDecorator(scope, scopeValue, decoratorName);
                update = true;
            }
            if (update)
            {
                updatePageOrPageTemplateFragmentProperties(fragment, scope);
View Full Code Here

                throw new IllegalArgumentException("Only page fragments can be modified");
            }
           
            // retrieve current fragment and page or template from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentFragmentImpl.getPageOrTemplate().getPath());
            BaseFragmentElement foundFragment = pageOrTemplate.getFragmentById(contentFragmentImpl.getFragment().getId());
            if (!(foundFragment instanceof Fragment))
            {
                throw new IllegalArgumentException("Fragment and page not consistent");               
            }
            Fragment fragment = (Fragment)foundFragment;
View Full Code Here

        {
            // validate content fragment and lookup current fragment
            // of page or page template from page manager and check
            // edit or view access requirements
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            BaseFragmentElement fragment = lookupPageOrTemplateFragment(contentFragmentImpl, scope);
           
            // update fragment position and page or page template
            // in page manager
            boolean update = false;
            if (!Utils.isNull(x))
            {
                if (x != fragment.getLayoutX())
                {
                    fragment.setLayoutX(scope, scopeValue, x);
                    update = true;
                }
            }
            if (!Utils.isNull(y))
            {
                if (y != fragment.getLayoutY())
                {
                    fragment.setLayoutY(scope, scopeValue, y);
                    update = true;
                }
            }
            if (!Utils.isNull(z))
            {
                if (z != fragment.getLayoutZ())
                {
                    fragment.setLayoutZ(scope, scopeValue, z);
                    update = true;
                }
            }
            if (!Utils.isNull(width))
            {
                if (width != fragment.getLayoutWidth())
                {
                    fragment.setLayoutWidth(scope, scopeValue, width);
                    update = true;
                }
            }
            if (!Utils.isNull(height))
            {
                if (height != fragment.getLayoutHeight())
                {
                    fragment.setLayoutHeight(scope, scopeValue, height);
                    update = true;
                }
            }
            if (update)
            {
View Full Code Here

            boolean contentFragmentIsReference = (contentFragmentImpl.getReference() != null);
           
            // retrieve current fragment and page or template from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentFragmentImpl.getPageOrTemplate().getPath());
            String pageFragmentId = (contentFragmentIsReference ? contentFragmentImpl.getReference().getId() : contentFragmentImpl.getFragment().getId());
            BaseFragmentElement fragment = pageOrTemplate.getFragmentById(pageFragmentId);
            if (fragment == null)
            {
                throw new IllegalArgumentException("Fragment and page not consistent");               
            }

            // check for edit permission
            fragment.checkAccess(JetspeedActions.EDIT);           

            // update fragment preferences and page in page manager
            fragment.getPreferences().clear();
            if (preferences != null)
            {
                Iterator preferencesIter = preferences.entrySet().iterator();
                while (preferencesIter.hasNext())
                {
                    Map.Entry preferencesEntry = (Map.Entry)preferencesIter.next();
                    FragmentPreference preference = pageManager.newFragmentPreference();
                    preference.setName((String)preferencesEntry.getKey());
                    Object values = preferencesEntry.getValue();
                    if (values instanceof String)
                    {
                        preference.getValueList().add((String)values);
                    }
                    else if (values instanceof String [])
                    {
                        preference.getValueList().addAll(Arrays.asList(((String [])values)));
                    }
                    else if (values instanceof FragmentPreference)
                    {
                        FragmentPreference fragmentPreference = (FragmentPreference)values;
                        preference.setReadOnly(fragmentPreference.isReadOnly());
                        preference.getValueList().addAll(fragmentPreference.getValueList());
                    }
                    else if (values instanceof PortletPreference)
                    {
                        PortletPreference portletPreference = (PortletPreference)values;
                        preference.setReadOnly(portletPreference.isReadOnly());
                        String [] prefValues = portletPreference.getValues();
                        if (prefValues != null)
                        {
                            preference.getValueList().addAll(Arrays.asList(prefValues));
                        }
                    }
                    else
                    {
                        throw new IllegalArgumentException("Unexpected preference value type");
                    }
                    fragment.getPreferences().add(preference);
                }
            }
            updatePage(pageOrTemplate);

            // update content context
View Full Code Here

        {
            // validate content fragment and lookup current fragment
            // of page or page template from page manager and check
            // edit or view access requirements
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            BaseFragmentElement fragment = lookupPageOrTemplateFragment(contentFragmentImpl, scope);
           
            // update fragment property and page or page template
            // in page manager
            propValue = (!Utils.isNull(propValue) ? propValue : null);
            String currentPropValue = fragment.getProperty(propName, scope, scopeValue);
            if (((propValue == null) && (currentPropValue != null)) || ((propValue != null) && !propValue.equals(currentPropValue)))
            {
                fragment.setProperty(propName, scope, scopeValue, propValue);
                updatePageOrPageTemplateFragmentProperties(fragment, scope);
            }

            // update content context
            contentFragmentImpl.setProperty(propName, scope, scopeValue, propValue);
View Full Code Here

            }
           
            // retrieve current fragment reference and page or template from page manager
            BaseFragmentsElement pageOrTemplate = getPageOrTemplate(contentFragmentImpl.getPageOrTemplate().getPath());
            String pageFragmentId = (contentFragmentIsReference ? contentFragmentImpl.getReference().getId() : contentFragmentImpl.getFragment().getId());
            BaseFragmentElement fragment = pageOrTemplate.getFragmentById(pageFragmentId);
            if (fragment == null)
            {
                throw new IllegalArgumentException("Fragment and page not consistent");               
            }
            if (!(fragment instanceof FragmentReference))
View Full Code Here

        {
            // validate content fragment and lookup current fragment
            // of page or page template from page manager and check
            // edit or view access requirements
            ContentFragmentImpl contentFragmentImpl = (ContentFragmentImpl)contentFragment;
            BaseFragmentElement fragment = lookupPageOrTemplateFragment(contentFragmentImpl, scope);
           
            // update fragment row and column and page or page
            // template in page manager
            boolean update = false;
            if (!Utils.isNull(row))
            {
                if (row != fragment.getLayoutRow())
                {
                    fragment.setLayoutRow(scope, scopeValue, row);
                    update = true;
                }
            }
            if (!Utils.isNull(column))
            {
                if (column != fragment.getLayoutColumn())
                {
                    fragment.setLayoutColumn(scope, scopeValue, column);
                    update = true;
                }
            }
            if (update)
            {
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.BaseFragmentElement

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.