Search in sources :

Example 6 with Section

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

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

the class CuPaymentDetailInquirableTest method buildSection.

private Section buildSection(String title, Row... rows) {
    Section section = new Section();
    section.setSectionTitle(title);
    section.setRows(Arrays.asList(rows));
    return section;
}
Also used : Section(org.kuali.kfs.kns.web.ui.Section)

Example 8 with Section

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

the class CuPaymentDetailInquirableTest method assertSectionWithCountryValueIsConvertedProperly.

private void assertSectionWithCountryValueIsConvertedProperly(String countryPropertyValue) {
    String expectedConvertedCountryValue = getExpectedPostConversionCountryValue(countryPropertyValue);
    Map<String, String> expectedPropertyValues = new HashMap<>();
    expectedPropertyValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_PAYEE_ID, TEST_PAYEE_ID);
    expectedPropertyValues.put(CUPdpPropertyConstants.PAYMENT_COUNTRY, expectedConvertedCountryValue);
    expectedPropertyValues.put(PdpPropertyConstants.PaymentDetail.PAYMENT_PAYEE_NAME, TEST_PAYEE_NAME);
    Section section = buildSectionWithCountryPropertyValue(countryPropertyValue);
    assertSectionIsUpdatedProperly(expectedPropertyValues, section);
}
Also used : HashMap(java.util.HashMap) Section(org.kuali.kfs.kns.web.ui.Section)

Aggregations

Section (org.kuali.kfs.kns.web.ui.Section)8 Field (org.kuali.kfs.kns.web.ui.Field)5 Row (org.kuali.kfs.kns.web.ui.Row)5 AccountReversionService (edu.cornell.kfs.coa.service.AccountReversionService)2 ArrayList (java.util.ArrayList)2 UserProcurementProfileValidationService (edu.cornell.kfs.sys.service.UserProcurementProfileValidationService)1 HashMap (java.util.HashMap)1 MaintenanceDocumentRestrictions (org.kuali.kfs.kns.document.authorization.MaintenanceDocumentRestrictions)1