<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %> <%@ taglib prefix="carbon" uri="http://wso2.org/projects/carbon/taglibs/carbontags.jar" %> <%@ page import="org.apache.axis2.client.Options" %> <%@ page import="org.apache.axis2.context.ConfigurationContext" %> <%@ page import="org.wso2.carbon.CarbonConstants" %> <%@ page import="org.wso2.carbon.authenticator.stub.AuthenticationAdminStub" %> <%@ page import="org.wso2.carbon.humantask.stub.ui.task.client.api.types.TSimpleQueryCategory" %> <%@ page import="org.wso2.carbon.humantask.stub.ui.task.client.api.types.TSimpleQueryInput" %> <%@ page import="org.wso2.carbon.humantask.stub.ui.task.client.api.types.TTaskSimpleQueryResultRow" %> <%@ page import="org.wso2.carbon.humantask.stub.ui.task.client.api.types.TTaskSimpleQueryResultSet" %> <%@ page import="org.wso2.carbon.humantask.ui.clients.HumanTaskClientAPIServiceClient" %> <%@ page import="org.wso2.carbon.humantask.ui.util.HumanTaskUIUtil" %> <%@ page import="org.wso2.carbon.ui.CarbonUIUtil" %> <%@ page import="org.apache.commons.logging.LogFactory" %> <%@ page import="org.apache.commons.logging.Log" %> <% String cookie = request.getHeader("Cookie"); String requestSessionId = HumanTaskUIUtil.getCookieSessionId(cookie); String userName = request.getParameter("userName"); String password = request.getParameter("password"); String queryType = request.getParameter("queryType"); String logoutParam = request.getParameter("logout"); Log log = LogFactory.getLog("GADGET.jsp"); String logoutLink = "/carbon/humantask/task-list-gadget-ajaxprocessor.jsp?logout=true"; if ("true".equals(logoutParam)) { String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session) + "AuthenticationAdmin"; ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); AuthenticationAdminStub authenticationAdminStub = new AuthenticationAdminStub(configContext, backendServerURL); Options option = authenticationAdminStub._getServiceClient().getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, requestSessionId); authenticationAdminStub.logout(); response.setHeader("Set-Cookie", null); %> <% return; } if (userName != null && userName.trim().length() > 0 && password != null && password.trim().length() > 0) { String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session) + "AuthenticationAdmin"; ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); AuthenticationAdminStub authenticationAdminStub = new AuthenticationAdminStub(configContext, backendServerURL); try { Options option = authenticationAdminStub._getServiceClient().getOptions(); option.setManageSession(true); option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, requestSessionId); boolean loggedIn = authenticationAdminStub.login(userName.trim(), password.trim(), "0.0.0.0"); if (loggedIn) { String responseCookie = (String) authenticationAdminStub._getServiceClient().getServiceContext().getProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING); response.setHeader("Set-Cookie", responseCookie); requestSessionId = responseCookie; } else { %> <% return; } } catch (Exception ex) { HumanTaskUIUtil.logError(ex.getMessage(), ex); %> <% return; } } response.setHeader("Cache-Control", "no-cache"); // Pagination related; int numberOfPages = 0; String pageNumber = request.getParameter("pageNumber"); int pageNumberInt = 0; String parameters = null; if (pageNumber == null) { pageNumber = "0"; } try { pageNumberInt = Integer.parseInt(pageNumber); } catch (NumberFormatException ignored) { } String backendServerURL = CarbonUIUtil.getServerURL(config.getServletContext(), session); ConfigurationContext configContext = (ConfigurationContext) config.getServletContext().getAttribute(CarbonConstants.CONFIGURATION_CONTEXT); HumanTaskClientAPIServiceClient taskAPIClient; TTaskSimpleQueryResultSet taskResults = null; parameters = "queryType=" + queryType; try { taskAPIClient = new HumanTaskClientAPIServiceClient(requestSessionId, backendServerURL, configContext); TSimpleQueryInput queryInput = new TSimpleQueryInput(); queryInput.setPageNumber(pageNumberInt); queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ASSIGNED_TO_ME); if (queryType != null && !"".equals(queryType)) { if ("allTasks".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ALL_TASKS); } else if ("assignedToMe".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ASSIGNED_TO_ME); } else if ("adminTasks".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ASSIGNABLE); } else if ("claimableTasks".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.CLAIMABLE); } else if ("notifications".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.NOTIFICATIONS); } else if ("advancedQuery".equals(queryType)) { queryInput.setSimpleQueryCategory(TSimpleQueryCategory.ADVANCED_QUERY); } } taskResults = taskAPIClient.taskListQuery(queryInput); numberOfPages = taskResults.getPages(); } catch (Exception e) { %> <% } %> <% if (taskResults != null) { %> Task List
 
Task List
<%----%>

Task List

<% if (taskResults != null && taskResults.getRow() != null && taskResults.getRow().length > 0) { %> <% } else { %> <% } %> <% if (taskResults != null && taskResults.getRow() != null && taskResults.getRow().length > 0) { TTaskSimpleQueryResultRow[] rows = taskResults.getRow(); for (TTaskSimpleQueryResultRow row : rows) { %> <% } } %>
<%=row.getId().toString()%> -<%=row.getName().getLocalPart()%> <% String presentationName = HumanTaskUIUtil.getTaskPresentationHeader(row.getPresentationSubject(), row.getPresentationName()); %> <%=presentationName%> <%= row.getStatus().toString() %> <%= row.getPriority() %> <%= row.getCreatedTime().getTime().toString() %>
<% } %>