for ( Iterator it = profilesById.entrySet().iterator(); it.hasNext(); )
{
Map.Entry entry = (Entry) it.next();
String profileId = (String) entry.getKey();
Profile profile = (Profile) entry.getValue();
boolean shouldAdd = false;
if ( activatedIds.contains( profileId ) )
{
shouldAdd = true;
}
else if ( !deactivatedIds.contains( profileId ) && isActive( profile ) )
{
shouldAdd = true;
}
if ( shouldAdd )
{
if ( "pom".equals( profile.getSource() ) )
{
activeFromPom.add( profile );
}
else
{
activeExternal.add( profile );
}
}
}
if ( activeFromPom.isEmpty() )
{
for ( Iterator it = defaultIds.iterator(); it.hasNext(); )
{
String profileId = (String) it.next();
Profile profile = (Profile) profilesById.get( profileId );
activeFromPom.add( profile );
}
}