Search in sources :

Example 1 with InquiryRestrictions

use of org.kuali.kfs.kns.inquiry.InquiryRestrictions in project cu-kfs by CU-CommunityApps.

the class CuBusinessObjectAuthorizationServiceImpl method getInquiryRestrictions.

@Override
public InquiryRestrictions getInquiryRestrictions(BusinessObject businessObject, Person user) {
    InquiryRestrictions inquiryRestrictions = super.getInquiryRestrictions(businessObject, user);
    if (inquiredObjectIsVendorDetail(businessObject) && shouldHideAttachmentLinkOnVendorInquiry(user)) {
        VendorDetail vendorDetail = (VendorDetail) businessObject;
        List<Note> boNotes = vendorDetail.getBoNotes();
        for (int i = 0; i < boNotes.size(); i++) {
            String attachmentLinkPropertyPath = MessageFormat.format(COLLECTION_ITEM_PROPERTY_PATH_FORMAT, CUKRADPropertyConstants.BO_NOTES, i, CUKRADPropertyConstants.ATTACHMENT_LINK);
            inquiryRestrictions.addHiddenField(attachmentLinkPropertyPath);
        }
    }
    return inquiryRestrictions;
}
Also used : VendorDetail(org.kuali.kfs.vnd.businessobject.VendorDetail) Note(org.kuali.kfs.krad.bo.Note) InquiryRestrictions(org.kuali.kfs.kns.inquiry.InquiryRestrictions)

Example 2 with InquiryRestrictions

use of org.kuali.kfs.kns.inquiry.InquiryRestrictions 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;
}
Also used : InquirySectionDefinition(org.kuali.kfs.kns.datadictionary.InquirySectionDefinition) PersonImpl(org.kuali.kfs.kim.impl.identity.PersonImpl) ArrayList(java.util.ArrayList) InquiryRestrictions(org.kuali.kfs.kns.inquiry.InquiryRestrictions) Row(org.kuali.kfs.kns.web.ui.Row) Section(org.kuali.kfs.kns.web.ui.Section)

Aggregations

InquiryRestrictions (org.kuali.kfs.kns.inquiry.InquiryRestrictions)2 ArrayList (java.util.ArrayList)1 PersonImpl (org.kuali.kfs.kim.impl.identity.PersonImpl)1 InquirySectionDefinition (org.kuali.kfs.kns.datadictionary.InquirySectionDefinition)1 Row (org.kuali.kfs.kns.web.ui.Row)1 Section (org.kuali.kfs.kns.web.ui.Section)1 Note (org.kuali.kfs.krad.bo.Note)1 VendorDetail (org.kuali.kfs.vnd.businessobject.VendorDetail)1