class AsyncPackageDataModelOracleUtilities {

    public static Map<String, List<String>> filterSuperTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, List<String>> projectSuperTypes) {
        final Map<String, List<String>> scopedSuperTypes = new HashMap<String, List<String>>();
        for (Map.Entry<String, List<String>> e : projectSuperTypes.entrySet()) {
            final String typeQualifiedType = e.getKey();
            final String typePackageName = getPackageName(typeQualifiedType);
            final String typeTypeName = getTypeName(typeQualifiedType);

            final List<String> superTypeQualifiedTypes = e.getValue();

            if (superTypeQualifiedTypes == null) {
                //Doesn't have a Super Type
                if (typePackageName.equals(packageName) || isImported(typeQualifiedType,
                                                                      imports)) {
                    scopedSuperTypes.put(typeTypeName,
                                         superTypeQualifiedTypes);
                }
            } else {
                //Has a Super Type
                if (typePackageName.equals(packageName) || isImported(typeQualifiedType,
                                                                      imports)) {
                    ArrayList<String> result = new ArrayList<String>();

                    for (String superTypeQualifiedType : superTypeQualifiedTypes) {
                        final String superTypePackageName = getPackageName(superTypeQualifiedType);
                        final String superTypeTypeName = getTypeName(superTypeQualifiedType);

                        if (superTypePackageName.equals(packageName) || isImported(superTypeQualifiedType,
                                                                                   imports)) {
                            result.add(superTypeTypeName);
                        } else {
                            result.add(superTypeQualifiedType);
                        }
                    }

                    scopedSuperTypes.put(typeTypeName,
                                         result);
                }
            }
        }
        return scopedSuperTypes;
    }

}