OracleJavaScript API Reference for Oracle ADF Faces

 

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

oracle.adfinternal.view.js.data.inputSearch
Class AdfPreferredSuggestionsManager

Warning:

org.ecmascript.object.Object
   |
   +--oracle.adf.view.js.base.AdfObject
         |
         +--oracle.adfinternal.view.js.data.inputSearch.AdfPreferredSuggestionsManager

public class AdfPreferredSuggestionsManager
extends AdfObject
Provides functions to manage the data using properties from af:suggestionsSection The data is stored in browser's localStorage. The data is organised using a frecency algorithm (AdfInputSearchScoreUtils)


Field Summary

private static Object
_DONT_CACHE_REPLACEMENT_STR
private static Object
_SUGGESTIONS_TOO_LESS_COUNT

Fields inherited from oracle.adf.view.js.base.AdfObject

constructor, superclass

Fields inherited from org.ecmascript.object.Object

prototype

Constructor Summary

public
AdfPreferredSuggestionsManager()
Provides functions to manage the data using properties from af:suggestionsSection The data is stored in browser's localStorage.

Method Summary

public static Object
add(AdfUIComponent inputSearch, Array newValues, Object suggestionMap)
Invoked on selection of a new suggestion item.
private static Object
_capPreferredSuggestions(Object preferredSuggestionsList, Object displayCount)
Returns the first X suggestion items
private static Object
_findIndex(Object preferredSuggestionsList, Object value)
Returns the index of the suggestion item whose 'key' property matches the 'value' passed
public static Object
get(Object inputSearch)
Reads the suggestions from localStorage and returns the suggestions list
private static Object
_getCacheableSuggestionData(Object suggestionsSection, Object suggestionItem)
private static Object
_getCacheKey(Object inputSearch, Object suggestionsSection)
Returns the REST URL post normalization and as modified by cacheKeyGenerator attribute
protected static Object
InitClass()
public static Object
isDisplayAttributesCacheable(Object inputSearch)
Returns true if the displayAttributes isn't part of dontCache
private static Object
_isSuggestionsTooLess(Object inputSearch, Object totalSuggestionsCount, Object preferredSuggestionsLength)
Determines if the master list length is too small to display the preferred suggestions
private static Object
_read(String storageKey, Number limit, AdfSuggestionMap suggestions)
Looksup the localStorage against the storageKey passed and returns the stored suggestion object.
private static Object
_substituteDontCacheAttributes(AdfRichSuggestionsSection suggestionsSection, Array preferredSuggestionsList)
The dontCache attributes, when needs to be displayed in the UI, should be shown as marker text represented by AdfPreferredSuggestionsManager._DONT_CACHE_REPLACEMENT_STR.
public static Object
update(AdfUIComponent inputSearch, Boolean isMasterList, AdfSuggestionMap suggestions)
Update the suggestions stored in localStorage on REST call completion

Methods inherited from oracle.adf.view.js.base.AdfObject

adopt, clone, createCallback, createInitializedObject, createSubclass, ensureClassInitialization, equals, exportPrototypeSymbol, getClass, GetLazyArrayProperty, GetLazyMapProperty, getTypeName, Init, toDebugString, toString

Field Detail


_DONT_CACHE_REPLACEMENT_STR

private static Object _DONT_CACHE_REPLACEMENT_STR

_SUGGESTIONS_TOO_LESS_COUNT

private static Object _SUGGESTIONS_TOO_LESS_COUNT

Constructor Detail


AdfPreferredSuggestionsManager

public AdfPreferredSuggestionsManager()

Provides functions to manage the data using properties from af:suggestionsSection The data is stored in browser's localStorage. The data is organised using a frecency algorithm (AdfInputSearchScoreUtils)

Method Detail


add

public static Object add(AdfUIComponent inputSearch,
                         Array newValues,
                         Object suggestionMap)

Invoked on selection of a new suggestion item. Adds newly selected items to the localStorage

Parameters:
inputSearch  
newValues - The newly selected values
suggestionMap  
Return:
Object

_capPreferredSuggestions

private static Object _capPreferredSuggestions(Object preferredSuggestionsList,
                                               Object displayCount)

Returns the first X suggestion items

Parameters:
preferredSuggestionsList  
displayCount  
Return:
Object

_findIndex

private static Object _findIndex(Object preferredSuggestionsList,
                                 Object value)

Returns the index of the suggestion item whose 'key' property matches the 'value' passed

Parameters:
preferredSuggestionsList  
value  
Return:
Object

get

public static Object get(Object inputSearch)

Reads the suggestions from localStorage and returns the suggestions list

Parameters:
inputSearch  
Return:
Object

_getCacheableSuggestionData

private static Object _getCacheableSuggestionData(Object suggestionsSection,
                                                  Object suggestionItem)

Parameters:
suggestionsSection  
suggestionItem  
Return:
Object

_getCacheKey

private static Object _getCacheKey(Object inputSearch,
                                   Object suggestionsSection)

Returns the REST URL post normalization and as modified by cacheKeyGenerator attribute

Parameters:
inputSearch  
suggestionsSection  
Return:
Object

InitClass

protected static Object InitClass()

Return:
Object

isDisplayAttributesCacheable

public static Object isDisplayAttributesCacheable(Object inputSearch)

Returns true if the displayAttributes isn't part of dontCache

Parameters:
inputSearch  
Return:
Object

_isSuggestionsTooLess

private static Object _isSuggestionsTooLess(Object inputSearch,
                                            Object totalSuggestionsCount,
                                            Object preferredSuggestionsLength)

Determines if the master list length is too small to display the preferred suggestions

Parameters:
inputSearch  
totalSuggestionsCount  
preferredSuggestionsLength  
Return:
Object

_read

private static Object _read(String storageKey,
                            Number limit,
                            AdfSuggestionMap suggestions)

Looksup the localStorage against the storageKey passed and returns the stored suggestion object. The method also creates the suggestion object if it doesn't already exist

Parameters:
storageKey - The key of the item to lookup for in localStorage
limit - The max number of suggestion items to be stored in localStorage per key
suggestions - The master list
Return:
Object

_substituteDontCacheAttributes

private static Object _substituteDontCacheAttributes(AdfRichSuggestionsSection suggestionsSection,
                                                     Array preferredSuggestionsList)

The dontCache attributes, when needs to be displayed in the UI, should be shown as marker text represented by AdfPreferredSuggestionsManager._DONT_CACHE_REPLACEMENT_STR. Fill up the suggestion objects with this marker text in this method. On fetch complete, if the data is available, the marker text will be substituted with real data.

Parameters:
suggestionsSection  
preferredSuggestionsList  
Return:
Object

update

public static Object update(AdfUIComponent inputSearch,
                            Boolean isMasterList,
                            AdfSuggestionMap suggestions)

Update the suggestions stored in localStorage on REST call completion

Parameters:
inputSearch  
isMasterList  
suggestions  
Return:
Object

SUMMARY: FIELD | CONSTR | METHOD    DETAIL: FIELD | CONSTR | METHOD

 

Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.