ariba.ui.aribaweb.util
Class AWCommunityContext

java.lang.Object
  extended by ariba.ui.aribaweb.util.AWCommunityContext

public class AWCommunityContext
extends java.lang.Object

This models the community context (which will be passed onto community when we click on a help link or to the in situ frame as we navigate in AN, Sourcing, etc). The context is a set of attributes. Not all have to be present (in some cases the application itself, or the page, or perhaps the domain object will be enough to determine the help or content to be shown to the user). The context consists of: Where (application, page) Activity (one of create, edit, review, approve, etc.) What (one of invoice, PO, contract, etc.) Tags (set of tags from the community vocabulary) Tags from othe domains (will allow on-the-fly creation of other domains -- for example "commodity" which we will not attempt to validate)


Nested Class Summary
static class AWCommunityContext.DomainAndValue
          We implement a tag with a domain so that always know the domain in which the tag is located.
 
Field Summary
static java.lang.String DomainActivity
           
static java.lang.String DomainApplication
           
static java.lang.String DomainDomainObject
           
static java.lang.String DomainPage
           
 
Constructor Summary
AWCommunityContext()
           
 
Method Summary
 void addTags(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tags)
          Add a set of tags (may be from any domain, registered or not).
 void addTags(java.lang.String domain, java.util.Set<java.lang.String> vals)
          Add a set of tags (may be from any domain, registered or not)
 java.lang.String getActivity()
          Return the activity being engaged in
 java.lang.String getApplication()
          Return the application
 java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getContextAsMap()
          Generate a map (domain -> Set) all the tags.
 java.lang.String getContextAsTagsCSV()
          Generate a CSV strings with all the tags.
 java.lang.String getPage()
          Return the page
static java.util.Set<java.lang.String> getRegisteredTags(java.lang.String domain)
          Given a domain, return the set of tags registered for that domain.
static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> parseCommunityContext(java.lang.String inStr, char seperator, boolean ensureValid)
          Given an input string of community context with a partiular seperator (say , or ;) break this up and return a map from domain to a set of values.
static void registerTag(java.lang.String domain, java.lang.String tag)
          Register the tags in a particular domain.
 void setActivity(java.lang.String activity)
          Set the activity engaged in by user
 void setApplication(java.lang.String application)
          Set the application
 void setPage(java.lang.String page)
          Set the page (this will be the AWPage.perfPageName by default)
static java.lang.String tagCollectionToCSV(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> domainTagsAndVals)
          Given a map from domain -> Set return a CSV
static java.lang.String tagCollectionToCSV(java.util.Set<AWCommunityContext.DomainAndValue> tags)
          Given a set of pairs return a CSV
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DomainDomainObject

public static final java.lang.String DomainDomainObject
See Also:
Constant Field Values

DomainApplication

public static final java.lang.String DomainApplication
See Also:
Constant Field Values

DomainPage

public static final java.lang.String DomainPage
See Also:
Constant Field Values

DomainActivity

public static final java.lang.String DomainActivity
See Also:
Constant Field Values
Constructor Detail

AWCommunityContext

public AWCommunityContext()
Method Detail

addTags

public void addTags(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> tags)
Add a set of tags (may be from any domain, registered or not). If the domain is registered we will validate the values for that domain

Parameters:
tags - map from domain to a set of strings

addTags

public void addTags(java.lang.String domain,
                    java.util.Set<java.lang.String> vals)
Add a set of tags (may be from any domain, registered or not)

Parameters:
domain - the type of tag (say activity, domainObject, page)
vals - set of values for that domain

setPage

public void setPage(java.lang.String page)
Set the page (this will be the AWPage.perfPageName by default)

Parameters:
page -

getPage

public java.lang.String getPage()
Return the page

Returns:
page

setApplication

public void setApplication(java.lang.String application)
Set the application

Parameters:
application -

getApplication

public java.lang.String getApplication()
Return the application

Returns:
application

setActivity

public void setActivity(java.lang.String activity)
Set the activity engaged in by user

Parameters:
activity - -- should be from among ActionCreate, ActionEdit, etc.

getActivity

public java.lang.String getActivity()
Return the activity being engaged in

Returns:
activity

getContextAsTagsCSV

public java.lang.String getContextAsTagsCSV()
Generate a CSV strings with all the tags. If we have no value (say no page) then we will not return any tag from the page domain.

Returns:
csv of all tags

getContextAsMap

public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getContextAsMap()
Generate a map (domain -> Set) all the tags. If we have no value (say no page) then we will not return any tag from the page domain.

Returns:
csv of all tags

registerTag

public static void registerTag(java.lang.String domain,
                               java.lang.String tag)
Register the tags in a particular domain.

Parameters:
domain -
tag -

getRegisteredTags

public static java.util.Set<java.lang.String> getRegisteredTags(java.lang.String domain)
Given a domain, return the set of tags registered for that domain. May be empty but will not be null.

Parameters:
domain -
Returns:
the set of registered tags from a domain

tagCollectionToCSV

public static java.lang.String tagCollectionToCSV(java.util.Set<AWCommunityContext.DomainAndValue> tags)
Given a set of pairs return a CSV

Parameters:
tags -
Returns:

tagCollectionToCSV

public static java.lang.String tagCollectionToCSV(java.util.Map<java.lang.String,java.util.Set<java.lang.String>> domainTagsAndVals)
Given a map from domain -> Set return a CSV

Parameters:
domainTagsAndVals -
Returns:

parseCommunityContext

public static java.util.Map<java.lang.String,java.util.Set<java.lang.String>> parseCommunityContext(java.lang.String inStr,
                                                                                                    char seperator,
                                                                                                    boolean ensureValid)
                                                                                             throws AWGenericException
Given an input string of community context with a partiular seperator (say , or ;) break this up and return a map from domain to a set of values. For instance given: "domainObject:invoice,activity:reconcile,av:reconciliation,av:VAT" then (assuming , is the seperator char) return (domainObject -> , activity-> , av -> Note we assume that the ":" char is the seperator between domain and value. Note this is not a full blown CSV parser, we do not check for seperators escaped or embeded in quotes. We do trim the individual values. (so " two words " -> "two words" with leading and trailing trailing spaces removed and all multiple instances of white space compressed to a single space

Parameters:
inStr - input
seperator - probably , or ;
ensureValid - if true then check that for registered domains that the values in that domain are indeed registered and throw an exception if not
Returns:
a map as described above
Throws:
AWGenericException


AribaWeb User Interface Development Framework
Copyright © 2000-2014 Ariba, Inc. All Rights Reserved.