Package org.apache.jetspeed.om.page.impl

Examples of org.apache.jetspeed.om.page.impl.FragmentPropertyImpl


                    allProperties.addAll(removedProperties);                   
                }
                Iterator allPropertiesIter = allProperties.iterator();
                while (allPropertiesIter.hasNext())
                {
                    FragmentPropertyImpl property = (FragmentPropertyImpl)allPropertiesIter.next();
                    property.setFragment(baseFragmentElementImpl);
                    String propertyScope = property.getScope();
                    String propertyScopeValue = property.getScopeValue();
                    if (updateAllScopes || ((scope == null) && (propertyScope == null)) || ((scope != null) && scope.equals(propertyScope)))
                    {
                        // classify property by scopes and create scoped lists
                        if (propertyScope == null)
                        {
                            if (globalFragmentPropertyList == null)
                            {
                                globalFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(baseFragmentElementImpl.getBaseFragmentsElement().getPath());
                            }
                        }
                        else if ((subject != null) && GROUP_AND_ROLE_PROPERTY_SCOPES_ENABLED)
                        {
                            boolean subjectHasPrincipal = false;
                            if (propertyScope.equals(USER_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = ((userPrincipal != null) && userPrincipal.getName().equals(propertyScopeValue));
                            }
                            else if (propertyScope.equals(GROUP_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = (SubjectHelper.getPrincipal(subject, Group.class, propertyScopeValue) != null);
                            }
                            else if (propertyScope.equals(ROLE_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = (SubjectHelper.getPrincipal(subject, Role.class, propertyScopeValue) != null);
                            }
                            if (subjectHasPrincipal)
                            {
                                if (principalPartialFragmentPropertyLists == null)
                                {
                                    principalPartialFragmentPropertyLists = new HashMap();
                                }
                                String principalKey = getFragmentPropertyListPrincipalKey(propertyScope, propertyScopeValue);
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(principalKey);
                                if (principalPartialFragmentPropertyList == null)
                                {
                                    principalPartialFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(propertyScope, principalKey);
                                    principalPartialFragmentPropertyLists.put(principalKey, principalPartialFragmentPropertyList);
                                }
                            }
                        }
                        else if ((subject != null) && propertyScope.equals(USER_PROPERTY_SCOPE))
                        {
                            if ((userPrincipal != null) && userPrincipal.getName().equals(propertyScopeValue))
                            {
                                if (principalPartialFragmentPropertyLists == null)
                                {
                                    principalPartialFragmentPropertyLists = new HashMap();
                                }
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(userPrincipalKey);
                                if (principalPartialFragmentPropertyList == null)
                                {
                                    principalPartialFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(USER_PROPERTY_SCOPE, userPrincipalKey);
                                    principalPartialFragmentPropertyLists.put(userPrincipalKey, principalPartialFragmentPropertyList);
                                }
                            }
                        }
                    }
                }
               
                // populate properties lists for cache updates and
                // update persistent properties
                Iterator propertiesIter = properties.iterator();
                while (propertiesIter.hasNext())
                {
                    FragmentPropertyImpl storeProperty = (FragmentPropertyImpl)propertiesIter.next();
                    String storePropertyScope = storeProperty.getScope();
                    String storePropertyScopeValue = storeProperty.getScopeValue();
                    if (updateAllScopes || ((scope == null) && (storePropertyScope == null)) || ((scope != null) && scope.equals(storePropertyScope)))
                    {
                        // classify and decompose update into individual caches:
                        // allow update only if scoped properties list created above
                        // exists since the subject matching rules are checked there
                        updateTransaction = (updateTransaction || (storeProperty.getIdentity() != 0));
                        boolean store = false;
                        if (storePropertyScope == null)
                        {
                            if (globalFragmentPropertyList != null)
                            {
                                globalFragmentPropertyList.add(storeProperty);
                                store = true;
                            }
                        }
                        else if (subject != null)
                        {
                            if (principalPartialFragmentPropertyLists != null)
                            {
                                String principalKey = getFragmentPropertyListPrincipalKey(storePropertyScope, storePropertyScopeValue);
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(principalKey);
                                if (principalPartialFragmentPropertyList != null)
                                {
                                    principalPartialFragmentPropertyList.add(storeProperty);
                                    store = true;
                                }
                            }
                        }
                        // store persistent property object
                        if (store)
                        {
                            getPersistenceBrokerTemplate().store(storeProperty);
                        }
                    }
                }
                if (removedProperties != null)
                {
                    Iterator removedPropertiesIter = removedProperties.iterator();
                    while (removedPropertiesIter.hasNext())
                    {
                        FragmentPropertyImpl deleteProperty = (FragmentPropertyImpl)removedPropertiesIter.next();
                        deleteProperty.setFragment(baseFragmentElementImpl);
                        String deletePropertyScope = deleteProperty.getScope();
                        String deletePropertyScopeValue = deleteProperty.getScopeValue();
                        if (updateAllScopes || ((scope == null) && (deletePropertyScope == null)) || ((scope != null) && scope.equals(deletePropertyScope)))
                        {
                            // classify and decompose delete: allow delete only
                            // if scoped properties list created above exists
                            // since the subject matching rules are checked there
View Full Code Here


        List filteredList = null;
        synchronized (principalFragmentPropertyList)
        {
            for (Iterator iter = principalFragmentPropertyList.iterator(); iter.hasNext();)
            {
                FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)iter.next();
                if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == baseFragmentElementImpl.getIdentity())
                {
                    if (filteredList == null)
                    {
                        filteredList = new ArrayList();
                    }
View Full Code Here

    {
        synchronized (principalFragmentPropertyList)
        {
            for (Iterator iter = principalFragmentPropertyList.iterator(); iter.hasNext();)
            {
                FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)iter.next();
                if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == baseFragmentElementImpl.getIdentity())
                {
                    iter.remove();
                }
            }
        }
View Full Code Here

                    // scan cached principal fragment property list
                    DatabasePageManagerCachedFragmentPropertyList cachedPrincipalFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)propertiesElement.getContent();
                    Iterator fragmentPropertyIter = cachedPrincipalFragmentPropertyList.iterator();
                    while (fragmentPropertyIter.hasNext())
                    {
                        FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)fragmentPropertyIter.next();
                        if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == fragmentId)
                        {
                            // remove cached principal fragment property list
                            DatabasePageManagerCache.principalPropertiesCache.removeQuiet(principalKey);
                            DatabasePageManagerCache.principalPropertiesPathCache.removeQuiet(principalKey);                           
                            break;
View Full Code Here

                    allProperties.addAll(removedProperties);                   
                }
                Iterator allPropertiesIter = allProperties.iterator();
                while (allPropertiesIter.hasNext())
                {
                    FragmentPropertyImpl property = (FragmentPropertyImpl)allPropertiesIter.next();
                    property.setFragment(baseFragmentElementImpl);
                    String propertyScope = property.getScope();
                    String propertyScopeValue = property.getScopeValue();
                    if (updateAllScopes || ((scope == null) && (propertyScope == null)) || ((scope != null) && scope.equals(propertyScope)))
                    {
                        // classify property by scopes and create scoped lists
                        if (propertyScope == null)
                        {
                            if (globalFragmentPropertyList == null)
                            {
                                globalFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(baseFragmentElementImpl.getBaseFragmentsElement().getPath());
                            }
                        }
                        else if ((subject != null) && GROUP_AND_ROLE_PROPERTY_SCOPES_ENABLED)
                        {
                            boolean subjectHasPrincipal = false;
                            if (propertyScope.equals(USER_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = ((userPrincipal != null) && userPrincipal.getName().equals(propertyScopeValue));
                            }
                            else if (propertyScope.equals(GROUP_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = (SubjectHelper.getPrincipal(subject, Group.class, propertyScopeValue) != null);
                            }
                            else if (propertyScope.equals(ROLE_PROPERTY_SCOPE))
                            {
                                subjectHasPrincipal = (SubjectHelper.getPrincipal(subject, Role.class, propertyScopeValue) != null);
                            }
                            if (subjectHasPrincipal)
                            {
                                if (principalPartialFragmentPropertyLists == null)
                                {
                                    principalPartialFragmentPropertyLists = new HashMap();
                                }
                                String principalKey = getFragmentPropertyListPrincipalKey(propertyScope, propertyScopeValue);
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(principalKey);
                                if (principalPartialFragmentPropertyList == null)
                                {
                                    principalPartialFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(propertyScope, principalKey);
                                    principalPartialFragmentPropertyLists.put(principalKey, principalPartialFragmentPropertyList);
                                }
                            }
                        }
                        else if ((subject != null) && propertyScope.equals(USER_PROPERTY_SCOPE))
                        {
                            if ((userPrincipal != null) && userPrincipal.getName().equals(propertyScopeValue))
                            {
                                if (principalPartialFragmentPropertyLists == null)
                                {
                                    principalPartialFragmentPropertyLists = new HashMap();
                                }
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(userPrincipalKey);
                                if (principalPartialFragmentPropertyList == null)
                                {
                                    principalPartialFragmentPropertyList = new DatabasePageManagerCachedFragmentPropertyList(USER_PROPERTY_SCOPE, userPrincipalKey);
                                    principalPartialFragmentPropertyLists.put(userPrincipalKey, principalPartialFragmentPropertyList);
                                }
                            }
                        }
                    }
                }
               
                // populate properties lists for cache updates and
                // update persistent properties
                Iterator propertiesIter = properties.iterator();
                while (propertiesIter.hasNext())
                {
                    FragmentPropertyImpl storeProperty = (FragmentPropertyImpl)propertiesIter.next();
                    String storePropertyScope = storeProperty.getScope();
                    String storePropertyScopeValue = storeProperty.getScopeValue();
                    if (updateAllScopes || ((scope == null) && (storePropertyScope == null)) || ((scope != null) && scope.equals(storePropertyScope)))
                    {
                        // classify and decompose update into individual caches:
                        // allow update only if scoped properties list created above
                        // exists since the subject matching rules are checked there
                        updateTransaction = (updateTransaction || (storeProperty.getIdentity() != 0));
                        boolean store = false;
                        if (storePropertyScope == null)
                        {
                            if (globalFragmentPropertyList != null)
                            {
                                globalFragmentPropertyList.add(storeProperty);
                                store = true;
                            }
                        }
                        else if (subject != null)
                        {
                            if (principalPartialFragmentPropertyLists != null)
                            {
                                String principalKey = getFragmentPropertyListPrincipalKey(storePropertyScope, storePropertyScopeValue);
                                DatabasePageManagerCachedFragmentPropertyList principalPartialFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)principalPartialFragmentPropertyLists.get(principalKey);
                                if (principalPartialFragmentPropertyList != null)
                                {
                                    principalPartialFragmentPropertyList.add(storeProperty);
                                    store = true;
                                }
                            }
                        }
                        // store persistent property object
                        if (store)
                        {
                            getPersistenceBrokerTemplate().store(storeProperty);
                        }
                    }
                }
                if (removedProperties != null)
                {
                    Iterator removedPropertiesIter = removedProperties.iterator();
                    while (removedPropertiesIter.hasNext())
                    {
                        FragmentPropertyImpl deleteProperty = (FragmentPropertyImpl)removedPropertiesIter.next();
                        deleteProperty.setFragment(baseFragmentElementImpl);
                        String deletePropertyScope = deleteProperty.getScope();
                        String deletePropertyScopeValue = deleteProperty.getScopeValue();
                        if (updateAllScopes || ((scope == null) && (deletePropertyScope == null)) || ((scope != null) && scope.equals(deletePropertyScope)))
                        {
                            // classify and decompose delete: allow delete only
                            // if scoped properties list created above exists
                            // since the subject matching rules are checked there
View Full Code Here

        List filteredList = null;
        synchronized (principalFragmentPropertyList)
        {
            for (Iterator iter = principalFragmentPropertyList.iterator(); iter.hasNext();)
            {
                FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)iter.next();
                if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == baseFragmentElementImpl.getIdentity())
                {
                    if (filteredList == null)
                    {
                        filteredList = new ArrayList();
                    }
View Full Code Here

    {
        synchronized (principalFragmentPropertyList)
        {
            for (Iterator iter = principalFragmentPropertyList.iterator(); iter.hasNext();)
            {
                FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)iter.next();
                if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == baseFragmentElementImpl.getIdentity())
                {
                    iter.remove();
                }
            }
        }
View Full Code Here

                // scan cached principal fragment property list
                DatabasePageManagerCachedFragmentPropertyList cachedPrincipalFragmentPropertyList = (DatabasePageManagerCachedFragmentPropertyList)propertiesElement.getContent();
                Iterator fragmentPropertyIter = cachedPrincipalFragmentPropertyList.iterator();
                while (fragmentPropertyIter.hasNext())
                {
                    FragmentPropertyImpl fragmentProperty = (FragmentPropertyImpl)fragmentPropertyIter.next();
                    if (((BaseFragmentElementImpl)fragmentProperty.getFragment()).getIdentity() == fragmentId)
                    {
                        // remove cached principal fragment property list
                        DatabasePageManagerCache.principalPropertiesCache.removeQuiet(principalKey);
                        DatabasePageManagerCache.principalPropertiesPathCache.removeQuiet(principalKey);                           
                        break;
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.om.page.impl.FragmentPropertyImpl

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.