Package com.liferay.faces.portal.context

Examples of com.liferay.faces.portal.context.LiferayFacesContext


  protected static final String UNEXPECTED_ERROR_MSG_ID = "an-unexpected-error-occurred";
  protected static final String SUCCESS_INFO_MSG_ID = "your-request-processed-successfully";

  public void addGlobalSuccessInfoMessage() {
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    liferayFacesContext.addGlobalSuccessInfoMessage();
  }
View Full Code Here


    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    liferayFacesContext.addGlobalSuccessInfoMessage();
  }

  public void addGlobalUnexpectedErrorMessage() {
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    liferayFacesContext.addGlobalUnexpectedErrorMessage();
  }
View Full Code Here

  public void add() {
    setOriginalGuestbook(getSelectedGuestbook());

    Guestbook guestbook = new Guestbook(GuestbookUtil.create(0L));
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    guestbook.setGroupId(liferayFacesContext.getScopeGroupId());
    setSelectedGuestbook(guestbook);
    editGuestbook();
  }
View Full Code Here

  public void createMainGuestbook() {

    try {

      LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
      long scopeGroupId = liferayFacesContext.getScopeGroupId();

      com.liferay.docs.guestbook.model.Guestbook defaultGuestbook = (com.liferay.docs.guestbook.model.Guestbook)
        GuestbookLocalServiceUtil.getFirstGuestbookByName(scopeGroupId, DEFAULT_GUESTBOOK_NAME);

      // Create the default guestbook if it does not exist in the database
      if (defaultGuestbook == null) {
        logger.info("postConstruct: creating a default guestbook named " + DEFAULT_GUESTBOOK_NAME + " ...");

        Guestbook guestbook = new Guestbook(GuestbookUtil.create(0L));
        guestbook.setName(DEFAULT_GUESTBOOK_NAME);
        guestbook.setGroupId(scopeGroupId);
        guestbook.setCompanyId(liferayFacesContext.getCompanyId());
        guestbook.setUserId(liferayFacesContext.getUserId());
        GuestbookLocalServiceUtil.addGuestbook(guestbook);
      }
    }
    catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    createMainGuestbook();
  }

  public void save() {
    Guestbook guestbook = getSelectedGuestbook();
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    guestbook.setCompanyId(liferayFacesContext.getCompanyId());
    guestbook.setUserId(liferayFacesContext.getUserId());

    try {

      if (guestbook.getGuestbookId() == 0) {
        guestbook = new Guestbook(GuestbookLocalServiceUtil.addGuestbook(guestbook,
              liferayFacesContext.getUserId()));
      }
      else {
        guestbook = new Guestbook(GuestbookLocalServiceUtil.updateGuestbook(guestbook));
      }
View Full Code Here

  }

  public Boolean getHasAddPermission() {

    if (hasAddPermission == null) {
      LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
      long scopeGroupId = liferayFacesContext.getScopeGroupId();
      hasAddPermission = liferayFacesContext.getThemeDisplay().getPermissionChecker().hasPermission(scopeGroupId,
          MODEL, scopeGroupId, "ADD_GUESTBOOK");
    }

    return hasAddPermission;
  }
View Full Code Here

  @ManagedProperty(name = "guestbookBacking", value = "#{guestbookBacking}")
  protected GuestbookBacking guestbookBacking;

  public void add() {
    Entry entry = new Entry(EntryUtil.create(0L));
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    entry.setGroupId(liferayFacesContext.getScopeGroupId());
    entry.setGuestbookId(guestbookBacking.getSelectedGuestbook().getGuestbookId());
    guestbookBacking.setSelectedEntry(entry);
    guestbookBacking.editEntry();
  }
View Full Code Here

  }

  public void save() {

    Entry entry = guestbookBacking.getSelectedEntry();
    LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
    entry.setCompanyId(liferayFacesContext.getCompanyId());
    entry.setUserId(liferayFacesContext.getUserId());

    try {

      if (entry.getEntryId() == 0) {
        EntryLocalServiceUtil.addEntry(entry, liferayFacesContext.getUserId());
      }
      else {
        EntryLocalServiceUtil.updateEntry(entry);
      }
View Full Code Here

  }

  public Boolean getHasAddPermission() {

    if (hasAddPermission == null) {
      LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();
      long scopeGroupId = liferayFacesContext.getScopeGroupId();
      hasAddPermission = liferayFacesContext.getThemeDisplay().getPermissionChecker().hasPermission(scopeGroupId,
          GuestbookBacking.MODEL, scopeGroupId, "ADD_ENTRY");
    }

    return hasAddPermission;
  }
View Full Code Here

  }

  private void setLocale() {

    try {
      LiferayFacesContext liferayFacesContext = LiferayFacesContext.getInstance();

      // It's possible that the FacesServlet was invoked directly, and so this PhaseListener
      // needs to check to see if the request/response is part of a portlet environment before
      // proceeding further.
      if (liferayFacesContext.isPortletEnvironment()) {
        ThemeDisplay themeDisplay = liferayFacesContext.getThemeDisplay();

        if (themeDisplay != null) {
          Locale locale = themeDisplay.getLocale();

          if (locale != null) {
            UIViewRoot viewRoot = liferayFacesContext.getViewRoot();

            if (viewRoot != null) {
              viewRoot.setLocale(locale);
            }
            else {
View Full Code Here

TOP

Related Classes of com.liferay.faces.portal.context.LiferayFacesContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.