53. EPMO Open Source Coordination Office Redaction File Detail Report

Produced by Araxis Merge on 9/11/2017 8:05:39 AM 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.

53.1 Files compared

# Location File Last Modified
1 MHV_CIF_2017.4.0.0.zip\MHV_CIF_2017.4.0.0\MHV_CIF_2017.4.0.0\sms_main\sms_source\mhv_sms_ng\mhv-sm-admin\src\main\java\gov\va\med\mhv\sm\web\actions ManageStaff.java Tue Jul 11 23:45:38 2017 UTC
2 MHV_CIF_2017.4.0.0.zip\MHV_CIF_2017.4.0.0\MHV_CIF_2017.4.0.0\sms_main\sms_source\mhv_sms_ng\mhv-sm-admin\src\main\java\gov\va\med\mhv\sm\web\actions ManageStaff.java Thu Sep 7 19:16:43 2017 UTC

53.2 Comparison summary

Description Between
Files 1 and 2
Text Blocks Lines
Unchanged 2 3406
Changed 1 2
Inserted 0 0
Removed 0 0

53.3 Comparison options

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

53.4 Active regular expressions

No regular expressions were active.

53.5 Comparison detail

  1   package go v.va.med.m hv.sm.web. actions;
  2  
  3   import gov .va.med.mh v.foundati on.service .response. Collection ServiceRes ponse;
  4   import gov .va.med.mh v.foundati on.service .response. ServiceRes ponse;
  5   import gov .va.med.mh v.foundati on.util.Lo gSanitizer ;
  6   import gov .va.med.mh v.sm.ad.AD QueryResul t;
  7   import gov .va.med.mh v.sm.dao.p roperties. ManageStaf fMemberPro perties;
  8   import gov .va.med.mh v.sm.dao.U serDao;
  9   import gov .va.med.mh v.sm.dto.L ocationDss UnitsDTO;
  10   import gov .va.med.mh v.sm.dto.U serInfoDTO ;
  11   import gov .va.med.mh v.sm.model .Administr ator;
  12   import gov .va.med.mh v.sm.model .ClinicalU serType;
  13   import gov .va.med.mh v.sm.model .Clinician ;
  14   import gov .va.med.mh v.sm.model .Facility;
  15   import gov .va.med.mh v.sm.servi ce.UserMan agementSer vice;
  16   import gov .va.med.mh v.sm.util. UserUtils;
  17   import gov .va.med.mh v.sm.util. WorkloadUt il;
  18   import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. Provider;
  19   import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. User;
  20   import gov .va.med.mh v.sm.wscli ent.adminq ueriessvc. UserNew;
  21   import gov .va.med.mh v.sm.wscli ent.tiusvc .DSSUnit;
  22  
  23   import jav a.io.File;
  24   import jav a.io.Input Stream;
  25   import jav a.io.Input StreamRead er;
  26   import jav a.io.Reade r;
  27   import jav a.util.Arr ayList;
  28   import jav a.util.Col lection;
  29   import jav a.util.Has hMap;
  30   import jav a.util.Lis t;
  31   import jav a.util.Map ;
  32   import jav a.util.Tre eSet;
  33  
  34   import org .apache.co mmons.lang .StringUti ls;
  35   import org .apache.co mmons.logg ing.Log;
  36   import org .apache.co mmons.logg ing.LogFac tory;
  37   import org .apache.co mmons.vali dator.Emai lValidator ;
  38   import org .apache.st ruts2.Serv letActionC ontext;
  39   import org .owasp.esa pi.ESAPI;
  40   import org .springfra mework.web .context.W ebApplicat ionContext ;
  41   import org .springfra mework.web .context.s upport.Web Applicatio nContextUt ils;
  42  
  43   import com .opensymph ony.xwork2 .Preparabl e;
  44  
  45   public cla ss ManageS taff exten ds BaseSMA dminAction  implement s Preparab le {
  46  
  47           @S uppressWar nings("unu sed")
  48           pr ivate stat ic final L og log = L ogFactory. getLog(Man ageStaff.c lass);
  49  
  50           pr ivate stat ic final S tring CANC EL = "canc el";
  51           pr ivate stat ic final S tring FAIL ED = "fail ed";
  52           pr ivate stat ic final S tring SELE CT_STAFF =  "selectSt aff";
  53           pr ivate stat ic final S tring SEAR CH_RESULTS  = "search Results";
  54           pr ivate stat ic final S tring QUER Y_RESULTS_ IR = "quer yResults_I R";
  55           pr ivate stat ic final S tring BULK _ACTIVATIO N = "bulkA ctivation" ;
  56           pr ivate stat ic final S tring PATC H29_NATION AL ="NATIO NAL";
  57           pr ivate stat ic final S tring PATC H29_FIELD  ="FIELD";
  58           pr ivate stat ic final S tring ALL_ DSS_UNITS  = "*";
  59           pr ivate stat ic final S tring DATA _DELIMITER  = "|";
  60           pr ivate User Management Service us erManageme ntService;
  61           pr ivate Mana geStaffMem berPropert ies manage StaffMembe rPropertie s;
  62           pr ivate User Dao userDa o;
  63           pr ivate Coll ection<Fac ility> vis ns;
  64           pr ivate Coll ection<Fac ility> fac ilities;
  65           pr ivate Long  visnId;
  66           pr ivate Long  facilityI d;
  67           pr ivate Stri ng selecte dVisnName;
  68           pr ivate Stri ng selecte dFacilityN ame;
  69           pr ivate List <Clinician > clinicia ns;
  70           pr ivate List <Clinician > selected Users;
  71           pr ivate List <ClinicalU serType> s taffMember Types;
  72           // private Ht tpServletR equest req uest;
  73           pr ivate Stri ng searchC rit;
  74           pr ivate Stri ng emailAD ;
  75           pr ivate Stri ng firstNa me;
  76           pr ivate Stri ng lastNam e;
  77           pr ivate Stri ng middleN ame;
  78           pr ivate Stri ng duz;
  79           pr ivate Stri ng phone;
  80           pr ivate Stri ng title;
  81           pr ivate Stri ng email;
  82           pr ivate Stri ng suffix;
  83           pr ivate Stri ng prefix;
  84           pr ivate Stri ng activeF lag;
  85           pr ivate Stri ng provide rKey;
  86           pr ivate Stri ng provide rClass;
  87           pr ivate Stri ng personC lass;
  88           pr ivate Stri ng[] dssUn its;
  89           pr ivate Stri ng pcmmFla g;
  90           pr ivate Stri ng require sCoSigner;
  91           pr ivate Stri ng network Id;
  92           pr ivate Long  memberTyp eId;
  93           pr ivate Stri ng memberT ype;
  94           pr ivate Stri ng firstNa meAD;
  95           pr ivate Stri ng lastNam eAD;
  96           pr ivate Stri ng phoneAD ;
  97           pr ivate Stri ng titleAD ;
  98           pr ivate Stri ng network IdAD;
  99           pr ivate Stri ng selectA ction;
  100           //  File uplo ad info fo r bulk act ivation
  101           pr ivate File  upload;
  102       privat e String u ploadConte ntType;
  103       privat e String u ploadFileN ame;
  104       privat e int adde d; // numb er of bulk  load staf f members  activated.
  105       privat e static S tring FILE _SIZE_LIMI T_ERROR =  "The file  you are tr ying to up load excee ds the 2MB  limit. "  +
  106                                                                                            "Please r educe the  file size  and try ag ain.";
  107       privat e static i nt FILE_SI ZE_LIMIT_2 MB = 2 * 1 024 * 1024 ;
  108           pu blic Manag eStaff() {
  109                    supe r();
  110           }
  111  
  112  
  113           pu blic void  prepare()  throws Exc eption {
  114                    supe r.prepare( );
  115                    WebA pplication Context ct x = WebApp licationCo ntextUtils
  116                                      .getWebA pplication Context(Se rvletActio nContext
  117                                                       .g etServletC ontext());
  118                    user Management Service =  (UserManag ementServi ce) ctx.ge tBean("use rManagemen tService") ;
  119                    mana geStaffMem berPropert ies = (Man ageStaffMe mberProper ties)ctx.g etBean("ma nageStaffM emberPrope rties");
  120                    user Dao = (Use rDao) ctx. getBean("u serDao");
  121           }
  122  
  123  
  124           pu blic Strin g manageSt affMembers () {
  125  
  126                    clea rSessionAt tr();
  127  
  128                    retu rn SUCCESS ;
  129           }
  130  
  131           pu blic Strin g selectEn tryMethod( ) {
  132  
  133                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  134                    clea rSessionAt tr();
  135                    faci lities = n ew TreeSet <Facility> ();
  136  
  137                    if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Ina ctivate a  Staff Memb er"))){
  138                             setSes sionAttrib ute("activ ationType" ,"inactiva te");
  139                             return  SELECT_ST AFF;
  140                    }
  141                    if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Rea ctivate a  Staff Memb er"))){
  142                             setSes sionAttrib ute("activ ationType" ,"reactiva te");
  143                             return  SELECT_ST AFF;
  144                    }
  145                    retu rn SUCCESS ;
  146           }
  147  
  148  
  149           pu blic Strin g selectSe archCrit()  {
  150  
  151                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  152                    clea rSessionAt tr();
  153                    faci lities = n ew TreeSet <Facility> ();
  154                    if(( selectActi on != null ) && ((sel ectAction. trim()).eq ualsIgnore Case("Bulk  Activatio n from CSV  File"))){
  155                             return  BULK_ACTI VATION;
  156                    }
  157  
  158                    retu rn SUCCESS ;
  159           }
  160  
  161  
  162           pu blic Strin g selectVi sn(){
  163  
  164                    getS taffSessio nAttr();
  165  
  166                    if(v isnId == - 1L){
  167                             addAct ionError(" Please sel ect a VISN .");
  168                             return  SELECT_ST AFF;
  169                    }
  170  
  171                    for( Facility v : getAdmin isteredVis ns()){
  172                             if(v.g etId().equ als(visnId )){
  173                                      selected VisnName =  v.getName ();
  174                                      faciliti es = getAd ministered Facilities InVisn(v);
  175                             }
  176                    }
  177  
  178                    if(S tringUtils .isBlank(s electedVis nName)){
  179                             addAct ionError(" Please sel ect a VISN .");
  180                             return  SELECT_ST AFF;
  181                    }
  182  
  183                    setS essionAttr ibute("fac ilities",f acilities) ;
  184                    setS essionAttr ibute("sel ectedVisnN ame",selec tedVisnNam e);
  185  
  186                    retu rn SELECT_ STAFF;
  187  
  188           }
  189  
  190           pu blic Strin g selectFa cility(){
  191  
  192                    getS taffSessio nAttr();
  193  
  194                    // i f the visn  hasn't be en selecte d first
  195                    if(S tringUtils .isBlank(s electedVis nName)){
  196                             addAct ionError(" Please sel ect a VISN .");
  197                             return  SELECT_ST AFF;
  198                    }
  199  
  200                    // m ake sure a  facility  has been c hosen
  201                    if(f acilityId  == -1){
  202                             addAct ionError(" Please sel ect a Faci lity.");
  203                             return  SELECT_ST AFF;
  204                    }
  205  
  206                    Stri ng station Number = n ull;
  207  
  208                    if(f acilities  != null){
  209                             for(Fa cility f:  facilities ){
  210                                      if(f.get Id().equal s(facility Id)){
  211                                               selectedFa cilityName  = f.getNa me();
  212                                               stationNum ber = f.ge tStationNu mber();
  213                                      }
  214                             }
  215                    }
  216  
  217                    setS essionAttr ibute("sel ectedFacil ityName",s electedFac ilityName) ;
  218                    setS essionAttr ibute("sta tionNumber ",stationN umber);
  219  
  220                    retu rn SELECT_ STAFF;
  221           }
  222  
  223           pr ivate Coll ectionServ iceRespons e<UserNew>  getPatch2 9VistAProv ider(Strin g lastName ,String fi rstName,St ring stati onNumber,S tring duz) {
  224                    Coll ectionServ iceRespons e<UserNew>  collectio nServiceRe sponse=nul l;
  225                    if(n ull!=duz){
  226                             collec tionServic eResponse  = getAdmin Service(). getVistAPr ovider(duz ,stationNu mber);
  227                             if(log .isInfoEna bled()){
  228                                      if(colle ctionServi ceResponse .getCollec tion()!=nu ll){
  229                                               log.info(L ogSanitize r.cleanTex t("ManageS taff=>getP atch29Vist AProvider= >DUZLookup ->DUZ"+duz +"station# "+stationN umber+"Res ponse size =>"+collec tionServic eResponse. getCollect ion().size ()));        
  230                                      }
  231                             }
  232                    }els e{
  233                             collec tionServic eResponse  = getAdmin Service(). getVistAPr ovider(las tName, fir stName, st ationNumbe r);     
  234                             if(log .isInfoEna bled()){
  235                                      if(colle ctionServi ceResponse .getCollec tion()!=nu ll){
  236                                               log.info(L ogSanitize r.cleanTex t("ManageS taff=>getP atch29Vist AProvider= >UserLooku p->LastNam e="+lastNa me+"FirstN ame="+firs tName+"sta tionNumber "+stationN umber+"Res ponse size =>"+collec tionServic eResponse. getCollect ion().size ()));        
  237                                      }
  238                             }
  239                    }
  240                    retu rn collect ionService Response;
  241           }
  242           
  243           pr ivate Coll ectionServ iceRespons e<User> ge tVistAProv ider(Strin g lastName ,String fi rstName,St ring stati onNumber,S tring duz) {
  244                    Coll ectionServ iceRespons e<User> co llectionSe rviceRespo nse=null;
  245                    if(n ull!=duz){
  246                             collec tionServic eResponse  = getAdmin Service(). findVistaC linician(d uz,station Number);
  247                             if(log .isInfoEna bled()){
  248                                      if(colle ctionServi ceResponse .getCollec tion()!=nu ll){
  249                                               log.info(L ogSanitize r.cleanTex t("ManageS taff=>getV istAProvid er=>DUZLoo kup->DUZ"+ duz+"stati on#"+stati onNumber+" Response s ize=>"+col lectionSer viceRespon se.getColl ection().s ize()));       
  250                                      }
  251                             }
  252                    }els e{
  253                             collec tionServic eResponse  = getAdmin Service(). findVistaC linician(l astName, f irstName,  stationNum ber);
  254                             if(log .isInfoEna bled()){
  255                                      if(colle ctionServi ceResponse .getCollec tion()!=nu ll){
  256                                               log.info(L ogSanitize r.cleanTex t("ManageS taff=>getV istAProvid er=>UserLo okup->Last Name="+las tName+"Fir stName="+f irstName+" station#"+ stationNum ber+"Respo nse size=> "+collecti onServiceR esponse.ge tCollectio n().size() ));   
  257                                      }
  258                             }
  259                    }
  260                    retu rn collect ionService Response;
  261           }
  262  
  263           
  264           pr ivate Coll ection<Use rInfoDTO>  getVistASt affMembers (String fi rstName,St ring lastN ame,String  stationNu mber,Strin g duz){
  265                    //if (null!=man ageStaffMe mberProper ties.getVi stAPatch29 Status() & & manageSt affMemberP roperties. getVistAPa tch29Statu s().equals IgnoreCase (PATCH29_N ATIONAL)){
  266                    if(g etVistAPat ch29Status (stationNu mber)){
  267                             Collec tionServic eResponse< UserNew> r esponse =  getPatch29 VistAProvi der(lastNa me,firstNa me,station Number,duz );
  268                             handle ErrorMessa ges(respon se.getMess ages());
  269                             return  createUse rsInfoList (response, stationNum ber);
  270                    }els e{
  271                             Collec tionServic eResponse< User> resp onse = get VistAProvi der(lastNa me, firstN ame, stati onNumber,d uz);
  272                             handle ErrorMessa ges(respon se.getMess ages());
  273                             return  createUse rsInfoList (response, stationNum ber);
  274                    }
  275           }
  276           
  277           pr ivate bool ean getVis tAPatch29S tatus(Stri ng station No){
  278                    if(n ull!=manag eStaffMemb erProperti es.getVist APatch29St atus() &&  manageStaf fMemberPro perties.ge tVistAPatc h29Status( ).equalsIg noreCase(P ATCH29_NAT IONAL)){
  279                             return  true;
  280                    }els e if(null! =manageSta ffMemberPr operties.g etVistAPat ch29Status () && mana geStaffMem berPropert ies.getVis tAPatch29S tatus().eq ualsIgnore Case(PATCH 29_FIELD)) {
  281                             if(Wor kloadUtil. isCurrentU serIsField Tester(sta tionNo, ma nageStaffM emberPrope rties.getV istAPatch2 9TestingSi tes())){
  282                                      return t rue;
  283                             }else{
  284                                      return f alse;
  285                             }
  286                    }
  287                    retu rn false;
  288           }
  289           
  290           pr ivate Coll ection<Use rInfoDTO>  createUser sInfoList( Collection ServiceRes ponse resp onse,Strin g stationN umber){
  291                    List <UserInfoD TO> userIn foDtoList  = new Arra yList<User InfoDTO>() ;
  292                    if(r esponse.ge tCollectio n()!=null  && respons e.getColle ction().si ze()!=0 &&  ((List)re sponse.get Collection ()).get(0)  instanceo f UserNew) {
  293                             List<U serNew> st affMembers  = (List<U serNew>)re sponse.get Collection ();
  294                             if(log .isInfoEna bled()){
  295                                      log.info ("ManageSt aff=>100 E nsemble Re sponse Ins tance of U serNew for  Station:" +stationNu mber+" Siz e: "+(staf fMembers!= null?staff Members.si ze():"0")) ;
  296                             }
  297                             for(Us erNew user Obj:staffM embers){
  298                                      UserInfo DTO userIn foDto= new  UserInfoD TO();
  299                                      userInfo Dto.setFir stName(use rObj.getFi rstName()! =null?user Obj.getFir stName():" ");
  300                                      userInfo Dto.setLas tName(user Obj.getLas tName()!=n ull?userOb j.getLastN ame():"");
  301                                      userInfo Dto.setMid dleName(us erObj.getM iddleName( )!=null?us erObj.getM iddleName( ):"");
  302                                      userInfo Dto.setSuf fix(userOb j.getSuffi x()!=null? userObj.ge tSuffix(): "");
  303                                      userInfo Dto.setPre fix(userOb j.getPrefi x()!=null? userObj.ge tPrefix(): "");
  304                                      userInfo Dto.setTit le(userObj .getTitle( )!=null?us erObj.getT itle():"") ;
  305                                      userInfo Dto.setWor kPhone(use rObj.getPh one()!=nul l?userObj. getPhone() :"");
  306                                      userInfo Dto.setDuz (userObj.g etIEN()!=n ull?userOb j.getIEN() :"");
  307                                      userInfo Dto.setAct iveFlag((u serObj.get ActiveFlag ()!=null & & userObj. getActiveF lag().equa lsIgnoreCa se("1"))?" ACTIVE":"I NACTIVE");
  308                                      userInfo Dto.setPro viderKey(( userObj.ge tProviderI ndicator() !=null &&  userObj.ge tProviderI ndicator() .equalsIgn oreCase("P ROVIDER")) ?"TRUE":"F ALSE");
  309                                      userInfo Dto.setPro viderClass (userObj.g etProvCls( )!=null?us erObj.getP rovCls():" ");
  310                                      userInfo Dto.setVis tAPersonCl ass(userOb j.getPersC ls());
  311                                      userInfo Dto.setReq uiresCoSig ner(userOb j.getReqCo sig()!=nul l?userObj. getReqCosi g():"");
  312                                      userInfo DtoList.ad d(userInfo Dto);
  313                             }
  314                    }
  315                    else  if(respon se.getColl ection()!= null && re sponse.get Collection ().size()! =0 && ((Li st)respons e.getColle ction()).g et(0) inst anceof Use r){
  316                             List<U ser> staff Members =  (List<User >)response .getCollec tion();
  317                             if(log .isInfoEna bled()){
  318                                      log.info ("ManageSt aff=>200 E nsemble Re sponse Ins tance of U ser for St ation:"+st ationNumbe r+" Size:  "+(staffMe mbers!=nul l?staffMem bers.size( ):"0"));
  319                             }
  320                             for(Us er userObj :staffMemb ers){
  321                                      UserInfo DTO userIn foDto= new  UserInfoD TO();
  322                                      userInfo Dto.setFir stName(use rObj.getFi rstName()! =null?user Obj.getFir stName():" ");
  323                                      userInfo Dto.setLas tName(user Obj.getLas tName()!=n ull?userOb j.getLastN ame():"");
  324                                      userInfo Dto.setMid dleName("" );
  325                                      userInfo Dto.setSuf fix("");
  326                                      userInfo Dto.setPre fix("");
  327                                      userInfo Dto.setTit le(userObj .getTitle( )!=null?us erObj.getT itle():"") ;
  328                                      userInfo Dto.setWor kPhone(use rObj.getPh one()!=nul l?userObj. getPhone() :"");
  329                                      userInfo Dto.setDuz (userObj.g etIEN()!=n ull?userOb j.getIEN() :"");
  330                                      userInfo Dto.setPro viderKey(u serObj.get ProviderIn dicator()! =null?"TRU E":"FALSE" );
  331                                      userInfo Dto.setPro viderClass ("");
  332                                      userInfo Dto.setReq uiresCoSig ner("");
  333                                      userInfo DtoList.ad d(userInfo Dto);
  334                             }
  335                    }
  336                    retu rn userInf oDtoList;
  337           }
  338           
  339           
  340           pu blic Strin g searchSt affMembers () {
  341                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  342  
  343                    getS taffSessio nAttr();
  344                    if(S tringUtils .isBlank(s electedVis nName)){
  345                             addAct ionError(" Please sel ect a VISN .");
  346                             return  SELECT_ST AFF;
  347                    }
  348  
  349                    if(S tringUtils .isBlank(s electedFac ilityName) ){
  350                             addAct ionError(" Please sel ect a Faci lity.");
  351                             return  SELECT_ST AFF;
  352                    }
  353                    //Li st<UserNew > staffMem bers= new  ArrayList< UserNew>() ;
  354                    List <UserInfoD TO> staffM embers = n ew ArrayLi st<UserInf oDTO>();
  355                    clin icians = n ew ArrayLi st<Clinici an>();
  356                    Clin ician clin  = null;
  357                    Stri ng station Number = n ull;
  358                    faci lities = n ew TreeSet <Facility> ();
  359  
  360                    getS taffSessio nAttr();
  361                    Stri ng activat ionType =  null;
  362  
  363                    if(( (String)ge tSessionAt tribute("a ctivationT ype")) !=  null){
  364                             activa tionType =  (String)g etSessionA ttribute(" activation Type");
  365                    }
  366                    if(( (String)ge tSessionAt tribute("s tationNumb er")) != n ull){
  367                             statio nNumber =  (String)ge tSessionAt tribute("s tationNumb er");
  368                    }
  369  
  370                    if(( selectActi on != null ) && (sele ctAction.e qualsIgnor eCase("Sea rch"))){
  371  
  372                             if(sea rchCrit ==  null){
  373                                      addActio nError("Pl ease selec t a radio  button.");
  374                                      return S ELECT_STAF F;
  375                             }
  376                             if(sta tionNumber  == null){
  377                                      
  378                                      if(Strin gUtils.isB lank(selec tedVisnNam e)){
  379                                               addActionE rror("Plea se select  a VISN.");
  380                                               return SEL ECT_STAFF;
  381                                      }else{
  382                                               addActionE rror("Plea se select  a facility .");
  383                                               return SEL ECT_STAFF;
  384                                      }
  385                             }        
  386                             
  387                             try{
  388                                      if(searc hCrit.equa lsIgnoreCa se("0")){
  389                                              
  390                                               if(lastNam e.trim().e quals("")  && firstNa me.trim(). equals("") ){
  391                                                       ad dActionErr or("Please  enter the  First Nam e and Last  Name and  select the  'Search b y Name' ra dio button .");
  392                                                       re turn SELEC T_STAFF;
  393                                               }
  394                                              
  395                                               if(lastNam e.trim().e quals("")) {
  396                                                       ad dActionErr or("Please  enter the  Last Name  and selec t the 'Sea rch by Nam e' radio b utton.");
  397                                                       re turn SELEC T_STAFF;
  398                                               }
  399                                              
  400                                               if(firstNa me.trim(). equals("") ){
  401                                                       ad dActionErr or("Please  enter the  First Nam e and sele ct the 'Se arch by Na me' radio  button.");
  402                                                       re turn SELEC T_STAFF;
  403                                               }
  404                                              
  405                                               if(firstNa me.trim(). length() <  2 || last Name.trim( ).length()  < 2){
  406                                                       ad dActionErr or("Please  enter at  least firs t 2 charac ters of Fi rst Name a nd Last Na me.");
  407                                                       re turn SELEC T_STAFF;
  408                                               }
  409                                              
  410                                               if((activa tionType ! = null) &&  (activati onType.equ alsIgnoreC ase("inact ivate"))){
  411                                                       cl inicians =  (List<Cli nician>) u serManagem entService .searchFor Clinicians (firstName , lastName , stationN umber, tru e).getColl ection();
  412                                               }else if(( activation Type != nu ll) && (ac tivationTy pe.equalsI gnoreCase( "reactivat e"))){
  413                                                       cl inicians =  (List<Cli nician>) u serManagem entService .searchFor Clinicians (firstName , lastName , stationN umber, fal se).getCol lection();
  414                                               }else{
  415                                                       st affMembers  = (List)g etVistASta ffMembers( firstName, lastName,s tationNumb er,null);
  416                                                       Li st userMan agementSta ffMembers  = (List<Cl inician>)  userManage mentServic e.searchFo rClinician s(firstNam e, lastNam e, station Number).ge tCollectio n();
  417  
  418                                                       if (staffMemb ers == nul l){
  419                                                                addA ctionError ("A search  of the Vi stA databa se did not  produce a  match for  the infor mation giv en.");
  420                                                                retu rn SELECT_ STAFF;
  421                                                       }
  422                                                       st affMembers  = filterS taffMember s(staffMem bers,userM anagementS taffMember s);
  423                                               }
  424                                      }else{
  425                                               if((duz ==  null) ||  ((duz.trim ()).equals (""))){
  426                                               addActionE rror("Plea se enter D UZ and sel ect 'Searc h by DUZ'  radio butt on.");
  427                                               return SEL ECT_STAFF;
  428                                               }
  429                                              
  430  
  431                                               if(duz !=n ull) duz=d uz.trim();
  432                                               if((activa tionType ! = null) &&  (activati onType.equ alsIgnoreC ase("inact ivate"))){
  433                                                       Se rviceRespo nse<Clinic ian> respo nse = user Management Service.ge tClinician ForStation AndDuz(sta tionNumber , duz, tru e);
  434                                                       cl in = respo nse.getPay load();
  435                                               }else if(( activation Type != nu ll) && (ac tivationTy pe.equalsI gnoreCase( "reactivat e"))){
  436                                                       Se rviceRespo nse<Clinic ian> respo nse = user Management Service.ge tClinician ForStation AndDuz(sta tionNumber , duz, fal se);
  437                                                       cl in = respo nse.getPay load();
  438  
  439                                               }else{
  440                                                       st affMembers  = (List)g etVistASta ffMembers( null,null, stationNum ber,duz);
  441                                                       Cl inician cl inician =   userDao.f indAuthCli nicianBySt ationAndDu z(stationN umber,duz) ;
  442                                                       Ar rayList<Cl inician> u serManagem entStaffMe mbers = ne w ArrayLis t<Clinicia n>();
  443                                                       if (clinician  !=null)
  444                                                                user Management StaffMembe rs.add(cli nician);
  445  
  446                                                       if (staffMemb ers == nul l){
  447                                                                addA ctionError ("A search  of the Vi stA databa se did not  produce a  match for  the infor mation giv en.");
  448                                                       }
  449                                                       if (userManag ementStaff Members.si ze()!=0)
  450                                                                staf fMembers =  filterSta ffMembers( staffMembe rs,userMan agementSta ffMembers) ;
  451                                               }
  452  
  453                                               if(clin!=n ull){
  454                                                       cl inicians.a dd(clin);
  455                                               }
  456                                      }
  457                             }catch (Exception  e){
  458                                      if(log.i sErrorEnab led()){
  459                                               log.error( "searchSta ffMembers( )=>Excepti on occured  while sea rch Staff  Members"+e .getMessag e());
  460                                               e.printSta ckTrace();
  461                                      }
  462                                      addActio nError("An  unexpecte d error ha s occurred . Please c ontact the  Help Desk , if the p roblem per sists.");
  463                             }
  464                             setSes sionAttrib ute("staff Members",s taffMember s);
  465                             setSes sionAttrib ute("clini cians",cli nicians);
  466  
  467  
  468                             if((ac tivationTy pe != null ) && ((act ivationTyp e.equalsIg noreCase(" inactivate ")) || (ac tivationTy pe.equalsI gnoreCase( "reactivat e")))){
  469                                      return Q UERY_RESUL TS_IR;
  470                             }
  471  
  472                             return  SUCCESS;
  473  
  474                    }
  475  
  476                    try{
  477                             String  cf = getP arameter(" changeFaci lity");
  478                             if(!St ringUtils. isBlank(cf ) && cf.eq ualsIgnore Case("yes" )){
  479                                      selected FacilityNa me = null;
  480                             }
  481                    }cat ch(Excepti on e){
  482                             if(log .isErrorEn abled()){
  483                                      log.erro r("Excepti on occurre d in chang eFacility" );
  484                             }
  485                    }
  486  
  487                    retu rn SELECT_ STAFF;
  488           }
  489  
  490           /* *
  491            *  filteredS tffMembers
  492            *  @param vi staStaffMe mbers
  493            *  @param us erManageme ntStaffMem bers
  494            *  @return L ist<User>
  495            * /
  496           pr ivate List <UserInfoD TO> filter StaffMembe rs(List<Us erInfoDTO>  vistaStaf fMembers,L ist<Clinic ian> userM anagementS taffMember s){
  497  
  498                             
  499                    Arra yList<User InfoDTO> f ilteredSta ffMembers  = new Arra yList<User InfoDTO>() ;
  500                    Arra yList<Stri ng> active Clinicians  = new Arr ayList<Str ing>();
  501                    for( Clinician  clinician: userManage mentStaffM embers){
  502                             if(cli nician.get Duz()!=nul l){
  503                                      activeCl inicians.a dd(clinici an.getDuz( ));
  504                             }
  505                    }
  506                    for( UserInfoDT O user:vis taStaffMem bers){
  507                             if(!ac tiveClinic ians.conta ins(user.g etDuz())){
  508                                      filtered StaffMembe rs.add(use r);
  509                             }
  510                    }
  511                    retu rn filtere dStaffMemb ers;
  512           }
  513  
  514           pu blic Strin g associat eNetworkId (){
  515  
  516                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  517                    User InfoDTO se lectedVist aUser = nu ll;
  518                    try{
  519                             duz =  (getParame ter("ien")  == null)? "":getPara meter("ien ");
  520                             if(duz  == null){
  521                                      addActio nError("Co uld not fi nd IEN for  the selec ted user." );
  522                             }
  523                             //List <UserNew>  searchedUs ers = (Lis t<UserNew> )getSessio nAttribute ("staffMem bers");
  524                             List<U serInfoDTO > searched Users = (L ist<UserIn foDTO>)get SessionAtt ribute("st affMembers ");
  525                             
  526                             if(sea rchedUsers  != null){
  527                                      for(User InfoDTO us erInfoDto: searchedUs ers){
  528                                               if(duz.equ alsIgnoreC ase(userIn foDto.getD uz())){
  529                                                       se lectedVist aUser = us erInfoDto;
  530                                               }
  531                                      }
  532                             }
  533                             
  534                             if(get VistAPatch 29Status(( String)get SessionAtt ribute("st ationNumbe r"))){
  535                                               ServiceRes ponse<Prov ider> pcmm Response   = getAdmin Service(). getPcmmPro vider((Str ing)getSes sionAttrib ute("stati onNumber") , duz);
  536                                               if(log.isI nfoEnabled ()){
  537                                                       lo g.info("as sociateNet workId=>10 0 pcmmResp onse==>"+p cmmRespons e);
  538                                                       lo g.info("as sociateNet workId=>10 1 pcmmResp onse==>"+p cmmRespons e.getPaylo ad());
  539                                               }
  540                                               if(pcmmRes ponse!=nul l && pcmmR esponse.ge tPayload() !=null &&  pcmmRespon se.getPayl oad().getI EN()!=null ){
  541                                                       se lectedVist aUser.setP cmmFlag("Y ES");
  542                                               }else{
  543                                                       se lectedVist aUser.setP cmmFlag("N O");
  544                                               }
  545                                              
  546                                               LocationDs sUnitsDTO  dssUnitsDT O = getAdm inService( ).getDSSUn itsByClini cAndStatio n((String) getSession Attribute( "stationNu mber"), AL L_DSS_UNIT S, duz, AL L_DSS_UNIT S);
  547                                               if(dssUnit sDTO!=null  && dssUni tsDTO.getE rror()==nu ll){
  548                                                       Li st<DSSUnit > dssUnits  = dssUnit sDTO.getDs sUnits();
  549                                                       St ringBuilde r strBuild er=new Str ingBuilder ();
  550                                                       in t count=1;
  551                                                       fo r(DSSUnit  dss:dssUni ts){
  552                                                                strB uilder.app end(dss.ge tDSSName() );
  553                                                                if(c ount!=dssU nits.size( )) strBuil der.append ("|");
  554                                                                coun t++;
  555                                                       }
  556                                                       se lectedVist aUser.setD ssUnits(st rBuilder.t oString()) ;
  557                                               }
  558                             }        
  559                             setSes sionAttrib ute("selec tedVistaUs er",select edVistaUse r);
  560                             setSes sionAttrib ute("duz", duz);
  561                             getUse rInformati on();
  562                    }cat ch(Excepti on exp1){
  563                             if(log .isErrorEn abled()){
  564                                      log.erro r("associa teNetworkI d()=>Excep tion occur red while  getting se lected use r details. "+exp1);
  565                             }
  566                    }
  567  
  568                    retu rn SUCCESS ;
  569           }
  570  
  571           
  572           pu blic void  getUserInf ormation() {
  573                    User InfoDTO se lectedVist AUser = (U serInfoDTO )getSessio nAttribute ("selected VistaUser" );
  574                    if(s electedVis tAUser!=nu ll){
  575                             firstN ame = sele ctedVistAU ser.getFir stName();
  576                             lastNa me = selec tedVistAUs er.getLast Name(); 
  577                             middle Name = sel ectedVistA User.getMi ddleName() ;
  578                             title  = selected VistAUser. getTitle() ;
  579                             phone  = selected VistAUser. getWorkPho ne();
  580                             duz =  selectedVi stAUser.ge tDuz();
  581                             suffix  = selecte dVistAUser .getSuffix () ;
  582                             prefix  = selecte dVistAUser .getPrefix ();
  583                             active Flag="";
  584                             if(sel ectedVistA User.getAc tiveFlag() !=null){
  585                                      activeFl ag = selec tedVistAUs er.getActi veFlag().e quals("0") ?"ACTIVE": "INACTIVE" ;
  586                             }
  587                             provid erKey = se lectedVist AUser.getP roviderKey ();
  588                             provid erClass =  selectedVi stAUser.ge tProviderC lass();
  589                             try{
  590                                      if(selec tedVistAUs er.getVist APersonCla ss()!=null  && select edVistAUse r.getPerso nClass()== null){
  591                                               if(selecte dVistAUser .getVistAP ersonClass ()[0]!=nul l){
  592                                                       St ring perso nClassific ation = Us erUtils.ge tProviderP ersonClass ification( selectedVi stAUser.ge tVistAPers onClass()[ 0]);
  593                                                       if (personCla ssificatio n!=null)
  594                                                                sele ctedVistAU ser.setPer sonClass(U serUtils.f ormatPerso nClass(per sonClassif ication));
  595                                               }
  596                                      }
  597                                      personCl ass = sele ctedVistAU ser.getPer sonClass() ;
  598                             }
  599                             catch( Exception  exp2){
  600                                      if(log.i sErrorEnab led()){
  601                                               log.error( "getUserIn formation= >An Error  Occured wh ile extrac ting Perso n Class "+ exp2);
  602                                      }
  603                             }
  604                             pcmmFl ag ="";
  605                             if(sel ectedVistA User.getPc mmFlag()!= null){
  606                                      pcmmFlag  = selecte dVistAUser .getPcmmFl ag();     
  607                             }
  608                             requir esCoSigner  = selecte dVistAUser .getRequir esCoSigner ();
  609                             if(sel ectedVistA User.getDs sUnits()!= null && se lectedVist AUser.getD ssUnits(). length()!= 0){
  610                                      dssUnits  = StringU tils.split (selectedV istAUser.g etDssUnits (),"|");
  611                             }
  612                             setSes sionAttrib ute("selec tedVistaUs er",select edVistAUse r);
  613                    }
  614           }
  615           
  616  
  617           pu blic Strin g verifyWi thADResult s(){
  618                    getU serInforma tion();
  619                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  620  
  621                    if(i sSearchRes ults()) 
  622                    {        
  623                             return  SEARCH_RE SULTS; 
  624                    }
  625                    
  626                    getS taffSessio nAttr();
  627  
  628                    if(i sNewSearch ())
  629                    { 
  630                             return  SELECT_ST AFF;
  631                    }
  632  
  633                    if(( networkId  == null) | | ((networ kId.trim() ).equals(" "))){
  634                             addAct ionError(" Please ent er the Net work ID.") ;
  635                             return  FAILED;
  636                    }
  637  
  638                    Stri ng station Number = n ull;
  639                    if(( (String)ge tSessionAt tribute("s tationNumb er")) != n ull){
  640                             statio nNumber =  (String)ge tSessionAt tribute("s tationNumb er");
  641                    }
  642  
  643                    if ( stationNum ber == nul l) {
  644                             addAct ionError(" Please sel ect a faci lity.");
  645                             return  SELECT_ST AFF;
  646                    }
  647  
  648                    Clin ician exis tingClinic ian = user Dao.findCl inicianByS tationAndU sername(st ationNumbe r, network Id);
  649                    if ( existingCl inician !=  null) {
  650                             addAct ionError(" Network ID  " +
  651                                                           networkId  +
  652                                                           " is alre ady in use  at this s tation by  " +
  653                                                           (existing Clinician. isActive()  ? "active " : "inact ive") +
  654                                                           " staff m ember " +
  655                                                           existingC linician.g etName());
  656                             return  FAILED;
  657                    }
  658  
  659                    ADQu eryResult  staffADRes ults = nul l;
  660                    firs tNameAD =  "";
  661                    last NameAD = " ";
  662                    phon eAD = "";
  663                    titl eAD = "";
  664                    netw orkIdAD =  "";
  665                    emai lAD = "";
  666                    try{
  667                             
  668                             Servic eResponse< ADQueryRes ult> respo nse = getA dminServic e().findAD Account(ne tworkId);
  669                             staffA DResults =  response. getPayload ();
  670                             if(sta ffADResult s == null) {
  671                                      if(log.i sInfoEnabl ed()){
  672                                               log.info(L ogSanitize r.cleanTex t("verifyW ithADResul ts()=>AD R esults: Nu ll for net workId"+ne tworkId));
  673                                      }
  674                                      addActio nError("An  Email Add ress could  not be fo und in Out look using  the VistA  search re sults.");
  675                                      return F AILED;
  676                             }else{
  677                                      firstNam eAD = (sta ffADResult s.getFirst Name() ==  null)?"":s taffADResu lts.getFir stName();
  678                                      lastName AD = (staf fADResults .getLastNa me() == nu ll)?"":sta ffADResult s.getLastN ame();
  679                                      phoneAD  = (staffAD Results.ge tTelephone Number() = = null)?"" :staffADRe sults.getT elephoneNu mber();
  680                                      titleAD  = (staffAD Results.ge tTitle() = = null)?"" :staffADRe sults.getT itle();
  681                                      emailAD  = (staffAD Results.ge tEmail() = = null)?"" :staffADRe sults.getE mail();
  682                                      setSessi onAttribut e("email", emailAD);
  683                                      networkI dAD = netw orkId;
  684                                      this.set Email(emai lAD);
  685                                      staffADR esults.set UserName(n etworkId);
  686                             }
  687                    }cat ch(Excepti on e){
  688                             if(log .isErrorEn abled()){
  689                                      log.erro r("verifyW ithADResul ts()=>"+e. getMessage () );
  690                                      e.printS tackTrace( );
  691                             }
  692                             addAct ionError(" Error occu rred while  accessing  the activ e director y.");
  693                    }
  694  
  695                    setS essionAttr ibute("sta ffADResult s",staffAD Results);
  696  
  697                    retu rn SUCCESS ;
  698           }
  699  
  700           pu blic Strin g assignSt affMemberT ype(){
  701  
  702    
  703                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  704                    getU serInforma tion();
  705                    getS taffSessio nAttr();
  706  
  707                    if(i sNewSearch ()){ retur n SELECT_S TAFF; }
  708                    duz  = (String) getSession Attribute( "duz");
  709                    staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion();
  710                    retu rn SUCCESS ;
  711           }
  712  
  713           pu blic Strin g activate StaffMembe r(){
  714  
  715                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  716  
  717                    getS taffSessio nAttr();
  718  
  719                    if(i sNewSearch ()){ retur n SELECT_S TAFF; }
  720  
  721                    Clin icalUserTy pe clinica lUserType  = null;
  722                    bool ean userTy peSelected  = false;
  723                    duz  = (String) getSession Attribute( "duz");
  724                    Stri ng station Number = ( String)get SessionAtt ribute("st ationNumbe r");
  725                    User InfoDTO se lectedVist aUser = (U serInfoDTO )getSessio nAttribute ("selected VistaUser" );
  726                    ADQu eryResult  adr = (ADQ ueryResult )getSessio nAttribute ("staffADR esults");
  727  
  728                    staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion();
  729                    if(s taffMember Types != n ull){
  730                             for(Cl inicalUser Type cu: s taffMember Types){
  731                                      if((cu.g etId()).eq uals(membe rTypeId)){
  732                                               clinicalUs erType = c u;
  733                                               memberType  = cu.getN ame();
  734                                               userTypeSe lected = t rue;
  735                                      }
  736                             }
  737                    }
  738                    if(! userTypeSe lected){
  739                             addAct ionError(" Please sel ect a user  type.");
  740                             getUse rInformati on();
  741                             setSes sionAttrib ute("email ",getEmail ());
  742                             return  FAILED;
  743                    }
  744  
  745                    if(g etEmail()= =null || g etEmail(). equals("") ){
  746                             addAct ionError(" Email Addr ess cannot  be blank. ");
  747                             return  FAILED;
  748                    }
  749                    else
  750                    {
  751                             EmailV alidator e mailValida tor = Emai lValidator .getInstan ce();
  752                             if(!em ailValidat or.isValid (email)){
  753                                      addActio nError(ESA PI.encoder ().encodeF orHTML(ema il) + " is  not a Val id Email A ddress.");
  754                                      setEmail (getEmail( ));
  755                                      setSessi onAttribut e("email", getEmail() );
  756                                      return F AILED;
  757                             }
  758                             else
  759                             {
  760                                      adr.setE mail(getEm ail());
  761                                      setSessi onAttribut e("email", getEmail() );
  762                             }
  763                    }
  764  
  765                    Admi nistrator  admin = (A dministrat or)getSess ionAttribu te(CURRENT _USER);
  766                    Clin ician clin  = null;
  767  
  768                    try{
  769                             Servic eResponse< Clinician>  response  = getAdmin Service(). activateNe wProvider( stationNum ber, selec tedVistaUs er, adr,cl inicalUser Type, admi n);
  770                             clin =  response. getPayload ();
  771                    }cat ch(Excepti on exp3){
  772                             if(log .isErrorEn abled()){
  773                                      log.erro r("activat eStaffMemb er()=>Exce ption occu red while  active sta ff member" +exp3);
  774                             }
  775                    }
  776  
  777                    if ( clin == nu ll){
  778                             addAct ionError(" An unexpec ted error  has occurr ed. Please  contact t he Help De sk, if the  problem p ersists.") ;
  779                             return  FAILED;
  780                    }
  781                    getU serInforma tion();
  782                    retu rn SUCCESS ;
  783           }
  784  
  785           pu blic Strin g activate AnotherSta ffMember() {
  786  
  787                    firs tName=null ;
  788                    last Name=null;
  789                    duz= null;
  790                    if(( selectActi on!=null)  && ((selec tAction.tr im()).equa lsIgnoreCa se("Done") )){
  791                             clearS essionAttr ();
  792                             return  CANCEL;
  793                    }
  794                    getS taffSessio nAttr();
  795  
  796                    retu rn SELECT_ STAFF;
  797           }
  798  
  799  
  800           pu blic Strin g showMemb erDetails( ){
  801  
  802                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  803                    Clin ician clin  = null;
  804                    try{
  805                             duz =  (getParame ter("duz")  == null)? "":getPara meter("duz ");
  806                             if(duz  == null){
  807                                      addActio nError("Co uld not fi nd DUZ for  the selec ted user." );
  808                             }
  809                             List<C linician>  searchedUs ers = (Lis t<Clinicia n>)getSess ionAttribu te("clinic ians");
  810                             if(sea rchedUsers  != null){
  811                                      for(Clin ician u:se archedUser s){
  812                                               if(duz.equ alsIgnoreC ase(u.getD uz())){
  813                                                       cl in = u;
  814                                               }
  815                                      }
  816                             }
  817                             if(cli n != null) {
  818                                      firstNam e = (clin. getFirstNa me() == nu ll)?"":cli n.getFirst Name();
  819                                      lastName  = (clin.g etLastName () == null )?"":clin. getLastNam e();
  820                                      networkI d = (clin. getUsernam e() == nul l)?"":clin .getUserna me(); 
  821                                      middleNa me = (clin .getMiddle Name() ==  null)?"":c lin.getMid dleName();  
  822                                      title =  (clin.getT itle() ==  null)?"":c lin.getTit le();
  823                                      phone =( clin.getPh one() == n ull)?"":cl in.getPhon e(); 
  824                                      suffix =  (clin.get Suffix() = = null)?"" :clin.getS uffix();
  825                                      prefix = (clin.getP refix() ==  null)?"": clin.getPr efix();
  826                                      if(clin. getProvide rVistAActi veFlag()!= null) acti veFlag = c lin.getPro viderVistA ActiveFlag ().equals( "0")?"ACTI VE":"INACT IVE";
  827                                      requires CoSigner =  clin.getR equiresCos igner();
  828                                      if(clin. getProvide rPcmmFlag( )!=null) p cmmFlag =  clin.getPr oviderPcmm Flag().equ als("1")?" YES":"NO";
  829                                      personCl ass = clin .getPerson Class()!=n ull?clin.g etPersonCl ass():"";
  830                                      if(clin. getProvide r()!=null)  providerK ey = clin. getProvide r().equals IgnoreCase ("1")?"TRU E":"FALSE" ;
  831                                      provider Class = cl in.getProv iderClass( );
  832                                      if(clin. getDmmsUni ts()!=null ) dssUnits  = StringU tils.split (clin.getD mmsUnits() ,DATA_DELI MITER);
  833                                      Clinical UserType c u = (Clini calUserTyp e)clin.get ClinicalUs erType();
  834                                      if(cu !=  null){
  835                                               memberType  = (cu.get Name() ==  null)?"":c u.getName( );
  836                                      }
  837                             }
  838                             setSes sionAttrib ute("selec tedUser",c lin);
  839                             setSes sionAttrib ute("duz", duz);
  840                    }cat ch(Excepti on e){
  841                             if(log .isErrorEn abled()){
  842                                      log.erro r("showMem berDetails ()=>Except ion occurr ed while g etting sel ected user  details." );
  843                                      e.printS tackTrace( );
  844                             }
  845                    }
  846  
  847                    retu rn SUCCESS ;
  848  
  849           }
  850  
  851  
  852           pu blic Strin g inactiva teReactiva teMember() {
  853  
  854                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  855  
  856                    if(i sSearchRes ults()) 
  857                    {        
  858                             return  SEARCH_RE SULTS; 
  859                    }
  860                    
  861                    getS taffSessio nAttr();
  862  
  863                    if(i sNewSearch ()){ retur n SELECT_S TAFF; }
  864                    Stri ng activat ionType =  (String)ge tSessionAt tribute("a ctivationT ype");
  865                    try  {
  866                             Clinic ian c = (C linician)g etSessionA ttribute(" selectedUs er");
  867                             if(c ! = null){
  868                                      if((acti vationType  != null)  && (activa tionType.e qualsIgnor eCase("ina ctivate")) ){
  869                                               c = (Clini cian) user Management Service.in activateRe activateCl inician(c,  false).ge tPayload() ;
  870                                      }else if ((activati onType !=  null) && ( activation Type.equal sIgnoreCas e("reactiv ate"))){
  871                                               c = (Clini cian) user Management Service.in activateRe activateCl inician(c,  true).get Payload();
  872                                      }
  873                             }
  874                    } ca tch (Excep tion e) {
  875                             log.in fo("Except ion occurr ed while i nactivatin g the sele cted user. ");
  876                             addAct ionError(" Error occu rred while  inactivat ing the se lected use r.");
  877                    }
  878  
  879                    retu rn SUCCESS ;
  880  
  881           }
  882  
  883           pu blic Strin g inactiva tionReacti vationComp lete(){
  884  
  885                    clea rSessionAt tr();
  886                    retu rn CANCEL;
  887  
  888           }
  889  
  890           pu blic Strin g bulkActi vation() {
  891                    if(a ppliedCanc el()){ ret urn CANCEL ;     }
  892                    clea rSessionAt tr();
  893                    List <User> sta ffMembers=  new Array List<User> ();
  894                    bool ean activa tionSucces s = true;
  895                    try{
  896  
  897                             log.in fo(LogSani tizer.clea nText("fil e name: "  + uploadFi leName));
  898                             upload FileName =  (uploadFi leName ==  null)?"":u ploadFileN ame;
  899                             if(upl oadFileNam e.equals(" ")){
  900                                      if(!chec kFileSizeM essage()){
  901                                               addActionE rror("Plea se select  a file");
  902                                      }
  903                                      return F AILED;
  904                             }
  905                             log.in fo(LogSani tizer.clea nText("Con tent type:  " + getUp loadConten tType()));
  906                             Object  rawConten t = getUpl oad().toUR L().getCon tent();
  907  
  908                             InputS tream is =  (InputStr eam)rawCon tent;
  909                             Reader  reader =  new InputS treamReade r(is);
  910                             String Builder co ntent = ne w StringBu ilder();
  911                             int re ad = 0;
  912                             while  ( read > - 1 ) {
  913                                      char[] b uffer = ne w char[102 4];
  914                                      read = r eader.read (buffer);
  915                                      content. append(buf fer);
  916                                      if(FILE_ SIZE_LIMIT _2MB<conte nt.length( )) {
  917                                               addActionE rror(FILE_ SIZE_LIMIT _ERROR);
  918                                               return FAI LED;
  919                                      }
  920                             }
  921                             if(log .isInfoEna bled()){
  922                                      log.info (LogSaniti zer.cleanT ext("Conte nts:\n" +  content.to String().t rim()));
  923                             }
  924                             String  fileConte nt = conte nt.toStrin g().trim() ;
  925                             if(fil eContent.l ength() ==  0){
  926                                      addActio nError("Th e bulk add ition of u ser record s failed"  +
  927                                                       "  because of  the follo wing recor ds. " +
  928                                                       "C orrect the se records  and repea t bulk add ition:");
  929  
  930                                      addActio nError("Li ne 1-incor rectly for matted.");
  931                                      addActio nError("No  Secure Me ssaging St aff Member s have bee n activate d.");
  932                                      return F AILED;
  933                             }
  934                             String [] rows =  fileConten t.split("\ r\n");
  935                             //Vali date the B ulk Record  File
  936                             if(val idateBulkR ecordFile( rows)){
  937                                      addActio nError("No  Secure Me ssaging St aff Member s have bee n activate d.");
  938                                      return F AILED;
  939                             }else{
  940                                      String r ecordType;
  941                                      String f irstName;
  942                                      String l astName;
  943                                      String s tationNumb er;
  944                                      added=0;
  945                                      int line Number = 0 ;
  946                                      for (int  i=0; i<ro ws.length;  i++){
  947                                               log.info(L ogSanitize r.cleanTex t("Line" +  i + ":" +  rows[i])) ;
  948                                               String row Data = row s[i];
  949                                               String[] f ields = ro wData.spli t(",");
  950                                               recordType   = fields [0].trim() ;
  951                                               firstName   = fields[ 1].trim();
  952                                               lastName   = fields[2 ].trim();
  953                                               duz  = fie lds[3].tri m();
  954                                               stationNum ber  = fie lds[4].tri m();
  955                                               networkId   = fields[ 5].trim();
  956                                               Long clini calUserTyp eId  = Lon g.valueOf( fields[6]. trim());
  957                                               lineNumber  = i + 1;
  958                                               log.info(L ogSanitize r.cleanTex t("firstNa me= "+firs tName));
  959                                               log.info(L ogSanitize r.cleanTex t("lastNam e= "+lastN ame));
  960                                               log.info(L ogSanitize r.cleanTex t("duz:" +  duz.toStr ing()));
  961                                               log.info(L ogSanitize r.cleanTex t("station Number:" +  stationNu mber.toStr ing()));
  962                                               log.info(L ogSanitize r.cleanTex t("clinica lUserTypeI d:" + clin icalUserTy peId.toStr ing()));
  963                                               log.info(L ogSanitize r.cleanTex t("network Id:" + net workId.toS tring()));
  964                                               boolean is Added = ac tivateBulk StaffMembe r(lineNumb er, duz,st ationNumbe r, clinica lUserTypeI d, network Id, firstN ame, lastN ame);
  965                                               if(isAdded ){
  966                                                       ad ded++;
  967                                               }
  968                                               activation Success =  activation Success &&  isAdded;
  969                                      }
  970                             }
  971                    }cat ch (java.i o.FileNotF oundExcept ion e)         {
  972                             addAct ionError(" The bulk a ddition of  user reco rds failed " +
  973                                               " because  of the fol lowing rec ords. " +
  974                                               "Correct t hese recor ds and rep eat bulk a ddition:") ;
  975  
  976                             addAct ionError(" Line 1-inc orrectly f ormatted." );
  977                             addAct ionError(" No Secure  Messaging  Staff Memb ers have b een activa ted.");
  978                             log.er ror(e);
  979                             return  FAILED;
  980  
  981                    } ca tch(Except ion e) {
  982                             log.er ror(e);
  983                             return  FAILED;
  984                    }
  985  
  986                    if(a ctivationS uccess){
  987                             return  SUCCESS;
  988                }else{
  989                    retu rn FAILED;
  990                }
  991           }
  992  
  993           /* *
  994            *  There are  two limit s for file  upload si ze struts. multipart. maxSize an d maximumS ize in the  action
  995            *  intercept or. The pr oblem is f or bug :53 91 providi ng custom  message is  not easy  as the
  996            *  error mes sage is ha rdcoded in  MultiPart Request. I n the foll owing code  the excep tion is
  997            *  trapped a nd replace d with the  message a s stated i n specific ation.
  998            * /
  999  
  1000           pr ivate bool ean checkF ileSizeMes sage() {
  1001                    bool ean hasSiz eError = f alse;
  1002                    Coll ection<?>  tmp = getA ctionError s();
  1003                    if(t mp!= null) {
  1004                             Collec tion<Strin g> errors  = new Arra yList<Stri ng>();
  1005                             for (O bject o :  tmp) {
  1006                                      if(o !=  null){
  1007                                           if  (o.toStrin g().contai ns("the re quest was  rejected b ecause its  size")) {
  1008                                             h asSizeErro r = true;
  1009                                             e rrors.add( FILE_SIZE_ LIMIT_ERRO R);
  1010                                           } e lse {
  1011                                             e rrors.add( o.toString ());
  1012                                           }
  1013                                      }
  1014                             }
  1015  
  1016                             setAct ionErrors( errors);
  1017                    }
  1018                    retu rn hasSize Error;
  1019           }
  1020  
  1021           /*
  1022            *  Validate  the Bulk R ecord File , it is a  Comma Sepa rated Valu es (CSV) f ile where  each row i s expected  to
  1023            *  have a ce rtain numb er and typ e of field s. Text fi elds are e nclosed in  quotes.
  1024            *  BR3902 Th e Bulk Rec ord Schema
  1025            *  Retruns t rue if fil e is not f ormating i s wrong.
  1026            *  C,FNAME,L NAME,DUZ,S TATION_NO, EXTERNAL_U SERNAME,CL INICAL_USE R_TYPE_ID
  1027            C,JOHN,DOE ,12345,994 ,         JDOE,1
  1028            * /
  1029           pr ivate bool ean valida teBulkReco rdFile(Str ing[] rows ){
  1030                    //ke ep track o f duplicat es in curr ent file u sers
  1031                    Map  currentFil eUsers = n ew HashMap ();
  1032  
  1033                    bool ean fileFa iled = fal se;
  1034                    for  (int i=0;  i<rows.len gth; i++){
  1035  
  1036                             log.in fo(LogSani tizer.clea nText("Lin e" + i + " :" + rows[ i]));
  1037                             boolea n failed =  false;
  1038                             int li neNumber =  i + 1;
  1039                             String  rowData =  rows[i];
  1040                             String [] fields  = rowData. split(",") ;
  1041                             //chec k if this  row has al l fields
  1042                             if(fie lds.length  == 7){
  1043                                      String l recordType   = fields [0].trim() ;
  1044                                      //check  if Record  Type is no t null and  maximum l ength is 1
  1045                                      if(lreco rdType== n ull || lre cordType.l ength() >1 ){
  1046                                               failed = t rue;
  1047                                      }
  1048                                      //check  first name
  1049                                      String l firstName   = fields[ 1].trim();
  1050                                      if(lfirs tName == n ull || lfi rstName.le ngth() >50 ){
  1051                                               failed = t rue;
  1052                                      }
  1053                                      //check  last name
  1054                                      String l lastName   = fields[2 ].trim();
  1055                                      if(llast Name == nu ll || llas tName.leng th() >50){
  1056                                               failed = t rue;
  1057                                      }
  1058                                      //check  DUZ
  1059                                      String l duz  = fie lds[3].tri m();
  1060                                      if(lduz  == null ||  lduz.leng th() >20){
  1061                                               failed = t rue;
  1062                                      }
  1063                                      //check  STATION_NO
  1064                                      String l stationNum ber  = fie lds[4].tri m();
  1065                                      if(lstat ionNumber  == null ||  lstationN umber.leng th() >10){
  1066                                               failed = t rue;
  1067                                      }
  1068                                      //check  EXTERNAL_U SER_NAME
  1069                                      String l networkId   = fields[ 5].trim();
  1070                                      if(lnetw orkId == n ull || lne tworkId.le ngth() >50 ){
  1071                                               failed = t rue;
  1072                                      }
  1073                                      //check  CLINICAL_U SER_TYPE_I D
  1074                                      try{
  1075                                               Long lclin icalUserTy peId  = Lo ng.valueOf (fields[6] .trim());
  1076                                               if(lclinic alUserType Id == null ){
  1077                                                       fa iled = tru e;
  1078                                               }
  1079                                      }catch(j ava.lang.N umberForma tException  ex){
  1080                                               //the clin ical user  type if is  not a num ber.
  1081                                               failed = t rue;
  1082                                      }
  1083  
  1084                                      //if fai led becaus e of forma t
  1085                                      if(faile d){
  1086                                               if(!fileFa iled){
  1087                                                       fi leFailed =  true;
  1088                                                       ad dActionErr or("The bu lk additio n of user  records fa iled" +
  1089                                                                         " beca use of the  following  records.  " +
  1090                                                                         "Corre ct these r ecords and  repeat bu lk additio n:");
  1091                                               }
  1092                                               addActionE rror("Line  " + lineN umber + "- incorrectl y formatte d.");
  1093                                      }else{
  1094                                               String tmp StationNum ber = (Str ing)curren tFileUsers .get(lnetw orkId);
  1095  
  1096                                               if(tmpStat ionNumber! =null){
  1097                                                       if (tmpStatio nNumber.eq uals(lstat ionNumber) ){
  1098                                                                if(! fileFailed ){
  1099                                                                         fileFa iled = tru e;
  1100                                                                         addAct ionError(" The bulk a ddition of  user reco rds failed " +
  1101                                                                                           " because  of the fol lowing rec ords. " +
  1102                                                                                           "Correct t hese recor ds and rep eat bulk a ddition:") ;
  1103                                                                }
  1104                                                                addA ctionError ("Line " +  lineNumbe r + "- Dup licate Net work ID "  +lnetworkI d +
  1105                                                                                              " is al ready list ed in this  file at t his statio n by" +
  1106                                                                                              " staff  member "  +
  1107                                                                                              ESAPI.e ncoder().e ncodeForHT ML(lfirstN ame)+","+E SAPI.encod er().encod eForHTML(l lastName)) ;
  1108  
  1109                                                       }
  1110  
  1111  
  1112                                               }else{
  1113                                                       cu rrentFileU sers.put(l networkId, lstationNu mber);
  1114                                               }
  1115  
  1116  
  1117                                               //ensure t hat you ca n never ac tivate new  staff mem bers that  have the s ame extern al_user_na me and sta tion_no
  1118                                               Clinician  existingCl inician =  userDao.fi ndClinicia nByStation AndUsernam e(lstation Number, ln etworkId);
  1119                                               if (existi ngClinicia n != null)  {
  1120                                                       if (!fileFail ed){
  1121                                                                file Failed = t rue;
  1122                                                                addA ctionError ("The bulk  addition  of user re cords fail ed" +
  1123                                                                                  " becaus e of the f ollowing r ecords. "  +
  1124                                                                                  "Correct  these rec ords and r epeat bulk  addition: ");
  1125                                                       }
  1126                                                       ad dActionErr or("Line "   + lineNu mber + "-  Network ID  " +lnetwo rkId +
  1127                                                                                     " is  already in  use at th is station  by " +
  1128                                                                                     (exis tingClinic ian.isActi ve() ? "ac tive" : "i nactive")  +
  1129                                                                                     " sta ff member  " +
  1130                                                                                     exist ingClinici an.getName ());
  1131  
  1132                                               }
  1133                                      }
  1134                             }else{
  1135                                      if(!file Failed){
  1136                                               fileFailed  = true;
  1137                                               addActionE rror("The  bulk addit ion of use r records  failed" +
  1138                                                                " be cause of t he followi ng records . " +
  1139                                                                "Cor rect these  records a nd repeat  bulk addit ion:");
  1140                                      }
  1141                                      addActio nError("Li ne " + lin eNumber +  "-incorrec tly format ted.");
  1142                             }
  1143                    }
  1144                    retu rn fileFai led;
  1145  
  1146           }
  1147  
  1148           pu blic boole an activat eBulkStaff Member(int  lineNumbe r, String  duz,String  stationNu mber, Long  clinicalU serTypeId,  String ne tworkId, S tring firs tName, Str ing lastNa me){
  1149                    bool ean succes sfullyActi vated = tr ue;
  1150  
  1151                    Clin ician clin  = null;
  1152                    Admi nistrator  admin = (A dministrat or)getSess ionAttribu te(CURRENT _USER);
  1153                    log. info("Admi n isNation al???..... ...."+admi n.isNation al());
  1154  
  1155                    bool ean permis sion = fal se;
  1156  
  1157                    //If  logged-in  user is N ational Ad min, they  have right s to manag e the any  facility u ser.
  1158                    if(a dmin.isNat ional()){
  1159                             permis sion = tru e;
  1160                    }
  1161  
  1162                    // I f logged-i n user is  VISN Admin , they hav e rights t o manage a ny facilit ies under  the visn.
  1163                    if(a dmin.getVi sns() !=nu ll) {
  1164                             log.in fo("admin. getVisins( )......"+a dmin.getVi sns());
  1165                             for (F acility vi sn: admin. getVisns() )
  1166                             {
  1167                                      Collecti on<Facilit y> facilit ies = getF acilitySer vice().get Facilities ForVisn(vi sn).getCol lection();
  1168                                      for(Faci lity f1 :  facilities ){
  1169                                               log.info(" f1.getId() ...."+f1.g etId());
  1170                                               log.info(" f1.getName ...."+f1.g etName());
  1171                                               log.info(" f1.getStat ionNumber( )......."+ f1.getStat ionNumber( ));
  1172                                               if(f1.getS tationNumb er().equal sIgnoreCas e(stationN umber)){
  1173                                                       pe rmission =  true;
  1174                                                       br eak;
  1175                                               }
  1176                                      }
  1177                             }
  1178                    }
  1179  
  1180                    // I f logged-i n user is  Facility A dmin, they  have righ ts to mana ge only th e associat ed user fa cilities.
  1181                    for( Facility f :admin.get Facilities ()) {
  1182                             if( f. getStation Number().e qualsIgnor eCase(stat ionNumber)  ) {
  1183                                      permissi on = true;
  1184                                      break;
  1185                             }
  1186                    }
  1187  
  1188                    log. info("perm ission.... ....."+per mission);
  1189  
  1190  
  1191                    if(  !permissio n ) {
  1192                             addAct ionError(" Line " + l ineNumber  + ": The s taff membe r's facili ty doesn't  match a f acility yo u can mana ge.");
  1193                             succes sfullyActi vated = fa lse;
  1194                    }
  1195  
  1196                    User  selectedV istaUser =  null;
  1197                    List <User> sta ffMembers=  new Array List<User> ();
  1198                    Coll ectionServ iceRespons e<User> re sponse = g etAdminSer vice().fin dVistaClin ician(duz,  stationNu mber);
  1199                    hand leErrorMes sages(resp onse.getMe ssages());
  1200                    staf fMembers =  (List<Use r>)respons e.getColle ction();
  1201                    if(s taffMember s == null) {
  1202                             addAct ionError(" Line " + l ineNumber  + ": A sea rch of the  VistA dat abase did  not produc e a match  for the in formation  given.");
  1203                             succes sfullyActi vated = fa lse;
  1204                    }els e{
  1205                             for(Us er u:staff Members){
  1206                                               if(duz.equ alsIgnoreC ase(u.getI EN())){
  1207                                               selectedVi staUser =  u;
  1208                                      }
  1209                             }
  1210                    }
  1211                    if(s electedVis taUser ==  null){
  1212                             addAct ionError(" Line " + l ineNumber  + ": A sea rch of the  VistA dat abase did  not produc e a match  for the in formation  given.");
  1213                             succes sfullyActi vated = fa lse;
  1214                    }
  1215  
  1216                    Clin icalUserTy pe clinica lUserType  = null;
  1217                    staf fMemberTyp es = (List <ClinicalU serType>)g etAdminSer vice().get ClinicalUs erTypes(). getCollect ion();
  1218                    if(s taffMember Types != n ull){
  1219                             for(Cl inicalUser Type cu: s taffMember Types){
  1220                                      if((cu.g etId()).eq uals(clini calUserTyp eId)){
  1221                                               clinicalUs erType = c u;
  1222                                      }
  1223                             }
  1224                    }
  1225                    if(c linicalUse rType == n ull){
  1226                             log.in fo("clinic alUserType : Null");
  1227                             addAct ionError(" Line " + l ineNumber  + ": A sea rch for cl inical use r type cou ld not pro duce a mat ch");
  1228                             succes sfullyActi vated = fa lse;
  1229                    }
  1230  
  1231                    ADQu eryResult  staffADRes ults = nul l;
  1232                    Serv iceRespons e<ADQueryR esult> fin dADAccount Response =  getAdminS ervice().f indADAccou nt(network Id);
  1233                    staf fADResults  = findADA ccountResp onse.getPa yload();
  1234                    if(s taffADResu lts == nul l){
  1235                             log.in fo("AD Res ults: Null ");
  1236                             addAct ionError(" Line " + l ineNumber  + ": An Em ail Addres s could no t be found  in Outloo k using th e VistA se arch resul ts.");
  1237                             succes sfullyActi vated = fa lse;
  1238                    }els e{
  1239                             staffA DResults.s etUserName (networkId );
  1240                    }
  1241  
  1242                    if(n ull!=staff ADResults  && null!=s taffADResu lts.getFir stName() & & !staffAD Results.ge tFirstName ().equalsI gnoreCase( firstName)  ) {
  1243  
  1244                             log.in fo(LogSani tizer.clea nText("AD  firstname  didn't mat ch bulk re cord: " +  staffADRes ults.getFi rstName()  + ", " + f irstName)) ;
  1245                             addAct ionError(" Line " + l ineNumber  + ": " + ( lastName== null?"null ":ESAPI.en coder().en codeForHTM L(lastName )) + ", "  + ESAPI.en coder().en codeForHTM L(firstNam e) + " is  not recogn ized as an  Outlook e mail accou nt.");
  1246                             succes sfullyActi vated = fa lse;
  1247                    }
  1248  
  1249                    if(n ull!=staff ADResults  && !staffA DResults.g etLastName ().equalsI gnoreCase( lastName)  ) {
  1250                             log.in fo(LogSani tizer.clea nText("AD  lastname d idn't matc h bulk rec ord: " + s taffADResu lts.getLas tName() +  ", " + las tName));
  1251                             addAct ionError(" Line " + l ineNumber  + ": " + E SAPI.encod er().encod eForHTML(l astName) +  ", " + (f irstName== null?"null ":ESAPI.en coder().en codeForHTM L(firstNam e)) + " is  not recog nized as a n Outlook  email acco unt.");
  1252                             succes sfullyActi vated = fa lse;
  1253                    }
  1254  
  1255                    if(s taffADResu lts.getEma il()!=null  && !staff ADResults. getEmail() .equals("" )){
  1256                             EmailV alidator e mailValida tor = Emai lValidator .getInstan ce();
  1257                             if(!em ailValidat or.isValid (staffADRe sults.getE mail())){
  1258                                      addActio nError("Li ne " + lin eNumber +   ": Outloo k Email Ad dress is i nvalid.");
  1259                                      successf ullyActiva ted = fals e;
  1260                             }
  1261                    }
  1262                    else
  1263                    {
  1264                             addAct ionError(" Line "+ li neNumber +  ": Outloo k Email Ad dress can' t be blank .");
  1265                             succes sfullyActi vated = fa lse;
  1266                    }
  1267  
  1268                    try  {
  1269                             if( tr ue == succ essfullyAc tivated )  {
  1270                                      ServiceR esponse<Cl inician> r esponse1 =  getAdminS ervice().c reateClini cianAccoun t(stationN umber, sel ectedVista User, staf fADResults , clinical UserType,  admin);
  1271                                      clin = r esponse1.g etPayload( );
  1272                             }
  1273                    } ca tch(Except ion e){
  1274                             succes sfullyActi vated = fa lse;
  1275                             log.er ror( e.get Message()  );
  1276                    }
  1277  
  1278                    if ( clin == nu ll){
  1279                             addAct ionError(" Line " + l ineNumber  + ": Error  occurred  while acti vating the  account." );
  1280                             succes sfullyActi vated = fa lse;
  1281                    }
  1282  
  1283                    retu rn success fullyActiv ated;
  1284           }
  1285  
  1286           pu blic Strin g bulkActi vationComp lete() {
  1287  
  1288                    clea rSessionAt tr();
  1289                    if(( selectActi on!=null)  && ((selec tAction.tr im()).equa lsIgnoreCa se("Done") )){
  1290                             return  CANCEL;
  1291                    }
  1292  
  1293                    retu rn SUCCESS ;
  1294           }
  1295  
  1296  
  1297           pu blic void  getStaffSe ssionAttr( ){
  1298  
  1299                    if(( (Collectio n<Facility >)getSessi onAttribut e("facilit ies")) !=  null){
  1300                             facili ties = (Co llection<F acility>)g etSessionA ttribute(" facilities ");
  1301                    }els e{
  1302                             facili ties = new  ArrayList <Facility> ();
  1303                    }
  1304                    if(( (String)ge tSessionAt tribute("s electedVis nName")) ! = null){
  1305                             select edVisnName  = (String )getSessio nAttribute ("selected VisnName") ;
  1306                    }
  1307                    if(( (String)ge tSessionAt tribute("s electedFac ilityName" )) != null ){
  1308                             select edFacility Name = (St ring)getSe ssionAttri bute("sele ctedFacili tyName");
  1309                    }
  1310  
  1311           }
  1312  
  1313           pu blic void  clearSessi onAttr(){
  1314                    remo veSessionA ttribute(" facilities ");
  1315                    remo veSessionA ttribute(" selectedVi snName");
  1316                    remo veSessionA ttribute(" selectedFa cilityName ");
  1317                    remo veSessionA ttribute(" stationNum ber");
  1318                    remo veSessionA ttribute(" staffMembe rs");
  1319                    remo veSessionA ttribute(" activation Type");
  1320                    remo veSessionA ttribute(" selectedVi staUser");
  1321           }
  1322  
  1323           pu blic boole an applied Cancel() {
  1324  
  1325                    if(( selectActi on!=null)  && ((selec tAction.tr im()).equa lsIgnoreCa se("Cancel ")||(selec tAction.tr im().equal sIgnoreCas e("Exit")) )){
  1326                             clearS essionAttr ();
  1327                             return  true;
  1328                    }
  1329                    retu rn false;
  1330  
  1331           }
  1332  
  1333           pu blic boole an isNewSe arch() {
  1334  
  1335                    if(( selectActi on!=null)  && ((selec tAction.tr im()).equa lsIgnoreCa se("New Se arch"))){
  1336                             firstN ame=null;
  1337                             lastNa me=null;
  1338                             duz=nu ll;
  1339                             remove SessionAtt ribute("se lectedVist aUser");
  1340                             return  true;
  1341                    }
  1342                    retu rn false;
  1343  
  1344           }
  1345           
  1346           pu blic boole an isSearc hResults() {
  1347                    if(( selectActi on!=null)  && ((selec tAction.tr im()).equa lsIgnoreCa se("Back") )){
  1348                             return  true;
  1349                    }
  1350                    retu rn false;
  1351           }
  1352  
  1353  
  1354           pu blic void  setVisns(C ollection< Facility>  visns) {
  1355                             this.v isns = vis ns;
  1356           }
  1357  
  1358           pu blic Colle ction<Faci lity> getV isns() {
  1359                             return  visns;
  1360           }
  1361  
  1362           pu blic void  setFacilit ies(Collec tion<Facil ity> facil ities) {
  1363                             this.f acilities  = faciliti es;
  1364           }
  1365  
  1366           pu blic Colle ction<Faci lity> getF acilities( ) {
  1367                             return  this.faci lities;
  1368           }
  1369  
  1370           pu blic void  setSelecte dVisnName( String sel ectedVisnN ame) {
  1371                             this.s electedVis nName = se lectedVisn Name;
  1372           }
  1373  
  1374           pu blic Strin g getSelec tedVisnNam e() {
  1375                             return  selectedV isnName;
  1376           }
  1377  
  1378           pu blic void  setSelecte dFacilityN ame(String  selectedF acilityNam e) {
  1379                             this.s electedFac ilityName  = selected FacilityNa me;
  1380           }
  1381  
  1382           pu blic Strin g getSelec tedFacilit yName() {
  1383                             return  selectedF acilityNam e;
  1384           }
  1385  
  1386           pu blic void  setVisnId( Long visnI d) {
  1387                             this.v isnId = vi snId;
  1388           }
  1389  
  1390           pu blic Long  getVisnId( ) {
  1391                             return  this.visn Id;
  1392           }
  1393  
  1394           pu blic void  setFacilit yId(Long f acilityId)  {
  1395                             this.f acilityId  = facility Id;
  1396           }
  1397  
  1398           pu blic Long  getFacilit yId() {
  1399                             return  this.faci lityId;
  1400           }
  1401  
  1402           pu blic void  setClinici ans(List<C linician>  clinicians ) {
  1403                             this.c linicians  = clinicia ns;
  1404           }
  1405  
  1406           pu blic List< Clinician>  getClinic ians() {
  1407                             return  clinician s;
  1408           }
  1409  
  1410           pu blic void  setSelectA ction(Stri ng selectA ction) {
  1411                    this .selectAct ion = sele ctAction;
  1412           }
  1413  
  1414           pu blic Strin g getSelec tAction()  {
  1415                    retu rn selectA ction;
  1416           }
  1417  
  1418           pu blic void  setSelecte dUsers(Lis t<Clinicia n> selecte dUsers) {
  1419                             this.s electedUse rs = selec tedUsers;
  1420           }
  1421  
  1422           pu blic List< Clinician>  getSelect edUsers()  {
  1423                             return  selectedU sers;
  1424           }
  1425  
  1426           pu blic void  setSearchC rit(String  searchCri t) {
  1427                             this.s earchCrit  = searchCr it;
  1428           }
  1429  
  1430           pu blic Strin g getSearc hCrit() {
  1431                             return  searchCri t;
  1432           }
  1433  
  1434           pu blic void  setDuz(Str ing duz) {
  1435                             this.d uz = duz;
  1436           }
  1437  
  1438           pu blic Strin g getDuz()  {
  1439                             return  duz;
  1440           }
  1441  
  1442           pu blic void  setFirstNa me(String  firstName)  {
  1443                             this.f irstName =  firstName ;
  1444           }
  1445  
  1446           pu blic Strin g getFirst Name() {
  1447                             return  firstName ;
  1448           }
  1449  
  1450           pu blic void  setLastNam e(String l astName) {
  1451                             this.l astName =  lastName;
  1452           }
  1453  
  1454           pu blic Strin g getLastN ame() {
  1455                             return  lastName;
  1456           }
  1457  
  1458           pu blic void  setPhone(S tring phon e) {
  1459                             this.p hone = pho ne;
  1460           }
  1461  
  1462           pu blic Strin g getPhone () {
  1463                             return  phone;
  1464           }
  1465  
  1466           pu blic void  setTitle(S tring titl e) {
  1467                             this.t itle = tit le;
  1468           }
  1469  
  1470           pu blic Strin g getTitle () {
  1471                             return  title;
  1472           }
  1473  
  1474           pu blic void  setNetwork Id(String  networkId)  {
  1475                             this.n etworkId =  networkId ;
  1476           }
  1477  
  1478           pu blic Strin g getNetwo rkId() {
  1479                             return  networkId ;
  1480           }
  1481  
  1482           pu blic void  setStaffMe mberTypes( List<Clini calUserTyp e> staffMe mberTypes)  {
  1483                             this.s taffMember Types = st affMemberT ypes;
  1484           }
  1485  
  1486           pu blic List< ClinicalUs erType> ge tStaffMemb erTypes()  {
  1487                             return  staffMemb erTypes;
  1488           }
  1489  
  1490           pu blic void  setMemberT ypeId(Long  memberTyp eId) {
  1491                             this.m emberTypeI d = member TypeId;
  1492           }
  1493  
  1494           pu blic Long  getMemberT ypeId() {
  1495                             return  memberTyp eId;
  1496           }
  1497  
  1498           pu blic void  setMemberT ype(String  memberTyp e) {
  1499                             this.m emberType  = memberTy pe;
  1500           }
  1501  
  1502           pu blic Strin g getMembe rType() {
  1503                             return  memberTyp e;
  1504           }
  1505  
  1506           pu blic void  setFirstNa meAD(Strin g firstNam eAD) {
  1507                             this.f irstNameAD  = firstNa meAD;
  1508           }
  1509  
  1510           pu blic Strin g getFirst NameAD() {
  1511                             return  firstName AD;
  1512           }
  1513  
  1514           pu blic void  setLastNam eAD(String  lastNameA D) {
  1515                             this.l astNameAD  = lastName AD;
  1516           }
  1517  
  1518           pu blic Strin g getLastN ameAD() {
  1519                             return  lastNameA D;
  1520           }
  1521  
  1522           pu blic void  setPhoneAD (String ph oneAD) {
  1523                             this.p honeAD = p honeAD;
  1524           }
  1525  
  1526           pu blic Strin g getPhone AD() {
  1527                             return  phoneAD;
  1528           }
  1529  
  1530  
  1531           pu blic void  setTitleAD (String ti tleAD) {
  1532                             this.t itleAD = t itleAD;
  1533           }
  1534  
  1535           pu blic Strin g getTitle AD() {
  1536                             return  titleAD;
  1537           }
  1538  
  1539           pu blic void  setNetwork IdAD(Strin g networkI dAD) {
  1540                             this.n etworkIdAD  = network IdAD;
  1541           }
  1542  
  1543           pu blic Strin g getNetwo rkIdAD() {
  1544                             return  networkId AD;
  1545           }
  1546  
  1547           pu blic Strin g getUploa dContentTy pe() {
  1548                    retu rn uploadC ontentType ;
  1549           }
  1550  
  1551           pu blic void  setUploadC ontentType (String co ntentType)  {
  1552                    this .uploadCon tentType =  contentTy pe;
  1553           }
  1554  
  1555           pu blic File  getUpload( ) {
  1556                    retu rn upload;
  1557           }
  1558  
  1559           pu blic void  setUpload( File file)  {
  1560                    this .upload =  file;
  1561           }
  1562  
  1563           pu blic Strin g getUploa dFileName( ) {
  1564                    retu rn uploadF ileName;
  1565           }
  1566  
  1567           pu blic void  setUploadF ileName(St ring filen ame) {
  1568                    this .uploadFil eName = fi lename;
  1569           }
  1570  
  1571           pu blic Strin g getEmail AD() {
  1572                    retu rn emailAD ;
  1573           }
  1574  
  1575           pu blic void  setEmailAD (String em ailAD) {
  1576                    this .emailAD =  emailAD;
  1577           }
  1578  
  1579           pu blic Strin g getEmail () {
  1580                    retu rn email;
  1581           }
  1582  
  1583           pu blic void  setEmail(S tring emai l) {
  1584                    this .email = e mail;
  1585           }
  1586  
  1587           pu blic UserD ao getUser Dao() {
  1588                    retu rn userDao ;
  1589           }
  1590  
  1591           pu blic void  setUserDao (UserDao u serDao) {
  1592                    this .userDao =  userDao;
  1593           }
  1594  
  1595  
  1596           pu blic int g etAdded()  {
  1597                    retu rn added;
  1598           }
  1599  
  1600  
  1601           pu blic void  setAdded(i nt added)  {
  1602                    this .added = a dded;
  1603           }
  1604  
  1605           pu blic Strin g getMiddl eName() {
  1606                    retu rn middleN ame;
  1607           }
  1608  
  1609  
  1610           pu blic void  setMiddleN ame(String  middleNam e) {
  1611                    this .middleNam e = middle Name;
  1612           }
  1613  
  1614  
  1615           pu blic Strin g getSuffi x() {
  1616                    retu rn suffix;
  1617           }
  1618  
  1619  
  1620           pu blic void  setSuffix( String suf fix) {
  1621                    this .suffix =  suffix;
  1622           }
  1623  
  1624  
  1625           pu blic Strin g getPrefi x() {
  1626                    retu rn prefix;
  1627           }
  1628  
  1629  
  1630           pu blic void  setPrefix( String pre fix) {
  1631                    this .prefix =  prefix;
  1632           }
  1633  
  1634  
  1635           pu blic Strin g getActiv eFlag() {
  1636                    retu rn activeF lag;
  1637           }
  1638  
  1639  
  1640           pu blic void  setActiveF lag(String  activeFla g) {
  1641                    this .activeFla g = active Flag;
  1642           }
  1643  
  1644  
  1645           pu blic Strin g getProvi derKey() {
  1646                    retu rn provide rKey;
  1647           }
  1648  
  1649  
  1650           pu blic void  setProvide rKey(Strin g provider Key) {
  1651                    this .providerK ey = provi derKey;
  1652           }
  1653  
  1654  
  1655           pu blic Strin g getProvi derClass()  {
  1656                    retu rn provide rClass;
  1657           }
  1658  
  1659  
  1660           pu blic void  setProvide rClass(Str ing provid erClass) {
  1661                    this .providerC lass = pro viderClass ;
  1662           }
  1663  
  1664  
  1665           pu blic Strin g getPerso nClass() {
  1666                    retu rn personC lass;
  1667           }
  1668  
  1669  
  1670           pu blic void  setPersonC lass(Strin g personCl ass) {
  1671                    this .personCla ss = perso nClass;
  1672           }
  1673  
  1674  
  1675           pu blic Strin g getPcmmF lag() {
  1676                    retu rn pcmmFla g;
  1677           }
  1678  
  1679  
  1680           pu blic void  setPcmmFla g(String p cmmFlag) {
  1681                    this .pcmmFlag  = pcmmFlag ;
  1682           }
  1683  
  1684  
  1685           pu blic Strin g getRequi resCoSigne r() {
  1686                    retu rn require sCoSigner;
  1687           }
  1688  
  1689  
  1690           pu blic void  setRequire sCoSigner( String req uiresCoSig ner) {
  1691                    this .requiresC oSigner =  requiresCo Signer;
  1692           }
  1693  
  1694           pu blic Strin g[] getDss Units() {
  1695                    retu rn dssUnit s;
  1696           }
  1697  
  1698  
  1699           pu blic void  setDssUnit s(String[]  dssUnits)  {
  1700                    this .dssUnits  = dssUnits ;
  1701           }
  1702           
  1703  
  1704   }