Restore any saved FacesMessages from the previous request.
Note that we don't need to save the keepMessages value for this request,
because we just have to check if the value for FLASH_KEEP_MESSAGES_LIST exists.
@param facesContext
761175
@SuppressWarnings("unchecked")
    private void _restoreMessages(FacesContext facesContext)
    {
        List<MessageEntry> messageList = (List<MessageEntry>) 
                _getExecuteFlashMap(facesContext).get(FLASH_KEEP_MESSAGES_LIST);

        if (messageList != null)
        {
            Iterator<MessageEntry> iterMessages = messageList.iterator();

            while (iterMessages.hasNext())
            {
                MessageEntry entry = iterMessages.next();
                facesContext.addMessage(entry.clientId, entry.message);
            }

            // we can now remove the messagesList from the flashMap
            _getExecuteFlashMap(facesContext).remove(FLASH_KEEP_MESSAGES_LIST);
        }
    }
725011
void addNewMessage(JsMessageWrapper message, boolean isStored, boolean isRecoverable)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc,
                  "addNewMessage",
                  new Object[] { new Integer(hashCode()),
                                 message,
                                 new Boolean(isStored)});

    JsMessage jsMsg = message.getMessage();

    long id = jsMsg.getSystemMessageValue();
    SIBUuid8 uuid = jsMsg.getSystemMessageSourceUuid();

    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      SibTr.debug(tc,
                  "addNewMessage",
                  new Object[] { new Integer(hashCode()),
                                 new Long(jsMsg.getSystemMessageValue()),
                                 jsMsg.getSystemMessageSourceUuid(),
                                 message,
                                 new Boolean(isStored)});

    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      SibTr.debug(localConsumerPoint, tc, "verboseMsg OUT : " + message.getMessage().toVerboseString());

    synchronized(this)
    {
      LMEMessage newElement = null;
      long messageReferenceExpiry = messageProcessor.getCustomProperties().get_message_reference_expiry_value();

      // We have to create an object if the pool is empty
      if(pooledMsg == null)
      {
        newElement = new LMEMessage(id, uuid, message, isStored, isRecoverable, messageLockExpiry, messageReferenceExpiry);
      }
      // Otherwise pop the first pooled object and use that
      else
      {
        newElement = pooledMsg;
        pooledMsg = pooledMsg.next;
        newElement.next = null;
        pooledCount--;

        newElement.reuseMessage(id, uuid, message, isStored, isRecoverable, messageLockExpiry, messageReferenceExpiry);
      }

      // Add the message to the end of the list
      newElement.previous = lastMsg;
      if(lastMsg != null)
        lastMsg.next = newElement;
      else
        firstMsg = newElement;
      lastMsg = newElement;

      // If the locks are set to expire and this is the first message we need to
      // register an alarm
      if(messageLockExpiry != 0)
      {
        // If there are no other messages expiring, this will be the first one
        if(nextMsgToExpire == null)
          nextMsgToExpire = newElement;

        // If we don't have an alarm registered, register one now
        if(!alarmRegistered)
        {
          if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "addNewMessage", "Registering MessageLock Expiry alarm for: " + nextMsgToExpire);

          alarmManager.create(messageLockExpiry, this);
          alarmRegistered = true;
        }
      }

      if (messageReferenceExpiry != 0)
      {
        if (messageLockExpiry != 0 && messageReferenceExpiry > messageLockExpiry)
        {
          // The messageReferenceExpiry is greater than the messageLockExpiry. There is no
          // point in creating the alarm for messageReferenceExpiry as the message lock expiry
          // will always go first.
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
          {
            SibTr.debug(tc, "MessageReferenceExpiry: "+messageReferenceExpiry+" is greater than messageLockExpiry: "+messageLockExpiry);
            SibTr.debug(tc, "MessageReferneceExpiry Alarm not registered");
          }
        }
        else
        {
          try
          {
            if (message.getReportCOD() == null)
            {
              // Now register the message reference expiry alarm
              // If there are no other message references expiring, this will be the first one
              if(nextMsgReferenceToExpire == null)
                nextMsgReferenceToExpire = newElement;

              // If we don't have an alarm registered, register one now
              if(!msgReferenceAlarmRegistered)
              {
                if(TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                  SibTr.debug(tc, "addNewMessage", "Registering MessageReference Expiry alarm for: " + nextMsgReferenceToExpire);

                alarmManager.create(messageReferenceExpiry, new MessageReferenceExpiryAlarm());
                msgReferenceAlarmRegistered = true;
              }
            }
          }
          catch(SIResourceException e)
          {
            // No FFDC code needed

            // There was a problem getting hold of the ReportCOD of the message
            // assume it is set and don't create the expiry alarm.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
              SibTr.debug(tc, "Thrown exception when trying to create msg ref expiry alarm: " + e);
          }
        }
     }

      // By adding a message we must be about to call consumeMessages and therefore
      // we're in a valid state for calls
      validState = true;
    } // synchronized

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addNewMessage", this);
  }
