This chapter discusses the set of standard, out-of-the-box function providers and their associated methods.
Function provider methods can be invoked from a Scenario to manipulate data returned by a data provider. The set of standard function providers described in this chapter are provided with WebCenter Portal out-of-the-box and perform commonly required operations upon results returned from data providers.
For information on implementing a custom function provider, see Chapter 68, "Implementing Custom Function Providers: Introduction."
Table 69-1 lists the different categories of standard function provider methods.
Table 69-1 Standard Function Provider Categories
Function Provider Category | Description |
---|---|
Perform operations on a named cache. |
|
Create and update a Map object. |
|
Create and update a List object. |
|
Perform common String manipulations. |
|
Create and operate upon Date objects. |
|
Perform print operations. |
|
Create, update, and transform Collections objects. |
|
Determines if a user is in a specified role. |
|
Supports the CMIS provider. |
|
Supports the Activity Graph provider. |
|
Lets you get information about users and roles. |
Perform operations on a named Oracle Coherence cache object.
Use this method... | To... |
---|---|
Return a named cache using the entry in the specified cache configuration file. |
|
Return the value for the address key in a named cache. |
|
Clear a named cache. |
|
Gets the custom cache configured in wcps-dataprovider-cache-config.xml. |
|
Gets a large cache configured in |
|
Gets a medium cache configured in |
|
Gets a medium cache configured in |
|
Puts an value into a named cache. |
Returns a named cache using the entry in the specified cache configuration file.
(String) The name of a cache configuration XML file. For custom function providers, this configuration file must be in the application classpath. Otherwise, it can be anywhere in the classpath of the caller.
(String) The name of the cache returned by this method.
${cache:getCache(configFile,cacheName)}
com.tangosol.net.NamedCache
${cache:getCache('my-config.xml','mycache')}
None.
Returns the value to which the cache maps the specified key.
(com.tangosol.net.NamedCache) A cache object.
(Object) The key to the address value in the named cache.
${cache:getCache(cache, key)}
(Object) The value to which the cache maps the specified key.
${cache:get(mycache, aKey)}
None.
Clears the named cache.
(com.tangosol.net.NamedCache) A cache object.
${cache:getCache(cacheName)}
${cache:clear(aCache)}
None.
Gets the custom cache configured in wcps-dataprovider-cache-config.xml.
(String) The name of a cache configured in wcps-dataprovider-cache-config.xml.
${cache:getCache("cacheName")}
(Object) The value to which the cache maps the specified key.
(com.tangosol.net.NamedCache) A cache object.
${cache:clear("aCache")}
None.
Gets a large cache configured in wcps-dataprovider-cache-config.xml
. The default cache parameters are:
10000 entries
1 hour TTL
(String) The name of a large cache configured in wcps-dataprovider-cache-config.xml
.
${cache:getLargeCache("cacheName")}
(com.tangosol.net.NamedCache) A cache object named wcps-dp-large-<cacheName>
.
${cache:getLargeCache("aLargeCache")}
None.
Gets a medium cache configured in wcps-dataprovider-cache-config.xml
. The default cache parameters are:
1000 entries
1 hour TTL
(String) The name of a medium cache configured in wcps-dataprovider-cache-config.xml
.
${cache:getMediumCache("cacheName")}
(com.tangosol.net.NamedCache) A cache object named wcps-dp-medium-<cacheName>
.
${cache:getMediumCache("aMediumCache")}
None.
Gets a small cache configured in wcps-dataprovider-cache-config.xml
. The default cache parameters are:
100 entries
1 hour TTL
(String) The name of a small cache configured in wcps-dataprovider-cache-config.xml
.
${cache:getSmallCache("cacheName")}
(com.tangosol.net.NamedCache) A cache object named wcps-dp-small-<cacheName>
.
${cache:getSmallCache("aSmallCache")}
None.
Utility methods that operate on Map objects.
Use this method... | To... |
---|---|
Create and return a new HashMap object. |
|
Puts an entry in an existing map of key/value pairs. |
|
Returns the number of entries in a Map. |
|
Returns a collection of the keys in the Map. |
|
Returns a collection of the values in a Map object. |
|
Return a value from a Map object that is associated with a key. |
Create and return a new HashMap object.
None.
${maps:new()}
java.util.HashMap
${maps:new()}
None.
Puts an entry in an existing map of key/value pairs.
The name of the HashMap.
A key object.
A value mapped to the key.
${maps:put(map,key,value)}
Returns the new Map object (java.util.Map).
${maps:put(existingMap, keyObj, aValue)}
None.
Returns the number of entries in a Map.
(java.util.Map) A map object.
${maps:size(aMap)}
int
${maps:size(aMap)}
None.
Returns a collection of the keys in the Map.
(java.util.Map) A Map object.
${maps:put(map)}
java.util.Set
${maps:keyset(aMap)}
None.
Returns a collection of the values in a Map object.
(java.util.Map) A Map object.
(java.lang.Object) A key object.
(<V>) A value mapped to the key.
${maps:values(map)}
java.util.Collection
${maps:values(aMap)}
None.
Constructs and adds to a List of objects.
Use this method... | To... |
---|---|
Create and return a new ArrayList object. |
|
Adds an object to a List. |
|
Returns the number of elements in a List object. |
Create and return a new ArrayList object.
None.
${list:new()}
java.util.ArrayList
${list:new()}
None.
Performs basic utility functions on strings.
Use this method... | To... |
---|---|
Concatenates two strings and returns a new String object. |
|
Returns true if this string contains the specified string. |
|
Returns the index within this string of the first occurrence of the specified substring. |
|
Join together String objects in a given Collection, separating them by a specified delimiter, and returning a new String. |
|
Replaces each substring of this string that matches the given regular expression with the given replacement string. |
|
Splits this string around matches of the given regular expression. |
|
Tests if this string starts with the specified prefix. |
|
Tests if this string ends with the specified prefix. |
|
Returns a new string that is a substring of this string. |
Concatenates two strings and returns a new String object.
(java.lang.String) The String to concatenate to.
(java.lang.String) The String to concatenate onto the end of stringA.
${string:concat(stringA,stringB)}
java.lang.String
${cache:getCache("Hello, ","world!")}
None.
Returns true if this string contains the specified string.
(java.lang.String) The String to search.
(java.lang.String) A string to search for.
${string:contains(string,containsString)}
java.lang.Boolean
${cache:getCache("the quick brown fox","fox")}
None.
Returns the index within this string of the first occurrence of the specified substring.
(java.lang.String) A string to search for a substring.
(java.lang.String) The substring to search for.
${string:indexOf(string,substring)}
int
${cache:getCache("the quick brown fox", "quick")}
None.
Join together String objects in a given Collection, separating them by a specified delimiter, and returning a new String.
A Collection object containing strings.
A string token used to split the input string values.
${string:join(collection,delimiter)}
java.lang.String
${cache:getCache(aCollection,', ')}
None.
Replaces each substring of this string that matches the given regular expression with the given replacement string.
The original String object.
A regular expression used to identify sub-strings.
A String to replace the original String input variable.
${string:replaceAll(string,regex,replacementString)}
java.lang.String
${cache:getCache("SomeSimpleString, "Simple", "Complex")}
None.
Splits this string around matches of the given regular expression.
A String object to split.
A token String used to split the input String parameter.
${string:split(string,splitToken)}
java.lang.String
${cache:getCache("one, two, three"), ",")}
None.
Tests if this string starts with the specified prefix.
The String to test.
The test string.
${string:startsWith(string,start)}
(java.lang.Boolean) Returns true if the input string starts with the test string.
${cache:getCache("BeginString", "Begin")}
None.
Tests if this string ends with the specified prefix.
The String to test.
The test string.
${string:startsWith(string,end)}
(java.lang.Boolean) Returns true if the input string starts with the test string.
${cache:getCache("StringEnd", "End")}
None.
Returns a new string that is a substring of this string.
The String subset.
The beginning index, inclusive.
The ending index, inclusive.
${string:startsWith(string,end)}
(java.lang.Boolean) Returns true if the input string starts with the test string.
${cache:getCache("The quick brown fox", 1, 10)}
None.
Utility methods for handling Date objects.
Use this method... | To... |
---|---|
Tests if this date is after the specified date. |
|
Tests if this date is after the specified date. |
|
Returns the difference between two dates (date1 – date2) by the specified unit of measure. |
|
Returns the difference between today's date and the specified date, by the specified unit of measure. |
|
Formats the provided date with the specified format string. |
|
Returns a new date with the current date/time. |
Tests if this date is after the specified date.
(java.util.Date) The first date to test.
(java.util.Date) The second date to test.
${date:after(date1,date2)}
(java.lang.Boolean) Returns true if the second date is after the first date.
${date:after(aDate, bDate)}
None.
Tests if this date is before the specified date.
(java.util.Date) The first date to test.
(java.util.Date) The second date to test.
${date:after(date1,date2)}
(java.lang.Boolean) Returns true if the second date is before the first date.
${date:before(aDate, bDate)}
None.
Returns the difference between two dates (date1 – date2) by the specified unit of measure.
The first Date to test.
The second Date to test.
(String) Valid units are:
${date:diffDates(date1,date2,units)}
(int) The calculated difference between the two dates, as specified by the input units. For example, if the input units is "y", the result will be the number of years separating the two dates.
${date:diffDates(aDate, bDate, "M")}
None.
Returns the difference between today's date and the specified date, by the specified unit of measure.
(java.util.Date) The Date to test.
(String) Valid units are:
${date:diffFromNow(date1,date2,units)}
(int) The calculated difference between the two dates, as specified by the input units. For example, if the input units is "y", the result will be the number of years separating the two dates.
${date:diffFromNow(aDate, bDate, "M")}
None.
Provides standard print methods.
Use this method... | To... |
---|---|
Print an object to either standard error output or the standard console. |
|
Print an object to either standard error output or the standard console with a newline. |
Prints an object.
(String) Specify err
to print to the standard error output stream or out
to print to the standard console.
(java.lang.Object) The Object to print.
${system:print(stream,object)}
void
${cache:getCache("err", "Hello, world!")}
Output goes to the WC_Utilities.out file for the "out" option and WC_Utilities.err file for the "err" option. These files are located in the server domain directory.
Prints an object with a newline.
(String) Specify err
to print to the standard error output stream or out
to print to the standard console.
(java.lang.Object) The Object to print.
${system:println(stream,object)}
void
${cache:println("out", "Hello, world!")}
Output goes to the WC_Utilities.out file for the "out" option and WC_Utilities.err file for the "err" option. These files are located in the server domain directory.
Let's you discover information about users and roles.
Use this method... | To... |
---|---|
getUserRoles |
Returns an array of roles/groups that is part of the current subject. |
isUserInRole |
Determines if the current user is a member of the specified role or group name. |
Perform operations on Collections objects.
Table 69-11 Collections Methods
Use this method... | To... |
---|---|
Appends an object to a collection of objects. |
|
Returns an array of Objects from a collection. |
|
Returns a List object populated with objects from an array of Objects. |
|
Determines the size of a collection. If the collection is null, zero is returned. |
|
Sorts the specified list into ascending order, according to the natural ordering of its elements. |
|
Returns a new Collection object. |
Appends an object to a collection of objects.
(java.util.Collection) A Collection Object.
(java.lang.Object) An Object to append to the Collection.
${collections:append(collection,item)}
java.util.Collection
${collections:append(aCollection, anObject)}
None.
Returns an array of Objects from a collection.
(java.util.Collection) A Collection object to turn into an array of Objects.
${collections:toArray(collection)}
java.lang.Object
${cache:getCache(aCollection)}
None.
Returns a List object populated with objects from an array of Objects.
(java.lang.Object[]) An array of Objects.
${collections:fromArray(array)}
java.util.Collection
${collections:fromArray(anArray)}
None.
Determines the size of a collection. If the collection is null, zero is returned.
(java.util.Collection) A Collection object.
${collections:size(collection)}
long
${collections:size(aCollection)}
None.
Perform operations on Activity Graphs.
Table 69-12 Activity Graph Methods
Use this method... | To... |
---|---|
Filter out Recommendations whose score is >= the input score. |
|
Return a List of URLs representing the common items as CMIS objects. |
|
Return a List of URLs representing the CMIS objects. |
|
Extract content IDs from input objects. Includes content of all types (WC.document, WC.wiki). |
|
Extract content IDs from input objects. |
|
Extract content IDs from input objects. |
Filter out Recommendations whose score is >= the input score.
Return only those Recommendations that are equal to or above the cutoffScore.
(java.util.Collection) A Collection Object.
(float) The cutoff score.
${agfunction:filterRecsByScore(recommendations,cutoffScore)}
oracle.wcps.activity.agrest.spy.jaxb.Recommendations
None.
Return a List of clickable URLs representing the actual content item in common items as CMIS objects.
(oracle.wcps.activity.agrest.spy.jaxb.Results)
${agfunction:getCMISLinksFromCommonItems(results)}
java.util.List
None.
Return a List of clickable URLs representing actual content item in the recommendations.
(oracle.wcps.activity.agrest.spy.jaxb.Recommendations)
${agfunction:getCMISLinksFromRecommendations(recommendations)}
java.util.List
None.
Extract content IDs from input objects. Includes content of all types (WC.document, WC.wiki).
Returns the short-version content identifier from the Recommendations results. The parameter 'agResults' can be one of:
Recommendations
RecommendedItems
List<Recommendation>
(java.lang.Object)
${agfunction:getContentIDs(agResults)}
java.util.List
None.
Returns the short-version content identifier from the Recommendations results. excludes the 'excludeClassURN' from the results The parameter 'agResults' can be one of:
Recommendations
RecommendedItems
List<Recommendations>
(java.lang.Object)
${agfunction:getContentIDsExclude(agResults,excludeClassURN)}
java.util.List
None.
Returns the short-version content identifier from the Recommendations results. returns only those IDs corresponding to the classURN. See the nomenclature section in this blog for more details on ClassURN. The parameter 'agResults' can be one of:
Recommendations
RecommendedItems
List<Recommendations>
(java.lang.Object)
(java.lang.String)
${agfunction:getContentIDsFiltered(agResults,filterClassURN)}
java.util.List
None.
Perform operations on CMIS.
Use this method... | To... |
---|---|
Return a List of URLs representing the common items as CMIS objects. |
|
Return a List of URLs representing the CMIS objects. |
|
Extract content IDs from input objects. Includes content of all types (WC.document, WC.wiki). |
|
Extract content IDs from input objects. |
|
Extract content IDs from input objects. |
|
ATOM feed as a List<CMISObject>. |
|
ATOM feed as List<org.apache.abdera.model.Entry> |
|
ATOM feed as org.apache.abdera.model.Feed |
|
ATOM feed as List<String> of URLs |
|
Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs. |
|
Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs. |
Because CMISObject is not marshalable, use this method in your Java client code to convert the ATOM query response to List<CMISObject>.
(java.lang.String) A Collection Object.
(float) The cutoff score.
${cmisfunction:atomAsCMISObjects(atomFeed)}
java.util.List
None.
Because org.apache.abdera.model.Entry (an attribute on an Abdera feed) is not marshalable, use this method in your Java client code to convert the ATOM query response to List<org.apache.abdera.model.Entry>.
(String)
${cmisfunction:atomAsEntries(atomFeed)}
java.util.List
None.
Because org.apache.abdera.model.Feed is not marshalable, use this method in your Java client code to convert the ATOM query response to List<org.apache.abdera.model.Feed>.
(String)
${cmisfunction:atomAsFeed(atomFeed)}
java.util.List
None.
Returns an ATOM feed as List<String> of URLs.
(String)
${agfunction:getContentIDs(agResults)}
java.util.List
None.
Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs.
(String)
(java.util.List)
${agfunction:getContentIDsExclude(agResults,excludeClassURN)}
String
None.
Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs.
This method converts a list of IDs (perhaps coming from the Activity Graph Provider) to a CMIS query string to retrieve multiple content items. The ID is in the form of a WebCenter ID, such as 'my-ucm11g#dDocName:MOUNTAINS'.
(java.util.List)
${cmisfunction:getCMISQueryForDocIDsFromFullID(ids)}
String
None.