ClassificationService classificationService = new ClassificationService(getGraphContext()); try (InputStream is = model.asInputStream()) "Failed to parse xml entity: " + model.getFilePath() + ", due to: " + e.getMessage(), e); classificationService.attachClassification(model, XmlFileModel.UNPARSEABLE_XML_CLASSIFICATION, XmlFileModel.UNPARSEABLE_XML_DESCRIPTION); classificationService.attachClassification(model, XmlFileModel.UNPARSEABLE_XML_CLASSIFICATION, XmlFileModel.UNPARSEABLE_XML_DESCRIPTION);
@Override public List<Map<String, Object>> getClassifications(Long executionID, Integer fileModelID) { GraphContext context = getGraph(executionID); FileService fileService = new FileService(context); FileModel fileModel = fileService.getById(fileModelID); ClassificationService classificationService = new ClassificationService(context); Iterable<ClassificationModel> classificationModels = classificationService.getClassifications(fileModel); return super.frameIterableToResult(executionID, classificationModels, 1); } }
private boolean isMavenFile(GraphContext context, FileLocationModel model) { if (!(model.getFile() instanceof XmlFileModel)) { return false; } ClassificationService cs = new ClassificationService(context); for (ClassificationModel cm : cs.getClassificationByName(model.getFile(), "Maven POM (pom.xml)")) { return true; } return false; }
@Override public void perform(GraphRewrite event, EvaluationContext context, XmlFileModel payload) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); ClassificationModel classificationModel = classificationService.attachClassification(event, context, payload, IssueCategoryRegistry.MANDATORY, "WebSphere web service extension descriptor (ibm-webservices-ext)", "WebSphere Webservice Extension XML Deployment Descriptor. \n" + "This deployment descriptor extension is IBM specific and it needs to be migrated to JBossWS. \n" + "JBossWS implements the latest JAX-WS specification, which users can reference for any vendor-agnostic web service usage need. \n" + "You can migrate deployment descriptors following the links below. \n"); classificationModel.setEffort(3); GraphContext graphContext = event.getGraphContext(); LinkService linkService = new LinkService(graphContext); LinkModel documentationEAP6Link = linkService.create(); documentationEAP6Link.setDescription("JAX-WS Web Services (JBoss EAP 6)"); documentationEAP6Link.setLink( "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/chap-JAX-WS_Web_Services.html"); classificationService.attachLink(classificationModel, documentationEAP6Link); LinkModel documentationEAP7Link = linkService.create(); documentationEAP7Link.setDescription("Developing JAX-WS Web Services (JBoss EAP 7)"); documentationEAP7Link.setLink( "https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/developing_web_services_applications/developing_jax_ws_web_services"); classificationService.attachLink(classificationModel, documentationEAP7Link); LinkModel documentationCommunityLink = linkService.create(); documentationCommunityLink.setDescription("Assigning Client and Endpoint Configurations (JBoss EAP 7)"); documentationCommunityLink.setLink("https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/developing_web_services_applications/#ws_endpoint_assign_config"); classificationService.attachLink(classificationModel, documentationCommunityLink); TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()); technologyTagService.addTagToFileModel(payload, "WebSphere WS Extension", TechnologyTagLevel.IMPORTANT); }
private static List<Classification> getClassifications(GraphContext graphContext) { final List<Classification> classifications = new ArrayList<>(); ClassificationService classificationService = new ClassificationService(graphContext); for (ClassificationModel classificationModel : classificationService.findAll()) { for (FileModel fileModel : classificationModel.getFileModels()) { ClassificationImpl classification = new ClassificationImpl(classificationModel.getElement().id()); classification.setClassification(classificationModel.getClassification()); classification.setDescription(classificationModel.getDescription()); classification.setEffort(classificationModel.getEffort()); classification.setRuleID(classificationModel.getRuleID()); classification.setIssueCategory(new IssueCategoryImpl(classificationModel.getIssueCategory())); classification.setFile(fileModel.asFile()); classification.setLinks(asLinks(classificationModel.getLinks())); classifications.add(classification); classification.setQuickfixes(asQuickfixes(classificationModel.getQuickfixes())); } } return classifications; }
@Override public void setContext(GraphRewrite event) { this.classificationService = new ClassificationService(event.getGraphContext()); this.inlineHintService = new InlineHintService(event.getGraphContext()); }
ClassificationService classificationService = new ClassificationService(graphContext); ClassificationModel classification = classificationService.getUniqueByProperty(ClassificationModel.CLASSIFICATION, text); classification = classificationService.create(); classification.setEffort(effort); classification.setIssueDisplayMode(this.issueDisplayMode); classificationService.attachClassification(event, classification, payload); if (payload instanceof SourceFileModel) ((SourceFileModel) payload).setGenerateSourceReport(true);
/** * Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}. * If an existing Model exists with the provided classificationText, that one will be used instead. */ public ClassificationModel attachClassification(GraphRewrite event, Rule rule, FileModel fileModel, String classificationText, String description) { return attachClassification(event, rule, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description); }
transformation.setResult(fileName); ClassificationService classificationService = new ClassificationService(graphContext); ClassificationModel classificationModel = classificationService.create(); classificationModel.addFileModel(payload);
Traversal<?, ?> classificationTraversal = getQuery().traverse(g -> g.has(ClassificationModel.CLASSIFICATION, classificationTitle)).getRawTraversal(); ClassificationModel classification = getUnique(classificationTraversal); if (classification == null) classification = create(); classification.setClassification(classificationTitle); classification.setDescription(description); return attachClassification(event, classification, fileModel);
@Override public void perform(GraphRewrite event, EvaluationContext context, XmlFileModel payload) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); ClassificationModel classificationModel = classificationService.attachClassification(event, context, payload, IssueCategoryRegistry.MANDATORY, "WebSphere web service extension descriptor (ibm-webservices-ext)", "WebSphere Webservice Extension XML Deployment Descriptor. \n" + "This deployment descriptor extension is IBM specific and it needs to be migrated to JBossWS. \n" + "JBossWS implements the latest JAX-WS specification, which users can reference for any vendor-agnostic web service usage need. \n" + "You can migrate deployment descriptors following the links below. \n"); classificationModel.setEffort(3); GraphContext graphContext = event.getGraphContext(); LinkService linkService = new LinkService(graphContext); LinkModel documentationEAP6Link = linkService.create(); documentationEAP6Link.setDescription("JAX-WS Web Services (JBoss EAP 6)"); documentationEAP6Link.setLink( "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/chap-JAX-WS_Web_Services.html"); classificationService.attachLink(classificationModel, documentationEAP6Link); LinkModel documentationEAP7Link = linkService.create(); documentationEAP7Link.setDescription("Developing JAX-WS Web Services (JBoss EAP 7)"); documentationEAP7Link.setLink( "https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/developing_web_services_applications/developing_jax_ws_web_services"); classificationService.attachLink(classificationModel, documentationEAP7Link); LinkModel documentationCommunityLink = linkService.create(); documentationCommunityLink.setDescription("Assigning Client and Endpoint Configurations (JBoss EAP 7)"); documentationCommunityLink.setLink("https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/developing_web_services_applications/#ws_endpoint_assign_config"); classificationService.attachLink(classificationModel, documentationCommunityLink); TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()); technologyTagService.addTagToFileModel(payload, "WebSphere WS Extension", TechnologyTagLevel.IMPORTANT); }
private static List<Classification> getClassifications(GraphContext graphContext) { final List<Classification> classifications = new ArrayList<>(); ClassificationService classificationService = new ClassificationService(graphContext); for (ClassificationModel classificationModel : classificationService.findAll()) { for (FileModel fileModel : classificationModel.getFileModels()) { ClassificationImpl classification = new ClassificationImpl(classificationModel.getElement().id()); classification.setClassification(classificationModel.getClassification()); classification.setDescription(classificationModel.getDescription()); classification.setEffort(classificationModel.getEffort()); classification.setRuleID(classificationModel.getRuleID()); classification.setIssueCategory(new IssueCategoryImpl(classificationModel.getIssueCategory())); classification.setFile(fileModel.asFile()); classification.setLinks(asLinks(classificationModel.getLinks())); classifications.add(classification); classification.setQuickfixes(asQuickfixes(classificationModel.getQuickfixes())); } } return classifications; }
@Override public void setContext(GraphRewrite event) { this.classificationService = new ClassificationService(event.getGraphContext()); this.inlineHintService = new InlineHintService(event.getGraphContext()); }
ClassificationService classificationService = new ClassificationService(graphContext); ClassificationModel classification = classificationService.getUniqueByProperty(ClassificationModel.CLASSIFICATION, text); classification = classificationService.create(); classification.setEffort(effort); classification.setIssueDisplayMode(this.issueDisplayMode); classificationService.attachClassification(event, classification, payload); if (payload instanceof SourceFileModel) ((SourceFileModel) payload).setGenerateSourceReport(true);
/** * Attach a {@link ClassificationModel} with the given classificationText and description to the provided {@link FileModel}. * If an existing Model exists with the provided classificationText, that one will be used instead. */ public ClassificationModel attachClassification(GraphRewrite event, EvaluationContext context, FileModel fileModel, String classificationText, String description) { return attachClassification(event, context, fileModel, IssueCategoryRegistry.DEFAULT, classificationText, description); }
transformation.setResult(fileName); ClassificationService classificationService = new ClassificationService(graphContext); ClassificationModel classificationModel = classificationService.create(); classificationModel.setClassification("Transformed to: " + description); classificationModel.setEffort(effort);
Traversal<?, ?> classificationTraversal = getQuery().traverse(g -> g.has(ClassificationModel.CLASSIFICATION, classificationTitle)).getRawTraversal(); ClassificationModel classification = getUnique(classificationTraversal); if (classification == null) classification = create(); classification.setClassification(classificationTitle); classification.setDescription(description); return attachClassification(event, classification, fileModel);
private boolean isMavenFile(GraphContext context, FileLocationModel model) { if (!(model.getFile() instanceof XmlFileModel)) { return false; } ClassificationService cs = new ClassificationService(context); for (ClassificationModel cm : cs.getClassificationByName(model.getFile(), "Maven POM (pom.xml)")) { return true; } return false; }
ClassificationService classificationService = new ClassificationService(context); classificationService.attachClassification(archiveModel, MALFORMED_ARCHIVE, "Cannot unzip the file"); LOG.warning("Cannot unzip the file " + inputZipFile.getPath() + " to " + appArchiveFolder.toString() + ". The ArchiveModel was classified as malformed.");
@Override public void perform(GraphRewrite event, EvaluationContext context, XmlFileModel payload) { ClassificationService classificationService = new ClassificationService(event.getGraphContext()); ClassificationModel classificationModel = classificationService.attachClassification(event, context, payload, IssueCategoryRegistry.MANDATORY, "WebSphere web service binding descriptor (ibm-webservices-bnd)", "WebSphere Webservice Binding XML Deployment Descriptor. \n" + "This deployment descriptor extension is IBM specific and it needs to be migrated to JBossWS. \n" + "JBossWS implements the latest JAX-WS specification, which users can reference for any vendor-agnostic web service usage need. \n" + "You can migrate deployment descriptors following the links below. \n"); classificationModel.setEffort(3); GraphContext graphContext = event.getGraphContext(); LinkService linkService = new LinkService(graphContext); LinkModel documentationEAP6Link = linkService.create(); documentationEAP6Link.setDescription("JAX-WS Web Services (JBoss EAP 6)"); documentationEAP6Link.setLink( "https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.4/html/Development_Guide/chap-JAX-WS_Web_Services.html"); classificationService.attachLink(classificationModel, documentationEAP6Link); LinkModel documentationEAP7Link = linkService.create(); documentationEAP7Link.setDescription("Developing JAX-WS Web Services (JBoss EAP 7)"); documentationEAP7Link.setLink( "https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html/developing_web_services_applications/developing_jax_ws_web_services"); classificationService.attachLink(classificationModel, documentationEAP7Link); LinkModel documentationCommunityLink = linkService.create(); documentationCommunityLink.setDescription("Assigning Client and Endpoint Configurations (JBoss EAP 7)"); documentationCommunityLink.setLink("https://access.redhat.com/documentation/en-us/red_hat_jboss_enterprise_application_platform/7.0/html-single/developing_web_services_applications/#ws_endpoint_assign_config"); classificationService.attachLink(classificationModel, documentationCommunityLink); TechnologyTagService technologyTagService = new TechnologyTagService(event.getGraphContext()); technologyTagService.addTagToFileModel(payload, "WebSphere WS Binding", TechnologyTagLevel.IMPORTANT); }