org.kuali.student.common.ui.client.application
Class ApplicationContext

java.lang.Object
  extended by org.kuali.student.common.ui.client.application.ApplicationContext

public class ApplicationContext
extends Object

The application contains information about who is currently logged in, the security context, and access to messages loaded from the message service in the app. It provides and a static way to obtain this information across the entire app.

Author:
Kuali Student

Field Summary
private  String applicationContextUrl
           
private  HashMap<String,HashMap<String,HashSet<HasCrossConstraints>>> crossConstraints
           
private  Map<String,String> flatMessages
           
private  boolean loggedIn
           
private  Map<String,Map<String,String>> messages
           
private  List<Message> messagesList
           
private  String parentPath
           
private  HashMap<String,HashMap<String,FieldDescriptor>> pathToFieldMapping
           
private  List<String> roles
           
private  SecurityContext securityContext
           
private  ServerPropertiesRpcServiceAsync serverPropertiesRpcService
           
private  String userId
           
private  String version
           
 
Constructor Summary
protected ApplicationContext()
          This constructor should only be visible to the common application package.
 
Method Summary
 void addMessages(List<Message> messages)
          Adds the messages in the list of messages to the map of the messages
 void clearCrossConstraintMap(String namespace)
           
 void clearCrossConstraintsWithStartingPath(String namespace, String pathPrefix)
          Removes the bidirectional mapping for all paths that start with the path prefix This means if Field A had a dependency on Field B, and you cleared A, first all mappings with dependencies to A would be removed, then all mappings with dependencies to A would be removed.
 void clearPathToFieldMapping(String namespace)
           
 String getApplicationContextUrl()
          Application URL based on the serverPropertiesRPC service result
 HashSet<HasCrossConstraints> getCrossConstraint(String namespace, String path)
           
 HashSet<HasCrossConstraints> getCrossConstraints(String namespace)
           
 String getMessage(String messageId)
          Get a message by a unique id
 String getMessage(String groupName, String messageId)
          Get message by the group it is in and its unique id within that group
 List<Message> getMessages()
          Returns all the messages in the ApplicationContext
 String getParentPath()
           
 FieldDescriptor getPathToFieldMapping(String namespace, String path)
           
 List<String> getRoles()
           
 SecurityContext getSecurityContext()
          Get the security context for the app
 String getUILabel(String groupName, String fieldId)
          Same as getUILabel(String groupName, String type, String state, String fieldId) with no type and state needed
 String getUILabel(String groupName, String type, String state, String fieldId)
          This method looks up a UI Label in the messages cache.
 String getUserId()
           
 String getVersion()
           
 boolean isLoggedIn()
           
 void putCrossConstraint(String namespace, String path, HasCrossConstraints fd)
          Adds a mapping from path to a list of field descriptors for a given namespace namespace defaults to _default if null
 void putPathToFieldMapping(String namespace, String path, FieldDescriptor fd)
           
 void setLoggedIn(boolean loggedIn)
           
 void setParentPath(String parentPath)
           
 void setRoles(List<String> roles)
           
 void setSecurityContext(SecurityContext securityContext)
           
 void setUserId(String userId)
           
 void setVersion(String version)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverPropertiesRpcService

private ServerPropertiesRpcServiceAsync serverPropertiesRpcService

loggedIn

private boolean loggedIn

userId

private String userId

version

private String version

roles

private List<String> roles

messages

private Map<String,Map<String,String>> messages

flatMessages

private Map<String,String> flatMessages

messagesList

private List<Message> messagesList

securityContext

private SecurityContext securityContext

applicationContextUrl

private String applicationContextUrl

parentPath

private String parentPath

pathToFieldMapping

private HashMap<String,HashMap<String,FieldDescriptor>> pathToFieldMapping

crossConstraints

private HashMap<String,HashMap<String,HashSet<HasCrossConstraints>>> crossConstraints
Constructor Detail

ApplicationContext

protected ApplicationContext()
This constructor should only be visible to the common application package. If ApplicationContext is required outside this package do Application.getApplicationContext();

Method Detail

setLoggedIn

public void setLoggedIn(boolean loggedIn)

setUserId

public void setUserId(String userId)

setRoles

public void setRoles(List<String> roles)

isLoggedIn

public boolean isLoggedIn()

getUserId

public String getUserId()

getRoles

public List<String> getRoles()

addMessages

public void addMessages(List<Message> messages)
Adds the messages in the list of messages to the map of the messages

Parameters:
messages -

getMessage

public String getMessage(String messageId)
Get a message by a unique id


getMessages

public List<Message> getMessages()
Returns all the messages in the ApplicationContext


getMessage

public String getMessage(String groupName,
                         String messageId)
Get message by the group it is in and its unique id within that group


getUILabel

public String getUILabel(String groupName,
                         String type,
                         String state,
                         String fieldId)
This method looks up a UI Label in the messages cache. First looks for a label specific to the type and state of the field. If none found try for a generalized label. Otherwise return the supplied fieldId Groups provide namespace for same label ids within different LUs

Parameters:
groupName - - for example 'course' or 'program'
type -
state -
fieldId -
Returns:

getUILabel

public String getUILabel(String groupName,
                         String fieldId)
Same as getUILabel(String groupName, String type, String state, String fieldId) with no type and state needed


getSecurityContext

public SecurityContext getSecurityContext()
Get the security context for the app

Returns:
SecurityContext

setSecurityContext

public void setSecurityContext(SecurityContext securityContext)

getApplicationContextUrl

public String getApplicationContextUrl()
Application URL based on the serverPropertiesRPC service result


setVersion

public void setVersion(String version)

getVersion

public String getVersion()

putCrossConstraint

public void putCrossConstraint(String namespace,
                               String path,
                               HasCrossConstraints fd)
Adds a mapping from path to a list of field descriptors for a given namespace namespace defaults to _default if null

Parameters:
path -
fd -

getCrossConstraint

public HashSet<HasCrossConstraints> getCrossConstraint(String namespace,
                                                       String path)

clearCrossConstraintMap

public void clearCrossConstraintMap(String namespace)

putPathToFieldMapping

public void putPathToFieldMapping(String namespace,
                                  String path,
                                  FieldDescriptor fd)

getPathToFieldMapping

public FieldDescriptor getPathToFieldMapping(String namespace,
                                             String path)

clearPathToFieldMapping

public void clearPathToFieldMapping(String namespace)

clearCrossConstraintsWithStartingPath

public void clearCrossConstraintsWithStartingPath(String namespace,
                                                  String pathPrefix)
Removes the bidirectional mapping for all paths that start with the path prefix This means if Field A had a dependency on Field B, and you cleared A, first all mappings with dependencies to A would be removed, then all mappings with dependencies to A would be removed.

Parameters:
namespace -
pathPrefix -

getCrossConstraints

public HashSet<HasCrossConstraints> getCrossConstraints(String namespace)

getParentPath

public String getParentPath()

setParentPath

public void setParentPath(String parentPath)


Copyright © 2007-2011 The Kuali Foundation. All Rights Reserved.