Class ServiceContext

Object
com.liferay.portal.kernel.service.ServiceContext
All Implemented Interfaces:
Serializable, Cloneable

@JSON public class ServiceContext extends Object implements Cloneable, Serializable
Contains context information about a given API call.

The ServiceContext object simplifies method signatures and provides a way to consolidate many different methods with different sets of optional parameters into a single, easier to use method. It also aggregates information necessary for transversal features such as permissioning, tagging, categorization, etc.

Author:
Raymond Augé, Brian Wing Shun Chan, Jorge Ferrer
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a new service context object identical to this service context object.
    void
    deriveDefaultPermissions(long repositoryId, String modelName)
    Derive default permissions based on the logic found in portal-web/docroot/html/taglib/ui/input_permissions/page.jsp.
     
    long[]
    Returns the asset category IDs to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
    long[]
    Returns the primary keys of the asset entries linked to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
    double
    Returns the priority of an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
    Returns the asset tag names to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
    Returns the serializable object associated with the name of the standard parameter of this service context.
    Returns the map of name/value pairs that are the standard parameters of this service context.
    Returns the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
    long
    Returns the company ID of this service context's current portal instance.
    Returns the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
    getCreateDate(Date defaultCreateDate)
    Returns the date when an entity was created (or a default date) if this service context is being passed as a parameter to a method which creates an entity.
    Returns the current URL of this service context
    Returns an arbitrary number of attributes of an entity to be persisted.
    Returns the date when an aui:form was generated in this service context.
    long
    Returns this service context's user ID or guest ID if no user ID is available.
    Returns the the map of request header name/value pairs of this service context.
    Returns the language ID of the locale of this service context's current user.
    Returns the complete URL of the current page if a page context can be determined for this service context.
    Returns the relative URL of the current page if a page context can be determined for this service context.
     
     
     
     
    Returns the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity.
    getModifiedDate(Date defaultModifiedDate)
    Returns the date when an entity was modified if this service context is being passed as a parameter to a method which modifies an entity.
     
     
     
    Returns the main context path of the portal, concatenated with /c.
    long
    Returns the portal layout ID of the current page of this service context.
    Returns the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.
    Returns the ID of the current portlet if this service context is being passed as a parameter to a portlet.
    Returns the portlet preferences IDs of the current portlet if the service context is being passed as a parameter to a portlet.
    Returns the remote address of the user making the request in this service context.
    Returns the remote host name of the user making the request in this service context.
    javax.servlet.http.HttpServletRequest
     
    javax.servlet.http.HttpServletResponse
     
     
     
    long
    Returns the ID of the group corresponding to the current data scope of this service context.
     
     
    Returns the user-agent request header of this service context.
    Returns the complete URL of this service context's current user's profile page.
    long
    Returns the ID of this service context's current user.
    Returns the UUID of this service context's current entity.
     
    int
    Returns the workflow action to take if this service context is being passed as a parameter to a method that processes a workflow action.
    boolean
    Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply.
    boolean
    Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply.
    boolean
     
    boolean
    Returns true if this service context contains an add command (i.e. has command value Constants.ADD)
    boolean
    Returns true if this service context contains an update command (i.e. has command value Constants.UPDATE)
    boolean
     
    boolean
    Returns true if portal exceptions should be handled as failures, possibly halting processing, or false if the exceptions should be handled differently, possibly allowing processing to continue in some manner.
    boolean
    Returns whether the primary entity of this service context is to be indexed/re-indexed.
    boolean
    Returns true if the sender of this service context's request is signed in.
    boolean
     
    void
    merge(ServiceContext serviceContext)
    Merges all of the specified service context's non-null attributes, attributes greater than 0, and fields (except the request) with this service context object.
    Removes the mapping of the serializable object to the name of the standard parameter of this service context.
    void
    setAddGroupPermissions(boolean addGroupPermissions)
    Sets whether or not default group permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
    void
    setAddGuestPermissions(boolean addGuestPermissions)
    Sets whether or not default guest permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
    void
    setAssetCategoryIds(long[] assetCategoryIds)
    Sets an array of asset category IDs to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
    void
    setAssetEntryVisible(boolean assetEntryVisible)
     
    void
    setAssetLinkEntryIds(long[] assetLinkEntryIds)
    Sets an array of the primary keys of asset entries to be linked to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
    void
    setAssetPriority(double assetPriority)
    Sets the priority of an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
    void
    setAssetTagNames(String[] assetTagNames)
    Sets an array of asset tag names to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
    void
    Sets a mapping of a standard parameter's name to its serializable object.
    void
    Sets the map of the name/value pairs that are the standard parameters of this service context.
    void
    setCommand(String command)
    Sets the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
    void
    setCompanyId(long companyId)
    Sets the company ID of this service context's current portal instance.
    void
    setCreateDate(Date createDate)
    Sets the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
    void
    setCurrentURL(String currentURL)
    Sets the current URL of this service context
    void
    setDeriveDefaultPermissions(boolean deriveDefaultPermissions)
     
    void
    Sets an arbitrary number of attributes of an entity to be persisted.
    void
    setFailOnPortalException(boolean failOnPortalException)
    Sets whether portal exceptions should be handled as failures, possibly halting processing, or if exceptions should be handled differently, possibly allowing processing to continue in some manner.
    void
    setFormDate(Date formDate)
    Sets the date when an aui:form was generated in this service context.
    void
    Sets the map of request header name/value pairs of this service context.
    void
    setIndexingEnabled(boolean indexingEnabled)
    Sets whether the primary entity of this service context is to be indexed/re-indexed.
    void
    setLanguageId(String languageId)
    Sets the language ID of the locale of this service context.
    void
    setLayoutFullURL(String layoutFullURL)
    Sets the complete URL of the current page for this service context.
    void
    setLayoutURL(String layoutURL)
    Sets the relative URL of the current page for this service context.
    void
     
    void
    setModifiedDate(Date modifiedDate)
    Sets the date when an entity was modified in this service context.
    void
    setPathFriendlyURLPrivateGroup(String pathFriendlyURLPrivateGroup)
     
    void
    setPathFriendlyURLPrivateUser(String pathFriendlyURLPrivateUser)
     
    void
    setPathFriendlyURLPublic(String pathFriendlyURLPublic)
     
    void
    setPathMain(String pathMain)
    Sets the main context path of the portal, concatenated with /c.
    void
    setPlid(long plid)
    Sets the portal layout ID of the current page in this service context.
    void
    setPortalURL(String portalURL)
    Sets the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.
    void
    setPortletId(String portletId)
     
    void
    Sets the portlet preferences IDs of the current portlet if this service context is being passed as a parameter to a portlet.
    void
    setRemoteAddr(String remoteAddr)
    Sets the remote address of the user making the request in this service context.
    void
    setRemoteHost(String remoteHost)
    Sets the remote host name of the user making the request in this service context.
    void
    setRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
    Sets the optional request used when instantiating this service context.
    void
    setScopeGroupId(long scopeGroupId)
    Sets the ID of the group corresponding to the current data scope of this service context.
    void
    setSignedIn(boolean signedIn)
    Sets whether the sender of this service context's request is signed in.
    void
    setStrictAdd(boolean strictAdd)
     
    void
     
    void
    setUserDisplayURL(String userDisplayURL)
    Sets the complete URL of this service context's current user's profile page.
    void
    setUserId(long userId)
    Sets the ID of this service context's current user.
    void
    Sets the UUID of this service context's current entity.
    void
    setWorkflowAction(int workflowAction)
    Sets the workflow action to take if this service context is being passed as parameter to a method that processes a workflow action.
    translate(String pattern, Object... arguments)
     
    void
    validateModifiedDate(AuditedModel auditedModel, Class<? extends PortalException> clazz)
     

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ServiceContext

      public ServiceContext()
  • Method Details

    • clone

      public Object clone()
      Returns a new service context object identical to this service context object.
      Overrides:
      clone in class Object
      Returns:
      a new service context object
    • deriveDefaultPermissions

      public void deriveDefaultPermissions(long repositoryId, String modelName) throws PortalException
      Derive default permissions based on the logic found in portal-web/docroot/html/taglib/ui/input_permissions/page.jsp. Do not update this logic updating the logic in the JSP.
      Throws:
      PortalException
    • fetchUser

      public User fetchUser()
    • getAssetCategoryIds

      public long[] getAssetCategoryIds()
      Returns the asset category IDs to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
      Returns:
      the asset category IDs
    • getAssetLinkEntryIds

      public long[] getAssetLinkEntryIds()
      Returns the primary keys of the asset entries linked to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
      Returns:
      the primary keys of the asset entries
    • getAssetPriority

      public double getAssetPriority()
      Returns the priority of an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
      Returns:
      the asset entry's priority
    • getAssetTagNames

      public String[] getAssetTagNames()
      Returns the asset tag names to be applied to an asset entry if the service context is being passed as a parameter to a method which manipulates the asset entry.
      Returns:
      the asset tag names
    • getAttribute

      public Serializable getAttribute(String name)
      Returns the serializable object associated with the name of the standard parameter of this service context.
      Parameters:
      name - the name of the standard parameter
      Returns:
      the serializable object associated with the name
    • getAttributes

      public Map<String,Serializable> getAttributes()
      Returns the map of name/value pairs that are the standard parameters of this service context. Each value is serializable.
      Returns:
      the map of name/value pairs
    • getCommand

      public String getCommand()
      Returns the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
      Returns:
      the value of the command parameter
    • getCompanyId

      public long getCompanyId()
      Returns the company ID of this service context's current portal instance.
      Returns:
      the company ID
    • getCreateDate

      public Date getCreateDate()
      Returns the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
      Returns:
      the creation date
    • getCreateDate

      public Date getCreateDate(Date defaultCreateDate)
      Returns the date when an entity was created (or a default date) if this service context is being passed as a parameter to a method which creates an entity.
      Parameters:
      defaultCreateDate - an optional default create date to use if the service context does not have a create date
      Returns:
      the creation date if available; the default date otherwise
    • getCurrentURL

      public String getCurrentURL()
      Returns the current URL of this service context
      Returns:
      the current URL
    • getExpandoBridgeAttributes

      public Map<String,Serializable> getExpandoBridgeAttributes()
      Returns an arbitrary number of attributes of an entity to be persisted.

      These attributes only include fields that this service context does not possess by default.

      Returns:
      the expando bridge attributes
    • getFormDate

      public Date getFormDate()
      Returns the date when an aui:form was generated in this service context. The form date can be used in detecting situations in which an entity has been modified while another client was editing that entity.

      Example:

      Person1 and person2 start editing the same version of a Web Content article. Person1 publishes changes to the article first. When person2 attempts to publish changes to that article, the service implementation finds that a modification to that article has already been published some time after person2 started editing the article. Since the the article modification date was found to be later than the form date for person2, person2 could be alerted to the modification and make a backup copy of his edits before synchronizing with the published changes by person1.

    • getGuestOrUserId

      public long getGuestOrUserId() throws PortalException
      Returns this service context's user ID or guest ID if no user ID is available.
      Returns:
      the user ID, or guest ID if there is no user in this service context, or 0 if there is no company in this service context
      Throws:
      PortalException
    • getHeaders

      @JSON(include=false) public Map<String,String> getHeaders()
      Returns the the map of request header name/value pairs of this service context.
      Returns:
      the the map of request header name/value pairs
      See Also:
    • getLanguageId

      public String getLanguageId()
      Returns the language ID of the locale of this service context's current user.
      Returns:
      the language ID
    • getLayoutFullURL

      public String getLayoutFullURL()
      Returns the complete URL of the current page if a page context can be determined for this service context.
      Returns:
      the complete URL of the current page
    • getLayoutURL

      public String getLayoutURL()
      Returns the relative URL of the current page if a page context can be determined for this service context.
      Returns:
      the relative URL of the current page
    • getLiferayPortletRequest

      @JSON(include=false) public LiferayPortletRequest getLiferayPortletRequest()
    • getLiferayPortletResponse

      @JSON(include=false) public LiferayPortletResponse getLiferayPortletResponse()
    • getLocale

      public Locale getLocale()
    • getModelPermissions

      public ModelPermissions getModelPermissions()
    • getModifiedDate

      public Date getModifiedDate()
      Returns the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity.
      Returns:
      the date when an entity was modified if this service context is being passed as a parameter to a method which updates an entity
    • getModifiedDate

      public Date getModifiedDate(Date defaultModifiedDate)
      Returns the date when an entity was modified if this service context is being passed as a parameter to a method which modifies an entity.
      Parameters:
      defaultModifiedDate - an optional default modified date to use if this service context does not have a modified date
      Returns:
      the modified date if available; the default date otherwise
    • getPathFriendlyURLPrivateGroup

      public String getPathFriendlyURLPrivateGroup()
    • getPathFriendlyURLPrivateUser

      public String getPathFriendlyURLPrivateUser()
    • getPathFriendlyURLPublic

      public String getPathFriendlyURLPublic()
    • getPathMain

      public String getPathMain()
      Returns the main context path of the portal, concatenated with /c.
      Returns:
      the main context path of the portal
    • getPlid

      public long getPlid()
      Returns the portal layout ID of the current page of this service context.
      Returns:
      the portal layout ID of the current page
    • getPortalURL

      public String getPortalURL()
      Returns the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.

      The URL returned does not include the port if a default port is used.

      Returns:
      the URL of this service context's portal, including the protocol, domain, and non-default port relative to company instance and any virtual host
    • getPortletId

      public String getPortletId()
      Returns the ID of the current portlet if this service context is being passed as a parameter to a portlet.
      Returns:
      the ID of the current portlet
      See Also:
    • getPortletPreferencesIds

      public PortletPreferencesIds getPortletPreferencesIds()
      Returns the portlet preferences IDs of the current portlet if the service context is being passed as a parameter to a portlet.

      The PortletPreferencesIds can be used to look up portlet preferences of the current portlet.

      Returns:
      the portlet preferences IDs of the current portlet
      See Also:
    • getRemoteAddr

      public String getRemoteAddr()
      Returns the remote address of the user making the request in this service context.
      Returns:
      the remote address of the user making the request
    • getRemoteHost

      public String getRemoteHost()
      Returns the remote host name of the user making the request in this service context.
      Returns:
      the remote host name of the user making the request
    • getRequest

      @JSON(include=false) public javax.servlet.http.HttpServletRequest getRequest()
    • getResponse

      @JSON(include=false) public javax.servlet.http.HttpServletResponse getResponse()
    • getRootPortletId

      public String getRootPortletId()
    • getScopeGroup

      public Group getScopeGroup() throws PortalException
      Throws:
      PortalException
    • getScopeGroupId

      public long getScopeGroupId()
      Returns the ID of the group corresponding to the current data scope of this service context.
      Returns:
      the ID of the group corresponding to the current data scope
      See Also:
    • getThemeDisplay

      public ThemeDisplay getThemeDisplay()
    • getTimeZone

      public TimeZone getTimeZone()
    • getUserAgent

      public String getUserAgent()
      Returns the user-agent request header of this service context.
      Returns:
      the user-agent request header
      See Also:
    • getUserDisplayURL

      public String getUserDisplayURL()
      Returns the complete URL of this service context's current user's profile page.
      Returns:
      the complete URL of this service context's current user's profile page
    • getUserId

      public long getUserId()
      Returns the ID of this service context's current user.
      Returns:
      the ID of this service context's current user
    • getUuid

      public String getUuid()
      Returns the UUID of this service context's current entity.

      To ensure the same UUID is never used by two entities, the UUID is reset to null upon invoking this method.

      Returns:
      the UUID of this service context's current entity
    • getUuidWithoutReset

      public String getUuidWithoutReset()
    • getWorkflowAction

      public int getWorkflowAction()
      Returns the workflow action to take if this service context is being passed as a parameter to a method that processes a workflow action.
      Returns:
      the workflow action to take
    • isAddGroupPermissions

      public boolean isAddGroupPermissions()
      Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply.
      Returns:
      true if this service context is being passed as a parameter to a method which manipulates a resource to which default group permissions apply; false otherwise
    • isAddGuestPermissions

      public boolean isAddGuestPermissions()
      Returns true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply.
      Returns:
      true if this service context is being passed as a parameter to a method which manipulates a resource to which default guest permissions apply; false otherwise
    • isAssetEntryVisible

      public boolean isAssetEntryVisible()
    • isCommandAdd

      public boolean isCommandAdd()
      Returns true if this service context contains an add command (i.e. has command value Constants.ADD)
      Returns:
      true if this service context contains an add command; false otherwise
    • isCommandUpdate

      public boolean isCommandUpdate()
      Returns true if this service context contains an update command (i.e. has command value Constants.UPDATE)
      Returns:
      true if this service context contains an update command; false otherwise
    • isDeriveDefaultPermissions

      public boolean isDeriveDefaultPermissions()
    • isFailOnPortalException

      public boolean isFailOnPortalException()
      Returns true if portal exceptions should be handled as failures, possibly halting processing, or false if the exceptions should be handled differently, possibly allowing processing to continue in some manner. Services may check this flag to execute desired behavior.

      Batch invocation of such services (exposed as a JSON web services) can result in execution of all service invocations, in spite of portal exceptions.

      If this flag is set to false, services can implement logic that allows processing to continue, while collecting information regarding the exceptions for returning to the caller. For example, the AssetVocabularyServiceImpl.deleteVocabularies(long[], ServiceContext) method uses the list it returns to give information on vocabularies it fails to delete; it returns an empty list if all deletions are successful.

      Returns:
      true if portal exceptions are to be handled as failures; false if portal exceptions can be handled differently, possibly allowing processing to continue in some manner
    • isIndexingEnabled

      public boolean isIndexingEnabled()
      Returns whether the primary entity of this service context is to be indexed/re-indexed.
      Returns:
      true the primary entity of this service context is to be indexed/re-indexed; false otherwise
    • isSignedIn

      public boolean isSignedIn()
      Returns true if the sender of this service context's request is signed in.
      Returns:
      true if the sender of this service context's request is signed in; false otherwise
    • isStrictAdd

      public boolean isStrictAdd()
    • merge

      public void merge(ServiceContext serviceContext)
      Merges all of the specified service context's non-null attributes, attributes greater than 0, and fields (except the request) with this service context object.
      Parameters:
      serviceContext - the service context object to be merged
    • removeAttribute

      public Serializable removeAttribute(String name)
      Removes the mapping of the serializable object to the name of the standard parameter of this service context.
      Parameters:
      name - the name of the standard parameter
      Returns:
      the serializable object associated to the name
    • setAddGroupPermissions

      public void setAddGroupPermissions(boolean addGroupPermissions)
      Sets whether or not default group permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
      Parameters:
      addGroupPermissions - indicates whether or not to apply default group permissions
    • setAddGuestPermissions

      public void setAddGuestPermissions(boolean addGuestPermissions)
      Sets whether or not default guest permissions should apply to a resource being manipulated by a method to which this service context is passed as a parameter.
      Parameters:
      addGuestPermissions - indicates whether or not to apply default guest permissions
    • setAssetCategoryIds

      public void setAssetCategoryIds(long[] assetCategoryIds)
      Sets an array of asset category IDs to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
      Parameters:
      assetCategoryIds - the primary keys of the asset categories
    • setAssetEntryVisible

      public void setAssetEntryVisible(boolean assetEntryVisible)
    • setAssetLinkEntryIds

      public void setAssetLinkEntryIds(long[] assetLinkEntryIds)
      Sets an array of the primary keys of asset entries to be linked to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
      Parameters:
      assetLinkEntryIds - the primary keys of the asset entries to be linked to an asset entry
    • setAssetPriority

      public void setAssetPriority(double assetPriority)
      Sets the priority of an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
      Parameters:
      assetPriority - the priority of an asset entry
    • setAssetTagNames

      public void setAssetTagNames(String[] assetTagNames)
      Sets an array of asset tag names to be applied to an asset entry if this service context is being passed as a parameter to a method which manipulates the asset entry.
      Parameters:
      assetTagNames - the tag names to be applied to an asset entry
    • setAttribute

      public void setAttribute(String name, Serializable value)
      Sets a mapping of a standard parameter's name to its serializable object.
      Parameters:
      name - the standard parameter name to associate with the value
      value - the serializable object to be associated with the name
    • setAttributes

      public void setAttributes(Map<String,Serializable> attributes)
      Sets the map of the name/value pairs that are the standard parameters of this service context. Each value must be serializable.
      Parameters:
      attributes - the map of the name/value pairs that are the standard parameters of this service context
    • setCommand

      public void setCommand(String command)
      Sets the value of the Constants.CMD parameter used in most Liferay forms for internal portlets.
      Parameters:
      command - the value of the Constants.CMD parameter
    • setCompanyId

      public void setCompanyId(long companyId)
      Sets the company ID of this service context's current portal instance.
      Parameters:
      companyId - the primary key of this service context's current portal instance
    • setCreateDate

      public void setCreateDate(Date createDate)
      Sets the date when an entity was created if this service context is being passed as a parameter to a method which creates an entity.
      Parameters:
      createDate - the date the entity was created
    • setCurrentURL

      public void setCurrentURL(String currentURL)
      Sets the current URL of this service context
      Parameters:
      currentURL - the current URL of this service context
    • setDeriveDefaultPermissions

      public void setDeriveDefaultPermissions(boolean deriveDefaultPermissions)
    • setExpandoBridgeAttributes

      public void setExpandoBridgeAttributes(Map<String,Serializable> expandoBridgeAttributes)
      Sets an arbitrary number of attributes of an entity to be persisted.

      These attributes should only include fields that ServiceContext does not possess by default.

      Parameters:
      expandoBridgeAttributes - the expando bridge attributes (optionally null)
    • setFailOnPortalException

      public void setFailOnPortalException(boolean failOnPortalException)
      Sets whether portal exceptions should be handled as failures, possibly halting processing, or if exceptions should be handled differently, possibly allowing processing to continue in some manner.
      Parameters:
      failOnPortalException - whether portal exceptions should be handled as failures, or if portal exceptions should be handled differently, possibly allowing processing to continue in some manner
      See Also:
    • setFormDate

      public void setFormDate(Date formDate)
      Sets the date when an aui:form was generated in this service context. The form date can be used in detecting situations in which an entity has been modified while another client was editing that entity.

      Example:

      Person1 and person2 start editing the same version of a Web Content article. Person1 publishes changes to the article first. When person2 attempts to publish changes to that article, the service implementation finds that a modification to that article has already been published some time after person2 started editing the article. Since the article modification date was found to be later than the form date for person2, person2 could be alerted to the modification and make a backup copy of his edits before synchronizing with the published changes by person1.

      Parameters:
      formDate - the date that an aui:form was generated for this service context (optionally null)
    • setHeaders

      public void setHeaders(Map<String,String> headers)
      Sets the map of request header name/value pairs of this service context.
      Parameters:
      headers - map of request header name/value pairs of this service context
      See Also:
    • setIndexingEnabled

      public void setIndexingEnabled(boolean indexingEnabled)
      Sets whether the primary entity of this service context is to be indexed/re-indexed.

      The entity is only indexed/re-indexed if the method receiving this service context as a parameter does indexing.

      Parameters:
      indexingEnabled - whether the primary entity of this service context is to be indexed/re-indexed (default is true)
    • setLanguageId

      public void setLanguageId(String languageId)
      Sets the language ID of the locale of this service context.
      Parameters:
      languageId - the language ID of the locale of this service context's current user
    • setLayoutFullURL

      public void setLayoutFullURL(String layoutFullURL)
      Sets the complete URL of the current page for this service context.
      Parameters:
      layoutFullURL - the complete URL of the current page if a page context can be determined for this service context
    • setLayoutURL

      public void setLayoutURL(String layoutURL)
      Sets the relative URL of the current page for this service context.
      Parameters:
      layoutURL - the relative URL of the current page if a page context can be determined for this service context
    • setModelPermissions

      public void setModelPermissions(ModelPermissions modelPermissions)
    • setModifiedDate

      public void setModifiedDate(Date modifiedDate)
      Sets the date when an entity was modified in this service context.
      Parameters:
      modifiedDate - the date when an entity was modified in this service context
    • setPathFriendlyURLPrivateGroup

      public void setPathFriendlyURLPrivateGroup(String pathFriendlyURLPrivateGroup)
    • setPathFriendlyURLPrivateUser

      public void setPathFriendlyURLPrivateUser(String pathFriendlyURLPrivateUser)
    • setPathFriendlyURLPublic

      public void setPathFriendlyURLPublic(String pathFriendlyURLPublic)
    • setPathMain

      public void setPathMain(String pathMain)
      Sets the main context path of the portal, concatenated with /c.
      Parameters:
      pathMain - the main context path of the portal
    • setPlid

      public void setPlid(long plid)
      Sets the portal layout ID of the current page in this service context.
      Parameters:
      plid - the portal layout ID of the current page
    • setPortalURL

      public void setPortalURL(String portalURL)
      Sets the URL of this service context's portal, including the protocol, domain, and non-default port relative to the company instance and any virtual host.

      The URL should not include the port if a default port is used.

      Parameters:
      portalURL - the portal URL
    • setPortletId

      public void setPortletId(String portletId)
    • setPortletPreferencesIds

      public void setPortletPreferencesIds(PortletPreferencesIds portletPreferencesIds)
      Sets the portlet preferences IDs of the current portlet if this service context is being passed as a parameter to a portlet.

      The PortletPreferencesIds can be used to look up portlet preferences of the current portlet.

      Parameters:
      portletPreferencesIds - the portlet preferences
      See Also:
    • setRemoteAddr

      public void setRemoteAddr(String remoteAddr)
      Sets the remote address of the user making the request in this service context.
      Parameters:
      remoteAddr - the remote address of the user making the request in this service context
    • setRemoteHost

      public void setRemoteHost(String remoteHost)
      Sets the remote host name of the user making the request in this service context.
      Parameters:
      remoteHost - the remote host name of the user making the request in this service context
    • setRequest

      public void setRequest(javax.servlet.http.HttpServletRequest httpServletRequest)
      Sets the optional request used when instantiating this service context. The field is volatile and so will be discarded on serialization.
      Parameters:
      httpServletRequest - the request
    • setScopeGroupId

      public void setScopeGroupId(long scopeGroupId)
      Sets the ID of the group corresponding to the current data scope of this service context.
      Parameters:
      scopeGroupId - the ID of the group corresponding to the current data scope of this service context
      See Also:
    • setSignedIn

      public void setSignedIn(boolean signedIn)
      Sets whether the sender of this service context's request is signed in.
      Parameters:
      signedIn - whether the sender of this service context's request is signed in
    • setStrictAdd

      public void setStrictAdd(boolean strictAdd)
    • setTimeZone

      public void setTimeZone(TimeZone timeZone)
    • setUserDisplayURL

      public void setUserDisplayURL(String userDisplayURL)
      Sets the complete URL of this service context's current user's profile page.
      Parameters:
      userDisplayURL - the complete URL of the current user's profile page
    • setUserId

      public void setUserId(long userId)
      Sets the ID of this service context's current user.
      Parameters:
      userId - the ID of the current user
    • setUuid

      public void setUuid(String uuid)
      Sets the UUID of this service context's current entity.
      Parameters:
      uuid - the UUID of the current entity
    • setWorkflowAction

      public void setWorkflowAction(int workflowAction)
      Sets the workflow action to take if this service context is being passed as parameter to a method that processes a workflow action.
      Parameters:
      workflowAction - workflow action to take (default is WorkflowConstants.ACTION_PUBLISH)
    • translate

      public String translate(String pattern, Object... arguments)
    • validateModifiedDate

      public void validateModifiedDate(AuditedModel auditedModel, Class<? extends PortalException> clazz) throws PortalException
      Throws:
      PortalException