Retrieves the event id for a SIP Request event.

@param eventLookupFacility
@param request
@param inDialogActivity
if the event occurred in a dialog activity or not
@return
435879
public FireableEventType getEventId(EventLookupFacility eventLookupFacility,
			Request request, boolean inDialogActivity) {

		final String requestMethod = request.getMethod();
		
		// Cancel is always the same.
		if (requestMethod.equals(Request.CANCEL))
			inDialogActivity = false;

		FireableEventType eventID = null;
		if (inDialogActivity) {
			eventID = getEventId(eventLookupFacility,
					new StringBuilder(INDIALOG_REQUEST_EVENT_PREFIX).append(requestMethod).toString());
			if (eventID == null) {
				eventID = getEventId(eventLookupFacility,
						new StringBuilder(INDIALOG_REQUEST_EVENT_PREFIX).append(SIP_EXTENSION_REQUEST_EVENT_NAME_SUFIX).toString());
			}
		} else {
			eventID = getEventId(eventLookupFacility,
					new StringBuilder(OUT_OF_DIALOG_REQUEST_EVENT_PREFIX).append(requestMethod).toString());
			if (eventID == null) {
				eventID = getEventId(eventLookupFacility,
						new StringBuilder(OUT_OF_DIALOG_REQUEST_EVENT_PREFIX).append(SIP_EXTENSION_REQUEST_EVENT_NAME_SUFIX).toString());
			}
		}
		return eventID;
	}
1342696
private void addQueryParams(final Request request) {
        if (actorSid != null) {
            request.addQueryParam("ActorSid", actorSid);
        }

        if (eventType != null) {
            request.addQueryParam("EventType", eventType);
        }

        if (resourceSid != null) {
            request.addQueryParam("ResourceSid", resourceSid);
        }

        if (sourceIpAddress != null) {
            request.addQueryParam("SourceIpAddress", sourceIpAddress);
        }

        if (startDate != null) {
            request.addQueryParam("StartDate", startDate.toString());
        }

        if (endDate != null) {
            request.addQueryParam("EndDate", endDate.toString());
        }

        if (getPageSize() != null) {
            request.addQueryParam("PageSize", Integer.toString(getPageSize()));
        }
    }
1179301
@Override
    public PortletEventQueue getPortletEventQueue(HttpServletRequest request) {
        request = this.portalRequestUtils.getOriginalPortalRequest(request);

        synchronized (PortalWebUtils.getRequestAttributeMutex(request)) {
            PortletEventQueue portletEventQueue =
                    (PortletEventQueue) request.getAttribute(PORTLET_EVENT_QUEUE);
            if (portletEventQueue == null) {
                portletEventQueue = new PortletEventQueue();
                request.setAttribute(PORTLET_EVENT_QUEUE, portletEventQueue);
            }
            return portletEventQueue;
        }
    }
708909
@Override
	public void handleRequest(final Request request) {
		if (isDisabled()) {
			// Protect against client-side tampering of disabled/read-only fields.
			return;
		}

		// Remember which client side tab we were on.
		String[] indicesStr = request.getParameterValues(getId());

		if (indicesStr != null && indicesStr.length > 0) {
			List<Integer> oldIndices = getActiveIndices();
			List<Integer> changes = new ArrayList<>(1);
			int[] indices = new int[indicesStr.length];

			if (Util.empty(indicesStr[0])) {
				// Special case - no tab selected
				if (getType() == TYPE_ACCORDION) {
					indices = null;
				} else {
					int idx = findFirstVisibleTab();
					indices = new int[idx];
				}
			} else {
				// Normal case - one or more tabs selected
				for (int i = 0; i < indices.length; i++) {
					int clientIndex = Integer.parseInt(indicesStr[i]);
					int idx = clientIndexToTabIndex(clientIndex);
					indices[i] = idx;

					if (!oldIndices.contains(idx)) {
						// Check for a server mode tab and set focus
						WTab tab = getTab(idx);
						if (TabMode.SERVER.equals(tab.getMode()) && UIContextHolder.getCurrent().getFocussed() == null) {
							tab.setFocussed();
						}
						changes.add(idx);
					}
				}
			}

			setActiveIndices(indices);

			// Invoke action if tab selection has changed
			final Action action = getActionOnChange();

			if (action != null && !changes.isEmpty()) {
				final ActionEvent event = new ActionEvent(this, changes.toString(), null);

				Runnable later = new Runnable() {
					@Override
					public void run() {
						action.execute(event);
					}
				};

				invokeLater(later);
			}
		}

		String showHeadOnlyStr = request.getParameter(getId() + ".showHeadOnly");

		if (showHeadOnlyStr != null) {
			boolean showHeadOnly = "true".equals(showHeadOnlyStr);
			setShowHeadOnly(showHeadOnly);
		}
	}
