@Override public boolean isAllowed(final String key, final Map<String, Serializable> context) throws SExecutionException { @SuppressWarnings("unchecked") final Map<String, String[]> queryParameters = (Map<String, String[]>) context.get(URLAdapterConstants.QUERY_PARAMETERS); String[] idParamValue = new String[0]; if (queryParameters != null) { idParamValue = queryParameters.get(URLAdapterConstants.ID_QUERY_PARAM); } long taskInstanceId; if (idParamValue == null || idParamValue.length == 0) { throw new IllegalArgumentException("The parameter \"id\" is missing from the original URL"); } else { taskInstanceId = Long.parseLong(idParamValue[0]); try { long userId = sessionService.getSession(sessionAccessor.getSessionId()).getUserId(); return isTaskAvailableForOrExecutedByUser(taskInstanceId, userId); } catch (final SBonitaException e) { throw new SExecutionException("Unable to figure out if the task " + taskInstanceId + " is available for the user.", e); } } }
@Override public boolean isAllowed(final String key, final Map<String, Serializable> context) throws SExecutionException { @SuppressWarnings("unchecked") final Map<String, String[]> queryParameters = (Map<String, String[]>) context.get(URLAdapterConstants.QUERY_PARAMETERS); String[] idParamValue = new String[0]; if (queryParameters != null) { idParamValue = queryParameters.get(URLAdapterConstants.ID_QUERY_PARAM); } long taskInstanceId; if (idParamValue == null || idParamValue.length == 0) { throw new IllegalArgumentException("The parameter \"id\" is missing from the original URL"); } else { taskInstanceId = Long.parseLong(idParamValue[0]); try { long userId = sessionService.getSession(sessionAccessor.getSessionId()).getUserId(); return isTaskAvailableForOrExecutedByUser(taskInstanceId, userId); } catch (final SBonitaException e) { throw new SExecutionException("Unable to figure out if the task " + taskInstanceId + " is available for the user.", e); } } }