use of org.eclipse.sw360.datahandler.common.CommonUtils.isTemporaryTodo in project sw360portal by sw360.
the class LicensesPortlet method prepareDetailView.
private void prepareDetailView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
String id = request.getParameter(LICENSE_ID);
User user = UserCacheHolder.getUserFromRequest(request);
request.setAttribute(IS_USER_AT_LEAST_CLEARING_ADMIN, PermissionUtils.isUserAtLeast(UserGroup.CLEARING_ADMIN, user) ? "Yes" : "No");
if (id != null) {
try {
LicenseService.Iface client = thriftClients.makeLicenseClient();
License moderationLicense = client.getByIDWithOwnModerationRequests(id, user.getDepartment(), user);
List<Todo> allTodos = nullToEmptyList(moderationLicense.getTodos());
List<Todo> addedTodos = allTodos.stream().filter(CommonUtils::isTemporaryTodo).collect(Collectors.toList());
List<Todo> currentTodos = allTodos.stream().filter(t -> !CommonUtils.isTemporaryTodo(t)).collect(Collectors.toList());
request.setAttribute(ADDED_TODOS_FROM_MODERATION_REQUEST, addedTodos);
request.setAttribute(DB_TODOS_FROM_MODERATION_REQUEST, currentTodos);
request.setAttribute(MODERATION_LICENSE_DETAIL, moderationLicense);
License dbLicense = client.getByID(id, user.getDepartment());
request.setAttribute(KEY_LICENSE_DETAIL, dbLicense);
List<Obligation> obligations = client.getObligations();
request.setAttribute(KEY_OBLIGATION_LIST, obligations);
addLicenseBreadcrumb(request, response, moderationLicense);
} catch (TException e) {
log.error("Error fetching license details from backend", e);
setSW360SessionError(request, ErrorMessages.ERROR_GETTING_LICENSE);
}
}
}
Aggregations