192910
protected String verifyPortletWindowId(
            HttpServletRequest request, IPortletWindowId portletWindowId) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserLayoutManager userLayoutManager = preferencesManager.getUserLayoutManager();

        final IPortletWindow portletWindow =
                this.portletWindowRegistry.getPortletWindow(request, portletWindowId);
        final IPortletWindowId delegationParentWindowId = portletWindow.getDelegationParentId();
        if (delegationParentWindowId != null) {
            return verifyPortletWindowId(request, delegationParentWindowId);
        }

        final IPortletEntity portletEntity = portletWindow.getPortletEntity();
        final String channelSubscribeId = portletEntity.getLayoutNodeId();
        final IUserLayoutNodeDescription node = userLayoutManager.getNode(channelSubscribeId);
        if (node == null) {
            throw new IllegalArgumentException(
                    "No layout node exists for id "
                            + channelSubscribeId
                            + " of window "
                            + portletWindowId);
        }

        return node.getId();
    }
511291
@Override
	public void serviceRequest(final Request request) {

		// Get trigger id
		String triggerId = request.getParameter(WServlet.AJAX_TRIGGER_PARAM_NAME);
		if (triggerId == null) {
			throw new SystemException("No AJAX trigger id to on request");
		}

		// Find the Component for this trigger
		ComponentWithContext trigger = WebUtilities.getComponentById(triggerId,
				true);
		if (trigger == null) {
			throw new SystemException("No component found for AJAX trigger " + triggerId + ".");
		}
		WComponent triggerComponent = trigger.getComponent();

		// Check for an internal AJAX request (if client has flagged it as internal)
		boolean internal = request.getParameter(WServlet.AJAX_TRIGGER_INTERNAL_PARAM_NAME) != null;

		AjaxOperation ajaxOperation = null;
		if (internal) {
			if (!(triggerComponent instanceof AjaxInternalTrigger)) {
				throw new SystemException("AJAX trigger [" + triggerId + "] does not support internal actions.");
			}
			// Create internal operation
			ajaxOperation = new AjaxOperation(triggerId);
		} else {
			// Check for a registered AJAX operation
			ajaxOperation = AjaxHelper.getAjaxOperation(triggerId);

			// Override registered operation if it is a GET and trigger supports Internal AJAX
			// TODO This is only required until all components start using the Internal param flag
			if (ajaxOperation != null && "GET".equals(request.getMethod()) && triggerComponent instanceof AjaxInternalTrigger) {
				// Create internal operation
				ajaxOperation = new AjaxOperation(triggerId);
			}
		}

		// If no operation registered, check if the trigger supports internal AJAX then assume it is an Internal Action
		if (ajaxOperation == null && trigger.getComponent() instanceof AjaxInternalTrigger) {
			// Create internal operation
			ajaxOperation = new AjaxOperation(triggerId);
		}

		// No Valid operation
		if (ajaxOperation == null) {
			throw new SystemException("No AJAX operation has been registered for trigger " + triggerId + ".");
		}

		// Set current operation
		AjaxHelper.setCurrentOperationDetails(ajaxOperation, trigger);

		// Process Service Request
		super.serviceRequest(request);
	}
928287
@Override
  public void doPushNotificationRequestEvent(ClientShSession session, PushNotificationRequest request)
      throws InternalException, IllegalDiameterStateException, RouteException, OverloadException {
    // TODO Auto-generated method stub
  }
614965
function (activityId) {
      var i;
      for (i = 0; i < this._events.length; i++) {
         var evt = this._events[i];

         if (evt.eventType === "ActivityTaskCompleted") {
            if (this.activityIdFor(evt.activityTaskCompletedEventAttributes.scheduledEventId) === activityId) {

               var result = evt.activityTaskCompletedEventAttributes.result;

               try {
                  var d = JSON.parse(result);
                  return d;
               } catch (ex) {
                  return result;
               }

            }
         }
      }

      return null;
   }
