Source:
<code>public Workflow refresh(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow ID", required = true) @PathParam("workflowId") Long workflowId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); <START> checkCanWriteWorkflow(user, workflow); <END> checkNotHosted(workflow); user = userDAO.findById(user.getId()); user.updateUserMetadata(tokenDAO); final SourceCodeRepoInterface sourceCodeRepo = getSourceCodeRepoInterface(workflow.getGitUrl(), user); workflow.setMode(WorkflowMode.FULL); if (!workflow.isIsChecker() && workflow.getDescriptorType().equals(CWL_STRING) || workflow.getDescriptorType().equals(WDL_STRING)) { String workflowName = workflow.getWorkflowName() == null ? "" : workflow.getWorkflowName(); String checkerWorkflowName = "/" + workflowName + (workflow.getDescriptorType().equals(CWL_STRING) ? CWL_CHECKER : WDL_CHECKER); Workflow byPath = workflowDAO.findByPath(workflow.getPath() + checkerWorkflowName, false); if (byPath != null && workflow.getCheckerWorkflow() == null) { workflow.setCheckerWorkflow(byPath); } } final Workflow newWorkflow = sourceCodeRepo.getWorkflow(workflow.getOrganization() + '/' + workflow.getRepository(), Optional.of(workflow)); workflow.getUsers().add(user); updateDBWorkflowWithSourceControlWorkflow(workflow, newWorkflow); FileFormatHelper.updateFileFormats(newWorkflow.getVersions(), fileFormatDAO); if (!workflow.isIsChecker() && workflow.getCheckerWorkflow() != null) { refresh(user, workflow.getCheckerWorkflow().getId()); } elasticManager.handleIndexUpdate(newWorkflow, ElasticMode.UPDATE); return workflow; }</code><technical_language>this a check for a user read? is refresh considered writing</technical_language>

Target:
public Workflow refresh(@ApiParam(hidden = true) @Auth User user, @ApiParam(value = "workflow ID", required = true) @PathParam("workflowId") Long workflowId) { Workflow workflow = workflowDAO.findById(workflowId); checkEntry(workflow); checkUser(user, workflow); checkNotHosted(workflow); user = userDAO.findById(user.getId()); user.updateUserMetadata(tokenDAO); final SourceCodeRepoInterface sourceCodeRepo = getSourceCodeRepoInterface(workflow.getGitUrl(), user); workflow.setMode(WorkflowMode.FULL); if (!workflow.isIsChecker() && workflow.getDescriptorType().equals(CWL_STRING) || workflow.getDescriptorType().equals(WDL_STRING)) { String workflowName = workflow.getWorkflowName() == null ? "" : workflow.getWorkflowName(); String checkerWorkflowName = "/" + workflowName + (workflow.getDescriptorType().equals(CWL_STRING) ? CWL_CHECKER : WDL_CHECKER); Workflow byPath = workflowDAO.findByPath(workflow.getPath() + checkerWorkflowName, false); if (byPath != null && workflow.getCheckerWorkflow() == null) { workflow.setCheckerWorkflow(byPath); } } final Workflow newWorkflow = sourceCodeRepo.getWorkflow(workflow.getOrganization() + '/' + workflow.getRepository(), Optional.of(workflow)); workflow.getUsers().add(user); updateDBWorkflowWithSourceControlWorkflow(workflow, newWorkflow); FileFormatHelper.updateFileFormats(newWorkflow.getVersions(), fileFormatDAO); if (!workflow.isIsChecker() && workflow.getCheckerWorkflow() != null) { refresh(user, workflow.getCheckerWorkflow().getId()); } elasticManager.handleIndexUpdate(newWorkflow, ElasticMode.UPDATE); return workflow; }