public String getPath(JavaSourceFileModel javaSourceModel) { String filename = javaSourceModel.getFileName(); String packageName = javaSourceModel.getPackageName() == null ? "" : javaSourceModel.getPackageName().replaceAll("\\.", File.separator); String qualifiedName = packageName + File.separator + filename; String reportFileName = qualifiedName; return reportFileName; }
/** * Returns the path of this file within the parent project (format suitable for reporting) * Uses fully qualified class name notation for classes */ default String getPrettyPathWithinProject(boolean useFQNForClasses) { if (!useFQNForClasses) { return this.getPrettyPathWithinProject(); } String filename = StringUtils.removeEndIgnoreCase(getFileName(), ".java"); String packageName = getPackageName(); return (packageName == null || packageName.isEmpty()) ? filename : packageName + "." + filename; }
private void markAsReportReportable(JavaClassModel reference) { JavaSourceFileModel originalSource = reference.getOriginalSource(); JavaSourceFileModel decompiledSource = reference.getDecompiledSource(); if (originalSource != null) originalSource.setGenerateSourceReport(true); if (decompiledSource != null) decompiledSource.setGenerateSourceReport(true); }
private String groupByProjectModelFunction(final GraphContext context, final Vertex vertex) { JavaSourceFileModel javaModel = context.getFramed().frameElement(vertex, JavaSourceFileModel.class); // String that identifies 3 properties - projectModel + packageName + className that must be the same for vertices ProjectModel projectModel = javaModel.getProjectModel(); String projectModelID = projectModel == null ? "" : projectModel.getId().toString(); String packageName = javaModel.getPackageName() == null ? "" : javaModel.getPackageName(); return projectModelID + "_" + packageName + "_" + javaModel.getFileName(); }
decompiledSourceFileModel.setPackageName(classModel.getPackageName()); decompiledSourceFileModel.setWindupGenerated(true); setupClassToJavaConnections(event.getGraphContext(), inputPath, decompiledSourceFileModel); Path rootSourcePath = PathUtil.getRootFolderForSource(decompiledSourceFileModel.asFile().toPath(), classModel.getPackageName()); if (rootSourcePath != null) decompiledSourceFileModel.setRootSourceFolder(rootSourceFileModel); decompiledSourceFileModel.addJavaClass(classModel.getJavaClass());
sourceFileModel.setParseError(UNPARSEABLE_JAVA_CLASSIFICATION + ": " + e.getMessage()); return; sourceFileModel.setPackageName(packageName); Path rootSourcePath = PathUtil.getRootFolderForSource(sourceFileModel.asFile().toPath(), packageName); if (rootSourcePath != null) sourceFileModel.setRootSourceFolder(rootSourceFileModel); sourceFileModel.addJavaClass(javaClassModel);
payload.remove(); return; .getUnique(); String filepath = payload.getFilePath(); filepath = Paths.get(filepath).toAbsolutePath().toString(); classFilePath = payload.getPrettyPathWithinProject(); payload.setPackageName(packageName); try (FileInputStream fis = new FileInputStream(payload.getFilePath())) throw new WindupException("File in " + payload.getFilePath() + " was not found.", e); + payload.getFilePath(), e); LOG.log(Level.WARNING, "Could not parse java file: " + payload.getFilePath() + " due to: " + e.getMessage(), e); ClassificationService classificationService = new ClassificationService(graphContext); classificationService.attachClassification(event, context, payload, UNPARSEABLE_JAVA_CLASSIFICATION, UNPARSEABLE_JAVA_DESCRIPTION); payload.setParseError(UNPARSEABLE_JAVA_CLASSIFICATION + ": " + e.getMessage()); return;
for (JavaSourceFileModel javaFile : allJavaSourceModels) FileModel rootSourceFolder = javaFile.getRootSourceFolder(); if (rootSourceFolder != null) if (windupJavaConfigurationService.shouldScanPackage(javaFile.getPackageName())) ProjectModel application = javaFile.getApplication(); JavaAnalysisBatch batch = batchMap.get(application); if (batch == null) Path path = Paths.get(javaFile.getFilePath()); batch.getSourceFiles().add(path); sourceFileCount++;
inputDir = Paths.get(inputDir).toAbsolutePath().toString(); String filepath = payload.getFilePath(); filepath = Paths.get(filepath).toAbsolutePath().toString(); classFilePath = payload.getPrettyPathWithinProject(); payload.setPackageName(packageName); try (FileInputStream fis = new FileInputStream(payload.getFilePath())) throw new WindupException("File in " + payload.getFilePath() + " was not found.", e); + payload.getFilePath(), e); "Could not parse java file: " + payload.getFilePath() + " due to: " + e.getMessage(), e); ClassificationService classificationService = new ClassificationService(graphContext); classificationService.attachClassification(payload,
if (!windupJavaConfigurationService.shouldScanPackage(payload.getPackageName())) parser.setBindingsRecovery(true); parser.setResolveBindings(true); File sourceFile = payload.asFile(); try throw new WindupException("Failed to get source for file: " + payload.getFilePath() + " due to: " + e.getMessage(), e);
decompiledSourceFileModel.setPackageName(classModel.getPackageName()); if (classModel.getJavaClass() != null) decompiledSourceFileModel.addJavaClass(classModel.getJavaClass());
String packageName = javaSourceModel.getPackageName();
/** * FIXME - Hacky, typecast filled code below: * - This is necessary due to a frames bug: * - https://issues.jboss.org/browse/WINDUP-1610 */ private void addPrettyPathToModel(FileModel fileModel) { if (fileModel instanceof JavaClassFileModel) { JavaClassFileModel jcfm = ((JavaClassFileModel) fileModel); jcfm.setCachedPrettyPath(jcfm.getPrettyPathWithinProject(true)); } else if (fileModel instanceof JavaSourceFileModel) { JavaSourceFileModel jsfm = ((JavaSourceFileModel) fileModel); jsfm.setCachedPrettyPath(jsfm.getPrettyPathWithinProject(true)); } else if (fileModel instanceof ReportResourceFileModel) { ReportResourceFileModel rrfm = (ReportResourceFileModel) fileModel; rrfm.setCachedPrettyPath(rrfm.getPrettyPathWithinProject(false)); } else { fileModel.setCachedPrettyPath(fileModel.getPrettyPathWithinProject(false)); } }
for (JavaClassModel javaClassModel : javaSource.getJavaClasses()) result = javaSource.getJavaClasses().iterator().next();
decompiledSourceFileModel.setPackageName(classModel.getPackageName()); decompiledSourceFileModel.setWindupGenerated(true); setupClassToJavaConnections(event.getGraphContext(), inputPath, decompiledSourceFileModel); Path rootSourcePath = PathUtil.getRootFolderForSource(decompiledSourceFileModel.asFile().toPath(), classModel.getPackageName()); if (rootSourcePath != null) decompiledSourceFileModel.setRootSourceFolder(rootSourceFileModel); decompiledSourceFileModel.addJavaClass(classModel.getJavaClass());
sourceFileModel.setParseError(UNPARSEABLE_JAVA_CLASSIFICATION + ": " + e.getMessage()); return; sourceFileModel.setPackageName(packageName); Path rootSourcePath = PathUtil.getRootFolderForSource(sourceFileModel.asFile().toPath(), packageName); if (rootSourcePath != null) sourceFileModel.setRootSourceFolder(rootSourceFileModel); sourceFileModel.addJavaClass(javaClassModel);
payload.remove(); return; .getUnique(); String filepath = payload.getFilePath(); filepath = Paths.get(filepath).toAbsolutePath().toString(); classFilePath = payload.getPrettyPathWithinProject(); payload.setPackageName(packageName); try (FileInputStream fis = new FileInputStream(payload.getFilePath())) throw new WindupException("File in " + payload.getFilePath() + " was not found.", e); + payload.getFilePath(), e); LOG.log(Level.WARNING, "Could not parse java file: " + payload.getFilePath() + " due to: " + e.getMessage(), e); ClassificationService classificationService = new ClassificationService(graphContext); classificationService.attachClassification(event, context, payload, UNPARSEABLE_JAVA_CLASSIFICATION, UNPARSEABLE_JAVA_DESCRIPTION); payload.setParseError(UNPARSEABLE_JAVA_CLASSIFICATION + ": " + e.getMessage()); return;
for (JavaSourceFileModel javaFile : allJavaSourceModels) FileModel rootSourceFolder = javaFile.getRootSourceFolder(); if (rootSourceFolder != null) if (windupJavaConfigurationService.shouldScanPackage(javaFile.getPackageName())) ProjectModel application = javaFile.getApplication(); JavaAnalysisBatch batch = batchMap.get(application); if (batch == null) Path path = Paths.get(javaFile.getFilePath()); batch.getSourceFiles().add(path); sourceFileCount++;
private String groupByProjectModelFunction(final GraphContext context, final Vertex vertex) { JavaSourceFileModel javaModel = context.getFramed().frameElement(vertex, JavaSourceFileModel.class); // String that identifies 3 properties - projectModel + packageName + className that must be the same for vertices ProjectModel projectModel = javaModel.getProjectModel(); String projectModelID = projectModel == null ? "" : projectModel.getId().toString(); String packageName = javaModel.getPackageName() == null ? "" : javaModel.getPackageName(); return projectModelID + "_" + packageName + "_" + javaModel.getFileName(); }
sourceFileModel.setPackageName(packageName); String qualifiedName = javaSource.getQualifiedName(); sourceFileModel.addJavaClass(javaClassModel);