479580
def activityrequest(self, event):
        

        # self.log("Event: '%s'" % event.__dict__)

        try:
            action = event.action
            data = event.data
            self.log("Activityrequest: ", action, data)

        except Exception as e:
            self.log("Error: '%s' %s" % (e, type(e)), lvl=error)
699414
@Override
    public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(
            HttpServletRequest request, HttpServletResponse response) {
        final PipelineEventReader<XMLEventReader, XMLEvent> pipelineEventReader =
                this.wrappedComponent.getEventReader(request, response);

        final XMLEventReader eventReader = pipelineEventReader.getEventReader();

        final IStylesheetDescriptor stylesheetDescriptor =
                stylesheetAttributeSource.getStylesheetDescriptor(request);

        final IPortalRequestInfo portalRequestInfo =
                this.urlSyntaxProvider.getPortalRequestInfo(request);

        final XMLEventReader filteredEventReader;
        if (portalRequestInfo.getTargetedPortletWindowId() == null) {
            final IStylesheetParameterDescriptor defaultWindowStateParam =
                    stylesheetDescriptor.getStylesheetParameterDescriptor(
                            "dashboardForcedWindowState");
            if (defaultWindowStateParam != null) {
                // Set all window states to the specified default
                final WindowState windowState =
                        PortletUtils.getWindowState(defaultWindowStateParam.getDefaultValue());
                filteredEventReader =
                        new SinglePortletWindowStateSettingXMLEventReader(
                                request, eventReader, windowState);
            } else {
                // Make sure there aren't any portlets in a "targeted" window state
                filteredEventReader =
                        new NonTargetedPortletWindowStateSettingXMLEventReader(
                                request, eventReader);
            }
        } else {
            // Not mobile, don't bother filtering
            filteredEventReader = eventReader;
        }

        final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
        return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(
                filteredEventReader, outputProperties);
    }
573169
public Address getEventFiringAddress() {
        if (eventFiringAddress == null) {
            eventFiringAddress = new Address(AddressPlan.SIP,
                    ((ToHeader) wrappedTransaction.getRequest().getHeader(ToHeader.NAME))
                    .getAddress().toString());
        }
        return eventFiringAddress;
    }
63096
public void processRequest(RequestEvent requestEvent) {
        // This will be invoked only by external endpoint
    	BalancerAppContent content=(BalancerAppContent)requestEvent.getSource();
    	boolean isIpv6 = content.isIpv6();
        final SipProvider sipProvider = content.getProvider();
        final Request request = requestEvent.getRequest();
        final String requestMethod = request.getMethod();

        if(logger.isDebugEnabled()) {
            logger.debug("got request:\n"+request);
        }
        
        if((requestMethod.equals(Request.OPTIONS) ||
                requestMethod.equals(Request.INFO)) &&
                request.getHeader("Mobicents-Heartbeat") != null &&
                sipProvider == balancerRunner.balancerContext.internalSipProvider) {
            byte[] bytes = (byte[]) request.getContent();
            Properties prop = new Properties();
            try {
                prop.load(new ByteArrayInputStream(bytes, 0, bytes.length));
                Node node = new Node(prop.getProperty("hostname"), prop.getProperty("ip"));
                for(String id : prop.stringPropertyNames()) {
                    node.getProperties().put(id, prop.getProperty(id));
                }
                ArrayList<Node> list = new ArrayList<Node>();
                list.add(node);
                this.register.handlePingInRegister(list);
                Response response = balancerRunner.balancerContext.messageFactory.createResponse(Response.OK, request);			
                sipProvider.sendResponse(response);	
                return;
            } catch (Exception e) {
                logger.error("Failure parsing heartbeat properties from this request " + request, e);
            }
        }
        //Issue 10: https://telestax.atlassian.net/browse/LB-10
        if (request.getContent() != null || (requestMethod.equals(Request.REGISTER) && sipProvider != balancerRunner.balancerContext.internalSipProvider)) {
            SIPMessage message = (SIPMessage)request;            

            String initialRemoteAddr = message.getPeerPacketSourceAddress().getHostAddress();
            String initialRemotePort = String.valueOf(message.getPeerPacketSourcePort());

            Header remoteAddrHeader = null;
            Header remotePortHeader = null;
            try {
                remoteAddrHeader = SipFactory.getInstance().createHeaderFactory().createHeader("X-Sip-Balancer-InitialRemoteAddr", initialRemoteAddr);
                remotePortHeader = SipFactory.getInstance().createHeaderFactory().createHeader("X-Sip-Balancer-InitialRemotePort", initialRemotePort);
            } catch (PeerUnavailableException e) {
                logger.error("Unexpected exception while creating custom headers for REGISTER message ", e);
            } catch (ParseException e) {
                logger.error("Unexpected exception while creating custom headers for REGISTER message ", e);
            }
            if (remoteAddrHeader != null)
                request.addHeader(remoteAddrHeader);
            if (remotePortHeader != null)
                request.addHeader(remotePortHeader);
        } 
        try {	
            updateStats(request);
            forwardRequest(sipProvider,request, isIpv6);          						
        } catch (Throwable throwable) {
            logger.error("Unexpected exception while forwarding the request " + request, throwable);
            if(!Request.ACK.equalsIgnoreCase(requestMethod)) {
                try {
                    Response response = balancerRunner.balancerContext.messageFactory.createResponse(Response.SERVER_INTERNAL_ERROR, request);			
                    sipProvider.sendResponse(response);	
                } catch (Exception e) {
                    logger.error("Unexpected exception while trying to send the error response for this " + request, e);
                }
            }
        }
    }
