Search in sources :

Example 1 with Field

use of org.kuali.kfs.kns.web.ui.Field 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 2 with Field

use of org.kuali.kfs.kns.web.ui.Field 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)

Example 3 with Field

use of org.kuali.kfs.kns.web.ui.Field 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());
        }
    }
    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(CoreConstants.DATA_TYPE_STRING);
            accountField.setColumnVisible(true);
            docSearchRows.add(new Row(Collections.singletonList(accountField)));
        }
    }
    DocumentEntry entry = SpringContext.getBean(DocumentDictionaryService.class).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;
            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(CoreConstants.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(CoreConstants.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(CoreConstants.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(CoreConstants.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(CoreConstants.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(CoreConstants.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) DocumentDictionaryService(org.kuali.kfs.datadictionary.legacy.DocumentDictionaryService) GeneralLedgerPendingEntry(org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry) DocumentAttributeString(org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString) SourceAccountingLine(org.kuali.kfs.sys.businessobject.SourceAccountingLine) BusinessObject(org.kuali.kfs.krad.bo.BusinessObject) WorkflowException(org.kuali.kfs.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.kns.datadictionary.DocumentEntry) Row(org.kuali.kfs.kns.web.ui.Row)

Example 4 with Field

use of org.kuali.kfs.kns.web.ui.Field 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 5 with Field

use of org.kuali.kfs.kns.web.ui.Field in project cu-kfs by CU-CommunityApps.

the class PersonInquirableImpl method buildSeparatorField.

private Field buildSeparatorField(String fieldLabel) {
    Field separatorField = new Field();
    separatorField.setFieldLabel(fieldLabel);
    separatorField.setFieldType(Field.SUB_SECTION_SEPARATOR);
    separatorField.setReadOnly(true);
    return separatorField;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field)

Aggregations

Field (org.kuali.kfs.kns.web.ui.Field)13 Row (org.kuali.kfs.kns.web.ui.Row)10 Section (org.kuali.kfs.kns.web.ui.Section)5 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)2 ArrayList (java.util.ArrayList)2 LinkedHashMap (java.util.LinkedHashMap)2 UserProcurementProfileValidationService (edu.cornell.kfs.sys.service.UserProcurementProfileValidationService)1 Account (org.kuali.kfs.coa.businessobject.Account)1 DataDictionaryService (org.kuali.kfs.datadictionary.legacy.DataDictionaryService)1 DocumentDictionaryService (org.kuali.kfs.datadictionary.legacy.DocumentDictionaryService)1 DocumentAttributeString (org.kuali.kfs.kew.api.document.attribute.DocumentAttributeString)1 WorkflowException (org.kuali.kfs.kew.api.exception.WorkflowException)1 KimAttributeData (org.kuali.kfs.kim.impl.common.attribute.KimAttributeData)1 KimTypeAttribute (org.kuali.kfs.kim.impl.type.KimTypeAttribute)1 DocumentEntry (org.kuali.kfs.kns.datadictionary.DocumentEntry)1 MaintenanceDocumentRestrictions (org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions)1 BusinessObject (org.kuali.kfs.krad.bo.BusinessObject)1 GeneralLedgerPendingEntry (org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry)1 SourceAccountingLine (org.kuali.kfs.sys.businessobject.SourceAccountingLine)1 GeneralLedgerPostingDocument (org.kuali.kfs.sys.document.GeneralLedgerPostingDocument)1