Package org.apache.rave.model

Examples of org.apache.rave.model.PortalPreference


        model.addAttribute(ModelKeys.CATEGORIES, categoryService.getAll());
        ControllerUtils.addNavItemsToModel(view, model, referringPageId, user);
    }

    public int getPageSize() {
        final PortalPreference pageSizePref = preferenceService.getPreference(PortalPreferenceKeys.PAGE_SIZE);
        if (pageSizePref == null) {
            return MAXIMUM_WIDGETS_PER_PAGE;
        }
        try {
            return Integer.parseInt(pageSizePref.getValue());
        } catch (NumberFormatException e) {
            return MAXIMUM_WIDGETS_PER_PAGE;
        }
    }
View Full Code Here


    public void setCategoryEditor(CategoryEditor categoryEditor) {
        this.categoryEditor = categoryEditor;
    }

    public int getPageSize() {
        final PortalPreference pageSizePref = preferenceService.getPreference(PortalPreferenceKeys.PAGE_SIZE);
        if (pageSizePref == null) {
            return DEFAULT_PAGE_SIZE;
        }
        try {
            return Integer.parseInt(pageSizePref.getValue());
        } catch (NumberFormatException e) {
            return DEFAULT_PAGE_SIZE;
        }
    }
View Full Code Here

    }
    return view;
  }

  private int getPageSize() {
    final PortalPreference pageSizePref = preferenceService
        .getPreference(PortalPreferenceKeys.PAGE_SIZE);
    if (pageSizePref == null) {
      return MAXIMUM_WIDGETS_PER_PAGE;
    }
    try {
      return Integer.parseInt(pageSizePref.getValue());
    } catch (NumberFormatException e) {
      return MAXIMUM_WIDGETS_PER_PAGE;
    }
  }
View Full Code Here

    }

    @Test
    public void convertPreference_valid(){

        PortalPreference pp = new PortalPreferenceImpl();
        pp.setKey("key");
        pp.setValues(Lists.<String>newLinkedList());
        MongoDbPortalPreference converted;
        MongoDbPortalPreference mpp = new MongoDbPortalPreference();
        mpp.setKey("carol");
        mpp.setValues(Lists.<String>newLinkedList());
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

        assertEquals(VALUES, preference.getValues());
    }

    @Test
    public void singleValuePreference() throws Exception {
        PortalPreference preference = new JpaPortalPreference(KEY, "bar");
        assertEquals(KEY, preference.getKey());
        assertEquals("bar", preference.getValue());
    }
View Full Code Here

        assertEquals("bar", preference.getValue());
    }

    @Test
    public void testGetValues() throws Exception {
        PortalPreference preference = new JpaPortalPreference(KEY, VALUES);
        assertEquals(KEY, preference.getKey());
        assertEquals(VALUES, preference.getValues());
    }
View Full Code Here

        assertEquals(VALUES, preference.getValues());
    }

    @Test
    public void testSetValues() throws Exception {
        PortalPreference preference = new JpaPortalPreference(KEY, VALUES);
        assertEquals(KEY, preference.getKey());
        assertEquals(VALUES, preference.getValues());
        preference.setValue("tree");
        assertEquals("tree", preference.getValue());
        assertEquals(1, preference.getValues().size());
    }
View Full Code Here

    }


    @Test(expected = NotSupportedException.class)
    public void getValueFailsForMultiValue() {
        PortalPreference preference = new JpaPortalPreference(KEY, VALUES);
        preference.getValue();
        assertFalse("Expected exception", true);

    }
View Full Code Here

    private String finalizeNewWidget(WidgetImpl widget, User user, String referringPageId){
        /*
         * By default, a new widget has a status of "PREVIEW", however this can be overridden in portal preferences,
         * skipping the need for an admin to approve a new widget.
         */
        PortalPreference status = preferenceService.getPreference(PortalPreferenceKeys.INITIAL_WIDGET_STATUS);
        if (status != null && status.getValue().equals("PUBLISHED")){
      widget.setWidgetStatus(WidgetStatus.PUBLISHED);
    } else {
          widget.setWidgetStatus(WidgetStatus.PREVIEW);
    }
       
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.