package net.ihe.gazelle.tm.configurations.action ; import net.ihe.gazelle.tm.systems.model.SystemActorProfiles; import net.ihe.gazelle.tm.configurations.model.HL7.AbstractHL7Configuration ; import net.ihe.gazelle.tm.configurations.model.HL7.HL7V2ResponderConfiguration; import net.ihe.gazelle.tm.configurations.model.HL7.HL7V2InitiatorConfiguration; import net.ihe.gazelle.tm.configurations.model.HL7.HL7V3ResponderConfiguration; import net.ihe.gazelle.tm.configurations.model.HL7.HL7V3InitiatorConfiguration; import net.ihe.gazelle.tm.configurations.model.DICOM.DicomSCPConfiguration ; import net.ihe.gazelle.tm.configurations.model.DICOM.DicomSCUConfiguration ; import net.ihe.gazelle.tm.configurations.model.WebServiceConfiguration ; import net.ihe.gazelle.tm.configurations.model.SyslogConfiguration ; import net.ihe.gazelle.tm.configurations.model.Configuration; import net.ihe.gazelle.tm.configurations.model.WebServiceType ; import net.ihe.gazelle.users.model.Institution ; import net.ihe.gazelle.tm.systems.model.System ; import net.ihe.gazelle.tf.model.IntegrationProfile ; import net.ihe.gazelle.tm.configurations.action.ActorDefaultPortsManager ; import net.ihe.gazelle.tm.configurations.model.ActorDefaultPorts ; import net.ihe.gazelle.tf.model.Actor; import net.ihe.gazelle.tm.systems.model.TestingSession ; import java.util.List ; global java.util.List myGlobalList; ##constructors available ## public Configuration( String inComment , Boolean isSecured ) ## public Configuration( Actor inActor , String inComment , Boolean isSecured ) ## public Configuration( Host inHost , Actor inActor , SystemInSession systemInSession , String inComment , Boolean isSecured ) ## ## public HL7InitiatorConfiguration( String inSendingReceivingApplication , String inSendingReceivingFacility , String inAssigningAuthority , String inAssigningAuthorityOID , String inComments) ## ## public HL7ResponderConfiguration( Integer inPortIn ) ## public HL7ResponderConfiguration( Integer inPortIn , Integer inPortOut ) ## public HL7ResponderConfiguration( Integer inPortIn , Integer inPortOut , String inSendingReceivingApplication , String inSendingReceivingFacility , String inAssigningAuthority , String inAssigningAuthorityOID , String inComments) ## public HL7ResponderConfiguration( Integer inPortIn , String inSendingReceivingApplication , String inSendingReceivingFacility , String inAssigningAuthority , String inAssigningAuthorityOID , String inComments) ############## ## EC, EXPORT_MANAGER, EXPORT_SELECTOR, ID, IM, IMG_DOC_CONSUMER, IMG_DOC_SOURCE, IMPORTER, MOD, OF, PC, PMC, PPSM, PWPC, RC, RM, RRD, SA, SN, XRA rule "DICOM SCU" when sap :( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EXPORT_MANAGER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EXPORT_SELECTOR' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ID' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMG_DOC_CONSUMER') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMG_DOC_SOURCE' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMPORTER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'MOD' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OF', actorIntegrationProfile.integrationProfile.keyword == 'SWF') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PMC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PPSM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PWPC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RRD' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'XRA' ) ) then appendDicomSCUConfToList ( sap , myGlobalList ) ; end ## ARR, CHARGE_PRO, DISPLAY, DNS, DOC_REPOSITORY, EXPORT_MANAGER, ID, IM, IMG_DOC_SOURCE, MOD, OF, PC, PMI, PPM, PPSM, PS, RC, RECEIVER, RM, RRD, RRP, SA, SN rule "DICOM SCP" when sap :( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ARR' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'CHARGE_PRO' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DISPLAY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DNS' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_REPOSITORY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EXPORT_MANAGER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ID' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMG_DOC_SOURCE' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'MOD' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OF' , actorIntegrationProfile.integrationProfile.keyword == 'SWF' || =='CATH' || == 'ECHO') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PMI' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PPM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PPSM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PS' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RECEIVER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RRD' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RRP' ) ) then appendDicomSCPConfToList ( sap , myGlobalList ) ; end ## ADT, AM, ANALYZER, DOC_REPOSITORY, IMPORTER, LB, LIP, OF, OP, PAT_IDENTITY_CONSUMER, PAT_IDENTITY_SRC, PAT_IDENTITY_X_REF_MGR, PDC, PDS, PES, POCDM, PPM, PRE_POST_PROCESSOR, PWPC, RC, RM ## removed Feb 26 2009 ## or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDC') ## rule "HL7 Initiator" when sap :( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ADT') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'AM') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ANALYZER') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_REPOSITORY') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMPORTER', actorIntegrationProfile.integrationProfile.keyword == 'IRWF', integrationProfileOption.keyword == 'UNSCHED_IMPORT' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'LB') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'LIP') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OF') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OP') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_CONSUMER' , actorIntegrationProfile.integrationProfile.keyword == 'PIX' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_SRC' , actorIntegrationProfile.integrationProfile.keyword == 'PIX' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_X_REF_MGR' , actorIntegrationProfile.integrationProfile.keyword == 'PIX' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDC' , actorIntegrationProfile.integrationProfile.keyword == 'PDQ' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDS' , actorIntegrationProfile.integrationProfile.keyword == 'PAM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PES') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'POCDM') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PPM') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PRE_POST_PROCESSOR') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PWPC') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RC') or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RM') ) then appendHL7InititiatorConfToList ( sap , myGlobalList ) ; end ## AM, ANALYZER, CHARGE_PRO, DOC_REGISTRY, EC, ERR, IM, LB, LIP, OF, OP, ORT, PAT_IDENTITY_CONSUMER, PAT_IDENTITY_X_REF_MGR, PDC, PDS, PEC, PRE_POST_PROCESSOR, PWPD, RM ## removed Feb 26 2009 ## ## or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDS' ) ## rule "HL7 Responder" when sap : ( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'AM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ANALYZER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'CHARGE_PRO' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_REGISTRY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ERR' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'LB' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'LIP' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OF' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'OP' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ORT' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_CONSUMER' , actorIntegrationProfile.integrationProfile.keyword == 'PIX' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_X_REF_MGR', actorIntegrationProfile.integrationProfile.keyword == 'PIX' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDS' , actorIntegrationProfile.integrationProfile.keyword == 'PDQ' || == 'IRWF' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDC' , actorIntegrationProfile.integrationProfile.keyword == 'PAM' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PEC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PRE_POST_PROCESSOR' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PWPD' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RM' ) ) then appendHL7ResponderConfToList ( sap , myGlobalList ) ; end rule "HL7 V3 Initiator" when sap :( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_CONSUMER', actorIntegrationProfile.integrationProfile.keyword == 'PIXV3' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_SRC' , actorIntegrationProfile.integrationProfile.keyword == 'PIXV3' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_X_REF_MGR', actorIntegrationProfile.integrationProfile.keyword == 'PIXV3' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDC' , actorIntegrationProfile.integrationProfile.keyword == 'PDQV3' ) ) then appendHL7V3InititiatorConfToList ( sap , myGlobalList ) ; end rule "HL7 V3 Responder" when sap : ( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_CONSUMER' , actorIntegrationProfile.integrationProfile.keyword == 'PIXV3' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PAT_IDENTITY_X_REF_MGR' , actorIntegrationProfile.integrationProfile.keyword == 'PIXV3' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'PDS' , actorIntegrationProfile.integrationProfile.keyword == 'PDQV3' ) ) then appendHL7V3ResponderConfToList ( sap , myGlobalList ) ; end rule "Webservice" when sap : ( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'CLIN_DATA_SOURCE' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_RECIPIENT' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_REGISTRY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'DOC_REPOSITORY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'EMBED_REPOS' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'FORM_ARCHIVER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'FORM_MANAGER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'FORM_RECEIVER' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'IMG_DOC_SOURCE' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'INFO_SRC' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'INIT_GATEWAY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'RESP_GATEWAY' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'VALUE_SET_REPOSITORY' ) ) then appendWSConfToList ( sap , myGlobalList ) ; end rule "Syslog" when sap : ( SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'SA' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'SN' ) or SystemActorProfiles ( actorIntegrationProfile.actor.keyword == 'ARR' ) ) then appendSyslogConfToList( sap , myGlobalList ) ; end function void appendHL7InititiatorConfToList(SystemActorProfiles sap , List listToAppend ) { try { List listInst = net.ihe.gazelle.tm.systems.model.System.getInstitutionsForASystem( sap.getSystem() ) ; String facility = "" ; for ( int currInst = 0 ; currInst < listInst.size() ; currInst++ ) { facility += listInst.get( currInst ).getKeyword() ; if ( currInst + 1 == listInst.size() && listInst.size() >1 ) { facility += "&" ; } } listToAppend.add( new HL7V2InitiatorConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , "Configuration HL7 Initiator for "+sap.getActorIntegrationProfile().getActor().getKeyword() , false ) , sap.getSystem().getKeyword() , facility , AbstractHL7Configuration.getAssigningAuthority( sap.getSystem() ) , "" , "" ) ); } catch( Exception e ) { e.printStackTrace(); } } function void appendHL7V3InititiatorConfToList(SystemActorProfiles sap , List listToAppend ) { try { List listInst = net.ihe.gazelle.tm.systems.model.System.getInstitutionsForASystem( sap.getSystem() ) ; String facility = "" ; for ( int currInst = 0 ; currInst < listInst.size() ; currInst++ ) { facility += listInst.get( currInst ).getKeyword() ; if ( currInst + 1 == listInst.size() && listInst.size() >1 ) { facility += "&" ; } } listToAppend.add( new HL7V3InitiatorConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , "Configuration HL7 V3 Initiator for "+sap.getActorIntegrationProfile().getActor().getKeyword() , false ) , sap.getSystem().getKeyword() , facility , AbstractHL7Configuration.getAssigningAuthority( sap.getSystem() ) , "" , "" ) ); } catch ( Exception e ) { e.printStackTrace() ; } } function void appendHL7ResponderConfToList(SystemActorProfiles sap , List listToAppend ) { List hl7portsList = ActorDefaultPortsManager.getHL7DefaultPortsFor(sap.getActorIntegrationProfile().getActor().getKeyword()) ; for ( int i = 0 ; hl7portsList!= null && i < hl7portsList.size() ; i++ ) { try { List listInst = net.ihe.gazelle.tm.systems.model.System.getInstitutionsForASystem( sap.getSystem() ) ; String facility = "" ; for ( int currInst = 0 ; currInst < listInst.size() ; currInst++ ) { facility += listInst.get( currInst ).getKeyword() ; if ( currInst + 1 == listInst.size() && listInst.size() >1 ) { facility += "&" ; } } // public static FreeIPPortsForProxy getNextAvailablePort( TestingSession s , ConfigurationType confType ) listToAppend.add( new HL7V2ResponderConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , "HL7 Responder for "+sap.getActorIntegrationProfile().getActor().getKeyword() , false ) , hl7portsList.get(i).getPortNonSecure() , hl7portsList.get(i).getPortSecure() , null , sap.getSystem().getKeyword() , facility , AbstractHL7Configuration.getAssigningAuthority( sap.getSystem() ) , "" , "" ) ) ; } catch ( Exception e ) { e.printStackTrace(); } } } function void appendHL7V3ResponderConfToList(SystemActorProfiles sap , List listToAppend ) { List hl7V3portsList = ActorDefaultPortsManager.getHL7DefaultPortsFor(sap.getActorIntegrationProfile().getActor().getKeyword()) ; for ( int i = 0 ; hl7V3portsList!= null && i < hl7V3portsList.size() ; i++ ) { try { List listInst = net.ihe.gazelle.tm.systems.model.System.getInstitutionsForASystem( sap.getSystem() ) ; String facility = "" ; for ( int currInst = 0 ; currInst < listInst.size() ; currInst++ ) { facility += listInst.get( currInst ).getKeyword() ; if ( currInst + 1 == listInst.size() && listInst.size() >1 ) { facility += "&" ; } } String comment = "" ; String url = "your_url" ; String usage = hl7V3portsList.get(i).getConfigurationName() ; listToAppend.add( new HL7V3ResponderConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , "HL7 V3 Responder for "+sap.getActorIntegrationProfile().getActor().getKeyword() , false ) , url , hl7V3portsList.get(i).getPortNonSecure() , hl7V3portsList.get(i).getPortSecure() , null , usage , sap.getSystem().getKeyword() , facility , AbstractHL7Configuration.getAssigningAuthority( sap.getSystem() ) , "" , "" ) ) ; } catch ( Exception e ) { e.printStackTrace(); } } } function void appendDicomSCUConfToList(SystemActorProfiles sap , List listToAppend ) { List dicomSCUportsList = ActorDefaultPortsManager.getDicomSCUDefaultPortsFor(sap.getActorIntegrationProfile().getActor().getKeyword()) ; for ( int i = 0 ; dicomSCUportsList!= null && i < dicomSCUportsList.size() ; i++ ) { try { String comment = "" ; String sopClass = dicomSCUportsList.get(i).getConfigurationName() ; String role = "SCU" ; ActorDefaultPorts dicomSCUPort = dicomSCUportsList.get(i) ; listToAppend.add( new DicomSCUConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , comment , false ) , sap.getSystem().getKeyword() , dicomSCUPort.getPortNonSecure() , dicomSCUPort.getPortSecure() , null , sopClass , role ) ) ; } catch ( Exception e ) { e.printStackTrace(); } } } function void appendDicomSCPConfToList(SystemActorProfiles sap , List listToAppend ) { List dicomSCPportsList = ActorDefaultPortsManager.getDicomSCPDefaultPortsFor(sap.getActorIntegrationProfile().getActor().getKeyword()) ; for ( int i = 0 ; dicomSCPportsList!= null && i < dicomSCPportsList.size() ; i++ ) { try { String comment = "" ; String sopClass = dicomSCPportsList.get(i).getConfigurationName() ; String role = "SCP" ; listToAppend.add( new DicomSCPConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , comment , false ) , sap.getSystem().getKeyword() , dicomSCPportsList.get(i).getPortNonSecure() , dicomSCPportsList.get(i).getPortSecure() , null , sopClass , role ) ) ; } catch ( Exception e ) { e.printStackTrace(); } } } function void appendWSConfToList(SystemActorProfiles sap , List listToAppend ) { List wsPortsList = ActorDefaultPortsManager.getWebServicesDefaultFor( sap.getActorIntegrationProfile().getActor().getKeyword()) ; for ( int i = 0 ; wsPortsList!= null && i < wsPortsList.size() ; i++ ) { try { String comment = "" ; String url = "your_url" ; String usage = wsPortsList.get(i).getConfigurationName() ; listToAppend.add( new WebServiceConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , comment , false ) , url , wsPortsList.get(i).getPortNonSecure() , wsPortsList.get(i).getPortSecure() , null , usage , comment , WebServiceType.findWebServiceType(sap.getActorIntegrationProfile().getIntegrationProfile() ) ) ) ; } catch ( Exception e ) { e.printStackTrace(); } } } function void appendSyslogConfToList(SystemActorProfiles sap , List listToAppend ) { try { listToAppend.add( new SyslogConfiguration( new Configuration( sap.getActorIntegrationProfile().getActor() , "Syslog configuration Configuration for "+sap.getActorIntegrationProfile().getActor().getKeyword() , false ) , 5000 , null ) ); } catch( Exception e ) { e.printStackTrace(); } }