Search in sources :

Example 1 with ReflectionToStringBuilder

use of org.apache.commons.lang.builder.ReflectionToStringBuilder in project cu-kfs by CU-CommunityApps.

the class PayeeACHAccount method toString.

/**
 * KFSCNTRB-1682: Some of the fields contain confidential information
 *
 * @see org.kuali.rice.krad.bo.BusinessObjectBase#toString()
 */
@Override
public String toString() {
    class PayeeACHAccountToStringBuilder extends ReflectionToStringBuilder {

        private PayeeACHAccountToStringBuilder(Object object) {
            super(object);
        }

        @Override
        public boolean accept(Field field) {
            if (BusinessObject.class.isAssignableFrom(field.getType())) {
                return false;
            }
            DataDictionaryService dataDictionaryService = SpringContext.getBean(DataDictionaryService.class);
            AttributeSecurity attributeSecurity = dataDictionaryService.getAttributeSecurity(PayeeACHAccount.class.getName(), field.getName());
            if ((ObjectUtils.isNotNull(attributeSecurity) && (attributeSecurity.isHide() || attributeSecurity.isMask() || attributeSecurity.isPartialMask()))) {
                return false;
            }
            return super.accept(field);
        }
    }
    ;
    ReflectionToStringBuilder toStringBuilder = new PayeeACHAccountToStringBuilder(this);
    return toStringBuilder.toString();
}
Also used : Field(java.lang.reflect.Field) BusinessObject(org.kuali.rice.krad.bo.BusinessObject) ReflectionToStringBuilder(org.apache.commons.lang.builder.ReflectionToStringBuilder) DataDictionaryService(org.kuali.kfs.krad.service.DataDictionaryService) AttributeSecurity(org.kuali.kfs.krad.datadictionary.AttributeSecurity)

Aggregations

Field (java.lang.reflect.Field)1 ReflectionToStringBuilder (org.apache.commons.lang.builder.ReflectionToStringBuilder)1 AttributeSecurity (org.kuali.kfs.krad.datadictionary.AttributeSecurity)1 DataDictionaryService (org.kuali.kfs.krad.service.DataDictionaryService)1 BusinessObject (org.kuali.rice.krad.bo.BusinessObject)1