Java Code Examples for javax.faces.context.ExternalContext#getRequestParameterMap()

The following examples show how to use javax.faces.context.ExternalContext#getRequestParameterMap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String processDeleteAttach() {
  log.debug("processDeleteAttach()");

  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();

  Map<String, String> paramMap = context.getRequestParameterMap();

  if(paramMap != null) {
      final String attachId = paramMap.entrySet().stream().
              filter(entry -> entry.getKey().contains("pvmsg_current_attach")).
              collect(Collectors.collectingAndThen(Collectors.toList(), list -> list.isEmpty() ? null : list.get(0).getValue()));
      if (StringUtils.isNotEmpty(attachId)) {
          attachments.removeIf(da -> attachId.equalsIgnoreCase(da.getAttachment().getAttachmentId()));
      }
  }
  return null;
}
 
Example 2
Source File: SyllabusTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String processDeleteAttach() {
  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
  String attachId = null;
  
  Map paramMap = context.getRequestParameterMap();
  Iterator itr = paramMap.keySet().iterator();
  while(itr.hasNext()) {
    Object key = itr.next();
    if( key instanceof String && "syllabus_current_attach".equals((String) key)) {
        attachId = (String) paramMap.get(key);
        break;
    }
  }

  removeAttachId = attachId;

  if (StringUtils.isNotBlank(removeAttachId)) {
    return "remove_attach_confirm";
  } else {
    return null;
  }

}
 
Example 3
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String processDeleteAttach() {
  log.debug("processDeleteAttach()");

  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();

  Map<String, String> paramMap = context.getRequestParameterMap();

  if(paramMap != null) {
      final String attachId = paramMap.entrySet().stream().
              filter(entry -> entry.getKey().contains("pvmsg_current_attach")).
              collect(Collectors.collectingAndThen(Collectors.toList(), list -> list.isEmpty() ? null : list.get(0).getValue()));
      if (StringUtils.isNotEmpty(attachId)) {
          attachments.removeIf(da -> attachId.equalsIgnoreCase(da.getAttachment().getAttachmentId()));
      }
  }
  return null;
}
 
Example 4
Source File: SyllabusTool.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public String processDeleteAttach() {
  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
  String attachId = null;
  
  Map paramMap = context.getRequestParameterMap();
  Iterator itr = paramMap.keySet().iterator();
  while(itr.hasNext()) {
    Object key = itr.next();
    if( key instanceof String && "syllabus_current_attach".equals((String) key)) {
        attachId = (String) paramMap.get(key);
        break;
    }
  }

  removeAttachId = attachId;

  if (StringUtils.isNotBlank(removeAttachId)) {
    return "remove_attach_confirm";
  } else {
    return null;
  }

}
 
Example 5
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void selectDate(ActionEvent e) {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		String dateStr = (String) paramMap.get("selectedDay");
		DateFormat df = new SimpleDateFormat(msgs.getString("date_link_format"), msgs.getLocale());
		df.setTimeZone(getCurrentUserTimezone());
		selectedDay = df.parse(dateStr);
		selectedEventRef = null;
		updateEventList = true;
	}catch(Exception ex){
		log.error("Error getting selectedDate: {}", ex.toString());
	}
}
 
Example 6
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void selectEvent(ActionEvent e) {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		selectedCalendarRef = (String) paramMap.get("calendarRef");
		selectedEventRef = (String) paramMap.get("eventRef");
		selectedEvent = null;
		updateEventList = false;
	}catch(Exception ex){
		log.error("Error getting selectedEventRef: {}", ex.toString());
	}
}
 
Example 7
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public String processDeleteReplyAttach()
{
  log.debug("processDeleteReplyAttach()");
  
  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
  String attachId = null;
  
  Map paramMap = context.getRequestParameterMap();
  Iterator<Entry<Object, String>> itr = paramMap.entrySet().iterator();
  while(itr.hasNext())
  {
    Entry<Object, String> entry = itr.next();
    Object key = entry.getKey();
    if( key instanceof String)
    {
      String name =  (String)key;
      int pos = name.lastIndexOf("remsg_current_attach");
      
      if(pos>=0 && name.length()==pos+"remsg_current_attach".length())
      {
        attachId = entry.getValue();
        break;
      }
    }
  }
  
  if (StringUtils.isNotEmpty(attachId)) {
    for (int i = 0; i < allAttachments.size(); i++)
    {
      if (attachId.equalsIgnoreCase(((DecoratedAttachment) allAttachments.get(i)).getAttachment()
          .getAttachmentId()))
      {
        allAttachments.remove(i);
        break;
      }
    }
  }
  return null ;
}
 
