Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IPreference


   * Bookmark Set, or the currently selected Bookmark Set otherwise.
   * @throws PersistenceException in case of an error while loading.
   */
  public static IFolder getSelectedParent(IFolder folder) throws PersistenceException {
    String selectedBookMarkSetPref = BookMarkExplorer.getSelectedBookMarkSetPref(OwlUI.getWindow());
    IPreference preference = DynamicDAO.getDAO(IPreferenceDAO.class).load(selectedBookMarkSetPref);
    if (preference != null) {
      Long selectedRootFolderID = preference.getLong();

      /* Check if available Parent is still valid */
      if (folder != null) {
        if (hasParent(folder, new FolderReference(selectedRootFolderID)))
          return folder;
View Full Code Here


    }

    /* Otherwise use visible root-folder */
    if (folder == null) {
      String selectedBookMarkSetPref = BookMarkExplorer.getSelectedBookMarkSetPref(OwlUI.getWindow());
      IPreference preference = DynamicDAO.getDAO(IPreferenceDAO.class).load(selectedBookMarkSetPref);
      if (preference != null) {
        Long selectedRootFolderID = preference.getLong();
        if (selectedRootFolderID != null)
          folder = new FolderReference(selectedRootFolderID).resolve();
      }

      /* Finally use the first root folder */
 
View Full Code Here

  public void testGetTypeAfterSave() throws Exception   {
    String booleanKey = "boolean";
    String longKey = "long";
    String stringKey = "string";

    IPreference booleanPref = fDao.loadOrCreate(booleanKey);
    booleanPref.putBooleans(true);
    fDao.save(booleanPref);

    IPreference longPref = fDao.loadOrCreate(longKey);
    longPref.putLongs(5L);
    fDao.save(longPref);

    IPreference stringPref = fDao.loadOrCreate(stringKey);
    stringPref.putStrings("some string");
    fDao.save(stringPref);

    booleanPref = null;
    stringPref = null;
    longPref = null;
View Full Code Here

  public final void testPutGetBoolean() throws Exception {
    String key1 = "key1";
    String key2 = "key2";
    String key3 = "key3";

    IPreference pref = fDao.loadOrCreate(key1);
    pref.putBooleans(true);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key2);
    pref.putBooleans(true);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key3);
    pref.putBooleans(false);
    fDao.save(pref);

    assertEquals(Boolean.TRUE, fDao.load(key1).getBoolean());
    assertEquals(Boolean.TRUE, fDao.load(key2).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key3).getBoolean());

    pref = fDao.loadOrCreate(key2);
    pref.putBooleans(false);
    fDao.save(pref);

    assertEquals(Boolean.TRUE, fDao.load(key1).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key2).getBoolean());
    assertEquals(Boolean.FALSE, fDao.load(key3).getBoolean());
View Full Code Here

   * @throws Exception
   */
  @Test
  public final void testActivation() throws Exception   {
    String key = "key";
    IPreference pref = fFactory.createPreference(key);
    pref.putBooleans(true);
    fDao.save(pref);
    pref = null;
    System.gc();
    assertEquals(Boolean.TRUE, fDao.load(key).getBoolean());
    String anotherKey = "anotherKey";
    String[] longs = new String[] { "2", "3", "5"};
    pref = fFactory.createPreference(anotherKey);
    pref.putStrings(longs);
    fDao.save(pref);
    longs = null;
    pref = null;
    System.gc();
    assertEquals(3, fDao.load(anotherKey).getStrings().length);
View Full Code Here

  public final void testPutGetStrings() throws Exception {
    String key1 = "key1";
    String key2 = "key2";
    String key3 = "key3";

    IPreference pref1 = fFactory.createPreference(key1);
    String[] value1 = new String[] { "value1.1", "value1.2", "value1.3" };
    pref1.putStrings(value1);

    IPreference pref2 = fFactory.createPreference(key2);
    String[] value2 = new String[] { "value2.1", "value2.2", "value2.3" };
    pref2.putStrings(value2);

    IPreference pref3 = fFactory.createPreference(key3);
    String[] value3 = new String[] { "value3.1", "value3.2", "value3.3" };
    pref3.putStrings(value3);

    fDao.save(pref1);
    fDao.save(pref2);
    fDao.save(pref3);
View Full Code Here

    long[] value1 = new long[] { 11, 12, 13 };
    long[] value2 = new long[] { 21, 22, 23 };
    long[] value3 = new long[] { 31, 32, 33 };

    IPreference pref = fDao.loadOrCreate(key1);
    pref.putLongs(value1);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    pref = fDao.loadOrCreate(key3);
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getLongs()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getLongs()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getLongs()));

    value2 = new long[] { 110, 120, 130 };
    pref = fDao.loadOrCreate(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getLongs()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getLongs()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getLongs()));
View Full Code Here

    int[] value1 = new int[] { 11, 12, 13 };
    int[] value2 = new int[] { 21, 22, 23 };
    int[] value3 = new int[] { 31, 32, 33 };

    IPreference pref = fFactory.createPreference(key1);
    pref.putIntegers(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putIntegers(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putIntegers(value3);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getIntegers()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getIntegers()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getIntegers()));

    value2 = new int[] { 110, 120, 130 };
    pref = fDao.loadOrCreate(key2);
    pref.putIntegers(value2);
    fDao.save(pref);

    assertEquals(true, Arrays.equals(value1, fDao.load(key1).getIntegers()));
    assertEquals(true, Arrays.equals(value2, fDao.load(key2).getIntegers()));
    assertEquals(true, Arrays.equals(value3, fDao.load(key3).getIntegers()));
View Full Code Here

    long value1 = 10;
    long value2 = 15;
    long value3 = 20;

    IPreference pref = fFactory.createPreference(key1);
    pref.putLongs(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putLongs(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(Long.valueOf(value1), fDao.load(key1).getLong());
    assertEquals(Long.valueOf(value2), fDao.load(key2).getLong());
    assertEquals(Long.valueOf(value3), fDao.load(key3).getLong());

    value3 = 5;
    pref.putLongs(value3);
    fDao.save(pref);

    assertEquals(Long.valueOf(value1), fDao.load(key1).getLong());
    assertEquals(Long.valueOf(value2), fDao.load(key2).getLong());
    assertEquals(Long.valueOf(value3), fDao.load(key3).getLong());
View Full Code Here

    String value1 = "value1";
    String value2 = "value2";
    String value3 = "value3";

    IPreference pref = fFactory.createPreference(key1);
    pref.putStrings(value1);
    fDao.save(pref);

    pref = fFactory.createPreference(key2);
    pref.putStrings(value2);
    fDao.save(pref);

    pref = fFactory.createPreference(key3);
    pref.putStrings(value3);
    fDao.save(pref);

    assertEquals(value1, fDao.load(key1).getString());
    assertEquals(value2, fDao.load(key2).getString());
    assertEquals(value3, fDao.load(key3).getString());

    value1 = "newValue1";
    pref = fDao.load(key1);
    pref.putStrings(value1);
    fDao.save(pref);

    assertEquals(value1, fDao.load(key1).getString());
    assertEquals(value2, fDao.load(key2).getString());
    assertEquals(value3, fDao.load(key3).getString());
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.IPreference

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.