1213321
@Override
    public void doPostPhaseActions(FacesContext facesContext)
    {
        if (!_flashScopeDisabled)
        {
            // do the actions only if this is the last time
            // doPostPhaseActions() is called on this request
            if (_isLastPhaseInRequest(facesContext))
            {
                if (_isRedirectTrueOnThisRequest(facesContext))
                {
                    // copy entries from executeMap to renderMap, if they do not exist
                    Map<String, Object> renderMap = _getRenderFlashMap(facesContext);

                    for (Map.Entry<String, Object> entry 
                        : _getExecuteFlashMap(facesContext).entrySet())
                    {
                        if (!renderMap.containsKey(entry.getKey()))
                        {
                            renderMap.put(entry.getKey(), entry.getValue());
                        }
                    }
                }
            
                // remove execute Map entries from session (--> "destroy" executeMap)
                _clearExecuteFlashMap(facesContext);
            
                // save the current FacesMessages in the renderMap, if wanted
                // Note that this also works on a redirect even though the redirect
                // was already performed and the response has already been committed,
                // because the renderMap is stored in the session.
                _saveMessages(facesContext);
                
                _clearRenderFlashTokenIfMapEmpty(facesContext);
            }
        }
    }
97148
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        methodExpressionOneArg = (MethodExpression) ((Object[]) state)[0];
        methodExpressionZeroArg = (MethodExpression) ((Object[]) state)[1];

    }
806660
@Override
    public void acknowledge(SQSMessage message) throws JMSException {
        session.checkClosed();

        SQSMessageIdentifier ackMessage = SQSMessageIdentifier.fromSQSMessage(message);

        int indexOfMessage = indexOf(ackMessage);

        /**
         * In case the message has already been deleted, warn user about it and
         * return. If not then then it should continue with acknowledging all
         * the messages received before that
         */
        if (indexOfMessage == -1) {
            LOG.warn("SQSMessageID: " + message.getSQSMessageId() + " with SQSMessageReceiptHandle: " +
                     message.getReceiptHandle() + " does not exist.");
        } else {
            bulkAction(getUnAckMessages(), indexOfMessage);
        }
    }
342080
public void setDeletedFaces(java.util.Collection<String> deletedFaces) {
        if (deletedFaces == null) {
            this.deletedFaces = null;
            return;
        }

        this.deletedFaces = new java.util.ArrayList<String>(deletedFaces);
    }
177380
public void restoreState(FacesContext facesContext, Object state)
    {
        if (state != null)
        {
            if (state instanceof ValueExpression)
            {
                _valueExpression = (ValueExpression) state;
            }
            else
            {
                Object[] stateArray = (Object[]) state;
                _valueExpression
                        = (ValueExpression) ClassUtils.newInstance((String) stateArray[0], ValueExpression.class);
                ((StateHolder) _valueExpression).restoreState(facesContext, stateArray[1]);
            }
        }
    }
963727
private boolean _isRedirectTrueOnPreviousRequest(FacesContext facesContext)
    {
        ExternalContext externalContext = facesContext.getExternalContext();
        Map<String, Object> requestMap = externalContext.getRequestMap();
        Boolean redirect = (Boolean) requestMap.get(FLASH_PREVIOUS_REQUEST_REDIRECT);
        
        return Boolean.TRUE.equals(redirect);
    }
956745
public void restoreState(FacesContext facesContext, Object state)
    {
        if (state != null)
        {
            Object values[] = (Object[])state;
            _currencyCode = (String)values[0];
            _currencySymbol = (String)values[1];
            _locale = (Locale)values[2];
            Integer value = (Integer)values[3];
            _maxFractionDigits = value != null ? value.intValue() : 0;
            value = (Integer)values[4];
            _maxIntegerDigits = value != null ? value.intValue() : 0;
            value = (Integer)values[5];
            _minFractionDigits = value != null ? value.intValue() : 0;
            value = (Integer)values[6];
            _minIntegerDigits = value != null ? value.intValue() : 0;
            _pattern = (String)values[7];
            _type = (String)values[8];
            _groupingUsed = ((Boolean)values[9]).booleanValue();
            _integerOnly = ((Boolean)values[10]).booleanValue();
            _maxFractionDigitsSet = ((Boolean)values[11]).booleanValue();
            _maxIntegerDigitsSet = ((Boolean)values[12]).booleanValue();
            _minFractionDigitsSet = ((Boolean)values[13]).booleanValue();
            _minIntegerDigitsSet = ((Boolean)values[14]).booleanValue();
        }
    }
