org.kuali.rice.kns.util
Class MaintenanceUtils

java.lang.Object
  extended by org.kuali.rice.kns.util.MaintenanceUtils

public class MaintenanceUtils
extends Object


Field Summary
private static DataDictionaryService dataDictionaryService
           
private static KualiConfigurationService kualiConfigurationService
           
private static KualiExceptionIncidentService kualiExceptionIncidentService
           
private static org.apache.log4j.Logger LOG
           
private static MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService
           
private static MaintenanceDocumentService maintenanceDocumentService
           
private static WorkflowDocumentService workflowDocumentService
           
 
Constructor Summary
MaintenanceUtils()
           
 
Method Summary
private static void addMaintenanceDocumentCollectionPathToSecurityMappings(Map<String,AttributeSecurity> mappings, String propertyPathPrefix, MaintainableCollectionDefinition collectionDefinition)
           
protected static void addRowsToErrorKeySet(List<Row> listOfRows, Set<String> errorKeys)
          This method recurses through all the fields of the list of rows and adds each field's property name to the set if it starts with Constants.MAINTENANCE_NEW_MAINTAINABLE
private static void checkDocumentBlockingDocumentId(String blockingDocId, boolean throwExceptionIfLocked)
           
static void checkForLockingDocument(Maintainable maintainable, boolean throwExceptionIfLocked)
          This method will throw a ValidationException if there is a valid locking document in existence and throwExceptionIfLocked is true.
static void checkForLockingDocument(MaintenanceDocument document, boolean throwExceptionIfLocked)
          This method will throw a ValidationException if there is a valid locking document in existence and throwExceptionIfLocked is true.
private static void cleanOrphanLocks(String lockingDocumentNumber, Exception workflowException)
           
static MaintainableCollectionDefinition findMaintainableCollectionDefinition(List<MaintainableSectionDefinition> sections, String collectionName)
          Finds the MaintainableCollectionDefinition corresponding to the given collection name.
private static
<E extends MaintainableItemDefinition>
MaintainableCollectionDefinition
findMaintainableCollectionDefinitionHelper(Collection<E> items, String[] collectionNameParts, int collectionNameIndex)
           
static String generateErrorKeyForSection(Section section)
          Given a section, returns a comma delimited string of all fields, representing the error keys that exist for a section
static Map<String,String> generateMultipleValueLookupBOTemplate(List<MaintainableSectionDefinition> sections, String collectionName)
          Returns the field templates defined in the maint dictionary xml files.
private static DataDictionaryService getDataDictionaryService()
           
private static KualiConfigurationService getKualiConfigurationService()
           
private static KualiExceptionIncidentService getKualiExceptionIncidentService()
           
private static MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService()
           
private static MaintenanceDocumentService getMaintenanceDocumentService()
           
private static WorkflowDocumentService getWorkflowDocumentService()
           
static boolean isMaintenanceDocumentCreatingNewRecord(String maintenanceAction)
           
private static boolean lockCanBeIgnored(KualiWorkflowDocument lockedDocument)
          This method guesses whether the current user should be allowed to change a document even though it is locked.
private static String prefixFieldConversionsDestinationsWithCollectionPrefix(String originalFieldConversions, String collectionPrefix)
           
static Map<String,AttributeSecurity> retrievePropertyPathToAttributeSecurityMappings(String docTypeName)
           
static void setFieldDirectInquiry(BusinessObject businessObject, String collectionName, boolean addLine, int index, String attributeName, Field field, List<String> displayedFieldNames, Maintainable maintainable, MaintainableFieldDefinition maintainableFieldDefinition)
           
static void setFieldDirectInquiry(BusinessObject businessObject, String attributeName, MaintainableFieldDefinition maintainableFieldDefinition, Field field, List<String> displayedFieldNames)
           
static Field setFieldQuickfinder(BusinessObject businessObject, String collectionName, boolean addLine, int index, String attributeName, Field field, List<String> displayedFieldNames, Maintainable maintainable, MaintainableFieldDefinition maintainableFieldDefinition)
           
static Field setFieldQuickfinder(BusinessObject businessObject, String attributeName, MaintainableFieldDefinition maintainableFieldDefinition, Field field, List<String> displayedFieldNames, SelectiveReferenceRefresher srr)
          Checks to see if there has been an override lookup declared for the maintenance field.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

private static final org.apache.log4j.Logger LOG

maintenanceDocumentService

private static MaintenanceDocumentService maintenanceDocumentService

workflowDocumentService

private static WorkflowDocumentService workflowDocumentService

kualiConfigurationService

private static KualiConfigurationService kualiConfigurationService

kualiExceptionIncidentService

private static KualiExceptionIncidentService kualiExceptionIncidentService

maintenanceDocumentDictionaryService

private static MaintenanceDocumentDictionaryService maintenanceDocumentDictionaryService

dataDictionaryService

private static DataDictionaryService dataDictionaryService
Constructor Detail

MaintenanceUtils

public MaintenanceUtils()
Method Detail

generateMultipleValueLookupBOTemplate

public static Map<String,String> generateMultipleValueLookupBOTemplate(List<MaintainableSectionDefinition> sections,
                                                                       String collectionName)
Returns the field templates defined in the maint dictionary xml files. Field templates are used in multiple value lookups. When doing a MV lookup on a collection, the returned BOs are not necessarily of the same type as the elements of the collection. Therefore, a means of mapping between the fields for the 2 BOs are necessary. The template attribute of <maintainableField>s contained within <maintainableCollection>s tells us this mapping. Example: a <maintainableField name="collectionAttrib" template="lookupBOAttrib"> definition means that when a list of BOs are returned, the lookupBOAttrib value of the looked up BO will be placed into the collectionAttrib value of the BO added to the collection

