Search in sources :

Example 1 with Row

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;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) Row(org.kuali.kfs.kns.web.ui.Row) UserProcurementProfileValidationService(edu.cornell.kfs.sys.service.UserProcurementProfileValidationService) Section(org.kuali.kfs.kns.web.ui.Section)

Example 2 with Row

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;
}
Also used : Account(org.kuali.kfs.coa.businessobject.Account) GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) DocumentAttributeString(org.kuali.rice.kew.api.document.attribute.DocumentAttributeString) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) DataDictionaryService(org.kuali.kfs.kns.service.DataDictionaryService) WorkflowException(org.kuali.rice.kew.api.exception.WorkflowException) Field(org.kuali.kfs.kns.web.ui.Field) AccountingLineGroupDefinition(org.kuali.kfs.sys.document.datadictionary.AccountingLineGroupDefinition) FinancialSystemTransactionalDocumentEntry(org.kuali.kfs.sys.document.datadictionary.FinancialSystemTransactionalDocumentEntry) GeneralLedgerPostingDocument(org.kuali.kfs.sys.document.GeneralLedgerPostingDocument) FinancialSystemTransactionalDocumentEntry(org.kuali.kfs.sys.document.datadictionary.FinancialSystemTransactionalDocumentEntry) DocumentEntry(org.kuali.kfs.krad.datadictionary.DocumentEntry) Row(org.kuali.kfs.kns.web.ui.Row)

Example 3 with Row

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);
}
Also used : CollectionIncomplete(org.kuali.kfs.krad.lookup.CollectionIncomplete) AccountStatusCurrentFunds(org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds) HashMap(java.util.HashMap) BeanPropertyComparator(org.kuali.kfs.krad.util.BeanPropertyComparator) ArrayList(java.util.ArrayList) LaborLedgerObject(org.kuali.kfs.integration.ld.LaborLedgerObject) LaborObject(org.kuali.kfs.module.ld.businessobject.LaborObject) July1PositionFunding(org.kuali.kfs.module.ld.businessobject.July1PositionFunding) ArrayList(java.util.ArrayList) IteratorUtils.toList(org.apache.commons.collections.IteratorUtils.toList) List(java.util.List) Row(org.kuali.kfs.kns.web.ui.Row) HashMap(java.util.HashMap) Map(java.util.Map)

Example 4 with Row

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());
                    }
                }
            }
        }
    }
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) Row(org.kuali.kfs.kns.web.ui.Row) Section(org.kuali.kfs.kns.web.ui.Section)

Example 5 with Row

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;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) ArrayList(java.util.ArrayList) Row(org.kuali.kfs.kns.web.ui.Row) Section(org.kuali.kfs.kns.web.ui.Section) AccountReversionService(edu.cornell.kfs.coa.service.AccountReversionService)

Aggregations

Row (org.kuali.kfs.kns.web.ui.Row)11 Field (org.kuali.kfs.kns.web.ui.Field)9 Section (org.kuali.kfs.kns.web.ui.Section)5 ArrayList (java.util.ArrayList)3 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)2 UserProcurementProfileValidationService (edu.cornell.kfs.sys.service.UserProcurementProfileValidationService)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 IteratorUtils.toList (org.apache.commons.collections.IteratorUtils.toList)1 Account (org.kuali.kfs.coa.businessobject.Account)1 LaborLedgerObject (org.kuali.kfs.integration.ld.LaborLedgerObject)1 MaintenanceDocumentRestrictions (org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions)1 DataDictionaryService (org.kuali.kfs.kns.service.DataDictionaryService)1 DocumentEntry (org.kuali.kfs.krad.datadictionary.DocumentEntry)1 CollectionIncomplete (org.kuali.kfs.krad.lookup.CollectionIncomplete)1 BeanPropertyComparator (org.kuali.kfs.krad.util.BeanPropertyComparator)1 AccountStatusCurrentFunds (org.kuali.kfs.module.ld.businessobject.AccountStatusCurrentFunds)1 July1PositionFunding (org.kuali.kfs.module.ld.businessobject.July1PositionFunding)1 LaborObject (org.kuali.kfs.module.ld.businessobject.LaborObject)1