Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2005-2013 The Kuali Foundation Licensed under the Educational Community License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.opensource.org/licenses/ecl2.php Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package org.kuali.rice.kim.lookup;
 
 
 import java.util.List;
 import java.util.Map;

Author(s):
Kuali Rice Team (rice.collab@kuali.org)
 
 
     private static final long serialVersionUID = 1L;
     private transient UiDocumentService uiDocumentService;
     private transient RoleService roleService;
     private transient KimTypeInfoService kimTypeInfoService;
 
     @SuppressWarnings("unchecked")
     protected List<? extends BusinessObjectgetSearchResultsHelper(Map<StringStringfieldValuesboolean unbounded) {
         List<KimDocumentRoleMembersearchResults = new ArrayList<KimDocumentRoleMember>();
         if (roleDocument != null) {
             String memberId = fieldValues.get(..);
             String memberTypeCode = fieldValues.get(..);
             String memberName = fieldValues.get(..);
             String memberNamespaceCode = fieldValues.get(..);
             String activeFromDate = fieldValues.get(..);
             String activeToDate = fieldValues.get(..);
             List<KimDocumentRoleMembercurrentRoleMembers = roleDocument.getMembers();
             if (currentRoleMembers != null && !currentRoleMembers.isEmpty()) {
                 for (KimDocumentRoleMember currentRoleMember : currentRoleMembers) {
                     if ((StringUtils.isEmpty(memberId) || (StringUtils.isNotEmpty(memberId) && memberId.equals(currentRoleMember.getMemberId())))
                             && (StringUtils.isEmpty(memberTypeCode) || (StringUtils.isNotEmpty(memberTypeCode) && memberTypeCode.equals(currentRoleMember.getMemberTypeCode())))
                             && (StringUtils.isEmpty(memberName) || (StringUtils.isNotEmpty(memberName) && memberName.equals(currentRoleMember.getMemberName())))
                             && (StringUtils.isEmpty(memberNamespaceCode) || (StringUtils.isNotEmpty(memberNamespaceCode) && memberNamespaceCode.equals(currentRoleMember.getMemberNamespaceCode())))
                             && (StringUtils.isEmpty(activeFromDate) || (StringUtils.isNotEmpty(activeFromDate) && activeFromDate.equals(currentRoleMember.getActiveFromDate())))
                             && (StringUtils.isEmpty(activeToDate) || (StringUtils.isNotEmpty(activeToDate) && activeToDate.equals(currentRoleMember.getActiveToDate())))) {
                         searchResults.add(currentRoleMember);
                     }
                 }
             }
         } else {
             searchResults = getUiDocumentService().getRoleMembers(fieldValues);
         }
         if (searchResults != null) {
             for (KimDocumentRoleMember roleMember : searchResults) {
                 roleMember.setQualifiersToDisplay(getQualifiersToDisplay(roleMember));
             }
         }
         return searchResults;
     }
 
     public String getQualifiersToDisplay(KimDocumentRoleMember roleMember) {
         if (roleMember != null && StringUtils.isNotEmpty(roleMember.getRoleId()) &&
                 roleMember.getQualifiers() != null && !roleMember.getQualifiers().isEmpty()) {
             Role role = getRoleService().getRole(roleMember.getRoleId());
             KimType kimType = null;
             if (role != null) {
                 kimType = getKimTypeInfoService().getKimType(role.getKimTypeId());
             }
             if (kimType != null) {
                 KimTypeAttributesHelper attributesHelper = new KimTypeAttributesHelper(kimType);
                 StringBuffer attributesToDisplay = new StringBuffer();
                 KimAttributeField attribDefn;
                 for (KimDocumentRoleQualifier attribute : roleMember.getQualifiers()) {
                     if (attribute.getKimAttribute() != null) {
                        attribDefn = attributesHelper.getAttributeDefinition(attribute.getKimAttribute().getAttributeName());
                        attributesToDisplay.append(attribDefn != null ? attribDefn.getAttributeField().getLongLabel() : "");
                        attributesToDisplay.append(..);
                        attributesToDisplay.append(attribute.getAttrVal());
                        attributesToDisplay.append(..);
                    }
                }
                return stripEnd(attributesToDisplay.toString(), ..);
            }
        }
        return "";
    }
    private static String stripEnd(String toStripFromString toStrip){
		String stripped;
		if(toStripFrom==nullreturn null;
		if(toStrip==nullreturn toStripFrom;
        if(toStrip.length() > toStripFrom.length()) return toStripFrom;
		if(toStripFrom.endsWith(toStrip)){
			StringBuffer buffer = new StringBuffer(toStripFrom);
			buffer.delete(buffer.length()-toStrip.length(), buffer.length());
			stripped = buffer.toString();
else stripped = toStripFrom;
		return stripped;
	}
    public RoleService getRoleService() {
        if ( == null) {
             = KimApiServiceLocator.getRoleService();
        }
        return ;
    }
        if ( == null) {
             = KimApiServiceLocator.getKimTypeInfoService();
        }
        return ;
    }
        if ( == null) {
             = KIMServiceLocatorInternal.getUiDocumentService();
        }
        return ;
    }
New to GrepCode? Check out our FAQ X