com.indexdata.masterkey.pazpar2.client
Class Pazpar2Settings

java.lang.Object
  extended by com.indexdata.masterkey.pazpar2.client.Pazpar2Settings

public class Pazpar2Settings
extends Object

Manages Pazpar2Settings

TODO: THIS CLASS IS CONFUSED ABOUT IT'S ROLE (CONTROLER OR CONTROLEE?) AND DEPENDENCY TO PAZPAR2 CLIENT OBJECT. THE LOGIC FOR FETCHING TARGETS IS SCATTERED IN TWO PLACES (FROM SEARCHABLES AND IN THE TARGET FILTER APPLY METHOD)


Constructor Summary
protected Pazpar2Settings(Pazpar2ClientConfiguration cfg)
           
 
Method Summary
 String encode()
           
static Pazpar2Settings fromSearchables(Records records, Pazpar2ClientConfiguration cfg)
           
 String getSetting(String targetId, String key)
           
 void loadSearchable(Record record)
          Loads torus target setting record (enveloped, first layer).
 void loadSearchable(SearchableTypeLayer l)
          Loads torus target setting record (layer).
 void loadSearchables(Records records)
          Loads torus target setting records.
protected  void setPrefixedSetttings(String targetId, String mapPrefix, List<Object> elements)
          setPrefixedSetttings: set a value of maps based on prefix
 void setRecordFilter(String recordFilter, String recordFilterCriteria)
           
 boolean setSetting(String targetId, String key, String value)
           
 boolean setSetting(String targetId, String key, String value, String defaultValue)
          Sets the property 'key' of the given 'targetId' to 'value'.
 Document toXml(Element parent)
          Encode settings to an XML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pazpar2Settings

protected Pazpar2Settings(Pazpar2ClientConfiguration cfg)
Method Detail

fromSearchables

public static Pazpar2Settings fromSearchables(Records records,
                                              Pazpar2ClientConfiguration cfg)

loadSearchables

public void loadSearchables(Records records)
Loads torus target setting records.

Parameters:
record - target setting record

loadSearchable

public void loadSearchable(Record record)
Loads torus target setting record (enveloped, first layer).

Parameters:
record - target setting record

loadSearchable

public void loadSearchable(SearchableTypeLayer l)
Loads torus target setting record (layer).

Parameters:
record - target setting record

setSetting

public boolean setSetting(String targetId,
                          String key,
                          String value)

setSetting

public boolean setSetting(String targetId,
                          String key,
                          String value,
                          String defaultValue)
Sets the property 'key' of the given 'targetId' to 'value'. Falls back to 'defaultValue' if 'value' is null and no setting already exists. Will skip the setting altogether if value and 'defaultValue' are both null.

Parameters:
targetId - The target to define a setting for
key - The name of the setting
value - The value of the setting
defaultValue - Fall-back value if 'value' is null

getSetting

public String getSetting(String targetId,
                         String key)

setPrefixedSetttings

protected void setPrefixedSetttings(String targetId,
                                    String mapPrefix,
                                    List<Object> elements)
setPrefixedSetttings: set a value of maps based on prefix


encode

public String encode()
              throws UnsupportedEncodingException
Throws:
UnsupportedEncodingException

toXml

public Document toXml(Element parent)
               throws Error
Encode settings to an XML

Returns:
XML Document with all target settings
Throws:
Error

setRecordFilter

public void setRecordFilter(String recordFilter,
                            String recordFilterCriteria)


Copyright © 2012. All Rights Reserved.