/** Assigns the lead unit of the proposal to the given principal investigator */ public void assignLeadUnit(ProposalPerson person, String unitNumber) { if (person.containsUnit(unitNumber)) { person.getUnit(unitNumber).setLeadUnit(true); return; } ProposalPersonUnit unit = createProposalPersonUnit(unitNumber, person); unit.setLeadUnit(true); addUnitToPerson(person, unit); }
@Override public void addUnitToPerson(ProposalPerson person, ProposalPersonUnit unit) { if (unit == null) { throw new IllegalArgumentException("Cannot add null units to a ProposalPerson instance"); } if (!person.containsUnit(unit.getUnitNumber())) { unit.setProposalPerson(person); person.addUnit(unit); unit.refreshReferenceObject("unit"); } }