Search in sources :

Example 6 with CommonUtils.nullToEmptyList

use of org.eclipse.sw360.datahandler.common.CommonUtils.nullToEmptyList in project sw360portal by sw360.

the class MyTaskSubmissionsPortlet method doView.

@Override
public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException {
    List<ModerationRequest> moderations = null;
    try {
        final User user = UserCacheHolder.getUserFromRequest(request);
        moderations = thriftClients.makeModerationClient().getRequestsByRequestingUser(user);
    } catch (TException e) {
        log.error("Could not fetch your moderations from backend", e);
    }
    request.setAttribute(PortalConstants.MODERATION_REQUESTS, CommonUtils.nullToEmptyList(moderations));
    super.doView(request, response);
}
Also used : TException(org.apache.thrift.TException) ModerationRequest(org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest) User(org.eclipse.sw360.datahandler.thrift.users.User)

Aggregations

TException (org.apache.thrift.TException)6 User (org.eclipse.sw360.datahandler.thrift.users.User)6 Component (org.eclipse.sw360.datahandler.thrift.components.Component)3 ModerationRequest (org.eclipse.sw360.datahandler.thrift.moderation.ModerationRequest)3 ArrayList (java.util.ArrayList)1 ComponentService (org.eclipse.sw360.datahandler.thrift.components.ComponentService)1 Release (org.eclipse.sw360.datahandler.thrift.components.Release)1 ModerationService (org.eclipse.sw360.datahandler.thrift.moderation.ModerationService)1 ModerationPortletUtils (org.eclipse.sw360.portal.portlets.moderation.ModerationPortletUtils)1