private String buildApplicationLink(Application application, String linkText, Map<String, Object> urlMap) { if ((application == null) || (!application.isActive())) { return linkText; } String urlString = "/organizations/" + application.getOrganization().getId() + "/applications/" + application.getId(); return buildLink(urlString, linkText, urlMap); }
@Transient @JsonIgnore public Info getInfo() { Info info = new Info(); info.applicationId = getId().toString(); info.organizationName = getOrganization().getName(); info.applicationName = getName(); return info; }
@Override public Map<String, Object> getAllVersionsByAppId(List<Integer> appIds) { Session session = sessionFactory.getCurrentSession(); Criteria criteria = session.createCriteria(Application.class); criteria.add(Restrictions.eq("active", true)); criteria.createAlias("versions", "version"); if (appIds != null) criteria.add(Restrictions.in("id", appIds)); List<Application> applications = (List<Application>) criteria.list(); Map<String, Object> map = CollectionUtils.map(); for (Application application: applications) { map.put(application.getOrganization().getName() + " / " + application.getName(), application.getVersions()); } return map; }
@Transient @JsonView({AllViews.FormInfo.class}) public List<Map> getAssociatedApplications() { List<Map> apps = list(); if (applications != null) { for (Application application: applications) { apps.add(map("id", application.getId(), "name", application.getName(), "team", application.getTeam())); } } return apps; }
@Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{application.id="); sb.append(this.application.getId()); sb.append(", scanner="); sb.append(this.scanner); sb.append(", status="); sb.append(this.showStatusString()); sb.append("}"); return sb.toString(); }
@Transient @JsonView({ AllViews.RestViewTag.class, AllViews.VulnerabilityDetail.class }) public Map<String, Object> getCommentInfo(){ Map<String, Object> commentInfo = new HashMap<String, Object>(); commentInfo.put("commentId", getId()); commentInfo.put("comment", getComment()); if (getVulnerability() != null && getVulnerability().getApplication() != null && getVulnerability().getApplication().isActive()) { commentInfo.put("vulnerabilityId", getVulnerability().getId()); commentInfo.put("vulnerabilityName", getVulnerability().getGenericVulnerability().getName()); commentInfo.put("vulnerabilityDisplayId", getVulnerability().getGenericVulnerability().getDisplayId()); commentInfo.put("applicationId", getVulnerability().getApplication().getId()); commentInfo.put("applicationName", getVulnerability().getApplication().getName()); commentInfo.put("teamId", getVulnerability().getApplication().getOrganization().getId()); commentInfo.put("teamName", getVulnerability().getApplication().getOrganization().getName()); Map<String, Object> severityMap = new HashMap<String, Object>(); severityMap.put("name", getVulnerability().getGenericSeverity().getName()); severityMap.put("intValue", getVulnerability().getGenericSeverity().getIntValue()); severityMap.put("displayName", getVulnerability().getGenericSeverity().getDisplayName()); commentInfo.put("genericSeverity", severityMap); } commentInfo.put("tags", getTags()); commentInfo.put("username", getUsername()); commentInfo.put("time", getTime()); return commentInfo; } }
public void updateVulnerabilityReport() { int info = 0, low = 0, medium = 0, high = 0, critical = 0, total = 0; for (Application app : this.applications) { if (app != null && app.isActive()) { info += app.getInfoVulnCount(); low += app.getLowVulnCount(); medium += app.getMediumVulnCount(); high += app.getHighVulnCount(); critical += app.getCriticalVulnCount(); total += app.getTotalVulnCount(); } } setInfoVulnCount(info); setLowVulnCount(low); setMediumVulnCount(medium); setHighVulnCount(high); setCriticalVulnCount(critical); setTotalVulnCount(total); }
@Transient @JsonView(Object.class) // This means it will be included in all ObjectWriters with Views. public String getFullName() { if (referenceApplication != null) { return referenceApplication.getName() + " / " + name; } return name; }
@Transient @JsonView({ AllViews.RestViewApplication2_1.class, AllViews.RestViewTeams2_1.class, AllViews.RestCreateApplication2_1.class, AllViews.RestViewWafs2_1.class }) @JsonProperty("organization") public Map<String, Object> getOrganizationRest() { Organization team = getOrganization(); Map<String, Object> map = new HashMap<String, Object>(); map.put("id", team.getId()); map.put("name", team.getName()); return map; }
@Transient @JsonView({AllViews.TableRow.class, AllViews.GRCToolsPage.class, AllViews.RestViewTeam2_1.class, AllViews.RestViewTeams2_1.class, AllViews.VulnSearchApplications.class }) @JsonProperty("applications") public List<Application> getActiveApplications() { if (activeApps == null && this.applications != null) { activeApps = new ArrayList<Application>(); for (Application application : this.applications) { if (application.isActive()) activeApps.add(application); } } return activeApps; }
List<ApplicationVersion> versions = list(); List<ApplicationVersion> applicationVersions = listFrom(getApplication().getVersions()); List<ScanCloseVulnerabilityMap> closeMaps = listFrom(this.getScanCloseVulnerabilityMaps()); List<ScanReopenVulnerabilityMap> reopenMaps = listFrom(this.getScanReopenVulnerabilityMaps());
@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 @JsonIgnore public List<Integer> getActiveAppIds(){ List<Integer> applicationIdList = CollectionUtils.list(); for (Application application : getActiveApplications()) { if (application != null) { applicationIdList.add(application.getId()); } } return applicationIdList; }
@Transient @JsonView({AllViews.TableRow.class, AllViews.FormInfo.class, AllViews.PolicyPageView.class}) public String getName() { return application.getName(); } }
@Transient @JsonView({ AllViews.TableRow.class, AllViews.FormInfo.class, AllViews.VulnSearchApplications.class, AllViews.RestViewTag.class, AllViews.DefectTrackerInfos.class, AllViews.PolicyPageView.class, AllViews.RestViewTeams2_1.class, AllViews.RestViewWafs2_1.class }) public Map<String, Object> getTeam() { Organization team = getOrganization(); Map<String, Object> map = new HashMap<String, Object>(); if (team != null) { map.put("id", team.getId()); map.put("name", team.getName()); } return map; }
@JsonView({ AllViews.RestViewWaf2_1.class, AllViews.RestViewWafs2_1.class }) @Transient @JsonProperty("applications") public List<Application> getActiveApplications() { List<Application> list = list(); if (applicationList != null) { for (Application application : applicationList) { if (application.isActive()) { list.add(application); } } } return list; }
private String buildScanLink(Scan scan, String linkText, Map<String, Object> urlMap) { if (scan == null) { return linkText; } Application application = getApplication(); if (application == null) { application = scan.getApplication(); } if ((application == null) || (!application.isActive())) { return linkText; } Organization organization = application.getOrganization(); if ((organization == null) || (!organization.isActive())) { return linkText; } String urlString = "/organizations/" + scan.getApplication().getOrganization().getId() + "/applications/" + scan.getApplication().getId() + "/scans/" + scan.getId(); return buildLink(urlString, linkText, urlMap); }
@Transient @JsonProperty("application") @JsonView(Object.class) public Map<String, ? extends Serializable> getApplicationJson() { if(application != null) { return map( "id", application.getId(), "name", application.getName(), "teamName", application.getOrganization().getName(), "teamId", application.getOrganization().getId()); } else { return null; } }