Example 8
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * @return
 */
private String getExternalParameterByKey(String parameterId)
{    
  ExternalContext context = FacesContext.getCurrentInstance()
      .getExternalContext();
  Map paramMap = context.getRequestParameterMap();
  
  return (String) paramMap.get(parameterId);    
}
 
Example 9
Source File: MessageForumStatisticsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private String getExternalParameterByKey(String parameterId)
{    
	ExternalContext context = FacesContext.getCurrentInstance()
	.getExternalContext();
	Map paramMap = context.getRequestParameterMap();

	return (String) paramMap.get(parameterId);    
}
 
Example 10
Source File: SiteListBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public String processActionUserId() {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		userId = (String) paramMap.get("userId");
		refreshQuery = true;
		return "sitelist";
	}catch(Exception e){
		log.error("Error getting userId var.");
		return "userlist";
	}
}
 
Example 11
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void selectDate(ActionEvent e) {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		String dateStr = (String) paramMap.get("selectedDay");
		DateFormat df = new SimpleDateFormat(msgs.getString("date_link_format"), msgs.getLocale());
		df.setTimeZone(getCurrentUserTimezone());
		selectedDay = df.parse(dateStr);
		selectedEventRef = null;
		updateEventList = true;
	}catch(Exception ex){
		log.error("Error getting selectedDate: {}", ex.toString());
	}
}
 
Example 12
Source File: CalendarBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public void selectEvent(ActionEvent e) {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		selectedCalendarRef = (String) paramMap.get("calendarRef");
		selectedEventRef = (String) paramMap.get("eventRef");
		selectedEvent = null;
		updateEventList = false;
	}catch(Exception ex){
		log.error("Error getting selectedEventRef: {}", ex.toString());
	}
}
 
Example 13
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public String processDeleteReplyAttach()
{
  log.debug("processDeleteReplyAttach()");
  
  ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
  String attachId = null;
  
  Map paramMap = context.getRequestParameterMap();
  Iterator<Entry<Object, String>> itr = paramMap.entrySet().iterator();
  while(itr.hasNext())
  {
    Entry<Object, String> entry = itr.next();
    Object key = entry.getKey();
    if( key instanceof String)
    {
      String name =  (String)key;
      int pos = name.lastIndexOf("remsg_current_attach");
      
      if(pos>=0 && name.length()==pos+"remsg_current_attach".length())
      {
        attachId = entry.getValue();
        break;
      }
    }
  }
  
  if (StringUtils.isNotEmpty(attachId)) {
    for (int i = 0; i < allAttachments.size(); i++)
    {
      if (attachId.equalsIgnoreCase(((DecoratedAttachment) allAttachments.get(i)).getAttachment()
          .getAttachmentId()))
      {
        allAttachments.remove(i);
        break;
      }
    }
  }
  return null ;
}
 
Example 14
Source File: PrivateMessagesTool.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
/**
 * @return
 */
private String getExternalParameterByKey(String parameterId)
{    
  ExternalContext context = FacesContext.getCurrentInstance()
      .getExternalContext();
  Map paramMap = context.getRequestParameterMap();
  
  return (String) paramMap.get(parameterId);    
}
 
Example 15
Source File: MessageForumStatisticsBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private String getExternalParameterByKey(String parameterId)
{    
	ExternalContext context = FacesContext.getCurrentInstance()
	.getExternalContext();
	Map paramMap = context.getRequestParameterMap();

	return (String) paramMap.get(parameterId);    
}
 
Example 16
Source File: SiteListBean.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
public String processActionUserId() {
	try{
		ExternalContext context = FacesContext.getCurrentInstance().getExternalContext();
		Map paramMap = context.getRequestParameterMap();
		userId = (String) paramMap.get("userId");
		refreshQuery = true;
		return "sitelist";
	}catch(Exception e){
		log.error("Error getting userId var.");
		return "userlist";
	}
}