org.kuali.student.common.assembly.dictionary
Class MetadataServiceImpl

java.lang.Object
  extended by org.kuali.student.common.assembly.dictionary.MetadataServiceImpl
Direct Known Subclasses:
ProgramMetadataServiceImpl

public class MetadataServiceImpl
extends Object

This class provides metadata lookup for service dto objects.

Author:
Kuali Student Team

Nested Class Summary
private static class MetadataServiceImpl.RecursionCounter
           
 
Field Summary
private  Map<String,DictionaryService> dictionaryServiceMap
           
(package private)  Logger LOG
           
private  List<UILookupConfig> lookupObjectStructures
           
private  String uiLookupContext
           
 
Constructor Summary
MetadataServiceImpl(DictionaryService... dictionaryServices)
          Create a metadata service initializing it with all known dictionary services
 
Method Summary
private  void addLookupstoMetadata(String objectKey, Metadata metadata, String type)
           
private  String calcSimpleName(String objectKey)
           
protected  Data.Value convertDefaultValue(Data.DataType dataType, Object value)
          Convert Object value to respective DataType.
protected  Data.Value convertDefaultValue(Object value)
           
protected  Data.DataType convertDictionaryDataType(DataType dataType)
           
protected  List<ConstraintMetadata> getConstraints(FieldDefinition fd, String type, String state, String nextState)
           
 Metadata getMetadata(String objectKey)
          This method gets the metadata for the given object key for state DRAFT.
 Metadata getMetadata(String objectKey, String state)
          This method gets the metadata for the given object key and state
 Metadata getMetadata(String objectKey, String type, String state)
          This method gets the metadata for the given object key, type and state
 Metadata getMetadata(String objectKey, String type, String state, String nextState)
          This method gets the metadata for the given object key, type, state and nextState
protected  Metadata getMetadataFromDictionaryService(String objectKey, String type, String state, String nextState)
          This invokes the appropriate dictionary service to get the object structure and then converts it to a metadata structure.
protected  ObjectStructureDefinition getObjectStructure(String objectKey)
          This method gets the object structure for given objectKey from a dictionaryService
private static String[] getPathTokens(String fieldPath)
           
private  Map<String,Metadata> getProperties(ObjectStructureDefinition objectStructure, String type, String state, String nextState, MetadataServiceImpl.RecursionCounter counter)
          This method is used to convert a list of dictionary fields into metadata properties
private  void init()
           
protected  boolean isRepeating(FieldDefinition fd)
          This method determines if a field is repeating
private  LookupMetadata mapLookupDatatoMeta(UILookupData lookupData)
           
private  LookupParamMetadata mapLookupParamMetadata(CommonLookupParam param)
           
private  boolean matchesObjectKey(String objectKey, String path)
           
private  boolean matchesType(String paramType, String lookupType)
           
protected  void processCaseConstraint(ConstraintMetadata constraintMetadata, CaseConstraint caseConstraint, String type, String state, String nextState)
           
 void setUiLookupContext(String uiLookupContext)
           
protected  void updateConstraintMetadata(ConstraintMetadata constraintMetadata, Constraint constraint, String type, String state, String nextState)
          This updates the constraintMetadata with defintions from the dictionary constraint field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

final Logger LOG

dictionaryServiceMap

private Map<String,DictionaryService> dictionaryServiceMap

lookupObjectStructures

private List<UILookupConfig> lookupObjectStructures

uiLookupContext

private String uiLookupContext
Constructor Detail

MetadataServiceImpl

public MetadataServiceImpl(DictionaryService... dictionaryServices)
Create a metadata service initializing it with all known dictionary services

Parameters:
dictionaryServices -
Method Detail

getMetadata

public Metadata getMetadata(String objectKey,
                            String type,
                            String state,
                            String nextState)
This method gets the metadata for the given object key, type, state and nextState

Parameters:
objectKey -
type - The type of the object (value can be null)
state - The state for which to retrieve object constraints (value can be null)
nextState - The state to to check requiredForNextState indicators (value can be null)
Returns:

getMetadata

public Metadata getMetadata(String objectKey,
                            String type,
                            String state)
This method gets the metadata for the given object key, type and state

Parameters:
objectKey -
type - The type of the object (value can be null)
state - The state for which to retrieve object constraints (value can be null)
Returns:

getMetadata

public Metadata getMetadata(String objectKey,
                            String state)
This method gets the metadata for the given object key and state

Parameters:
objectKey -
type - The type of the object (value can be null)

getMetadata

public Metadata getMetadata(String objectKey)
This method gets the metadata for the given object key for state DRAFT.

Parameters:
objectKey -
Returns:
See Also:
getMetadata(String, String)

getMetadataFromDictionaryService

protected Metadata getMetadataFromDictionaryService(String objectKey,
                                                    String type,
                                                    String state,
                                                    String nextState)
This invokes the appropriate dictionary service to get the object structure and then converts it to a metadata structure.

Parameters:
objectKey -
type -
state -
Returns:

getProperties

private Map<String,Metadata> getProperties(ObjectStructureDefinition objectStructure,
                                           String type,
                                           String state,
                                           String nextState,
                                           MetadataServiceImpl.RecursionCounter counter)
This method is used to convert a list of dictionary fields into metadata properties

Parameters:
fields -
type -
state -
Returns:

isRepeating

protected boolean isRepeating(FieldDefinition fd)
This method determines if a field is repeating

Parameters:
fd -
Returns:

getObjectStructure

protected ObjectStructureDefinition getObjectStructure(String objectKey)
This method gets the object structure for given objectKey from a dictionaryService

Parameters:
objectKey -
Returns:

getConstraints

protected List<ConstraintMetadata> getConstraints(FieldDefinition fd,
                                                  String type,
                                                  String state,
                                                  String nextState)

updateConstraintMetadata

protected void updateConstraintMetadata(ConstraintMetadata constraintMetadata,
                                        Constraint constraint,
                                        String type,
                                        String state,
                                        String nextState)
This updates the constraintMetadata with defintions from the dictionary constraint field.

Parameters:
constraintMetadata -
constraint -

processCaseConstraint

protected void processCaseConstraint(ConstraintMetadata constraintMetadata,
                                     CaseConstraint caseConstraint,
                                     String type,
                                     String state,
                                     String nextState)

convertDefaultValue

protected Data.Value convertDefaultValue(Data.DataType dataType,
                                         Object value)
Convert Object value to respective DataType. Method return null for object Value.

Parameters:
dataType -
value -
Returns:

convertDefaultValue

protected Data.Value convertDefaultValue(Object value)

convertDictionaryDataType

protected Data.DataType convertDictionaryDataType(DataType dataType)

setUiLookupContext

public void setUiLookupContext(String uiLookupContext)

init

private void init()

calcSimpleName

private String calcSimpleName(String objectKey)

matchesObjectKey

private boolean matchesObjectKey(String objectKey,
                                 String path)

matchesType

private boolean matchesType(String paramType,
                            String lookupType)

addLookupstoMetadata

private void addLookupstoMetadata(String objectKey,
                                  Metadata metadata,
                                  String type)

mapLookupDatatoMeta

private LookupMetadata mapLookupDatatoMeta(UILookupData lookupData)

mapLookupParamMetadata

private LookupParamMetadata mapLookupParamMetadata(CommonLookupParam param)

getPathTokens

private static String[] getPathTokens(String fieldPath)


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