Parameters:
sections - the sections of a document
collectionName - the name of a collection. May be a nested collection with indices (e.g. collA[1].collB)
Returns:

findMaintainableCollectionDefinition

public static MaintainableCollectionDefinition findMaintainableCollectionDefinition(List<MaintainableSectionDefinition> sections,
                                                                                    String collectionName)
Finds the MaintainableCollectionDefinition corresponding to the given collection name. For example, if the collection name is "A.B.C", it will attempt to find the MaintainableCollectionDefinition for C that is nested in B that is nested under A. This may not work correctly if there are duplicate collection definitions within the sections

Parameters:
sections - the sections of a maint doc
collectionName - the name of a collection, relative to the root of the BO being maintained. This value may have index values (e.g. [1]), but these are ignored.
Returns:

findMaintainableCollectionDefinitionHelper

private static <E extends MaintainableItemDefinition> MaintainableCollectionDefinition findMaintainableCollectionDefinitionHelper(Collection<E> items,
                                                                                                                                  String[] collectionNameParts,
                                                                                                                                  int collectionNameIndex)

setFieldQuickfinder

public static final Field setFieldQuickfinder(BusinessObject businessObject,
                                              String attributeName,
                                              MaintainableFieldDefinition maintainableFieldDefinition,
                                              Field field,
                                              List<String> displayedFieldNames,
                                              SelectiveReferenceRefresher srr)
Checks to see if there has been an override lookup declared for the maintenance field. If so, the override will be used for the quickfinder and lookup utils will not be called. If no override was given, LookupUtils.setFieldQuickfinder will be called to set the system generated quickfinder based on the attributes relationship to the parent business object.

Returns:
Field with quickfinder set if one was found

setFieldQuickfinder

public static final Field setFieldQuickfinder(BusinessObject businessObject,
                                              String collectionName,
                                              boolean addLine,
                                              int index,
                                              String attributeName,
                                              Field field,
                                              List<String> displayedFieldNames,
                                              Maintainable maintainable,
                                              MaintainableFieldDefinition maintainableFieldDefinition)

prefixFieldConversionsDestinationsWithCollectionPrefix

private static String prefixFieldConversionsDestinationsWithCollectionPrefix(String originalFieldConversions,
                                                                             String collectionPrefix)

setFieldDirectInquiry

public static final void setFieldDirectInquiry(BusinessObject businessObject,
                                               String attributeName,
                                               MaintainableFieldDefinition maintainableFieldDefinition,
                                               Field field,
                                               List<String> displayedFieldNames)

setFieldDirectInquiry

public static final void setFieldDirectInquiry(BusinessObject businessObject,
                                               String collectionName,
                                               boolean addLine,
                                               int index,
                                               String attributeName,
                                               Field field,
                                               List<String> displayedFieldNames,
                                               Maintainable maintainable,
                                               MaintainableFieldDefinition maintainableFieldDefinition)

generateErrorKeyForSection

public static String generateErrorKeyForSection(Section section)
Given a section, returns a comma delimited string of all fields, representing the error keys that exist for a section

Parameters:
section - a section
Returns:

addRowsToErrorKeySet

protected static void addRowsToErrorKeySet(List<Row> listOfRows,
                                           Set<String> errorKeys)
This method recurses through all the fields of the list of rows and adds each field's property name to the set if it starts with Constants.MAINTENANCE_NEW_MAINTAINABLE

Parameters:
listOfRows -
errorKeys -
See Also:
KNSConstants.MAINTENANCE_NEW_MAINTAINABLE

isMaintenanceDocumentCreatingNewRecord

public static boolean isMaintenanceDocumentCreatingNewRecord(String maintenanceAction)

checkForLockingDocument

public static void checkForLockingDocument(MaintenanceDocument document,
                                           boolean throwExceptionIfLocked)
This method will throw a ValidationException if there is a valid locking document in existence and throwExceptionIfLocked is true.


checkForLockingDocument

public static void checkForLockingDocument(Maintainable maintainable,
                                           boolean throwExceptionIfLocked)
This method will throw a ValidationException if there is a valid locking document in existence and throwExceptionIfLocked is true.


checkDocumentBlockingDocumentId

private static void checkDocumentBlockingDocumentId(String blockingDocId,
                                                    boolean throwExceptionIfLocked)

lockCanBeIgnored

private static boolean lockCanBeIgnored(KualiWorkflowDocument lockedDocument)
This method guesses whether the current user should be allowed to change a document even though it is locked. It probably should use Authorization instead? See KULNRVSYS-948

Parameters:
lockedDocument -
Returns:
Throws:
WorkflowException

cleanOrphanLocks

private static void cleanOrphanLocks(String lockingDocumentNumber,
                                     Exception workflowException)

getMaintenanceDocumentService

private static MaintenanceDocumentService getMaintenanceDocumentService()

getWorkflowDocumentService

private static WorkflowDocumentService getWorkflowDocumentService()

getKualiConfigurationService

private static KualiConfigurationService getKualiConfigurationService()

getKualiExceptionIncidentService

private static KualiExceptionIncidentService getKualiExceptionIncidentService()

getMaintenanceDocumentDictionaryService

private static MaintenanceDocumentDictionaryService getMaintenanceDocumentDictionaryService()

getDataDictionaryService

private static DataDictionaryService getDataDictionaryService()

retrievePropertyPathToAttributeSecurityMappings

public static Map<String,AttributeSecurity> retrievePropertyPathToAttributeSecurityMappings(String docTypeName)

addMaintenanceDocumentCollectionPathToSecurityMappings

private static void addMaintenanceDocumentCollectionPathToSecurityMappings(Map<String,AttributeSecurity> mappings,
                                                                           String propertyPathPrefix,
                                                                           MaintainableCollectionDefinition collectionDefinition)


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