641759
protected function restoreCachedActionMessages(Request $request) {
        if ($request->hasSessionId() && $request->getSession()) {
            $messages = $errors = [];

            if (isset($_SESSION[ACTION_MESSAGES_KEY])) {
                $messages = $_SESSION[ACTION_MESSAGES_KEY];
                unset($_SESSION[ACTION_MESSAGES_KEY]);
            }
            if (isset($_SESSION[ACTION_ERRORS_KEY])) {
                $errors = $_SESSION[ACTION_ERRORS_KEY];
                unset($_SESSION[ACTION_ERRORS_KEY]);
            }
            $request->setAttribute(ACTION_MESSAGES_KEY, \array_merge($messages, $errors));
        }
    }
153931
private void saveInitialChildState(FacesContext facesContext, UIComponent component) {
        if (component instanceof EditableValueHolder && !component.isTransient()) {
            String clientId = component.getClientId(facesContext);
            SavedState state = new SavedState();
            initialChildState.put(clientId, state);
            state.populate((EditableValueHolder) component);
        }

        Iterator<UIComponent> iterator = component.getFacetsAndChildren();
        while (iterator.hasNext()) {
            saveChildState(facesContext, iterator.next());
        }
    }
314742
public void restoreState(FacesContext context, Object state) {

        if (context == null) {
            throw new NullPointerException();
        }
        if (state == null) {
            return;
        }
        
        if (!component.initialStateMarked() && !defaultMap.isEmpty())
        {
            defaultMap.clear();
            if(deltaMap != null && !deltaMap.isEmpty())
            {
                deltaMap.clear();
            }
        }
        
        Object[] savedState = (Object[]) state;
        if (savedState[savedState.length - 1] != null) {
            component.initialState = (Boolean) savedState[savedState.length - 1];
        }
        int length = (savedState.length-1)/2;
        for (int i = 0; i < length; i++) {
           Object value = savedState[i * 2 + 1];
            Serializable serializable = (Serializable) savedState[i * 2];
            if (value != null) {
                if (value instanceof Collection) {
                    value = restoreAttachedState(context, value);
                } else if (value instanceof StateHolderSaver) {
                    value = ((StateHolderSaver) value).restore(context);
                } else {
                    value = (value instanceof Serializable
                             ? value
                             : restoreAttachedState(context, value));
                }
            }
            if (value instanceof Map) {
                for (Map.Entry<String, Object> entry : ((Map<String, Object>) value)
                      .entrySet()) {
                    this.put(serializable, entry.getKey(), entry.getValue());
                }
            } else if (value instanceof List) {
                List<Object> list = (List) get(serializable);
                for (Object o : ((List<Object>) value)) {
                    if (list == null || !list.contains(o)) {
                        this.add(serializable, o);
                    }
                }
            } else {
                put(serializable, value);
            }
        }
    }
543292
public final void restoreDefaults() {
        SharedPreferences sharedPreferences = getPreferenceManager().getSharedPreferences();

        if (getPreferenceScreen() != null) {
            restoreDefaults(getPreferenceScreen(), sharedPreferences);
        }
    }
1025894
public Object saveTransientState(FacesContext context)
    {
        TransientStateHelper helper = getTransientStateHelper(false);

        return (helper == null) ? null : helper.saveTransientState(context);
    }
105174
public Object saveState(FacesContext context) {

        if (context == null) {
            throw new NullPointerException();
        }
        
        // If initial state has been marked, we don't need to
        // save any state.
        if (initialStateMarked()) {
            return null;
        }

        // At the moment, the only state we need to save is our listeners
        return UIComponentBase.saveAttachedState(context, listeners);
    }
1195339
public static void initPartialValidationAndModelUpdate(
            UIComponent component, FacesContext facesContext)
    {
        String actionFor = (String) component.getAttributes().get("actionFor");

        if (actionFor != null)
        {
            List li = convertIdsToClientIds(actionFor, facesContext, component);

            facesContext.getExternalContext().getRequestMap()
                    .put(ACTION_FOR_LIST, li);

            String actionForPhase = (String) component.getAttributes().get(
                    "actionForPhase");

            if (actionForPhase != null)
            {
                List phaseList = convertPhasesToPhasesIds(actionForPhase);

                facesContext.getExternalContext().getRequestMap()
                        .put(ACTION_FOR_PHASE_LIST, phaseList);
            }
        }
    }
1241156
private static Map<String, ValueExpression> restoreBindings(FacesContext context,
                                                                Object state) {

        // Note: This code is copied from UIComponentBase.  See note above
        // in saveBindings().

        if (state == null) {
            return (null);
        }
        Object values[] = (Object[]) state;
        String names[] = (String[]) values[0];
        Object states[] = (Object[]) values[1];
        Map<String, ValueExpression> bindings = new HashMap<String, ValueExpression>(names.length);
        for (int i = 0; i < names.length; i++) {
            bindings.put(names[i],
                    (ValueExpression) UIComponentBase.restoreAttachedState(context, states[i]));
        }
        return (bindings);
    }