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; }
/** * Gets a human readable description of the location in the file */ default String getDescription() { TypeReferenceLocation location = getReferenceLocation(); return location.toReadablePrefix() + " '" + getResolvedSourceSnippit() + "'"; }
private void extractEJBMetadata(GraphRewrite event, JavaTypeReferenceModel javaTypeReference) { ((SourceFileModel) javaTypeReference.getFile()).setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) javaTypeReference; JavaClassModel ejbClass = getJavaClass(javaTypeReference); String ejbName = annotationTypeReference.getAnnotationValues().get("name"); String sessionType = javaTypeReference.getSourceSnippit().substring(javaTypeReference.getSourceSnippit().lastIndexOf(".") + 1); Service<EjbSessionBeanModel> sessionBeanService = new GraphService<>(event.getGraphContext(), EjbSessionBeanModel.class); EjbSessionBeanModel sessionBean = sessionBeanService.create(); sessionBean.setBeanName(ejbName); sessionBean.setEjbClass(ejbClass); sessionBean.setSessionType(sessionType); }
public JavaTypeReferenceModel createTypeReference(FileModel fileModel, TypeReferenceLocation location, ResolutionStatus resolutionStatus, int lineNumber, int columnNumber, int length, String resolvedSource, String line) { ExecutionStatistics.get().begin("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); JavaTypeReferenceModel model = create(); model.setFile(fileModel); model.setLineNumber(lineNumber); model.setColumnNumber(columnNumber); model.setLength(length); model.setResolvedSourceSnippit(resolvedSource); model.setSourceSnippit(line); model.setReferenceLocation(location); model.setResolutionStatus(resolutionStatus); ExecutionStatistics.get().end("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); return model; }
public JavaTypeReferenceModel createTypeReference(FileModel fileModel, TypeReferenceLocation location, int lineNumber, int columnNumber, int length, String source) { ExecutionStatistics.get().begin("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); JavaTypeReferenceModel model = create(); model.setFile(fileModel); model.setLineNumber(lineNumber); model.setColumnNumber(columnNumber); model.setLength(length); model.setSourceSnippit(source); model.setReferenceLocation(location); ExecutionStatistics.get().end("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); return model; }
hint.setLineNumber(typeReference.getLineNumber()); hint.setColumnNumber(typeReference.getColumnNumber()); hint.setLength(typeReference.getLength()); hint.setFileLocationReference(typeReference); hint.setFile(typeReference.getFile()); hint.setEffort(5); hint.setIssueCategory(issueCategoryRegistry.loadFromGraph(event.getGraphContext(), IssueCategoryRegistry.MANDATORY)); hint.setTitle(TITLE); hint.setHint("This class reference (" + typeReference.getDescription() + ") could not be found on the classpath"); typeReference.getFile().setGenerateSourceReport(true);
private void extractEJBMetadata(GraphRewrite event, JavaTypeReferenceModel javaTypeReference) { javaTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) javaTypeReference; JavaClassModel ejbClass = getJavaClass(javaTypeReference); String ejbName = getAnnotationLiteralValue(annotationTypeReference, "name"); if (Strings.isNullOrEmpty(ejbName)) { ejbName = ejbClass.getClassName(); } String sessionType = javaTypeReference.getResolvedSourceSnippit() .substring(javaTypeReference.getResolvedSourceSnippit().lastIndexOf(".") + 1); Service<EjbSessionBeanModel> sessionBeanService = new GraphService<>(event.getGraphContext(), EjbSessionBeanModel.class); EjbSessionBeanModel sessionBean = sessionBeanService.create(); Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), javaTypeReference.getFile().getProjectModel()); sessionBean.setApplications(applications); sessionBean.setBeanName(ejbName); sessionBean.setEjbClass(ejbClass); sessionBean.setSessionType(sessionType); }
private void extractEntityBeanMetadata(GraphRewrite event, JavaTypeReferenceModel entityTypeReference) LOG.log(Level.INFO, () -> "extractEntityBeanMetadata() with " + entityTypeReference.getDescription()); entityTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel entityAnnotationTypeReference = (JavaAnnotationTypeReferenceModel) entityTypeReference; JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = findTableAnnotation(event, entityTypeReference); jpaEntity.setApplications(ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), entityTypeReference.getFile().getProjectModel())); jpaEntity.setEntityName(ejbName); jpaEntity.setJavaClass(ejbClass); if (!annotationTypeReference.getFile().equals(entityTypeReference.getFile())) continue; if (annotationTypeReference.getFile().equals(entityTypeReference.getFile()))
String pattern = typeReferenceModel.getResolvedSourceSnippit(); String[] keyArray = pattern.split("\\.");
String pattern = typeReferenceModel.getSourceSnippit(); String[] keyArray = pattern.split("\\.");
public JavaTypeReferenceModel createTypeReference(FileModel fileModel, TypeReferenceLocation location, ResolutionStatus resolutionStatus, int lineNumber, int columnNumber, int length, String resolvedSource, String line) { ExecutionStatistics.get().begin("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); JavaTypeReferenceModel model = create(); model.setFile(fileModel); model.setLineNumber(lineNumber); model.setColumnNumber(columnNumber); model.setLength(length); model.setResolvedSourceSnippit(resolvedSource); model.setSourceSnippit(line); model.setReferenceLocation(location); model.setResolutionStatus(resolutionStatus); ExecutionStatistics.get().end("TypeReferenceService.createTypeReference(fileModel,location,lineNumber,columnNumber,length,source)"); return model; }
hint.setLineNumber(typeReference.getLineNumber()); hint.setColumnNumber(typeReference.getColumnNumber()); hint.setLength(typeReference.getLength()); hint.setFileLocationReference(typeReference); hint.setFile(typeReference.getFile()); hint.setEffort(5); hint.setIssueCategory(issueCategoryRegistry.loadFromGraph(event.getGraphContext(), IssueCategoryRegistry.MANDATORY)); hint.setTitle(TITLE); hint.setHint("This class reference (" + typeReference.getDescription() + ") could not be found on the classpath"); typeReference.getFile().setGenerateSourceReport(true);
private void extractEJBMetadata(GraphRewrite event, JavaTypeReferenceModel javaTypeReference) { javaTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel annotationTypeReference = (JavaAnnotationTypeReferenceModel) javaTypeReference; JavaClassModel ejbClass = getJavaClass(javaTypeReference); String ejbName = getAnnotationLiteralValue(annotationTypeReference, "name"); if (Strings.isNullOrEmpty(ejbName)) { ejbName = ejbClass.getClassName(); } String sessionType = javaTypeReference.getResolvedSourceSnippit() .substring(javaTypeReference.getResolvedSourceSnippit().lastIndexOf(".") + 1); Service<EjbSessionBeanModel> sessionBeanService = new GraphService<>(event.getGraphContext(), EjbSessionBeanModel.class); EjbSessionBeanModel sessionBean = sessionBeanService.create(); Set<ProjectModel> applications = ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), javaTypeReference.getFile().getProjectModel()); sessionBean.setApplications(applications); sessionBean.setBeanName(ejbName); sessionBean.setEjbClass(ejbClass); sessionBean.setSessionType(sessionType); }
private void extractEntityBeanMetadata(GraphRewrite event, JavaTypeReferenceModel entityTypeReference) LOG.log(Level.INFO, () -> "extractEntityBeanMetadata() with " + entityTypeReference.getDescription()); entityTypeReference.getFile().setGenerateSourceReport(true); JavaAnnotationTypeReferenceModel entityAnnotationTypeReference = (JavaAnnotationTypeReferenceModel) entityTypeReference; JavaAnnotationTypeReferenceModel tableAnnotationTypeReference = findTableAnnotation(event, entityTypeReference); jpaEntity.setApplications(ProjectTraversalCache.getApplicationsForProject(event.getGraphContext(), entityTypeReference.getFile().getProjectModel())); jpaEntity.setEntityName(ejbName); jpaEntity.setJavaClass(ejbClass); if (!annotationTypeReference.getFile().equals(entityTypeReference.getFile())) continue; if (annotationTypeReference.getFile().equals(entityTypeReference.getFile()))
String pattern = typeReferenceModel.getResolvedSourceSnippit(); String[] keyArray = pattern.split("\\.");
.getSourceSnippit()); if (referenceResult.matches())
private void attachLocationMetadata(JavaTypeReferenceModel javaTypeReferenceModel, AnnotationClassReference annotationClassReference, JavaSourceFileModel javaSourceFileModel) { javaTypeReferenceModel.setResolutionStatus(annotationClassReference.getResolutionStatus()); javaTypeReferenceModel.setResolvedSourceSnippit(annotationClassReference.getQualifiedName()); javaTypeReferenceModel.setSourceSnippit(annotationClassReference.getLine()); javaTypeReferenceModel.setReferenceLocation(annotationClassReference.getLocation()); javaTypeReferenceModel.setColumnNumber(annotationClassReference.getColumn()); javaTypeReferenceModel.setLineNumber(annotationClassReference.getLineNumber()); javaTypeReferenceModel.setLength(annotationClassReference.getLength()); javaTypeReferenceModel.setFile(javaSourceFileModel); }
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; }
hintReducedDTO.setJavaFQCN(strings.getOrAdd(((JavaTypeReferenceModel) fileLocationModel).getResolvedSourceSnippit()));
/** * Gets a human readable description of the location in the file */ default String getDescription() { TypeReferenceLocation location = getReferenceLocation(); return location.toReadablePrefix() + " '" + getResolvedSourceSnippit() + "'"; }