method2testcases
stringlengths
118
6.63k
### Question: BankDetailsPermissionRules extends BasePermissionRules { @PermissionRule( value = "UPDATE", description = "Project finance users can update any organisations bank details") public boolean projectFinanceUsersCanUpdateAnyOrganisationsBankDetails(BankDetailsResource bankDetailsResource, UserResource user) { ...
### Question: CompetitionsBankDetailsController { @GetMapping("/pending-bank-details-approvals") public RestResult<List<BankDetailsReviewResource>> getPendingBankDetailsApprovals() { return bankDetailsService.getPendingBankDetailsApprovals().toGetResponse(); } @GetMapping("/pending-bank-details-approvals") RestResult<...
### Question: CompetitionsBankDetailsController { @GetMapping("/count-pending-bank-details-approvals") public RestResult<Long> countPendingBankDetailsApprovals() { return bankDetailsService.countPendingBankDetailsApprovals().toGetResponse(); } @GetMapping("/pending-bank-details-approvals") RestResult<List<BankDetailsR...
### Question: BankDetailsServiceImpl implements BankDetailsService { @Override public ServiceResult<BankDetailsResource> getByProjectAndOrganisation(Long projectId, Long organisationId) { return find(bankDetailsRepository.findByProjectIdAndOrganisationId(projectId, organisationId), new Error(BANK_DETAILS_DONT_EXIST_FOR...
### Question: BankDetailsServiceImpl implements BankDetailsService { @Override @Transactional public ServiceResult<Void> updateBankDetails(ProjectOrganisationCompositeId projectOrganisationCompositeId, BankDetailsResource bankDetailsResource) { Address address = toExperianAddressFormat(bankDetailsResource.getAddress())...
### Question: BankDetailsServiceImpl implements BankDetailsService { @Override public ServiceResult<ProjectBankDetailsStatusSummary> getProjectBankDetailsStatusSummary(Long projectId) { Project project = projectRepository.findById(projectId).get(); ProcessRole leadProcessRole = project.getApplication().getLeadApplicant...
### Question: BankDetailsServiceImpl implements BankDetailsService { @Override public ServiceResult<List<BankDetailsReviewResource>> getPendingBankDetailsApprovals() { List<BankDetailsReviewResource> pendingBankDetails = bankDetailsRepository.getPendingBankDetailsApprovalsForProjectStateNotIn(asList(WITHDRAWN, HANDLED_...
### Question: BankDetailsServiceImpl implements BankDetailsService { @Override public ServiceResult<Long> countPendingBankDetailsApprovals() { Long countBankDetails = bankDetailsRepository.countPendingBankDetailsApprovalsForProjectStateNotIn(asList(WITHDRAWN, HANDLED_OFFLINE, COMPLETED_OFFLINE)); return serviceSuccess(...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override @Transactional public ServiceResult<FileEntryResource> createSignedGrantOfferLetterFileEntry(Long projectId, FileEntryResource fileEntryResource, Supplier<InputStream> inputStreamSupplier) { return ...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override @Transactional public ServiceResult<FileEntryResource> createGrantOfferLetterFileEntry(Long projectId, FileEntryResource fileEntryResource, Supplier<InputStream> inputStreamSupplier) { return getPro...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override @Transactional public ServiceResult<FileEntryResource> createAdditionalContractFileEntry(Long projectId, FileEntryResource fileEntryResource, Supplier<InputStream> inputStreamSupplier) { return getP...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> getAdditionalContractFileEntryDetails(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getAdditionalCont...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> getGrantOfferLetterFileEntryDetails(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getGrantOfferLetter...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileEntryResource> getSignedGrantOfferLetterFileEntryDetails(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getSignedGran...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileAndContents> getAdditionalContractFileAndContents(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getAdditionalContrac...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileAndContents> getGrantOfferLetterFileAndContents(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getGrantOfferLetter();...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<FileAndContents> getSignedGrantOfferLetterFileAndContents(Long projectId) { return getProject(projectId).andOnSuccess(project -> { FileEntry fileEntry = project.getSignedGrantOf...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override @Transactional public ServiceResult<Void> resetGrantOfferLetter(Long projectId) { Project project = getProject(projectId).getSuccess(); if (project.getGrantOfferLetter() != null) { fileService.delet...
### Question: RoleProfileStatusPermissionRoles { @PermissionRule(value = "RETRIEVE_USER_ROLE_PROFILE", description = "Comp admin, project finance or support can retrieve a users status") public boolean adminsAndSupportCanRetrieveUserRoleProfile(UserResource userToCheck, UserResource user) { return isInternalAdmin(user)...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override public ServiceResult<GrantOfferLetterStateResource> getGrantOfferLetterState(Long projectId) { return getProject(projectId).andOnSuccess( golWorkflowHandler::getExtendedState); } @Override ServiceR...
### Question: GrantOfferLetterServiceImpl extends BaseTransactionalService implements GrantOfferLetterService { @Override @Transactional public ServiceResult<Void> importGrantOfferLetter(long projectId) { return getProject(projectId).andOnSuccess(project -> docusignService.importDocument(project.getSignedGolDocusignDoc...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "A user can see projects that they are partners on") public boolean partnersOnProjectCanView(ProjectResource project, UserResource user) { return project != null && isPartner(project.getId(), user.getId()); ...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Internal users can see project resources") public boolean internalUsersCanViewProjects(final ProjectResource project, final UserResource user) { return isInternal(user); } @PermissionRule(value = "READ", d...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Stakeholders can see project resources") public boolean stakeholdersCanViewProjects(final ProjectResource project, final UserResource user) { return userIsStakeholderInCompetition(project.getCompetition(), ...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Competition finance users can see project resources") public boolean competitionFinanceUsersCanViewProjects(final ProjectResource project, final UserResource user) { return userIsExternalFinanceInCompetitio...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "A monitoring officer can see projects that they are assigned to") public boolean monitoringOfficerOnProjectCanView(final ProjectResource project, final UserResource user) { return project != null && isMonit...
### Question: RoleProfileStatusPermissionRoles { @PermissionRule(value = "RETRIEVE_USER_ROLE_PROFILE", description = "kta can retrieve a users status") public boolean ktaCanRetrieveUserRoleProfile(UserResource userToCheck, UserResource user) { return isKta(user); } @PermissionRule(value = "RETRIEVE_USER_ROLE_PROFILE",...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "ADD_PARTNER", description = "The System Registration user can add a partner to a project") public boolean systemRegistrarCanAddPartnersToProject(final ProjectResource project, final UserResource user) { return isSystemRegistrati...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "VIEW_FINANCE_REVIEWER", description = "Project finance users can view finance reviewer.") public boolean projectFinanceCanViewFinanceReviewer(final ProjectResource project, final UserResource user) { return isProjectFinanceUser(...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "VIEW_FINANCE_REVIEWER", description = "Comp admin users can view finance reviewer.") public boolean compAdminCanViewFinanceReviewer(final ProjectResource project, final UserResource user) { return isCompAdmin(user); } @Permissi...
### Question: ProjectPermissionRules extends BasePermissionRules { @PermissionRule(value = "VIEW_FINANCE_REVIEWER", description = "Support users can view finance reviewer.") public boolean supportCanViewFinanceReviewer(final ProjectResource project, final UserResource user) { return isSupport(user); } @PermissionRule(...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "A partner can see a list of all partner organisations on their project") public boolean partnersOnProjectCanView(final PartnerOrganisationResource partnerOrganisation, final UserResource user) {...
### Question: RoleProfileStatusPermissionRoles { @PermissionRule(value = "RETRIEVE_USER_ROLE_PROFILE", description = "Assessors can retrieve their own status") public boolean usersCanRetrieveTheirOwnUserRoleProfile(UserResource userToCheck, UserResource user) { return userToCheck.equals(user); } @PermissionRule(value ...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Internal users can see partner organisations for any project") public boolean internalUsersCanView(PartnerOrganisationResource partnerOrganisation, UserResource user) { return isInternal(user); ...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Monitoring officers can see partner organisations on a project they are assigned to") public boolean monitoringOfficersUsersCanView(PartnerOrganisationResource partnerOrganisation, UserResource ...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Competition finances users can see partner organisations on projects in competitions they are assigned to") public boolean competitionFinanceUsersCanViewProjects(PartnerOrganisationResource part...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ_PENDING_PARTNER_PROGRESS", description = "Internal users can read partner progress in project setup") public boolean internalUsersCanReadPendingPartnerProgress(final PartnerOrganisationResource partnerOrganisati...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ_PENDING_PARTNER_PROGRESS", description = "Competition finance users can read partner progress in project setup in competitions they are assigned to") public boolean competitionFinanceUsersCanReadPendingPartnerPr...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "UPDATE_PENDING_PARTNER_PROGRESS", description = "Partners can update their own progress when setting up their organisation") public boolean partnersCanUpdateTheirOwnPendingPartnerProgress(final PartnerOrganisationRes...
### Question: PartnerOrganisationPermissionRules extends BasePermissionRules { @PermissionRule(value = "REMOVE_PARTNER_ORGANISATION", description = "Internal users can remove partner organisations for any project") public boolean internalUsersCanRemovePartnerOrganisations(final PartnerOrganisationResource partnerOrgani...
### Question: UserLookupStrategies { @PermissionEntityLookupStrategy public UserResource findById(Long id) { return userMapper.mapIdToResource(id); } @PermissionEntityLookupStrategy UserResource findById(Long id); }### Answer: @Test public void testFindById() { UserResource user = newUserResource().build(); when(user...
### Question: ProjectController { @GetMapping("/{id}") public RestResult<ProjectResource> getProjectById(@PathVariable long id) { return projectService.getProjectById(id).toGetResponse(); } @GetMapping("/{id}") RestResult<ProjectResource> getProjectById(@PathVariable long id); @GetMapping("/application/{applicationId}...
### Question: ProjectController { @GetMapping public RestResult<List<ProjectResource>> findAll() { return projectService.findAll().toGetResponse(); } @GetMapping("/{id}") RestResult<ProjectResource> getProjectById(@PathVariable long id); @GetMapping("/application/{applicationId}") RestResult<ProjectResource> getByAppl...
### Question: ProjectController { @GetMapping("/{projectId}/project-users") public RestResult<List<ProjectUserResource>> getProjectUsers(@PathVariable long projectId) { return projectService.getProjectUsersByProjectIdAndRoleIn(projectId, PROJECT_USER_ROLES.stream().collect(Collectors.toList())).toGetResponse(); } @Get...
### Question: ProjectController { @PostMapping("/create-project/application/{applicationId}") public RestResult<ProjectResource> createProjectFromApplication(@PathVariable long applicationId) { return projectService.createProjectFromApplication(applicationId).toPostWithBodyResponse(); } @GetMapping("/{id}") RestResult...
### Question: ProjectController { @GetMapping("/{projectId}/lead-organisation") public RestResult<OrganisationResource> getLeadOrganisation(@PathVariable long projectId){ return projectService.getLeadOrganisation(projectId).toGetResponse(); } @GetMapping("/{id}") RestResult<ProjectResource> getProjectById(@PathVariabl...
### Question: ProjectController { @GetMapping("/{projectId}/project-finance-contacts") public RestResult<List<ProjectUserResource>> getProjectFinanceContacts(@PathVariable(value = "projectId") Long projectId) { return projectService.getProjectUsersByProjectIdAndRoleIn(projectId, Collections.singletonList(ProjectPartici...
### Question: PartnerOrganisationController { @GetMapping("/partner/{organisationId}") public RestResult<PartnerOrganisationResource> getPartnerOrganisation(@PathVariable long projectId, @PathVariable long organisationId) { return partnerOrganisationService.getPartnerOrganisation(projectId, organisationId).toGetRespons...
### Question: PartnerOrganisationController { @PostMapping("/remove-organisation/{organisationId}") public RestResult<Void> removeOrganisation(@PathVariable long projectId, @PathVariable long organisationId) { return partnerOrganisationService.removePartnerOrganisation(id(projectId, organisationId)).toPostResponse(); }...
### Question: AgreementPermissionRules extends BasePermissionRules { @PermissionRule(value = "READ", description = "Any assessor user can view the current agreement") public boolean anyAssessorCanViewTheCurrentAgreement(UserResource user) { return SecurityRuleUtil.hasAssessorAuthority(user); } @PermissionRule(value = ...
### Question: ProjectServiceImpl extends AbstractProjectServiceImpl implements ProjectService { @Override @Transactional (readOnly = true) public ServiceResult<List<ProjectResource>> findByUserId(long userId) { List<ProjectUser> projectUsers = projectUserRepository.findByUserId(userId); return serviceSuccess(projectUse...
### Question: ProjectServiceImpl extends AbstractProjectServiceImpl implements ProjectService { @Override @Transactional public ServiceResult<ProjectUser> addPartner(long projectId, long userId, long organisationId) { return find(getProject(projectId), getOrganisation(organisationId), getUser(userId)). andOnSuccess((pr...
### Question: ProjectServiceImpl extends AbstractProjectServiceImpl implements ProjectService { @Override public ServiceResult<Boolean> existsOnApplication(long projectId, long organisationId) { return getProject(projectId).andOnSuccessReturn(p -> p.getApplication().getApplicantProcessRoles().stream() .anyMatch(pr -> p...
### Question: ProjectServiceImpl extends AbstractProjectServiceImpl implements ProjectService { @Override public ServiceResult<OrganisationResource> getLeadOrganisation(long projectId) { return getProject(projectId) .andOnSuccessReturn(p -> p.getApplication().getLeadOrganisationId()) .andOnSuccess(this::getOrganisation...
### Question: PartnerOrganisationServiceImpl implements PartnerOrganisationService { @Override public ServiceResult<PartnerOrganisationResource> getPartnerOrganisation(Long projectId, Long organisationId) { return find(partnerOrganisationRepository.findOneByProjectIdAndOrganisationId(projectId, organisationId), notFoun...
### Question: PartnerOrganisationServiceImpl implements PartnerOrganisationService { @Override public ServiceResult<List<PartnerOrganisationResource>> getProjectPartnerOrganisations(Long projectId) { return find(partnerOrganisationRepository.findByProjectId(projectId), notFoundError(PartnerOrganisation.class)). andOnSu...
### Question: ProjectPartnerChangeServiceImpl extends BaseTransactionalService implements ProjectPartnerChangeService { @Override @Transactional public void updateProjectWhenPartnersChange(long projectId) { rejectProjectDocuments(projectId); resetProjectFinanceEligibility(projectId); } @Override @Transactional void up...
### Question: Project implements ProcessActivity { public List<Organisation> getOrganisations(){ return simpleMap(partnerOrganisations, PartnerOrganisation::getOrganisation); } Project(); Project(Application application, LocalDate targetStartDate, Address address, Long durationInMonths, String name,...
### Question: Project implements ProcessActivity { public List<ProjectUser> getProjectUsers() { return projectUsers; } Project(); Project(Application application, LocalDate targetStartDate, Address address, Long durationInMonths, String name, ZonedDateTime documentsSubmittedDate, ApprovalType otherD...
### Question: ProcessRoleController { @GetMapping("{id}/application") public RestResult<ApplicationResource> findByProcessRole(@PathVariable("id") final long id) { return applicationService.findByProcessRole(id).toGetResponse(); } @GetMapping("/{id}") RestResult<ProcessRoleResource> findOne(@PathVariable("id") final l...
### Question: LegacyMonitoringOfficerPermissionRules extends BasePermissionRules { @PermissionRule( value = "ASSIGN_MONITORING_OFFICER", description = "Internal users can assign Monitoring Officers on any Project") public boolean internalUsersCanAssignMonitoringOfficersForAnyProject(ProjectResource project, UserResourc...
### Question: LegacyMonitoringOfficerController { @GetMapping("/{projectId}/monitoring-officer") public RestResult<LegacyMonitoringOfficerResource> getMonitoringOfficer(@PathVariable("projectId") final Long projectId) { return monitoringOfficerService.getMonitoringOfficer(projectId).toGetResponse(); } @GetMapping("/{p...
### Question: RoleProfileStatusController { @GetMapping("/{userId}/role-profile-status") public RestResult<List<RoleProfileStatusResource>> findByUserId(@PathVariable long userId) { return roleProfileStatusService.findByUserId(userId).toGetResponse(); } @GetMapping("/{userId}/role-profile-status/{profileRole}") RestRe...
### Question: LegacyMonitoringOfficerServiceImpl extends AbstractProjectServiceImpl implements LegacyMonitoringOfficerService { @Override public ServiceResult<LegacyMonitoringOfficerResource> getMonitoringOfficer(Long projectId) { return getExistingMonitoringOfficerForProject(projectId).andOnSuccessReturn(legacyMonitor...
### Question: RoleProfileStatusController { @GetMapping("/{userId}/role-profile-status/{profileRole}") public RestResult<RoleProfileStatusResource> findByUserIdAndProfileRole(@PathVariable long userId, @PathVariable final ProfileRole profileRole) { return roleProfileStatusService.findByUserIdAndProfileRole(userId, prof...
### Question: RoleProfileStatusController { @PutMapping("/{userId}/role-profile-status") public RestResult<Void> updateUserStatus(@PathVariable long userId, @RequestBody RoleProfileStatusResource roleProfileStatusResource) { return roleProfileStatusService.updateUserStatus(userId, roleProfileStatusResource).toPutRespon...
### Question: SpendProfileController { @PostMapping("/spend-profile/generate") public RestResult<Void> generateSpendProfile(@PathVariable("projectId") final Long projectId) { return spendProfileService.generateSpendProfile(projectId).toPostCreateResponse(); } @PostMapping("/spend-profile/generate") RestResult<Void> ge...
### Question: SpendProfileController { @DeleteMapping("/spend-profile/reset") public RestResult<Void> deleteSpendProfile(@PathVariable("projectId") final Long projectId) { return spendProfileService.deleteSpendProfile(projectId).toDeleteResponse(); } @PostMapping("/spend-profile/generate") RestResult<Void> generateSpe...
### Question: SpendProfileController { @PostMapping("/partner-organisation/{organisationId}/spend-profile/complete") public RestResult<Void> markSpendProfileComplete(@PathVariable("projectId") final long projectId, @PathVariable("organisationId") final long organisationId) { ProjectOrganisationCompositeId projectOrgani...
### Question: SpendProfileController { @PostMapping("/partner-organisation/{organisationId}/spend-profile/incomplete") public RestResult<Void> markSpendProfileIncomplete(@PathVariable("projectId") final Long projectId, @PathVariable("organisationId") final Long organisationId) { ProjectOrganisationCompositeId projectOr...
### Question: SpendProfileController { @GetMapping("/partner-organisation/{organisationId}/spend-profile-csv") public RestResult<SpendProfileCSVResource> getSpendProfileCSV(@PathVariable("projectId") final Long projectId, @PathVariable("organisationId") final Long organisationId) { ProjectOrganisationCompositeId projec...
### Question: RoleProfileStatusController { @GetMapping("/role-profile-status/{roleProfileState}/{profileRole}") public RestResult<UserPageResource> getByRoleProfileStatus(@PathVariable RoleProfileState roleProfileState, @PathVariable ProfileRole profileRole, @RequestParam(required = false) String filter, @RequestParam...
### Question: SpendProfileController { @GetMapping("/partner-organisation/{organisationId}/spend-profile") public RestResult<SpendProfileResource> getSpendProfile(@PathVariable("projectId") final Long projectId, @PathVariable("organisationId") final Long organisationId) { ProjectOrganisationCompositeId projectOrganisat...
### Question: SpendProfileController { @PostMapping("/partner-organisation/{organisationId}/spend-profile") public RestResult<Void> saveSpendProfile(@PathVariable("projectId") final long projectId, @PathVariable("organisationId") final long organisationId, @RequestBody SpendProfileTableResource table) { ProjectOrganisa...
### Question: SpendProfileController { @PostMapping("/complete-spend-profiles-review") public RestResult<Void> completeSpendProfilesReview(@PathVariable("projectId") final Long projectId) { return spendProfileService.completeSpendProfilesReview(projectId).toPostResponse(); } @PostMapping("/spend-profile/generate") Res...
### Question: SpendProfileValidationUtil { public Optional<ValidationMessages> validateSpendProfileTableResource(SpendProfileTableResource tableResource) { Optional<ValidationMessages> result = Optional.empty(); BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(tableResource, "spendProfileTable");...
### Question: AgreementController { @GetMapping("/find-current") public RestResult<AgreementResource> findCurrent() { return agreementService.getCurrent().toGetResponse(); } @GetMapping("/find-current") RestResult<AgreementResource> findCurrent(); }### Answer: @Test public void findCurrent() throws Exception { String...
### Question: SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService { @Override public ServiceResult<ApprovalType> getSpendProfileStatusByProjectId(Long projectId) { return serviceSuccess(getSpendProfileStatusBy(projectId)); } @Override @Transactional ServiceResult<Void> generateSpend...
### Question: SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService { private ServiceResult<Void> approveSpendProfile(ApprovalType approvalType, Project project) { return getCurrentlyLoggedInUser().andOnSuccess(user -> { if (approvalType.equals(APPROVED)) { if (spendProfileWorkflowHand...
### Question: SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService { @Override @Transactional public ServiceResult<Void> deleteSpendProfile(Long projectId) { List<SpendProfile> spendProfiles = spendProfileRepository.findByProjectId(projectId); Project project = getProject(projectId).g...
### Question: SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService { @Override @Transactional public ServiceResult<Void> markSpendProfileIncomplete(ProjectOrganisationCompositeId projectOrganisationCompositeId) { SpendProfileTableResource table = getSpendProfileTable(projectOrganisati...
### Question: SpendProfileServiceImpl extends BaseTransactionalService implements SpendProfileService { @Override @Transactional public ServiceResult<Void> completeSpendProfilesReview(Long projectId) { return getProject(projectId).andOnSuccess(project -> { if (project.getSpendProfiles().stream().anyMatch(spendProfile -...
### Question: ProjectPartnerInviteServiceImpl extends BaseTransactionalService implements ProjectPartnerInviteService { @Override @Transactional public ServiceResult<Void> invitePartnerOrganisation(long projectId, SendProjectPartnerInviteResource invite) { return find(projectRepository.findById(projectId), notFoundErro...
### Question: ProjectPartnerInviteServiceImpl extends BaseTransactionalService implements ProjectPartnerInviteService { @Override public ServiceResult<List<SentProjectPartnerInviteResource>> getPartnerInvites(long projectId) { return serviceSuccess(projectPartnerInviteRepository.findByProjectId(projectId).stream() .fil...
### Question: ProjectPartnerInviteServiceImpl extends BaseTransactionalService implements ProjectPartnerInviteService { @Override @Transactional public ServiceResult<Void> resendInvite(long inviteId) { return find(projectPartnerInviteRepository.findById(inviteId), notFoundError(ProjectPartnerInvite.class, inviteId)) .a...
### Question: ProjectPartnerInviteServiceImpl extends BaseTransactionalService implements ProjectPartnerInviteService { @Override @Transactional public ServiceResult<Void> deleteInvite(long inviteId) { return find(projectPartnerInviteRepository.findById(inviteId), notFoundError(ProjectPartnerInvite.class, inviteId)) .a...
### Question: ProjectPartnerInviteServiceImpl extends BaseTransactionalService implements ProjectPartnerInviteService { @Override public ServiceResult<SentProjectPartnerInviteResource> getInviteByHash(String hash) { return find(projectPartnerInviteRepository.getByHash(hash), notFoundError(ProjectPartnerInvite.class, ha...
### Question: ApplicationFundingDecisionController { @PostMapping(value="/{competitionId}") public RestResult<Void> saveFundingDecisionData(@PathVariable("competitionId") final Long competitionId, @RequestBody Map<Long, FundingDecision> applicationFundingDecisions) { return applicationFundingService.saveFundingDecision...
### Question: ApplicationNotificationTemplateController { @GetMapping("/successful/{competitionId}") public RestResult<ApplicationNotificationTemplateResource> getSuccessfulNotificationTemplate(@PathVariable("competitionId") long competitionId) { return applicationNotificationTemplateService.getSuccessfulNotificationTe...
### Question: ApplicationNotificationTemplateController { @GetMapping("/unsuccessful/{competitionId}") public RestResult<ApplicationNotificationTemplateResource> getUnsuccessfulNotificationTemplate(@PathVariable("competitionId") long competitionId) { return applicationNotificationTemplateService.getUnsuccessfulNotifica...
### Question: ApplicationNotificationTemplateController { @GetMapping("/ineligible/{competitionId}") public RestResult<ApplicationNotificationTemplateResource> getIneligibleNotificationTemplate(@PathVariable("competitionId") long competitionId) { return applicationNotificationTemplateService.getIneligibleNotificationTe...
### Question: FundingDecisionMapper { public FundingDecisionStatus mapToDomain(FundingDecision source){ return FundingDecisionStatus.valueOf(source.name()); } FundingDecision mapToResource(FundingDecisionStatus source); FundingDecisionStatus mapToDomain(FundingDecision source); }### Answer: @Test public void testConv...
### Question: FundingDecisionMapper { public FundingDecision mapToResource(FundingDecisionStatus source){ return FundingDecision.valueOf(source.name()); } FundingDecision mapToResource(FundingDecisionStatus source); FundingDecisionStatus mapToDomain(FundingDecision source); }### Answer: @Test public void testConvertF...
### Question: ApplicationNotificationTemplateServiceImpl extends BaseTransactionalService implements ApplicationNotificationTemplateService { @Override public ServiceResult<ApplicationNotificationTemplateResource> getSuccessfulNotificationTemplate(long competitionId) { return getCompetition(competitionId).andOnSuccess(...
### Question: ApplicationNotificationTemplateServiceImpl extends BaseTransactionalService implements ApplicationNotificationTemplateService { @Override public ServiceResult<ApplicationNotificationTemplateResource> getUnsuccessfulNotificationTemplate(long competitionId) { return getCompetition(competitionId).andOnSucces...
### Question: ApplicationNotificationTemplateServiceImpl extends BaseTransactionalService implements ApplicationNotificationTemplateService { @Override public ServiceResult<ApplicationNotificationTemplateResource> getIneligibleNotificationTemplate(long competitionId) { return renderTemplate(competitionId, "ineligible_a...
### Question: RestSilEmailEndpoint implements SilEmailEndpoint { @Override public ServiceResult<SilEmailMessage> sendEmail(SilEmailMessage message) { return handlingErrors(() -> { final Either<ResponseEntity<Void>, ResponseEntity<Void>> response = adaptor.restPostWithEntity(silRestServiceUrl + silSendmailPath, message,...
### Question: AffiliationController { @GetMapping("/id/{userId}/get-user-affiliations") public RestResult<AffiliationListResource> getUserAffiliations(@PathVariable("userId") long userId) { return affiliationService.getUserAffiliations(userId).toGetResponse(); } @GetMapping("/id/{userId}/get-user-affiliations") RestRe...
### Question: AffiliationController { @PutMapping("/id/{userId}/update-user-affiliations") public RestResult<Void> updateUserAffiliations(@PathVariable("userId") long userId, @Valid @RequestBody AffiliationListResource affiliations) { return affiliationService.updateUserAffiliations(userId, affiliations).toPutResponse(...
### Question: AffiliationServiceImpl extends BaseTransactionalService implements AffiliationService { @Override public ServiceResult<AffiliationListResource> getUserAffiliations(long userId) { return find(userRepository.findById(userId), notFoundError(User.class, userId)).andOnSuccess(user -> serviceSuccess(new Affilia...