6767@ Component
6868public class LdapManagerImpl extends ComponentLifecycleBase implements LdapManager , LdapValidator {
6969 private static final Logger LOGGER = Logger .getLogger (LdapManagerImpl .class .getName ());
70+ public static final String REMOVING_LDAP_LINK_ON_DOMAIN = "Removing link between LDAP: %s - type: %s and account: %s on domain: %s" ;
7071
7172 @ Inject
7273 private LdapConfigurationDao _ldapConfigurationDao ;
@@ -124,7 +125,7 @@ public void onPublishMessage(String senderAddress, String subject, Object args)
124125 long domainId = account .getDomainId ();
125126 LdapTrustMapVO ldapTrustMapVO = _ldapTrustMapDao .findByAccount (domainId , account .getAccountId ());
126127 if (ldapTrustMapVO != null ) {
127- String msg = String .format ("Removing link between LDAP: %s - type: %s and account: %s on domain: %s" ,
128+ String msg = String .format (REMOVING_LDAP_LINK_ON_DOMAIN ,
128129 ldapTrustMapVO .getName (), ldapTrustMapVO .getType ().name (), account .getAccountId (), domainId );
129130 LOGGER .debug (msg );
130131 _ldapTrustMapDao .remove (ldapTrustMapVO .getId ());
@@ -143,10 +144,10 @@ public void onPublishMessage(String senderAddress, String subject, Object args)
143144 try {
144145 final Domain domain = domainDao .findByIdIncludingRemoved ((Long ) args );
145146 long domainId = domain .getId ();
146- LdapTrustMapVO ldapTrustMapVO = _ldapTrustMapDao .findByDomainId (domainId );
147- if ( ldapTrustMapVO != null ) {
148- String msg = String .format ("Removing link between LDAP: %s - type: %s on domain: %s" ,
149- ldapTrustMapVO .getName (), ldapTrustMapVO .getType ().name (), domainId );
147+ List < LdapTrustMapVO > ldapTrustMapVOs = _ldapTrustMapDao .searchByDomainId (domainId );
148+ for ( LdapTrustMapVO ldapTrustMapVO : ldapTrustMapVOs ) {
149+ String msg = String .format (REMOVING_LDAP_LINK_ON_DOMAIN ,
150+ ldapTrustMapVO .getName (), ldapTrustMapVO .getType ().name (), ldapTrustMapVO . getAccountId (), domainId );
150151 LOGGER .debug (msg );
151152 _ldapTrustMapDao .remove (ldapTrustMapVO .getId ());
152153 }
0 commit comments