@Transient public String getScannerTypeName(){ return this.channelType.getName(); } }
@Override public String toString() { String type = applicationChannel == null ? "no type" : applicationChannel.getChannelType().getName(); return type + " (" + (findings == null ? 0 : findings.size()) + " results)"; } }
@Override public String toString() { if (channelType == null && application == null) { return "Channel with no type or application"; } else if (channelType == null) { return "Channel with no type for application " + application.getName(); } else if (application == null) { return "Channel with type " + channelType.getName() + " and no application."; } else { return channelType.getName() + "--" + application.getName(); } } }
@JsonView({AllViews.TableRow.class}) @Transient private String getType() { String type = getApplicationChannel().getChannelType().getName(); if (ChannelType.DYNAMIC_TYPES.contains(type)) { return ChannelType.DYNAMIC; } else if (ChannelType.STATIC_TYPES.contains(type)) { return ChannelType.STATIC; } else { return ChannelType.MIXED; } }
@Override public ChannelVulnerability retrieveByName(ChannelType channelType, String name) { @SuppressWarnings("unchecked") List<ChannelVulnerability> vulns = sessionFactory.getCurrentSession() .createCriteria(ChannelVulnerability.class) .add( Restrictions.eq("name", name).ignoreCase() ) .add( Restrictions.eq("channelType", channelType) ) .list(); if (vulns == null || vulns.isEmpty()) { LOG.error("Error: you should add a mapping for " + name + " for channel " + channelType.getName()); return null; } else { return vulns.get(0); } }
@Override public Map<String, List<ChannelVulnerability>> getChannelVulnsEachChannelType(List<ChannelType> channelTypes) { Map<String, List<ChannelVulnerability>> map = CollectionUtils.map(); for (ChannelType channelType: channelTypes) { map.put(channelType.getName(), (List<ChannelVulnerability>) sessionFactory.getCurrentSession() .createCriteria(ChannelVulnerability.class) .add(Restrictions.eq("channelType", channelType)) .addOrder(Order.asc("name")) .list()); } return map; }
@JsonView({AllViews.TableRow.class, AllViews.FormInfo.class, AllViews.RestView2_1.class, AllViews.RestViewScanStatistic.class, AllViews.RestViewScanList.class }) @Transient private String getScannerName() { return getApplicationChannel().getChannelType().getName(); }
@Transient public String getScannerType() { if (getApplicationChannel() != null && getApplicationChannel().getChannelType() != null && getApplicationChannel().getChannelType().getName() != null) { String scannerName = getApplicationChannel().getChannelType().getName(); if (DYNAMIC_TYPES.contains(scannerName)) { return DYNAMIC; } else if (STATIC_TYPES.contains(scannerName)) { return STATIC; } else if (MIXED_TYPES.contains(scannerName)) { return MIXED; } } return null; }
@Transient @JsonIgnore public List<ApplicationChannel> getUploadableChannels() { if (uploadableChannels != null) return uploadableChannels; List<ApplicationChannel> normalList = getChannelList(); if (normalList == null || normalList.size() == 0) return new ArrayList<ApplicationChannel>(); Set<String> doNotIncludeSet = new HashSet<String>(); doNotIncludeSet.add(ScannerType.MANUAL.getDisplayName()); doNotIncludeSet.add(ScannerType.SENTINEL.getDisplayName()); doNotIncludeSet.add(ScannerType.VERACODE.getDisplayName()); doNotIncludeSet.add(ScannerType.QUALYSGUARD_WAS.getDisplayName()); List<ApplicationChannel> returnList = new ArrayList<ApplicationChannel>(); for (ApplicationChannel channel : normalList) { if (channel != null && channel.getChannelType() != null && channel.getChannelType().getName() != null && !doNotIncludeSet.contains(channel.getChannelType().getName())) { returnList.add(channel); } } uploadableChannels = returnList; return returnList; }
@Transient @JsonView({ AllViews.TableRow.class, AllViews.VulnerabilityDetail.class, AllViews.UIVulnSearch.class, AllViews.RestVulnSearch.class }) private String getScannerName() { return getScan().getApplicationChannel().getChannelType().getName(); }
@Transient @JsonIgnore @Nullable public String getChannelNameOrNull() { return getScan() != null && getScan().getApplicationChannel() != null && getScan().getApplicationChannel().getChannelType() != null && getScan().getApplicationChannel().getChannelType().getName() != null ? getScan().getApplicationChannel().getChannelType().getName() : null; }
@Transient @JsonView({ AllViews.UIVulnSearch.class, AllViews.VulnSearchApplications.class, AllViews.RestVulnSearch.class }) public List<String> getChannelNames() { if (getFindings() == null || getFindings().isEmpty()) { return new ArrayList<String>(); } List<String> returnList = new ArrayList<String>(); for (Finding finding : getFindings()) { if (finding.getScan() != null && finding.getScan().getApplicationChannel() != null && finding.getScan().getApplicationChannel().getChannelType() != null) { returnList.add(finding.getScan().getApplicationChannel().getChannelType().getName()); } } return returnList; }