Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Commit

Permalink
fix(moderation): set all using project count to merge pages
Browse files Browse the repository at this point in the history
  • Loading branch information
maierthomas committed Apr 9, 2018
1 parent a183488 commit e944e3f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright Siemens AG, 2013-2017. Part of the SW360 Portal Project.
* Copyright Siemens AG, 2013-2018. Part of the SW360 Portal Project.
*
* SPDX-License-Identifier: EPL-1.0
*
Expand Down Expand Up @@ -399,18 +399,21 @@ private void prepareComponent(RenderRequest request, User user, Component actual
Set<String> releaseIds = SW360Utils.getReleaseIds(releases);

Set<Project> usingProjects = null;
int allUsingProjectsCount = 0;

if (releaseIds != null && releaseIds.size() > 0) {
try {
ProjectService.Iface projectClient = thriftClients.makeProjectClient();
usingProjects = projectClient.searchByReleaseIds(releaseIds, user);
allUsingProjectsCount = projectClient.getCountByReleaseIds(releaseIds);
} catch (TException e) {
log.error("Could not retrieve using projects", e);
}
}
request.setAttribute(DOCUMENT_TYPE, SW360Constants.TYPE_COMPONENT);
setAttachmentsInRequest(request, actualComponent.getAttachments());
request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects));
request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount);
}

public void renderReleaseModeration(RenderRequest request, RenderResponse response, ModerationRequest moderationRequest, User user) throws IOException, PortletException, TException {
Expand Down Expand Up @@ -464,6 +467,8 @@ private void prepareRelease(RenderRequest request, User user, Release actualRele
ProjectService.Iface projectClient = thriftClients.makeProjectClient();
Set<Project> usingProjects = projectClient.searchByReleaseId(actualReleaseId, user);
request.setAttribute(USING_PROJECTS, nullToEmptySet(usingProjects));
int allUsingProjectsCount = projectClient.getCountByReleaseIds(Collections.singleton(actualReleaseId));
request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount);
putDirectlyLinkedReleaseRelationsInRequest(request, actualRelease);
} catch (TException e) {
log.error("Could not retrieve using projects", e);
Expand Down Expand Up @@ -517,6 +522,8 @@ private void prepareProject(RenderRequest request, User user, Project actual_pro
putDirectlyLinkedReleasesInRequest(request, actual_project);
Set<Project> usingProjects = client.searchLinkingProjects(actual_project.getId(), user);
request.setAttribute(USING_PROJECTS, usingProjects);
int allUsingProjectsCount = client.getCountByProjectId(actual_project.getId());
request.setAttribute(ALL_USING_PROJECTS_COUNT, allUsingProjectsCount);
putReleasesAndProjectIntoRequest(request, actual_project.getId(), user);
request.setAttribute(DOCUMENT_TYPE, SW360Constants.TYPE_PROJECT);
setAttachmentsInRequest(request, actual_project.getAttachments());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

<jsp:useBean id="usingProjects" type="java.util.Set<org.eclipse.sw360.datahandler.thrift.projects.Project>"
scope="request"/>

<jsp:useBean id="allUsingProjectsCount" type="java.lang.Integer" scope="request"/>
<jsp:useBean id="usingComponents" type="java.util.Set<org.eclipse.sw360.datahandler.thrift.components.Component>" scope="request"/>

<core_rt:set var="programmingLanguages" value='<%=PortalConstants.PROGRAMMING_LANGUAGES%>'/>
Expand Down

0 comments on commit e944e3f

Please sign in to comment.