Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IPreference


  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getLongs(java.lang.String)
   */
  public long[] getLongs(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getLongs() != null)
      return cachedPref.getLongs();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getLongs() != null) {
      fCache.put(key, pref);
      return pref.getLongs();
    }

    /* Ask Parent */
    long[] parentValue = fParent.getLongs(key);
   
    /* Cache value from parent */
    if (parentValue != null) {
      pref = Owl.getModelFactory().createPreference(key);
      pref.putLongs(parentValue);
      fCache.put(key, pref);
    }

    return parentValue;
  }
View Full Code Here


  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getString(java.lang.String)
   */
  public String getString(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getString() != null)
      return cachedPref.getString();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getString() != null) {
      fCache.put(key, pref);
      return pref.getString();
    }

    /* Ask Parent */
    String parentValue = fParent.getString(key);
   
    /* Cache value from parent */
    if (parentValue != null) {
      pref = Owl.getModelFactory().createPreference(key);
      pref.putStrings(parentValue);
      fCache.put(key, pref);
    }

    return parentValue;
  }
View Full Code Here

  /*
   * @see org.rssowl.core.model.preferences.IPreferencesNode#getStrings(java.lang.String)
   */
  public String[] getStrings(String key) {
    /* Consult Cache */
    IPreference cachedPref = fCache.get(key);
    if (cachedPref != null && cachedPref.getStrings() != null)
      return cachedPref.getStrings();

    /* Consult the Persistence Layer */
    IPreference pref = load(key);
   
    if (pref != null && pref.getStrings() != null) {
      fCache.put(key, pref);
      return pref.getStrings();
    }

    /* Ask Parent */
    String[] parentValue = fParent.getStrings(key);
   
    /* Cache value from parent */
    if (parentValue != null) {
      pref = Owl.getModelFactory().createPreference(key);
      pref.putStrings(parentValue);
      fCache.put(key, pref);
    }

    return parentValue;
  }
View Full Code Here

      delete(key);
      return;
    }

    /* Save to DB */
    IPreference pref = fPreferenceDAO.loadOrCreate(key);
    pref.putBooleans(value);
    fPreferenceDAO.save(pref);
  }
View Full Code Here

      delete(key);
      return;
    }

    /* Save to DB */
    IPreference pref = fPreferenceDAO.loadOrCreate(key);
    pref.putIntegers(value);
    fPreferenceDAO.save(pref);
  }
View Full Code Here

      delete(key);
      return;
    }

    /* Save to DB */
    IPreference pref = fPreferenceDAO.loadOrCreate(key);
    pref.putIntegers(values);
    fPreferenceDAO.save(pref);
  }
View Full Code Here

      delete(key);
      return;
    }

    /* Save to DB */
    IPreference pref = fPreferenceDAO.loadOrCreate(key);
    pref.putLongs(value);
    fPreferenceDAO.save(pref);
  }
View Full Code Here

      delete(key);
      return;
    }

    /* Save to DB */
    IPreference pref = fPreferenceDAO.loadOrCreate(key);
    pref.putLongs(values);
    fPreferenceDAO.save(pref);
  }
View Full Code Here

    if (!InternalOwl.TESTING) {
      SafeRunner.run(new LoggingSafeRunnable() {
        public void run() throws Exception {

          /* First check wether this action is required */
          IPreference firstStartToken = fPrefsDAO.load(FIRST_START_TOKEN);
          if (firstStartToken != null)
            return;

          onFirstStartup();

View Full Code Here

    String kindVal = element.getAttributeValue(Attributes.KIND.get());

    if (StringUtils.isSet(key) && value != null && typeVal != null && kindVal != null) {
      IPreferenceScope.Kind kind = IPreferenceScope.Kind.values()[Integer.parseInt(kindVal)];
      IPreferenceType type = IPreferenceType.values()[Integer.parseInt(typeVal)];
      IPreference preference = Owl.getModelFactory().createPreference(key);
      preference.setProperty(ITypeImporter.DATA_KEY, new Object[] { kind, type });

      switch (type) {
        case BOOLEAN:
          preference.putBooleans(Boolean.parseBoolean(value));
          break;
        case INTEGER:
          preference.putIntegers(Integer.parseInt(value));
          break;
        case INTEGERS:
          preference.putIntegers((int[]) getPropertyValue(value, type));
          break;
        case LONG:
          preference.putLongs(Long.parseLong(value));
          break;
        case LONGS:
          preference.putLongs((long[]) getPropertyValue(value, type));
          break;
        case STRING:
          preference.putStrings(value);
          break;
        case STRINGS:
          preference.putStrings((String[]) getPropertyValue(value, type));
          break;
      }

      importedEntities.add(preference);
    }
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.