418956
@Override
    public IPortalRequestInfo getPortalRequestInfo(HttpServletRequest request) {
        request = this.portalRequestUtils.getOriginalPortalRequest(request);
        final IPortalRequestInfo cachedPortalRequestInfo =
                (IPortalRequestInfo) request.getAttribute(PORTAL_REQUEST_INFO_ATTR);
        if (cachedPortalRequestInfo != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("short-circuit: found portalRequestInfo within request attributes");
            }
            return cachedPortalRequestInfo;
        }

        synchronized (PortalWebUtils.getRequestAttributeMutex(request)) {
            // set a flag to say this request is currently being parsed
            final Boolean inProgressAttr =
                    (Boolean) request.getAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR);
            if (inProgressAttr != null && inProgressAttr) {
                if (logger.isDebugEnabled()) {
                    logger.warn("Portal request info parsing already in progress, returning null");
                }
                return null;
            }
            request.setAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR, Boolean.TRUE);
        }

        try {
            // Clone the parameter map so data can be removed from it as it is parsed to help
            // determine
            // what to do with non-namespaced parameters
            final Map<String, String[]> parameterMap = new ParameterMap(request.getParameterMap());

            final String requestPath = this.urlPathHelper.getPathWithinApplication(request);

            if (LEGACY_URL_PATHS.contains(requestPath)) {
                return parseLegacyPortalUrl(request, parameterMap);
            }

            final IUrlNodeSyntaxHelper urlNodeSyntaxHelper =
                    this.urlNodeSyntaxHelperRegistry.getCurrentUrlNodeSyntaxHelper(request);

            final PortalRequestInfoImpl portalRequestInfo = new PortalRequestInfoImpl();
            IPortletWindowId targetedPortletWindowId = null;
            PortletRequestInfoImpl targetedPortletRequestInfo = null;

            final String[] requestPathParts = SLASH_PATTERN.split(requestPath);

            UrlState requestedUrlState = null;
            ParseStep parseStep = ParseStep.FOLDER;
            for (int pathPartIndex = 0; pathPartIndex < requestPathParts.length; pathPartIndex++) {
                String pathPart = requestPathParts[pathPartIndex];

                logger.trace("In parseStep {} considering pathPart [{}].", parseStep, pathPart);

                if (StringUtils.isEmpty(pathPart)) {
                    continue;
                }

                switch (parseStep) {
                    case FOLDER:
                        {
                            parseStep = ParseStep.PORTLET;

                            if (FOLDER_PATH_PREFIX.equals(pathPart)) {

                                logger.trace(
                                        "Skipping adding {} to the folders deque "
                                                + "because it is simply the folder path prefix.",
                                        pathPart);

                                pathPartIndex++;

                                final LinkedList<String> folders = new LinkedList<String>();
                                for (; pathPartIndex < requestPathParts.length; pathPartIndex++) {
                                    pathPart = requestPathParts[pathPartIndex];

                                    if (PORTLET_PATH_PREFIX.equals(pathPart)) {
                                        logger.trace(
                                                "Found the portlet part of the path "
                                                        + "demarked by portlet path prefix [{}]; "
                                                        + "stepping back one path part to finish folder processing",
                                                pathPart);
                                        pathPartIndex--;
                                        break;
                                    } else {

                                        if (pathPart.endsWith(REQUEST_TYPE_SUFFIX)) {
                                            logger.trace(
                                                    "Found the end of the folder path with pathPart [{}];"
                                                            + " stepping back one, checking for state, "
                                                            + "and finishing folder parsing",
                                                    pathPart);
                                            pathPartIndex--;
                                            pathPart = requestPathParts[pathPartIndex];

                                            // If a state was added to the folder list remove it and
                                            // step back one so
                                            // other code can handle it
                                            if (UrlState.valueOfIngoreCase(pathPart, null)
                                                    != null) {
                                                logger.trace(
                                                        "A state was added to the end of folder list {};"
                                                                + " removing it.",
                                                        folders);
                                                folders.removeLast();
                                                pathPartIndex--;
                                            }
                                            break;
                                        }
                                    }

                                    logger.trace("Adding pathPart [{}] to folders.", pathPart);
                                    folders.add(pathPart);
                                }

                                logger.trace("Folders is [{}]", folders);
                                if (folders.size() > 0) {
                                    final String targetedLayoutNodeId =
                                            urlNodeSyntaxHelper.getLayoutNodeForFolderNames(
                                                    request, folders);
                                    portalRequestInfo.setTargetedLayoutNodeId(targetedLayoutNodeId);
                                }
                                break;
                            }
                        }
                        // fall through
                    case PORTLET:
                        {
                            parseStep = ParseStep.STATE;

                            final String targetedLayoutNodeId =
                                    portalRequestInfo.getTargetedLayoutNodeId();

                            if (PORTLET_PATH_PREFIX.equals(pathPart)) {
                                if (++pathPartIndex < requestPathParts.length) {
                                    pathPart = requestPathParts[pathPartIndex];

                                    targetedPortletWindowId =
                                            urlNodeSyntaxHelper.getPortletForFolderName(
                                                    request, targetedLayoutNodeId, pathPart);
                                }

                                break;
                            }

                            // See if a portlet was targeted by parameter
                            final String[] targetedPortletIds =
                                    parameterMap.remove(PARAM_TARGET_PORTLET);
                            if (targetedPortletIds != null && targetedPortletIds.length > 0) {
                                final String targetedPortletString = targetedPortletIds[0];
                                targetedPortletWindowId =
                                        urlNodeSyntaxHelper.getPortletForFolderName(
                                                request,
                                                targetedLayoutNodeId,
                                                targetedPortletString);
                            }
                        }
                        // fall through
                    case STATE:
                        {
                            parseStep = ParseStep.TYPE;

                            // States other than the default only make sense if a portlet is being
                            // targeted
                            if (targetedPortletWindowId == null) {
                                break;
                            }

                            requestedUrlState = UrlState.valueOfIngoreCase(pathPart, null);

                            // Set the URL state
                            if (requestedUrlState != null) {
                                portalRequestInfo.setUrlState(requestedUrlState);

                                // If the request is stateless
                                if (statelessUrlStates.contains(requestedUrlState)) {
                                    final IPortletWindow statelessPortletWindow =
                                            this.portletWindowRegistry
                                                    .getOrCreateStatelessPortletWindow(
                                                            request, targetedPortletWindowId);
                                    targetedPortletWindowId =
                                            statelessPortletWindow.getPortletWindowId();
                                }

                                // Create the portlet request info
                                targetedPortletRequestInfo =
                                        portalRequestInfo.getPortletRequestInfo(
                                                targetedPortletWindowId);
                                portalRequestInfo.setTargetedPortletWindowId(
                                        targetedPortletWindowId);

                                // Set window state based on URL State first then look for the
                                // window state parameter
                                switch (requestedUrlState) {
                                    case MAX:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    WindowState.MAXIMIZED);
                                        }
                                        break;

                                    case DETACHED:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    IPortletRenderer.DETACHED);
                                        }
                                        break;

                                    case EXCLUSIVE:
                                        {
                                            targetedPortletRequestInfo.setWindowState(
                                                    IPortletRenderer.EXCLUSIVE);
                                        }
                                        break;

                                    default:
                                        // Nothing to do -- some cases don't need treatment
                                }

                                break;
                            }
                        }
                        // fall through
                    case TYPE:
                        {
                            parseStep = ParseStep.COMPLETE;

                            if (pathPartIndex == requestPathParts.length - 1
                                    && pathPart.endsWith(REQUEST_TYPE_SUFFIX)
                                    && pathPart.length() > REQUEST_TYPE_SUFFIX.length()) {
                                final String urlTypePart =
                                        pathPart.substring(
                                                0,
                                                pathPart.length() - REQUEST_TYPE_SUFFIX.length());
                                final UrlType urlType;

                                // Handle inline resourceIds, look for a . in the request type
                                // string and use the suffix as the urlType
                                final int lastPeriod = urlTypePart.lastIndexOf('.');
                                if (lastPeriod >= 0 && lastPeriod < urlTypePart.length()) {
                                    final String urlTypePartSuffix =
                                            urlTypePart.substring(lastPeriod + 1);
                                    urlType = UrlType.valueOfIngoreCase(urlTypePartSuffix, null);
                                    if (urlType == UrlType.RESOURCE
                                            && targetedPortletRequestInfo != null) {
                                        final String resourceId =
                                                urlTypePart.substring(0, lastPeriod);
                                        targetedPortletRequestInfo.setResourceId(resourceId);
                                    }
                                } else {
                                    urlType = UrlType.valueOfIngoreCase(urlTypePart, null);
                                }

                                if (urlType != null) {
                                    portalRequestInfo.setUrlType(urlType);
                                    break;
                                }
                            }
                        }
                        // fall through
                    default:
                        // Nothing to do -- some cases don't need treatment
                }
            }

            // If a targeted portlet window ID is found but no targeted portlet request info has
            // been retrieved yet, set it up
            if (targetedPortletWindowId != null && targetedPortletRequestInfo == null) {
                targetedPortletRequestInfo =
                        portalRequestInfo.getPortletRequestInfo(targetedPortletWindowId);
                portalRequestInfo.setTargetedPortletWindowId(targetedPortletWindowId);
            }

            // Get the set of portlet window ids that also have parameters on the url
            final String[] additionalPortletIdArray = parameterMap.remove(PARAM_ADDITIONAL_PORTLET);
            final Set<String> additionalPortletIds =
                    Sets.newHashSet(
                            additionalPortletIdArray != null
                                    ? additionalPortletIdArray
                                    : new String[0]);

            // Used if there is delegation to capture form-submit and other non-prefixed parameters
            // Map of parent id to delegate id
            final Map<IPortletWindowId, IPortletWindowId> delegateIdMappings =
                    new LinkedHashMap<IPortletWindowId, IPortletWindowId>(0);

            // Parse all remaining parameters from the request
            final Set<Entry<String, String[]>> parameterEntrySet = parameterMap.entrySet();
            for (final Iterator<Entry<String, String[]>> parameterEntryItr =
                            parameterEntrySet.iterator();
                    parameterEntryItr.hasNext(); ) {
                final Entry<String, String[]> parameterEntry = parameterEntryItr.next();

                final String name = parameterEntry.getKey();
                final List<String> values = Arrays.asList(parameterEntry.getValue());

                /* NOTE: continues are being used to allow fall-through behavior like a switch statement would provide */

                // Portal Parameters, just need to remove the prefix
                if (name.startsWith(PORTAL_PARAM_PREFIX)) {
                    final Map<String, List<String>> portalParameters =
                            portalRequestInfo.getPortalParameters();
                    portalParameters.put(
                            this.safeSubstringAfter(PORTAL_PARAM_PREFIX, name), values);
                    parameterEntryItr.remove();
                    continue;
                }

                // Generic portlet parameters, have to remove the prefix and see if there was a
                // portlet windowId between the prefix and parameter name
                if (name.startsWith(PORTLET_PARAM_PREFIX)) {
                    final Tuple<String, IPortletWindowId> portletParameterParts =
                            this.parsePortletParameterName(request, name, additionalPortletIds);
                    final IPortletWindowId portletWindowId = portletParameterParts.second;
                    final String paramName = portletParameterParts.first;

                    // Get the portlet parameter map to add the parameter to
                    final Map<String, List<String>> portletParameters;
                    if (portletWindowId == null) {
                        if (targetedPortletRequestInfo == null) {
                            this.logger.warn(
                                    "Parameter "
                                            + name
                                            + " is for the targeted portlet but no portlet is targeted by the request. The parameter will be ignored. Value: "
                                            + values);
                            parameterEntryItr.remove();
                            break;
                        }

                        portletParameters = targetedPortletRequestInfo.getPortletParameters();
                    } else {
                        final PortletRequestInfoImpl portletRequestInfoImpl =
                                portalRequestInfo.getPortletRequestInfo(portletWindowId);
                        portletParameters = portletRequestInfoImpl.getPortletParameters();
                    }

                    portletParameters.put(paramName, values);
                    parameterEntryItr.remove();
                    continue;
                }

                // Portlet control parameters are either used directly or as a prefix to a windowId.
                // Use the
                // SuffixedPortletParameter to simplify their parsing
                for (final SuffixedPortletParameter suffixedPortletParameter :
                        SuffixedPortletParameter.values()) {
                    final String parameterPrefix = suffixedPortletParameter.getParameterPrefix();
                    // Skip to the next parameter prefix if the current doesn't match
                    if (!name.startsWith(parameterPrefix)) {
                        continue;
                    }

                    // All of these parameters require at least one value
                    if (values.isEmpty()) {
                        this.logger.warn(
                                "Ignoring parameter {} as it must have a value. Value: {}",
                                name,
                                values);
                        break;
                    }

                    // Verify the parameter is being used on the correct type of URL
                    final Set<UrlType> validUrlTypes = suffixedPortletParameter.getValidUrlTypes();
                    if (!validUrlTypes.contains(portalRequestInfo.getUrlType())) {
                        this.logger.warn(
                                "Ignoring parameter {} as it is only valid for {} requests and this is a "
                                        + "{} request. Value: {}",
                                name,
                                validUrlTypes,
                                portalRequestInfo.getUrlType(),
                                values);
                        break;
                    }

                    // Determine the portlet window and request info the parameter targets
                    final IPortletWindowId portletWindowId =
                            this.parsePortletWindowIdSuffix(
                                    request, parameterPrefix, additionalPortletIds, name);
                    final PortletRequestInfoImpl portletRequestInfo =
                            getTargetedPortletRequestInfo(
                                    portalRequestInfo, targetedPortletRequestInfo, portletWindowId);
                    if (portletRequestInfo == null) {
                        this.logger.warn(
                                "Parameter {} is for the targeted portlet but no portlet is targeted"
                                        + " by the request. The parameter will be ignored. Value: {}",
                                name,
                                values);
                        break;
                    }

                    parameterEntryItr.remove();

                    // Use the enum helper to store the parameter values on the request info
                    suffixedPortletParameter.updateRequestInfo(
                            request,
                            portletWindowRegistry,
                            portletRequestInfo,
                            values,
                            delegateIdMappings);
                    break;
                }
            }

            // Any non-namespaced parameters still need processing?
            if (!parameterMap.isEmpty()) {
                // If the parameter was not ignored by a previous parser add it to whatever was
                // targeted (portlet or portal)
                final Map<String, List<String>> parameters;
                if (!delegateIdMappings.isEmpty()) {
                    // Resolve the last portlet window in the chain of delegation
                    PortletRequestInfoImpl delegatePortletRequestInfo = null;
                    for (final IPortletWindowId delegatePortletWindowId :
                            delegateIdMappings.values()) {
                        if (!delegateIdMappings.containsKey(delegatePortletWindowId)) {
                            delegatePortletRequestInfo =
                                    portalRequestInfo.getPortletRequestInfo(
                                            delegatePortletWindowId);
                            break;
                        }
                    }

                    if (delegatePortletRequestInfo != null) {
                        parameters = delegatePortletRequestInfo.getPortletParameters();
                    } else {
                        this.logger.warn(
                                "No root delegate portlet could be resolved, non-namespaced parameters"
                                        + " will be sent to the targeted portlet. THIS SHOULD NEVER HAPPEN. Delegate"
                                        + " parent/child mapping: {}",
                                delegateIdMappings);

                        if (targetedPortletRequestInfo != null) {
                            parameters = targetedPortletRequestInfo.getPortletParameters();
                        } else {
                            parameters = portalRequestInfo.getPortalParameters();
                        }
                    }
                } else if (targetedPortletRequestInfo != null) {
                    parameters = targetedPortletRequestInfo.getPortletParameters();
                } else {
                    parameters = portalRequestInfo.getPortalParameters();
                }

                ParameterMap.putAllList(parameters, parameterMap);
            }

            // If a portlet is targeted but no layout node is targeted must be maximized
            if (targetedPortletRequestInfo != null
                    && portalRequestInfo.getTargetedLayoutNodeId() == null
                    && (requestedUrlState == null || requestedUrlState == UrlState.NORMAL)) {
                portalRequestInfo.setUrlState(UrlState.MAX);
                targetedPortletRequestInfo.setWindowState(WindowState.MAXIMIZED);
            }

            // Make the request info object read-only, once parsed the request info should be static
            portalRequestInfo.makeReadOnly();

            request.setAttribute(PORTAL_REQUEST_INFO_ATTR, portalRequestInfo);

            logger.debug("Finished building requestInfo: {}", portalRequestInfo);

            return portalRequestInfo;
        } finally {
            request.removeAttribute(PORTAL_REQUEST_PARSING_IN_PROGRESS_ATTR);
        }
    }
