{"action":"created","comment":{"url":"https://api.github.com/repos/ua-eas/kfs/pulls/comments/77925605","id":77925605,"diff_hunk":"@@ -0,0 +1,140 @@\n+package edu.arizona.kfs.gl.batch;\n+\n+import java.io.BufferedReader;\n+import java.io.BufferedWriter;\n+import java.io.File;\n+import java.io.FileFilter;\n+import java.io.FileReader;\n+import java.io.FileWriter;\n+import java.io.IOException;\n+import java.util.Date;\n+\n+import org.apache.commons.io.FileUtils;\n+import org.apache.commons.io.filefilter.SuffixFileFilter;\n+import org.kuali.kfs.gl.batch.BatchSortUtil;\n+import org.kuali.kfs.gl.batch.ScrubberSortComparator;\n+import org.kuali.kfs.sys.batch.AbstractStep;\n+\n+import edu.arizona.kfs.gl.GeneralLedgerConstants;\n+\n+public class BudgetAdjustmentMergeSortStep extends AbstractStep {\n+\tprivate static org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(BudgetAdjustmentMergeSortStep.class);\n+\t\n+\tprotected String batchFileDirectoryName;\n+\t\n+\t@Override\n+\tpublic boolean execute(String jobName, Date jobRunDate) {\n+\t\tString budgetOfficeFileName = batchFileDirectoryName + File.separator + GeneralLedgerConstants.BatchFileSystem.ENTERPRISE_FEED + GeneralLedgerConstants.BatchFileSystem.EXTENSION;\n+\t\tString laborLedgerFileName = batchFileDirectoryName + File.separator + GeneralLedgerConstants.BatchFileSystem.LABOR_GL_ENTRY_FILE + GeneralLedgerConstants.BatchFileSystem.EXTENSION;\n+\t\tString outputFile = batchFileDirectoryName + File.separator + GeneralLedgerConstants.BatchFileSystem.BUDGET_ADJUSTMENT_OUTPUT_FILE + GeneralLedgerConstants.BatchFileSystem.EXTENSION;\n+\t\t\n+\t\t// names of the two .done files that we are checking to see if they exist\n+\t\tString budgetOfficeDoneFileName = GeneralLedgerConstants.BatchFileSystem.ENTERPRISE_FEED + GeneralLedgerConstants.BatchFileSystem.DONE_FILE_EXTENSION;\n+\t\tString laborLedgerDoneFileName = GeneralLedgerConstants.BatchFileSystem.LABOR_GL_ENTRY_FILE + GeneralLedgerConstants.BatchFileSystem.DONE_FILE_EXTENSION;\n+\t\t\n+\t\t// pull out a list of the .done files in the batch file directory\n+\t\tFile directory = new File(batchFileDirectoryName);\n+\t\tFileFilter doneFileFilter = new SuffixFileFilter(GeneralLedgerConstants.BatchFileSystem.DONE_FILE_EXTENSION);\n+\t\tFile[] doneFiles = directory.listFiles(doneFileFilter);\n+\t\t\n+\t\tboolean laborLedgerDoneFileExists = false;\n+\t\tboolean budgetOfficeDoneFileExists = false;\n+\t\t\n+\t\t// check each file in the list to see if \n+\t\t// the files we need to merge exist in the directory\n+\t\tfor (File doneFile : doneFiles) {\n+\t\t\tString fileName = doneFile.getName();\n+\t\t\t\n+\t\t\tif (fileName.equals(laborLedgerDoneFileName)) {\n+\t\t\t\tlaborLedgerDoneFileExists = true;\n+\t\t\t} \n+\t\t\t\n+\t\t\tif (fileName.equals(budgetOfficeDoneFileName)){\n+\t\t\t\tbudgetOfficeDoneFileExists = true;\n+\t\t\t}\n+\t\t}\n+\t\t\n+\t\t// checks to see which files actually exists in the directory\n+\t\t// then pulls the necessary .data files to be processed and put into the output file.\n+\t\tif (laborLedgerDoneFileExists && budgetOfficeDoneFileExists) {\t\n+\t\t\tString mergedFile = batchFileDirectoryName + File.separator + GeneralLedgerConstants.BatchFileSystem.BUDGET_ADJUSTMENT_MERGE_FILE + GeneralLedgerConstants.BatchFileSystem.EXTENSION;\n+\t\t\t\n+\t\t\ttry {\n+\t\t\t\tmergeFiles(laborLedgerFileName, budgetOfficeFileName, mergedFile);\n+\t\t\t} catch (Exception e) {\n+\t\t\t\tLOG.error( \"Exception merging the files\", e );\n+\t\t\t\te.printStackTrace();\n+\t\t\t}\n+\t\t\t\n+\t\t\tBatchSortUtil.sortTextFileWithFields(mergedFile, outputFile, new ScrubberSortComparator());\n+\t\t\t\n+\t\t} else if (laborLedgerDoneFileExists && !budgetOfficeDoneFileExists) {\n+\t\t\t// if only the labor ledger .done file exists, process the Labor Ledger File\t\n+\t\t\tBatchSortUtil.sortTextFileWithFields(laborLedgerFileName, outputFile, new ScrubberSortComparator());\t\t\n+\t\t\t\n+\t\t} else if (budgetOfficeDoneFileExists && !laborLedgerDoneFileExists) {\n+\t\t\t// if only the budget office .done file exists, process the Budget Office File\n+\t\t\tBatchSortUtil.sortTextFileWithFields(budgetOfficeFileName, outputFile, new ScrubberSortComparator());\n+\t\t\t\n+\t\t} else {\n+\t\t\t// if neither .done file exists, produce an empty file then process the file\n+\t\t\tString emptyFileName = batchFileDirectoryName + File.separator + \"temp\" + GeneralLedgerConstants.BatchFileSystem.EXTENSION;\n+\t\t\t\n+\t\t\t// creates the new temp file\n+\t\t\tFile emptyFile = new File(emptyFileName);\n+\t\t\ttry {\n+\t\t\t\temptyFile.createNewFile();\n+\t\t\t} catch (IOException e) {\n+\t\t\t\tLOG.error(\"Error creating the temp file\", e);","path":"kfs-core/src/main/java/edu/arizona/kfs/gl/batch/BudgetAdjustmentMergeSortStep.java","position":88,"original_position":88,"commit_id":"7c4d55d9c4d95e300292da897d4672bf07e6924e","original_commit_id":"7c4d55d9c4d95e300292da897d4672bf07e6924e","user":{"login":"nataliac06","id":5472054,"avatar_url":"https://avatars.githubusercontent.com/u/5472054?v=3","gravatar_id":"","url":"https://api.github.com/users/nataliac06","html_url":"https://github.com/nataliac06","followers_url":"https://api.github.com/users/nataliac06/followers","following_url":"https://api.github.com/users/nataliac06/following{/other_user}","gists_url":"https://api.github.com/users/nataliac06/gists{/gist_id}","starred_url":"https://api.github.com/users/nataliac06/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nataliac06/subscriptions","organizations_url":"https://api.github.com/users/nataliac06/orgs","repos_url":"https://api.github.com/users/nataliac06/repos","events_url":"https://api.github.com/users/nataliac06/events{/privacy}","received_events_url":"https://api.github.com/users/nataliac06/received_events","type":"User","site_admin":false},"body":"Exception is caught and logged but batch job allowed to continue even if the file can't be created, no exception is thrown further the rest of the batch job is not aware something went wrong...\r\nI think we need to return false and stop the job at this point since we can't create a new file.\r\n","created_at":"2016-09-07T23:51:20Z","updated_at":"2016-09-07T23:51:20Z","html_url":"https://github.com/ua-eas/kfs/pull/166#discussion_r77925605","pull_request_url":"https://api.github.com/repos/ua-eas/kfs/pulls/166","_links":{"self":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/comments/77925605"},"html":{"href":"https://github.com/ua-eas/kfs/pull/166#discussion_r77925605"},"pull_request":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/166"}}},"pull_request":{"url":"https://api.github.com/repos/ua-eas/kfs/pulls/166","id":83864796,"html_url":"https://github.com/ua-eas/kfs/pull/166","diff_url":"https://github.com/ua-eas/kfs/pull/166.diff","patch_url":"https://github.com/ua-eas/kfs/pull/166.patch","issue_url":"https://api.github.com/repos/ua-eas/kfs/issues/166","number":166,"state":"open","locked":false,"title":"UAF-2307 MOD-FP0069-03 Cash Transfer of Funds on Interfaced Budget Adjustments","user":{"login":"leahasullivan","id":5092112,"avatar_url":"https://avatars.githubusercontent.com/u/5092112?v=3","gravatar_id":"","url":"https://api.github.com/users/leahasullivan","html_url":"https://github.com/leahasullivan","followers_url":"https://api.github.com/users/leahasullivan/followers","following_url":"https://api.github.com/users/leahasullivan/following{/other_user}","gists_url":"https://api.github.com/users/leahasullivan/gists{/gist_id}","starred_url":"https://api.github.com/users/leahasullivan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leahasullivan/subscriptions","organizations_url":"https://api.github.com/users/leahasullivan/orgs","repos_url":"https://api.github.com/users/leahasullivan/repos","events_url":"https://api.github.com/users/leahasullivan/events{/privacy}","received_events_url":"https://api.github.com/users/leahasullivan/received_events","type":"User","site_admin":false},"body":"Created a new job to create a cash transfer file from incoming budget adjustment transactions.\r\n\r\nCreated the following batch steps:  BudgetAdjustmentMergeSortStep.java, BudgetAdjustmentExtractStep.java, BudgetAdjustmentGenerationStep.java\r\n\r\nCreated the service BudgetAdjustmentCashTransferService.java and BudgetAdjustmentCashTransferServiceImpl.java\r\n\r\nCreated the DAO BudgetAdjustmentTransactionDao.java and BudgetAdjustmentTransactionDaoOjb.java.\r\n\r\nCreated the business object BudgetAdjustmentTransaction.java and Data Dictionary file BudgetAdjustmentTransaction.xml\r\n\r\nUpdated the ojb-gl.xml with the new BudgetAdjustmentTransaction table mappings.  Updated the spring-gl.xml with the new bean definitions for the new job, new steps, DAO, Report Helper, service, etc.  Added new constants to the GeneralLedgerConstants.java file for the parameters and the new file names for the new steps.\r\n\r\nThis was worked on by both Julie and Leaha.\r\n","created_at":"2016-09-02T21:08:24Z","updated_at":"2016-09-07T23:51:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"84bb39a221e1746ff72d446407457877d54f000a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ua-eas/kfs/pulls/166/commits","review_comments_url":"https://api.github.com/repos/ua-eas/kfs/pulls/166/comments","review_comment_url":"https://api.github.com/repos/ua-eas/kfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ua-eas/kfs/issues/166/comments","statuses_url":"https://api.github.com/repos/ua-eas/kfs/statuses/7c4d55d9c4d95e300292da897d4672bf07e6924e","head":{"label":"ua-eas:UAF-2307","ref":"UAF-2307","sha":"7c4d55d9c4d95e300292da897d4672bf07e6924e","user":{"login":"ua-eas","id":3485494,"avatar_url":"https://avatars.githubusercontent.com/u/3485494?v=3","gravatar_id":"","url":"https://api.github.com/users/ua-eas","html_url":"https://github.com/ua-eas","followers_url":"https://api.github.com/users/ua-eas/followers","following_url":"https://api.github.com/users/ua-eas/following{/other_user}","gists_url":"https://api.github.com/users/ua-eas/gists{/gist_id}","starred_url":"https://api.github.com/users/ua-eas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ua-eas/subscriptions","organizations_url":"https://api.github.com/users/ua-eas/orgs","repos_url":"https://api.github.com/users/ua-eas/repos","events_url":"https://api.github.com/users/ua-eas/events{/privacy}","received_events_url":"https://api.github.com/users/ua-eas/received_events","type":"Organization","site_admin":false},"repo":{"id":39457535,"name":"kfs","full_name":"ua-eas/kfs","owner":{"login":"ua-eas","id":3485494,"avatar_url":"https://avatars.githubusercontent.com/u/3485494?v=3","gravatar_id":"","url":"https://api.github.com/users/ua-eas","html_url":"https://github.com/ua-eas","followers_url":"https://api.github.com/users/ua-eas/followers","following_url":"https://api.github.com/users/ua-eas/following{/other_user}","gists_url":"https://api.github.com/users/ua-eas/gists{/gist_id}","starred_url":"https://api.github.com/users/ua-eas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ua-eas/subscriptions","organizations_url":"https://api.github.com/users/ua-eas/orgs","repos_url":"https://api.github.com/users/ua-eas/repos","events_url":"https://api.github.com/users/ua-eas/events{/privacy}","received_events_url":"https://api.github.com/users/ua-eas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ua-eas/kfs","description":"Kuali Financial System","fork":true,"url":"https://api.github.com/repos/ua-eas/kfs","forks_url":"https://api.github.com/repos/ua-eas/kfs/forks","keys_url":"https://api.github.com/repos/ua-eas/kfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ua-eas/kfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ua-eas/kfs/teams","hooks_url":"https://api.github.com/repos/ua-eas/kfs/hooks","issue_events_url":"https://api.github.com/repos/ua-eas/kfs/issues/events{/number}","events_url":"https://api.github.com/repos/ua-eas/kfs/events","assignees_url":"https://api.github.com/repos/ua-eas/kfs/assignees{/user}","branches_url":"https://api.github.com/repos/ua-eas/kfs/branches{/branch}","tags_url":"https://api.github.com/repos/ua-eas/kfs/tags","blobs_url":"https://api.github.com/repos/ua-eas/kfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ua-eas/kfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ua-eas/kfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ua-eas/kfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ua-eas/kfs/statuses/{sha}","languages_url":"https://api.github.com/repos/ua-eas/kfs/languages","stargazers_url":"https://api.github.com/repos/ua-eas/kfs/stargazers","contributors_url":"https://api.github.com/repos/ua-eas/kfs/contributors","subscribers_url":"https://api.github.com/repos/ua-eas/kfs/subscribers","subscription_url":"https://api.github.com/repos/ua-eas/kfs/subscription","commits_url":"https://api.github.com/repos/ua-eas/kfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ua-eas/kfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ua-eas/kfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ua-eas/kfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ua-eas/kfs/contents/{+path}","compare_url":"https://api.github.com/repos/ua-eas/kfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ua-eas/kfs/merges","archive_url":"https://api.github.com/repos/ua-eas/kfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ua-eas/kfs/downloads","issues_url":"https://api.github.com/repos/ua-eas/kfs/issues{/number}","pulls_url":"https://api.github.com/repos/ua-eas/kfs/pulls{/number}","milestones_url":"https://api.github.com/repos/ua-eas/kfs/milestones{/number}","notifications_url":"https://api.github.com/repos/ua-eas/kfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ua-eas/kfs/labels{/name}","releases_url":"https://api.github.com/repos/ua-eas/kfs/releases{/id}","deployments_url":"https://api.github.com/repos/ua-eas/kfs/deployments","created_at":"2015-07-21T16:41:24Z","updated_at":"2016-02-10T20:21:10Z","pushed_at":"2016-09-03T01:39:29Z","git_url":"git://github.com/ua-eas/kfs.git","ssh_url":"git@github.com:ua-eas/kfs.git","clone_url":"https://github.com/ua-eas/kfs.git","svn_url":"https://github.com/ua-eas/kfs","homepage":null,"size":441603,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"ua-development"}},"base":{"label":"ua-eas:ua-development","ref":"ua-development","sha":"7ce3cf14b33cd5eaddf96cba11fdb25fbc64d6d7","user":{"login":"ua-eas","id":3485494,"avatar_url":"https://avatars.githubusercontent.com/u/3485494?v=3","gravatar_id":"","url":"https://api.github.com/users/ua-eas","html_url":"https://github.com/ua-eas","followers_url":"https://api.github.com/users/ua-eas/followers","following_url":"https://api.github.com/users/ua-eas/following{/other_user}","gists_url":"https://api.github.com/users/ua-eas/gists{/gist_id}","starred_url":"https://api.github.com/users/ua-eas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ua-eas/subscriptions","organizations_url":"https://api.github.com/users/ua-eas/orgs","repos_url":"https://api.github.com/users/ua-eas/repos","events_url":"https://api.github.com/users/ua-eas/events{/privacy}","received_events_url":"https://api.github.com/users/ua-eas/received_events","type":"Organization","site_admin":false},"repo":{"id":39457535,"name":"kfs","full_name":"ua-eas/kfs","owner":{"login":"ua-eas","id":3485494,"avatar_url":"https://avatars.githubusercontent.com/u/3485494?v=3","gravatar_id":"","url":"https://api.github.com/users/ua-eas","html_url":"https://github.com/ua-eas","followers_url":"https://api.github.com/users/ua-eas/followers","following_url":"https://api.github.com/users/ua-eas/following{/other_user}","gists_url":"https://api.github.com/users/ua-eas/gists{/gist_id}","starred_url":"https://api.github.com/users/ua-eas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ua-eas/subscriptions","organizations_url":"https://api.github.com/users/ua-eas/orgs","repos_url":"https://api.github.com/users/ua-eas/repos","events_url":"https://api.github.com/users/ua-eas/events{/privacy}","received_events_url":"https://api.github.com/users/ua-eas/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ua-eas/kfs","description":"Kuali Financial System","fork":true,"url":"https://api.github.com/repos/ua-eas/kfs","forks_url":"https://api.github.com/repos/ua-eas/kfs/forks","keys_url":"https://api.github.com/repos/ua-eas/kfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ua-eas/kfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ua-eas/kfs/teams","hooks_url":"https://api.github.com/repos/ua-eas/kfs/hooks","issue_events_url":"https://api.github.com/repos/ua-eas/kfs/issues/events{/number}","events_url":"https://api.github.com/repos/ua-eas/kfs/events","assignees_url":"https://api.github.com/repos/ua-eas/kfs/assignees{/user}","branches_url":"https://api.github.com/repos/ua-eas/kfs/branches{/branch}","tags_url":"https://api.github.com/repos/ua-eas/kfs/tags","blobs_url":"https://api.github.com/repos/ua-eas/kfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ua-eas/kfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ua-eas/kfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/ua-eas/kfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ua-eas/kfs/statuses/{sha}","languages_url":"https://api.github.com/repos/ua-eas/kfs/languages","stargazers_url":"https://api.github.com/repos/ua-eas/kfs/stargazers","contributors_url":"https://api.github.com/repos/ua-eas/kfs/contributors","subscribers_url":"https://api.github.com/repos/ua-eas/kfs/subscribers","subscription_url":"https://api.github.com/repos/ua-eas/kfs/subscription","commits_url":"https://api.github.com/repos/ua-eas/kfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/ua-eas/kfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/ua-eas/kfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/ua-eas/kfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/ua-eas/kfs/contents/{+path}","compare_url":"https://api.github.com/repos/ua-eas/kfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ua-eas/kfs/merges","archive_url":"https://api.github.com/repos/ua-eas/kfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ua-eas/kfs/downloads","issues_url":"https://api.github.com/repos/ua-eas/kfs/issues{/number}","pulls_url":"https://api.github.com/repos/ua-eas/kfs/pulls{/number}","milestones_url":"https://api.github.com/repos/ua-eas/kfs/milestones{/number}","notifications_url":"https://api.github.com/repos/ua-eas/kfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ua-eas/kfs/labels{/name}","releases_url":"https://api.github.com/repos/ua-eas/kfs/releases{/id}","deployments_url":"https://api.github.com/repos/ua-eas/kfs/deployments","created_at":"2015-07-21T16:41:24Z","updated_at":"2016-02-10T20:21:10Z","pushed_at":"2016-09-03T01:39:29Z","git_url":"git://github.com/ua-eas/kfs.git","ssh_url":"git@github.com:ua-eas/kfs.git","clone_url":"https://github.com/ua-eas/kfs.git","svn_url":"https://github.com/ua-eas/kfs","homepage":null,"size":441603,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":3,"forks":2,"open_issues":3,"watchers":2,"default_branch":"ua-development"}},"_links":{"self":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/166"},"html":{"href":"https://github.com/ua-eas/kfs/pull/166"},"issue":{"href":"https://api.github.com/repos/ua-eas/kfs/issues/166"},"comments":{"href":"https://api.github.com/repos/ua-eas/kfs/issues/166/comments"},"review_comments":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/166/comments"},"review_comment":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ua-eas/kfs/pulls/166/commits"},"statuses":{"href":"https://api.github.com/repos/ua-eas/kfs/statuses/7c4d55d9c4d95e300292da897d4672bf07e6924e"}}}}
{"actor":{"display_login":"nataliac06"}}