use of org.kuali.kfs.kns.datadictionary.InquirySectionDefinition in project cu-kfs by CU-CommunityApps.
the class PersonInquirableImpl method getSections.
/**
* Add Role Qualifier Attributes to Roles section of Person Inquiry.
*/
@Override
public List<Section> getSections(BusinessObject businessObject) {
List<Section> sections = new ArrayList<>();
if (getBusinessObjectClass() == null) {
LOG.error("Business object class not set in inquirable.");
throw new RuntimeException("Business object class not set in inquirable.");
}
InquiryRestrictions inquiryRestrictions = KNSServiceLocator.getBusinessObjectAuthorizationService().getInquiryRestrictions(businessObject, GlobalVariables.getUserSession().getPerson());
Collection<InquirySectionDefinition> inquirySections = getBusinessObjectDictionaryService().getInquirySections(getBusinessObjectClass());
for (InquirySectionDefinition inquirySection : inquirySections) {
String sectionId = inquirySection.getId();
if (!inquiryRestrictions.isHiddenSectionId(sectionId)) {
Section section = SectionBridge.toSection(this, inquirySection, businessObject, inquiryRestrictions);
if (StringUtils.equals(sectionId, "rolesSection") || StringUtils.equals(sectionId, "delegationsSection")) {
int memberIndex = 0;
for (Row containerRow : section.getRows()) {
List<Row> containerRows = containerRow.getFields().get(0).getContainerRows();
Row lastRow = containerRows.get(containerRows.size() - 1);
// we want the new fields added before any sub-sections (i.e. container fields)
if (Field.CONTAINER.equals(lastRow.getField(0).getFieldType())) {
containerRows.addAll(containerRows.size() - 1, buildRowsWithQualifierFields(sectionId, (PersonImpl) businessObject, memberIndex));
} else {
containerRows.addAll(buildRowsWithQualifierFields(sectionId, (PersonImpl) businessObject, memberIndex));
}
memberIndex++;
}
}
sections.add(section);
}
}
return sections;
}
Aggregations