../E63259-01.epub /> ../E63259-01.mobi />

69 Function Provider Reference

This chapter discusses the set of standard, "out-of-the-box" function provider 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

Cache Methods

Perform operations on a named cache.

Maps Methods

Create and update a Map object.

List Methods

Create and update a List object.

String Methods

Perform common String manipulations.

Date Methods

Create and operate upon Date objects.

System Methods

Perform print operations.

Collections Methods

Create, update, and transform Collections objects.

Security Methods

Determines if a user is in a specified role.

CMIS Methods

Supports the CMIS provider.

Activity Graph Methods

Supports the Activity Graph provider.

Security Methods

Lets you get information about users and roles.


Cache Methods

Perform operations on a named Oracle Coherence cache object.

Table 69-2 Cache Methods

Use this method... To...

getCache

Return a named cache using the entry in the specified cache configuration file.

get

Return the value for the address key in a named cache.

clear

Clear a named cache.

getCustomCache

Gets the custom cache configured in wcps-dataprovider-cache-config.xml.

getLargeCache

Gets a large cache configured in wcps-dataprovider-cache-config.xml.

getMediumCache

Gets a medium cache configured in wcps-dataprovider-cache-config.xml.

getSmallCache

Gets a medium cache configured in wcps-dataprovider-cache-config.xml.

put

Puts an value into a named cache.


getCache

Returns a named cache using the entry in the specified cache configuration file.

Arguments

cacheConfigFile

