public CommitFundsActivityInformation( final RegularAcquisitionProcess process, final WorkflowActivity<? extends WorkflowProcess, ? extends ActivityInformation> activity) { super(process, activity); process.takeProcess(); final User user = UserView.getCurrentUser(); Person person = user.getExpenditurePerson(); final AcquisitionRequest acquisitionRequest = process.getAcquisitionRequest(); for (final Financer financer : acquisitionRequest.getFinancersSet()) { if (!financer.isCommitted() && financer.isAccountingEmployee(person)) { final CommitmentNumberBean bean = new CommitmentNumberBean(financer); commitmentNumberBeans.add(bean); if (bean.getCommitmentNumber() == null || bean.getCommitmentNumber().isEmpty()) { final MissionProcess missionProcess = process.getMissionProcess(); if (missionProcess != null) { final MissionFinancer missionFinancer = findMissionFinance(missionProcess, financer); if (missionFinancer != null) { bean.setCommitmentNumber(missionFinancer.getCommitmentNumber()); } } } } } }
private MissionFinancer findMissionFinance( final MissionProcess missionProcess, final Financer financer) { for (final MissionFinancer missionFinancer : missionProcess.getMission().getFinancerSet()) { if (missionFinancer.getUnit() == financer.getUnit()) { return missionFinancer; } } return null; }