Package org.jasig.portal.portlet.om

Examples of org.jasig.portal.portlet.om.IPortletPreference


        //Actually "store" the stored prefs
        this.targetPrefs = new LinkedHashMap<String, IPortletPreference>(this.storedPrefs);
       
        assertEquals(1, this.storedPrefs.size());
       
        IPortletPreference pref = this.storedPrefs.get("key");
        assertNotNull(pref);
        assertEquals("key", pref.getName());
        assertArrayEquals(new String[] { "modified" }, pref.getValues());
        assertFalse(pref.isReadOnly());
       
       
        //Get the current value
        String[] values = portletPreferences.getValues("key", null);
        assertArrayEquals(new String[] { "modified" }, values);
View Full Code Here


            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
                return null;
            }
        });

        this.execute(new Callable<Object>() {
            @Override
            public Object call() throws Exception {
                //T1 - Verify it was converted from interim to persistent
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                assertEquals(1, preferences.size());
               
                //T2 - get the entity and add preferences
                final IPortletEntityId localPortletEntityId = executeInThread("T2.1", new Callable<IPortletEntityId>() {
                    @Override
                    public IPortletEntityId call() throws Exception {
                        //T2 - Get entity
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId.getStringId());
                        assertEquals(portletEntity, portletEntity);
       
                        //T2 - add preference
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        preferences.clear();
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, portletEntity);
                       
                        return portletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from persistent to interim
                        final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, localPortletEntityId);
                        assertNotNull(portletEntity);
                        assertEquals(SessionPortletEntityImpl.class, portletEntity.getClass());
                        final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(0, preferences.size());
                       
                        return null;
                    }
                });
       

                //T1 - add preference 2
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                preferences.add(portletPreference);
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

                        final IPortletEntity localPortletEntity = portletEntityRegistry.getPortletEntity(request, portletEntity.getPortletEntityId().getStringId());
                        assertEquals(portletEntity, localPortletEntity);
       
                        //T2 - Add a preference
                        final List<IPortletPreference> preferences = localPortletEntity.getPortletPreferences();
                        final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                        preferences.add(portletPreference);
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, localPortletEntity);
                       
View Full Code Here

                        final IPortletEntity localPortletEntity = portletEntityRegistry.getPortletEntity(request, portletEntity.getPortletEntityId().getStringId());
                        assertEquals(portletEntity, localPortletEntity);
       
                        //T2 - Add a preference
                        final List<IPortletPreference> preferences = localPortletEntity.getPortletPreferences();
                        final IPortletPreference portletPreference = new PortletPreferenceImpl("pref2", false, "value");
                        preferences.add(portletPreference);
                       
                        //T2 - Store the entity
                        portletEntityRegistry.storePortletEntity(request, localPortletEntity);
                       
                        return localPortletEntity.getPortletEntityId();
                    }
                });

                //T2 - verify entity was made persistent
                executeInThread("T2.2", new Callable<Object>() {
                    @Override
                    public Object call() throws Exception {
                       
                        //T2 - Verify it was converted from interim to persistent
                        IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
                        assertEquals(PersistentPortletEntityWrapper.class, portletEntity.getClass());
                        List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                        assertEquals(1, preferences.size());
                       
                        return null;
                    }
                });
       
                //T1 - Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref1", false, "value");
                preferences.add(portletPreference);
       
                //T1 - Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

            public Object call() throws Exception {
                final IPortletEntity portletEntity = portletEntityRegistry.getPortletEntity(request, portletEntityId);
               
                //Add a preference
                final List<IPortletPreference> preferences = portletEntity.getPortletPreferences();
                final IPortletPreference portletPreference = new PortletPreferenceImpl("pref", false, "value");
                preferences.add(portletPreference);
       
                //Store the entity
                portletEntityRegistry.storePortletEntity(request, portletEntity);
               
View Full Code Here

   
    protected final IPortletPreference getPortletPreference(String key) {
        Assert.notNull(key, "Preference Key cannot be null");
       
        final Map<String, IPortletPreference> targetPortletPreferences = this.getTargetPortletPreferences();
        final IPortletPreference portletPreference = targetPortletPreferences.get(key);
        if (portletPreference != null) {
            return portletPreference;
        }
       
        final Map<String, IPortletPreference> basePortletPreferences = this.getBasePortletPreferences();
View Full Code Here

        return basePortletPreferences.get(key);
    }

    @Override
    public final boolean isReadOnly(String key) {
        final IPortletPreference portletPreference = this.getPortletPreference(key);
        return portletPreference != null && portletPreference.isReadOnly();
    }
View Full Code Here

TOP

Related Classes of org.jasig.portal.portlet.om.IPortletPreference

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.