method2testcases
stringlengths
118
3.08k
### Question: ContentRepository { public static Provider getRepositoryProvider(String repositoryOrLogicalWorkspace) { RepositoryManager repositoryManager = Components.getComponent(RepositoryManager.class); if (!repositoryManager.hasRepository(repositoryOrLogicalWorkspace)) { repositoryOrLogicalWorkspace = getMappedRepo...
### Question: AggregationState { protected String stripContextPathIfExists(String uri) { String contextPath = MgnlContext.getContextPath(); if (uri != null && uri.startsWith(contextPath + "/")) { return StringUtils.removeStart(uri, contextPath); } return uri; } void setOriginalURI(String originalURI); void setOriginal...
### Question: MetaData { public String getTitle() { return getStringProperty(TITLE); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); void set...
### Question: MetaData { public void setTitle(String value) { setProperty(TITLE, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); void...
### Question: MetaData { public void setCreationDate() { Calendar value = new GregorianCalendar(TimeZone.getDefault()); setProperty(CREATION_DATE, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCre...
### Question: MetaData { public Calendar getCreationDate() { return this.getDateProperty(CREATION_DATE); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setA...
### Question: MetaData { public void setActivated() { setProperty(ACTIVATED, true); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); void setU...
### Question: MetaData { public void setUnActivated() { setProperty(ACTIVATED, false); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); void s...
### Question: MetaData { public boolean getIsActivated() { return getBooleanProperty(ACTIVATED); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated...
### Question: MetaData { public int getActivationStatus() { if (getIsActivated()) { if (getModificationDate() != null && getModificationDate().after(getLastActionDate())) { return ACTIVATION_STATUS_MODIFIED; } return ACTIVATION_STATUS_ACTIVATED; } return ACTIVATION_STATUS_NOT_ACTIVATED; } protected MetaData(Node worki...
### Question: MetaData { public void setLastActivationActionDate() { Calendar value = new GregorianCalendar(TimeZone.getDefault()); setProperty(LAST_ACTION, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); v...
### Question: MetaData { public Calendar getLastActionDate() { return getDateProperty(LAST_ACTION); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActiva...
### Question: MetaData { public void setModificationDate() { Calendar value = new GregorianCalendar(TimeZone.getDefault()); setProperty(LAST_MODIFIED, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void se...
### Question: MetaData { public String getAuthorId() { return getStringProperty(AUTHOR_ID); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); v...
### Question: MetaData { public void setAuthorId(String value) { setProperty(AUTHOR_ID, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(...
### Question: MetaData { public String getActivatorId() { return getStringProperty(ACTIVATOR_ID); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivate...
### Question: MetaData { public void setActivatorId(String value) { setProperty(ACTIVATOR_ID, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActi...
### Question: MetaData { public String getTemplate() { return getStringProperty(TEMPLATE); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated(); vo...
### Question: MetaData { public void setTemplate(String value) { setProperty(TEMPLATE, value); } protected MetaData(Node workingNode, AccessManager ignoredAccessManager); MetaData(Node workingNode); String getTitle(); void setTitle(String value); void setCreationDate(); Calendar getCreationDate(); void setActivated()...
### Question: Path { public static boolean isAbsolute(String path) { if (path == null) { return false; } if (path.startsWith("/") || path.startsWith(File.separator)) { return true; } if (path.length() >= 3 && Character.isLetter(path.charAt(0)) && path.charAt(1) == ':') { return true; } return false; } private Path(); ...
### Question: Path { public static String getAbsoluteFileSystemPath(String path) { if (isAbsolute(path)) { return path; } return new File(getAppRootDir(), path).getAbsolutePath(); } private Path(); static String getCacheDirectoryPath(); static File getCacheDirectory(); static String getTempDirectoryPath(); static File...
### Question: VersionedNode extends PropertyAndChildWrappingNodeWrapper implements Version { @Override public Property wrapProperty(Property property) { return new DelegatePropertyWrapper(property) { @Override public String getPath() throws RepositoryException { return VersionedNode.this.getPath() + "/" + getName(); } ...
### Question: BaseVersionManager { protected Session getSession() throws LoginException, RepositoryException { return MgnlContext.getSystemContext().getJCRSession(VersionManager.VERSION_WORKSPACE); } synchronized Version addVersion(Node node); synchronized Version addVersion(final Node node, final Rule rule); abstract...
### Question: ContentTypeFilter extends AbstractMgnlFilter { protected String setupContentTypeAndCharacterEncoding(String extension, HttpServletRequest request, HttpServletResponse response) { final String mimeType = MIMEMapping.getMIMETypeOrDefault(extension); final String characterEncoding = MIMEMapping.getContentEnc...
### Question: WorkspaceMapping { public Repository getRepository(String repositoryId) { Repository repository = repositories.get(repositoryId); if (repository == null) { final String s = "Failed to retrieve repository '" + repositoryId + "'. Your Magnolia instance might not have been initialized properly."; log.warn(s)...
### Question: Ops { public static NodeOperation addProperty(final String name, final Object value) { return new AbstractNodeOperation() { @Override protected Content doExec(Content context, ErrorHandler errorHandler) throws RepositoryException { if (context.hasNodeData(name)) { throw new ItemExistsException(name); } co...
### Question: Ops { public static NodeOperation remove(final String name) { return new AbstractNodeOperation() { @Override protected Content doExec(Content context, ErrorHandler errorHandler) throws RepositoryException { context.delete(name); return context; } }; } static NodeOperation addNode(final String name); stat...
### Question: ContentOps { public static NodeOperation createContent(String name, ItemType type) { return Ops.addNode(name, type); } static NodeOperation createContent(String name, ItemType type); static NodeOperation createPage(String name, String template); static NodeOperation createCollectionNode(String name); sta...
### Question: ContentOps { public static NodeOperation createCollectionNode(String name) { return createContent(name, ItemType.CONTENTNODE); } static NodeOperation createContent(String name, ItemType type); static NodeOperation createPage(String name, String template); static NodeOperation createCollectionNode(String ...
### Question: ContentOps { public static NodeOperation setNodeData(final String name, final Object value) { return new AbstractNodeOperation() { @Override protected Content doExec(Content context, ErrorHandler errorHandler) throws RepositoryException { context.setNodeData(name, value); return context; } }; } static No...
### Question: ContentOps { public static NodeOperation setBinaryNodeData(final String name, final String fileName, final long size, final InputStream inputStream) { return new AbstractNodeOperation() { @Override protected Content doExec(Content context, ErrorHandler errorHandler) throws RepositoryException { NodeData b...
### Question: SimpleContext extends AbstractMapBasedContext { @Override public Session getJCRSession(String workspaceName) throws LoginException, RepositoryException { return this.ctx.getJCRSession(workspaceName); } SimpleContext(); SimpleContext(Map<String, Object> map); @Override AccessManager getAccessManager(Strin...
### Question: DefaultRepositoryStrategy extends AbstractRepositoryStrategy { protected Credentials getCredentials() { User user = MgnlContext.getUser(); if (user == null) { String user1 = SystemProperty.getProperty("magnolia.connection.jcr.anonymous.userId", "anonymous"); String pwd = SystemProperty.getProperty("magnol...
### Question: AbstractRepositoryStrategy implements JCRSessionStrategy { @Override public Session getSession(String workspaceName) throws LoginException, RepositoryException { Session jcrSession = jcrSessions.get(workspaceName); if (jcrSession == null) { log.debug("creating jcr session {} by thread {}", workspaceName, ...
### Question: MetaDataImportPostProcessor implements ImportPostProcessor { @Override public void postProcessNode(Node node) throws RepositoryException { MetaDataAsMixinConversionHelper conversionHelper = new MetaDataAsMixinConversionHelper(); conversionHelper.setDeleteMetaDataIfEmptied(true); conversionHelper.setPeriod...
### Question: BootstrapUtil { public static String getWorkspaceNameFromResource(final String resourcePath) { String resourceName = StringUtils.replace(resourcePath, "\\", "/"); String name = getFilenameFromResource(resourceName, ".xml"); String fullPath = DataTransporter.revertExportPath(name); return StringUtils.subst...
### Question: BootstrapUtil { public static String getPathnameFromResource(final String resourcePath) { String resourceName = StringUtils.replace(resourcePath, "\\", "/"); String name = getFilenameFromResource(resourceName, ".xml"); String fullPath = DataTransporter.revertExportPath(name); String pathName = StringUtils...
### Question: BootstrapUtil { public static String getFullpathFromResource(final String resourcePath) { String resourceName = StringUtils.replace(resourcePath, "\\", "/"); String name = getFilenameFromResource(resourceName, ".xml"); String fullPath = DataTransporter.revertExportPath(name); String repository = StringUti...
### Question: BootstrapUtil { public static String getFilenameFromResource(final String resourcePath, final String extension) { String ext = StringUtils.defaultIfEmpty(extension, ".xml"); String tmpResourcePath = resourcePath; if(resourcePath.contains("/")) { tmpResourcePath = StringUtils.substringAfterLast(resourcePat...
### Question: DataTransporter { public static String createExportPath(String path) { String newPath = path.replace(".", ".."); newPath = newPath.replace("/", "."); return newPath; } static synchronized void importDocument(Document xmlDocument, String repositoryName, String basepath, ...
### Question: ModuleBootstrapTask extends BootstrapResourcesTask { @Override protected boolean acceptResource(InstallContext ctx, String resourceName) { final String moduleName = ctx.getCurrentModuleDefinition().getName(); return resourceName.startsWith("/mgnl-bootstrap/" + moduleName + "/") && resourceName.endsWith("....
### Question: TextFileConditionsUtil { public void addFalseConditionIfExpressionIsContained(String fileName, String regExp) { List<String> matches = TextFileUtil.getTrimmedLinesMatching(fileName, regExp); if (matches.size() > 0) { conditions.add(new FalseCondition("Invalid entries", "The file '" + fileName + "' contain...
### Question: TextFileConditionsUtil { public void addFalseConditionIfExpressionIsNotContained(String fileName, String regExp) { List<String> matches = TextFileUtil.getTrimmedLinesMatching(fileName, regExp); if (matches.isEmpty()) { conditions.add(new FalseCondition("Missing required entries.", "The file '" + fileName ...
### Question: WorkspaceXmlConditionsUtil { public void paramAnalyzerIsNotSet() { List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='analyzer']/@value"); if (names.size() > 0) { for (int i = 0; i < names.size(); i++) { conditions.add(new WarnCondition("workspace.xml upda...
### Question: WorkspaceXmlConditionsUtil { public void textFilterClassesAreNotSet() { List<String> names = WorkspaceXmlUtil.getWorkspaceNamesMatching("/Workspace/SearchIndex/param[@name='textFilterClasses']/@value"); if (names.size() > 0) { for (int i = 0; i < names.size(); i++) { conditions.add(new FalseCondition("wor...
### Question: WorkspaceXmlConditionsUtil { public void accessControlProviderIsSet() { List<String> names = WorkspaceXmlUtil.getWorkspaceNames("/Workspace/WorkspaceSecurity/AccessControlProvider/@class", null); if (names.size() > 0) { for (int i = 0; i < names.size(); i++) { conditions.add(new FalseCondition("workspace....
### Question: PropertyValuesTask extends AbstractTask { protected void newProperty(InstallContext ctx, Content node, String propertyName, String value) throws RepositoryException { newProperty(ctx, node, propertyName, value, true); } PropertyValuesTask(String name, String description); }### Answer: @Test public void ...
### Question: PartialBootstrapTask extends AbstractTask { protected String getOutputResourceName(final String resource, final String itemPath) { String inputResourceName = BootstrapUtil.getFilenameFromResource(resource, ".xml"); String tmpitemPath = itemPath.replace("/", "."); tmpitemPath = StringUtils.removeStart(tmpi...
### Question: ModuleManagerWebUI implements ModuleManagerUI { protected void performInstallOrUpdate() { final Runnable runnable = new Runnable() { @Override public void run() { try { moduleManager.performInstallOrUpdate(); } catch (Throwable e) { log.error("Could not perform installation: " + e.getMessage(), e); module...
### Question: ModuleLifecycleContextImpl implements ModuleLifecycleContext { @Override public void registerModuleObservingComponent(String nodeName, ObservedManager component) { if (components.containsKey(nodeName)) { final Object currentObservedManager = components.get(nodeName); throw new IllegalStateException("Obser...
### Question: AbstractModuleVersionHandler implements ModuleVersionHandler { protected void register(Delta delta) { final Version v = delta.getVersion(); if (allDeltas.containsKey(v)) { throw new IllegalStateException("Version " + v + " was already registered in this ModuleVersionHandler."); } delta.getTasks().addAll(g...
### Question: ModuleRegistryImpl implements ModuleRegistry { @Override public List<ModuleDefinition> getModuleDefinitions() { final List<ModuleDefinition> defs = new ArrayList<ModuleDefinition>(); for (ModuleEntry mod : entries.values()) { defs.add(mod.moduleDefinition); } return Collections.unmodifiableList(defs); } M...
### Question: RenameACLNodesTask extends AbstractRepositoryTask { public RenameACLNodesTask() { super("Security", "Renames ACL nodes."); } RenameACLNodesTask(); }### Answer: @Test public void testRenameACLNodesTask() throws Exception { Session session = MgnlContext.getSystemContext().getJCRSession(RepositoryConstants...
### Question: BasePatternVoter extends AbstractBoolVoter { public void init() { if(autoTrueValue){ if(!isInverse()){ setTrueValue(pattern.length()); } else{ setTrueValue(-pattern.length()); } } } void init(); @Override void setTrueValue(int positiveVoteValue); String getPattern(); void setPattern(String pattern); bool...
### Question: ResponseContentTypeVoter extends AbstractBoolVoter { public void addAllowed(String contentType) { allowed.add(contentType); } List<String> getAllowed(); void setAllowed(List<String> allowed); void addAllowed(String contentType); List<String> getRejected(); void setRejected(List<String> rejected); void ad...
### Question: ResponseContentTypeVoter extends AbstractBoolVoter { public void addRejected(String contentType) { rejected.add(contentType); } List<String> getAllowed(); void setAllowed(List<String> allowed); void addAllowed(String contentType); List<String> getRejected(); void setRejected(List<String> rejected); void ...
### Question: URIPatternVoter extends BasePatternVoter { @Override public void setPattern(String pattern) { super.setPattern(pattern); this.pattern = new SimpleUrlPattern(pattern); } @Override void setPattern(String pattern); }### Answer: @Test public void testVotesTrueOnMatchingWildcardPattern() { URIPatternVoter vo...
### Question: FreemarkerHelper { public void render(String templatePath, Object root, Writer out) throws TemplateException, IOException { render(templatePath, null, null, root, out); } FreemarkerHelper(); FreemarkerHelper(final FreemarkerConfig freemarkerConfig); static FreemarkerHelper getInstance(); void resetObject...
### Question: EmailNotificationSender implements NotificationSender { @Override public NotificationMedium getNotificationMedium() { return EMAIL; } @Override NotificationMedium getNotificationMedium(); @Override ServiceResult<Notification> sendNotification(Notification notification); @Override @Transactional(propagati...
### Question: InterviewApplicationFeedbackServiceImpl implements InterviewApplicationFeedbackService { @Override @Transactional(readOnly = true) public ServiceResult<FileEntryResource> findFeedback(long applicationId) { return findAssignmentByApplicationId(applicationId).andOnSuccess(interviewAssignment -> ofNullable(i...
### Question: InterviewApplicationFeedbackServiceImpl implements InterviewApplicationFeedbackService { @Override @Transactional(readOnly = true) public ServiceResult<FileAndContents> downloadFeedback(long applicationId) { return findAssignmentByApplicationId(applicationId).andOnSuccess(interviewAssignment -> fileEntryS...
### Question: InterviewAllocationServiceImpl implements InterviewAllocationService { @Override public ServiceResult<List<Long>> getUnallocatedApplicationIds(long competitionId, long assessorId) { return serviceSuccess(interviewRepository.findApplicationIdsNotAssignedToAssessor(competitionId, assessorId)); } @Override ...
### Question: InterviewAllocationServiceImpl implements InterviewAllocationService { @Override public ServiceResult<List<InterviewApplicationResource>> getUnallocatedApplicationsById(List<Long> applicationIds) { return serviceSuccess(interviewRepository.findAllNotified(applicationIds)); } @Override ServiceResult<Inter...
### Question: InterviewResponseServiceImpl implements InterviewResponseService { @Override @Transactional(readOnly = true) public ServiceResult<FileEntryResource> findResponse(long applicationId) { return findAssignmentByApplicationId(applicationId).andOnSuccess(interviewAssignment -> ofNullable(interviewAssignment.get...
### Question: InterviewResponseServiceImpl implements InterviewResponseService { @Override @Transactional(readOnly = true) public ServiceResult<FileAndContents> downloadResponse(long applicationId) { return findAssignmentByApplicationId(applicationId).andOnSuccess(interviewAssignment -> fileEntryService.findOne(intervi...
### Question: InterviewResponseServiceImpl implements InterviewResponseService { @Override public ServiceResult<Void> deleteResponse(long applicationId) { return findAssignmentByApplicationId(applicationId).andOnSuccessReturnVoid(interviewAssignment -> interviewAssignmentWorkflowHandler.withdrawResponse(interviewAssign...
### Question: InterviewAssignmentServiceImpl implements InterviewAssignmentService { @Override @Transactional(readOnly = true) public ServiceResult<List<Long>> getAvailableApplicationIds(long competitionId) { return serviceSuccess( simpleMap( applicationRepository.findSubmittedApplicationsNotOnInterviewPanel(competitio...
### Question: InterviewAssignmentServiceImpl implements InterviewAssignmentService { @Override public ServiceResult<Void> unstageApplication(long applicationId) { interviewAssignmentRepository.deleteByTargetIdAndActivityState(applicationId, CREATED); return serviceSuccess(); } @Override @Transactional(readOnly = true)...
### Question: InterviewAssignmentServiceImpl implements InterviewAssignmentService { @Override public ServiceResult<Void> unstageApplications(long competitionId) { interviewAssignmentRepository.deleteByTargetCompetitionIdAndActivityState(competitionId, CREATED); return serviceSuccess(); } @Override @Transactional(read...
### Question: InterviewAssignmentServiceImpl implements InterviewAssignmentService { @Override @Transactional(readOnly = true) public ServiceResult<Boolean> isApplicationAssigned(long applicationId) { return serviceSuccess(interviewAssignmentRepository.existsByTargetIdAndActivityStateIn(applicationId, asList(AWAITING_F...
### Question: InterviewApplicationInviteServiceImpl implements InterviewApplicationInviteService { @Override public ServiceResult<ApplicantInterviewInviteResource> getEmailTemplate() { NotificationTarget notificationTarget = new UserNotificationTarget("", ""); return renderer.renderTemplate(systemNotificationSource, no...
### Question: InterviewApplicationInviteServiceImpl implements InterviewApplicationInviteService { @Override public ServiceResult<InterviewApplicationSentInviteResource> getSentInvite(long applicationId) { InterviewAssignment assignment = interviewAssignmentRepository.findOneByTargetId(applicationId); return ofNullable...
### Question: CompetitionSetupInnovationLeadController { @GetMapping("/{competitionId}/innovation-leads") public RestResult<List<UserResource>> findAvailableInnovationLeadsNotAssignedToCompetition(@PathVariable("competitionId") final long competitionId) { return competitionSetupInnovationLeadService.findInnovationLeads...
### Question: CompetitionSetupInnovationLeadController { @GetMapping("/{competitionId}/innovation-leads/find-added") public RestResult<List<UserResource>> findInnovationLeadsAddedToCompetition(@PathVariable("competitionId") final long competitionId) { return competitionSetupInnovationLeadService.findAddedInnovationLead...
### Question: CompetitionSetupInnovationLeadController { @PostMapping("/{competitionId}/add-innovation-lead/{innovationLeadUserId}") public RestResult<Void> addInnovationLead(@PathVariable("competitionId") final long competitionId, @PathVariable("innovationLeadUserId") final long innovationLeadUserId) { return competit...
### Question: CompetitionSetupInnovationLeadController { @PostMapping("/{competitionId}/remove-innovation-lead/{innovationLeadUserId}") public RestResult<Void> removeInnovationLead(@PathVariable("competitionId") final long competitionId, @PathVariable("innovationLeadUserId") final long innovationLeadUserId) { return co...
### Question: CompetitionSetupPostAwardServiceController { @PostMapping("/{competitionId}/post-award-service/{postAwardService}") public RestResult<Void> configurePostAwardService(@PathVariable("competitionId") final long competitionId, @PathVariable("postAwardService") final PostAwardService postAwardService) { return...
### Question: CompetitionSetupFinanceServiceImpl extends BaseTransactionalService implements CompetitionSetupFinanceService { @Override @Transactional public ServiceResult<Void> save(CompetitionSetupFinanceResource compSetupFinanceRes) { return getCompetition(compSetupFinanceRes.getCompetitionId()).andOnSuccess...
### Question: CompetitionSetupStakeholderServiceImpl extends BaseTransactionalService implements CompetitionSetupStakeholderService { @Override @Transactional public ServiceResult<Void> removeStakeholder(long competitionId, long stakeholderUserId) { stakeholderRepository.deleteStakeholder(competitionId, stakeholderUser...
### Question: EmailAddressResolver { public static EmailAddress fromNotificationTarget(NotificationTarget notificationTarget) { return new EmailAddress(notificationTarget.getEmailAddress(), notificationTarget.getName()); } private EmailAddressResolver(); static EmailAddress fromNotificationSource(NotificationSource no...
### Question: AssessorCountOptionServiceImpl extends BaseTransactionalService implements AssessorCountOptionService { @Override public ServiceResult<List<AssessorCountOptionResource>> findAllByCompetitionType(Long competitionTypeId) { return serviceSuccess(simpleMap(assessorCountOptionRepository.findByCompetitionTypeId...
### Question: ProfileController { @GetMapping("/id/{userId}/get-profile-skills") public RestResult<ProfileSkillsResource> getProfileSkills(@PathVariable("userId") long userId) { return profileService.getProfileSkills(userId).toGetResponse(); } @GetMapping("/id/{userId}/get-profile-skills") RestResult<ProfileSkillsReso...
### Question: ProfileController { @GetMapping("/id/{userId}/get-profile-agreement") public RestResult<ProfileAgreementResource> getProfileAgreement(@PathVariable("userId") long userId) { return profileService.getProfileAgreement(userId).toGetResponse(); } @GetMapping("/id/{userId}/get-profile-skills") RestResult<Profi...
### Question: ProfileController { @PutMapping("/id/{userId}/update-profile-agreement") public RestResult<Void> updateProfileAgreement(@PathVariable("userId") long userId) { return profileService.updateProfileAgreement(userId).toPutResponse(); } @GetMapping("/id/{userId}/get-profile-skills") RestResult<ProfileSkillsRes...
### Question: ProfileController { @GetMapping("/id/{userId}/get-user-profile") public RestResult<UserProfileResource> getUserProfile(@PathVariable("userId") Long userId) { return profileService.getUserProfile(userId).toGetResponse(); } @GetMapping("/id/{userId}/get-profile-skills") RestResult<ProfileSkillsResource> ge...
### Question: ProfileController { @PutMapping("/id/{userId}/update-user-profile") public RestResult<Void> updateUserProfile(@PathVariable("userId") Long userId, @RequestBody UserProfileResource profileDetails) { return profileService.updateUserProfile(userId, profileDetails).toPutResponse(); } @GetMapping("/id/{userId...
### Question: ProfileController { @GetMapping("/id/{userId}/profile-status") public RestResult<UserProfileStatusResource> getUserProfileStatus(@PathVariable("userId") Long userId) { return profileService.getUserProfileStatus(userId).toGetResponse(); } @GetMapping("/id/{userId}/get-profile-skills") RestResult<ProfileSk...
### Question: Profile extends AuditableEntity { public void addInnovationAreas(Set<InnovationArea> innovationAreas) { innovationAreas.forEach(this::addInnovationArea); } Profile(); void signAgreement(Agreement agreement, ZonedDateTime signedDate); Long getId(); void setId(Long id); Address getAddress(); void setAddress...
### Question: RestGrantEndpoint implements GrantEndpoint { @Override public ServiceResult<Void> send(Grant grant) { List<Grant> grantAsList = singletonList(grant); Either<ResponseEntity<Void>, ResponseEntity<JsonNode>> response = adaptor.restPostWithEntity(silRestServiceUrl + path, grantAsList, JsonNode.class, Void.cla...
### Question: RestSilCrmEndpoint implements SilCrmEndpoint { @Override public ServiceResult<Void> updateContact(SilContact silContact) { return handlingErrors(() -> { final Either<ResponseEntity<SilCrmError>, ResponseEntity<Void>> response = adaptor.restPostWithEntity(silRestServiceUrl + silCrmContacts, silContact, Voi...
### Question: SpendProfileCostFilter { public List<FinanceCostTotalResource> filterBySpendProfile(List<FinanceCostTotalResource> financeCostTotalResources) { return simpleFilter( financeCostTotalResources, financeResource -> financeResource.getFinanceRowType().isIncludedInSpendProfile() ); } List<FinanceCostTotalResou...
### Question: AllFinanceTotalsSenderImpl implements AllFinanceTotalsSender { @Override @Transactional(readOnly = true) public ServiceResult<Void> sendAllFinanceTotals() { LOG.debug("Initiating sendAllFinanceTotals."); try (Stream<Application> applications = submittedApplicationsStream()) { applications.forEach(applicat...
### Question: AsyncRestCostTotalEndpoint { public ServiceResult<Void> sendCostTotals(Long applicationId, List<FinanceCostTotalResource> financeCostTotalResources) { sendCostTotalsCompletable(applicationId, financeCostTotalResources); return ServiceResult.serviceSuccess(); } @Autowired AsyncRestCostTotalEndpoint( ...
### Question: ApplicationFinanceRowController { @PostMapping public RestResult<FinanceRowItem> create(@RequestBody final FinanceRowItem financeRowItem) { return applicationFinanceRowService.create(financeRowItem.getTargetId(), financeRowItem).toPostCreateResponse(); } @GetMapping("/{id}") RestResult<FinanceRowItem> ge...
### Question: ApplicationFinanceRowController { @DeleteMapping("/{id}") public RestResult<Void> delete(@PathVariable final long id) { return applicationFinanceRowService.delete(id).toDeleteResponse(); } @GetMapping("/{id}") RestResult<FinanceRowItem> get(@PathVariable final long id); @PostMapping RestResult<FinanceRow...
### Question: ProjectFinanceRowController { @DeleteMapping("/{id}") public RestResult<Void> delete(@PathVariable final long id) { return projectFinanceRowService.delete(id).toDeleteResponse(); } @PostMapping RestResult<FinanceRowItem> addWithResponse(@RequestBody final FinanceRowItem financeRowItem); @GetMapping("/{id...
### Question: GrantClaimMaximumController { @GetMapping("/{id}") public RestResult<GrantClaimMaximumResource> getGrantClaimMaximumById(@PathVariable("id") final long id) { return grantClaimMaximumService.getGrantClaimMaximumById(id).toGetResponse(); } GrantClaimMaximumController(GrantClaimMaximumService grantClaimMaxim...
### Question: GrantClaimMaximumController { @GetMapping("/maximum-funding-level-overridden/{competitionId}") public RestResult<Boolean> isMaximumFundingLevelOverridden(@PathVariable("competitionId") final long competitionId) { return grantClaimMaximumService.isMaximumFundingLevelOverridden(competitionId).toGetResponse(...
### Question: CostTotalMaintenanceController { @PutMapping("/send-all") public RestResult<Void> sendAll() { return allFinanceTotalsSender.sendAllFinanceTotals().toPutResponse(); } @PutMapping("/send-all") RestResult<Void> sendAll(); }### Answer: @Test public void sendAll() throws Exception { when(allFinanceTotalsSend...
### Question: ProjectFinanceHandlerImpl implements ProjectFinanceHandler { @Override @Transactional public BigDecimal getResearchParticipationPercentageFromProject(long projectId){ List<ProjectFinanceResource> applicationFinanceResources = this.getFinanceChecksTotals(projectId); BigDecimal totalCosts = applicationFinan...