private String getFundingSourceNameForType(int sourceType, String sourceCode) { String name = null; if (sourceType == 1) { Sponsor sponsor = getBusinessObjectService().findBySinglePrimaryKey(Sponsor.class, sourceCode); if (sponsor != null) { name = sponsor.getSponsorName(); } } else if (sourceType == 2) { Unit unit = getBusinessObjectService().findBySinglePrimaryKey(Unit.class, sourceCode); if (unit != null) { name = unit.getUnitName(); } } else { name = sourceCode; } return name; }
public String getUnitName() { return unit != null ? unit.getUnitName() : null; }