Produced by Araxis Merge on 10/27/2017 2:19:30 PM Central Daylight Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | Source Code.zip\Source Code\Services\src\main\java\gov\va\genisis2\bo | BusinessHelper.java | Fri Oct 27 12:18:48 2017 UTC |
| 2 | Source Code.zip\Source Code\Services\src\main\java\gov\va\genisis2\bo | BusinessHelper.java | Fri Oct 27 17:34:41 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 340 |
| Changed | 1 | 4 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | package go v.va.genis is2.bo; | |
| 2 | ||
| 3 | import jav a.io.File; | |
| 4 | import jav a.util.Lis t; | |
| 5 | import jav a.util.Str ingJoiner; | |
| 6 | ||
| 7 | import jav ax.annotat ion.Resour ce; | |
| 8 | ||
| 9 | import org .apache.co mmons.lang 3.StringUt ils; | |
| 10 | import org .slf4j.Log ger; | |
| 11 | import org .slf4j.Log gerFactory ; | |
| 12 | import org .springfra mework.bea ns.factory .annotatio n.Required ; | |
| 13 | import org .springfra mework.ste reotype.Co mponent; | |
| 14 | ||
| 15 | import gov .va.genisi s2.common. enums.Work flowStatus Enum; | |
| 16 | import gov .va.genisi s2.util.re st.helper. ResponseWr apper; | |
| 17 | import gov .va.genisi s2.vo.Copy TableSourc e; | |
| 18 | ||
| 19 | /** | |
| 20 | * The Cla ss Busines sHelper. | |
| 21 | */ | |
| 22 | @Component | |
| 23 | public cla ss Busines sHelper { | |
| 24 | ||
| 25 | pr ivate stat ic final L ogger LOGG ER = Logge rFactory.g etLogger(B usinessHel per.class) ; | |
| 26 | ||
| 27 | pr ivate stat ic final S tring EMAI LID_DELIME TER = ","; | |
| 28 | ||
| 29 | @R esource(na me="workfl owDeadends List") | |
| 30 | pr ivate List <String> w orkflowDea dendsList; | |
| 31 | ||
| 32 | @R esource(na me="allowe dOperation s") | |
| 33 | pr ivate List <String> a llowedOper ations; | |
| 34 | ||
| 35 | @R esource(na me="notifi cationAllo wedStutuse s") | |
| 36 | pr ivate List <String> n otificatio nAllowedSt utuses; | |
| 37 | ||
| 38 | @R esource(na me="return ToDdmAllow edStutuses ") | |
| 39 | pr ivate List <String> r eturnToDdm AllowedStu tuses; | |
| 40 | ||
| 41 | /* * | |
| 42 | * @param wo rkflowDead endsList | |
| 43 | * the work flowDeaden dsList to set | |
| 44 | * / | |
| 45 | @R equired | |
| 46 | pu blic void setWorkflo wDeadendsL ist(List<S tring> wor kflowDeade ndsList) { | |
| 47 | this .workflowD eadendsLis t = workfl owDeadends List; | |
| 48 | } | |
| 49 | ||
| 50 | pu blic Respo nseWrapper validateC opyTableSo urce(CopyT ableSource copyTable Source, Co pyTableSou rce jsonRe quest, Res ponseWrapp er wrapper ) { | |
| 51 | ||
| 52 | // G et require d properti es | |
| 53 | Stri ng tcSourc eDataBaseS erverName = copyTabl eSource.ge tTcSourceD ataBaseSer verName(); | |
| 54 | Stri ng tcSourc eDataBaseN ame = copy TableSourc e.getTcSou rceDataBas eName(); | |
| 55 | Stri ng sourceS chemaName = jsonRequ est.getSou rceSchemaN ame(); | |
| 56 | Stri ng tcDesti nationData BaseServer Name = cop yTableSour ce.getTcDe stinationD ataBaseSer verName(); | |
| 57 | Stri ng tcDesti nationData BaseUserNa me = copyT ableSource .getTcDest inationDat aBaseUserN ame(); | |
| 58 | Stri ng tcDesti nationData BaseUserPa ssword = c opyTableSo urce.getTc Destinatio nDataBaseU serPasswor d(); | |
| 59 | Stri ng tcDesti nationServ erDataBase Name = cop yTableSour ce.getTcDe stinationS erverDataB aseName(); | |
| 60 | Stri ng destina tionSchema Name = jso nRequest.g etDestinat ionSchemaN ame(); | |
| 61 | Stri ng tcManag ementDataB aseServerN ame = copy TableSourc e.getTcMan agementDat aBaseServe rName(); | |
| 62 | Stri ng tcManag ementDataB aseUserNam e = copyTa bleSource. getTcManag ementDataB aseUserNam e(); | |
| 63 | Stri ng tcManag ementDataB aseUserPas sword = co pyTableSou rce.getTcM anagementD ataBaseUse rPassword( ); | |
| 64 | Stri ng tcManag ementDataB aseSchema = copyTabl eSource.ge tTcManagem entDataBas eSchema(); | |
| 65 | Stri ng copyTab le = jsonR equest.get TableName( ); | |
| 66 | Stri ng copyTab leScript = copyTable Source.get CmdFilePat h(); | |
| 67 | Stri ng tcManag ementDataB aseName = copyTableS ource.getT cManagemen tDataBaseN ame(); | |
| 68 | Stri ng tcTempo raryDataBa seName = c opyTableSo urce.getTc TemporaryD ataBaseNam e(); | |
| 69 | ||
| 70 | bool ean source DBFlag = S tringUtils .isBlank(t cSourceDat aBaseServe rName) || StringUtil s.isBlank( tcSourceDa taBaseName ); | |
| 71 | bool ean schema Flag = Str ingUtils.i sBlank(sou rceSchemaN ame); | |
| 72 | bool ean destDB Flag = Str ingUtils.i sBlank(tcD estination DataBaseSe rverName) || StringU tils.isBla nk(tcDesti nationData BaseUserNa me) || Str ingUtils.i sBlank(tcD estination DataBaseUs erPassword ); | |
| 73 | bool ean source SchemaDest Flag = sou rceDBFlag || schemaF lag || des tDBFlag; | |
| 74 | ||
| 75 | bool ean destSe rvFlag = s ourceSchem aDestFlag || StringU tils.isBla nk(tcDesti nationServ erDataBase Name) || S tringUtils .isBlank(d estination SchemaName ); | |
| 76 | ||
| 77 | bool ean mgmtDB Flag = Str ingUtils.i sBlank(tcM anagementD ataBaseSer verName) | | StringUt ils.isBlan k(tcManage mentDataBa seSchema) || StringU tils.isBla nk(tcManag ementDataB aseName); | |
| 78 | bool ean mgmtDB UserFlag = StringUti ls.isBlank (tcManagem entDataBas eUserName) || String Utils.isBl ank(tcMana gementData BaseUserPa ssword); | |
| 79 | bool ean destMg mtflag = d estServFla g || mgmtD BFlag || m gmtDBUserF lag; | |
| 80 | ||
| 81 | bool ean copyTa bleFlag = StringUtil s.isBlank( tcTemporar yDataBaseN ame) || St ringUtils. isBlank(co pyTable) | | StringUt ils.isBlan k(copyTabl eScript); | |
| 82 | ||
| 83 | // C heck for a ll propert ies are pr esent | |
| 84 | if ( sourceSche maDestFlag || destMg mtflag || copyTableF lag) { | |
| 85 | LOGGER .error("On e or more properties in genisi s2.propert ies file s eems blank "); | |
| 86 | wrappe r.setRespo nse(jsonRe quest); | |
| 87 | wrappe r.setMessa ge("One or more prop erties in genisis2.p roperties file seems blank"); | |
| 88 | wrappe r.setSucce ss(false); | |
| 89 | return wrapper; | |
| 90 | } | |
| 91 | ||
| 92 | File file = ne w File(cop yTableScri pt); | |
| 93 | ||
| 94 | // C heck shell script av ailable on Linux ser ver | |
| 95 | if ( !file.isFi le()) { | |
| 96 | LOGGER .error("Th e file {} does not e xist", cop yTableScri pt); | |
| 97 | wrappe r.setRespo nse(jsonRe quest); | |
| 98 | wrappe r.setMessa ge("Copy t able faile d. " + cop yTableScri pt + " doe s not exis t"); | |
| 99 | wrappe r.setSucce ss(false); | |
| 100 | return wrapper; | |
| 101 | } | |
| 102 | ||
| 103 | /* | |
| 104 | * IP GENISISDAT ASOURCE df lt IP data_ops g enisis20!7 | |
| 105 | * GENISISD ATADEST db o IP data_ops g enisis20!7 dbo | |
| 106 | * v inciTable1 ,vinciTabl e2 | |
| 107 | */ | |
| 108 | ||
| 109 | Stri ng[] comma nd = new S tring[16]; | |
| 110 | comm and[0] = c opyTableSc ript; | |
| 111 | comm and[1] = t cSourceDat aBaseServe rName; | |
| 112 | comm and[2] = t cSourceDat aBaseName; | |
| 113 | comm and[3] = s ourceSchem aName; | |
| 114 | comm and[4] = t cDestinati onDataBase ServerName ; | |
| 115 | comm and[5] = t cDestinati onDataBase UserName; | |
| 116 | comm and[6] = t cDestinati onDataBase UserPasswo rd; | |
| 117 | comm and[7] = t cDestinati onServerDa taBaseName ; | |
| 118 | comm and[8] = d estination SchemaName ; | |
| 119 | comm and[9] = t cManagemen tDataBaseS erverName; | |
| 120 | comm and[10] = tcManageme ntDataBase UserName; | |
| 121 | comm and[11] = tcManageme ntDataBase UserPasswo rd; | |
| 122 | comm and[12] = tcManageme ntDataBase Name; | |
| 123 | comm and[13] = tcTemporar yDataBaseN ame; | |
| 124 | comm and[14] = tcManageme ntDataBase Schema; | |
| 125 | comm and[15] = copyTable; | |
| 126 | ||
| 127 | wrap per.setRes ponse(comm and); | |
| 128 | wrap per.setSuc cess(true) ; | |
| 129 | ||
| 130 | retu rn wrapper ; | |
| 131 | } | |
| 132 | ||
| 133 | pu blic boole an getWork flowDeadEn ds(String status) { | |
| 134 | bool ean workfl owDeadEnds = false; | |
| 135 | Stri ngJoiner t erminatedS tates = ne w StringJo iner(EMAIL ID_DELIMET ER); | |
| 136 | for (Object ob j : workfl owDeadends List) { | |
| 137 | if (ob j != null) { | |
| 138 | terminat edStates.a dd(obj.toS tring()); | |
| 139 | } | |
| 140 | } | |
| 141 | if ( StringUtil s.isBlank( terminated States.toS tring())) { | |
| 142 | LOGGER .error("No workflow deadends f ound!"); | |
| 143 | workfl owDeadEnds = true; | |
| 144 | } | |
| 145 | if ( StringUtil s.countMat ches(termi natedState s.toString (), status ) > 0) { | |
| 146 | workfl owDeadEnds = true; | |
| 147 | } | |
| 148 | retu rn workflo wDeadEnds; | |
| 149 | } | |
| 150 | ||
| 151 | pu blic boole an isCance lAllowed(S tring stat us) { | |
| 152 | bool ean flag; | |
| 153 | flag = StringU tils.equal sIgnoreCas e(status, WorkflowSt atusEnum.S UBMITTED.g etDesc()) ? true : f alse; | |
| 154 | flag = flag || (StringUt ils.equals IgnoreCase (status, W orkflowSta tusEnum.RE TURNED.get Desc())) ? true : fa lse; | |
| 155 | flag = flag || (StringUt ils.equals IgnoreCase (status, W orkflowSta tusEnum.SE NT.getDesc ())) ? tru e : false; | |
| 156 | flag = flag || (StringUt ils.equals IgnoreCase (status, W orkflowSta tusEnum.RE QUESTACCEP TED.getDes c())) ? tr ue : false ; | |
| 157 | flag = flag || (StringUt ils.equals IgnoreCase (status, W orkflowSta tusEnum.RE SULTSDELIV ERED.getDe sc())) ? t rue : fals e; | |
| 158 | retu rn flag; | |
| 159 | } | |
| 160 | ||
| 161 | pu blic boole an isOpera tionAllowe d(String o peration) { | |
| 162 | retu rn allowed Operations .stream(). filter(s - > s.equals IgnoreCase (operation )).findFir st().isPre sent(); | |
| 163 | } | |
| 164 | ||
| 165 | pu blic boole an isNotif icationAll owed(Strin g status) { | |
| 166 | retu rn notific ationAllow edStutuses .stream(). filter(s - > s.equals IgnoreCase (status)). findFirst( ).isPresen t(); | |
| 167 | } | |
| 168 | ||
| 169 | pu blic boole an isRetur nToDDMAllo wed(String status) { | |
| 170 | retu rn returnT oDdmAllowe dStutuses. stream().f ilter(s -> s.equalsI gnoreCase( status)).f indFirst() .isPresent (); | |
| 171 | } | |
| 172 | } |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.