Search in sources :

Example 6 with Field

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

the class PersonInquirableImpl method buildQualifierAttributeFieldMap.

private Map<String, Field> buildQualifierAttributeFieldMap(List<KimTypeAttribute> attributeDefinitions) {
    Map<String, Field> fieldsToAdd = new LinkedHashMap<>();
    attributeDefinitions.sort(Comparator.comparing(KimTypeAttribute::getSortCode));
    attributeDefinitions.stream().map(KimTypeAttribute::getKimAttribute).forEach(kimAttribute -> {
        String componentName = kimAttribute.getComponentName();
        String attributeName = kimAttribute.getAttributeName();
        DataDictionaryService dataDictionaryService = getDataDictionaryService();
        Field newField = new Field();
        newField.setFieldLabel(dataDictionaryService.getAttributeLabel(componentName, attributeName));
        newField.setFieldShortLabel(dataDictionaryService.getAttributeShortLabel(componentName, attributeName));
        newField.setPropertyName(attributeName);
        newField.setFieldType(Field.TEXT);
        fieldsToAdd.put(attributeName, newField);
    });
    return fieldsToAdd;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field) DataDictionaryService(org.kuali.kfs.datadictionary.legacy.DataDictionaryService) LinkedHashMap(java.util.LinkedHashMap)

Example 7 with Field

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

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

the class AccountReversionMaintainableImpl method getSections.

/**
 * @see org.kuali.kfs.kns.maintenance.MaintainableImpl#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 9 with Field

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

the class CuPaymentDetailInquirableTest method buildField.

private Field buildField(String propertyName, String propertyValue) {
    Field field = new Field();
    field.setPropertyName(propertyName);
    field.setPropertyValue(propertyValue);
    return field;
}
Also used : Field(org.kuali.kfs.kns.web.ui.Field)

Example 10 with Field

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

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