@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.TableRow.class, AllViews.FormInfo.class, AllViews.PolicyPageView.class}) public String getName() { return application.getName(); } }
@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(); } } }
@Transient @JsonView(AllViews.VulnSearchApplications.class) public String getAppName() { return getApplication().getName(); }
@JsonView({ AllViews.TableRow.class, AllViews.RestViewScanStatistic.class}) @Transient private Map<String, Object> getApp() { Application app = getApplication(); Map<String, Object> map = new HashMap<String, Object>(); map.put("id", app.getId()); map.put("name", app.getName()); return map; }
@Transient @JsonIgnore public Info getInfo() { Info info = new Info(); info.applicationId = getId().toString(); info.organizationName = getOrganization().getName(); info.applicationName = getName(); return info; }
private void appendApplicationLink(StringBuilder description, Map<String, Object> descriptionUrlMap, HistoryView historyView) { if ((getApplication() != null) && (historyView != HistoryView.APPLICATION_HISTORY) && (historyView != HistoryView.VULNERABILITY_HISTORY)) { description.append(" ").append(buildApplicationLink(getApplication(), getApplication().getName(), descriptionUrlMap)); } }
@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; }
String applicationName = application.getName(); Integer id = application.getId();
@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; } }
@Transient @JsonProperty("application") @JsonView(AllViews.PolicyPageView.class) public Map<String, Object> getApplicationJson() { if(application != null) { return map( "id", application.getId(), "name", application.getName(), "team", map( "id", application.getOrganization().getId(), "name", application.getOrganization().getName())); } else { return null; } }
@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; } }
@Transient @JsonProperty("accessControlTeamMaps") @JsonView(AllViews.TableRow.class) public List<?> getAccessControlTeamMapsJSON() { List<Map<?, ?>> teamMaps = list(); if (this.accessControlTeamMaps != null) { for (AccessControlTeamMap accessControlTeamMap : this.accessControlTeamMaps) { List<Map<?, ?>> appMaps = list(); if (accessControlTeamMap.getAccessControlApplicationMaps() != null) { for (AccessControlApplicationMap appMap : accessControlTeamMap.getAccessControlApplicationMaps()) { appMaps.add(map( "teamName", accessControlTeamMap.getOrganization().getName(), "roleName", appMap.getRole() != null ? appMap.getRole().getDisplayName() : "-", "appName", appMap.getApplication().getName(), "active", appMap.isActive() ) ); } } teamMaps.add(map( "roleName", accessControlTeamMap.getRole() != null ? accessControlTeamMap.getRole().getDisplayName() : "-", "teamName", accessControlTeamMap.getOrganization().getName(), "appRoles", appMaps ) ); } } return teamMaps; }