(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.

cacheName

(String) The name of the cache returned by this method.

Expression Language Format

${cache:getCache(configFile,cacheName)}

Returns

com.tangosol.net.NamedCache

Example

${cache:getCache('my-config.xml','mycache')} 

Usage Notes

None.

get

Returns the value to which the cache maps the specified key.

Arguments

cacheName

(com.tangosol.net.NamedCache) A cache object.

key

(Object) The key to the address value in the named cache.

Expression Language Format

${cache:getCache(cache, key)}

Returns

(Object) The value to which the cache maps the specified key.

Example

${cache:get(mycache, aKey)} 

Usage Notes

None.

clear

Clears the named cache.

Arguments

cacheName

(com.tangosol.net.NamedCache) A cache object.

Expression Language Format

${cache:getCache(cacheName)}

Example

${cache:clear(aCache)} 

Usage Notes

None.

getCustomCache

Gets the custom cache configured in wcps-dataprovider-cache-config.xml.

Arguments

cacheName

(String) The name of a cache configured in wcps-dataprovider-cache-config.xml.

Expression Language Format

${cache:getCache("cacheName")}

(Object) The value to which the cache maps the specified key.

Returns

(com.tangosol.net.NamedCache) A cache object.

Example

${cache:clear("aCache")} 

Usage Notes

None.

getLargeCache

Gets a large cache configured in wcps-dataprovider-cache-config.xml. The default cache parameters are:

  • 10000 entries

  • 1 hour TTL

Arguments

cacheName

(String) The name of a large cache configured in wcps-dataprovider-cache-config.xml.

Expression Language Format

${cache:getLargeCache("cacheName")}

Returns

(com.tangosol.net.NamedCache) A cache object named wcps-dp-large-<cacheName>.

Example

${cache:getLargeCache("aLargeCache")} 

Usage Notes

None.

getMediumCache

Gets a medium cache configured in wcps-dataprovider-cache-config.xml. The default cache parameters are:

  • 1000 entries

  • 1 hour TTL

Arguments

cacheName

(String) The name of a medium cache configured in wcps-dataprovider-cache-config.xml.

Expression Language Format

${cache:getMediumCache("cacheName")}

Returns

(com.tangosol.net.NamedCache) A cache object named wcps-dp-medium-<cacheName>.

Example

${cache:getMediumCache("aMediumCache")} 

Usage Notes

None.

getSmallCache

Gets a small cache configured in wcps-dataprovider-cache-config.xml. The default cache parameters are:

  • 100 entries

  • 1 hour TTL

Arguments

cacheName

(String) The name of a small cache configured in wcps-dataprovider-cache-config.xml.

Expression Language Format

${cache:getSmallCache("cacheName")}

Returns

(com.tangosol.net.NamedCache) A cache object named wcps-dp-small-<cacheName>.

Example

${cache:getSmallCache("aSmallCache")} 

Usage Notes

None.

put

Puts an value into a named cache.

Arguments

cache

(com.tangosol.net.NamedCache) A cache object.

key

(java.lang.Object) A key to identify the saved object.

value

(java.lang.Object) An object to cache.

Expression Language Format

${cache:put(aCache, aKey, aValue)}

Returns

void

Example

${cache:put(myCache, myKey, myValue)} 

Usage Notes

None.

Maps Methods

Utility methods that operate on Map objects.

Table 69-3 Maps Methods

Use this method... To...

new

Create and return a new HashMap object.

put

Puts an entry in an existing map of key/value pairs.

size

Returns the number of entries in a Map.

keyset

Returns a collection of the keys in the Map.

values

Returns a collection of the values in a Map object.

get

Return a value from a Map object that is associated with a key.


new

Create and return a new HashMap object.

Arguments

None.

Expression Language Format

${maps:new()}

Returns

java.util.HashMap

Example

${maps:new()} 

Usage Notes

None.

put

Puts an entry in an existing map of key/value pairs.

Arguments

map

The name of the HashMap.

key

A key object.

value

A value mapped to the key.

Expression Language Format

${maps:put(map,key,value)}

Returns

Returns the new Map object (java.util.Map).

Example

${maps:put(existingMap, keyObj, aValue)} 

Usage Notes

None.

size

Returns the number of entries in a Map.

Arguments

map

(java.util.Map) A map object.

Expression Language Format

${maps:size(aMap)}

Returns

int

Example

${maps:size(aMap)} 

Usage Notes

None.

keyset

Returns a collection of the keys in the Map.

Arguments

map

(java.util.Map) A Map object.

Expression Language Format

${maps:put(map)}

Returns

java.util.Set

Example

${maps:keyset(aMap)} 

Usage Notes

None.

values

Returns a collection of the values in a Map object.

Arguments

map

(java.util.Map) A Map object.

key

(java.lang.Object) A key object.

value

(<V>) A value mapped to the key.

Expression Language Format

${maps:values(map)}

Returns

java.util.Collection

Example

${maps:values(aMap)} 

Usage Notes

None.

get

Return a value from a Map object that is associated with a key.

Arguments

map

(java.util.Map) A Map object.

key

(java.lang.Object) A key object.

Expression Language Format

${maps:put(map,key)}

Returns

A value of type <V>.

Example

${maps:put(aMap, aKey)} 

Usage Notes

None.

withEntries

Creates a HashMap populated with the given key/value pairs.

Arguments

key – (String) A key.

value – (String) A value.

Expression Language Format

${maps:withEntries(keyvaluepairs)}

Returns

java.util.Map

Usage Notes

None.

List Methods

Constructs and adds to a List of objects.

Table 69-4 List Methods

Use this method... To...

new

Create and return a new ArrayList object.

add

Adds an object to a List.

size

Returns the number of elements in a List object.


new

Create and return a new ArrayList object.

Arguments

None.

Expression Language Format

${list:new()} 

Returns

java.util.ArrayList

Example

${list:new()} 

Usage Notes

None.

add

Adds an object to a List.

Arguments

list

(java.util.List) An object of type List.

value

(java.lang.Object) A value to add to the List.

Expression Language Format

${list:add(list,value)}

Returns

java.lang.Boolean

Example

${list.add(existingList, aValue)} 

Usage Notes

None.

size

Returns the number of elements in a List object.

Arguments

list

(java.util.List) A List object.

Expression Language Format

${list:size(list)}

Returns

int

Example

${list:size(mylist)}

Usage Notes

None.

String Methods

Performs basic utility functions on strings.

Table 69-5 String Methods

Use this method... To...

concat

Concatenates two strings and returns a new String object.

contains

Returns true if this string contains the specified string.

indexOf

Returns the index within this string of the first occurrence of the specified substring.

join

Join together String objects in a given Collection, separating them by a specified delimiter, and returning a new String.

replaceAll

Replaces each substring of this string that matches the given regular expression with the given replacement string.

split

Splits this string around matches of the given regular expression.

startsWith

Tests if this string starts with the specified prefix.

endsWith

Tests if this string ends with the specified prefix.

substring

Returns a new string that is a substring of this string.


concat

Concatenates two strings and returns a new String object.

Arguments

stringA

(java.lang.String) The String to concatenate to.

stringB

(java.lang.String) The String to concatenate onto the end of stringA.

Expression Language Format

${string:concat(stringA,stringB)}

Returns

java.lang.String

Example

${cache:getCache("Hello, ","world!")} 

Usage Notes

None.

contains

Returns true if this string contains the specified string.

Arguments

string

(java.lang.String) The String to search.

containsString

(java.lang.String) A string to search for.

Expression Language Format

${string:contains(string,containsString)}

Returns

java.lang.Boolean

Example

${cache:getCache("the quick brown fox","fox")} 

Usage Notes

None.

indexOf

Returns the index within this string of the first occurrence of the specified substring.

Arguments

string

(java.lang.String) A string to search for a substring.

substring

(java.lang.String) The substring to search for.

Expression Language Format

${string:indexOf(string,substring)}

Returns

int

Example

${cache:getCache("the quick brown fox", "quick")} 

Usage Notes

None.

join

Join together String objects in a given Collection, separating them by a specified delimiter, and returning a new String.

Arguments

collection

A Collection object containing strings.

delimiter

A string token used to split the input string values.

Expression Language Format

${string:join(collection,delimiter)}

Returns

java.lang.String

Example

${cache:getCache(aCollection,', ')} 

Usage Notes

None.

replaceAll

Replaces each substring of this string that matches the given regular expression with the given replacement string.

Arguments

string

The original String object.

regex

A regular expression used to identify sub-strings.

replacementString

A String to replace the original String input variable.

Expression Language Format

${string:replaceAll(string,regex,replacementString)}

Returns

java.lang.String

Example

${cache:getCache("SomeSimpleString, "Simple", "Complex")} 

Usage Notes

None.

split

Splits this string around matches of the given regular expression.

Arguments

string

A String object to split.

splitToken

A token String used to split the input String parameter.

Expression Language Format

${string:split(string,splitToken)}

Returns

java.lang.String

Example

${cache:getCache("one, two, three"), ",")} 

Usage Notes

None.

startsWith

Tests if this string starts with the specified prefix.

Arguments

string

The String to test.

start

The test string.

Expression Language Format

${string:startsWith(string,start)}

Returns

(java.lang.Boolean) Returns true if the input string starts with the test string.

Example

${cache:getCache("BeginString", "Begin")} 

Usage Notes

None.

endsWith

Tests if this string ends with the specified prefix.

Arguments

string

The String to test.

start

The test string.

Expression Language Format

${string:startsWith(string,end)}

Returns

(java.lang.Boolean) Returns true if the input string starts with the test string.

Example

${cache:getCache("StringEnd", "End")} 

Usage Notes

None.

substring

Returns a new string that is a substring of this string.

Arguments

inputString

The String subset.

startIndex

The beginning index, inclusive.

endIndex

The ending index, inclusive.

Expression Language Format

${string:startsWith(string,end)}

Returns

(java.lang.Boolean) Returns true if the input string starts with the test string.

Example

${cache:getCache("The quick brown fox", 1, 10)} 

Usage Notes

None.

Date Methods

Utility methods for handling Date objects.

Table 69-6 Date Methods

Use this method... To...

after

Tests if this date is after the specified date.

before

Tests if this date is after the specified date.

diffDates

Returns the difference between two dates (date1 – date2) by the specified unit of measure.

diffFromNow

Returns the difference between today's date and the specified date, by the specified unit of measure.

format

Formats the provided date with the specified format string.

new

Returns a new date with the current date/time.


after

Tests if this date is after the specified date.

Arguments

date1

(java.util.Date) The first date to test.

date2

(java.util.Date) The second date to test.

Expression Language Format

${date:after(date1,date2)}

Returns

(java.lang.Boolean) Returns true if the second date is after the first date.

Example

${date:after(aDate, bDate)} 

Usage Notes

None.

before

Tests if this date is before the specified date.

Arguments

date1

(java.util.Date) The first date to test.

date2

(java.util.Date) The second date to test.

Expression Language Format

${date:after(date1,date2)}

Returns

(java.lang.Boolean) Returns true if the second date is before the first date.

Example

${date:before(aDate, bDate)} 

Usage Notes

None.

diffDates

Returns the difference between two dates (date1 – date2) by the specified unit of measure.

Arguments

date1

The first Date to test.

date

The second Date to test.

units

(String) Valid units are:

Table 69-7 Valid Values for the units Parameter

Unit Description

y

Year

M

Month of Year

w

Week of Year

d

Day of Year

m

Minutes

s

Seconds

l

Milliseconds


Expression Language Format

${date:diffDates(date1,date2,units)}

Returns

(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.

Example

${date:diffDates(aDate, bDate, "M")} 

Usage Notes

None.

diffFromNow

Returns the difference between today's date and the specified date, by the specified unit of measure.

Arguments

date1

(java.util.Date) The Date to test.

units

(String) Valid units are:

Table 69-8 Valid Values for the units Parameter

Unit Description

y

Year

M

Month of Year

w

Week of Year

d

Day of Year

m

Minutes

s

Seconds

l

Milliseconds


Expression Language Format

${date:diffFromNow(date1,date2,units)}

Returns

(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.

Example

${date:diffFromNow(aDate, bDate, "M")} 

Usage Notes

None.

format

Formats the provided date with the specified format string.

Arguments

date

(java.util.Date) The Date object to format.

pattern

The Date pattern to format the date with.

Expression Language Format

${date:format(date,pattern)}

Returns

java.lang.String

Example

${date:format(aDate, "yyyy-MM-dd")} 

Usage Notes

None.

new

Returns a new date with the current date/time.

Arguments

None.

Expression Language Format

${date:new()}

Returns

java.lang.Date

Example

${date:new()} 

Usage Notes

None.

System Methods

Provides standard print methods.

Table 69-9 System Methods

Use this method... To...

print

Print an object to either standard error output or the standard console.

println

Print an object to either standard error output or the standard console with a newline.


print

Prints an object.

Arguments

stream

(String) Specify err to print to the standard error output stream or out to print to the standard console.

object

(java.lang.Object) The Object to print.

Expression Language Format

${system:print(stream,object)}

Returns

void

Example

${cache:getCache("err", "Hello, world!")} 

Usage Notes

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.

println

Prints an object with a newline.

Arguments

stream

(String) Specify err to print to the standard error output stream or out to print to the standard console.

object

(java.lang.Object) The Object to print.

Expression Language Format

${system:println(stream,object)}

Returns

void

Example

${cache:println("out", "Hello, world!")} 

Usage Notes

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.

Security Methods

Let's you discover information about users and roles.

Table 69-10 Security Methods

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.


getUserRoles

Returns an array of roles/groups that is part of the current subject.

Arguments

None.

Expression Language Format

${security:getUserRoles()}

Returns

java.util.List

Example

${security:getUserRoles()}

Usage Notes

None.

isUserInRole

Determines if the current user is a member in the specified role or group name.

Arguments

role

(String) The name of a role or group.

Expression Language Format

${security:isUserInRole(role)}

Returns

Boolean

Example

${security:isUserInRole("Moderator")}

Usage Notes

None.

Collections Methods

Perform operations on Collections objects.

Table 69-11 Collections Methods

Use this method... To...

append

 

fromArray

 

size

 

sort

Appends an object to a collection of objects.

toArray

Returns an array of Objects from a collection.

fromArray

Returns a List object populated with objects from an array of Objects.

size

Determines the size of a collection. If the collection is null, zero is returned.

sort

Sorts the specified list into ascending order, according to the natural ordering of its elements.

new

Returns a new Collection object.


append

Appends an object to a collection of objects.

Arguments

collection

(java.util.Collection) A Collection Object.

item

(java.lang.Object) An Object to append to the Collection.

Expression Language Format

${collections:append(collection,item)}

Returns

java.util.Collection

Example

${collections:append(aCollection, anObject)} 

Usage Notes

None.

toArray

Returns an array of Objects from a collection.

Arguments

collection

(java.util.Collection) A Collection object to turn into an array of Objects.

Expression Language Format

${collections:toArray(collection)}

Returns

java.lang.Object

Example

${cache:getCache(aCollection)} 

Usage Notes

None.

fromArray

Returns a List object populated with objects from an array of Objects.

Arguments

array

(java.lang.Object[]) An array of Objects.

Expression Language Format

${collections:fromArray(array)}

Returns

java.util.Collection

Example

${collections:fromArray(anArray)} 

Usage Notes

None.

size

Determines the size of a collection. If the collection is null, zero is returned.

Arguments

collection

(java.util.Collection) A Collection object.

Expression Language Format

${collections:size(collection)}

Returns

long

Example

${collections:size(aCollection)} 

Usage Notes

None.

sort

Sorts the specified list into ascending order, according to the natural ordering of its elements.

Arguments

list

(java.util.List) A List object to sort.

Expression Language Format

${collections:sort(list)}

Returns

void

Example

${collections:sort(myList)} 

Usage Notes

None.

new

Returns a new Collection object.

Arguments

None.

Expression Language Format

${collections:new()}

Returns

java.lang.Collection

Example

${collections:new()} 

Usage Notes

None.

Activity Graph Methods

Perform operations on Activity Graphs.

Table 69-12 Activity Graph Methods

Use this method... To...

filterRecsByScore

Filter out Recommendations whose score is >= the input score.

getCMISLinksFromCommonItems

Return a List of URLs representing the common items as CMIS objects.

getCMISLinksFromRecommendations

Return a List of URLs representing the CMIS objects.

getContentIDs

Extract content IDs from input objects. Includes content of all types (WC.document, WC.wiki).

getContentIDsExclude

Extract content IDs from input objects.

getContentIDsFiltered

Extract content IDs from input objects.


filterRecsByScore

Filter out Recommendations whose score is >= the input score.

Return only those Recommendations that are equal to or above the cutoffScore.

Arguments

recommendations

(java.util.Collection) A Collection Object.

cutoffScore

(float) The cutoff score.

Expression Language Format

${agfunction:filterRecsByScore(recommendations,cutoffScore)}

Returns

oracle.wcps.activity.agrest.spy.jaxb.Recommendations

Usage Notes

None.

getCMISLinksFromCommonItems

Return a List of clickable URLs representing the actual content item in common items as CMIS objects.

Arguments

results

(oracle.wcps.activity.agrest.spy.jaxb.Results)

Expression Language Format

${agfunction:getCMISLinksFromCommonItems(results)}

Returns

 java.util.List

Usage Notes

None.

getCMISLinksFromRecommendations

Return a List of clickable URLs representing actual content item in the recommendations.

Arguments

recommendation

(oracle.wcps.activity.agrest.spy.jaxb.Recommendations)

Expression Language Format

${agfunction:getCMISLinksFromRecommendations(recommendations)}

Returns

java.util.List

Usage Notes

None.

getContentIDs

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>

Arguments

agResults

(java.lang.Object)

Expression Language Format

${agfunction:getContentIDs(agResults)}

Returns

java.util.List

Usage Notes

None.

getContentIDsExclude

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>

Arguments

agResults

(java.lang.Object)

Expression Language Format

${agfunction:getContentIDsExclude(agResults,excludeClassURN)}

Returns

java.util.List

Usage Notes

None.

getContentIDsFiltered

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>

Arguments

agResults

(java.lang.Object)

filterClassURN

(java.lang.String)

Expression Language Format

${agfunction:getContentIDsFiltered(agResults,filterClassURN)}

Returns

java.util.List

Usage Notes

None.

CMIS Methods

Perform operations on CMIS.

Table 69-13 CMIS Methods

Use this method... To...

getCMISLinksFromCommonItems

Return a List of URLs representing the common items as CMIS objects.

getCMISLinksFromRecommendations

Return a List of URLs representing the CMIS objects.

getContentIDs

Extract content IDs from input objects. Includes content of all types (WC.document, WC.wiki).

getContentIDsExclude

Extract content IDs from input objects.

getContentIDsFiltered

Extract content IDs from input objects.

atomAsCMISObjects

ATOM feed as a List<CMISObject>.

atomAsEntries

ATOM feed as List<org.apache.abdera.model.Entry>

atomAsFeed

ATOM feed as org.apache.abdera.model.Feed

atomAsStreamUrls

ATOM feed as List<String> of URLs

getCMISQueryForDocIDs

Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs.

getCMISQueryForDocIDsFromFullID

Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs.


atomAsCMISObjects

Because CMISObject is not marshalable, use this method in your Java client code to convert the ATOM query response to List<CMISObject>.

Arguments

atomFeed

(java.lang.String) A Collection Object.

cutoffScore

(float) The cutoff score.

Expression Language Format

${cmisfunction:atomAsCMISObjects(atomFeed)}

Returns

java.util.List

Usage Notes

None.

atomAsEntries

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>.

Arguments

atomFeed

(String)

Expression Language Format

${cmisfunction:atomAsEntries(atomFeed)}

Returns

java.util.List

Usage Notes

None.

atomAsFeed

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>.

Arguments

atomFeed

(String)

Expression Language Format

${cmisfunction:atomAsFeed(atomFeed)}

Returns

java.util.List

Usage Notes

None.

atomAsStreamUrls

Returns an ATOM feed as List<String> of URLs.

Arguments

atomFeed

(String)

Expression Language Format

${agfunction:getContentIDs(agResults)}

Returns

java.util.List

Usage Notes

None.

getCMISQueryForDocIDs

Construct a CMIS query in the form of 'IN' query syntax that will retrieve the documents for the array of input doc IDs.

Arguments

repository

(String)

ids

(java.util.List)

Expression Language Format

${agfunction:getContentIDsExclude(agResults,excludeClassURN)}

Returns

String

Usage Notes

None.

getCMISQueryForDocIDsFromFullID

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'.

Arguments

ids

(java.util.List)

Expression Language Format

${cmisfunction:getCMISQueryForDocIDsFromFullID(ids)} 

Returns

String

Usage Notes

None.