Package com.liferay.portal.service

Examples of com.liferay.portal.service.ServiceContext


    if (amPm == Calendar.PM) {
      hour += 12;
    }

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

    Event event = null;

    if (eventId <= 0) {
      event = EventServiceUtil.addEvent(
        serviceContext.getScopeGroupId(), name, description, month, day,
        year, hour, minute, locationId, serviceContext);
    }
    else {
      event = EventServiceUtil.getEvent(eventId);

      event = EventServiceUtil.updateEvent(
        serviceContext.getUserId(), eventId, name, description, month,
        day, year, hour, minute, locationId, serviceContext);
    }

    return event;
  }
View Full Code Here


    String streetAddress = (ParamUtil.getString(request, "streetAddress"));
    String city = (ParamUtil.getString(request, "city"));
    String stateOrProvince = (ParamUtil.getString(request, "stateOrProvince"));
    String country = (ParamUtil.getString(request, "country"));

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

    Location location = null;

    if (locationId <= 0) {

      location = LocationLocalServiceUtil.addLocation(
        serviceContext.getUserId(), serviceContext.getScopeGroupId(), name, description,
        streetAddress, city, stateOrProvince, country, serviceContext);
    }
    else {
      location = LocationLocalServiceUtil.getLocation(locationId);

      location = LocationLocalServiceUtil.updateLocation(
          serviceContext.getUserId(), locationId, name,
          description, streetAddress, city, stateOrProvince, country,
          serviceContext);
    }

    return location;
View Full Code Here

      if (amPm == Calendar.PM) {
        hour += 12;
      }

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

      Event event = null;

      if (eventId <= 0) {
        event = EventServiceUtil.addEvent(
          serviceContext.getScopeGroupId(), name, description, month, day,
          year, hour, minute, locationId, serviceContext);
      }
      else {
        event = EventServiceUtil.getEvent(eventId);

        event = EventServiceUtil.updateEvent(
          serviceContext.getUserId(), eventId, name, description, month,
          day, year, hour, minute, locationId, serviceContext);
      }

      return event;
    }
View Full Code Here

    if (amPm == Calendar.PM) {
      hour += 12;
    }

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

    Event event = null;

    if (eventId <= 0) {
      event = EventServiceUtil.addEvent(
        serviceContext.getScopeGroupId(), name, description, month, day,
        year, hour, minute, locationId, serviceContext);
    }
    else {
      event = EventServiceUtil.getEvent(eventId);

      event = EventServiceUtil.updateEvent(
        serviceContext.getUserId(), eventId, name, description, month,
        day, year, hour, minute, locationId, serviceContext);
    }

    return event;
  }
View Full Code Here

    String streetAddress = (ParamUtil.getString(request, "streetAddress"));
    String city = (ParamUtil.getString(request, "city"));
    String stateOrProvince = (ParamUtil.getString(request, "stateOrProvince"));
    String country = (ParamUtil.getString(request, "country"));

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

    Location location = null;

    if (locationId <= 0) {

      location = LocationLocalServiceUtil.addLocation(
        serviceContext.getUserId(), serviceContext.getScopeGroupId(), name, description,
        streetAddress, city, stateOrProvince, country, serviceContext);
    }
    else {
      location = LocationLocalServiceUtil.getLocation(locationId);

      location = LocationLocalServiceUtil.updateLocation(
          serviceContext.getUserId(), locationId, name,
          description, streetAddress, city, stateOrProvince, country,
          serviceContext);
    }

    return location;
