Package org.apache.rave.model

Examples of org.apache.rave.model.PortalPreference


    public void testGetPreference() {
        final String key = "title";
        expect(repository.getByKey(key)).andReturn(titlePreference());
        replay(repository);

        final PortalPreference preference = service.getPreference(key);
        verify(repository);

        assertEquals("Rave", preference.getValue());
    }
View Full Code Here


    public void testGetPreference_notExisting() {
        final String key = "foo";
        expect(repository.getByKey(key)).andReturn(null);
        replay(repository);

        final PortalPreference preference = service.getPreference(key);
        verify(repository);

        assertNull(preference);
    }
View Full Code Here

    @Test
    public void testSaveKeyValue_new() {
        final String key = "foo";
        final String value = "bar";
        PortalPreference fooBar = new PortalPreferenceImpl(key, value);
        PortalPreferenceImpl fooBarSaved = new PortalPreferenceImpl(key, value);

        expect(repository.getByKey(key)).andReturn(null).once();
        expect(repository.save(fooBar)).andReturn(fooBarSaved).once();
View Full Code Here

    public void testSaveKeyValues_new() {
        final String key = "foo";
        List<String> values = new ArrayList<String>();
        values.add("bar");
        values.add("baz");
        PortalPreference fooBar = new PortalPreferenceImpl(key, values);
        PortalPreferenceImpl fooBarSaved = new PortalPreferenceImpl(key, values);

        expect(repository.getByKey(key)).andReturn(null).once();
        expect(repository.save(fooBar)).andReturn(fooBarSaved).once();
        replay(repository);
View Full Code Here

        verify(repository);
    }

    @Test
    public void testSavePreference() {
        PortalPreference title = titlePreference();
        PortalPreferenceImpl savedTitle = new PortalPreferenceImpl("title", "Rave");

        expect(repository.save(title)).andReturn(savedTitle).once();
        replay(repository);
View Full Code Here

        service.savePreference(title);
        verify(repository);
    }

    private static List<PortalPreference> portalPreferenceList() {
        PortalPreference title = titlePreference();

        List<String> colors = new ArrayList<String>();
        colors.add("red");
        colors.add("yellow");
        colors.add("blue");
        PortalPreference colorPref = new PortalPreferenceImpl("colors", colors);

        List<PortalPreference> preferences = new ArrayList<PortalPreference>();
        preferences.add(title);
        preferences.add(colorPref);
View Full Code Here

    }

    @Override
    @Transactional
    public void savePreference(String key, List<String> values) {
        PortalPreference preference = getPreference(key);
        if (preference == null) {
            preference = new PortalPreferenceImpl(key, values);
        } else {
            preference.setValues(values);
        }
        this.savePreference(preference);
    }
View Full Code Here

     * (non-Javadoc)
     * @see org.apache.rave.portal.service.WidgetResolverService#addWidget(org.apache.rave.model.Widget)
     */
    @Override
    public Widget addWidget(Widget widget) throws Exception{
        PortalPreference status = portalPreferenceService.getPreference(PortalPreferenceKeys.INITIAL_WIDGET_STATUS);
        User user = userService.getAuthenticatedUser();
        widget.setOwnerId(user.getId());
        if (status != null && status.getValue().equals("PUBLISHED")){
            widget.setWidgetStatus(WidgetStatus.PUBLISHED);
        } else {
            widget.setWidgetStatus(WidgetStatus.PREVIEW);
        }
        return widgetService.registerNewWidget(widget);
View Full Code Here

     * (non-Javadoc)
     * @see org.apache.rave.portal.service.RemoteWidgetResolverService#isPublished()
     */
    @Override
    public boolean isPublished() {
        PortalPreference status = portalPreferenceService.getPreference(PortalPreferenceKeys.INITIAL_WIDGET_STATUS);
        if (status != null && status.getValue().equals("PUBLISHED")){
            return true;
        }
        return false;
    }
View Full Code Here

    /**
     * Get the store URL
     * @return the URL for the store; either as set in portal preferences or the default value
     */
    private String getStoreUrl(){
        PortalPreference storePref = portalPreferenceService.getPreference(PortalPreferenceKeys.EXTERNAL_MARKETPLACE_URL);
        if (storePref != null){
            return storePref.getValue();
        } else {
            return DEFAULT_URL;
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.rave.model.PortalPreference

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.