Search in sources :

Example 6 with Row

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

the class AccountReversionMaintainableImpl method getSections.

/**
 * @see org.kuali.kfs.kns.maintenance.KualiMaintainableImpl#getSections(org.kuali.kfs.kns.document.MaintenanceDocument, org.kuali.kfs.kns.maintenance.Maintainable)
 */
@Override
public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) {
    List<Section> sections = super.getSections(document, oldMaintainable);
    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 7 with Row

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

the class AccountReversionMaintainableImpl method shouldIncludeField.

/**
 * Determines if the given field should be included in the updated row, once we take out inactive categories
 * @param field the field to check
 * @return true if the field should be included (ie, it doesn't describe an organization reversion with an inactive category); false otherwise
 */
protected boolean shouldIncludeField(Field field) {
    boolean includeField = true;
    if (field.getContainerRows() != null) {
        for (Row containerRow : field.getContainerRows()) {
            for (Field containedField : containerRow.getFields()) {
                if (containedField.getPropertyName().matches("accountReversionDetails\\[\\d+\\]\\.reversionCategory\\.reversionCategoryName")) {
                    final String categoryValue = containedField.getPropertyValue();
                    includeField = accountReversionService.isCategoryActiveByName(categoryValue);
                }
            }
        }
    }
    return includeField;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) Row(org.kuali.kfs.kns.web.ui.Row)

Example 8 with Row

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

the class AccountReversionInquirable method shouldIncludeField.

/**
 * Determines if the given field should be included in the updated row, once we take out inactive categories
 * @param field the field to check
 * @return true if the field should be included (ie, it doesn't describe an account reversion with an inactive category); false otherwise
 */
protected boolean shouldIncludeField(Field field) {
    boolean includeField = true;
    if (field.getContainerRows() != null) {
        for (Row containerRow : field.getContainerRows()) {
            for (Field containedField : containerRow.getFields()) {
                if (containedField.getPropertyName().matches("accountReversionDetails\\[\\d+\\]\\.accountReversionCategoryCode")) {
                    final String categoryValue = containedField.getPropertyValue();
                    includeField = accountReversionService.isCategoryActive(categoryValue);
                }
            }
        }
    }
    return includeField;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) Row(org.kuali.kfs.kns.web.ui.Row)

Example 9 with Row

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

the class CuVendorMaintainableImpl method getSections.

/**
 * Overridden to forcibly populate the multi-select procurementMethodsArray KNS field values,
 * and to forcibly hide the procurementMethods field's row.
 *
 * @see org.kuali.kfs.kns.maintenance.KualiMaintainableImpl#getSections(org.kuali.kfs.kns.document.MaintenanceDocument,
 *      org.kuali.kfs.kns.maintenance.Maintainable)
 */
@SuppressWarnings("rawtypes")
@Override
public List getSections(MaintenanceDocument document, Maintainable oldMaintainable) {
    @SuppressWarnings("unchecked") List<Section> sections = super.getSections(document, oldMaintainable);
    MaintenanceDocumentRestrictions restrictions = KNSServiceLocator.getBusinessObjectAuthorizationService().getMaintenanceDocumentRestrictions(document, GlobalVariables.getUserSession().getPerson());
    // Perform the forcible updates on the generated sections.
    boolean doneWithSections = false;
    for (int i = 0; !doneWithSections && i < sections.size(); i++) {
        Section section = sections.get(i);
        if (VENDOR_SECTION_ID.equals(section.getSectionId())) {
            // Find and update the appropriate fields/rows.
            List<Row> rows = section.getRows();
            int fieldsDone = 0;
            for (int j = 0; fieldsDone < 2 && j < rows.size(); j++) {
                List<Field> fields = rows.get(j).getFields();
                for (int k = 0; fieldsDone < 2 && k < fields.size(); k++) {
                    String fieldName = fields.get(k).getPropertyName();
                    if (PROC_METHODS_MULTISELECT_FIELD_NAME.equals(fieldName)) {
                        // Update the property values and security on the multiselect field.
                        setupMultiselectField(document, restrictions, fields.get(k), MULTISELECT_FIELD_PATH_PREFIX + fieldName);
                        fieldsDone++;
                    } else if (PROC_METHODS_FIELD_NAME.equals(fieldName)) {
                        // Hide the row containing the flattened version of the multiselect field.
                        rows.get(j).setHidden(true);
                        fieldsDone++;
                    }
                }
            }
            doneWithSections = true;
        }
    }
    return sections;
}
Also used : MaintenanceDocumentRestrictions(org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions) 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 10 with Row

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

the class FinancialSystemSearchableAttribute method createSearchResultDisplayTypeRow.

protected Row createSearchResultDisplayTypeRow() {
    Field searchField = new Field(DISPLAY_TYPE_SEARCH_ATTRIBUTE_NAME, DISPLAY_TYPE_SEARCH_ATTRIBUTE_LABEL);
    searchField.setFieldType(Field.RADIO);
    searchField.setIndexedForSearch(false);
    searchField.setBusinessObjectClassName("");
    searchField.setFieldHelpName("");
    searchField.setFieldHelpSummary("");
    searchField.setColumnVisible(false);
    searchField.setFieldValidValues(SEARCH_RESULT_TYPE_OPTION_LIST);
    searchField.setPropertyValue(DOCUMENT_DISPLAY_TYPE_VALUE);
    searchField.setDefaultValue(DOCUMENT_DISPLAY_TYPE_VALUE);
    return new Row(Collections.singletonList(searchField));
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) Row(org.kuali.kfs.kns.web.ui.Row)

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