View Full Code Here

      addLayoutTemplate(getInputStream(file));
    }
  }

  protected void doImportResources() throws Exception {
    serviceContext = new ServiceContext();

    serviceContext.setAddGroupPermissions(true);
    serviceContext.setAddGuestPermissions(true);
    serviceContext.setScopeGroupId(groupId);
View Full Code Here

      layoutSetPrototype);
  }

  protected void setupSitemap(String fileName) throws Exception {
    LayoutLocalServiceUtil.deleteLayouts(
      groupId, true, new ServiceContext());

    LayoutLocalServiceUtil.deleteLayouts(
      groupId, false, new ServiceContext());

    JSONObject jsonObject = getJSONObject(fileName);

    if (jsonObject == null) {
      return;
View Full Code Here

      }
      else {
        layoutSetPrototype =
          LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(
            userId, companyId, getTargetValueMap(),
            StringPool.BLANK, true, true, new ServiceContext());
      }

      group = layoutSetPrototype.getGroup();

      targetClassPK = layoutSetPrototype.getLayoutSetPrototypeId();
    }
    else if (targetClassName.equals(Group.class.getName())) {
      if (targetValue.equals(GroupConstants.GLOBAL)) {
        group = GroupLocalServiceUtil.getCompanyGroup(companyId);
      }
      else if (targetValue.equals(GroupConstants.GUEST)) {
        group = GroupLocalServiceUtil.getGroup(
          companyId, GroupConstants.GUEST);

        List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(
          group.getGroupId(), false,
          LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, false, 0, 1);

        if (!layouts.isEmpty()) {
          Layout layout = layouts.get(0);

          LayoutTypePortlet layoutTypePortlet =
            (LayoutTypePortlet)layout.getLayoutType();

          List<String> portletIds = layoutTypePortlet.getPortletIds();

          if (portletIds.size() != 2) {
            existing = true;
          }

          for (String portletId : portletIds) {
            if (!portletId.equals("47") &&
              !portletId.equals("58")) {

              existing = true;
            }
          }
        }
      }
      else {
        group = GroupLocalServiceUtil.fetchGroup(
          companyId, targetValue);

        if (group != null) {
          existing = true;
        }
        else {
          group = GroupLocalServiceUtil.addGroup(
            userId, GroupConstants.DEFAULT_PARENT_GROUP_ID,
            StringPool.BLANK,
            GroupConstants.DEFAULT_PARENT_GROUP_ID,
            GroupConstants.DEFAULT_LIVE_GROUP_ID, targetValue,
            StringPool.BLANK, GroupConstants.TYPE_SITE_OPEN, true,
            GroupConstants.DEFAULT_MEMBERSHIP_RESTRICTION, null,
            true, true, new ServiceContext());
        }
      }

      targetClassPK = group.getGroupId();
    }
View Full Code Here

public class GuestbookPortlet extends MVCPortlet {

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

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

    String userName = ParamUtil.getString(request, "name");
    String email = ParamUtil.getString(request, "email");
    String message = ParamUtil.getString(request, "message");
    long guestbookId = ParamUtil.getLong(request, "guestbookId");
    long entryId = ParamUtil.getLong(request, "entryId");

    if (entryId > 0) {
      try {
        EntryLocalServiceUtil.updateEntry(serviceContext.getUserId(),
            guestbookId, entryId, userName, email, message,
            serviceContext);

        SessionMessages.add(request, "entryAdded");

        response.setRenderParameter("guestbookId",
            Long.toString(guestbookId));
      } catch (Exception e) {
        SessionErrors.add(request, e.getClass().getName());
       
        PortalUtil.copyRequestParameters(request, response);

        response.setRenderParameter("mvcPath",
            "/html/guestbook/edit_entry.jsp");
      }
    }
    else {
      try {
        EntryLocalServiceUtil.addEntry(serviceContext.getUserId(),
            guestbookId, userName, email, message, serviceContext);

        SessionMessages.add(request, "entryAdded");

        response.setRenderParameter("guestbookId",
View Full Code Here

   
    long entryId = ParamUtil.getLong(request, "entryId");
    long guestbookId = ParamUtil.getLong(request, "guestbookId");
   
    try {
      ServiceContext serviceContext = ServiceContextFactory.getInstance(
        Entry.class.getName(), request);
     
      response.setRenderParameter("guestbookId",
          Long.toString(guestbookId));
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.