@startuml
title ** __DSPA Selfcare PCF: getCustomerProfile__ **\n

actor CLIENT #Magenta

participant SelfCareServiceWSController
participant SelfCareService as "<b><color:white>SelfCareService" #Magenta
participant SelfCareUtil
participant IAMManager
participant IAMDao
participant LDAPService
participant TIBCO_EMS
participant PROVISIONING as "<b><color:white>PROVISIONING" #Magenta
participant IAM_LDAP #DarkSeaGreen

CLIENT -> SelfCareServiceWSController: <font color=blue><b> getCustomerProfile [[https://servicecatalog.internal.t-mobile.com/servicecat/dspa/2016-10-14/wsdl_api/wsdl/SelfCareService.wsdl WSDL]]\n (JAX-RPC XML Request over Http)

note left
URI: /webservice/SelfCareService
CLIENT : QUICKVIEW, SIVR, STREAMLINE, WFM, MYTMO
endnote

SelfCareServiceWSController->SelfCareService: getProfile(msisdn, customerType)
SelfCareService-> SelfCareUtil : validateRequest(msisdn, customerType)
alt msisdn doesnot match msisdnPattern or customerType validation failed
	SelfCareUtil->SelfCareService: throws InvalidRequestException
	SelfCareService -> SelfCareServiceWSController : throws InvalidRequestException
	SelfCareServiceWSController -> CLIENT : throws InvalidRequestException
end
SelfCareService-> IAMManager : getProfile(msisdn)
IAMManager-> IAMDao : getProfile(msisdn)
IAMDao-> LDAPService : ldapSearch(searchCriteria, filterAttributes, searchControls)
note left : with msisdn in searchCriteria
LDAPService -> IAM_LDAP : search(rootSuffix, searchCriteria, searchControls, handler)
IAM_LDAP -> LDAPService : SearchResult List
LDAPService-> IAMDao : SearchResult
alt Search Result is empty or doesnot return any attributes
	IAMDao-> IAMManager : throws CustomerNotFoundException, NoSuchMsisdnException
	IAMManager-> SelfCareService : throws CustomerNotFoundException, NoSuchMsisdnException
	SelfCareService -> SelfCareServiceWSController : throws NoSuchMsisdnException
	SelfCareServiceWSController -> CLIENT : throws NoSuchMsisdnException
	end
IAMDao-> IAMManager : CustomerProfile
IAMManager-> SelfCareService : CustomerProfile
alt customerType is PREPAID and multiLineCustomer type is null
	SelfCareService -> SelfCareUtil: getMLCustomerTypeForBlank(profile)
	SelfCareService-[#blue]>TIBCO_EMS : Publish the message with <back:cadetblue><b>event 'setMLType' and msgType='PUBLISH'</back>  to <back:cadetblue><b>PUBLISH TOPIC</back> 
	TIBCO_EMS -> PROVISIONING : [[../../provisioningems/ce.dsg.dice.prov.ems.pcf.publishtopic.setmltype.svg Provisioning_AsncFlow_setMLType]]	
end
alt servicePartnerId is not NULL
	SelfCareService -> SelfCareUtil: validate ServicePartnerId with the accountType and accountSubType
	alt validation fails 
		SelfCareUtil-> SelfCareService : throws NoSuchMsisdnException
		SelfCareService -> SelfCareServiceWSController : throws NoSuchMsisdnException
		SelfCareServiceWSController -> CLIENT : throws NoSuchMsisdnException
	end
else 
	SelfCareService -> SelfCareUtil: validate default TMOSERVICEPARTNERID with the accountType and accountSubType
	alt validation fails 
		SelfCareUtil-> SelfCareService : throws NoSuchMsisdnException
		SelfCareService -> SelfCareServiceWSController : throws NoSuchMsisdnException
		SelfCareServiceWSController -> CLIENT : throws NoSuchMsisdnException
	end
SelfCareService-> SelfCareServiceWSController : CustomerProfile
SelfCareServiceWSController-[#green]> CLIENT : CustomerProfile
@enduml
