Examples of Preference


Examples of org.rssowl.core.model.internal.preferences.Preference

    savePreference(pref, values);
  }
 
  public void putLong(String key, long value) throws PersistenceException {
    Long valueLong = Long.valueOf(value);
    Preference pref = new Preference(key, Type.LONG);
    pref.addValue(valueLong.toString());
    savePreference(pref, valueLong);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

    Preference pref = new Preference(key, Type.LONG);
    pref.addValue(valueLong.toString());
    savePreference(pref, valueLong);
  }
  public void putLongs(String key, long[] values) throws PersistenceException {
    Preference pref = new Preference(key, Type.LONG_ARRAY);
    for (long value : values) {
      pref.addValue(String.valueOf(value));
    }
    savePreference(pref, values);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

      pref.addValue(String.valueOf(value));
    }
    savePreference(pref, values);
  }
  public void putString(String key, String value) throws PersistenceException {
    Preference pref = new Preference(key, Type.STRING);
    pref.addValue(value);
    savePreference(pref, value);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

    pref.addValue(value);
    savePreference(pref, value);
  }
 
  public void putStrings(String key, String[] values) throws PersistenceException {
    Preference pref = new Preference(key, Type.STRING_ARRAY);
    for (String value : values) {
      pref.addValue(value);
    }
    savePreference(pref, values);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

  }
 
  public void putBoolean(String key, boolean value)
      throws PersistenceException {
    Boolean valueBoolean = Boolean.valueOf(value);
    Preference pref = new Preference(key, Type.BOOLEAN);
    pref.addValue(valueBoolean.toString());
    savePreference(pref, valueBoolean);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

    Query query = fDb.ext().query();
    query.constrain(Preference.class);
    query.descend("fKey").constrain(key); //$NON-NLS-1$
    ObjectSet<Preference> prefs = query.execute();
    if (prefs.hasNext()) {
      Preference pref = prefs.next();
      fDb.activate(pref, Integer.MAX_VALUE);
      return pref;
    }
    return null;
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

    }
    return null;
  }

  private synchronized void savePreference(Preference preference, Object originalObject) throws PersistenceException {
    Preference savedPreference = findPreference(preference.getKey());
    boolean update = false;
    if (savedPreference == null)
      fDb.ext().set(preference, Integer.MAX_VALUE);
    else {
      update = true;

      if (savedPreference.getType() != preference.getType()) {
        throw new PersistenceException("Trying to replace an existing " + //$NON-NLS-1$
            "preference with a preference of a different type"); //$NON-NLS-1$
      }
      fDb.delete(savedPreference);
      fDb.ext().set(preference, Integer.MAX_VALUE);
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

    }
  }
  private Object getValues(String key)
      throws PersistenceException {
    Preference pref = findPreference(key);
    return getValues(pref);
  }
View Full Code Here

Examples of org.rssowl.core.model.internal.preferences.Preference

  public Long getLong(String key) throws PersistenceException {
    return (Long) getValues(key);
  }

  public boolean delete(String key) throws PersistenceException {
    Preference pref = findPreference(key);
    if (pref == null)
      return false;
   
    Object value = getValues(pref);
    fDb.delete(pref);
View Full Code Here

Examples of org.wildfly.clustering.singleton.election.Preference

    public void test() throws UnknownHostException {
        InetSocketAddress preferredAddress = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 1);
        InetSocketAddress otherAddress1 = new InetSocketAddress(InetAddress.getByName("127.0.0.1"), 2);
        InetSocketAddress otherAddress2 = new InetSocketAddress(InetAddress.getByName("127.0.0.2"), 1);

        Preference preference = new SocketAddressPreference(preferredAddress);

        Node preferredNode = mock(Node.class);
        Node otherNode1 = mock(Node.class);
        Node otherNode2 = mock(Node.class);

        when(preferredNode.getSocketAddress()).thenReturn(preferredAddress);
        when(otherNode1.getSocketAddress()).thenReturn(otherAddress1);
        when(otherNode2.getSocketAddress()).thenReturn(otherAddress2);

        assertTrue(preference.preferred(preferredNode));
        assertFalse(preference.preferred(otherNode1));
        assertFalse(preference.preferred(otherNode2));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.