@@ -2927,6 +2927,39 @@ public void getlicenseClearingCount(
29272927 }
29282928 }
29292929
2930+ @ Operation (
2931+ description = "Get license clearing details counts for `Clearing Detail` field " +
2932+ "at Administration tab of project detail page." ,
2933+ tags = {"Projects" }
2934+ )
2935+ @ RequestMapping (value = PROJECTS_URL + "/{id}/clearingDetailsCount" , method = RequestMethod .GET )
2936+ public void getlicenseClearingDetailsCount (
2937+ HttpServletResponse response ,
2938+ @ Parameter (description = "Project ID" , example = "376521" )
2939+ @ PathVariable ("id" ) String id
2940+ ) throws TException {
2941+ User sw360User = restControllerHelper .getSw360UserFromAuthentication ();
2942+ restControllerHelper .throwIfSecurityUser (sw360User );
2943+ Project sw360Project = projectService .getProjectForUserById (id , sw360User );
2944+
2945+ Project proj = projectService .getClearingInfo (sw360Project , sw360User );
2946+ ReleaseClearingStateSummary clearingInfo = proj .getReleaseClearingStateSummary ();
2947+ int releaseCount = clearingInfo .newRelease + clearingInfo .sentToClearingTool + clearingInfo .underClearing + clearingInfo .reportAvailable + clearingInfo .approved ;
2948+
2949+ try {
2950+ JsonObject row = new JsonObject ();
2951+ row .addProperty ("newClearing" ,clearingInfo .newRelease );
2952+ row .addProperty ("underClearing" ,clearingInfo .underClearing );
2953+ row .addProperty ("sentToClearingTool" ,clearingInfo .sentToClearingTool );
2954+ row .addProperty ("reportAvailable" ,clearingInfo .reportAvailable );
2955+ row .addProperty ("approved" ,clearingInfo .approved );
2956+ row .addProperty ("totalReleases" , releaseCount );
2957+ response .getWriter ().write (row .toString ());
2958+ } catch (IOException e ) {
2959+ throw new SW360Exception (e .getMessage ());
2960+ }
2961+ }
2962+
29302963 @ Operation (
29312964 description = "Get license obligations data from license database." ,
29322965 tags = {"Projects" }
0 commit comments