private JavaAnnotationTypeReferenceModel findTableAnnotation(GraphRewrite event, List<AbstractJavaSourceModel> sourceModels) { for (AbstractJavaSourceModel sourceModel : sourceModels) { Optional<JavaAnnotationTypeReferenceModel> tableAnnotation = sourceModel.getAllTypeReferences().stream() .filter(reference -> reference instanceof JavaAnnotationTypeReferenceModel) .map(reference -> (JavaAnnotationTypeReferenceModel)reference) .filter(annotationReference -> annotationReference.getResolvedSourceSnippit() != null && annotationReference.getResolvedSourceSnippit().contains("javax.persistence.Table")) .findFirst(); if (tableAnnotation.isPresent()) return tableAnnotation.get(); else return findTableAnnotation(event, getParentSourceFiles(event, sourceModel)); } return null; }
private JavaAnnotationTypeReferenceModel findTableAnnotation(GraphRewrite event, List<AbstractJavaSourceModel> sourceModels) { for (AbstractJavaSourceModel sourceModel : sourceModels) { Optional<JavaAnnotationTypeReferenceModel> tableAnnotation = sourceModel.getAllTypeReferences().stream() .filter(reference -> reference instanceof JavaAnnotationTypeReferenceModel) .map(reference -> (JavaAnnotationTypeReferenceModel)reference) .filter(annotationReference -> annotationReference.getResolvedSourceSnippit() != null && annotationReference.getResolvedSourceSnippit().contains("javax.persistence.Table")) .findFirst(); if (tableAnnotation.isPresent()) return tableAnnotation.get(); else return findTableAnnotation(event, getParentSourceFiles(event, sourceModel)); } return null; }
private JavaAnnotationTypeReferenceModel findTableAnnotation(GraphRewrite event, JavaTypeReferenceModel entityTypeReference) { JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = null; final Iterable<? extends WindupVertexFrame> tableAnnotationList = Variables.instance(event).findVariable(TABLE_ANNOTATIONS_LIST); if (tableAnnotationList != null) { for (WindupVertexFrame annotationTypeReferenceBase : tableAnnotationList) { JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) annotationTypeReferenceBase; if (annotationTypeReference.getFile().equals(entityTypeReference.getFile())) { tableAnnotationTypeReference = annotationTypeReference; break; } } } if (tableAnnotationTypeReference == null) { AbstractJavaSourceModel sourceModel = entityTypeReference.getFile(); tableAnnotationTypeReference = findTableAnnotation(event, getParentSourceFiles(event, sourceModel)); } return tableAnnotationTypeReference; }
private JavaAnnotationTypeReferenceModel findTableAnnotation(GraphRewrite event, JavaTypeReferenceModel entityTypeReference) { JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = null; final Iterable<? extends WindupVertexFrame> tableAnnotationList = Variables.instance(event).findVariable(TABLE_ANNOTATIONS_LIST); if (tableAnnotationList != null) { for (WindupVertexFrame annotationTypeReferenceBase : tableAnnotationList) { JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) annotationTypeReferenceBase; if (annotationTypeReference.getFile().equals(entityTypeReference.getFile())) { tableAnnotationTypeReference = annotationTypeReference; break; } } } if (tableAnnotationTypeReference == null) { AbstractJavaSourceModel sourceModel = entityTypeReference.getFile(); tableAnnotationTypeReference = findTableAnnotation(event, getParentSourceFiles(event, sourceModel)); } return tableAnnotationTypeReference; }
entityTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel entityAnnotationTypeReference = (JavaAnnotationTypeReferenceModel) entityTypeReference; JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = findTableAnnotation(event, entityTypeReference);
entityTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel entityAnnotationTypeReference = (JavaAnnotationTypeReferenceModel) entityTypeReference; JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = findTableAnnotation(event, entityTypeReference);