use of org.kuali.kfs.kns.web.ui.Row in project cu-kfs by CU-CommunityApps.
the class UserProcurementProfileMaintainableImpl method getCoreSections.
@Override
public List<Section> getCoreSections(MaintenanceDocument document, Maintainable oldMaintainable) {
boolean hasRole = SpringContext.getBean(UserProcurementProfileValidationService.class).canMaintainUserProcurementProfile();
List<Section> sections = super.getCoreSections(document, oldMaintainable);
// if it is not 'super user', then default to user him/herself and disable person lookup
if (StringUtils.equals(document.getNewMaintainableObject().getMaintenanceAction(), KRADConstants.MAINTENANCE_EDIT_ACTION) || (!hasRole && StringUtils.equals(KRADConstants.MAINTENANCE_NEW_ACTION, document.getNewMaintainableObject().getMaintenanceAction()))) {
for (Section section : sections) {
for (Row row : section.getRows()) {
for (Field field : row.getFields()) {
if (StringUtils.equalsIgnoreCase(field.getPropertyName(), "profileUser.principalName")) {
field.setReadOnly(true);
field.setQuickFinderClassNameImpl("");
}
}
}
}
}
return sections;
}
use of org.kuali.kfs.kns.web.ui.Row in project cu-kfs by CU-CommunityApps.
the class FinancialSystemSearchableAttribute method getSearchingRows.
@Override
protected List<Row> getSearchingRows(String documentTypeName) {
if (LOG.isDebugEnabled()) {
LOG.debug("getSearchingRows( " + documentTypeName + " )");
if (LOG.isTraceEnabled()) {
LOG.trace("Stack Trace at point of call", new Throwable());
}
}
DataDictionaryService ddService = SpringContext.getBean(DataDictionaryService.class);
List<Row> docSearchRows = super.getSearchingRows(documentTypeName);
// add account number search field when selected document type is COA
if (StringUtils.isNotEmpty(documentTypeName)) {
if (CUKFSConstants.COA_DOCUMENT_TYPE.equalsIgnoreCase(documentTypeName)) {
Field accountField = FieldUtils.getPropertyField(Account.class, KFSPropertyConstants.ACCOUNT_NUMBER, true);
accountField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
accountField.setColumnVisible(true);
docSearchRows.add(new Row(Collections.singletonList(accountField)));
}
}
DocumentEntry entry = ddService.getDataDictionary().getDocumentEntry(documentTypeName);
if (entry != null) {
Class<? extends Document> docClass = entry.getDocumentClass();
if (AccountingDocument.class.isAssignableFrom(docClass)) {
Map<String, AccountingLineGroupDefinition> alGroups = ((FinancialSystemTransactionalDocumentEntry) entry).getAccountingLineGroups();
Class alClass = SourceAccountingLine.class;
if (ObjectUtils.isNotNull(alGroups)) {
if (alGroups.containsKey("source")) {
alClass = alGroups.get("source").getAccountingLineClass();
}
}
BusinessObject alBusinessObject = null;
try {
alBusinessObject = (BusinessObject) alClass.newInstance();
} catch (Exception cnfe) {
throw new RuntimeException("Unable to instantiate accounting line class: " + alClass, cnfe);
}
Field chartField = FieldUtils.getPropertyField(alClass, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, true);
chartField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
chartField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(alBusinessObject, KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, chartField, Collections.singletonList(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE));
docSearchRows.add(new Row(Collections.singletonList(chartField)));
Field orgField = FieldUtils.getPropertyField(Organization.class, KFSPropertyConstants.ORGANIZATION_CODE, true);
orgField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
orgField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(new Account(), KFSPropertyConstants.ORGANIZATION_CODE, orgField, Collections.singletonList(KFSPropertyConstants.ORGANIZATION_CODE));
docSearchRows.add(new Row(Collections.singletonList(orgField)));
Field accountField = FieldUtils.getPropertyField(alClass, KFSPropertyConstants.ACCOUNT_NUMBER, true);
accountField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
accountField.setColumnVisible(true);
LookupUtils.setFieldQuickfinder(alBusinessObject, KFSPropertyConstants.ACCOUNT_NUMBER, accountField, Collections.singletonList(KFSPropertyConstants.ACCOUNT_NUMBER));
docSearchRows.add(new Row(Collections.singletonList(accountField)));
}
boolean displayedLedgerPostingDoc = false;
if (LaborLedgerPostingDocumentForSearching.class.isAssignableFrom(docClass)) {
Field searchField = FieldUtils.getPropertyField(GeneralLedgerPendingEntry.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
LookupUtils.setFieldQuickfinder(new GeneralLedgerPendingEntry(), KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, searchField, Collections.singletonList(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE));
docSearchRows.add(new Row(Collections.singletonList(searchField)));
displayedLedgerPostingDoc = true;
}
if (GeneralLedgerPostingDocument.class.isAssignableFrom(docClass) && !displayedLedgerPostingDoc) {
Field searchField = FieldUtils.getPropertyField(GeneralLedgerPendingEntry.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_STRING);
LookupUtils.setFieldQuickfinder(new GeneralLedgerPendingEntry(), KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE, searchField, Collections.singletonList(KFSPropertyConstants.FINANCIAL_DOCUMENT_TYPE_CODE));
docSearchRows.add(new Row(Collections.singletonList(searchField)));
}
if (AmountTotaling.class.isAssignableFrom(docClass)) {
Field searchField = FieldUtils.getPropertyField(FinancialSystemDocumentHeader.class, KFSPropertyConstants.FINANCIAL_DOCUMENT_TOTAL_AMOUNT, true);
searchField.setFieldDataType(SearchableAttributeConstants.DATA_TYPE_FLOAT);
docSearchRows.add(new Row(Collections.singletonList(searchField)));
}
}
Row resultType = createSearchResultDisplayTypeRow();
docSearchRows.add(resultType);
if (LOG.isDebugEnabled()) {
LOG.debug("Returning Rows: " + docSearchRows);
}
return docSearchRows;
}
use of org.kuali.kfs.kns.web.ui.Row in project cu-kfs by CU-CommunityApps.
the class CurrentFundsLookupableHelperServiceImpl method getSearchResults.
/**
* Gets a list with the fields that will be displayed on page
*
* @param fieldValues list of fields that are used as a key to filter out data
* @see org.kuali.kfs.kns.lookup.Lookupable#getSearchResults(java.util.Map)
*/
@Override
public List getSearchResults(Map fieldValues) {
LOG.info("getSearchResults() - Entry");
boolean unbounded = false;
Long actualCountIfTruncated = new Long(0);
setBackLocation((String) fieldValues.get(KFSConstants.BACK_LOCATION));
setDocFormKey((String) fieldValues.get(KFSConstants.DOC_FORM_KEY));
// get the pending entry option. This method must be prior to the get search results
String pendingEntryOption = laborInquiryOptionsService.getSelectedPendingEntryOption(fieldValues);
// get the consolidation option
boolean isConsolidated = laborInquiryOptionsService.isConsolidationSelected(fieldValues, (Collection<Row>) getRows());
String searchObjectCodeVal = (String) fieldValues.get(KFSPropertyConstants.FINANCIAL_OBJECT_CODE);
// Check for a valid labor object code for this inquiry
if (StringUtils.isNotBlank(searchObjectCodeVal)) {
Map objectCodeFieldValues = new HashMap();
objectCodeFieldValues.put(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR, fieldValues.get(KFSPropertyConstants.UNIVERSITY_FISCAL_YEAR));
objectCodeFieldValues.put(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, fieldValues.get(KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE));
objectCodeFieldValues.put(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, searchObjectCodeVal);
LaborLedgerObject foundObjectCode = (LaborLedgerObject) businessObjectService.findByPrimaryKey(LaborObject.class, objectCodeFieldValues);
if (foundObjectCode == null) {
GlobalVariables.getMessageMap().putError(KFSPropertyConstants.FINANCIAL_OBJECT_CODE, LaborKeyConstants.ERROR_INVALID_LABOR_OBJECT_CODE, "2");
return new CollectionIncomplete(new ArrayList(), actualCountIfTruncated);
}
}
// Parse the map and call the DAO to process the inquiry
Collection<AccountStatusCurrentFunds> searchResultsCollection = buildCurrentFundsCollection(toList(laborDao.getCurrentFunds(fieldValues, isConsolidated)), isConsolidated, pendingEntryOption);
// update search results according to the selected pending entry option
laborInquiryOptionsService.updateCurrentFundsByPendingLedgerEntry(searchResultsCollection, fieldValues, pendingEntryOption, isConsolidated);
// gets the July1st budget amount column.
Collection<July1PositionFunding> july1PositionFundings = laborDao.getJuly1(fieldValues);
this.updateJuly1BalanceAmount(searchResultsCollection, july1PositionFundings, isConsolidated);
// sort list if default sort column given
List searchResults = (List) searchResultsCollection;
List defaultSortColumns = getDefaultSortColumns();
if (defaultSortColumns.size() > 0) {
Collections.sort(searchResults, new BeanPropertyComparator(defaultSortColumns, true));
}
return new CollectionIncomplete(searchResults, actualCountIfTruncated);
}
use of org.kuali.kfs.kns.web.ui.Row in project cu-kfs by CU-CommunityApps.
the class WebUtils method reopenInactiveRecords.
/**
* Attempts to reopen sub tabs which would have been closed for inactive records
*
* @param sections the list of Sections whose rows and fields to set the open tab state on
* @param tabStates the map of tabKey->tabState. This map will be modified to set entries to "OPEN"
* @param collectionName the name of the collection reopening
*/
public static void reopenInactiveRecords(List<Section> sections, Map<String, String> tabStates, String collectionName) {
for (Section section : sections) {
for (Row row : section.getRows()) {
for (Field field : row.getFields()) {
if (field != null) {
if (Field.CONTAINER.equals(field.getFieldType()) && StringUtils.startsWith(field.getContainerName(), collectionName)) {
final String tabKey = WebUtils.generateTabKey(FieldUtils.generateCollectionSubTabName(field));
tabStates.put(tabKey, KualiForm.TabState.OPEN.name());
}
}
}
}
}
}
use of org.kuali.kfs.kns.web.ui.Row in project cu-kfs by CU-CommunityApps.
the class AccountReversionInquirable method getSections.
/**
* Overridden to take out details with inactive categories
* @see org.kuali.kfs.kns.inquiry.KualiInquirableImpl#getSections(org.kuali.kfs.kns.bo.BusinessObject)
*/
@Override
public List<Section> getSections(BusinessObject bo) {
List<Section> sections = super.getSections(bo);
if (accountReversionService == null) {
accountReversionService = SpringContext.getBean(AccountReversionService.class);
}
for (Section section : sections) {
for (Row row : section.getRows()) {
List<Field> updatedFields = new ArrayList<Field>();
for (Field field : row.getFields()) {
if (shouldIncludeField(field)) {
updatedFields.add(field);
}
}
row.setFields(updatedFields);
}
}
return sections;
}
Aggregations