@Test public void testFilterModelFieldsFactsShareNameInDifferentPackagesAnotherOneIsInCurrentPackage() throws Exception { Map<String, ModelField[]> projectModelFields = new TreeMap<String, ModelField[]>(); projectModelFields.put("org.test.Person", new ModelField[]{getModelField("Person", "org.test.Person")}); projectModelFields.put("org.test.sub.Person", new ModelField[]{getModelField("Person", "org.test.sub.Person")}); projectModelFields.put("org.test.sub.Address", new ModelField[]{getModelField("Address", "org.test.sub.Address")}); projectModelFields.put("org.test.Address", new ModelField[]{getModelField("Address", "org.test.Address")}); FactNameToFQCNHandleRegistry registry = new FactNameToFQCNHandleRegistry(); AsyncPackageDataModelOracleUtilities.filterModelFields( "org.test.sub", new Imports(), projectModelFields, registry); assertEquals("org.test.sub.Person", registry.get("Person")); assertEquals("org.test.sub.Address", registry.get("Address")); }
public static Map<String, ModelField[]> filterModelFields(final String packageName, final Imports imports, final Map<String, ModelField[]> projectModelFields, final FactNameToFQCNHandleRegistry registry) { final Map<String, ModelField[]> scopedModelFields = new HashMap<String, ModelField[]>(); for (Map.Entry<String, ModelField[]> entry : projectModelFields.entrySet()) { final String mfQualifiedType = entry.getKey(); final String mfPackageName = getPackageName(mfQualifiedType); final String mfTypeName = getTypeName(mfQualifiedType); if (registry.contains(mfTypeName)) { final Set<String> importStrings = imports.getImportStrings(); if (mfPackageName.equals(packageName) || importStrings.contains(mfQualifiedType)) { registry.add(mfTypeName, mfQualifiedType); } } else { registry.add(mfTypeName, mfQualifiedType); } if (mfPackageName.equals(packageName) || isImported(mfQualifiedType, imports)) { scopedModelFields.put(mfTypeName, correctModelFields(packageName, entry.getValue(), imports)); } } return scopedModelFields; }
AsyncPackageDataModelOracleUtilities { public static Map<String, ModelField[]> filterModelFields(final String packageName, final Imports imports, final Map<String, ModelField[]> projectModelFields, final FactNameToFQCNHandleRegistry registry) { final Map<String, ModelField[]> scopedModelFields = new HashMap<String, ModelField[]>(); for (Map.Entry<String, ModelField[]> entry : projectModelFields.entrySet()) { final String mfQualifiedType = entry.getKey(); final String mfPackageName = getPackageName(mfQualifiedType); final String mfTypeName = getTypeName(mfQualifiedType); if (registry.contains(mfTypeName)) { final Set<String> importStrings = imports.getImportStrings(); if (mfPackageName.equals(packageName) || importStrings.contains(mfQualifiedType)) { registry.add(mfTypeName, mfQualifiedType); } } else { registry.add(mfTypeName, mfQualifiedType); } if (mfPackageName.equals(packageName) || isImported(mfQualifiedType, imports)) { scopedModelFields.put(mfTypeName, correctModelFields(packageName, entry.getValue(), imports)); } } return scopedModelFields; } }
AsyncPackageDataModelOracleUtilities { public static Map<String, ModelField[]> filterModelFields(final String packageName, final Imports imports, final Map<String, ModelField[]> projectModelFields, final FactNameToFQCNHandleRegistry registry) { final Map<String, ModelField[]> scopedModelFields = new HashMap<String, ModelField[]>(); for (Map.Entry<String, ModelField[]> entry : projectModelFields.entrySet()) { final String mfQualifiedType = entry.getKey(); final String mfPackageName = getPackageName(mfQualifiedType); final String mfTypeName = getTypeName(mfQualifiedType); if (registry.contains(mfTypeName)) { final Set<String> importStrings = imports.getImportStrings(); if (mfPackageName.equals(packageName) || importStrings.contains(mfQualifiedType)) { registry.add(mfTypeName, mfQualifiedType); } } else { registry.add(mfTypeName, mfQualifiedType); } if (mfPackageName.equals(packageName) || isImported(mfQualifiedType, imports)) { scopedModelFields.put(mfTypeName, correctModelFields(packageName, entry.getValue(), imports)); } } return scopedModelFields; }  }
AsyncPackageDataModelOracleUtilities { public static Map<String, ModelField[]> filterModelFields(final String packageName, final Imports imports, final Map<String, ModelField[]> projectModelFields, final FactNameToFQCNHandleRegistry registry) { final Map<String, ModelField[]> scopedModelFields = new HashMap<String, ModelField[]>(); for (Map.Entry<String, ModelField[]> entry : projectModelFields.entrySet()) { final String mfQualifiedType = entry.getKey(); final String mfPackageName = getPackageName(mfQualifiedType); final String mfTypeName = getTypeName(mfQualifiedType); if (registry.contains(mfTypeName)) { final Set<String> importStrings = imports.getImportStrings(); if (mfPackageName.equals(packageName) || importStrings.contains(mfQualifiedType)) { registry.add(mfTypeName, mfQualifiedType); } } else { registry.add(mfTypeName, mfQualifiedType); } if (mfPackageName.equals(packageName) || isImported(mfQualifiedType, imports)) { scopedModelFields.put(mfTypeName, correctModelFields(packageName, entry.getValue(), imports)); } } return scopedModelFields; }  static void populateDataModelOracle(final AsyncPackageDataModelOracle oracle,
                                               final PackageDataModelOracleIncrementalPayload payload); static Map<String, ModelField[]> filterModelFields(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, ModelField[]> projectModelFields,
                                                              final FactNameToFQCNHandleRegistry registry); static Map<String, Boolean> filterCollectionTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, Boolean> projectCollectionTypes); static Map<String, String> filterGlobalTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, String> packageGlobalTypes); static Map<String, Boolean> filterEventTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, Boolean> projectEventTypes); static Map<String, TypeSource> filterTypeSources(final String packageName,
                                                            final Imports imports,
                                                            final Map<String, TypeSource> projectTypeSources); static Map<String, List<String>> filterSuperTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, List<String>> projectSuperTypes); static Map<String, Set<Annotation>> filterTypeAnnotations(final String packageName,
                                                                     final Imports imports,
                                                                     final Map<String, Set<Annotation>> projectTypeAnnotations); static Map<String, Map<String, Set<Annotation>>> filterTypeFieldsAnnotations(final String packageName,
                                                                                        final Imports imports,
                                                                                        final Map<String, Map<String, Set<Annotation>>> projectTypeFieldsAnnotations); static Map<String, String[]> filterEnumDefinitions(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, String[]> enumDefinitions); static void visitMethodInformation(final Map<String, List<MethodInfo>> projectMethodInformation,
                                              final FactNameToFQCNHandleRegistry registry); static Map<String, String> filterFieldParametersTypes(final String packageName,
                                                                 final Imports imports,
                                                                 final Map<String, String> projectFieldParametersTypes); static String getPackageName(final String qualifiedType); static String getTypeName(final String qualifiedType); static ModelField[] correctModelFields(final String packageName,
                                                  final ModelField[] originalModelFields,
                                                  final Imports imports); static ModelField correctModelFields(final String packageName,
                                                final Imports imports,
                                                final ModelField mf); static MethodInfo correctMethodInformation(final String packageName,
                                                      final MethodInfo originalMethodInformation,
                                                      final Imports imports); static List<MethodInfo> correctMethodInformation(final String packageName,
                                                            final List<MethodInfo> originalMethodInformation,
                                                            final Imports imports); }