967193
protected Event getEventInfo(RequestDetails theRequestDetails) {
		Event event = new Event();
		event.setAction(mapResourceTypeToSecurityEventAction(theRequestDetails.getRestOperationType()));
		event.setDateTimeWithMillisPrecision(new Date());
		event.setOutcome(SecurityEventOutcomeEnum.SUCCESS); // we audit successful return of PHI only, otherwise an
																				// exception is thrown and no resources are returned to be
																				// audited
		return event;

	}
1159069
@SuppressWarnings("UnusedReturnValue")
    public static boolean sendAccessibilityEvent(View view) {
        final AccessibilityManager accessibilityManager = (AccessibilityManager)
                view.getContext().getSystemService(Context.ACCESSIBILITY_SERVICE);

        if (!accessibilityManager.isEnabled()) return false;

        final AccessibilityEvent accessibilityEvent = AccessibilityEvent
                .obtain(AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED);
        accessibilityEvent.setClassName(view.getClass().getName());
        accessibilityEvent.setPackageName(view.getContext().getPackageName());

        view.dispatchPopulateAccessibilityEvent(accessibilityEvent);
        accessibilityManager.sendAccessibilityEvent(accessibilityEvent);

        return true;
    }
555444
private String getEventLogName(String name, String id) {
    return String.format("%s-%s", name, id);
  }
1366439
protected Object getNewSelection(final Request request) {
		String paramValue = request.getParameter(getId());

		if (paramValue == null) {
			return null;
		}

		// Figure out which option has been selected.
		List<?> options = getOptions();

		if (options == null || options.isEmpty()) {
			if (!isEditable()) {
				// User could not have made a selection.
				return null;
			}

			options = Collections.EMPTY_LIST;
		}

		int optionIndex = 0;

		for (Object option : options) {
			if (option instanceof OptionGroup) {
				List<?> groupOptions = ((OptionGroup) option).getOptions();
				if (groupOptions != null) {
					for (Object nestedOption : groupOptions) {
						if (paramValue.equals(optionToCode(nestedOption, optionIndex++))) {
							return nestedOption;
						}
					}
				}
			} else if (paramValue.equals(optionToCode(option, optionIndex++))) {
				return option;
			}
		}

		// Option not found, but if editable, user entered text
		if (isEditable()) {
			return paramValue;
		}

		// Invalid option. Ignore and use the current selection
		LOG.warn(
				"Option \"" + paramValue + "\" on the request is not a valid option. Will be ignored.");
		Object currentOption = getValue();
		return currentOption;
	}