Package com.liferay.portal.service

Examples of com.liferay.portal.service.ServiceContext


  }

  public void addGuestbook(ActionRequest request, ActionResponse response)
      throws PortalException, SystemException {

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
        Guestbook.class.getName(), request);

    String name = ParamUtil.getString(request, "name");

    try {
      GuestbookLocalServiceUtil.addGuestbook(serviceContext.getUserId(),
          name, serviceContext);

      SessionMessages.add(request, "guestbookAdded");

    } catch (Exception e) {
View Full Code Here


  @Override
  public void render(RenderRequest renderRequest,
      RenderResponse renderResponse) throws PortletException, IOException {

    try {
      ServiceContext serviceContext = ServiceContextFactory.getInstance(
          Guestbook.class.getName(), renderRequest);

      long groupId = serviceContext.getScopeGroupId();

      long guestbookId = ParamUtil.getLong(renderRequest, "guestbookId");

      List<Guestbook> guestbooks = GuestbookLocalServiceUtil
          .getGuestbooks(groupId);

      if (guestbooks.size() == 0) {
        Guestbook guestbook = GuestbookLocalServiceUtil.addGuestbook(
            serviceContext.getUserId(), "Main", serviceContext);

        guestbookId = guestbook.getGuestbookId();

      }
View Full Code Here

public class GuestbookAdminPortlet extends MVCPortlet {

  public void addGuestbook(ActionRequest request, ActionResponse response)
      throws PortalException, SystemException {

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
        Guestbook.class.getName(), request);

    String name = ParamUtil.getString(request, "name");

    try {
      GuestbookLocalServiceUtil.addGuestbook(serviceContext.getUserId(),
          name, serviceContext);
     
      SessionMessages.add(request, "guestbookAdded");
    } catch (PortalException e) {
      SessionErrors.add(request, e.getClass().getName());
View Full Code Here

  }

  public void updateGuestbook(ActionRequest request, ActionResponse response)
      throws PortalException, SystemException {

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
        Guestbook.class.getName(), request);

    String name = ParamUtil.getString(request, "name");
    long guestbookId = ParamUtil.getLong(request, "guestbookId");

    try {
      GuestbookLocalServiceUtil.updateGuestbook(serviceContext.getUserId(), guestbookId,
          name, serviceContext);
     
      SessionMessages.add(request, "guestbookUpdated");
    } catch (PortalException pe) {
      SessionErrors.add(request, pe.getClass().getName());
View Full Code Here

  }

  public void deleteGuestbook(ActionRequest request, ActionResponse response)
      throws PortalException, SystemException {

    ServiceContext serviceContext = ServiceContextFactory.getInstance(
        Guestbook.class.getName(), request);

    long guestbookId = ParamUtil.getLong(request, "guestbookId");
   
    try {
View Full Code Here

    boolean manualMembership = false;
    int membershipRestriction = GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION;

    return GroupLocalServiceUtil.addGroup(userId, GroupConstants.DEFAULT_PARENT_GROUP_ID, (String) null, 0L,
        GroupConstants.DEFAULT_LIVE_GROUP_ID, name, description, type, manualMembership, membershipRestriction,
        friendlyURL, siteFlag, active, new ServiceContext());
  }
View Full Code Here

  }

  public static Layout addLayout(long userId, long groupId, boolean privateLayout, long parentLayoutId, String name,
    String title, String description, String type, boolean hidden, String friendlyURL) throws Exception {

    ServiceContext serviceContext = new ServiceContext();
    serviceContext.setScopeGroupId(groupId);

    return LayoutLocalServiceUtil.addLayout(userId, groupId, privateLayout, parentLayoutId, name, title,
        description, type, hidden, friendlyURL, serviceContext);
  }
View Full Code Here

    long[] groupIds = new long[] {};
    long[] organizationIds = new long[] {};
    long[] roleIds = new long[] {};
    long[] userGroupIds = new long[] {};
    boolean sendEmail = false;
    ServiceContext serviceContext = new ServiceContext();

    User user = null;

    try {
      user = UserLocalServiceUtil.getUserByScreenName(companyId, screenName);
View Full Code Here

    return groupUser;
  }

  public ServiceContext getServiceContext() {

    ServiceContext serviceContext = new ServiceContext();
    ThemeDisplay themeDisplay = getThemeDisplay();
    serviceContext.setCompanyId(themeDisplay.getCompanyId());
    serviceContext.setLanguageId(themeDisplay.getLanguageId());
    serviceContext.setPathMain(PortalUtil.getPathMain());
    serviceContext.setPlid(themeDisplay.getPlid());
    serviceContext.setPortalURL(PortalUtil.getPortalURL(getPortletRequest()));
    serviceContext.setScopeGroupId(themeDisplay.getScopeGroupId());
    serviceContext.setUserId(themeDisplay.getUserId());

    try {
      serviceContext.setLayoutFullURL(PortalUtil.getLayoutFullURL(themeDisplay));
      serviceContext.setLayoutURL(PortalUtil.getLayoutURL(themeDisplay));
      serviceContext.setUserDisplayURL(themeDisplay.getUser().getDisplayURL(themeDisplay));
    }
    catch (Exception e) {
      logger.error(e.getMessage(), e);
    }
View Full Code Here

    long[] groupIds = new long[] {};
    long[] organizationIds = new long[] {};
    long[] roleIds = new long[] {};

    long[] userGroupIds = new long[] {};
    ServiceContext serviceContext = new ServiceContext();

    // Add the user to the Liferay database (create an account).
    User user = UserLocalServiceUtil.addUser(creatorUserId, companyId, autoPassword, password1, password2,
        autoScreenName, screenName, emailAddress, facebookId, openId, locale, firstName, middleName, lastName,
        prefixId, suffixId, male, birthdayMonth, birthdayDay, birthdayYear, jobTitle, groupIds, organizationIds,
View Full Code Here

TOP

Related Classes of com.liferay.portal.service.ServiceContext

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.