public class

VarsUserPreferences

extends AbstractPreferences
java.lang.Object
   ↳ java.util.prefs.Preferences
     ↳ java.util.prefs.AbstractPreferences
       ↳ vars.jpa.VarsUserPreferences

Class Overview

Created by IntelliJ IDEA. User: brian Date: Aug 25, 2009 Time: 9:49:54 AM To change this template use File | Settings | File Templates.

Summary

[Expand]
Inherited Constants
From class java.util.prefs.Preferences
[Expand]
Inherited Fields
From class java.util.prefs.AbstractPreferences
Public Constructors
VarsUserPreferences(String persistenceUnit)
This is a default constructor that simply calls another constructor.
VarsUserPreferences(EntityManagerFactory entityManagerFactory, VarsUserPreferences parent, String name)
This is the main constructor that takes in a VARSPreferences object that will serve as the parent preference to the new VARSPreference that will be created with the name that is passed in
Public Methods
static void copyPrefs(Preferences source, Preferences destination)
This method is used to copy one preference 'tree' to another.
List findByNamedQuery(String name, Map<String, Object> namedParameters)
Executes a named query using a map of named parameters
Protected Methods
AbstractPreferences childSpi(String name)
This method is used to get a child node with a specific name from the current node
String[] childrenNamesSpi()
This method returns an array of strings that represent the names of the children that are directly below this node.
void flushSpi()
String getSpi(String key)
This method returns the value associated with the specified key at the preference node, or null if there is no association for this key, or the association cannot be determined at this time.
String[] keysSpi()
Returns all of the keys that have an associated value in this preference node.
void putSpi(String key, String value)
` This method puts the give key/value association into this preference node (and persists it to the database)
void removeNodeSpi()
This method rmoves this prefernce node, invalidating it and any prefernces that it contains.
void removeSpi(String key)
Remove the association (if any) for the specified key at this preference node.
void syncSpi()
[Expand]
Inherited Methods
From class java.util.prefs.AbstractPreferences
From class java.util.prefs.Preferences
From class java.lang.Object

Public Constructors

public VarsUserPreferences (String persistenceUnit)

This is a default constructor that simply calls another constructor. This is designed to construct a preferences object that has the whole preferences tree (at the root with all users)

public VarsUserPreferences (EntityManagerFactory entityManagerFactory, VarsUserPreferences parent, String name)

This is the main constructor that takes in a VARSPreferences object that will serve as the parent preference to the new VARSPreference that will be created with the name that is passed in

Parameters
parent This is the VARSPreferences object that will be the parent of the new VARSPreferences object created with this constructor
name This is the name that will be used for the new VARSPreferences node

Public Methods

public static void copyPrefs (Preferences source, Preferences destination)

This method is used to copy one preference 'tree' to another. It provides a 'deep' copy.

Parameters
source This is the Preferences object that contains the preferences object you want to copy
destination This is the Preferences object that contains the preferences object you want to copy to

public List findByNamedQuery (String name, Map<String, Object> namedParameters)

Executes a named query using a map of named parameters

Parameters
name The name of the query to execute
namedParameters A Map of the 'named' parameters to assign in the query
Returns
  • A list of objects returned by the query.

Protected Methods

protected AbstractPreferences childSpi (String name)

This method is used to get a child node with a specific name from the current node

Parameters
name The name of the child node to return from the current node
Returns
  • AbstractPreferences This is the new VARSPreferences that has the name supplied in the parameter. If no node exists, one will be created.

protected String[] childrenNamesSpi ()

This method returns an array of strings that represent the names of the children that are directly below this node.

Returns
  • Description of the Return Value
Throws
BackingStoreException - if anything goes wrong and the operation cannot complete

protected void flushSpi ()

Throws
BackingStoreException

protected String getSpi (String key)

This method returns the value associated with the specified key at the preference node, or null if there is no association for this key, or the association cannot be determined at this time. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed.

Parameters
key The key to be searched for
Returns
  • A String that is the value associated with the given key

protected String[] keysSpi ()

Returns all of the keys that have an associated value in this preference node. The returned array will have size of zero if this node has no preferences.

Returns
  • String[] that contains the keys of the preferences that have associated values at this node
Throws
BackingStoreException - if something goes wrong and the operation cannot be completed successfully

protected void putSpi (String key, String value)

` This method puts the give key/value association into this preference node (and persists it to the database)

Parameters
key This is the key that will be used to insert and extract the associated value from the database
value This is the value that is associated with the give key and will be stored in the database

protected void removeNodeSpi ()

This method rmoves this prefernce node, invalidating it and any prefernces that it contains. The named child will have no descendants at the time this invocation is made (the removeNode() will be called recursively from the bottom up.

Throws
BackingStoreException - if something goes wrong with the removal from the back end storage and this operation cannot be peformed successfully

protected void removeSpi (String key)

Remove the association (if any) for the specified key at this preference node. It is guaranteed that key is non-null. Also, it is guaranteed that this node has not been removed.

Parameters
key This is the key (name) of the preference to be removed

protected void syncSpi ()

Throws
BackingStoreException