AsyncPackageDataModelOracleUtilities { public static Map<String, ModelField[]> filterModelFields(final String packageName, final Imports imports, final Map<String, ModelField[]> projectModelFields, final FactNameToFQCNHandleRegistry registry) { final Map<String, ModelField[]> scopedModelFields = new HashMap<String, ModelField[]>(); for (Map.Entry<String, ModelField[]> entry : projectModelFields.entrySet()) { final String mfQualifiedType = entry.getKey(); final String mfPackageName = getPackageName(mfQualifiedType); final String mfTypeName = getTypeName(mfQualifiedType); if (registry.contains(mfTypeName)) { final Set<String> importStrings = imports.getImportStrings(); if (mfPackageName.equals(packageName) || importStrings.contains(mfQualifiedType)) { registry.add(mfTypeName, mfQualifiedType); } } else { registry.add(mfTypeName, mfQualifiedType); } if (mfPackageName.equals(packageName) || isImported(mfQualifiedType, imports)) { scopedModelFields.put(mfTypeName, correctModelFields(packageName, entry.getValue(), imports)); } } return scopedModelFields; }  static void populateDataModelOracle(final AsyncPackageDataModelOracle oracle,
                                               final PackageDataModelOracleIncrementalPayload payload); static Map<String, ModelField[]> filterModelFields(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, ModelField[]> projectModelFields,
                                                              final FactNameToFQCNHandleRegistry registry); static Map<String, Boolean> filterCollectionTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, Boolean> projectCollectionTypes); static Map<String, String> filterGlobalTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, String> packageGlobalTypes); static Map<String, Boolean> filterEventTypes(final String packageName,
                                                        final Imports imports,
                                                        final Map<String, Boolean> projectEventTypes); static Map<String, TypeSource> filterTypeSources(final String packageName,
                                                            final Imports imports,
                                                            final Map<String, TypeSource> projectTypeSources); static Map<String, List<String>> filterSuperTypes(final String packageName,
                                                             final Imports imports,
                                                             final Map<String, List<String>> projectSuperTypes); static Map<String, Set<Annotation>> filterTypeAnnotations(final String packageName,
                                                                     final Imports imports,
                                                                     final Map<String, Set<Annotation>> projectTypeAnnotations); static Map<String, Map<String, Set<Annotation>>> filterTypeFieldsAnnotations(final String packageName,
                                                                                        final Imports imports,
                                                                                        final Map<String, Map<String, Set<Annotation>>> projectTypeFieldsAnnotations); static Map<String, String[]> filterEnumDefinitions(final String packageName,
                                                              final Imports imports,
                                                              final Map<String, String[]> enumDefinitions); static void visitMethodInformation(final Map<String, List<MethodInfo>> projectMethodInformation,
                                              final FactNameToFQCNHandleRegistry registry); static Map<String, String> filterFieldParametersTypes(final String packageName,
                                                                 final Imports imports,
                                                                 final Map<String, String> projectFieldParametersTypes); static String getPackageName(final String qualifiedType); static String getTypeName(final String qualifiedType); static ModelField[] correctModelFields(final String packageName,
                                                  final ModelField[] originalModelFields,
                                                  final Imports imports); static ModelField correctModelFields(final String packageName,
                                                final Imports imports,
                                                final ModelField mf); static MethodInfo correctMethodInformation(final String packageName,
                                                      final MethodInfo originalMethodInformation,
                                                      final Imports imports); static List<MethodInfo> correctMethodInformation(final String packageName,
                                                            final List<MethodInfo> originalMethodInformation,
                                                            final Imports imports);  }